Merge "Sanitizer::safeEncodeAttribute(): also encode ]"
[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 No p-wrappable content
1917 !! wikitext
1918 <span><div>x</div></span>
1919 <span><s><div>x</div></s></span>
1920 <small><em></em></small><span><s><div>x</div></s></span>
1921 !! html+tidy
1922 <div><span>x</span></div>
1923 <div><span><s>x</s></span></div>
1924 <div><span><s>x</s></span></div>
1925 !! html/parsoid
1926 <span><div>x</div></span>
1927 <span><s><div>x</div></s></span>
1928 <small><em></em></small><span><s><div>x</div></s></span>
1929 !! end
1930
1931 # T177612: Parsoid-only test
1932 !! test
1933 Transclusion meta tags shouldn't trip Parsoid's useless p-wrapper stripping code
1934 !! wikitext
1935 {{echo|<span><div>x</div></span>}}
1936 x
1937 !! html/parsoid
1938 <span about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"stx":"html","pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;span>&lt;div>x&lt;/div>&lt;/span>"}},"i":0}}]}'><div>x</div></span>
1939 <p>x</p>
1940 !! end
1941
1942 !! test
1943 Block tag on one line (<blockquote>)
1944 !! wikitext
1945 a <blockquote>foo</blockquote>
1946
1947 b
1948 !! html
1949 a <blockquote>foo</blockquote>
1950 <p>b
1951 </p>
1952 !! html+tidy
1953 <p>a</p>
1954 <blockquote>
1955 <p>foo</p>
1956 </blockquote>
1957 <p>b</p>
1958 !! end
1959
1960 !! test
1961 Block tag on both lines (<div>)
1962 !! wikitext
1963 a <div>foo</div>
1964
1965 b <div>foo</div>
1966 !! html
1967 a <div>foo</div>
1968 b <div>foo</div>
1969
1970 !! html+tidy
1971 <p>a</p>
1972 <div>foo</div>
1973 <p>b</p>
1974 <div>foo</div>
1975 !! end
1976
1977 !! test
1978 Block tag on both lines (<blockquote>)
1979 !! wikitext
1980 a <blockquote>foo</blockquote>
1981
1982 b <blockquote>foo</blockquote>
1983 !! html
1984 a <blockquote>foo</blockquote>
1985 b <blockquote>foo</blockquote>
1986
1987 !! html+tidy
1988 <p>a</p>
1989 <blockquote>
1990 <p>foo</p>
1991 </blockquote>
1992 <p>b</p>
1993 <blockquote>
1994 <p>foo</p>
1995 </blockquote>
1996 !! end
1997
1998 !! test
1999 Multiple lines without block tags
2000 !! wikitext
2001 <div>foo</div> a
2002 b
2003 c
2004 d<!--foo--> e
2005 x <div>foo</div> z
2006 !! html
2007 <div>foo</div> a
2008 <p>b
2009 c
2010 d e
2011 </p>
2012 x <div>foo</div> z
2013
2014 !! html+tidy
2015 <div>foo</div>
2016 <p>a</p>
2017 <p>b c d e</p>
2018 <p>x</p>
2019 <div>foo</div>
2020 <p>z</p>
2021 !! end
2022
2023 # Tidy strips out the empty <div> tags. Parsoid doesn't.
2024 # So, we have a separate section for Parsoid. We don't want
2025 # to mimic this stripping behavior in Parsoid. It affects
2026 # editing experience and also requires us to maintain additional
2027 # info for RT-ing.
2028 !! test
2029 Empty lines between lines with block tags
2030 !! wikitext
2031 <div></div>
2032
2033
2034 <div></div>a
2035
2036 b
2037 <div>a</div>b
2038
2039 <div>b</div>d
2040
2041
2042 <div>e</div>
2043 !! html
2044 <div></div>
2045 <p><br />
2046 </p>
2047 <div></div>a
2048 <p>b
2049 </p>
2050 <div>a</div>b
2051 <div>b</div>d
2052 <p><br />
2053 </p>
2054 <div>e</div>
2055
2056 !! html+tidy
2057 <p><br /></p>
2058 <p>a</p>
2059 <p>b</p>
2060 <div>a</div>
2061 <p>b</p>
2062 <div>b</div>
2063 <p>d</p>
2064 <p><br /></p>
2065 <div>e</div>
2066 !! html/parsoid
2067 <div data-parsoid='{"stx":"html"}'></div>
2068
2069 <p><br /></p>
2070 <div data-parsoid='{"stx":"html"}'></div><p>a</p>
2071
2072 <p>b</p>
2073 <div data-parsoid='{"stx":"html"}'>a</div><p>b</p>
2074
2075 <div data-parsoid='{"stx":"html"}'>b</div><p>d</p>
2076
2077 <p><br /></p>
2078 <div data-parsoid='{"stx":"html"}'>e</div>
2079 !! end
2080
2081 ## PHP parser emits output which is broken
2082 !! test
2083 Unclosed HTML p-tags should be handled properly
2084 !! wikitext
2085 <div><p>foo</div>
2086 a
2087
2088 b
2089 !! html/php+tidy
2090 <div>
2091 <p>foo</p>
2092 </div>
2093 <p>a</p>
2094 <p>b</p>
2095 !! html/parsoid
2096 <div data-parsoid='{"stx":"html"}'><p data-parsoid='{"stx":"html", "autoInsertedEnd":true}'>foo</p></div>
2097 <p>a</p>
2098 <p>b</p>
2099 !! end
2100
2101 ## SSS FIXME: I can come up with other scenarios where this doesn't work because
2102 ## of eager output of buffered tokens in the p-wrapper. But, I'm going to ignore
2103 ## them for now.
2104 !! test
2105 1. P-wrapping should leave sol-transparent tags outside p-tags where possible
2106 !! options
2107 parsoid=wt2html
2108 !! wikitext
2109 a [[Category:A1]] [[Category:A2]]
2110 [[Category:A3]]
2111 [[Category:A4]]
2112 !! html/parsoid
2113 <p>a</p>
2114 <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"/>
2115 !! end
2116
2117 !! test
2118 2. P-wrapping should leave sol-transparent tags outside p-tags where possible
2119 !! options
2120 parsoid=wt2html
2121 !! wikitext
2122 [[Category:A1]]a
2123 !! html/parsoid
2124 <link rel="mw:PageProp/Category" href="./Category:A1"/><p>a</p>
2125 !! end
2126
2127 ###
2128 ### Preformatted text
2129 ###
2130 !! test
2131 Preformatted text
2132 !! wikitext
2133 This is some
2134 Preformatted text
2135 With ''italic''
2136 And '''bold'''
2137 And a [[Main Page|link]]
2138 !! html
2139 <pre>This is some
2140 Preformatted text
2141 With <i>italic</i>
2142 And <b>bold</b>
2143 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
2144 </pre>
2145 !! end
2146
2147 !! test
2148 Tabs don't trigger preformatted text
2149 !! wikitext
2150 This is not
2151 preformatted text.
2152 This is preformatted text.
2153 So is this.
2154 !! html/php
2155 <p> This is not
2156 preformatted text.
2157 </p>
2158 <pre>This is preformatted text.
2159 So is this.
2160 </pre>
2161 !! html/parsoid
2162 <p> This is not
2163 preformatted text.</p>
2164 <pre>This is preformatted text.
2165 So is this.</pre>
2166 !! end
2167
2168 !! test
2169 Space before tab needs nowiki pre protection
2170 !! options
2171 parsoid=html2wt
2172 !! html/parsoid
2173 <p> a</p>
2174 !! wikitext
2175 <nowiki> </nowiki> a
2176 !! end
2177
2178 !! test
2179 Ident preformatting with inline content
2180 !! wikitext
2181 a
2182 ''b''
2183 !! html
2184 <pre>a
2185 <i>b</i>
2186 </pre>
2187 !! end
2188
2189 !! test
2190 <pre> with <nowiki> inside (compatibility with 1.6 and earlier)
2191 !! wikitext
2192 <pre><nowiki>
2193 <b>
2194 <cite>
2195 <em>
2196 </nowiki></pre>
2197 !! html
2198 <pre>
2199 &lt;b&gt;
2200 &lt;cite&gt;
2201 &lt;em&gt;
2202 </pre>
2203
2204 !! end
2205
2206 !! test
2207 Regression with preformatted in <center>
2208 !! wikitext
2209 <center>
2210 Blah
2211 </center>
2212 !! html
2213 <center>
2214 <pre>Blah
2215 </pre>
2216 </center>
2217
2218 !! end
2219
2220 !! test
2221 T54763: Preformatted in <blockquote>
2222 !! wikitext
2223 <blockquote>
2224 Blah
2225 {|
2226 |
2227 indented cell (no pre-wrapping!)
2228 |}
2229 </blockquote>
2230 !! html
2231 <blockquote>
2232 <p> Blah
2233 </p>
2234 <table>
2235 <tr>
2236 <td>
2237 <p> indented cell (no pre-wrapping!)
2238 </p>
2239 </td></tr></table>
2240 </blockquote>
2241
2242 !! end
2243
2244 !! test
2245 T53086: Double newlines in blockquotes should be turned into paragraphs
2246 !! wikitext
2247 <blockquote>
2248 Foo
2249
2250 Bar
2251 </blockquote>
2252 !! html
2253 <blockquote>
2254 <p>Foo
2255 </p><p>Bar
2256 </p>
2257 </blockquote>
2258
2259 !! end
2260
2261 !! test
2262 T17491: <ins>/<del> in blockquote
2263 !! wikitext
2264 <blockquote>
2265 Foo <del>bar</del> <ins>baz</ins> quux
2266 </blockquote>
2267 !! html
2268 <blockquote>
2269 <p>Foo <del>bar</del> <ins>baz</ins> quux
2270 </p>
2271 </blockquote>
2272
2273 !! end
2274
2275 # Note that the p-wrapping is newline sensitive, which could be
2276 # considered a bug: tidy will wrap only the 'Foo' in the example
2277 # below in a <p> tag. (see comment 23-25 of T8200)
2278 !! test
2279 T17491: <ins>/<del> in blockquote (2)
2280 !! wikitext
2281 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
2282 </blockquote>
2283 !! html
2284 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
2285 </blockquote>
2286
2287 !! html+tidy
2288 <blockquote>
2289 <p>Foo</p>
2290 <del>bar</del> <ins>baz</ins> quux</blockquote>
2291 !! end
2292
2293 !! test
2294 <pre> with attributes (T5202)
2295 !! wikitext
2296 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
2297 !! html
2298 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
2299
2300 !! end
2301
2302 !! test
2303 <pre> with width attribute (T5202)
2304 !! wikitext
2305 <pre width="8">Narrow screen goodies</pre>
2306 !! html
2307 <pre width="8">Narrow screen goodies</pre>
2308
2309 !! end
2310
2311 !! test
2312 <pre> with forbidden attribute (T5202)
2313 !! wikitext
2314 <pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
2315 !! html
2316 <pre width="8">Narrow screen goodies</pre>
2317
2318 !! end
2319
2320 !! test
2321 Entities inside <pre>
2322 !! wikitext
2323 <pre>&lt;</pre>
2324 !! html
2325 <pre>&lt;</pre>
2326
2327 !! end
2328
2329 !! test
2330 <pre> with forbidden attribute values (T5202)
2331 !! wikitext
2332 <pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
2333 !! html
2334 <pre width="8" style="/* insecure input */">Narrow screen goodies</pre>
2335
2336 !! end
2337
2338 !! test
2339 <nowiki> inside <pre> (T15238)
2340 !! wikitext
2341 <pre>
2342 <nowiki>
2343 </pre>
2344 <pre>
2345 <nowiki></nowiki>
2346 </pre>
2347 <pre><nowiki><nowiki></nowiki>Foo<nowiki></nowiki></nowiki></pre>
2348 !! html
2349 <pre>
2350 &lt;nowiki&gt;
2351 </pre>
2352 <pre>
2353
2354 </pre>
2355 <pre>&lt;nowiki&gt;Foo&lt;/nowiki&gt;</pre>
2356
2357 !! end
2358
2359 !! test
2360 <nowiki> inside of #tag:pre
2361 !! wikitext
2362 {{#tag:pre|Foo <nowiki>&rarr;bar</nowiki>}}
2363 !! html/php
2364 <pre>Foo &#8594;bar</pre>
2365
2366 !! html/parsoid
2367 <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>
2368 !! end
2369
2370 ## Don't expect this to rt, Parsoid drops the unmatched closing pre tags that
2371 ## aren't enclosed in nowikis.
2372 !! test
2373 <nowiki> and <pre> preference (first one wins)
2374 !! options
2375 parsoid=wt2html
2376 !! wikitext
2377 <pre>
2378 <nowiki>
2379 </pre>
2380 </nowiki>
2381 </pre>
2382
2383 <nowiki>
2384 <pre>
2385 <nowiki>
2386 </pre>
2387 </nowiki>
2388 </pre>
2389
2390 !! html/php
2391 <pre>
2392 &lt;nowiki&gt;
2393 </pre>
2394 <p>&lt;/nowiki&gt;
2395 &lt;/pre&gt;
2396 </p><p>
2397 &lt;pre&gt;
2398 &lt;nowiki&gt;
2399 &lt;/pre&gt;
2400
2401 &lt;/pre&gt;
2402 </p>
2403 !! html/parsoid
2404 <pre typeof="mw:Extension/pre" about="#mwt2" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\n&lt;nowiki>\n"}}'>&lt;nowiki>
2405 </pre>
2406 <p>&lt;/nowiki></p>
2407
2408
2409 <p><span typeof="mw:Nowiki">
2410 &lt;pre>
2411 &lt;nowiki>
2412 &lt;/pre>
2413 </span></p>
2414 !! end
2415
2416 !! test
2417 </pre> inside nowiki
2418 !! wikitext
2419 <nowiki></pre></nowiki>
2420 !! html
2421 <p>&lt;/pre&gt;
2422 </p>
2423 !! end
2424
2425 # Parsoid doesn't strip empty tags, like Tidy does.
2426 !! test
2427 Empty pre; pre inside other HTML tags (T56946)
2428 !! wikitext
2429 a
2430
2431 <div><pre>
2432 foo
2433 </pre></div>
2434 <pre></pre>
2435 !! html/php
2436 <p>a
2437 </p>
2438 <div><pre>
2439 foo
2440 </pre></div>
2441 <pre></pre>
2442
2443 !! html/php+tidy
2444 <p>a</p>
2445 <div>
2446 <pre>
2447 foo
2448 </pre></div>
2449 !! html/parsoid
2450 <p>a</p>
2451
2452 <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
2453 </pre></div>
2454 <pre typeof="mw:Extension/pre" about="#mwt4" data-parsoid='{"stx":"html"}' data-mw='{"name":"pre","attrs":{},"body":{"extsrc":""}}'></pre>
2455 !! end
2456
2457 !! test
2458 HTML pre followed by indent-pre
2459 !! wikitext
2460 <pre>foo</pre>
2461 bar
2462 !! html
2463 <pre>foo</pre>
2464 <pre>bar
2465 </pre>
2466 !! end
2467
2468 # Note that tidy removes the empty <p> tags from the start and end.
2469 # Parsoid does not, by design.
2470 !! test
2471 Block tag pre
2472 !! wikitext
2473 <p><pre>foo</pre></p>
2474 !! html/php+tidy
2475 <pre>
2476 foo
2477 </pre>
2478 !! html/parsoid
2479 <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>
2480 !! end
2481
2482 !!test
2483 Templates: Indent-Pre: 1a. Templates that break a line should suppress <pre>
2484 !! wikitext
2485 {{echo|}}
2486 !! html
2487
2488 !!end
2489
2490 !!test
2491 Templates: Indent-Pre: 1b. Templates that break a line should suppress <pre>
2492 !! wikitext
2493 {{echo|
2494 foo}}
2495 !! html
2496 <p>foo
2497 </p>
2498 !!end
2499
2500 !! test
2501 Templates: Indent-Pre: 1c: Wrapping should be based on expanded content
2502 !! wikitext
2503 {{echo|a
2504 b}}
2505 !! html
2506 <pre>a
2507 </pre>
2508 <p>b
2509 </p>
2510 !!end
2511
2512 !! test
2513 Templates: Indent-Pre: 1d: Wrapping should be based on expanded content
2514 !! wikitext
2515 {{echo|a
2516 b
2517 c
2518 d
2519 e
2520 }}
2521 !! html
2522 <pre>a
2523 </pre>
2524 <p>b
2525 c
2526 </p>
2527 <pre>d
2528 </pre>
2529 <p>e
2530 </p>
2531 !!end
2532
2533 !!test
2534 Templates: Indent-Pre: 1e. Wrapping should be based on expanded content
2535 !! wikitext
2536 {{echo| foo}}
2537
2538 {{echo| foo}}{{echo| bar}}
2539
2540 {{echo| foo}}
2541 {{echo| bar}}
2542
2543 {{echo|<!--cmt--> foo}}
2544
2545 <!--cmt-->{{echo| foo}}
2546
2547 {{echo|{{echo| }}bar}}
2548 !! html
2549 <pre>foo
2550 </pre>
2551 <pre>foo bar
2552 </pre>
2553 <pre>foo
2554 bar
2555 </pre>
2556 <pre>foo
2557 </pre>
2558 <pre>foo
2559 </pre>
2560 <pre>bar
2561 </pre>
2562 !!end
2563
2564 !! test
2565 Templates: Indent-Pre: 1f: Wrapping should be based on expanded content
2566 !! wikitext
2567 {{echo| }}a
2568
2569 {{echo|
2570 }}a
2571
2572 {{echo|
2573 b}}
2574
2575 {{echo|a
2576 }}b
2577
2578 {{echo|a
2579 }} b
2580 !! html
2581 <pre>a
2582 </pre>
2583 <p><br />
2584 </p>
2585 <pre>a
2586 </pre>
2587 <p><br />
2588 </p>
2589 <pre>b
2590 </pre>
2591 <p>a
2592 </p>
2593 <pre>b
2594 </pre>
2595 <p>a
2596 </p>
2597 <pre>b
2598 </pre>
2599 !!end
2600
2601 ## Hmm, should Parsoid rt this?
2602 !! test
2603 Pres with newline attributes
2604 !! options
2605 parsoid=wt2html,html2html
2606 !! wikitext
2607 <pre class="one
2608 two">hi</pre>
2609 !! html/php
2610 <pre class="one two">hi</pre>
2611
2612 !! html/parsoid
2613 <pre typeof="mw:Extension/pre" about="#mwt2" class="one two" data-mw='{"name":"pre","attrs":{"class":"one two"},"body":{"extsrc":"hi"}}'>hi</pre>
2614 !! end
2615
2616 !! test
2617 Things that look like <pre> tags aren't treated as such
2618 !! wikitext
2619 Barack Obama <President> of the United States
2620 <President></President>
2621 !! html
2622 <p>Barack Obama &lt;President&gt; of the United States
2623 &lt;President&gt;&lt;/President&gt;
2624 </p>
2625 !! end
2626
2627 !! test
2628 Handle broken pre-like tags (T66025)
2629 !! options
2630 parsoid=wt2html
2631 !! wikitext
2632 {{echo|<pre <pre>x</pre>}}
2633
2634 <table><pre </table>
2635 !! html/php
2636 <pre>x</pre>
2637 <table>&lt;pre </table>
2638
2639 !! html/php+tidy
2640 <pre>
2641 x
2642 </pre>
2643 <p>&lt;pre</p>
2644 !! html/parsoid
2645 <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>
2646
2647
2648 <p>&lt;pre </p>
2649
2650 <table></table>
2651 !! end
2652
2653 !! test
2654 Parsoid: handle pre with space after attribute
2655 !! options
2656 parsoid=wt2html
2657 !! wikitext
2658 <pre style="width:50%;" >{{echo|foo}}</pre>
2659 !! html/php
2660 <pre style="width:50%;">{{echo|foo}}</pre>
2661
2662 !! html/parsoid
2663 <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>
2664 !! end
2665
2666 # TODO / maybe: fix wt2wt for this
2667 !! test
2668 Parsoid: Don't paragraph-wrap fosterable content
2669 !! options
2670 parsoid=wt2html
2671 !! wikitext
2672 {|
2673 <td></td>
2674 <td></td>
2675
2676
2677
2678 |}
2679 !! html
2680 <table>
2681
2682 <tbody>
2683 <tr>
2684 <td></td>
2685
2686 <td></td></tr>
2687
2688
2689
2690 </tbody></table>
2691 !! end
2692
2693 !! test
2694 Parsoid: Don't paragraph-wrap fosterable content even if table syntax is unbalanced
2695 !! options
2696 parsoid=wt2html
2697 !! wikitext
2698 {|
2699 <td>
2700 <td>
2701 </td>
2702
2703
2704
2705 |}
2706 !! html
2707 <table>
2708
2709 <tbody>
2710 <tr>
2711 <td></td>
2712
2713 <td>
2714 </td></tr>
2715
2716
2717
2718 </tbody></table>
2719 !! end
2720
2721
2722 #--------------------------------------------------------------------
2723 # Transclusion parameter whitespace stripping tests
2724 # Behavior is different for positional and named parameters
2725 #--------------------------------------------------------------------
2726 !! test
2727 Templates: Strip leading and trailing whitespace from named-param values
2728 !! wikitext
2729 {{echo|1= a }}
2730
2731 {{echo|1= {{echo|b}} }}
2732
2733 {{echo| 1 =
2734 c }}
2735
2736 {{echo| 1 =
2737 * d
2738 }}
2739 !! html
2740 <p>a
2741 </p><p>b
2742 </p><p>c
2743 </p>
2744 <ul><li> d</li></ul>
2745
2746 !! end
2747
2748 !! test
2749 Templates: Don't strip whitespace from positional-param values
2750 !! wikitext
2751 {{echo|a }}
2752
2753 {{echo|{{echo|b}} }}
2754
2755 {{echo| c
2756 }}
2757
2758 {{echo| {{echo|d}}
2759 }}
2760
2761 {{echo|
2762 e}}
2763
2764 {{echo|
2765 * f}}
2766
2767 {{echo|
2768 }}g
2769 !! html
2770 <p>a
2771 </p><p>b
2772 </p>
2773 <pre>c
2774 </pre>
2775 <p><br />
2776 </p>
2777 <pre>d
2778 </pre>
2779 <p><br />
2780 </p>
2781 <pre>e
2782 </pre>
2783 <p><br />
2784 </p>
2785 <ul><li> f</li></ul>
2786 <p><br />
2787 </p>
2788 <pre>g
2789 </pre>
2790 !! end
2791
2792 !! test
2793 Templates: Don't recognize targets split by newlines
2794 !! options
2795 parsoid=wt2html
2796 !! wikitext
2797 {{ech
2798 o|foo}}
2799 !! html/php
2800 <p>{{ech
2801 o|foo}}
2802 </p>
2803 !! html/parsoid
2804 <p>{{ech
2805 o|foo}}</p>
2806 !! end
2807
2808 !! test
2809 Templates: Recognize targets when newlines and comments don't split the target
2810 !! options
2811 parsoid=wt2html
2812 !! wikitext
2813 {{
2814 <!--X--> ech<!--X-->o<!--X-->
2815 <!--X--> <!--X-->
2816
2817 |foo}}
2818 !! html/php
2819 <p>foo
2820 </p>
2821 !! html/parsoid
2822 <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>
2823 !! end
2824
2825 !! test
2826 Templates: Handle empty comment-and-ws-only lines correctly
2827 !! wikitext
2828 {{echo|foo
2829 <!--should be ignored-->
2830 <!--should be ignored as well-->
2831 bar}}
2832 !! html/php
2833 <p>foo
2834 bar
2835 </p>
2836 !! html/parsoid
2837 <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>
2838 !! end
2839
2840 !! test
2841 Templates: Handle comments in the target
2842 !! wikitext
2843 {{echo
2844 <!-- should be ignored -->
2845 |foo}}
2846
2847 {{echo
2848 <!-- should be ignored and spaces on next line should not trip us up (T147742) -->
2849 |foo}}
2850
2851 {{echo<!-- should be ignored -->
2852 |foo}}
2853
2854 {{echo<!-- should be ignored -->|foo}}
2855
2856 {{<!-- should be ignored -->echo|foo}}
2857 !! html/php
2858 <p>foo
2859 </p><p>foo
2860 </p><p>foo
2861 </p><p>foo
2862 </p><p>foo
2863 </p>
2864 !! html/parsoid
2865 <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>
2866
2867 <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>
2868
2869 <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>
2870
2871 <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>
2872
2873 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2874 !! end
2875
2876 !! test
2877 Templates: Handle comments in parameter names (T69657)
2878 !! wikitext
2879 {{echo|1
2880 <!-- should be ignored -->
2881 =foo}}
2882
2883 {{echo|
2884 <!-- should be ignored -->
2885 1 = foo}}
2886
2887 {{echo|1<!-- should be ignored -->=foo}}
2888
2889 {{echo|<!-- should be ignored -->1=foo}}
2890 !! html/php
2891 <p>foo
2892 </p><p>foo
2893 </p><p>foo
2894 </p><p>foo
2895 </p>
2896 !! html/parsoid
2897 <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>
2898
2899 <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>
2900
2901 <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>
2902
2903 <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>
2904 !! end
2905
2906 !! test
2907 Templates: Other wikitext in parameter names (T69657)
2908 !! wikitext
2909 {{echo|''1''=foo}}
2910 !! html/php
2911 <p>{{{1}}}
2912 </p>
2913 !! html/parsoid
2914 <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>
2915 !! end
2916
2917 !! test
2918 Templates: With colons
2919 !! wikitext
2920 {{With: Colon}}
2921 !! html/php
2922 <p>Template with colon
2923 </p>
2924 !! html/parsoid
2925 <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>
2926 !! end
2927
2928 #--------------------------------------------------------------------
2929 # Transclusion parameter escaping tests
2930 #--------------------------------------------------------------------
2931
2932 !! test
2933 Templates: Parsoid parameter escaping test 1
2934 !! wikitext
2935 {{echo|[foo]|{{echo|[bar]}}}}
2936 !! html/php+tidy
2937 <p>[foo]</p>
2938 !! html/parsoid
2939 <p about="#mwt1" typeof="mw:Transclusion"
2940 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[foo]"},"2":{"wt":"{{echo|[bar]}}"}},"i":0}}]}'>[foo]</p>
2941 !! end
2942
2943 !! test
2944 Parsoid: Pipes in external links in template parameter
2945 !! wikitext
2946 {{echo|[{{echo|http://example.com}} link]}}
2947 !! html/php+tidy
2948 <p><a rel="nofollow" class="external text" href="http://example.com">link</a></p>
2949 !! html/parsoid
2950 <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>
2951 !! end
2952
2953 !! test
2954 Parsoid: pipe in transclusion parameter
2955 !! wikitext
2956 {{echo|http://foo.com/a&#124;b}}
2957 !! html/php+tidy
2958 <p><a rel="nofollow" class="external free" href="http://foo.com/a%7Cb">http://foo.com/a%7Cb</a></p>
2959 !! html/parsoid
2960 <p><a rel="mw:ExtLink" href="http://foo.com/a%7Cb" about="#mwt1"
2961 typeof="mw:Transclusion"
2962 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>
2963 !! end
2964
2965 !! test
2966 Parsoid: Pipe in external link target and content in template parameter
2967 !! options
2968 parsoid=html2wt,wt2wt
2969 !! wikitext
2970 {{echo|[http://foo.com/a&#124;b a&#124;b]}}
2971 !! html/php+tidy
2972 <p><a rel="nofollow" class="external text" href="http://foo.com/a%7Cb">a|b</a></p>
2973 !! html/parsoid
2974 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2975 typeof="mw:Transclusion"
2976 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},
2977 "params":{"1":{"wt":"[http://foo.com/a|b a|b]"}},"i":0}}]}'>a|b</a></p>
2978 !! end
2979
2980 !! test
2981 Parsoid: Pipe in template with nested template in external link target in template parameter (seriously)
2982 !! options
2983 parsoid
2984 !! wikitext
2985 {{echo|[{{fullurl:{{FULLPAGENAME}}|action=edit}} bar]}}
2986 !! html
2987 <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>
2988 !! end
2989
2990 !! test
2991 Templates: Don't escape already nowiki-escaped text in template parameters
2992 !! options
2993 parsoid=html2wt,wt2wt
2994 !! wikitext
2995 {{echo|foo<nowiki>|</nowiki>bar}}
2996 {{echo|<nowiki>&lt;div&gt;</nowiki>}}
2997 {{echo|<nowiki></nowiki>}}
2998 !! html/php+tidy
2999 <p>foo|bar &lt;div&gt;</p>
3000 !! html/parsoid
3001 <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>
3002 <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>
3003 <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>
3004 </p>
3005 !! end
3006
3007 ## T54824
3008 !! test
3009 Templates: '=' char in nested transclusions should not trigger nowiki escapes or conversion to named param
3010 !! options
3011 parsoid=html2wt,wt2wt
3012 !! wikitext
3013 {{echo|{{echo|1=bar}}}}
3014 !! html/php+tidy
3015 <p>bar</p>
3016 !! html/parsoid
3017 <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>
3018 !! end
3019
3020 ## T58733
3021 !! test
3022 Templates parameters with special tokenizing behavior dont get modified because of arg escaping
3023 !! wikitext
3024 {{echo|a : b}}
3025 !! html/php+tidy
3026 <p>a&#160;: b</p>
3027 !! html/parsoid
3028 <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>
3029 !! end
3030
3031 ## T73412
3032 !! test
3033 Templates: Preserve blank parameter names
3034 !! wikitext
3035 {{echo|=foo}}
3036 !! html/php+tidy
3037 <p>{{{1}}}</p>
3038 !! html/parsoid
3039 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"":{"wt":"foo"}},"i":0}}]}'>{{{1}}}</p>
3040 !! end
3041
3042 !! test
3043 Templates: Preserve blank parameter names in other positions
3044 !! wikitext
3045 {{blank_param|bar|=foo}}
3046 !! html/php+tidy
3047 <p>bar foo</p>
3048 !! html/parsoid
3049 <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
3050 foo</p>
3051 !! end
3052
3053 ###
3054 ### Parsoid-centric tests for testing RT edge cases for pre
3055 ###
3056
3057 !!test
3058 1a. Indent-Pre and Comments
3059 !! wikitext
3060 a
3061 <!--a-->
3062 c
3063 !! html
3064 <pre>a
3065 </pre>
3066 <p>c
3067 </p>
3068 !!end
3069
3070 !!test
3071 1b. Indent-Pre and Comments
3072 !! wikitext
3073 a
3074 <!--a-->
3075 c
3076 !! html
3077 <pre>a
3078 </pre>
3079 <p>c
3080 </p>
3081 !!end
3082
3083 !!test
3084 1c. Indent-Pre and Comments
3085 !! wikitext
3086 <!--a--> a
3087
3088 <!--a--> a
3089 !! html
3090 <pre> a
3091 </pre>
3092 <pre> a
3093 </pre>
3094 !!end
3095
3096 !!test
3097 1d. Indent-Pre and Comments
3098 (Pre-handler currently cannot distinguish between comment/ws order and normalizes them to [comment,ws] order)
3099 !! wikitext
3100 <!--a--> a
3101
3102 <!--b-->b
3103 !! html
3104 <pre>a
3105 </pre>
3106 <pre>b
3107 </pre>
3108 !!end
3109
3110 !!test
3111 2a. Indent-Pre and tables
3112 !! wikitext
3113 {|
3114 |-
3115 !h1!!h2
3116 |foo||bar
3117 |}
3118 !! html
3119 <table>
3120
3121 <tr>
3122 <th>h1</th>
3123 <th>h2
3124 </th>
3125 <td>foo</td>
3126 <td>bar
3127 </td></tr></table>
3128
3129 !!end
3130
3131 !!test
3132 2b. Indent-Pre and tables
3133 !! wikitext
3134 {|
3135 |-
3136 |foo
3137 |}
3138 !! html
3139 <table>
3140
3141 <tr>
3142 <td>foo
3143 </td></tr></table>
3144
3145 !!end
3146
3147 !!test
3148 2c. Indent-Pre and tables (T44252)
3149 !! wikitext
3150 {|
3151 |+ foo
3152 ! | bar
3153 |}
3154 !! html
3155 <table>
3156 <caption> foo
3157 </caption>
3158 <tr>
3159 <th> bar
3160 </th></tr></table>
3161
3162 !!end
3163
3164 !!test
3165 2d. Indent-Pre and tables
3166 !! wikitext
3167 a
3168 {|
3169 | b
3170 |}
3171 !! html/php
3172 <pre>a
3173 </pre>
3174 <table>
3175 <tr>
3176 <td> b
3177 </td></tr></table>
3178
3179 !! html/parsoid
3180 <pre>a</pre>
3181 <table>
3182 <tbody><tr><td> b</td></tr>
3183 </tbody></table>
3184 !!end
3185
3186 !!test
3187 2e. Indent-Pre and table-line syntax
3188 !! wikitext
3189 a
3190 | b
3191 | c
3192 !! html/php
3193 <pre>a
3194 | b
3195 | c
3196 </pre>
3197 !!end
3198
3199 !!test
3200 2f. Indent-pre started by table-line syntax
3201 !! wikitext
3202 a
3203 | b
3204 | c
3205 !! html/php
3206 <p>a
3207 </p>
3208 <pre>| b
3209 | c
3210 </pre>
3211 !! html/parsoid
3212 <p>a</p>
3213 <pre>
3214 | b
3215 | c</pre>
3216 !!end
3217
3218 !! test
3219 2g. Indented table markup mixed with indented pre content (proposed in T8200)
3220 !! wikitext
3221 <table>
3222 <tr>
3223 <td>
3224 Text that should be rendered preformatted
3225 </td>
3226 </tr>
3227 </table>
3228 !! html
3229 <table>
3230 <tr>
3231 <td>
3232 <pre>Text that should be rendered preformatted
3233 </pre>
3234 </td>
3235 </tr>
3236 </table>
3237
3238 !! end
3239
3240 !!test
3241 3a. Indent-Pre and block tags (single-line html)
3242 !! wikitext
3243 a <p> foo </p>
3244 b <div> foo </div>
3245 c <blockquote> foo </blockquote>
3246 <span> foo </span>
3247 !! html
3248 a <p> foo </p>
3249 b <div> foo </div>
3250 c <blockquote> foo </blockquote>
3251 <pre><span> foo </span>
3252 </pre>
3253 !! html/parsoid
3254 <p>a </p><p data-parsoid='{"stx":"html"}'> foo </p>
3255 <p>b </p><div data-parsoid='{"stx":"html"}'> foo </div>
3256 <p>c </p><blockquote data-parsoid='{"stx":"html"}'> foo </blockquote>
3257 <pre><span> foo </span>
3258 </pre>
3259 !! html+tidy
3260 <p>a</p>
3261 <p>foo</p>
3262 <p>b</p>
3263 <div>foo</div>
3264 <p>c</p>
3265 <blockquote>
3266 <p>foo</p>
3267 </blockquote>
3268 <pre>
3269 <span> foo </span>
3270 </pre>
3271 !! end
3272
3273 !!test
3274 3b. Indent-Pre and block tags (multi-line html)
3275 !! wikitext
3276 a <span>foo</span>
3277 b <div> foo </div>
3278 !! html
3279 <pre>a <span>foo</span>
3280 </pre>
3281 b <div> foo </div>
3282
3283 !! html/parsoid
3284 <pre>a <span data-parsoid='{"stx":"html"}'>foo</span></pre>
3285 b <div data-parsoid='{"stx":"html"}'> foo </div>
3286 !! html+tidy
3287 <pre>
3288 a <span>foo</span>
3289 </pre>
3290 <p>b</p>
3291 <div>foo</div>
3292 !!end
3293
3294 !!test
3295 3c. Indent-Pre and block tags (pre-content on separate line)
3296 !! wikitext
3297 <p>
3298 foo
3299 </p>
3300
3301 <div>
3302 foo
3303 </div>
3304
3305 <center>
3306 foo
3307 </center>
3308
3309 <blockquote>
3310 foo
3311 </blockquote>
3312
3313 <blockquote>
3314 <pre>
3315 foo
3316 </pre>
3317 </blockquote>
3318
3319 <table><tr><td>
3320 foo
3321 </td></tr></table>
3322
3323 <ul><li>
3324 foo
3325 </li></ul>
3326
3327 !! html
3328 <p>
3329 foo
3330 </p>
3331 <div>
3332 <pre>foo
3333 </pre>
3334 </div>
3335 <center>
3336 <pre>foo
3337 </pre>
3338 </center>
3339 <blockquote>
3340 <p> foo
3341 </p>
3342 </blockquote>
3343 <blockquote>
3344 <pre>
3345 foo
3346 </pre>
3347 </blockquote>
3348 <table><tr><td>
3349 <pre>foo
3350 </pre>
3351 </td></tr></table>
3352 <ul><li>
3353 foo
3354 </li></ul>
3355
3356 !!end
3357
3358 !! test
3359 4. Indent-Pre and extension tags
3360 !! wikitext
3361 a <tag />
3362 !! html/php
3363 a <pre>
3364 NULL
3365 array (
3366 )
3367 </pre>
3368
3369 !! html/parsoid
3370 a <pre typeof="mw:Extension/tag" about="#mwt2" data-parsoid='{}' data-mw='{"name":"tag","attrs":{},"body":null}'></pre>
3371 !! end
3372
3373 !! test
3374 5. Indent-Pre and html pre
3375 !! wikitext
3376 <pre class="123">hi</pre>
3377 !! html/php
3378 <pre class="123">hi</pre>
3379
3380 !! html/parsoid
3381 <pre typeof="mw:Extension/pre" about="#mwt2" class="123" data-mw='{"name":"pre","attrs":{"class":"123"},"body":{"extsrc":"hi"}}'>hi</pre>
3382 !! end
3383
3384 !!test
3385 Render paragraphs when indent-pre is suppressed in blocklevels
3386 !! wikitext
3387 <blockquote>
3388 foo
3389
3390 bar
3391 </blockquote>
3392 !! html
3393 <blockquote>
3394 <p> foo
3395 </p><p> bar
3396 </p>
3397 </blockquote>
3398
3399 !!end
3400
3401 !!test
3402 4. Multiple spaces at start-of-line
3403 !! wikitext
3404 <p> foo </p>
3405 foo
3406 {|
3407 |foo
3408 |}
3409 !! html
3410 <p> foo </p>
3411 <pre> foo
3412 </pre>
3413 <table>
3414 <tr>
3415 <td>foo
3416 </td></tr></table>
3417
3418 !!end
3419
3420 ## NOTE: the leading white-space chars on empty line are significant
3421 !! test
3422 5a. White-space in indent-pre
3423 !! wikitext
3424 a<br />
3425
3426 b
3427 !! html
3428 <pre>a<br />
3429
3430 b
3431 </pre>
3432 !! end
3433
3434 ## NOTE: the leading white-space chars on empty line are significant
3435 !! test
3436 5b. White-space in indent-pre
3437 !! wikitext
3438 a
3439
3440 b
3441
3442
3443 c
3444 !! html
3445 <pre>a
3446
3447 b
3448
3449
3450 c
3451 </pre>
3452 !! end
3453
3454 !! test
3455 5c. White-space in indent-pre
3456 !! wikitext
3457 ''a''
3458 ''b''
3459 ''c''
3460 !! html
3461 <pre><i>a</i>
3462 <i>b</i>
3463 <i>c</i>
3464 </pre>
3465 !! end
3466
3467 !! test
3468 6. Pre-blocks should extend across lines with leading WS even when there is no wrappable content
3469 !! wikitext
3470 a
3471
3472 <!-- continue -->
3473 b
3474
3475 c
3476
3477 d
3478 !! html
3479 <pre>a
3480
3481 b
3482 </pre>
3483 <pre>c
3484
3485 </pre>
3486 <p>d
3487 </p>
3488 !! end
3489
3490 !! test
3491 7a. Indent-pre and category links
3492 !! options
3493 parsoid=wt2html,wt2wt
3494 !! wikitext
3495 [[Category:foo]] <!-- No pre-wrapping -->
3496 {{echo| [[Category:foo]]}} <!-- No pre-wrapping -->
3497 !! html/php+tidy
3498 !! html/parsoid
3499 <link rel="mw:PageProp/Category" href="./Category:Foo"> <!-- No pre&#x2D;wrapping -->
3500 <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 -->
3501 !! end
3502
3503 ## We used to, but no longer wt2wt this test since the default serializer
3504 ## will normalize all categories to serialize on their own line.
3505 ## This wikitext usage is going to be fairly uncommon in production and
3506 ## selser will take care of preserving formatting in those scenarios.
3507 !! test
3508 7b. Indent-pre and category links
3509 !! options
3510 parsoid=wt2html
3511 !! wikitext
3512 [[Category:foo]] a
3513 [[Category:foo]] {{echo|b}}
3514 !! html/parsoid
3515 <pre><link rel="mw:PageProp/Category" href="./Category:Foo"> a
3516 <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>
3517 !! end
3518
3519 !! test
3520 Indent-Pre: Newlines in comments shouldn't affect sol state
3521 !! wikitext
3522 a <!--
3523 foo
3524 --> b
3525 !! html/php+tidy
3526 <p>a b</p>
3527 !! html/parsoid
3528 <p>a <!--
3529 foo
3530 --> b</p>
3531 !! end
3532
3533 ###
3534 ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
3535 ###
3536
3537 !!test
3538 HTML-pre: 1. embedded newlines
3539 !! wikitext
3540 <pre>foo</pre>
3541
3542 <pre>
3543 foo
3544 </pre>
3545
3546 <pre>
3547
3548 foo
3549 </pre>
3550
3551 <pre>
3552
3553
3554 foo
3555 </pre>
3556 !! html/php+tidy
3557 <pre>
3558 foo
3559 </pre>
3560 <pre>
3561 foo
3562 </pre>
3563 <pre>
3564
3565 foo
3566 </pre>
3567 <pre>
3568
3569
3570 foo
3571 </pre>
3572 !! html/parsoid
3573 <pre typeof="mw:Extension/pre" about="#mwt2" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"foo"}}'>foo</pre>
3574
3575 <pre typeof="mw:Extension/pre" about="#mwt4" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\nfoo\n"}}'>foo
3576 </pre>
3577
3578 <pre typeof="mw:Extension/pre" about="#mwt6" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\n\nfoo\n"}}'>
3579
3580 foo
3581 </pre>
3582
3583 <pre typeof="mw:Extension/pre" about="#mwt8" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\n\n\nfoo\n"}}'>
3584
3585
3586 foo
3587 </pre>
3588 !!end
3589
3590 !! test
3591 HTML-pre: big spaces
3592 !! wikitext
3593 <pre>
3594
3595
3596
3597
3598 haha
3599
3600
3601
3602
3603 haha
3604
3605
3606
3607
3608 </pre>
3609 !! html/php+tidy
3610 <pre>
3611
3612
3613
3614
3615 haha
3616
3617
3618
3619
3620 haha
3621
3622
3623
3624
3625 </pre>
3626 !! html/parsoid
3627 <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"}}'>
3628
3629
3630
3631
3632 haha
3633
3634
3635
3636
3637 haha
3638
3639
3640
3641
3642 </pre>
3643 !! end
3644
3645 !!test
3646 HTML-pre: 2: indented text
3647 !! wikitext
3648 <pre>
3649 foo
3650 </pre>
3651 !! html
3652 <pre>
3653 foo
3654 </pre>
3655
3656 !!end
3657
3658 !!test
3659 HTML-pre: 3: other wikitext
3660 !! wikitext
3661 <pre>
3662 * foo
3663 # bar
3664 = no-h =
3665 '' no-italic ''
3666 [[ NoLink ]]
3667 </pre>
3668 !! html/php
3669 <pre>
3670 * foo
3671 # bar
3672 = no-h =
3673 '' no-italic ''
3674 [[ NoLink ]]
3675 </pre>
3676
3677 !! html/parsoid
3678 <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
3679 # bar
3680 = no-h =
3681 '' no-italic ''
3682 [[ NoLink ]]
3683 </pre>
3684 !!end
3685
3686 ###
3687 ### Definition lists
3688 ###
3689 !! test
3690 Simple definition
3691 !! wikitext
3692 ; name : Definition
3693 !! html
3694 <dl><dt> name&#160;</dt>
3695 <dd> Definition</dd></dl>
3696
3697 !! end
3698
3699 !! test
3700 Definition list for indentation only
3701 !! wikitext
3702 : Indented text
3703 !! html
3704 <dl><dd> Indented text</dd></dl>
3705
3706 !! end
3707
3708 !! test
3709 Definition list with no space
3710 !! wikitext
3711 ;name:Definition
3712 !! html
3713 <dl><dt>name</dt>
3714 <dd>Definition</dd></dl>
3715
3716 !!end
3717
3718 !! test
3719 Definition list with URL link
3720 !! wikitext
3721 ; http://example.com/ : definition
3722 !! html
3723 <dl><dt> <a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&#160;</dt>
3724 <dd> definition</dd></dl>
3725
3726 !! end
3727
3728 !! test
3729 Definition list with bracketed URL link
3730 !! wikitext
3731 ;[http://www.example.com/ Example]:Something about it
3732 !! html
3733 <dl><dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt>
3734 <dd>Something about it</dd></dl>
3735
3736 !! end
3737
3738 !! test
3739 Definition list with wikilink containing colon
3740 !! wikitext
3741 ; [[Help:FAQ]]: The least-read page on Wikipedia
3742 !! html
3743 <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>
3744 <dd> The least-read page on Wikipedia</dd></dl>
3745
3746 !! end
3747
3748 # At Brion's and JeLuF's insistence... :)
3749 !! test
3750 Definition list with news link containing colon
3751 !! wikitext
3752 ; news:alt.wikipedia.rox: This isn't even a real newsgroup!
3753 !! html/php
3754 <dl><dt> <a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a></dt>
3755 <dd> This isn't even a real newsgroup!</dd></dl>
3756
3757 !! html/parsoid
3758 <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>
3759 !! end
3760
3761 !! test
3762 Malformed definition list with colon
3763 !! wikitext
3764 ; news:alt.wikipedia.rox -- don't crash or enter an infinite loop
3765 !! html
3766 <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>
3767
3768 !! end
3769
3770 !! test
3771 Definition lists: colon in external link text
3772 !! wikitext
3773 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
3774 !! html
3775 <dl><dt> <a rel="nofollow" class="external text" href="http://www.wikipedia2.org/">Wikipedia&#160;: The Next Generation</a></dt>
3776 <dd> OK, I made that up</dd></dl>
3777
3778 !! end
3779
3780 !! test
3781 Definition lists: colon in HTML attribute
3782 !! wikitext
3783 ;<b style="display: inline">bold</b>
3784 !! html
3785 <dl><dt><b style="display: inline">bold</b></dt></dl>
3786
3787 !! end
3788
3789 !! test
3790 Definition lists: self-closed tag
3791 !! wikitext
3792 ;one<br/>two : two-line fun
3793 !! html
3794 <dl><dt>one<br />two&#160;</dt>
3795 <dd> two-line fun</dd></dl>
3796
3797 !! end
3798
3799 !! test
3800 Definition lists: ignore colons inside tags
3801 !! wikitext
3802 ;one <b>two : tag <i>fun:</i>:</b>: def
3803 !! html
3804 <dl><dt>one <b>two&#160;: tag <i>fun:</i>:</b></dt>
3805 <dd> def</dd></dl>
3806
3807 !! end
3808
3809 !! test
3810 Definition lists: excess closed tags
3811 !! wikitext
3812 ;one</b>two : bad tag fun
3813 !! html/php+tidy
3814 <dl>
3815 <dt>onetwo&#160;</dt>
3816 <dd>bad tag fun</dd>
3817 </dl>
3818 !! html/parsoid
3819 <dl>
3820 <dt>onetwo</dt>
3821 <dd>bad tag fun</dd>
3822 </dl>
3823 !! end
3824
3825 !! test
3826 T13748: Literal closing tags
3827 !! wikitext
3828 <dl>
3829 <dt>test 1</dt>
3830 <dd>test test test test test</dd>
3831 <dt>test 2</dt>
3832 <dd>test test test test test</dd>
3833 </dl>
3834 !! html
3835 <dl>
3836 <dt>test 1</dt>
3837 <dd>test test test test test</dd>
3838 <dt>test 2</dt>
3839 <dd>test test test test test</dd>
3840 </dl>
3841
3842 !! end
3843
3844 !! test
3845 Definition and unordered list using wiki syntax nested in unordered list using html tags.
3846 !! wikitext
3847 <ul><li>
3848 ; term : description
3849 * unordered
3850 </li></ul>
3851 !! html
3852 <ul><li>
3853 <dl><dt> term&#160;</dt>
3854 <dd> description</dd></dl>
3855 <ul><li> unordered</li></ul>
3856 </li></ul>
3857
3858 !! end
3859
3860 !! test
3861 Definition list with empty definition and following paragraph
3862 !! wikitext
3863 ; term:
3864 Paragraph text
3865 !! html
3866 <dl><dt> term</dt>
3867 <dd></dd></dl>
3868 <p>Paragraph text
3869 </p>
3870 !! end
3871
3872 !! test
3873 Nested definition lists using html syntax
3874 !! wikitext
3875 <dl><dt>x</dt>
3876 <dd>a</dd>
3877 <dd>b</dd></dl>
3878 !! html
3879 <dl><dt>x</dt>
3880 <dd>a</dd>
3881 <dd>b</dd></dl>
3882
3883 !! end
3884
3885 !! test
3886 Definition Lists: No nesting: Multiple dd's
3887 !! wikitext
3888 ;x
3889 :a
3890 :b
3891 !! html
3892 <dl><dt>x</dt>
3893 <dd>a</dd>
3894 <dd>b</dd></dl>
3895
3896 !! end
3897
3898 !! test
3899 Definition Lists: Indentation: Regular
3900 !! wikitext
3901 :i1
3902 ::i2
3903 :::i3
3904 !! html
3905 <dl><dd>i1
3906 <dl><dd>i2
3907 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3908
3909 !! end
3910
3911 !! test
3912 Definition Lists: Indentation: Missing 1st level
3913 !! wikitext
3914 ::i2
3915 :::i3
3916 !! html
3917 <dl><dd><dl><dd>i2
3918 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3919
3920 !! end
3921
3922 !! test
3923 Definition Lists: Indentation: Multi-level indent
3924 !! wikitext
3925 :::i3
3926 !! html
3927 <dl><dd><dl><dd><dl><dd>i3</dd></dl></dd></dl></dd></dl>
3928
3929 !! end
3930
3931 !! test
3932 Definition Lists: Hacky use to indent tables
3933 !! wikitext
3934 ::{|
3935 |foo
3936 |bar
3937 |}
3938 this text
3939 should be left alone
3940 !! html
3941 <dl><dd><dl><dd><table>
3942 <tr>
3943 <td>foo
3944 </td>
3945 <td>bar
3946 </td></tr></table></dd></dl></dd></dl>
3947 <p>this text
3948 should be left alone
3949 </p>
3950 !! end
3951
3952 !! test
3953 Definition Lists: Hacky use to indent tables, with comments (T65979)
3954 !! wikitext
3955 <!-- foo -->
3956 ::{|
3957 |foo
3958 |bar
3959 |}<!-- bar -->
3960 this text
3961 should be left alone
3962 !! html/parsoid
3963 <!-- foo -->
3964 <dl><dd><dl><dd><table><tr>
3965 <td>foo</td>
3966 <td>bar</td>
3967 </tr></table><!-- bar --></dd></dl></dd></dl>
3968 <p>this text
3969 should be left alone</p>
3970 !! end
3971
3972 !! test
3973 Definition Lists: Hacky use to indent tables, with comment before table
3974 !! wikitext
3975 ::<!-- foo -->{|
3976 |foo
3977 |}
3978 !! html/parsoid
3979 <dl><dd><dl><dd><!-- foo --><table><tr>
3980 <td>foo</td>
3981 </tr></table></dd></dl></dd></dl>
3982 !! end
3983
3984 # The trailing whitespace in this test is to catch a regression in
3985 # Parsoid after T54473.
3986 !! test
3987 Definition Lists: Hacky use to indent tables (WS-insensitive)
3988 !! wikitext
3989 : {|
3990 |a
3991 |}
3992 !! html/php
3993 <dl><dd><table>
3994 <tr>
3995 <td>a
3996 </td></tr></table></dd></dl>
3997
3998 !! html/parsoid
3999 <dl><dd> <table>
4000 <tbody><tr><td>a</td></tr>
4001 </tbody></table> </dd></dl>
4002 !! end
4003
4004 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
4005 ## as an empty dt item. It also ignores all but the last ";" when followed
4006 ## by ":" later on. So, ";" are not ignored in ";;;t3" but are ignored in
4007 ## ";;;t3 :d1". So, PHP parser behavior is a little inconsistent wrt multiple
4008 ## ";"s.
4009 ##
4010 ## Ex: ";;t2 ::d2" is transformed into:
4011 ##
4012 ## <dl>
4013 ## <dt>t2 </dt>
4014 ## <dd>
4015 ## <dl>
4016 ## <dt></dt>
4017 ## <dd>d2</dd>
4018 ## </dl>
4019 ## </dd>
4020 ## </dl>
4021 ##
4022 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
4023 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
4024 ##
4025 ## <dl>
4026 ## <dt>
4027 ## <dl>
4028 ## <dt>t2 </dt>
4029 ## <dd>:d2</dd>
4030 ## </dl>
4031 ## </dt>
4032 ## </dl>
4033 ##
4034 ## All Parsoid only definition list tests have this difference.
4035 ##
4036 ## See also: https://phabricator.wikimedia.org/T8569
4037 ## and https://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
4038
4039 !! test
4040 Table / list interaction: indented table with lists in table contents
4041 !! wikitext
4042 :{|
4043 |-
4044 | a
4045 * b
4046 |-
4047 | c
4048 * d
4049 |}
4050 !! html
4051 <dl><dd><table>
4052
4053 <tr>
4054 <td> a
4055 <ul><li> b</li></ul>
4056 </td></tr>
4057 <tr>
4058 <td> c
4059 <ul><li> d</li></ul>
4060 </td></tr></table></dd></dl>
4061
4062 !! end
4063
4064 !!test
4065 Table / list interaction: lists nested in tables nested in indented lists
4066 !! wikitext
4067 :{|
4068 |
4069 :a
4070 :b
4071 |
4072 *c
4073 *d
4074 |}
4075
4076 *e
4077 *f
4078 !! html
4079 <dl><dd><table>
4080 <tr>
4081 <td>
4082 <dl><dd>a</dd>
4083 <dd>b</dd></dl>
4084 </td>
4085 <td>
4086 <ul><li>c</li>
4087 <li>d</li></ul>
4088 </td></tr></table></dd></dl>
4089 <ul><li>e</li>
4090 <li>f</li></ul>
4091
4092 !!end
4093
4094 !! test
4095 Definition Lists: Nesting: Multi-level (Parsoid only)
4096 !! options
4097 parsoid
4098 !! wikitext
4099 ;t1 :d1
4100 ;;t2 ::d2
4101 ;;;t3 :::d3
4102 !! html
4103 <dl>
4104 <dt>t1 </dt>
4105 <dd>d1</dd>
4106 <dt>
4107 <dl>
4108 <dt>t2 </dt>
4109 <dd>:d2</dd>
4110 <dt>
4111 <dl>
4112 <dt>t3 </dt>
4113 <dd>::d3</dd>
4114 </dl>
4115 </dt>
4116 </dl>
4117 </dt>
4118 </dl>
4119
4120
4121 !! end
4122
4123
4124 !! test
4125 Definition Lists: Nesting: Test 2 (Parsoid only)
4126 !! wikitext
4127 ;t1
4128 ::d2
4129 !! html/php+tidy
4130 <dl>
4131 <dt>t1</dt>
4132 <dd>
4133 <dl>
4134 <dd>d2</dd>
4135 </dl>
4136 </dd>
4137 </dl>
4138 !! html/parsoid
4139 <dl>
4140 <dt>t1</dt>
4141 <dd>
4142 <dl>
4143 <dd>d2</dd>
4144 </dl>
4145 </dd>
4146 </dl>
4147
4148 !! end
4149
4150
4151 !! test
4152 Definition Lists: Nesting: Test 3 (Parsoid only)
4153 !! wikitext
4154 :;t1
4155 ::::d2
4156 !! html/php+tidy
4157 <dl>
4158 <dd>
4159 <dl>
4160 <dt>t1</dt>
4161 <dd>
4162 <dl>
4163 <dd>
4164 <dl>
4165 <dd>d2</dd>
4166 </dl>
4167 </dd>
4168 </dl>
4169 </dd>
4170 </dl>
4171 </dd>
4172 </dl>
4173 !! html/parsoid
4174 <dl>
4175 <dd>
4176 <dl>
4177 <dt>t1</dt>
4178 <dd>
4179 <dl>
4180 <dd>
4181 <dl>
4182 <dd>d2</dd>
4183 </dl>
4184 </dd>
4185 </dl>
4186 </dd>
4187 </dl>
4188 </dd>
4189 </dl>
4190
4191 !! end
4192
4193
4194 !! test
4195 Definition Lists: Nesting: Test 4
4196 !! wikitext
4197 ::;t3
4198 :::d3
4199 !! html
4200 <dl><dd><dl><dd><dl><dt>t3</dt>
4201 <dd>d3</dd></dl></dd></dl></dd></dl>
4202
4203 !! end
4204
4205
4206 ## The Parsoid team believes the following three test exposes a
4207 ## bug in the PHP parser. (Parsoid team thinks the PHP parser is
4208 ## wrong to close the <dl> after the <dt> containing the <ul>.)
4209 ## It also exposes a "misfeature" in tidy, which doesn't like
4210 ## <dl> tags with a single <dt> child; it converts the <dt> into
4211 ## a <dd> in that case. (Parsoid leaves the <dt> alone!)
4212 !! test
4213 Definition Lists: Mixed Lists: Test 1
4214 !! wikitext
4215 :;* foo
4216 ::* bar
4217 :; baz
4218 !! html/php
4219 <dl><dd><dl><dt><ul><li> foo</li>
4220 <li> bar</li></ul></dt></dl>
4221 <dl><dt> baz</dt></dl></dd></dl>
4222
4223 !! html/php+tidy
4224 <dl>
4225 <dd>
4226 <dl>
4227 <dd>
4228 <ul>
4229 <li>foo</li>
4230 <li>bar</li>
4231 </ul>
4232 </dd>
4233 </dl>
4234 <dl>
4235 <dt>baz</dt>
4236 </dl>
4237 </dd>
4238 </dl>
4239 !! html/parsoid
4240 <dl>
4241 <dd><dl>
4242 <dt><ul>
4243 <li> foo
4244 </li>
4245 </ul></dt>
4246 <dd><ul>
4247 <li> bar
4248 </li>
4249 </ul></dd>
4250 <dt> baz</dt>
4251 </dl></dd>
4252 </dl>
4253 !! end
4254
4255 !! test
4256 Definition Lists: Mixed Lists: Test 2
4257 !! wikitext
4258 *: d1
4259 *: d2
4260 !! html
4261 <ul><li><dl><dd> d1</dd>
4262 <dd> d2</dd></dl></li></ul>
4263
4264 !! end
4265
4266
4267 !! test
4268 Definition Lists: Mixed Lists: Test 3
4269 !! wikitext
4270 *::: d1
4271 *::: d2
4272 !! html
4273 <ul><li><dl><dd><dl><dd><dl><dd> d1</dd>
4274 <dd> d2</dd></dl></dd></dl></dd></dl></li></ul>
4275
4276 !! end
4277
4278
4279 !! test
4280 Definition Lists: Mixed Lists: Test 4
4281 !! wikitext
4282 *;d1 :d2
4283 *;d3 :d4
4284 !! html
4285 <ul><li><dl><dt>d1&#160;</dt>
4286 <dd>d2</dd>
4287 <dt>d3&#160;</dt>
4288 <dd>d4</dd></dl></li></ul>
4289
4290 !! end
4291
4292
4293 !! test
4294 Definition Lists: Mixed Lists: Test 5
4295 !! wikitext
4296 *:d1
4297 *:: d2
4298 !! html
4299 <ul><li><dl><dd>d1
4300 <dl><dd> d2</dd></dl></dd></dl></li></ul>
4301
4302 !! end
4303
4304
4305 !! test
4306 Definition Lists: Mixed Lists: Test 6
4307 !! wikitext
4308 #*:d1
4309 #*::: d3
4310 !! html
4311 <ol><li><ul><li><dl><dd>d1
4312 <dl><dd><dl><dd> d3</dd></dl></dd></dl></dd></dl></li></ul></li></ol>
4313
4314 !! end
4315
4316
4317 !! test
4318 Definition Lists: Mixed Lists: Test 7
4319 !! wikitext
4320 :* d1
4321 :* d2
4322 !! html
4323 <dl><dd><ul><li> d1</li>
4324 <li> d2</li></ul></dd></dl>
4325
4326 !! end
4327
4328
4329 !! test
4330 Definition Lists: Mixed Lists: Test 8
4331 !! wikitext
4332 :* d1
4333 ::* d2
4334 !! html
4335 <dl><dd><ul><li> d1</li></ul>
4336 <dl><dd><ul><li> d2</li></ul></dd></dl></dd></dl>
4337
4338 !! end
4339
4340
4341 !! test
4342 Definition Lists: Mixed Lists: Test 9
4343 !! wikitext
4344 *;foo :bar
4345 !! html
4346 <ul><li><dl><dt>foo&#160;</dt>
4347 <dd>bar</dd></dl></li></ul>
4348
4349 !! end
4350
4351
4352 !! test
4353 Definition Lists: Mixed Lists: Test 10
4354 !! wikitext
4355 *#;foo :bar
4356 !! html
4357 <ul><li><ol><li><dl><dt>foo&#160;</dt>
4358 <dd>bar</dd></dl></li></ol></li></ul>
4359
4360 !! end
4361
4362 # This is a regression test for T175099
4363 # html/php+tidy is insufficient since Tidy covers up the bug.
4364 # But once Tidy is replaced with RemexHTML, html/php+tidy is good enough
4365 !! test
4366 Definition Lists: Mixed Lists: Test 11
4367 !! wikitext
4368 ; a
4369 :* b
4370 !! html/*
4371 <dl><dt> a</dt>
4372 <dd>
4373 <ul><li> b</li></ul></dd></dl>
4374
4375 !! end
4376
4377 # The Parsoid team disagrees with the PHP parser's seemingly-random
4378 # rules regarding dd/dt on the next two tests. Parsoid is more
4379 # consistent, and recognizes the shared nesting and keeps the
4380 # still-open tags around until the nesting is complete.
4381 # (And tidy again converts <dt> to <dd> before 'bar'.)
4382
4383 !! test
4384 Definition Lists: Mixed Lists: Test 12
4385 !! wikitext
4386 *#*#;*;;foo :bar
4387 *#*#;boo :baz
4388 !! html/php
4389 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt>
4390 <dd><ul><li><dl><dt><dl><dt>bar</dt></dl></dd></dl></li></ul></dd></dl>
4391 <dl><dt>boo&#160;</dt>
4392 <dd>baz</dd></dl></li></ol></li></ul></li></ol></li></ul>
4393
4394 !! html/php+tidy
4395 <ul>
4396 <li>
4397 <ol>
4398 <li>
4399 <ul>
4400 <li>
4401 <ol>
4402 <li>
4403 <dl>
4404 <dt>foo&#160;</dt>
4405 <dd>
4406 <ul>
4407 <li>
4408 <dl>
4409 <dd>
4410 <dl>
4411 <dt>bar</dt>
4412 </dl>
4413 </dd>
4414 </dl>
4415 </li>
4416 </ul>
4417 </dd>
4418 </dl>
4419 <dl>
4420 <dt>boo&#160;</dt>
4421 <dd>baz</dd>
4422 </dl>
4423 </li>
4424 </ol>
4425 </li>
4426 </ul>
4427 </li>
4428 </ol>
4429 </li>
4430 </ul>
4431 !! html/parsoid
4432 <ul>
4433 <li>
4434 <ol>
4435 <li>
4436 <ul>
4437 <li>
4438 <ol>
4439 <li>
4440 <dl>
4441 <dt>
4442 <ul>
4443 <li>
4444 <dl>
4445 <dt>
4446 <dl>
4447 <dt>foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
4448 <dd data-parsoid='{"stx":"row"}'>bar</dd>
4449 </dl></dt>
4450 </dl></li>
4451 </ul></dt>
4452 <dt>boo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
4453 <dd data-parsoid='{"stx":"row"}'>baz</dd>
4454 </dl></li>
4455 </ol></li>
4456 </ul></li>
4457 </ol></li>
4458 </ul>
4459 !! end
4460
4461
4462 # Another case where tidy converts a <dt> to a <dd> (but Parsoid doesn't).
4463 # From whitelist:
4464 # * The test is wrong, there are two colons where there should be :;
4465 # * The PHP parser is wrong to close the <dl> after the <dt> containing the <ul>.
4466 !! test
4467 Definition Lists: Weird Ones: Test 1
4468 !! wikitext
4469 *#;*::;; foo : bar (who uses this?)
4470 !! html/php
4471 <ul><li><ol><li><dl><dt> foo&#160;</dt>
4472 <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>
4473
4474 !! html/php+tidy
4475 <ul>
4476 <li>
4477 <ol>
4478 <li>
4479 <dl>
4480 <dt>foo&#160;</dt>
4481 <dd>
4482 <ul>
4483 <li>
4484 <dl>
4485 <dd>
4486 <dl>
4487 <dd>
4488 <dl>
4489 <dd>
4490 <dl>
4491 <dt>bar (who uses this?)</dt>
4492 </dl>
4493 </dd>
4494 </dl>
4495 </dd>
4496 </dl>
4497 </dd>
4498 </dl>
4499 </li>
4500 </ul>
4501 </dd>
4502 </dl>
4503 </li>
4504 </ol>
4505 </li>
4506 </ul>
4507 !! html/parsoid
4508 <ul>
4509 <li>
4510 <ol>
4511 <li>
4512 <dl>
4513 <dt>
4514 <ul>
4515 <li>
4516 <dl>
4517 <dd>
4518 <dl>
4519 <dd>
4520 <dl>
4521 <dt>
4522 <dl>
4523 <dt> foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span></dt>
4524 <dd data-parsoid='{"stx":"row"}'> bar (who uses this?)</dd>
4525 </dl></dt>
4526 </dl></dd>
4527 </dl></dd>
4528 </dl></li>
4529 </ul></dt>
4530 </dl></li>
4531 </ol></li>
4532 </ul>
4533 !! end
4534
4535 !! test
4536 Definition Lists: colons occurring in tags
4537 !! wikitext
4538 ;a:b
4539 ;'''a:b'''
4540 ;<i>a:b</i>
4541 ;<span>a:b</span>
4542 ;<div>a:b</div>
4543 ;<div>a
4544 :b</div>
4545 ;{{echo|a:b}}
4546 ;{{echo|''a:b''}}
4547 ;;;''a:b''
4548 !! html+tidy
4549 <dl>
4550 <dt>a</dt>
4551 <dd>b</dd>
4552 <dt><b>a:b</b></dt>
4553 <dt><i>a:b</i></dt>
4554 <dt><span>a:b</span></dt>
4555 <dd>
4556 <div>a:b</div>
4557 </dd>
4558 <dd>
4559 <div>a
4560 <dl>
4561 <dd>b</dd>
4562 </dl>
4563 </div>
4564 </dd>
4565 <dt>a</dt>
4566 <dd>b</dd>
4567 <dt><i>a:b</i></dt>
4568 </dl>
4569 <dl>
4570 <dd>
4571 <dl>
4572 <dd>
4573 <dl>
4574 <dt><i>a:b</i></dt>
4575 </dl>
4576 </dd>
4577 </dl>
4578 </dd>
4579 </dl>
4580 !! html/parsoid
4581 <dl><dt>a</dt><dd data-parsoid='{"stx":"row"}'>b</dd>
4582 <dt><b>a:b</b></dt>
4583 <dt><i data-parsoid='{"stx":"html"}'>a:b</i></dt>
4584 <dt><span data-parsoid='{"stx":"html"}'>a:b</span></dt>
4585 <dt><div data-parsoid='{"stx":"html"}'>a:b</div></dt>
4586 <dt><div data-parsoid='{"stx":"html","autoInsertedEnd":true}'>a</div></dt>
4587 <dd>b</dd>
4588 <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>
4589 <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>
4590 <dl><dt><dl><dt><i>a:b</i></dt></dl></dt></dl></dt></dl>
4591 !! end
4592
4593 !! test
4594 Definition Lists: colons and tables 1
4595 !! wikitext
4596 :{|
4597 | x
4598 |}
4599 :{|
4600 | y
4601 |}
4602 !! html
4603 <dl><dd><table>
4604 <tr>
4605 <td> x
4606 </td></tr></table></dd></dl>
4607 <dl><dd><table>
4608 <tr>
4609 <td> y
4610 </td></tr></table></dd></dl>
4611
4612 !! end
4613
4614 # Parsoid's output (as documented below) differs from php's in this case.
4615 # This is probably a bug. If we fixup parsoid to match php's output, the
4616 # above test should pass and the below test case can be removed. It is
4617 # unclear which output is more desirable.
4618
4619 !! test
4620 Definition Lists: colons and tables 2
4621 !! wikitext
4622 :{|
4623 | x
4624 |}
4625 :{|
4626 | y
4627 |}
4628 !! html/parsoid
4629 <dl><dd><table>
4630 <tr>
4631 <td> x
4632 </td></tr></table></dd>
4633 <dd><table>
4634 <tr>
4635 <td> y
4636 </td></tr></table></dd></dl>
4637 !! end
4638
4639 !! test
4640 Definition Lists: template interaction
4641 !! wikitext
4642 ::{{definition_list}}
4643
4644 :one
4645 ::{{definition_list}}
4646 :::two
4647 :::three
4648 ::four
4649 !! html/parsoid
4650 <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">
4651 </span><dd about="#mwt1">two</dd></dl></dd></dl>
4652
4653 <dl><dd data-parsoid='{}'>one
4654 <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">
4655 </span><dd about="#mwt2">two
4656 <dl><dd>two</dd>
4657 <dd>three</dd></dl></dd>
4658 <dd data-parsoid='{}'>four</dd></dl></dd></dl>
4659 !! end
4660
4661
4662 ###
4663 ### External links
4664 ###
4665 !! test
4666 External links: non-bracketed
4667 !! wikitext
4668 Non-bracketed: http://example.com
4669 !! html
4670 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4671 </p>
4672 !! end
4673
4674 # parsoid doesn't explicitly mark autonumbered links, see T55505
4675 !! test
4676 External links: numbered
4677 !! wikitext
4678 Numbered: [http://example.com]
4679 Numbered: [http://example.net]
4680 Numbered: [http://example.com]
4681 !! html/php
4682 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
4683 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
4684 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
4685 </p>
4686 !! html/parsoid
4687 <p>Numbered: <a rel="mw:ExtLink" href="http://example.com"></a>
4688 Numbered: <a rel="mw:ExtLink" href="http://example.net"></a>
4689 Numbered: <a rel="mw:ExtLink" href="http://example.com"></a></p>
4690 !!end
4691
4692 !! test
4693 External links: specified text
4694 !! wikitext
4695 Specified text: [http://example.com link]
4696 !! html
4697 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
4698 </p>
4699 !!end
4700
4701 !! test
4702 External links: trail
4703 !! wikitext
4704 Linktrails should not work for external links: [http://example.com link]s
4705 !! html
4706 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
4707 </p>
4708 !! end
4709
4710 !! test
4711 External links: dollar sign in URL
4712 !! wikitext
4713 http://example.com/1$2345
4714 !! html
4715 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
4716 </p>
4717 !! end
4718
4719 # parsoid doesn't explicitly mark autonumbered links, see T55505
4720 !! test
4721 External links: dollar sign in URL (autonumber)
4722 !! wikitext
4723 [http://example.com/1$2345]
4724 !! html/php
4725 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
4726 </p>
4727 !! html/parsoid
4728 <p><a rel="mw:ExtLink" href="http://example.com/1$2345"></a></p>
4729 !!end
4730
4731 !! test
4732 External links: open square bracket forbidden in URL (T6377)
4733 !! options
4734 parsoid=wt2html,wt2wt,html2html
4735 !! wikitext
4736 http://example.com/1[2345
4737 !! html/php
4738 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
4739 </p>
4740 !! html/parsoid
4741 <p><a rel="mw:ExtLink" href="http://example.com/1">http://example.com/1</a>[2345</p>
4742 !! end
4743
4744 !! test
4745 External links: open square bracket forbidden in URL (named) (T6377)
4746 !! options
4747 parsoid=wt2html,html2html
4748 !! wikitext
4749 [http://example.com/1[2345]
4750 !! html/php
4751 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4752 </p>
4753 !! html/parsoid
4754 <p><a rel="mw:ExtLink" href="http://example.com/1">[2345</a></p>
4755 !!end
4756
4757 # parsoid adds a space before the link name
4758 !! test
4759 External links: open square bracket forbidden in URL (named) (T6377)
4760 Parsoid variant.
4761 !! wikitext
4762 [http://example.com/1 [2345]
4763 !! html
4764 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4765 </p>
4766 !!end
4767
4768 !! test
4769 External links: nowiki in URL link text (T8230)
4770 !! wikitext
4771 [http://example.com/ <nowiki>''example site''</nowiki>]
4772 !! html
4773 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
4774 </p>
4775 !! end
4776
4777 !! test
4778 External links: newline forbidden in text (T8230 regression check)
4779 !! wikitext
4780 [http://example.com/ first
4781 second]
4782 !! html
4783 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
4784 second]
4785 </p>
4786 !!end
4787
4788 !! test
4789 External links: Pipe char between url and text
4790 !! wikitext
4791 [http://example.com | link]
4792 !! html
4793 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
4794 </p>
4795 !!end
4796
4797 !! test
4798 External links: protocol-relative URL in brackets
4799 !! wikitext
4800 [//example.com/ Test]
4801 !! html
4802 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
4803 </p>
4804 !! end
4805
4806 # parsoid doesn't explicitly mark autonumbered links, see T55505
4807 !! test
4808 External links: protocol-relative URL in brackets without text
4809 !! wikitext
4810 [//example.com]
4811 !! html/php
4812 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
4813 </p>
4814 !! html/parsoid
4815 <p><a rel="mw:ExtLink" href="//example.com"></a></p>
4816 !! end
4817
4818 !! test
4819 External links: protocol-relative URL in free text is left alone
4820 !! wikitext
4821 //example.com/Foo
4822 !! html
4823 <p>//example.com/Foo
4824 </p>
4825 !!end
4826
4827 !! test
4828 External links: protocol-relative URL in the middle of a word is left alone (T32269)
4829 !! wikitext
4830 foo//example.com/Foo
4831 !! html
4832 <p>foo//example.com/Foo
4833 </p>
4834 !! end
4835
4836 ## html2wt and html2html will fail because we will prefer the :en: interwiki prefix over wikipedia:
4837 !! test
4838 External links: with no contents
4839 !! options
4840 parsoid=wt2html,wt2wt
4841 !! wikitext
4842 [http://en.wikipedia.org/wiki/Foo]
4843
4844 [[wikipedia:Foo|Bar]]
4845
4846 [[wikipedia:Foo|<span>Bar</span>]]
4847 !! html/php
4848 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/wiki/Foo">[1]</a>
4849 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
4850 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo"><span>Bar</span></a>
4851 </p>
4852 !! html/parsoid
4853 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo"></a></p>
4854 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo">Bar</a></p>
4855 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo"><span>Bar</span></a></p>
4856 !! end
4857
4858 !! test
4859 External links: Free with trailing punctuation
4860 !! wikitext
4861 http://example.com,
4862 http://example.com;
4863 http://example.com\
4864 http://example.com.
4865 http://example.com:
4866 http://example.com!
4867 http://example.com?
4868 http://example.com)
4869 http://example.com/url_with_(brackets)
4870 (http://example.com/url_without_brackets)
4871 http://example.com/url_with_entity&amp;
4872 http://example.com/url_with_entity&#x26;
4873 http://example.com/url_with_entity&#038;
4874 http://example.com/url_with_entity&nbsp;
4875 http://example.com/url_with_entity&#xA0;
4876 http://example.com/url_with_entity&#160;
4877 http://example.com/url_with_entity&lt;
4878 http://example.com/url_with_entity&#x3C;
4879 http://example.com/url_with_entity&#60;
4880 !! html/php
4881 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
4882 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>;
4883 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>\
4884 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.
4885 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
4886 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>!
4887 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>?
4888 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
4889 <a rel="nofollow" class="external free" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
4890 (<a rel="nofollow" class="external free" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
4891 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4892 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4893 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4894 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#160;
4895 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#xa0;
4896 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#160;
4897 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&lt;
4898 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#x3c;
4899 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#60;
4900 </p>
4901 !! html/parsoid
4902 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>,
4903 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>;
4904 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>\
4905 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>.
4906 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:
4907 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>!
4908 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>?
4909 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)
4910 <a rel="mw:ExtLink" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
4911 (<a rel="mw:ExtLink" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
4912 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4913 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4914 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4915 <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>
4916 <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>
4917 <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>
4918 <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>
4919 <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>
4920 <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>
4921 !! end
4922
4923 !! test
4924 External links: tricky Parsoid html2html case
4925 !! options
4926 parsoid=wt2html,wt2wt,html2html
4927 !! wikitext
4928 http://example.com/url_with_entity&amp;amp;
4929 !! html/php
4930 <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>;
4931 </p>
4932 !! html/parsoid
4933 <p><a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;amp">http://example.com/url_with_entity&amp;amp</a>;</p>
4934 !! end
4935
4936 !! test
4937 External links: Free with trailing quotes (T113666)
4938 !! wikitext
4939 '''News:''' Stuff here
4940
4941 news:'a'b''c''d e
4942 !! html/php
4943 <p><b>News:</b> Stuff here
4944 </p><p><a rel="nofollow" class="external free" href="news:&#39;a&#39;b">news:'a'b</a><i>c</i>d e
4945 </p>
4946 !! html/parsoid
4947 <p><b>News:</b> Stuff here</p>
4948 <p><a rel="mw:ExtLink" href="news:'a'b">news:'a'b</a><i>c</i>d e</p>
4949 !! end
4950
4951 !! test
4952 External links: with entity
4953 !! wikitext
4954 [http://&#x20;www.librarieswithoutborders.org Libraries without borders]
4955 !! html/php
4956 <p><a rel="nofollow" class="external text" href="http://+www.librarieswithoutborders.org">Libraries without borders</a>
4957 </p>
4958 !! html/parsoid
4959 <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>
4960 !! end
4961
4962 !! test
4963 External links: Lone protocols are never linked (T105697)
4964 !! wikitext
4965 http://
4966 http://;
4967 (http://)
4968 bitcoin:
4969 bitcoin:;
4970 (bitcoin:)
4971 !! html
4972 <p>http://
4973 http://;
4974 (http://)
4975 bitcoin:
4976 bitcoin:;
4977 (bitcoin:)
4978 </p>
4979 !! end
4980
4981 !! test
4982 External links: No preceding word characters allowed (T67278)
4983 !! wikitext
4984 NOPEhttp://example.com
4985 N0http://example.com
4986 ok:http://example.com
4987 ok-http://example.com
4988 !! html
4989 <p>NOPEhttp://example.com
4990 N0http://example.com
4991 ok:<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4992 ok-<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4993 </p>
4994 !! end
4995
4996 !! test
4997 External links: nofollow domain exception
4998 !! wikitext
4999 A [https://no-nofollow.org/foobar link], and another [https://example.org link].
5000 !! html
5001 <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>.
5002 </p>
5003 !!end
5004
5005 !! test
5006 External image
5007 !! wikitext
5008 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
5009 !! html
5010 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png"/>
5011 </p>
5012 !! end
5013
5014 !! test
5015 External image from https
5016 !! wikitext
5017 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
5018 !! html
5019 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png"/>
5020 </p>
5021 !! end
5022
5023 !! test
5024 External image (when not allowed)
5025 !! options
5026 wgAllowExternalImages=0
5027 !! wikitext
5028 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
5029 !! html
5030 <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>
5031 </p>
5032 !! end
5033
5034 !! test
5035 Link to non-http image, no img tag
5036 !! wikitext
5037 Link to non-http image, no img tag: ftp://example.com/test.jpg
5038 !! html
5039 <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>
5040 </p>
5041 !! end
5042
5043 !! test
5044 External links: terminating separator
5045 !! wikitext
5046 Terminating separator: http://example.com/thing,
5047 !! html
5048 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
5049 </p>
5050 !! end
5051
5052 !! test
5053 External links: intervening separator
5054 !! wikitext
5055 Intervening separator: http://example.com/1,2,3
5056 !! html
5057 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
5058 </p>
5059 !! end
5060
5061 !! test
5062 External links: old bug with URL in query
5063 !! wikitext
5064 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
5065 !! html
5066 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
5067 </p>
5068 !! end
5069
5070 !! test
5071 External links: old URL-in-URL bug, mixed protocols
5072 !! wikitext
5073 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
5074 !! html
5075 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
5076 </p>
5077 !!end
5078
5079 # Since Parsoid is starting to emit canonical wikitext for links,
5080 # [http://example.com http://example.com] will not RT back to that
5081 # form anymore.
5082 !! test
5083 External links: URL in text
5084 !! options
5085 parsoid=wt2html
5086 !! wikitext
5087 URL in text: [http://example.com http://example.com]
5088 !! html/php
5089 <p>URL in text: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
5090 </p>
5091 !! html/parsoid
5092 <p>URL in text: <a rel="mw:ExtLink" href="http://example.com">http://example.com</a></p>
5093 !! end
5094
5095 !! test
5096 External links: Clickable images
5097 !! wikitext
5098 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
5099 !! html/php
5100 <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>
5101 </p>
5102 !! html/parsoid
5103 <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>
5104 !! end
5105
5106 !! test
5107 External links: raw ampersand
5108 !! wikitext
5109 Old &amp; use: http://x&y
5110 !! html
5111 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
5112 </p>
5113 !! end
5114
5115 !! test
5116 External links: encoded ampersand
5117 !! wikitext
5118 Old &amp; use: http://x&amp;y
5119 !! html/php
5120 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
5121 </p>
5122 !! html/parsoid
5123 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y">http://x&amp;y</a></p>
5124 !! end
5125
5126 !! test
5127 External links: encoded equals (T8102)
5128 !! wikitext
5129 http://example.com/?foo&#61;bar
5130 !! html/php
5131 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
5132 </p>
5133 !! html/parsoid
5134 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a></p>
5135 !! end
5136
5137 ##
5138 ## Note that parsoid doesn't explicit mark autonumbered links, nor
5139 ## does it number them. As discussed in T55505, we can identify
5140 ## autonumbered links via CSS.
5141 ##
5142
5143 !! test
5144 External links: [raw ampersand]
5145 !! wikitext
5146 Old &amp; use: [http://x&y]
5147 !! html/php
5148 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
5149 </p>
5150 !! html/parsoid
5151 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
5152 !! end
5153
5154 # note that parsoid html is identical to [raw ampersand] case; so html2wt
5155 # mode will return the [raw ampersand] wikitext
5156 !! test
5157 External links: [encoded ampersand]
5158 !! options
5159 parsoid=wt2html,wt2wt,html2html
5160 !! wikitext
5161 Old &amp; use: [http://x&amp;y]
5162 !! html/php
5163 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
5164 </p>
5165 !! html/parsoid
5166 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
5167 !! end
5168
5169 !! test
5170 External links: [raw equals]
5171 !! wikitext
5172 [http://example.com/?foo=bar]
5173 !! html/php
5174 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
5175 </p>
5176 !! html/parsoid
5177 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
5178 !! end
5179
5180 # note that parsoid html is identical to [raw equals] case; so html2wt
5181 # mode will return the [raw equals] wikitext
5182 !! test
5183 External links: [encoded equals] (T8102)
5184 !! options
5185 parsoid=wt2html,wt2wt,html2html
5186 !! wikitext
5187 [http://example.com/?foo&#61;bar]
5188 !! html/php
5189 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
5190 </p>
5191 !! html/parsoid
5192 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
5193 !! end
5194
5195 # xxx parsoid strips the IDN character, so the round-trip tests will
5196 # obviously fail and are disabled. --cscott
5197 !! test
5198 External links: [IDN ignored character reference in hostname; strip it right off]
5199 !! options
5200 parsoid=wt2html,wt2wt,html2html
5201 !! wikitext
5202 [http://e&zwnj;xample.com/]
5203 !! html/php
5204 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
5205 </p>
5206 !! html/parsoid
5207 <p><a rel="mw:ExtLink" href="http://example.com/"></a></p>
5208 !! end
5209
5210 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
5211 # Where an external link could easily circumvent the sanitization of the text of
5212 # a link like this (where an IDN-ignore character is in the URL somewhere), this
5213 # test demands a higher standard. That's a bit strange.
5214 #
5215 # Example:
5216 #
5217 # http://e‌xample.com -> [http://example.com|http://example.com]
5218 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
5219 #
5220 # The first example is sanitized, but the second is not. Any security benefits
5221 # from this production are trivial to circumvent. Either remove this test and
5222 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
5223 # the test accordingly.
5224 #
5225 # All our love,
5226 # The Parsoid team.
5227 # xxx parsoid strips the IDN character, so the round-trip tests will
5228 # obviously fail and are disabled. --cscott
5229 !! test
5230 External links: IDN ignored character reference in hostname; strip it right off
5231 !! options
5232 parsoid=wt2html,html2html
5233 !! wikitext
5234 http://e&zwnj;xample.com/
5235 !! html/php
5236 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
5237 </p>
5238 !! html/parsoid
5239 <p><a rel="mw:ExtLink" href="http://example.com/">http://example.com/</a></p>
5240 !! end
5241
5242 !! test
5243 External links: www.jpeg.org (T2554)
5244 !! wikitext
5245 http://www.jpeg.org
5246 !! html
5247 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
5248 </p>
5249 !! end
5250
5251 # parsoid doesn't explicitly mark autonumbered links, see T55505
5252 !! test
5253 External links: URL within URL (T2002)
5254 !! wikitext
5255 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
5256 !! html/php
5257 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
5258 </p>
5259 !! html/parsoid
5260 <p><a rel="mw:ExtLink" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp"></a></p>
5261 !! end
5262
5263 !! test
5264 T2361: URL inside bracketed URL
5265 !! wikitext
5266 [http://www.example.com/foo http://www.example.com/bar]
5267 !! html
5268 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
5269 </p>
5270 !! end
5271
5272 !! test
5273 T2361: URL within URL, not bracketed
5274 !! wikitext
5275 http://www.example.com/foo?=http://www.example.com/bar
5276 !! html
5277 <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>
5278 </p>
5279 !! end
5280
5281 !! test
5282 T2289: ">"-token in URL-tail
5283 !! wikitext
5284 http://www.example.com/<hello>
5285 !! html
5286 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
5287 </p>
5288 !!end
5289
5290 !! test
5291 T2289: literal ">"-token in URL-tail
5292 !! wikitext
5293 http://www.example.com/<b>html</b>
5294 !! html/php
5295 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
5296 </p>
5297 !! html/parsoid
5298 <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>
5299 !! end
5300
5301 !! test
5302 T2289: ">"-token in bracketed URL
5303 !! wikitext
5304 [http://www.example.com/<hello> stuff]
5305 !! html
5306 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
5307 </p>
5308 !!end
5309
5310 !! test
5311 T2289: literal ">"-token in bracketed URL
5312 !! wikitext
5313 [http://www.example.com/<b>html</b> stuff]
5314 !! html
5315 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
5316 </p>
5317 !!end
5318
5319 !! test
5320 T2289: literal double quote at end of URL
5321 !! wikitext
5322 http://www.example.com/"hello"
5323 !! html
5324 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
5325 </p>
5326 !!end
5327
5328 !! test
5329 T2289: literal double quote in bracketed URL
5330 !! wikitext
5331 [http://www.example.com/"hello" stuff]
5332 !! html
5333 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
5334 </p>
5335 !!end
5336
5337 !! test
5338 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (T7081)
5339 !! wikitext
5340 [http://www.example.com test]
5341 !! html
5342 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
5343 </p>
5344 !! end
5345
5346 !! test
5347 External links: link text with spaces
5348 !! wikitext
5349 [http://www.example.com a b c]
5350 [http://www.example.com ''a'' ''b'']
5351 !! html
5352 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
5353 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
5354 </p>
5355 !! end
5356
5357 !! test
5358 External links: wiki links within external link (T5695)
5359 !! options
5360 parsoid=wt2html,html2html
5361 !! wikitext
5362 [http://example.com [[wikilink]] embedded in ext link]
5363 !! html/php
5364 <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>
5365 </p>
5366 !! html/parsoid
5367 <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>
5368 !! end
5369
5370 !! test
5371 T2787: Links with one slash after the url protocol are invalid
5372 !! wikitext
5373 http:/example.com
5374
5375 [http:/example.com title]
5376 !! html
5377 <p>http:/example.com
5378 </p><p>[http:/example.com title]
5379 </p>
5380 !! end
5381
5382 !! test
5383 Bracketed external links with template-generated invalid target
5384 !! wikitext
5385 [{{echo|http:/example.com}} title]
5386 !! html
5387 <p>[http:/example.com title]
5388 </p>
5389 !! end
5390
5391 # wt2html only because Parsoid would want to add <nowiki>s coming from html
5392 !! test
5393 Broken wikilinks (but not external links) prevent templates from closing
5394 !! options
5395 parsoid=wt2html
5396 !! wikitext
5397 [http://example.com x
5398
5399 {{echo|[http://example.com x}}
5400
5401 [[Foo
5402
5403 {{echo|[[Foo}}
5404 !! html/php
5405 <p>[<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> x
5406 </p><p>[<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> x
5407 </p><p>[[Foo
5408 </p><p>{{echo|[[Foo}}
5409 </p>
5410 !! html/parsoid
5411 <p>[<a rel="mw:ExtLink" href="http://example.com">http://example.com</a> x</p>
5412 <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>
5413 <p>[[Foo</p>
5414 <p>{{echo|[[Foo}}</p>
5415 !! end
5416
5417 !! test
5418 Wikilinks with embedded newlines are not broken
5419 !! wikitext
5420 {{echo|[[ Foo
5421 B
5422 C]]}}
5423 !! html/php
5424 <p>[[ Foo
5425 B
5426 C]]
5427 </p>
5428 !! html/parsoid
5429 <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>
5430 !! end
5431
5432 !! test
5433 Broken templates
5434 !! options
5435 parsoid=wt2html
5436 !! wikitext
5437 {{echo|[[Foo|}}]]
5438
5439 [[Foo|{{echo|]]}}
5440 !! html/php
5441 <p>{{echo|<a href="/wiki/Foo" title="Foo">}}</a>
5442 </p><p>[[Foo|]]
5443 </p>
5444 !! html/parsoid
5445 <p>{{echo|<a rel="mw:WikiLink" href="./Foo" title="Foo">}}</a></p>
5446 <p>[[Foo|<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"]]"}},"i":0}}]}'>]]</span></p>
5447 !! end
5448
5449 !! test
5450 T4702: Mismatched <i>, <b> and <a> tags are invalid
5451 !! wikitext
5452 ''[http://example.com text'']
5453 [http://example.com '''text]'''
5454 ''Something [http://example.com in italic'']
5455 ''Something [http://example.com mixed''''', even bold]'''
5456 '''''Now [http://example.com both''''']
5457 !! html
5458 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
5459 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
5460 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
5461 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
5462 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
5463 </p>
5464 !! end
5465
5466
5467 !! test
5468 T6781: %26 in URL
5469 !! wikitext
5470 http://www.example.com/?title=AT%26T
5471 !! html/php
5472 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
5473 </p>
5474 !! html/parsoid
5475 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a></p>
5476 !! end
5477
5478 # According to https://www.w3.org/TR/2011/WD-html5-20110525/Overview.html#parsing-urls a plain
5479 # % is actually legal in HTML5. Any change in output would need testing though.
5480 !! test
5481 T6781, T7267: %25 in URL
5482 !! wikitext
5483 http://www.example.com/?title=100%25_Bran
5484 !! html/php
5485 <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>
5486 </p>
5487 !! html/parsoid
5488 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran">http://www.example.com/?title=100%25_Bran</a></p>
5489 !! end
5490
5491 !! test
5492 T6781, T7267: %28, %29 in URL
5493 !! wikitext
5494 http://www.example.com/?title=Ben-Hur_%281959_film%29
5495 !! html/php
5496 <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>
5497 </p>
5498 !! html/parsoid
5499 <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>
5500 !! end
5501
5502
5503 !! test
5504 T6781: %26 in autonumber URL
5505 !! wikitext
5506 [http://www.example.com/?title=AT%26T]
5507 !! html/php
5508 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
5509 </p>
5510 !! html/parsoid
5511 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T"></a></p>
5512 !! end
5513
5514 !! test
5515 T6781, T7267: %26 in autonumber URL
5516 !! wikitext
5517 [http://www.example.com/?title=100%25_Bran]
5518 !! html/php
5519 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
5520 </p>
5521 !! html/parsoid
5522 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran"></a></p>
5523 !! end
5524
5525 !! test
5526 T6781, T7267: %28, %29 in autonumber URL
5527 !! wikitext
5528 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
5529 !! html/php
5530 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
5531 </p>
5532 !! html/parsoid
5533 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29"></a></p>
5534 !! end
5535
5536
5537 !! test
5538 T6781: %26 in bracketed URL
5539 !! wikitext
5540 [http://www.example.com/?title=AT%26T link]
5541 !! html/php
5542 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
5543 </p>
5544 !! html/parsoid
5545 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">link</a></p>
5546 !! end
5547
5548 !! test
5549 T6781, T7267: %25 in bracketed URL
5550 !! wikitext
5551 [http://www.example.com/?title=100%25_Bran link]
5552 !! html
5553 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
5554 </p>
5555 !! end
5556
5557 !! test
5558 T6781, T7267: %28, %29 in bracketed URL
5559 !! wikitext
5560 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
5561 !! html/php
5562 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
5563 </p>
5564 !! html/parsoid
5565 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a></p>
5566 !! end
5567
5568 !! test
5569 External link containing a period in the anchor. (T65947)
5570 !! wikitext
5571 [//foo.org/bar#baz. bang]
5572
5573 [//foo.org/bar. bang]
5574 !! html/php
5575 <p><a rel="nofollow" class="external text" href="//foo.org/bar#baz.">bang</a>
5576 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar.">bang</a>
5577 </p>
5578 !! html/parsoid
5579 <p><a rel="mw:ExtLink" href="//foo.org/bar#baz.">bang</a></p>
5580 <p><a rel="mw:ExtLink" href="//foo.org/bar.">bang</a></p>
5581 !! end
5582
5583 !! test
5584 External link containing a single quote. (T65947)
5585 !! wikitext
5586 [//foo.org/bar'baz]
5587
5588 [//foo.org/bar'baz bang]
5589 !! html/php
5590 <p><a rel="nofollow" class="external autonumber" href="//foo.org/bar&#39;baz">[1]</a>
5591 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar&#39;baz">bang</a>
5592 </p>
5593 !! html/parsoid
5594 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz"></a></p>
5595 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz">bang</a></p>
5596 !! end
5597
5598 !! test
5599 External link containing double-single-quotes in text '' (T6598 sanity check)
5600 !! wikitext
5601 Some [http://example.com/ pretty ''italics'' and stuff]!
5602 !! html
5603 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
5604 </p>
5605 !! end
5606
5607 !! test
5608 External link containing double-single-quotes in text embedded in italics (T6598 sanity check)
5609 !! wikitext
5610 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
5611 !! html
5612 <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>
5613 </p>
5614 !! end
5615
5616 !! test
5617 External link containing double-single-quotes with no space separating the url from text in italics
5618 !! wikitext
5619 [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]].]
5620 !! html/php
5621 <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>
5622 </p>
5623 !! html/php+tidy
5624 <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>
5625 !! html/parsoid
5626 <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>
5627 !! end
5628
5629 !! test
5630 External link with comments in link text
5631 !! wikitext
5632 [http://www.google.com Google <!-- comment -->]
5633 !! html/php
5634 <p><a rel="nofollow" class="external text" href="http://www.google.com">Google </a>
5635 </p>
5636 !! html/parsoid
5637 <p><a rel="mw:ExtLink" href="http://www.google.com">Google <!-- comment --></a></p>
5638 !! end
5639
5640 !! test
5641 External link to bare IPv4 address
5642 !! wikitext
5643 [http://192.168.0.1 Link]
5644 !! html/php
5645 <p><a rel="nofollow" class="external text" href="http://192.168.0.1">Link</a>
5646 </p>
5647 !! html/parsoid
5648 <p><a rel="mw:ExtLink" href="http://192.168.0.1">Link</a></p>
5649 !! end
5650
5651 !! test
5652 URL-encoding in URL functions (single parameter)
5653 !! wikitext
5654 {{localurl:Some page|amp=&}}
5655 !! html
5656 <p>/index.php?title=Some_page&amp;amp=&amp;
5657 </p>
5658 !! end
5659
5660 !! test
5661 URL-encoding in URL functions (multiple parameters)
5662 !! wikitext
5663 {{localurl:Some page|q=?&amp=&}}
5664 !! html
5665 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
5666 </p>
5667 !! end
5668
5669 !! test
5670 Brackets in urls
5671 !! wikitext
5672 http://example.com/index.php?foozoid%5B%5D=bar
5673
5674 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
5675 !! html/php
5676 <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>
5677 </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>
5678 </p>
5679 !! html/parsoid
5680 <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>
5681
5682 <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>
5683 !! end
5684
5685 !! test
5686 IPv6 urls, autolink format (T23261)
5687 !! wikitext
5688 http://[2404:130:0:1000::187:2]/index.php
5689
5690 Examples from RFC 2373, section 2.2:
5691 * http://[1080::8:800:200C:417A]/unicast
5692 * http://[FF01::101]/multicast
5693 * http://[::1]/loopback
5694 * http://[::]/unspecified
5695 * http://[::13.1.68.3]/ipv4compat
5696 * http://[::FFFF:129.144.52.38]/ipv4compat
5697
5698 Examples from RFC 2732, section 2:
5699 * http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html
5700 * http://[1080:0:0:0:8:800:200C:417A]/index.html
5701 * http://[3ffe:2a00:100:7031::1]
5702 * http://[1080::8:800:200C:417A]/foo
5703 * http://[::192.9.5.5]/ipng
5704 * http://[::FFFF:129.144.52.38]:80/index.html
5705 * http://[2010:836B:4179::836B:4179]
5706
5707 !! html/php
5708 <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>
5709 </p><p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc2373">RFC 2373</a>, section 2.2:
5710 </p>
5711 <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>
5712 <li> <a rel="nofollow" class="external free" href="http://[FF01::101]/multicast">http://[FF01::101]/multicast</a></li>
5713 <li> <a rel="nofollow" class="external free" href="http://[::1]/loopback">http://[::1]/loopback</a></li>
5714 <li> <a rel="nofollow" class="external free" href="http://[::]/unspecified">http://[::]/unspecified</a></li>
5715 <li> <a rel="nofollow" class="external free" href="http://[::13.1.68.3]/ipv4compat">http://[::13.1.68.3]/ipv4compat</a></li>
5716 <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>
5717 <p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc2732">RFC 2732</a>, section 2:
5718 </p>
5719 <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>
5720 <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>
5721 <li> <a rel="nofollow" class="external free" href="http://[3ffe:2a00:100:7031::1]">http://[3ffe:2a00:100:7031::1]</a></li>
5722 <li> <a rel="nofollow" class="external free" href="http://[1080::8:800:200C:417A]/foo">http://[1080::8:800:200C:417A]/foo</a></li>
5723 <li> <a rel="nofollow" class="external free" href="http://[::192.9.5.5]/ipng">http://[::192.9.5.5]/ipng</a></li>
5724 <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>
5725 <li> <a rel="nofollow" class="external free" href="http://[2010:836B:4179::836B:4179]">http://[2010:836B:4179::836B:4179]</a></li></ul>
5726
5727 !! html/parsoid
5728 <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>
5729
5730 <p>Examples from <a href="https://tools.ietf.org/html/rfc2373" rel="mw:ExtLink">RFC 2373</a>, section 2.2:</p>
5731 <ul><li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/unicast">http://[1080::8:800:200C:417A]/unicast</a></li>
5732 <li> <a rel="mw:ExtLink" href="http://[FF01::101]/multicast">http://[FF01::101]/multicast</a></li>
5733 <li> <a rel="mw:ExtLink" href="http://[::1]/loopback">http://[::1]/loopback</a></li>
5734 <li> <a rel="mw:ExtLink" href="http://[::]/unspecified">http://[::]/unspecified</a></li>
5735 <li> <a rel="mw:ExtLink" href="http://[::13.1.68.3]/ipv4compat">http://[::13.1.68.3]/ipv4compat</a></li>
5736 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]/ipv4compat">http://[::FFFF:129.144.52.38]/ipv4compat</a></li></ul>
5737
5738 <p>Examples from <a href="https://tools.ietf.org/html/rfc2732" rel="mw:ExtLink">RFC 2732</a>, section 2:</p>
5739 <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>
5740 <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>
5741 <li> <a rel="mw:ExtLink" href="http://[3ffe:2a00:100:7031::1]">http://[3ffe:2a00:100:7031::1]</a></li>
5742 <li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/foo">http://[1080::8:800:200C:417A]/foo</a></li>
5743 <li> <a rel="mw:ExtLink" href="http://[::192.9.5.5]/ipng">http://[::192.9.5.5]/ipng</a></li>
5744 <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>
5745 <li> <a rel="mw:ExtLink" href="http://[2010:836B:4179::836B:4179]">http://[2010:836B:4179::836B:4179]</a></li></ul>
5746 !! end
5747
5748 !! test
5749 IPv6 urls, bracketed format (T23261)
5750 !! wikitext
5751 [http://[2404:130:0:1000::187:2]/index.php test]
5752
5753 Examples from RFC 2373, section 2.2:
5754 * [http://[1080::8:800:200C:417A] unicast]
5755 * [http://[FF01::101] multicast]
5756 * [http://[::1]/ loopback]
5757 * [http://[::] unspecified]
5758 * [http://[::13.1.68.3] ipv4compat]
5759 * [http://[::FFFF:129.144.52.38] ipv4compat]
5760
5761 Examples from RFC 2732, section 2:
5762 * [http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html 1]
5763 * [http://[1080:0:0:0:8:800:200C:417A]/index.html 2]
5764 * [http://[3ffe:2a00:100:7031::1] 3]
5765 * [http://[1080::8:800:200C:417A]/foo 4]
5766 * [http://[::192.9.5.5]/ipng 5]
5767 * [http://[::FFFF:129.144.52.38]:80/index.html 6]
5768 * [http://[2010:836B:4179::836B:4179] 7]
5769
5770 !! html/php
5771 <p><a rel="nofollow" class="external text" href="http://[2404:130:0:1000::187:2]/index.php">test</a>
5772 </p><p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc2373">RFC 2373</a>, section 2.2:
5773 </p>
5774 <ul><li> <a rel="nofollow" class="external text" href="http://[1080::8:800:200C:417A]">unicast</a></li>
5775 <li> <a rel="nofollow" class="external text" href="http://[FF01::101]">multicast</a></li>
5776 <li> <a rel="nofollow" class="external text" href="http://[::1]/">loopback</a></li>
5777 <li> <a rel="nofollow" class="external text" href="http://[::]">unspecified</a></li>
5778 <li> <a rel="nofollow" class="external text" href="http://[::13.1.68.3]">ipv4compat</a></li>
5779 <li> <a rel="nofollow" class="external text" href="http://[::FFFF:129.144.52.38]">ipv4compat</a></li></ul>
5780 <p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc2732">RFC 2732</a>, section 2:
5781 </p>
5782 <ul><li> <a rel="nofollow" class="external text" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">1</a></li>
5783 <li> <a rel="nofollow" class="external text" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">2</a></li>
5784 <li> <a rel="nofollow" class="external text" href="http://[3ffe:2a00:100:7031::1]">3</a></li>
5785 <li> <a rel="nofollow" class="external text" href="http://[1080::8:800:200C:417A]/foo">4</a></li>
5786 <li> <a rel="nofollow" class="external text" href="http://[::192.9.5.5]/ipng">5</a></li>
5787 <li> <a rel="nofollow" class="external text" href="http://[::FFFF:129.144.52.38]:80/index.html">6</a></li>
5788 <li> <a rel="nofollow" class="external text" href="http://[2010:836B:4179::836B:4179]">7</a></li></ul>
5789
5790 !! html/parsoid
5791 <p><a rel="mw:ExtLink" href="http://[2404:130:0:1000::187:2]/index.php">test</a></p>
5792
5793 <p>Examples from <a href="https://tools.ietf.org/html/rfc2373" rel="mw:ExtLink">RFC 2373</a>, section 2.2:</p>
5794 <ul><li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]">unicast</a></li>
5795 <li> <a rel="mw:ExtLink" href="http://[FF01::101]">multicast</a></li>
5796 <li> <a rel="mw:ExtLink" href="http://[::1]/">loopback</a></li>
5797 <li> <a rel="mw:ExtLink" href="http://[::]">unspecified</a></li>
5798 <li> <a rel="mw:ExtLink" href="http://[::13.1.68.3]">ipv4compat</a></li>
5799 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]">ipv4compat</a></li></ul>
5800
5801 <p>Examples from <a href="https://tools.ietf.org/html/rfc2732" rel="mw:ExtLink">RFC 2732</a>, section 2:</p>
5802 <ul><li> <a rel="mw:ExtLink" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">1</a></li>
5803 <li> <a rel="mw:ExtLink" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">2</a></li>
5804 <li> <a rel="mw:ExtLink" href="http://[3ffe:2a00:100:7031::1]">3</a></li>
5805 <li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/foo">4</a></li>
5806 <li> <a rel="mw:ExtLink" href="http://[::192.9.5.5]/ipng">5</a></li>
5807 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]:80/index.html">6</a></li>
5808 <li> <a rel="mw:ExtLink" href="http://[2010:836B:4179::836B:4179]">7</a></li></ul>
5809 !! end
5810
5811 !! test
5812 Non-extlinks in brackets
5813 !! wikitext
5814 [foo]
5815 [foo bar]
5816 [foo ''bar'']
5817 [fool's] errand
5818 [fool's errand]
5819 [{{echo|foo}}]
5820 [{{echo|foo}} bar]
5821 [{{echo|foo}} ''bar'']
5822 [{{echo|foo}}l's] errand
5823 [{{echo|foo}}l's errand]
5824 [url={{echo|foo}}]
5825 [url=http://example.com]
5826 [http:// bare protocols don't count]
5827 !! html/php
5828 <p>[foo]
5829 [foo bar]
5830 [foo <i>bar</i>]
5831 [fool's] errand
5832 [fool's errand]
5833 [foo]
5834 [foo bar]
5835 [foo <i>bar</i>]
5836 [fool's] errand
5837 [fool's errand]
5838 [url=foo]
5839 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
5840 [http:// bare protocols don't count]
5841 </p>
5842 !! html/parsoid
5843 <p>[foo]
5844 [foo bar]
5845 [foo <i>bar</i>]
5846 [fool's] errand
5847 [fool's errand]
5848 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}"}'>foo</span>]
5849 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}"}'>foo</span> bar]
5850 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}"}'>foo</span> <i>bar</i>]
5851 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}l&#39;s"}'>fool's</span>] errand
5852 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}l&#39;s"}'>fool's</span> errand]
5853 [<span typeof="mw:Placeholder" data-parsoid='{"src":"url={{echo|foo}}"}'>url=foo</span>]
5854 [url=<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>]
5855 [http:// bare protocols don't count]</p>
5856 !! end
5857
5858 !! test
5859 Percent encoding in external links
5860 !! wikitext
5861 [https://github.com/search?l=&q=ResourceLoader+%40wikimedia Search]
5862 !! html/php
5863 <p><a rel="nofollow" class="external text" href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a>
5864 </p>
5865 !! html/parsoid
5866 <p><a rel="mw:ExtLink"
5867 href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a></p>
5868 !! end
5869
5870 !! test
5871 Use url link syntax for links where the content is equal the link target
5872 !! wikitext
5873 http://example.com
5874 !! html/php
5875 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
5876 </p>
5877 !! html/parsoid
5878 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></p>
5879 !! end
5880
5881 !! test
5882 Parenthesis in external links, especially URL links
5883 !! wikitext
5884 http://example.com)
5885
5886 http://example.com/test)
5887
5888 http://example.com/(test)
5889
5890 http://example.com/((test)
5891
5892 (http://example.com/(test))
5893
5894 (http://example.com/(test)))))
5895
5896 http://example.com/a)b
5897
5898 [http://example.com) foo]
5899 !! html/php
5900 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5901 </p><p><a rel="nofollow" class="external free" href="http://example.com/test">http://example.com/test</a>)
5902 </p><p><a rel="nofollow" class="external free" href="http://example.com/(test)">http://example.com/(test)</a>
5903 </p><p><a rel="nofollow" class="external free" href="http://example.com/((test)">http://example.com/((test)</a>
5904 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test))">http://example.com/(test))</a>
5905 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test)))))">http://example.com/(test)))))</a>
5906 </p><p><a rel="nofollow" class="external free" href="http://example.com/a)b">http://example.com/a)b</a>
5907 </p><p><a rel="nofollow" class="external text" href="http://example.com)">foo</a>
5908 </p>
5909 !! html/parsoid
5910 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)</p>
5911 <p><a rel="mw:ExtLink" href="http://example.com/test">http://example.com/test</a>)</p>
5912 <p><a rel="mw:ExtLink" href="http://example.com/(test)">http://example.com/(test)</a></p>
5913 <p><a rel="mw:ExtLink" href="http://example.com/((test)">http://example.com/((test)</a></p>
5914 <p>(<a rel="mw:ExtLink" href="http://example.com/(test))">http://example.com/(test))</a></p>
5915 <p>(<a rel="mw:ExtLink" href="http://example.com/(test)))))">http://example.com/(test)))))</a></p>
5916 <p><a rel="mw:ExtLink" href="http://example.com/a)b">http://example.com/a)b</a></p>
5917 <p><a rel="mw:ExtLink" href="http://example.com)">foo</a></p>
5918 !! end
5919
5920 !! test
5921 Parenthesis in external links, w/ transclusion or comment
5922 !! wikitext
5923 (http://example.com/{{echo|hi}})
5924
5925 (http://example.com<!-- hi -->)
5926 !! html/php
5927 <p>(<a rel="nofollow" class="external free" href="http://example.com/hi">http://example.com/hi</a>)
5928 </p><p>(<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5929 </p>
5930 !! html/parsoid
5931 <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>
5932
5933 <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>
5934 !! end
5935
5936 !! test
5937 Serialize <a> tags with invalid link targets as plain text
5938 !! options
5939 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
5940 !! html/parsoid
5941 <a rel="mw:WikiLink" href="[[foo]]">text</a>
5942 <a rel="mw:WikiLink" href="[[foo]]">*text</a>
5943 <a rel="mw:WikiLink" href="[[foo]]">[[foo]]</a>
5944 <a rel="mw:WikiLink" href="[[foo]]">*a [[foo]]</a>
5945 !! wikitext
5946 text
5947 <nowiki>*</nowiki>text
5948 <nowiki>[[foo]]</nowiki>
5949 <nowiki>*</nowiki>a <nowiki>[[foo]]</nowiki>
5950 !! end
5951
5952 !! test
5953 mw:ExtLink -vs- mw:WikiLink (T94723)
5954 !! options
5955 parsoid=html2wt
5956 !! html/parsoid
5957 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"piped","a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>Bar</a>
5958 <a rel="mw:WikiLink" href="./Foo" title="Foo">Bar</a>
5959 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
5960 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
5961 <p>
5962 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
5963 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
5964 </p>
5965 !! wikitext
5966 [[Foo|Bar]]
5967 [[Foo|Bar]]
5968 [[:en:Foo|Bar]]
5969 [[:en:Foo|Bar]]
5970
5971 [[:en:European_Robin|European Robin]]
5972 [[:en:European_Robin|European Robin]]
5973 !! end
5974
5975 !! test
5976 mw:ExtLink linking to a interwiki URL can be round-tripped losslessly (T94723)
5977 !! options
5978 parsoid=wt2wt
5979 !! wikitext
5980 [http://en.wikipedia.org/wiki/European_Robin European Robin]
5981 !! html/parsoid
5982 THIS SECTION IS NOT USED (but Parsoid won't run the test without it)
5983 !! end
5984
5985
5986 ###
5987 ### Quotes
5988 ###
5989
5990 !! test
5991 Quotes
5992 !! wikitext
5993 Normal text. '''Bold text.''' Normal text. ''Italic text.''
5994
5995 Normal text. '''''Bold italic text.''''' Normal text.
5996 !! html
5997 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
5998 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
5999 </p>
6000 !! end
6001
6002
6003 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
6004 # parser strips. The wikitext contains just the first half of the bold
6005 # quote pair.
6006 !! test
6007 Unclosed and unmatched quotes
6008 !! wikitext
6009 '''''Bold italic text '''with bold deactivated''' in between.'''''
6010
6011 '''''Bold italic text ''with italic deactivated'' in between.'''''
6012
6013 '''Bold text..
6014
6015 ..spanning two paragraphs (should not work).'''
6016
6017 '''Bold tag left open
6018
6019 ''Italic tag left open
6020
6021 Normal text.
6022
6023 <!-- Unmatching number of opening, closing tags: -->
6024 '''This year''''s election ''should'' beat '''last year''''s.
6025
6026 ''Tom'''s car is bigger than ''Susan'''s.
6027
6028 Plain ''italic'''s plain
6029 !! html/php
6030 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
6031 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
6032 </p><p><b>Bold text..</b>
6033 </p><p>..spanning two paragraphs (should not work).
6034 </p><p><b>Bold tag left open</b>
6035 </p><p><i>Italic tag left open</i>
6036 </p><p>Normal text.
6037 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
6038 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
6039 </p><p>Plain <i>italic'</i>s plain
6040 </p>
6041 !! html/parsoid
6042 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
6043 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
6044 </p><p><b>Bold text..</b>
6045 </p><p>..spanning two paragraphs (should not work).<b></b>
6046 </p><p><b>Bold tag left open</b>
6047 </p><p><i>Italic tag left open</i>
6048 </p><p>Normal text.
6049 </p>
6050 <!-- Unmatching number of opening, closing tags: -->
6051 <p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
6052 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
6053 </p><p>Plain <i>italic'</i>s plain
6054 </p>
6055 !! end
6056
6057 ###
6058 ### Tables
6059 ###
6060 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
6061 ###
6062
6063 # This should not produce <table></table> as <table><tr><td></td></tr></table>
6064 # is the bare minimum required by the spec, see:
6065 # https://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
6066 # Parsoid team replies: empty table tags are legal in HTML5
6067 !! test
6068 A table with no data.
6069 !! options
6070 parsoid=wt2html
6071 !! wikitext
6072 {||}
6073 !! html/php
6074
6075 !! html/parsoid
6076 <table></table>
6077
6078 !! end
6079
6080 !! test
6081 A table with stray table end tags on start tag line (wt2html)
6082 !! options
6083 parsoid=wt2html
6084 !! wikitext
6085 {|style="color: red;"|}
6086
6087 {|style="color: red;" |}
6088 |foo
6089 |}
6090
6091 {|style="color: red;"|} id="foo"
6092 |foo
6093 |}
6094
6095 {|style="color: red;" |} id="foo"
6096 |foo
6097 |}
6098 !! html
6099 <table style="color: red;"></table>
6100
6101 <table style="color: red;">
6102 <tbody><tr>
6103 <td>foo</td>
6104 </tr></tbody>
6105 </table>
6106
6107 <table style="color: red;" id="foo">
6108 <tbody><tr>
6109 <td>foo</td>
6110 </tr></tbody>
6111 </table>
6112
6113 <table style="color: red;" id="foo">
6114 <tbody><tr>
6115 <td>foo</td>
6116 </tr></tbody>
6117 </table>
6118
6119 !! end
6120
6121 !! test
6122 A table with no data (take 2)
6123 !! wikitext
6124 {|
6125 |}
6126 !! html/parsoid
6127 <table></table>
6128 !! end
6129
6130 # A table with nothing but a caption is invalid XHTML, we might want to render
6131 # this as <p>caption</p>
6132 # Parsoid team replies: table with only a caption is legal in HTML5
6133 !! test
6134 A table with nothing but a caption
6135 !! wikitext
6136 {|
6137 |+ caption
6138 |}
6139 !! html/php
6140 <table>
6141 <caption> caption
6142 </caption><tr><td></td></tr></table>
6143
6144 !! html/parsoid
6145 <table><caption> caption</caption></table>
6146 !! end
6147
6148 !! test
6149 A table with caption with default-spaced attributes and a table row
6150 !! wikitext
6151 {|
6152 |+ style="color: red;" | caption1
6153 |-
6154 | foo
6155 |}
6156 !! html
6157 <table>
6158 <caption style="color: red;"> caption1
6159 </caption>
6160 <tr>
6161 <td> foo
6162 </td></tr></table>
6163
6164 !! end
6165
6166 !! test
6167 A table with captions with non-default spaced attributes and a table row
6168 !! wikitext
6169 {|
6170 |+style="color: red;"|caption2
6171 |+ style="color: red;"| caption3
6172 |-
6173 | foo
6174 |}
6175 !! html
6176 <table>
6177 <caption style="color: red;">caption2
6178 </caption>
6179 <caption style="color: red;"> caption3
6180 </caption>
6181 <tr>
6182 <td> foo
6183 </td></tr></table>
6184
6185 !! end
6186
6187 !! test
6188 Table td-cell syntax variations
6189 !! wikitext
6190 {|
6191 | foo bar foo | baz
6192 | foo bar foo || baz
6193 | style='color:red;' | baz
6194 | style='color:red;' || baz
6195 |}
6196 !! html
6197 <table>
6198 <tr>
6199 <td> baz
6200 </td>
6201 <td> foo bar foo </td>
6202 <td> baz
6203 </td>
6204 <td style="color:red;"> baz
6205 </td>
6206 <td> style='color:red;' </td>
6207 <td> baz
6208 </td></tr></table>
6209
6210 !! end
6211
6212 !! test
6213 Simple table
6214 !! wikitext
6215 {|
6216 | 1 || 2
6217 |-
6218 | 3 || 4
6219 |}
6220 !! html
6221 <table>
6222 <tr>
6223 <td> 1 </td>
6224 <td> 2
6225 </td></tr>
6226 <tr>
6227 <td> 3 </td>
6228 <td> 4
6229 </td></tr></table>
6230
6231 !! end
6232
6233 !! test
6234 Simple table but with multiple dashes for row wikitext
6235 !! wikitext
6236 {|
6237 | foo
6238 |-----
6239 | bar
6240 |}
6241 !! html
6242 <table>
6243 <tr>
6244 <td> foo
6245 </td></tr>
6246 <tr>
6247 <td> bar
6248 </td></tr></table>
6249
6250 !! end
6251
6252 !! test
6253 Multiplication table
6254 !! wikitext
6255 {| border="1" cellpadding="2"
6256 |+Multiplication table
6257 |-
6258 ! &times; !! 1 !! 2 !! 3
6259 |-
6260 ! 1
6261 | 1 || 2 || 3
6262 |-
6263 ! 2
6264 | 2 || 4 || 6
6265 |-
6266 ! 3
6267 | 3 || 6 || 9
6268 |-
6269 ! 4
6270 | 4 || 8 || 12
6271 |-
6272 ! 5
6273 | 5 || 10 || 15
6274 |}
6275 !! html
6276 <table border="1" cellpadding="2">
6277 <caption>Multiplication table
6278 </caption>
6279 <tr>
6280 <th> &#215; </th>
6281 <th> 1 </th>
6282 <th> 2 </th>
6283 <th> 3
6284 </th></tr>
6285 <tr>
6286 <th> 1
6287 </th>
6288 <td> 1 </td>
6289 <td> 2 </td>
6290 <td> 3
6291 </td></tr>
6292 <tr>
6293 <th> 2
6294 </th>
6295 <td> 2 </td>
6296 <td> 4 </td>
6297 <td> 6
6298 </td></tr>
6299 <tr>
6300 <th> 3
6301 </th>
6302 <td> 3 </td>
6303 <td> 6 </td>
6304 <td> 9
6305 </td></tr>
6306 <tr>
6307 <th> 4
6308 </th>
6309 <td> 4 </td>
6310 <td> 8 </td>
6311 <td> 12
6312 </td></tr>
6313 <tr>
6314 <th> 5
6315 </th>
6316 <td> 5 </td>
6317 <td> 10 </td>
6318 <td> 15
6319 </td></tr></table>
6320
6321 !! end
6322
6323 !! test
6324 Accept "||" in table headings
6325 !! wikitext
6326 {|
6327 !h1 || h2
6328 |}
6329 !! html
6330 <table>
6331 <tr>
6332 <th>h1 </th>
6333 <th> h2
6334 </th></tr></table>
6335
6336 !! end
6337
6338 !! test
6339 Accept "!!" in table data
6340 !! wikitext
6341 {|
6342 | Foo!! ||
6343 |}
6344 !! html
6345 <table>
6346 <tr>
6347 <td> Foo!! </td>
6348 <td>
6349 </td></tr></table>
6350
6351 !! html/parsoid
6352 <table>
6353 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'> Foo!! </td><td data-parsoid='{"stx":"row","autoInsertedEnd":true}'></td></tr>
6354 </tbody></table>
6355 !! end
6356
6357 !! test
6358 Accept "||" in indented table headings
6359 !! wikitext
6360 :{|
6361 !h1 || h2
6362 |}
6363 !! html
6364 <dl><dd><table>
6365 <tr>
6366 <th>h1 </th>
6367 <th> h2
6368 </th></tr></table></dd></dl>
6369
6370 !! end
6371
6372 !! test
6373 Accept "!!" in templates
6374 !! wikitext
6375 {|
6376 !a {{echo|b!!c}}
6377 |}
6378 !! html/php
6379 <table>
6380 <tr>
6381 <th>a b</th>
6382 <th>c
6383 </th></tr></table>
6384
6385 !! html/parsoid
6386 <table>
6387 <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>
6388 !! end
6389
6390 !! test
6391 Accept "!!" in table headings after newline
6392 !! wikitext
6393 {|
6394 !a
6395 b!!c
6396 |}
6397 !! html/php
6398 <table>
6399 <tr>
6400 <th>a
6401 <p>b!!c
6402 </p>
6403 </th></tr></table>
6404
6405 !! html/parsoid
6406 <table>
6407 <tbody><tr><th>a
6408 <p>b!!c</p></th></tr>
6409 </tbody></table>
6410 !! end
6411
6412 !! test
6413 Accept "!!" in table data of mixed wikitext / html syntax
6414 !! wikitext
6415 {|
6416 !a
6417 <tr><td>b!!c</td></tr>
6418 |}
6419 !! html+tidy
6420 <table>
6421 <tr>
6422 <th>a</th>
6423 </tr>
6424 <tr>
6425 <td>b!!c</td>
6426 </tr>
6427 </table>
6428 !! html/parsoid
6429 <table>
6430 <tbody><tr><th>a</th></tr>
6431 <tr data-parsoid='{"stx":"html"}'><td data-parsoid='{"stx":"html"}'>b!!c</td></tr>
6432 </tbody></table>
6433 !! end
6434
6435 !! test
6436 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
6437 !! wikitext
6438 {|
6439 !| h1
6440 || a
6441 |}
6442 !! html
6443 <table>
6444 <tr>
6445 <th> h1
6446 </th>
6447 <td> a
6448 </td></tr></table>
6449
6450 !! end
6451
6452 !!test
6453 Accept "| !" at start of line in tables (ignore !-attribute)
6454 !! wikitext
6455 {|
6456 |-
6457 | !style="color:red" | bar
6458 |}
6459 !! html
6460 <table>
6461
6462 <tr>
6463 <td> bar
6464 </td></tr></table>
6465
6466 !!end
6467
6468 !!test
6469 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 +/-
6470 !! wikitext
6471 {|
6472 |-
6473 |style='color:red;'|+1
6474 |style='color:blue;'|-1
6475 |-
6476 | 1 || 2 || 3
6477 | 1 ||+2 ||-3
6478 |-
6479 | +1
6480 | -1
6481 |}
6482 !! html
6483 <table>
6484
6485 <tr>
6486 <td style="color:red;">+1
6487 </td>
6488 <td style="color:blue;">-1
6489 </td></tr>
6490 <tr>
6491 <td> 1 </td>
6492 <td> 2 </td>
6493 <td> 3
6494 </td>
6495 <td> 1 </td>
6496 <td>+2 </td>
6497 <td>-3
6498 </td></tr>
6499 <tr>
6500 <td> +1
6501 </td>
6502 <td> -1
6503 </td></tr></table>
6504
6505 !!end
6506
6507 !! test
6508 Table rowspan
6509 !! wikitext
6510 {| border=1
6511 | Cell 1, row 1
6512 |rowspan=2| Cell 2, row 1 (and 2)
6513 | Cell 3, row 1
6514 |-
6515 | Cell 1, row 2
6516 | Cell 3, row 2
6517 |}
6518 !! html
6519 <table border="1">
6520 <tr>
6521 <td> Cell 1, row 1
6522 </td>
6523 <td rowspan="2"> Cell 2, row 1 (and 2)
6524 </td>
6525 <td> Cell 3, row 1
6526 </td></tr>
6527 <tr>
6528 <td> Cell 1, row 2
6529 </td>
6530 <td> Cell 3, row 2
6531 </td></tr></table>
6532
6533 !! end
6534
6535 !! test
6536 Nested table
6537 !! wikitext
6538 {| border=1
6539 | &alpha;
6540 |
6541 {| bgcolor=#ABCDEF border=2
6542 |nested
6543 |-
6544 |table
6545 |}
6546 |the original table again
6547 |}
6548 !! html
6549 <table border="1">
6550 <tr>
6551 <td> &#945;
6552 </td>
6553 <td>
6554 <table bgcolor="#ABCDEF" border="2">
6555 <tr>
6556 <td>nested
6557 </td></tr>
6558 <tr>
6559 <td>table
6560 </td></tr></table>
6561 </td>
6562 <td>the original table again
6563 </td></tr></table>
6564
6565 !! end
6566
6567 !! test
6568 Invalid attributes in table cell (T3830)
6569 !! wikitext
6570 {|
6571 |Cell:|broken
6572 |}
6573 !! html
6574 <table>
6575 <tr>
6576 <td>broken
6577 </td></tr></table>
6578
6579 !! end
6580
6581 !! test
6582 Table cell attributes: Pipes protected by nowikis should be treated as a plain character
6583 !! wikitext
6584 {|
6585 | title="foo" |bar
6586 | title="foo<nowiki>|</nowiki>" |bar
6587 | title="foo<nowiki>|</nowiki>" bar
6588 |}
6589 !! html/php
6590 <table>
6591 <tr>
6592 <td title="foo">bar
6593 </td>
6594 <td title="foo&#124;">bar
6595 </td>
6596 <td> title="foo|" bar
6597 </td></tr></table>
6598
6599 !! html/parsoid
6600 <table>
6601 <tbody><tr><td title="foo">bar</td>
6602 <td title="foo|" data-parsoid='{"a":{"title":"foo|"},"sa":{"title":"foo&lt;nowiki>|&lt;/nowiki>"},"autoInsertedEnd":true}'>bar</td>
6603 <td> title="foo<span typeof="mw:Nowiki">|</span>" bar</td></tr>
6604 </tbody></table>
6605 !! end
6606
6607 # See: http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html
6608 # N.B. The "|}" to close the table is missing from the input, so parsoid's
6609 # *2wt modes will fail.
6610 !! test
6611 Table security: embedded pipes
6612 !! options
6613 parsoid=wt2html,html2html
6614 !! wikitext
6615 {|
6616 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
6617 !! html/php
6618 <table>
6619 <tr>
6620 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
6621 <td>]" onmouseover="alert(document.cookie)"&gt;test
6622 </td>
6623 </tr>
6624 </table>
6625
6626 !! html/parsoid
6627 <table><tbody>
6628 <tr>
6629 <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":"row","autoInsertedEnd":true}'>]" onmouseover="alert(document.cookie)">test</td></tr></tbody></table>
6630 !! end
6631
6632 !! test
6633 Element attributes with double ! should not be broken up by <th>
6634 !! wikitext
6635 {|
6636 ! hi <div class="!!">ha</div> ho
6637 |}
6638 !! html/php
6639 <table>
6640 <tr>
6641 <th> hi <div class="!!">ha</div> ho
6642 </th></tr></table>
6643
6644 !! html/parsoid
6645 <table>
6646 <tbody><tr><th> hi <div class="!!" data-parsoid='{"stx":"html"}'>ha</div> ho</th></tr>
6647 </tbody></table>
6648 !! end
6649
6650 !! test
6651 ! and || in element attributes should not be parsed as <th>/<td>
6652 !! wikitext
6653 {|
6654 | <div style="color: red !important;" data-contrived="put this here ||">hi</div>
6655 |}
6656 !! html/php
6657 <table>
6658 <tr>
6659 <td> <div style="color: red !important;" data-contrived="put this here &#124;&#124;">hi</div>
6660 </td></tr></table>
6661
6662 !! html/parsoid
6663 <table>
6664 <tbody><tr><td> <div style="color: red !important;" data-contrived="put this here ||" data-parsoid='{"stx":"html"}'>hi</div></td></tr>
6665 </tbody></table>
6666 !! end
6667
6668 # FIXME: The output seems broken. Filed as T110268.
6669 !! test
6670 ! and || in td attributes should not be parsed as <th>/<td>
6671 !! options
6672 parsoid=wt2html
6673 !! wikitext
6674 {|
6675 | style="color: red !important;" data-contrived="put this here ||" | foo
6676 |}
6677 !! html/php
6678 <table>
6679 <tr>
6680 <td> style="color: red !important;" data-contrived="put this here </td>
6681 <td> foo
6682 </td></tr></table>
6683
6684 !! html/parsoid
6685 <table>
6686 <tbody><tr><td> style="color: red !important;" data-contrived="put this here </td><td data-parsoid='{"stx":"row","a":{"\"":null},"sa":{"\"":""},"autoInsertedEnd":true}'> foo</td></tr>
6687 </tbody></table>
6688 !! end
6689
6690 !! test
6691 Break on | in element attribute in template
6692 !! options
6693 parsoid=wt2html,html2html
6694 !! wikitext
6695 {{echo|1=<div class="hi|ho">ha</div>}}
6696 !! html/php
6697 <p>ho"&gt;ha&lt;/div&gt;
6698 </p>
6699 !! html/parsoid
6700 <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>
6701 !! end
6702
6703 !! test
6704 Break on | in element attribute name in template
6705 !! wikitext
6706 {{echo|<div cla|ss="hiho">ha</div>}}
6707 !! html/parsoid
6708 <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>
6709 !! end
6710
6711 !! test
6712 Don't break on | in extension attribute in template
6713 !! wikitext
6714 {{echo|<ref name="hi|ho">ha</ref>}}
6715
6716 <references />
6717 !! html/parsoid
6718 <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>
6719
6720 <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>
6721 !! end
6722
6723 ## We don't support roundtripping of these attributes in Parsoid.
6724 ## Selective serialization takes care of preventing dirty diffs.
6725 ## But, on edits, we dirty-diff the invalid attribute text.
6726 !! test
6727 Invalid text in table attributes should be discarded
6728 !! options
6729 parsoid=wt2html
6730 !! wikitext
6731 {| <span>boo</span> style='border:1px solid black'
6732 | <span>boo</span> style='color:blue' | 1
6733 |<span>boo</span> style='color:blue'| 2
6734 |}
6735 !! html/php
6736 <table style="border:1px solid black">
6737 <tr>
6738 <td style="color:blue"> 1
6739 </td>
6740 <td style="color:blue"> 2
6741 </td></tr></table>
6742
6743 !! html/parsoid
6744 <table style="border:1px solid black">
6745 <tr>
6746 <td style="color:blue"> 1</td>
6747 <td style="color:blue"> 2</td>
6748 </tr>
6749 </table>
6750 !! end
6751
6752 !! test
6753 Invalid text in table attributes should be preserved by selective serializer
6754 !! options
6755 parsoid={
6756 "modes": ["selser"],
6757 "changes": [
6758 ["td:first-child", "text", "abc"],
6759 ["td + td", "text", "xyz"]
6760 ]
6761 }
6762 !! wikitext
6763 {| <span>boo</span> style='border:1px solid black'
6764 | <span>boo</span> style='color:blue' | 1
6765 |<span>boo</span> style='color:blue'| 2
6766 |}
6767 !! wikitext/edited
6768 {| <span>boo</span> style='border:1px solid black'
6769 | <span>boo</span> style='color:blue' |abc
6770 |<span>boo</span> style='color:blue'|xyz
6771 |}
6772 !! end
6773
6774 !! test
6775 1. Template-generated table cell attributes and cell content
6776 !! wikitext
6777 {|
6778 |{{table_attribs}}
6779 | {{table_attribs}}
6780 || {{table_attribs_5}}
6781 | <!--foo--> <!--bar--> <!--baz--> {{table_attribs}}
6782 |align=center {{table_attribs}}
6783 | <!--foo--> align=center <!--bar--> {{table_attribs}}
6784 |}
6785 !! html
6786 <table>
6787 <tr>
6788 <td style="color:red;">Foo
6789 </td>
6790 <td style="color:red;">Foo
6791 </td>
6792 <td> style="color:red;"</td>
6793 <td>Bar
6794 </td>
6795 <td style="color:red;">Foo
6796 </td>
6797 <td align="center" style="color:red;">Foo
6798 </td>
6799 <td align="center" style="color:red;">Foo
6800 </td></tr></table>
6801
6802 !! end
6803
6804 !! test
6805 2. Template-generated table cell attributes and cell content
6806 !! wikitext
6807 {|
6808 |{{table_attribs_2}}
6809 |}
6810 !! html/php
6811 <table>
6812 <tr>
6813 <td style="color:red;">Foo
6814 </td>
6815 <td>Bar</td>
6816 <td>Baz
6817 </td></tr></table>
6818
6819 !! html/parsoid
6820 <table>
6821 <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>
6822 <td about="#mwt1">Bar</td><td about="#mwt1">Baz</td></tr>
6823 </tbody></table>
6824 !! end
6825
6826 !! test
6827 3. Template-generated table cell attributes and cell content
6828 !! wikitext
6829 {|
6830 !align=center {{table_header_cells}}
6831 |-
6832 |align=center {{table_cells}}
6833 |}
6834 !! html/php
6835 <table>
6836 <tr>
6837 <th align="center" style="color:red;">Foo</th>
6838 <th style="color:red;"><i>Bar</i></th>
6839 <th style="color:brown;"><i>Foo</i> and Baz
6840 </th></tr>
6841 <tr>
6842 <td align="center" style="color:red;">Foo</td>
6843 <td style="color:red;"><i>Bar</i></td>
6844 <td style="color:brown;"><i>Foo</i> and Baz
6845 </td></tr></table>
6846
6847 !! html/parsoid
6848 <table>
6849 <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>
6850 <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>
6851 </tbody></table>
6852 !! end
6853
6854 !! test
6855 4. Template-generated table cell attributes and cell content inside a templated table
6856 !! wikitext
6857 {{tbl-start}}
6858 !align=center {{table_header_cells}}
6859 |-
6860 |align=center {{table_cells}}
6861 {{tbl-end}}
6862 !! html/php
6863 <table>
6864 <tr>
6865 <th align="center" style="color:red;">Foo</th>
6866 <th style="color:red;"><i>Bar</i></th>
6867 <th style="color:brown;"><i>Foo</i> and Baz
6868 </th></tr>
6869 <tr>
6870 <td align="center" style="color:red;">Foo</td>
6871 <td style="color:red;"><i>Bar</i></td>
6872 <td style="color:brown;"><i>Foo</i> and Baz
6873 </td></tr></table>
6874
6875 !! html/parsoid
6876 <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}}]}'>
6877 <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>
6878 <tr>
6879 <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>
6880 </tbody></table>
6881 !! end
6882
6883 ## Edge case fix to prevent future regressions
6884 !! test
6885 T107652: <ref>s in templates that also generate table cell attributes should be rendered properly
6886 !! wikitext
6887 {|
6888 |{{table_attribs_7}}
6889 |}
6890 <references />
6891 !! html/parsoid
6892 <table>
6893 <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>
6894 </tbody></table>
6895 <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>
6896 !! end
6897
6898 !! test
6899 Table with row followed by newlines and table heading
6900 !! options
6901 parsoid=wt2html,html2html
6902 !! wikitext
6903 {|
6904 |-
6905
6906 ! foo
6907 |}
6908 !! html/*
6909 <table>
6910
6911
6912 <tr>
6913 <th> foo
6914 </th></tr></table>
6915
6916 !! end
6917
6918 !! test
6919 Table with empty line following the start tag
6920 !! options
6921 parsoid=wt2html,html2html
6922 !! wikitext
6923 {|
6924
6925 |-
6926 | foo
6927 |}
6928 !! html/*
6929 <table>
6930
6931
6932 <tr>
6933 <td> foo
6934 </td></tr></table>
6935
6936 !! end
6937
6938 !! test
6939 Table attributes with empty value
6940 !! options
6941 parsoid=wt2html,html2html
6942 !! wikitext
6943 {|
6944 | style=| hello
6945 |}
6946 !! html/php
6947 <table>
6948 <tr>
6949 <td style=""> hello
6950 </td></tr></table>
6951
6952 !! html/parsoid
6953 <table>
6954 <tbody><tr><td style=""> hello</td></tr>
6955 </tbody></table>
6956 !! end
6957
6958 !! test
6959 Wikitext table with a lot of comments
6960 !! wikitext
6961 {|
6962 <!-- c0 -->
6963 | foo
6964 <!-- c1 -->
6965 |-<!-- c2 -->
6966 <!-- c3 -->
6967 |<!-- c4 -->
6968 <!-- c5 -->
6969 |}
6970 !! html
6971 <table>
6972 <tr>
6973 <td> foo
6974 </td></tr>
6975 <tr>
6976 <td>
6977 </td></tr></table>
6978
6979 !! end
6980
6981 !! test
6982 Wikitext table comments represented in parsoid dom
6983 !! wikitext
6984 {|<!--c1--><!--c2-->
6985 |-<!--c3-->
6986 | x
6987 |}
6988 !! html/php+tidy
6989 <table>
6990 <tr>
6991 <td>x</td>
6992 </tr>
6993 </table>
6994 !! html/parsoid
6995 <table><!--c1--><!--c2-->
6996 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'><!--c3-->
6997 <td data-parsoid='{"autoInsertedEnd":true}'> x</td></tr>
6998 </tbody></table>
6999 !! end
7000
7001 !! test
7002 Wikitext table with double-line table cell
7003 !! wikitext
7004 {|
7005 |a
7006 b
7007 |}
7008 !! html
7009 <table>
7010 <tr>
7011 <td>a
7012 <p>b
7013 </p>
7014 </td></tr></table>
7015
7016 !! end
7017
7018 !! test
7019 Table cell with a single comment
7020 !! wikitext
7021 {|
7022 | <!-- c1 -->
7023 | a
7024 |}
7025 !! html
7026 <table>
7027 <tr>
7028 <td>
7029 </td>
7030 <td> a
7031 </td></tr></table>
7032
7033 !! end
7034
7035 !! test
7036 Table-cell after a comment-only-empty-line
7037 !! wikitext
7038 {|
7039 |a
7040 <!--c1-->
7041 <!--c2-->| b
7042 |}
7043 !! html
7044 <table>
7045 <tr>
7046 <td>a
7047 </td>
7048 <td> b
7049 </td></tr></table>
7050
7051 !! html/parsoid
7052 <table>
7053 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>a</td>
7054 <!--c1-->
7055 <!--c2--><td data-parsoid='{"autoInsertedEnd":true}'> b</td></tr>
7056 </tbody></table>
7057
7058 !! end
7059
7060 !! test
7061 Build table with {{!}}
7062 !! wikitext
7063 {{{!}} class="wikitable"
7064 ! header
7065 ! second header
7066 {{!}}- style="color:red;"
7067 {{!}} data {{!}}{{!}} style="color:red;" {{!}} second data
7068 {{!}}}
7069 !! html
7070 <table class="wikitable">
7071 <tr>
7072 <th> header
7073 </th>
7074 <th> second header
7075 </th></tr>
7076 <tr style="color:red;">
7077 <td> data </td>
7078 <td style="color:red;"> second data
7079 </td></tr></table>
7080
7081 !! end
7082
7083 !! test
7084 Build table with pipe as data
7085 !! wikitext
7086 {| class="wikitable"
7087 ! header
7088 ! second header
7089 |- style="color:red;"
7090 | data || style="color:red;" | second data
7091 |-
7092 | style="color:red;" | data with | || style="color:red;" | second data with |
7093 |-
7094 || data with | ||| second data with |
7095 |}
7096 !! html
7097 <table class="wikitable">
7098 <tr>
7099 <th> header
7100 </th>
7101 <th> second header
7102 </th></tr>
7103 <tr style="color:red;">
7104 <td> data </td>
7105 <td style="color:red;"> second data
7106 </td></tr>
7107 <tr>
7108 <td style="color:red;"> data with | </td>
7109 <td style="color:red;"> second data with |
7110 </td></tr>
7111 <tr>
7112 <td> data with | </td>
7113 <td> second data with |
7114 </td></tr></table>
7115
7116 !! end
7117
7118 !! test
7119 Build table with wikilink
7120 !! wikitext
7121 {| class="wikitable"
7122 ! header || second header
7123 |- style="color:red;"
7124 | data [[Main Page|linktext]] || second data [[Main Page|linktext]]
7125 |-
7126 | data || second data [[Main Page|link|text with pipe]]
7127 |}
7128 !! html
7129 <table class="wikitable">
7130 <tr>
7131 <th> header </th>
7132 <th> second header
7133 </th></tr>
7134 <tr style="color:red;">
7135 <td> data <a href="/wiki/Main_Page" title="Main Page">linktext</a> </td>
7136 <td> second data <a href="/wiki/Main_Page" title="Main Page">linktext</a>
7137 </td></tr>
7138 <tr>
7139 <td> data </td>
7140 <td> second data <a href="/wiki/Main_Page" title="Main Page">link|text with pipe</a>
7141 </td></tr></table>
7142
7143 !! end
7144
7145 # The expected HTML structure in this test is debatable. The PHP parser does
7146 # not parse this kind of table at all. The main focus for Parsoid is on
7147 # round-tripping, so this output is ok for now. TODO: revisit!
7148 !! test
7149 Wikitext table with html-syntax row
7150 !! wikitext
7151 {|
7152 |-
7153 <td>foo</td>
7154 |}
7155 !! html/parsoid
7156 <table>
7157 <tbody>
7158 <tr>
7159 <td>foo</td></tr></tbody></table>
7160 !! end
7161
7162 !! test
7163 Implicit <td> after a |-
7164 !! options
7165 parsoid=wt2html,html2html
7166 !! wikitext
7167 {|
7168 |-
7169 a
7170 |}
7171 !! html/php
7172 <table>
7173
7174 a
7175 </table>
7176
7177 !! html/php+tidy
7178 <p>a</p>
7179 !! html/parsoid
7180 <p data-parsoid='{"fostered":true,"autoInsertedEnd":true}'>a</p><table>
7181 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
7182
7183 </tr></tbody></table>
7184 !! end
7185
7186 !! test
7187 Lists should be recognized in an implicit <td> context
7188 !! options
7189 parsoid=wt2html,html2html
7190 !! wikitext
7191 {|
7192 |-
7193 *a
7194 |}
7195 !! html/php
7196 <table>
7197
7198 <ul><li>a</li></ul>
7199 </table>
7200
7201 !! html/php+tidy
7202 <ul>
7203 <li>a</li>
7204 </ul>
7205 !! html/parsoid
7206 <ul data-parsoid='{"fostered":true,"autoInsertedEnd":true}'><li>a</li></ul><table>
7207 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
7208
7209 </tr></tbody></table>
7210 !! end
7211
7212 !! test
7213 Table cells not properly parsed in an implicit-td context
7214 !! wikitext
7215 {|
7216 |-
7217 {{table_attribs_4}} || a || b
7218 |}
7219 !! html/php+tidy
7220 <table>
7221 <tr>
7222 <td style="background-color:#DC241f;" width="10px"></td>
7223 <td>a</td>
7224 <td>b</td>
7225 </tr>
7226 </table>
7227 !! html/parsoid
7228 <table>
7229 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
7230 <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>
7231 !! end
7232
7233 !! test
7234 Parsoid: Round-trip tables directly followed by content (T53219)
7235 !! options
7236 parsoid=wt2html,wt2wt
7237 !! wikitext
7238 {|
7239 |foo
7240 |} bar
7241
7242 {|
7243 |baz
7244 |}<b>quux</b>
7245 !! html+tidy
7246 <table>
7247 <tr>
7248 <td>foo</td>
7249 </tr>
7250 </table>
7251 <p>bar</p>
7252 <table>
7253 <tr>
7254 <td>baz</td>
7255 </tr>
7256 </table>
7257 <p><b>quux</b></p>
7258 !! end
7259
7260 !! test
7261 Parsoid: Default to a newline after tables in new content (T53219)
7262 !! options
7263 parsoid=html2wt
7264 !! html/parsoid
7265 <table><tbody>
7266 <tr><td>foo</td></tr></tbody></table> bar
7267 <table><tbody>
7268 <tr><td>baz</td></tr></tbody></table><b>quux</b>
7269 !! wikitext
7270 {|
7271 |foo
7272 |}
7273 <nowiki> </nowiki>bar
7274 {|
7275 |baz
7276 |}
7277 '''quux'''
7278 !! end
7279
7280 !! test
7281 Parsoid: newline inducing block nodes don't suppress <nowiki>
7282 !! options
7283 parsoid=html2wt
7284 !! html/parsoid
7285 a<h1>foo</h1>
7286 !! wikitext
7287 <nowiki> </nowiki>a
7288
7289 = foo =
7290 !! end
7291
7292 !! test
7293 Parsoid: Row-syntax table headings followed by comment & table cells
7294 !! options
7295 parsoid=wt2html,wt2wt
7296 !! wikitext
7297 {|
7298 ! foo || bar
7299 <!-- foo --> || baz || quux
7300 |}
7301 !! html/php
7302 <table>
7303 <tr>
7304 <th> foo </th>
7305 <th> bar
7306 </th>
7307 <td> baz </td>
7308 <td> quux
7309 </td></tr></table>
7310
7311 !! html/parsoid
7312 <table>
7313 <tbody><tr><th> foo </th><th> bar
7314 <!-- foo --> </th><td> baz </td><td> quux</td></tr>
7315 </tbody></table>
7316 !! end
7317
7318 !!test
7319 Parsoid: Recover better from broken table attributes
7320 !!options
7321 parsoid=wt2html
7322 !!wikitext
7323 {| class="foo
7324 | class="bar" |
7325 foo
7326 |}
7327 !!html/php+tidy
7328 <table class="foo">
7329 <tr>
7330 <td class="bar">
7331 <p>foo</p>
7332 </td>
7333 </tr>
7334 </table>
7335 !!html/parsoid
7336 <table class="foo">
7337 <tr>
7338 <td class="bar">
7339 <p>foo</p></td></tr>
7340 </tbody></table>
7341 !!end
7342
7343 !! test
7344 Tables: Digest broken attributes on table and tr tag
7345 !! options
7346 parsoid=wt2html
7347 !! wikitext
7348 {| || |} ++
7349 |- || || ++ --
7350 |- > [
7351 |}
7352 !! html
7353 <table>
7354 <tbody>
7355 <tr class='mw-empty-elt'></tr>
7356 <tr class='mw-empty-elt'></tr>
7357 </tbody></table>
7358 !! end
7359
7360 # T137406: Whitespace in the HTML
7361 !! test
7362 1. Generate correct wikitext for tables with thead/tbody/tfoot
7363 !! options
7364 parsoid=html2wt
7365 !! html/parsoid
7366 <table>
7367 <caption>Test</caption>
7368 <thead>
7369 <tr>
7370 <th>Month</th>
7371 <th>Savings</th>
7372 </tr>
7373 </thead>
7374 <tbody>
7375 <tr>
7376 <td>January</td>
7377 <td>$100</td>
7378 </tr>
7379 <tr>
7380 <td>February</td>
7381 <td>$80</td>
7382 </tr>
7383 </tbody>
7384 <tfoot>
7385 <tr>
7386 <td>Sum</td>
7387 <td>$180</td>
7388 </tr>
7389 </tfoot>
7390 </table>
7391 !! wikitext
7392 {|
7393 |+Test
7394 !Month
7395 !Savings
7396 |-
7397 |January
7398 |$100
7399 |-
7400 |February
7401 |$80
7402 |-
7403 |Sum
7404 |$180
7405 |}
7406 !! html/php+tidy
7407 <table>
7408 <caption>Test</caption>
7409 <tr>
7410 <th>Month</th>
7411 <th>Savings</th>
7412 </tr>
7413 <tr>
7414 <td>January</td>
7415 <td>$100</td>
7416 </tr>
7417 <tr>
7418 <td>February</td>
7419 <td>$80</td>
7420 </tr>
7421 <tr>
7422 <td>Sum</td>
7423 <td>$180</td>
7424 </tr>
7425 </table>
7426 !! end
7427
7428 # T137406: No whitespace in the HTML
7429 !! test
7430 2. Generate correct wikitext for tables with thead/tbody/tfoot
7431 !! options
7432 parsoid=html2wt
7433 !! html/parsoid
7434 <table><thead><tr><th>heading</th></tr></thead><tbody><tr><td>foo</td></tr></tbody></table>
7435 !! wikitext
7436 {|
7437 !heading
7438 |-
7439 |foo
7440 |}
7441 !! end
7442
7443 !! test
7444 Testing serialization after deletion in references
7445 !! options
7446 parsoid={
7447 "modes": ["wt2wt"],
7448 "changes": [
7449 ["#x", "remove"]
7450 ]
7451 }
7452 !! wikitext
7453 hi <ref><div id="x">ho</div></ref>
7454
7455 <references />
7456 !! wikitext/edited
7457 hi <ref></ref>
7458
7459 <references />
7460 !! end
7461
7462 !!test
7463 Testing serialization after deletion of table cells
7464 !!options
7465 parsoid={
7466 "modes": ["wt2wt", "selser"],
7467 "changes": [
7468 ["#x", "remove"]
7469 ]
7470 }
7471 !!wikitext
7472 {|
7473 !h1 !!h2 !!h3
7474 | id="x" |c1 {{!}}{{!}}{{!}}c2 |||c3
7475 |}
7476 !! wikitext/edited
7477 {|
7478 !h1 !!h2 !!h3
7479 |c2 |||c3
7480 |}
7481 !!end
7482
7483 !! test
7484 Testing selser after addition of new row before first row (T125419)
7485 !! options
7486 parsoid={
7487 "modes": ["wt2wt", "selser"],
7488 "changes": [
7489 [ "tr", "before", "<tr><td>X</td></tr>" ]
7490 ]
7491 }
7492 !! wikitext
7493 {|
7494 |a
7495 |}
7496 !! wikitext/edited
7497 {|
7498 |X
7499 |-
7500 |a
7501 |}
7502 !! end
7503
7504 !! test
7505 Serialize new table rows in a HTML table using HTML tags
7506 !! options
7507 parsoid={
7508 "modes": ["wt2wt", "selser"],
7509 "changes": [
7510 [ "tr", "before", "<tr><td>X</td></tr>" ]
7511 ]
7512 }
7513 !! wikitext
7514 <table><tr><td>a</td></tr></table>
7515 !! wikitext/edited
7516 <table><tr><td>X</td></tr><tr><td>a</td></tr></table>
7517 !! end
7518
7519 !! test
7520 Serialize new table cells in a HTML row using HTML tags
7521 !! options
7522 parsoid={
7523 "modes": ["wt2wt", "selser"],
7524 "changes": [
7525 [ "td", "before", "<td>X</td>" ]
7526 ]
7527 }
7528 !! wikitext
7529 <table><tr><td>a</td></tr></table>
7530 !! wikitext/edited
7531 <table><tr><td>X</td><td>a</td></tr></table>
7532 !! end
7533
7534 !! test
7535 Wikitext tables can be nested inside HTML tables
7536 !! options
7537 parsoid=html2wt
7538 !! html
7539 <table data-parsoid='{"stx":"html"}'>
7540 <tr><td>
7541 <table>
7542 <tr><td>foo</td></tr>
7543 </table>
7544 </td></tr>
7545 </table>
7546 !! wikitext
7547 <table>
7548 <tr><td>
7549 {|
7550 |foo
7551 |}
7552 </td></tr>
7553 </table>
7554 !! end
7555
7556 !! test
7557 Serialize wikitext list items as HTML list items when embedded in a HTML list
7558 !! options
7559 parsoid=html2wt
7560 !! html
7561 <ul data-parsoid='{"stx": "html"}'>
7562 <li data-parsoid='{}'>a</li>
7563 <li>b</li>
7564 </ul>
7565 !! wikitext
7566 <ul>
7567 <li>a</li>
7568 <li>b</li>
7569 </ul>
7570 !! end
7571
7572 # SSS FIXME: Is this actually a good thing given the
7573 # odd nested list output that is generated by MW?
7574 # <ul><li>foo<ul>..</ul></li></ul> instead of
7575 # <ul><li>foo</li><ul>..</ul></ul>
7576 !! test
7577 Wikitext lists can be nested inside HTML lists
7578 !! options
7579 parsoid=html2wt
7580 !! html
7581 <ul data-parsoid='{"stx": "html"}'>
7582 <li data-parsoid='{"stx": "html"}'>a
7583 <ul><li>b</li></ul>
7584 </li>
7585 </ul>
7586
7587 <ul data-parsoid='{"stx": "html"}'>
7588 <li>x
7589 <ul><li>y</li></ul>
7590 </li>
7591 </ul>
7592 !! wikitext
7593 <ul>
7594 <li>a
7595 * b
7596 </li>
7597 </ul>
7598
7599 <ul>
7600 <li>x
7601 * y
7602 </li>
7603 </ul>
7604 !! end
7605
7606 ###
7607 ### Internal links
7608 ###
7609 !! test
7610 Plain link, capitalized
7611 !! wikitext
7612 [[Main Page]]
7613 !! html
7614 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
7615 </p>
7616 !! end
7617
7618 !! test
7619 Plain link, uncapitalized
7620 !! wikitext
7621 [[main Page]]
7622 !! html
7623 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
7624 </p>
7625 !! end
7626
7627 !! test
7628 Piped link
7629 !! wikitext
7630 [[Main Page|The Main Page]]
7631 !! html
7632 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
7633 </p>
7634 !! end
7635
7636 !! test
7637 Piped link with comment in link text
7638 !! wikitext
7639 [[Main Page|The Main<!--front--> Page]]
7640 !! html
7641 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
7642 </p>
7643 !! end
7644
7645 !! test
7646 Piped link with multiple pipe characters in link text
7647 !! wikitext
7648 [[Main Page||The|Main|Page|]]
7649 !! html/php
7650 <p><a href="/wiki/Main_Page" title="Main Page">|The|Main|Page|</a>
7651 </p>
7652 !! html/parsoid
7653 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">|The|Main|Page|</a></p>
7654 !! end
7655
7656 !! test
7657 Piped link with no link text
7658 !! wikitext
7659 [[Thomas Bek (bishop of St David's)|]]
7660 !! html/php
7661 <p>[[Thomas Bek (bishop of St David's)|]]
7662 </p>
7663 !! html/parsoid
7664 <p>[[Thomas Bek (bishop of St David's)|]]</p>
7665 !! end
7666
7667 !! test
7668 Piped link with empty link text
7669 !! wikitext
7670 [[Main Page|<nowiki/>]] - empty nowiki
7671 [[Main Page| ]] - empty space
7672 [[Main Page|&nbsp;]] - empty non breaking space
7673 !! html/php
7674 <p><a href="/wiki/Main_Page" title="Main Page"></a> - empty nowiki
7675 <a href="/wiki/Main_Page" title="Main Page"> </a> - empty space
7676 <a href="/wiki/Main_Page" title="Main Page">&#160;</a> - empty non breaking space
7677 </p>
7678 !! html/parsoid
7679 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page"><span typeof="mw:Nowiki"></span></a> - empty nowiki
7680 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page"> </a> - empty space
7681 <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>
7682 !! end
7683
7684 !! test
7685 Broken link
7686 !! wikitext
7687 [[Zigzagzogzagzig]]
7688 !! html
7689 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
7690 </p>
7691 !! end
7692
7693 !! test
7694 Broken link with fragment
7695 !! wikitext
7696 [[Zigzagzogzagzig#zug]]
7697 !! html
7698 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
7699 </p>
7700 !! end
7701
7702 !! test
7703 Special page link with fragment
7704 !! wikitext
7705 [[Special:Version#anchor]]
7706 !! html
7707 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
7708 </p>
7709 !! end
7710
7711 !! test
7712 Nonexistent special page link with fragment
7713 !! wikitext
7714 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
7715 !! html
7716 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
7717 </p>
7718 !! end
7719
7720 !! test
7721 Link with prefix
7722 !! wikitext
7723 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
7724 !! html
7725 <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>
7726 </p>
7727 !! end
7728
7729 !! test
7730 Link with suffix
7731 !! wikitext
7732 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
7733 !! html
7734 <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>!!!
7735 </p>
7736 !! end
7737
7738 !! article
7739 prefixed article
7740 !! text
7741 Some text
7742 !! endarticle
7743
7744 !! test
7745 T45661: Piped links with identical prefixes
7746 !! wikitext
7747 [[prefixed article|prefixed articles with spaces]]
7748
7749 [[prefixed article|prefixed articlesaoeu]]
7750
7751 [[Main Page|Main Page test]]
7752 !! html
7753 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
7754 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
7755 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
7756 </p>
7757 !! end
7758
7759
7760 !! test
7761 Link with HTML entity in suffix / tail
7762 !! wikitext
7763 [[Main Page]]&quot;, [[Main Page]]&#97;
7764 !! html/php
7765 <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;
7766 </p>
7767 !! html/parsoid
7768 <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>
7769 !! end
7770
7771 !! test
7772 Link with 3 brackets
7773 !! wikitext
7774 [[[Main Page]]]
7775 Foo [[[Main Page]]]
7776 !! html
7777 <p>[[[Main Page]]]
7778 Foo [[[Main Page]]]
7779 </p>
7780 !! end
7781
7782 !! test
7783 Link with 4 brackets
7784 !! wikitext
7785 [[[[Main Page]]]]
7786 !! html
7787 <p>[[<a href="/wiki/Main_Page" title="Main Page">Main Page</a>]]
7788 </p>
7789 !! end
7790
7791 !! test
7792 Piped link with 3 brackets
7793 !! wikitext
7794 [[[main page|the main page]]]
7795 !! html
7796 <p>[[[main page|the main page]]]
7797 </p>
7798 !! end
7799
7800 !! test
7801 Piped link with extlink-like text
7802 !! wikitext
7803 [[Main Page|[bar]]]
7804 [[Main Page|This is a [bar]]]
7805 [[Main Page|[bar]]
7806 !! html/php
7807 <p><a href="/wiki/Main_Page" title="Main Page">[bar]</a>
7808 <a href="/wiki/Main_Page" title="Main Page">This is a [bar]</a>
7809 <a href="/wiki/Main_Page" title="Main Page">[bar</a>
7810 </p>
7811 !! html/parsoid
7812 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>[bar]</a>
7813 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>This is a [bar]</a>
7814 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>[bar</a></p>
7815 !! end
7816
7817 !! test
7818 Link with multiple pipes
7819 !! wikitext
7820 [[Main Page|The|Main|Page]]
7821 !! html
7822 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
7823 </p>
7824 !! end
7825
7826 !! test
7827 Anchor containing a #. (T65430)
7828 !! wikitext
7829 [[Main Page#And#Link]]
7830 !! html/php
7831 <p><a href="/wiki/Main_Page#And.23Link" title="Main Page">Main Page#And#Link</a>
7832 </p>
7833 !! html/parsoid
7834 <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>
7835 !! end
7836
7837 !! test
7838 Link to namespaces
7839 !! wikitext
7840 [[Talk:Parser testing]], [[Meta:Disclaimers]]
7841 !! html
7842 <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>
7843 </p>
7844 !! end
7845
7846 !! test
7847 Link with space in namespace
7848 !! wikitext
7849 [[User talk:Foo bar]]
7850 !! html
7851 <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>
7852 </p>
7853 !! end
7854
7855 !! article
7856 MemoryAlpha:AlphaTest
7857 !! text
7858 This is an article in the MemoryAlpha namespace
7859 (which shadows the memoryalpha interwiki link).
7860 !! endarticle
7861
7862 !! test
7863 Namespace takes precedence over interwiki link (T53680)
7864 !! wikitext
7865 [[MemoryAlpha:AlphaTest]]
7866 !! html
7867 <p><a href="/wiki/MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
7868 </p>
7869 !! end
7870
7871 # The previous test doesn't work correctly in html2*, due to not recognizing the
7872 # link as an internal one. This one checks for the correct behavior.
7873 !! test
7874 Link to namespace preferred over interwiki with correct rel attribute
7875 !! options
7876 parsoid=html2wt,html2html
7877 !! html/parsoid
7878 <p><a rel="mw:WikiLink" href="./MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a></p>
7879 !! wikitext
7880 [[MemoryAlpha:AlphaTest]]
7881 !! end
7882
7883 !! test
7884 Piped link to namespace
7885 !! wikitext
7886 [[Meta:Disclaimers|The disclaimers]]
7887 !! html
7888 <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>
7889 </p>
7890 !! end
7891
7892 !! test
7893 Link containing }
7894 !! wikitext
7895 [[Usually caused by a typo (oops}]]
7896 !! html
7897 <p>[[Usually caused by a typo (oops}]]
7898 </p>
7899 !! end
7900
7901 !! article
7902 7% Solution
7903 !! text
7904 Just a test of an article title containing a percent.
7905 !! endarticle
7906
7907 !! test
7908 Link containing % (not as a hex sequence)
7909 !! wikitext
7910 [[7% Solution]]
7911 [[7% Solution|7%25 Solution]]
7912 !! html/php
7913 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
7914 <a href="/wiki/7%25_Solution" title="7% Solution">7%25 Solution</a>
7915 </p>
7916 !! html/parsoid
7917 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a>
7918 <a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7%25 Solution</a></p>
7919 !! end
7920
7921 # note that the parsoid HTML is identical to the previous test output,
7922 # so the previous test ensures that the html2wt mode will generate the
7923 # "not as a hex sequence" wikitext.
7924 !! test
7925 Link containing % as a single hex sequence interpreted to char
7926 !! options
7927 parsoid=wt2wt,wt2html,html2html
7928 !! wikitext
7929 [[7%25 Solution]]
7930 [[7%25 Solution|7%25 Solution]]
7931 !! html/php
7932 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
7933 <a href="/wiki/7%25_Solution" title="7% Solution">7%25 Solution</a>
7934 </p>
7935 !! html/parsoid
7936 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a>
7937 <a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7%25 Solution</a></p>
7938 !!end
7939
7940 !! test
7941 Link containing % as a double hex sequence interpreted to hex sequence
7942 !! wikitext
7943 [[7%2525 Solution]]
7944 !! html
7945 <p>[[7%2525 Solution]]
7946 </p>
7947 !!end
7948
7949 ## Example for such a section: == < ==
7950 !! test
7951 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
7952 !! wikitext
7953 [[%23%3c]][[%23%3e]]
7954 !! html/php
7955 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
7956 </p>
7957 !! html/parsoid
7958 <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>
7959 !! end
7960
7961 !! test
7962 Link containing "<#" and ">#" as a hex sequences
7963 !! wikitext
7964 [[%3c%23]][[%3e%23]]
7965 !! html
7966 <p>[[%3c%23]][[%3e%23]]
7967 </p>
7968 !! end
7969
7970 !! test
7971 Link containing an equals sign
7972 !! wikitext
7973 [[Special:BookSources/isbn=4-00-026157-6]]
7974 !! html/php
7975 <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>
7976 </p>
7977 !! html/parsoid
7978 <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>
7979 !! end
7980
7981 !! article
7982 Foo~bar
7983 !! text
7984 Just a test of an article title containing a tilde.
7985 !! endarticle
7986
7987 # note that links containing signatures, like [[Foo~~~~]], are
7988 # massaged by the pre-save transform (PST) and so the tildes are never
7989 # seen by the parser.
7990 !! test
7991 Link containing a tilde
7992 !! wikitext
7993 [[Foo~bar]]
7994 !! html/php
7995 <p><a href="/wiki/Foo~bar" title="Foo~bar">Foo~bar</a>
7996 </p>
7997 !! html/parsoid
7998 <p><a rel="mw:WikiLink" href="./Foo~bar" title="Foo~bar">Foo~bar</a></p>
7999 !! end
8000
8001 !! test
8002 Link containing double-single-quotes '' (T6598)
8003 !! wikitext
8004 [[Lista d''e paise d''o munno]]
8005 !! html/php
8006 <p><a href="/index.php?title=Lista_d%27%27e_paise_d%27%27o_munno&amp;action=edit&amp;redlink=1" class="new" title="Lista d&#39;&#39;e paise d&#39;&#39;o munno (page does not exist)">Lista d''e paise d''o munno</a>
8007 </p>
8008 !! html/parsoid
8009 <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>
8010 !! end
8011
8012 !! test
8013 Link containing double quotes and spaces
8014 !! wikitext
8015 [[Cool "Gator"]]
8016 !! html/php
8017 <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>
8018 </p>
8019 !! html/parsoid
8020 <p><a rel="mw:WikiLink" href="./Cool_%22Gator%22" title='Cool "Gator"'>Cool "Gator"</a></p>
8021 !! end
8022
8023 !! test
8024 File containing double quotes and spaces
8025 !! wikitext
8026 [[File:Cool "Gator".png]]
8027 !! html/parsoid
8028 <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>
8029 !! end
8030
8031 !! test
8032 Redirect containing double quotes and spaces
8033 !! wikitext
8034 #REDIRECT [[Cool "Gator"]]
8035 !! html/parsoid
8036 <link rel="mw:PageProp/redirect" href="./Cool_%22Gator%22" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Cool_%22Gator%22"},"sa":{"href":"Cool \"Gator\""}}'/>
8037 !! end
8038
8039 !! test
8040 Link containing double-single-quotes '' in text (T6598 sanity check)
8041 !! wikitext
8042 Some [[Link|pretty ''italics'' and stuff]]!
8043 !! html/php
8044 <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>!
8045 </p>
8046 !! html/parsoid
8047 <p>Some <a rel="mw:WikiLink" href="./Link" title="Link">pretty <i>italics</i> and stuff</a>!</p>
8048 !! end
8049
8050 !! test
8051 Link containing double-single-quotes '' in text embedded in italics (T6598 sanity check)
8052 !! wikitext
8053 ''Some [[Link|pretty ''italics'' and stuff]]!''
8054 !! html
8055 <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>
8056 </p>
8057 !! end
8058
8059 !! test
8060 Link with double quotes in title part (literal) and alternate part (interpreted)
8061 !! wikitext
8062 [[File:Denys_Savchenko_''Pentecoste''.jpg]]
8063
8064 [[''Pentecoste'']]
8065
8066 [[''Pentecoste''|Pentecoste]]
8067
8068 [[''Pentecoste''|''Pentecoste'']]
8069 !! html/php
8070 <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>
8071 </p><p><a href="/index.php?title=%27%27Pentecoste%27%27&amp;action=edit&amp;redlink=1" class="new" title="&#39;&#39;Pentecoste&#39;&#39; (page does not exist)">''Pentecoste''</a>
8072 </p><p><a href="/index.php?title=%27%27Pentecoste%27%27&amp;action=edit&amp;redlink=1" class="new" title="&#39;&#39;Pentecoste&#39;&#39; (page does not exist)">Pentecoste</a>
8073 </p><p><a href="/index.php?title=%27%27Pentecoste%27%27&amp;action=edit&amp;redlink=1" class="new" title="&#39;&#39;Pentecoste&#39;&#39; (page does not exist)"><i>Pentecoste</i></a>
8074 </p>
8075 !! html/parsoid
8076 <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>
8077 <p><a rel="mw:WikiLink" href="./''Pentecoste''" title="''Pentecoste''">''Pentecoste''</a></p>
8078 <p><a rel="mw:WikiLink" href="./''Pentecoste''" title="''Pentecoste''">Pentecoste</a></p>
8079 <p><a rel="mw:WikiLink" href="./''Pentecoste''" title="''Pentecoste''"><i>Pentecoste</i></a></p>
8080 !! end
8081
8082 !! test
8083 Broken image links with HTML captions (T41700)
8084 !! wikitext
8085 [[File:Nonexistent|<script></script>]]
8086 [[File:Nonexistent|100x100px|<script></script>]]
8087 [[File:Nonexistent|&lt;]]
8088 [[File:Nonexistent|a<i>b</i>c]]
8089 !! html/php
8090 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
8091 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
8092 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
8093 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
8094 </p>
8095 !! html/parsoid
8096 <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>
8097 <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>
8098 <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>
8099 <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>
8100 !! end
8101
8102 !! test
8103 Plain link to URL
8104 !! wikitext
8105 [[http://www.example.com]]
8106 !! html/php
8107 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
8108 </p>
8109 !! html/parsoid
8110 <p>[<a rel="mw:ExtLink" href="http://www.example.com"></a>]</p>
8111 !! end
8112
8113 !! test
8114 Plain link to URL with link text
8115 !! wikitext
8116 [[http://www.example.com Link text]]
8117 !! html
8118 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
8119 </p>
8120 !! end
8121
8122 !! test
8123 Plain link to protocol-relative URL
8124 !! wikitext
8125 [[//www.example.com]]
8126 !! html/php
8127 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
8128 </p>
8129 !! html/parsoid
8130 <p>[<a rel="mw:ExtLink" href="//www.example.com"></a>]</p>
8131 !! end
8132
8133 !! test
8134 Plain link to protocol-relative URL with link text
8135 !! wikitext
8136 [[//www.example.com Link text]]
8137 !! html
8138 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
8139 </p>
8140 !! end
8141
8142 !! test
8143 Plain link to page with question mark in title
8144 !! wikitext
8145 [[A?b]]
8146
8147 [[A?b|Baz]]
8148 !! html
8149 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
8150 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
8151 </p>
8152 !! end
8153
8154 # I'm fairly sure the expected result here is wrong.
8155 # We want these to be URL links, not pseudo-pages with URLs for titles....
8156 # However the current output is also pretty screwy.
8157 #
8158 # ----
8159 # I'm changing it to match the current output--it arguably makes more
8160 # sense in the light of the test above. Old expected result was:
8161 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
8162 #</p>
8163 # But I think this test is bordering on "garbage in, garbage out" anyway.
8164 # -- wtm
8165 !! test
8166 Piped link to URL
8167 !! wikitext
8168 Piped link to URL: [[http://www.example.com|an example URL]]
8169 !! html/php
8170 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
8171 </p>
8172 !! html/parsoid
8173 <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>
8174 !! end
8175
8176 !! test
8177 Plain link in template argument
8178 !! options
8179 parsoid=wt2html
8180 !! wikitext
8181 {{echo|[http://www.example.com |123]}}
8182
8183 {{echo|[[http://www.example.com |123]]}}
8184
8185 {{echo|[[http://www.example.com |123]}}
8186
8187 {{echo|[http://www.example.com |123]]}}
8188 !! html/php
8189 <p>[<a rel="nofollow" class="external free" href="http://www.example.com">http://www.example.com</a>
8190 </p><p>[<a rel="nofollow" class="external text" href="http://www.example.com">|123</a>]
8191 </p><p>{{echo|[<a rel="nofollow" class="external text" href="http://www.example.com">|123</a>}}
8192 </p><p>[<a rel="nofollow" class="external free" href="http://www.example.com">http://www.example.com</a>
8193 </p>
8194 !! html/parsoid
8195 <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>
8196
8197 <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>
8198
8199 <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>
8200
8201 <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>
8202 !! end
8203
8204 !! test
8205 T2002: [[page|http://url/]] should link to page, not http://url/
8206 !! wikitext
8207 [[Main Page|http://url/]]
8208 !! html/php
8209 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
8210 </p>
8211 !! html/parsoid
8212 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">http://url/</a></p>
8213 !! end
8214
8215 # Parsoid does not mark self-links, by design.
8216 !! test
8217 T2337: Escaped self-links should be bold
8218 !! options
8219 title=[[Bug462]]
8220 !! wikitext
8221 [[Bu&#103;462]] [[Bug462]]
8222 !! html/php
8223 <p><a class="mw-selflink selflink">Bu&#103;462</a> <a class="mw-selflink selflink">Bug462</a>
8224 </p>
8225 !! html/php+tidy
8226 <p><a class="mw-selflink selflink">Bug462</a> <a class="mw-selflink selflink">Bug462</a></p>
8227 !! html/parsoid
8228 <p><a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a> <a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a></p>
8229 !! end
8230
8231 !! test
8232 Self-link to section should not be bold
8233 !! options
8234 title=[[Main Page]]
8235 !! wikitext
8236 [[Main Page#section]]
8237 !! html
8238 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
8239 </p>
8240 !! end
8241
8242 !! article
8243 00
8244 !! text
8245 This is 00.
8246 !! endarticle
8247
8248 !!test
8249 Self-link to numeric title
8250 !!options
8251 title=[[0]]
8252 !! wikitext
8253 [[0]]
8254 !! html
8255 <p><a class="mw-selflink selflink">0</a>
8256 </p>
8257 !!end
8258
8259 !!test
8260 Link to numeric-equivalent title
8261 !!options
8262 title=[[0]]
8263 !! wikitext
8264 [[00]]
8265 !! html
8266 <p><a href="/wiki/00" title="00">00</a>
8267 </p>
8268 !!end
8269
8270 !! test
8271 <nowiki> inside a link
8272 !! wikitext
8273 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
8274 !! html
8275 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
8276 </p>
8277 !! end
8278
8279 !! test
8280 Non-breaking spaces in title
8281 !! wikitext
8282 [[&nbsp; Main &nbsp; Page &nbsp;]]
8283 !! html
8284 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
8285 </p>
8286 !!end
8287
8288 # Add new article for the test below so that it doesn't red-link
8289 !! article
8290 Foo bar baz
8291 !! text
8292 boo
8293 !! endarticle
8294
8295 !! test
8296 Multiple spaces in titles should normalize to a single underscore
8297 !! options
8298 parsoid=wt2html,wt2wt
8299 !! wikitext
8300 [[Foo bar baz|x]]
8301 [[Foo bar baz|x]]
8302 [[Foo bar baz|x]]
8303 !! html/php
8304 <p><a href="/wiki/Foo_bar_baz" title="Foo bar baz">x</a>
8305 <a href="/wiki/Foo_bar_baz" title="Foo bar baz">x</a>
8306 <a href="/wiki/Foo_bar_baz" title="Foo bar baz">x</a>
8307 </p>
8308 !! html/parsoid
8309 <p><a rel="mw:WikiLink" href="./Foo_bar_baz" title="Foo bar baz">x</a>
8310 <a rel="mw:WikiLink" href="./Foo_bar_baz" title="Foo bar baz">x</a>
8311 <a rel="mw:WikiLink" href="./Foo_bar_baz" title="Foo bar baz">x</a>
8312 </p>
8313 !! end
8314
8315 !! test
8316 Internal link with ca linktrail, surrounded by bold apostrophes (T29473 primary issue)
8317 !! options
8318 language=ca
8319 !! wikitext
8320 '''[[Main Page]]'''
8321 !! html
8322 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
8323 </p>
8324 !! end
8325
8326 !! test
8327 Internal link with ca linktrail, surrounded by italic apostrophes (T29473 primary issue)
8328 !! options
8329 language=ca
8330 !! wikitext
8331 ''[[Main Page]]''
8332 !! html
8333 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
8334 </p>
8335 !! end
8336
8337 !! test
8338 Internal link with en linktrail: no apostrophes (T29473)
8339 !! options
8340 language=en
8341 !! wikitext
8342 [[Something]]'nice
8343 !! html
8344 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
8345 </p>
8346 !! end
8347
8348 !! test
8349 Internal link with ca linktrail with apostrophes (T29473)
8350 !! options
8351 language=ca
8352 !! wikitext
8353 [[Something]]'nice
8354 !! html
8355 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
8356 </p>
8357 !! end
8358
8359 !! test
8360 Internal link with kaa linktrail with apostrophes (T29473)
8361 !! options
8362 language=kaa
8363 !! wikitext
8364 [[Something]]'nice
8365 !! html
8366 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (bet ele jaratılmag&#39;an)">Something'nice</a>
8367 </p>
8368 !! end
8369
8370 !! test
8371 Link with multiple ":" in a subpage-supporting namespace (T65636)
8372 !! wikitext
8373 [[User:Foo/Test/63636:Bar|Test]]
8374 !! html/php
8375 <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>
8376 </p>
8377 !! html/parsoid
8378 <p><a rel="mw:WikiLink" href="./User:Foo/Test/63636:Bar" title="User:Foo/Test/63636:Bar">Test</a></p>
8379 !! end
8380
8381 ## Mainly a sanity check for Parsoid
8382 !! test
8383 Handle title parsing for subpages
8384 !! options
8385 title=[[/123123]]
8386 subpage
8387 !! wikitext
8388 123
8389 !! html/php
8390 <p>123
8391 </p>
8392 !! html/parsoid
8393 <p>123</p>
8394 !! end
8395
8396 !! article
8397 User:Test/123
8398 !! text
8399 test 123
8400 !! endarticle
8401
8402 !! test
8403 Link to a subpage from a namespace other than main
8404 !! options
8405 title=[[User:Test]]
8406 subpage
8407 !! wikitext
8408 [[/123]]
8409 !! html/php
8410 <p><a href="/wiki/User:Test/123" title="User:Test/123">/123</a>
8411 </p>
8412 !! html/parsoid
8413 <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>
8414 !! end
8415
8416 !! test
8417 Ensure that transclusion titles are not url-decoded
8418 !! options
8419 subpage title=[[Test]]
8420 parsoid=wt2html
8421 !! wikitext
8422 {{Bar%C3%A9}} {{/Bar%C3%A9}}
8423 !! html/php
8424 <p>{{Bar%C3%A9}} {{/Bar%C3%A9}}
8425 </p>
8426 !! html/parsoid
8427 <p>{{Bar%C3%A9}} {{/Bar%C3%A9}}</p>
8428 !! end
8429
8430 !! test
8431 Purely hash wikilink
8432 !! options
8433 title=[[User:Test/123]]
8434 subpage
8435 !! wikitext
8436 [[#a|b]]
8437 !! html/php
8438 <p><a href="#a">b</a>
8439 </p>
8440 !! html/parsoid
8441 <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>
8442 !! end
8443
8444 !! test
8445 Serialization of purely hash wikilink
8446 !! options
8447 title=[[User:Test/123]]
8448 subpage
8449 parsoid=html2wt
8450 !! html/parsoid
8451 <p><a href="#a">[[</a></p>
8452 !! wikitext
8453 [[#a|<nowiki>[[</nowiki>]]
8454 !! html/php
8455 <p><a href="#a">[[</a>
8456 </p>
8457 !! end
8458
8459 !! test
8460 1. Interaction of linktrail and template encapsulation
8461 !! wikitext
8462 {{echo|[[Foo]]}}l
8463 !! html/parsoid
8464 <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>
8465 !! end
8466
8467 !! test
8468 2. Interaction of linktrail and template encapsulation
8469 !! options
8470 parsoid
8471 !! wikitext
8472 {{echo|Some [[Fool]]}}s
8473 !! html
8474 <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>
8475 !! end
8476
8477 !! test
8478 3. Interaction of linktrail and template encapsulation
8479 !! options
8480 parsoid
8481 !! wikitext
8482 {{echo|Some [[Fool]]s are '''bold and foolish'''}}
8483 !! html
8484 <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>
8485 !! end
8486
8487 !! article
8488 Söfnuður
8489 !! text
8490 Test.
8491 !! endarticle
8492
8493 !! test
8494 Internal link with is link prefix
8495 !! options
8496 language=is
8497 !! wikitext
8498 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
8499 !! html
8500 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
8501 </p>
8502 !! end
8503
8504 !! article
8505 Mótmælendatrú
8506 !! text
8507 Test.
8508 !! endarticle
8509
8510 !! test
8511 Internal link with is link trail and link prefix
8512 !! options
8513 language=is
8514 !! wikitext
8515 [[mótmælendatrú|xxx]]ar
8516 [[mótmælendatrú]]ar
8517 mótmælenda[[söfnuður]]
8518 mótmælenda[[söfnuður|söfnuðir]]
8519 mótmælenda[[söfnuður|söfnuðir]]xxx
8520 !! html
8521 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
8522 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
8523 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
8524 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
8525 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
8526 </p>
8527 !! end
8528
8529 !! test
8530 Parsoid link trail escaping
8531 !! options
8532 parsoid=html2wt,html2html
8533 !! html/parsoid
8534 <p><a rel="mw:WikiLink" href="./Apple" title="Apple">apple</a>s</p>
8535 !! wikitext
8536 [[apple]]<nowiki/>s
8537 !! end
8538
8539 !! test
8540 Parsoid link prefix escaping
8541 !! options
8542 language=is
8543 parsoid=html2wt,html2html
8544 !! html/parsoid
8545 <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="./Söfnuður" title="Söfnuður">söfnuður</a></p>
8546 !! wikitext
8547 Aðrir mótmælenda<nowiki/>[[söfnuður]]
8548 !! end
8549
8550 !! test
8551 Parsoid link bracket escaping
8552 !! options
8553 parsoid=html2wt,html2html
8554 !! html/parsoid
8555 <p><a rel="mw:WikiLink" href="./Test" title="Test">Test</a></p>
8556 <p>[<a rel="mw:WikiLink" href="./Test" title="Test">Test</a>]</p>
8557 <p>[[<a rel="mw:WikiLink" href="./Test" title="Test">Test</a>]]</p>
8558 <p>[[[<a rel="mw:WikiLink" href="./Test" title="Test">Test</a>]]]</p>
8559 <p>[[[[<a rel="mw:WikiLink" href="./Test" title="Test">Test</a>]]]]</p>
8560 <p>[[[[[<a rel="mw:WikiLink" href="./Test" title="Test">Test</a>]]]]]</p>
8561 !! wikitext
8562 [[Test]]
8563
8564 [<nowiki/>[[Test]]]
8565
8566 [[[[Test]]]]
8567
8568 [[[<nowiki/>[[Test]]]]]
8569
8570 [[[[[[Test]]]]]]
8571
8572 [[[[[<nowiki/>[[Test]]]]]]]
8573 !! end
8574
8575 !! test
8576 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
8577 !! wikitext
8578 [[Foo| bar]]
8579
8580 [[Foo| ''bar'']]
8581
8582 [http://wp.org foo]
8583
8584 [http://wp.org ''foo'']
8585 !! html
8586 <p><a href="/wiki/Foo" title="Foo"> bar</a>
8587 </p><p><a href="/wiki/Foo" title="Foo"> <i>bar</i></a>
8588 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
8589 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
8590 </p>
8591 !! end
8592
8593 !! test
8594 Parsoid: Scoped parsing should handle mixed transclusions and plain text
8595 !! wikitext
8596 [[Foo|{{echo|a}} b {{echo|c}}]]
8597 !! html/parsoid
8598 <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>
8599 !! end
8600
8601 !! test
8602 Link with angle bracket after anchor
8603 !! wikitext
8604 [[Foo#<bar>]]
8605 !! html/php
8606 <p><a href="/wiki/Foo#.3Cbar.3E" title="Foo">Foo#&lt;bar&gt;</a>
8607 </p>
8608 !! html/parsoid
8609 <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>
8610 !! end
8611
8612 ###
8613 ### Interwiki links (see maintenance/interwiki.sql)
8614 ###
8615
8616 !! test
8617 Inline interwiki link
8618 !! options
8619 parsoid=wt2html,wt2wt,html2html
8620 !! wikitext
8621 [[MeatBall:SoftSecurity]]
8622 !! html/php
8623 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
8624 </p>
8625 !! html/parsoid
8626 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a></p>
8627 !! end
8628
8629 !! test
8630 Inline interwiki link with empty title (T4372)
8631 !! options
8632 parsoid=wt2html,wt2wt,html2html
8633 !! wikitext
8634 [[MeatBall:]]
8635 !! html/php
8636 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
8637 </p>
8638 !! html/parsoid
8639 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?" title="meatball:">MeatBall:</a></p>
8640 !! end
8641
8642 ## html2wt and html2html will fail because we will prefer the :en: interwiki prefix over wikipedia:
8643 !! test
8644 Interwiki link encoding conversion (T3636)
8645 !! options
8646 parsoid=wt2html,wt2wt
8647 !! wikitext
8648 *[[Wikipedia:ro:Olteni&#0355;a]]
8649 *[[Wikipedia:ro:Olteni&#355;a]]
8650 !! html
8651 <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>
8652 <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>
8653
8654 !! html+tidy
8655 <ul>
8656 <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>
8657 <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>
8658 </ul>
8659 !! html/parsoid
8660 <ul>
8661 <li><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/ro:Olteniţa" title="wikipedia:ro:Olteniţa">Wikipedia:ro:Olteniţa</a></li>
8662 <li><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/ro:Olteniţa" title="wikipedia:ro:Olteniţa">Wikipedia:ro:Olteniţa</a></li>
8663 </ul>
8664 !! end
8665
8666 !! test
8667 Interwiki link with fragment (T4130)
8668 !! wikitext
8669 [[MeatBall:SoftSecurity#foo]]
8670 !! html
8671 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
8672 </p>
8673 !! end
8674
8675 !! test
8676 Link scenarios with escaped fragments
8677 !! wikitext
8678 [[#Is this great?]]
8679 [[Foo#Is this great?]]
8680 [[meatball:Foo#Is this great?]]
8681 !! html/php
8682 <p><a href="#Is_this_great.3F">#Is this great?</a>
8683 <a href="/wiki/Foo#Is_this_great.3F" title="Foo">Foo#Is this great?</a>
8684 <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>
8685 </p>
8686 !! html/parsoid
8687 <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>
8688 <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>
8689 <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>
8690 !! end
8691
8692 # Ideally the wikipedia: prefix here should be proto-relative too
8693 # [CSA]: this is kind of a bogus test, as the PHP parser test doesn't
8694 # define the 'en' prefix, and originally the test used 'wikipedia',
8695 # which isn't a localinterwiki prefix hence the links to the 'en:Foo'
8696 # article.
8697 !! test
8698 Different interwiki prefixes mapping to the same URL
8699 !! wikitext
8700 [[:en:Foo]]
8701
8702 [[:en:Foo|Foo]]
8703
8704 [[wikipedia:Foo]]
8705
8706 [[:wikipedia:Foo|Foo]]
8707
8708 [[wikipedia:en:Foo]]
8709
8710 [[:wikipedia:en:Foo]]
8711
8712 [[ wikiPEdia :Foo]]
8713 !! html/parsoid
8714 <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>
8715
8716 <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>
8717
8718 <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>
8719
8720 <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>
8721
8722 <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>
8723
8724 <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>
8725
8726 <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>
8727 !! end
8728
8729 !! test
8730 Interwiki links that cannot be represented in wiki syntax
8731 !! wikitext
8732 [[meatball:ok]]
8733 [[meatball:ok#foo|ok with fragment]]
8734 [[meatball:ok_as_well?|ok ending with ? mark]]
8735 [http://de.wikipedia.org/wiki/Foo?action=history has query]
8736 [http://de.wikipedia.org/wiki/#foo is just fragment]
8737
8738 !! html/php
8739 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?ok" class="extiw" title="meatball:ok">meatball:ok</a>
8740 <a href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" class="extiw" title="meatball:ok">ok with fragment</a>
8741 <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>
8742 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
8743 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a>
8744 </p>
8745 !! html/parsoid
8746 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok" title="meatball:ok">meatball:ok</a>
8747 <a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" title="meatball:ok">ok with fragment</a>
8748 <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>
8749 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
8750 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a></p>
8751 !! end
8752
8753 !! test
8754 Interwiki links: trail
8755 !! wikitext
8756 [[wikipedia:Foo|Ba]]r
8757 !! html/php
8758 <p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
8759 </p>
8760 !! html/parsoid
8761 <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>
8762 !! end
8763
8764 !! test
8765 Local interwiki link
8766 !! options
8767 parsoid=wt2html,wt2wt,html2html
8768 !! wikitext
8769 [[local:Template:Foo]]
8770 !! html/php
8771 <p><a href="/wiki/Template:Foo" title="Template:Foo">local:Template:Foo</a>
8772 </p>
8773 !! html/parsoid
8774 <p><a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">local:Template:Foo</a></p>
8775 !! end
8776
8777 # Parsoid does not mark self-links, by design.
8778 !! test
8779 Local interwiki link: self-link to current page
8780 !! options
8781 title=[[Main Page]]
8782 parsoid=wt2html,wt2wt,html2html
8783 !! wikitext
8784 [[local:Main Page]]
8785 !! html/php
8786 <p><a class="mw-selflink selflink">local:Main Page</a>
8787 </p>
8788 !! html/parsoid
8789 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:Main Page</a></p>
8790 !! end
8791
8792 !! test
8793 Local interwiki link: prefix only (T66167)
8794 !! options
8795 parsoid=wt2html,wt2wt,html2html
8796 !! wikitext
8797 [[local:]]
8798 !! html/php
8799 <p><a href="/wiki/Main_Page" title="Main Page">local:</a>
8800 </p>
8801 !! html/parsoid
8802 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:</a></p>
8803 !! end
8804
8805 !! test
8806 Local interwiki link: with additional interwiki prefix (T63357)
8807 !! options
8808 parsoid=wt2html,wt2wt,html2html
8809 !! wikitext
8810 [[local:meatball:Hello]]
8811 !! html/php
8812 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?Hello" class="extiw" title="meatball:Hello">local:meatball:Hello</a>
8813 </p>
8814 !! html/parsoid
8815 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?Hello" title="meatball:Hello">local:meatball:Hello</a></p>
8816 !! end
8817
8818 !! test
8819 Multiple local interwiki link prefixes
8820 !! wikitext
8821 [[local:local:local:local:mi:local:Foo]]
8822 !! options
8823 parsoid=wt2html,wt2wt,html2html
8824 !! html/php
8825 <p><a href="/wiki/Foo" title="Foo">local:local:local:local:mi:local:Foo</a>
8826 </p>
8827 !! html/parsoid
8828 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">local:local:local:local:mi:local:Foo</a></p>
8829 !! end
8830
8831 ###
8832 ### Interlanguage links
8833 ### Language links (so that searching for '### language' matches..)
8834 ###
8835
8836 !! test
8837 Interlanguage link
8838 !! wikitext
8839 Blah blah blah
8840 [[zh:Chinese]]
8841 !! html/php
8842 <p>Blah blah blah
8843 </p>
8844 !! html/parsoid
8845 <p>Blah blah blah</p>
8846 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8847 !! end
8848
8849 ## parsoid html2wt will lose the space variations
8850 !! test
8851 Interlanguage link with spacing
8852 !! options
8853 parsoid=wt2html,wt2wt,html2html
8854 !! wikitext
8855 Blah blah blah
8856 [[ zh : Chinese ]]
8857 !! html/php
8858 <p>Blah blah blah
8859 </p>
8860 !! html/parsoid
8861 <p>Blah blah blah</p>
8862 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8863 !! end
8864
8865 !! test
8866 Double interlanguage link
8867 !! wikitext
8868 Blah blah blah
8869 [[es:Spanish]]
8870 [[zh:Chinese]]
8871 !! html/php
8872 <p>Blah blah blah
8873 </p>
8874 !! html/parsoid
8875 <p>Blah blah blah</p>
8876 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
8877 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8878 !! end
8879
8880 ## parsoid html2wt will lose the space variations
8881 !! test
8882 Interlanguage link variations
8883 !! options
8884 parsoid=wt2html,wt2wt,html2html
8885 !! wikitext
8886 Blah blah blah
8887 [[ es :Spanish]]
8888 [[ ZH :Chinese]]
8889 [[es:Foo_bar]]
8890 !! html/php
8891 <p>Blah blah blah
8892 </p>
8893 !! html/parsoid
8894 <p>Blah blah blah</p>
8895 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish" />
8896 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese" />
8897 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar" />
8898 !! end
8899
8900 !! test
8901 Escaping of interlanguage links (T129218, T156308)
8902 !! wikitext
8903 Blah blah blah
8904 [[:es:Spanish]]
8905 [[ : zh : Chinese ]]
8906 !! html/php
8907 <p>Blah blah blah
8908 <a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">es:Spanish</a>
8909 <a href="http://zh.wikipedia.org/wiki/Chinese" class="extiw" title="zh:Chinese"> zh : Chinese </a>
8910 </p>
8911 !! html/parsoid
8912 <p>Blah blah blah
8913 <a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">es:Spanish</a>
8914 <a rel="mw:ExtLink" href="http://zh.wikipedia.org/wiki/Chinese" title="zh:Chinese"> zh : Chinese </a></p>
8915 !! end
8916
8917 !! test
8918 Multiple colons escaping interlanguage links
8919 !! options
8920 parsoid=wt2html
8921 !! wikitext
8922 [[:es:Spanish]]
8923 [[::es:Spanish]]
8924 [[:::es:Spanish]]
8925 !! html/php
8926 <p><a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">es:Spanish</a>
8927 [[::es:Spanish]]
8928 [[:::es:Spanish]]
8929 </p>
8930 !! html/parsoid
8931 <p><a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">es:Spanish</a>
8932 [[::es:Spanish]]
8933 [[:::es:Spanish]]</p>
8934 !! end
8935
8936 ## parsoid html2wt will normalize the space to _
8937 !! test
8938 Space and question mark encoding in interlanguage links (T95473)
8939 !! options
8940 parsoid=wt2html,wt2wt,html2html
8941 !! wikitext
8942 Blah blah blah
8943 [[es:Foo bar?]]
8944 !! html/php
8945 <p>Blah blah blah
8946 </p>
8947 !! html/parsoid
8948 <p>Blah blah blah</p>
8949 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar%3F" />
8950 !! end
8951
8952 !! test
8953 Interlanguage link, with prefix links
8954 !! options
8955 language=ln
8956 !! wikitext
8957 Blah blah blah
8958 [[zh:Chinese]]
8959 !! html/php
8960 <p>Blah blah blah
8961 </p>
8962 !! html/parsoid
8963 <p>Blah blah blah</p>
8964 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8965 !! end
8966
8967 !! test
8968 Double interlanguage link, with prefix links (T10897)
8969 !! options
8970 language=ln
8971 !! wikitext
8972 Blah blah blah
8973 [[es:Spanish]]
8974 [[zh:Chinese]]
8975 !! html/php
8976 <p>Blah blah blah
8977 </p>
8978 !! html/parsoid
8979 <p>Blah blah blah</p>
8980 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
8981 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8982 !! end
8983
8984 !! test
8985 "Extra" interlanguage links (T34189 / gerrit 111390)
8986 !! wikitext
8987 Blah blah blah
8988 [[mul:Article]]
8989 !! html/php
8990 <p>Blah blah blah
8991 </p>
8992 !! html/parsoid
8993 <p>Blah blah blah</p>
8994 <link rel="mw:PageProp/Language" title="Multilingual" href="http://wikisource.org/wiki/Article"/>
8995 !! end
8996
8997 ## PHP parser tests script needs an update
8998 ## Parsoid html2wt will normalize output to [[:zh:Chinese]]
8999 !! test
9000 Language links render as inline links if $wgInterwikiMagic=false
9001 !! options
9002 wgInterwikiMagic=false
9003 parsoid=wt2html,wt2wt,html2html
9004 !! wikitext
9005 Blah blah blah
9006 [[zh:Chinese]]
9007 !! html/parsoid
9008 <p>Blah blah blah <a rel="mw:ExtLink" href="http://zh.wikipedia.org/wiki/Chinese" title="zh:Chinese">zh:Chinese</a></p>
9009 !! end
9010
9011 ## PHP parser tests script needs an update
9012 ## Parsoid html2wt will normalize output to [[:zh:Chinese]]
9013 !! test
9014 Language links render as inline links in the Talk namespace
9015 !! options
9016 title=Talk:Foo
9017 parsoid=wt2html,wt2wt,html2html
9018 !! wikitext
9019 Blah blah blah
9020 [[zh:Chinese]]
9021 !! html/parsoid
9022 <p>Blah blah blah <a rel="mw:ExtLink" href="http://zh.wikipedia.org/wiki/Chinese" title="zh:Chinese">zh:Chinese</a></p>
9023 !! end
9024
9025 !! test
9026 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
9027 !! options
9028 language=ln
9029 !! wikitext
9030 [[WW&nbsp;II]]
9031 !! html
9032 <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>
9033 </p>
9034 !! end
9035
9036 !! test
9037 Parsoid T55221: Wikilinks should be properly entity-escaped
9038 !! options
9039 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
9040 !! html/parsoid
9041 <p>He&amp;nbsp;llo <a href="./Foo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
9042 <p>He&amp;nbsp;llo <a href="./He&amp;nbsp;llo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
9043 !! wikitext
9044 He&amp;nbsp;llo [[Foo|He&amp;nbsp;llo]]
9045
9046 He&amp;nbsp;llo He&amp;nbsp;llo
9047 !! html/php
9048 <p>He&amp;nbsp;llo <a href="/wiki/Foo" title="Foo">He&amp;nbsp;llo</a>
9049 </p><p>He&amp;nbsp;llo He&amp;nbsp;llo
9050 </p>
9051 !! end
9052
9053 # html2wt will fail because of title normalization without data-parsoid
9054 !! test
9055 Parsoid: handle constructor well
9056 !! options
9057 parsoid=wt2html,wt2wt
9058 !! wikitext
9059 [[constructor]]
9060
9061 [[constructor:foo]]
9062 !! html/php
9063 <p><a href="/index.php?title=Constructor&amp;action=edit&amp;redlink=1" class="new" title="Constructor (page does not exist)">constructor</a>
9064 </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>
9065 </p>
9066 !! html/parsoid
9067 <p><a rel="mw:WikiLink" href="./Constructor" title="Constructor" data-parsoid='{"stx":"simple","a":{"href":"./Constructor"},"sa":{"href":"constructor"}}'>constructor</a></p>
9068
9069 <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>
9070 !! end
9071
9072 !! article
9073 ko:
9074 !! text
9075 Test.
9076 !! endarticle
9077
9078 # Note that `ko` isn't a known interlanguage prefix
9079 !! test
9080 Parsoid: recognize interlanguage links without a target page
9081 !! options
9082 ill
9083 !! wikitext
9084 [[es:]]
9085
9086 [[ko:]]
9087 !! html/php
9088 es:
9089 !! html/parsoid
9090 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/"/>
9091
9092 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
9093 !! end
9094
9095 # Note that `ko` isn't a known interwiki prefix
9096 !! test
9097 Parsoid: recognize interwiki links without a target page
9098 !! options
9099 parsoid=wt2html,wt2wt,html2html
9100 !! wikitext
9101 [[:es:]]
9102
9103 [[:ko:]]
9104 !! html/php
9105 <p><a href="http://es.wikipedia.org/wiki/" class="extiw" title="es:">es:</a>
9106 </p><p><a href="/wiki/Ko:" title="Ko:">ko:</a>
9107 </p>
9108 !! html/parsoid
9109 <p><a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/" title="es:">es:</a></p>
9110 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
9111 !! end
9112
9113 !! test
9114 Handle interwiki links pointing to the current wiki as plain wiki links (T47209)
9115 !! wikitext
9116 [[mi:Foo]]
9117 !! html/php
9118 <p><a href="/wiki/Foo" title="Foo">mi:Foo</a>
9119 </p>
9120 !! html/parsoid
9121 <p><a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo"},"sa":{"href":"mi:Foo"}}'>mi:Foo</a></p>
9122 !! end
9123
9124 !! test
9125 Interlanguage link with preceding local interwiki link (T70085)
9126 !! options
9127 parsoid=wt2html,wt2wt,html2html
9128 !! wikitext
9129 Blah blah blah
9130 [[local:es:Spanish]]
9131 !! html/php
9132 <p>Blah blah blah
9133 <a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">local:es:Spanish</a>
9134 </p>
9135 !! html/parsoid
9136 <p>Blah blah blah
9137 <a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">local:es:Spanish</a></p>
9138 !! end
9139
9140 !! test
9141 Looks like an interlanguage link, but is actually a local interwiki
9142 !! options
9143 parsoid=wt2html,wt2wt,html2html
9144 !! wikitext
9145 Blah blah blah
9146 [[mi:Template:Foo]]
9147 !! html/php
9148 <p>Blah blah blah
9149 <a href="/wiki/Template:Foo" title="Template:Foo">mi:Template:Foo</a>
9150 </p>
9151 !! html/parsoid
9152 <p>Blah blah blah
9153 <a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">mi:Template:Foo</a></p>
9154 !! end
9155
9156 ###
9157 ### Redirects, Parsoid-only
9158 ###
9159
9160 !! test
9161 1. Simple redirect to page
9162 !! wikitext
9163 #REDIRECT [[Main Page]]
9164 !! html/parsoid
9165 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
9166 !! end
9167
9168 !! test
9169 2. Other redirect variants
9170 !! wikitext
9171 #REDIRECT [[Main_Page]]
9172 !! html/parsoid
9173 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Main_Page"},"sa":{"href":"Main_Page"}}'/>
9174 !! end
9175
9176 # Not a valid redirect in PHP (although perhaps it was, once upon a time)
9177 # This tests the Parsoid bail-out code.
9178 !! test
9179 3. Other redirect variants
9180 !! wikitext
9181 #REDIRECT [[<nowiki>[[Bar]]</nowiki>]]
9182 !! html/parsoid
9183 <ol><li data-parsoid>REDIRECT [[[[Bar]]]]</li></ol>
9184 !! end
9185
9186 !! test
9187 4. Redirect to a templated destination
9188 !! wikitext
9189 #REDIRECT [[{{echo|Foo}}bar]]
9190 !! html/parsoid
9191 <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"}]]}'/>
9192 !! end
9193
9194 !! test
9195 Empty redirect
9196 !! options
9197 parsoid=wt2html,wt2wt
9198 !! wikitext
9199 #REDIRECT [[]]
9200 !! html/parsoid
9201 <ol>
9202 <li>REDIRECT [[]]</li></ol>
9203 !! end
9204
9205 !! test
9206 Optional colon in #REDIRECT
9207 !! options
9208 # the colon is archaic syntax. we support it for wt2html, but we
9209 # don't care that it roundtrips back to the modern syntax.
9210 parsoid=wt2html,html2html
9211 !! wikitext
9212 #REDIRECT:[[Main Page]]
9213 !! html/parsoid
9214 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
9215 !! end
9216
9217 !! test
9218 Whitespace in #REDIRECT with optional colon
9219 !! options
9220 # the colon and gratuitous whitespace is archaic syntax. we support
9221 # it for wt2html, but we don't care that it roundtrips back to the
9222 # modern syntax (without extra whitespace)
9223 parsoid=wt2html,html2html
9224 !! wikitext
9225
9226 #REDIRECT
9227 :
9228 [[Main Page]]
9229 !! html/parsoid
9230 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
9231 !! end
9232
9233 !! test
9234 Piped link in #REDIRECT
9235 !! options
9236 # content after piped link is ignored. we support this syntax,
9237 # but don't care that the piped link is lost when we roundtrip this.
9238 parsoid=wt2html
9239 !! wikitext
9240 #REDIRECT [[Main Page|bar]]
9241 !! html/parsoid
9242 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
9243 !! end
9244
9245 !! test
9246 Redirect to category (T104502)
9247 !! options
9248 parsoid=wt2html,wt2wt
9249 !! wikitext
9250 #REDIRECT [[Category:Foo]]
9251 !! html/parsoid
9252 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
9253 !! end
9254
9255 !! test
9256 Redirect to category with URL encoding (T104502)
9257 !! options
9258 parsoid=wt2html
9259 !! wikitext
9260 #REDIRECT [[Category%3AFoo]]
9261 !! html/parsoid
9262 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
9263 !! end
9264
9265 !! test
9266 Redirect to category page
9267 !! wikitext
9268 #REDIRECT [[:Category:Foo]]
9269 !! html/parsoid
9270 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
9271 !! end
9272
9273 !! test
9274 Redirect to image page (1)
9275 !! wikitext
9276 #REDIRECT [[File:Wiki.png]]
9277 !! html/parsoid
9278 <link rel="mw:PageProp/redirect" href="./File:Wiki.png"/>
9279 !! end
9280
9281 !! test
9282 Redirect to image page (2)
9283 !! wikitext
9284 #REDIRECT [[Image:Wiki.png]]
9285 !! html/parsoid
9286 <link rel="mw:PageProp/redirect" href="./File:Wiki.png" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./File:Wiki.png"},"sa":{"href":"Image:Wiki.png"}}'/>
9287 !! end
9288
9289 # html2wt disabled because wts serializes as "#REDIRECT [[:en:File:Wiki.png]]"
9290 # Next test confirms this.
9291 !! test
9292 Redirect to language (1) (T104918)
9293 !! options
9294 parsoid=wt2html,wt2wt,html2html
9295 !! wikitext
9296 #REDIRECT [[en:File:Wiki.png]]
9297 !! html/parsoid
9298 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
9299 !! end
9300
9301 !! test
9302 Redirect to language (2) (T104918)
9303 !! wikitext
9304 #REDIRECT [[:en:File:Wiki.png]]
9305 !! html/parsoid
9306 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
9307 !! end
9308
9309 !! test
9310 Redirect to interwiki (T104918)
9311 !! wikitext
9312 #REDIRECT [[meatball:File:Wiki.png]]
9313 !! html/parsoid
9314 <link rel="mw:PageProp/redirect" href="http://www.usemod.com/cgi-bin/mb.pl?File:Wiki.png"/>
9315 !! end
9316
9317 !! test
9318 Non-English #REDIRECT
9319 !! options
9320 language=is
9321 !! wikitext
9322 #TILVÍSUN [[Main Page]]
9323 !! html/parsoid
9324 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#TILVÍSUN ","a":{"href":"./Main_Page"},"sa":{"href":"Main Page"}}'/>
9325 !! end
9326
9327 !! test
9328 Redirect syntax under text isn't considered a redirect
9329 !! wikitext
9330 some text
9331 #redirect [[Main Page]]
9332 !! html/parsoid
9333 <p>some text</p>
9334 <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>
9335 !! end
9336
9337 !! test
9338 New redirect
9339 !! options
9340 parsoid=html2wt
9341 !! html/parsoid
9342 <p>Foo<link rel="mw:PageProp/redirect" href="./Foo"/></p>
9343 !! wikitext
9344 #REDIRECT [[Foo]]
9345 Foo
9346 !! end
9347
9348 !! test
9349 Redirect followed by block on the same line
9350 !! options
9351 parsoid=wt2html
9352 !! wikitext
9353 #REDIRECT [[Main Page]]<!-- haha -->== hi ==
9354 !! html/parsoid
9355 <link rel="mw:PageProp/redirect" href="./Main_Page"/><!-- haha --><h2 id="hi"> hi </h2>
9356 !! end
9357
9358 !! test
9359 Redirect followed by a newline
9360 !! wikitext
9361 #REDIRECT [[Main Page]]
9362 A newline
9363 !! html/parsoid
9364 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
9365 <p>A newline</p>
9366 !! end
9367
9368 !! test
9369 Redirect followed by multiple newlines
9370 !! wikitext
9371 #REDIRECT [[Main Page]]
9372
9373
9374 A newline
9375 !! html/parsoid
9376 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
9377
9378 <p><br/>
9379 A newline</p>
9380 !! end
9381
9382 !! test
9383 Drop duplicate redirects
9384 !! options
9385 parsoid=html2wt
9386 !! html/parsoid
9387 <link rel="mw:PageProp/redirect" href="./Foo"/>
9388 <link rel="mw:PageProp/redirect" href="./Bar"/>
9389 <link rel="mw:PageProp/redirect" href="./Baz"/>
9390 !! wikitext
9391 #REDIRECT [[Foo]]
9392 !! end
9393
9394 ##
9395 ## XHTML tidiness
9396 ###
9397
9398 !! test
9399 <br> to <br />
9400 !! wikitext
9401 1<br>2<br />3
9402 !! html
9403 <p>1<br />2<br />3
9404 </p>
9405 !! end
9406
9407 !! test
9408 Broken br tag sanitization
9409 !! wikitext
9410 </br>
9411 !! html/php
9412 <p>&lt;/br&gt;
9413 </p>
9414 !! end
9415
9416 # TODO: Fix html2html mode (T53055)!
9417 !! test
9418 Parsoid: Broken br tag recognition
9419 !! options
9420 parsoid=wt2html
9421 !! wikitext
9422 </br>
9423
9424 <br/ >
9425 !! html+tidy
9426 <p><br /></p>
9427 <p><br /></p>
9428 !! end
9429
9430 !! test
9431 Incorrecly removing closing slashes from correctly formed XHTML
9432 !! wikitext
9433 <br style="clear:both;" />
9434 !! html
9435 <p><br style="clear:both;" />
9436 </p>
9437 !! end
9438
9439 !! test
9440 Failing to transform badly formed HTML into correct XHTML
9441 !! wikitext
9442 <br style="clear: left;">
9443 <br style="clear: right;">
9444 <br style="clear: both;">
9445 !! html
9446 <p><br style="clear: left;" />
9447 <br style="clear: right;" />
9448 <br style="clear: both;" />
9449 </p>
9450 !!end
9451
9452 ## FIXME: Is Parsoid's acceptance of self-closing html-tags
9453 ## a feature or a bug? See https://phabricator.wikimedia.org/T76962
9454 !! test
9455 Handling html with a div self-closing tag
9456 !! wikitext
9457 <div title />
9458 <div title/>
9459 <div title/ >
9460 <div title=bar />
9461 <div title=bar/>
9462 <div title=bar/ >
9463 !! html/php
9464 <p>&lt;div title /&gt;
9465 &lt;div title/&gt;
9466 </p>
9467 <div>
9468 <p>&lt;div title=bar /&gt;
9469 &lt;div title=bar/&gt;
9470 </p>
9471 <div title="bar/"></div>
9472 </div>
9473
9474 !! html/parsoid
9475 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
9476 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
9477 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
9478 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
9479 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
9480 <div title="bar/" data-parsoid='{"stx":"html","autoInsertedEnd":true}'></div>
9481 !! end
9482
9483 !! test
9484 Handling html with a br self-closing tag
9485 !! wikitext
9486 <br title />
9487 <br title/>
9488 <br title/ >
9489 <br title=bar />
9490 <br title=bar/>
9491 <br title=bar/ >
9492 !! html/php
9493 <p><br title="" />
9494 <br title="" />
9495 <br />
9496 <br title="bar" />
9497 <br title="bar" />
9498 <br title="bar/" />
9499 </p>
9500 !! html/parsoid
9501 <p><br title="" />
9502 <br title="" />
9503 <br title="" />
9504 <br title="bar" />
9505 <br title="bar" />
9506 <br title="bar/" />
9507 </p>
9508 !! end
9509
9510 !! test
9511 Horizontal ruler (should it add that extra space?)
9512 !! wikitext
9513 <hr>
9514 <hr >
9515 foo <hr
9516 > bar
9517 !! html+tidy
9518 <hr />
9519 <hr />
9520 <p>foo</p>
9521 <hr />
9522 <p>bar</p>
9523 !! end
9524
9525 !! test
9526 Horizontal ruler -- 4+ dashes render hr
9527 !! wikitext
9528 ----
9529 !! html
9530 <hr />
9531
9532 !! end
9533
9534 !! test
9535 Horizontal ruler -- eats additional dashes on the same line
9536 !! wikitext
9537 ---------
9538 !! html
9539 <hr />
9540
9541 !! end
9542
9543 !! test
9544 Horizontal ruler -- does not collapse dashes on consecutive lines
9545 !! wikitext
9546 ----
9547 ----
9548 !! html
9549 <hr />
9550 <hr />
9551
9552 !! end
9553
9554 !! test
9555 Horizontal ruler -- <4 dashes render as plain text
9556 !! wikitext
9557 ---
9558 !! html
9559 <p>---
9560 </p>
9561 !! end
9562
9563 !! test
9564 Horizontal ruler -- Supports content following dashes on same line
9565 !! wikitext
9566 ---- Foo
9567 !! html
9568 <hr /> Foo
9569
9570 !! html+tidy
9571 <hr />
9572 <p>Foo</p>
9573 !! end
9574
9575 ###
9576 ### Block-level elements
9577 ###
9578 !! test
9579 Common list
9580 !! wikitext
9581 *Common list
9582 * item 2
9583 *item 3
9584 !! html
9585 <ul><li>Common list</li>
9586 <li> item 2</li>
9587 <li>item 3</li></ul>
9588
9589 !! end
9590
9591 !! test
9592 Numbered list
9593 !! wikitext
9594 #Numbered list
9595 #item 2
9596 # item 3
9597 !! html
9598 <ol><li>Numbered list</li>
9599 <li>item 2</li>
9600 <li> item 3</li></ol>
9601
9602 !! end
9603
9604 !! test
9605 Mixed list
9606 !! wikitext
9607 *Mixed list
9608 *# with numbers
9609 ** and bullets
9610 *# and numbers
9611 *bullets again
9612 **bullet level 2
9613 ***bullet level 3
9614 ***#Number on level 4
9615 **bullet level 2
9616 **#Number on level 3
9617 **#Number on level 3
9618 *#number level 2
9619 *Level 1
9620 *** Level 3
9621 #** Level 3, but ordered
9622 !! html
9623 <ul><li>Mixed list
9624 <ol><li> with numbers</li></ol>
9625 <ul><li> and bullets</li></ul>
9626 <ol><li> and numbers</li></ol></li>
9627 <li>bullets again
9628 <ul><li>bullet level 2
9629 <ul><li>bullet level 3
9630 <ol><li>Number on level 4</li></ol></li></ul></li>
9631 <li>bullet level 2
9632 <ol><li>Number on level 3</li>
9633 <li>Number on level 3</li></ol></li></ul>
9634 <ol><li>number level 2</li></ol></li>
9635 <li>Level 1
9636 <ul><li><ul><li> Level 3</li></ul></li></ul></li></ul>
9637 <ol><li><ul><li><ul><li> Level 3, but ordered</li></ul></li></ul></li></ol>
9638
9639 !! end
9640
9641 !! test
9642 1. Nested mixed wikitext and html list
9643 !! wikitext
9644 * hi
9645 * <ul><li>ho</li></ul>
9646 * hi
9647 ** ho
9648 !! html/php
9649 <ul><li> hi</li>
9650 <li> <ul><li>ho</li></ul></li>
9651 <li> hi
9652 <ul><li> ho</li></ul></li></ul>
9653
9654 !! html/parsoid
9655 <ul><li> hi</li>
9656 <li> <ul data-parsoid='{"stx":"html"}'><li data-parsoid='{"stx":"html"}'>ho</li></ul></li>
9657 <li> hi
9658 <ul><li> ho</li></ul></li></ul>
9659 !! end
9660
9661 !! test
9662 2. Nested mixed wikitext and html list (incompatible)
9663 !! wikitext
9664 ; hi
9665 : {{echo|<li>ho</li>}}
9666 !! html/php
9667 <dl><dt> hi</dt>
9668 <dd> <li>ho</li></dd></dl>
9669
9670 !! html/parsoid
9671 <dl><dt> hi</dt>
9672 <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>
9673 !! end
9674
9675 !! test
9676 Nested lists 1
9677 !! wikitext
9678 *foo
9679 **bar
9680 !! html
9681 <ul><li>foo
9682 <ul><li>bar</li></ul></li></ul>
9683
9684 !! end
9685
9686 !! test
9687 Nested lists 2
9688 !! wikitext
9689 **foo
9690 *bar
9691 !! html
9692 <ul><li><ul><li>foo</li></ul></li>
9693 <li>bar</li></ul>
9694
9695 !! end
9696
9697 !! test
9698 Nested lists 3 (first element empty)
9699 !! wikitext
9700 *
9701 **bar
9702 !! html
9703 <ul><li>
9704 <ul><li>bar</li></ul></li></ul>
9705
9706 !! end
9707
9708 !! test
9709 Nested lists 4 (first element empty)
9710 !! wikitext
9711 **
9712 *bar
9713 !! html
9714 <ul><li><ul><li></li></ul></li>
9715 <li>bar</li></ul>
9716
9717 !! end
9718
9719 !! test
9720 Nested lists 5 (both elements empty)
9721 !! wikitext
9722 **
9723 *
9724 !! html
9725 <ul><li><ul><li></li></ul></li>
9726 <li></li></ul>
9727
9728 !! end
9729
9730 !! test
9731 Nested lists 6 (both elements empty)
9732 !! wikitext
9733 *
9734 **
9735 !! html
9736 <ul><li>
9737 <ul><li></li></ul></li></ul>
9738
9739 !! end
9740
9741 !! test
9742 Nested lists 7 (skip initial nesting levels)
9743 !! wikitext
9744 *** foo
9745 !! html
9746 <ul><li><ul><li><ul><li> foo</li></ul></li></ul></li></ul>
9747
9748 !! end
9749
9750 !! test
9751 Nested lists 8 (multiple nesting transitions)
9752 !! wikitext
9753 * foo
9754 *** bar
9755 ** baz
9756 * boo
9757 !! html
9758 <ul><li> foo
9759 <ul><li><ul><li> bar</li></ul></li>
9760 <li> baz</li></ul></li>
9761 <li> boo</li></ul>
9762
9763 !! end
9764
9765 !! test
9766 Nested lists 9 (extension interaction)
9767 !! options
9768 parsoid
9769 !! wikitext
9770 *<references />
9771 !! html/parsoid
9772 <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>
9773 !! end
9774
9775 !! test
9776 1. Lists with start-of-line-transparent tokens before bullets: Comments
9777 !! wikitext
9778 *foo
9779 *<!--cmt-->bar
9780 <!--cmt-->*baz
9781 !! html
9782 <ul><li>foo</li>
9783 <li>bar</li>
9784 <li>baz</li></ul>
9785
9786 !! end
9787
9788 !! test
9789 2. Lists with start-of-line-transparent tokens before bullets: Template close
9790 !! wikitext
9791 *foo {{echo|bar
9792 }}*baz
9793 !! html
9794 <ul><li>foo bar</li>
9795 <li>baz</li></ul>
9796
9797 !! end
9798
9799 !! test
9800 List items are not parsed correctly following a <pre> block (T2785)
9801 !! wikitext
9802 * <pre>foo</pre>
9803 * <pre>bar</pre>
9804 * zar
9805 !! html/php
9806 <ul><li> <pre>foo</pre></li>
9807 <li> <pre>bar</pre></li>
9808 <li> zar</li></ul>
9809
9810 !! html/parsoid
9811 <ul><li> <pre typeof="mw:Extension/pre" about="#mwt2" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"foo"}}'>foo</pre></li>
9812 <li> <pre typeof="mw:Extension/pre" about="#mwt4" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"bar"}}'>bar</pre></li>
9813 <li> zar</li></ul>
9814 !! end
9815
9816 !! test
9817 List items from template
9818 !! wikitext
9819
9820 {{inner list}}
9821 * item 2
9822
9823 * item 0
9824 {{inner list}}
9825 * item 2
9826
9827 * item 0
9828 * notSOL{{inner list}}
9829 * item 2
9830 !! html
9831 <ul><li> item 1</li>
9832 <li> item 2</li></ul>
9833 <ul><li> item 0</li>
9834 <li> item 1</li>
9835 <li> item 2</li></ul>
9836 <ul><li> item 0</li>
9837 <li> notSOL</li>
9838 <li> item 1</li>
9839 <li> item 2</li></ul>
9840
9841 !! end
9842
9843 !! test
9844 List interrupted by empty line or heading
9845 !! wikitext
9846 * foo
9847
9848 ** bar
9849 == A heading ==
9850 * Another list item
9851 !! html
9852 <ul><li> foo</li></ul>
9853 <ul><li><ul><li> bar</li></ul></li></ul>
9854 <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>
9855 <ul><li> Another list item</li></ul>
9856
9857 !!end
9858
9859 !!test
9860 Multiple list tags generated by templates
9861 !! wikitext
9862 {{echo|<li>}}a
9863 {{echo|<li>}}b
9864 {{echo|<li>}}c
9865 !! html
9866 <li>a
9867 <li>b
9868 <li>c</li>
9869 </li>
9870 </li>
9871
9872 !! html+tidy
9873 <ul>
9874 <li>a</li>
9875 <li>b</li>
9876 <li>c</li>
9877 </ul>
9878 !!end
9879
9880 !!test
9881 Single-comment whitespace lines dont break lists, and neither do multi-comment whitespace lines
9882 !! wikitext
9883 *a
9884 <!--This line will NOT split the list-->
9885 *b
9886 <!--This line will NOT split the list either-->
9887 *c
9888 <!--foo--> <!----> <!--This line NOT split the list either-->
9889 *d
9890 !! html
9891 <ul><li>a</li>
9892 <li>b</li>
9893 <li>c</li>
9894 <li>d</li></ul>
9895
9896 !!end
9897
9898 !!test
9899 Replacing whitespace with tabs still doesn't break the list (gerrit 78327)
9900 !! wikitext
9901 *a
9902 <!--This line will NOT split the list-->
9903 *b
9904 <!--This line will NOT split the list either-->
9905 *c
9906 <!--foo--> <!----> <!--This line NOT split the list
9907 either-->
9908 *d
9909 !! html
9910 <ul><li>a</li>
9911 <li>b</li>
9912 <li>c</li>
9913 <li>d</li></ul>
9914
9915 !!end
9916
9917 !!test
9918 Test the li-hack
9919 (The PHP parser relies on Tidy for the hack)
9920 !!options
9921 parsoid=wt2html,wt2wt
9922 !! wikitext
9923 * foo
9924 * <li>li-hack
9925 * {{echo|<li>templated li-hack}}
9926 * <!--foo--> <li> unsupported li-hack with preceding comments
9927
9928 <ul>
9929 <li><li>not a li-hack
9930 </li>
9931 </ul>
9932 !! html+tidy
9933 <ul>
9934 <li>foo</li>
9935 <li>li-hack</li>
9936 <li>templated li-hack</li>
9937 <li>unsupported li-hack with preceding comments</li>
9938 </ul>
9939 <ul>
9940 <li>not a li-hack</li>
9941 </ul>
9942 !! html/parsoid
9943 <ul><li> foo</li>
9944 <li data-parsoid='{"stx":"html","autoInsertedEnd":true,"liHackSrc":"* "}'>li-hack</li>
9945 <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>
9946 <li data-parsoid='{"autoInsertedEnd":true}'> <!--foo--> </li><li data-parsoid='{"stx":"html","autoInsertedEnd":true}'> unsupported li-hack with preceding comments</li></ul>
9947
9948 <ul data-parsoid='{"stx":"html"}'>
9949 <li class="mw-empty-elt" data-parsoid='{"stx":"html","autoInsertedEnd":true}'></li><li data-parsoid='{"stx":"html"}'>not a li-hack
9950 </li>
9951 </ul>
9952
9953 !!end
9954
9955 !! test
9956 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
9957 !! options
9958 parsoid
9959 !! wikitext
9960 # foo
9961 ## bar
9962 * foo
9963 ** bar
9964 : foo
9965 :: bar
9966 !! html
9967 <ol>
9968 <li> foo<ol>
9969 <li> bar</li>
9970 </ol></li>
9971 </ol><ul>
9972 <li> foo<ul>
9973 <li> bar</li>
9974 </ul></li>
9975 </ul><dl>
9976 <dd> foo<dl>
9977 <dd> bar</dd>
9978 </dl></dd>
9979 </dl>
9980 !! end
9981
9982 !! test
9983 Parsoid: Test of whitespace serialization with Templated bullets
9984 !! options
9985 parsoid
9986 !! wikitext
9987 * {{bullet}}
9988 !! html/parsoid
9989 <ul>
9990 <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>
9991 </ul>
9992 !! end
9993
9994 # ------------------------------------------------------------------------
9995 # The next set of tests are about Parsoid's ability to handle badly nested
9996 # tags (parse, minimize scope of fixup, and roundtrip back)
9997 # ------------------------------------------------------------------------
9998
9999 !! test
10000 Unbalanced closing block tags break a list
10001 (php parser relies on Tidy to fix up)
10002 !! wikitext
10003 <div>
10004 *a</div><div>
10005 *b</div>
10006 !! html+tidy
10007 <div>
10008 <ul>
10009 <li>a</li>
10010 </ul>
10011 </div>
10012 <div>
10013 <ul>
10014 <li>b</li>
10015 </ul>
10016 </div>
10017 !! end
10018
10019 # Parsoid fails this test, but it might be tricky to support properly.
10020 # See T70395.
10021 !! test
10022 Unbalanced closing non-block tags don't break a list
10023 (php parser relies on Tidy to fix up)
10024 !! wikitext
10025 <span>
10026 *a</span><span>
10027 *b</span>
10028 !! html/php+tidy
10029 <ul>
10030 <li><span>a</span></li>
10031 <li><span>b</span></li>
10032 </ul>
10033 !! html/parsoid
10034 <span>
10035 <ul>
10036 <li>a<span></span>
10037 </li>
10038 <li>b
10039 </li>
10040 </ul>
10041 </span>
10042 !! end
10043
10044 !! test
10045 Unclosed formatting tags that straddle lists are closed and reopened
10046 (php parser relies on Tidy to fix up)
10047 !! options
10048 parsoid=wt2html,wt2wt,html2html
10049 !! wikitext
10050 # <s> a
10051 # b </s>
10052 !! html/php+tidy
10053 <ol>
10054 <li><s>a</s></li>
10055 <li><s>b</s></li>
10056 </ol>
10057 !! html/parsoid
10058 <ol><li> <s> a</s></li>
10059 <li><s> b </s></li></ol>
10060 !! end
10061
10062 # See T70395.
10063 !!test
10064 1. List embedded in a formatting tag
10065 !! wikitext
10066 <small>
10067 * foo
10068 </small>
10069 !! html/php+tidy
10070 <ul>
10071 <li><small>foo</small></li>
10072 </ul>
10073 !! html/parsoid
10074 <small>
10075 <ul>
10076 <li> foo</li>
10077 </ul>
10078 </small>
10079 !!end
10080
10081 ## Ugly Parsoid output here
10082 ## Not sure what the right output is.
10083 !!test
10084 2. List embedded in a formatting tag
10085 !! wikitext
10086 <small>
10087 *a
10088 *b</small>
10089 !! html/php+tidy
10090 <ul>
10091 <li><small>a</small></li>
10092 <li><small>b</small></li>
10093 </ul>
10094 !! html/parsoid
10095 <small></small>
10096 <ul><small>
10097 <li>a</li>
10098 </small>
10099 <li><small>b</small></li>
10100 </ul>
10101 !!end
10102
10103 # Ugly Parsoid and PHP parser output here
10104 # Not sure if we want to make this a test!
10105 #
10106 ## !!test
10107 ## 3. Unclosed formatting tags in list elements
10108 ## !! wikitext
10109 ## *<small>a
10110 ## *<small>b
10111 ## !! html/php+tidy
10112 ## <ul>
10113 ## <li><small>a</small></li>
10114 ## <li><small><small>b</small></small></li>
10115 ## </ul>
10116 ## !! html/parsoid
10117 ## <ul>
10118 ## <li><small>a</small></li>
10119 ## <small>
10120 ## <li><small>b</small></li>
10121 ## </small></ul>
10122 ## !!end
10123
10124 # This is a bug in the PHP parser + tidy combination.
10125 # (The </tr> tag gets parsed as text and html-escaped by PHP,
10126 # and then fostered out of the table by tidy.)
10127 # We believe the Parsoid output to be correct.
10128 !! test
10129 Table with missing opening <tr> tag
10130 !! options
10131 parsoid=wt2html,wt2wt
10132 !! wikitext
10133 <table>
10134 <td>foo</td>
10135 </tr>
10136 </table>
10137 !! html+tidy
10138 <table>
10139 <tr>
10140 <td>foo</td>
10141 </tr>
10142 </table>
10143 !! end
10144
10145 ###
10146 ### Magic Words
10147 ###
10148
10149 # Note that the current date is hard-coded as
10150 # 1970-01-01T00:02:03Z (a Thursday)
10151 # when running parser tests. The timezone is also fixed to GMT, so
10152 # local date will be identical to current date.
10153
10154 !! test
10155 Magic Word: {{CURRENTDAY}}
10156 !! wikitext
10157 {{CURRENTDAY}}
10158 !! html
10159 <p>1
10160 </p>
10161 !! end
10162
10163 !! test
10164 Magic Word: {{CURRENTDAY2}}
10165 !! wikitext
10166 {{CURRENTDAY2}}
10167 !! html
10168 <p>01
10169 </p>
10170 !! end
10171
10172 !! test
10173 Magic Word: {{CURRENTDAYNAME}}
10174 !! wikitext
10175 {{CURRENTDAYNAME}}
10176 !! html
10177 <p>Thursday
10178 </p>
10179 !! end
10180
10181 !! test
10182 Magic Word: {{CURRENTDOW}}
10183 !! wikitext
10184 {{CURRENTDOW}}
10185 !! html
10186 <p>4
10187 </p>
10188 !! end
10189
10190 !! test
10191 Magic Word: {{CURRENTMONTH}}
10192 !! wikitext
10193 {{CURRENTMONTH}}
10194 !! html
10195 <p>01
10196 </p>
10197 !! end
10198
10199 !! test
10200 Magic Word: {{CURRENTMONTH1}}
10201 !! wikitext
10202 {{CURRENTMONTH1}}
10203 !! html
10204 <p>1
10205 </p>
10206 !! end
10207
10208 !! test
10209 Magic Word: {{CURRENTMONTHABBREV}}
10210 !! wikitext
10211 {{CURRENTMONTHABBREV}}
10212 !! html
10213 <p>Jan
10214 </p>
10215 !! end
10216
10217 !! test
10218 Magic Word: {{CURRENTMONTHNAME}}
10219 !! wikitext
10220 {{CURRENTMONTHNAME}}
10221 !! html
10222 <p>January
10223 </p>
10224 !! end
10225
10226 !! test
10227 Magic Word: {{CURRENTMONTHNAMEGEN}}
10228 !! wikitext
10229 {{CURRENTMONTHNAMEGEN}}
10230 !! html
10231 <p>January
10232 </p>
10233 !! end
10234
10235 !! test
10236 Magic Word: {{CURRENTTIME}}
10237 !! wikitext
10238 {{CURRENTTIME}}
10239 !! html
10240 <p>00:02
10241 </p>
10242 !! end
10243
10244 !! test
10245 Magic Word: {{CURRENTHOUR}}
10246 !! wikitext
10247 {{CURRENTHOUR}}
10248 !! html
10249 <p>00
10250 </p>
10251 !! end
10252
10253 !! test
10254 Magic Word: {{CURRENTWEEK}} (T6594)
10255 !! wikitext
10256 {{CURRENTWEEK}}
10257 !! html
10258 <p>1
10259 </p>
10260 !! end
10261
10262 !! test
10263 Magic Word: {{CURRENTYEAR}}
10264 !! wikitext
10265 {{CURRENTYEAR}}
10266 !! html
10267 <p>1970
10268 </p>
10269 !! end
10270
10271 !! test
10272 Magic Word: {{CURRENTTIMESTAMP}}
10273 !! wikitext
10274 {{CURRENTTIMESTAMP}}
10275 !! html
10276 <p>19700101000203
10277 </p>
10278 !! end
10279
10280 !! test
10281 Magic Words LOCAL (UTC)
10282 !! wikitext
10283 * {{LOCALMONTH}}
10284 * {{LOCALMONTH1}}
10285 * {{LOCALMONTHNAME}}
10286 * {{LOCALMONTHNAMEGEN}}
10287 * {{LOCALMONTHABBREV}}
10288 * {{LOCALDAY}}
10289 * {{LOCALDAY2}}
10290 * {{LOCALDAYNAME}}
10291 * {{LOCALYEAR}}
10292 * {{LOCALTIME}}
10293 * {{LOCALHOUR}}
10294 * {{LOCALWEEK}}
10295 * {{LOCALDOW}}
10296 * {{LOCALTIMESTAMP}}
10297 !! html
10298 <ul><li> 01</li>
10299 <li> 1</li>
10300 <li> January</li>
10301 <li> January</li>
10302 <li> Jan</li>
10303 <li> 1</li>
10304 <li> 01</li>
10305 <li> Thursday</li>
10306 <li> 1970</li>
10307 <li> 00:02</li>
10308 <li> 00</li>
10309 <li> 1</li>
10310 <li> 4</li>
10311 <li> 19700101000203</li></ul>
10312
10313 !! end
10314
10315 !! test
10316 Magic Word: {{FULLPAGENAME}}
10317 !! options
10318 title=[[User:Ævar Arnfjörð Bjarmason]]
10319 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10320 !! wikitext
10321 {{FULLPAGENAME}}
10322 !! html/*
10323 <p>User:Ævar Arnfjörð Bjarmason
10324 </p>
10325 !! end
10326
10327 !! test
10328 Magic Word: {{FULLPAGENAMEE}}
10329 !! options
10330 title=[[User:Ævar Arnfjörð Bjarmason]]
10331 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10332 !! wikitext
10333 {{FULLPAGENAMEE}}
10334 !! html/*
10335 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10336 </p>
10337 !! end
10338
10339 !! test
10340 Magic Word: {{TALKSPACE}}
10341 !! options
10342 title=[[User:Ævar Arnfjörð Bjarmason]]
10343 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10344 !! wikitext
10345 {{TALKSPACE}}
10346 !! html/*
10347 <p>User talk
10348 </p>
10349 !! end
10350
10351 !! test
10352 Magic Word: {{TALKSPACE}}, same namespace
10353 !! options
10354 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10355 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10356 !! wikitext
10357 {{TALKSPACE}}
10358 !! html/*
10359 <p>User talk
10360 </p>
10361 !! end
10362
10363 !! test
10364 Magic Word: {{TALKSPACE}}, main namespace
10365 !! options
10366 title=[[Parser Test]]
10367 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10368 !! wikitext
10369 {{TALKSPACE}}
10370 !! html/*
10371 <p>Talk
10372 </p>
10373 !! end
10374
10375 !! test
10376 Magic Word: {{TALKSPACEE}}
10377 !! options
10378 title=[[User:Ævar Arnfjörð Bjarmason]]
10379 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10380 !! wikitext
10381 {{TALKSPACEE}}
10382 !! html/*
10383 <p>User_talk
10384 </p>
10385 !! end
10386
10387 !! test
10388 Magic Word: {{SUBJECTSPACE}}
10389 !! options
10390 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10391 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10392 !! wikitext
10393 {{SUBJECTSPACE}}
10394 !! html/*
10395 <p>User
10396 </p>
10397 !! end
10398
10399 !! test
10400 Magic Word: {{SUBJECTSPACE}}, same namespace
10401 !! options
10402 title=[[User:Ævar Arnfjörð Bjarmason]]
10403 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10404 !! wikitext
10405 {{SUBJECTSPACE}}
10406 !! html/*
10407 <p>User
10408 </p>
10409 !! end
10410
10411 !! test
10412 Magic Word: {{SUBJECTSPACE}}, main namespace
10413 !! options
10414 title=[[Parser Test]]
10415 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10416 !! wikitext
10417 {{SUBJECTSPACE}}
10418 !! html/*
10419
10420 !! end
10421
10422 !! test
10423 Magic Word: {{SUBJECTSPACEE}}
10424 !! options
10425 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10426 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10427 !! wikitext
10428 {{SUBJECTSPACEE}}
10429 !! html/*
10430 <p>User
10431 </p>
10432 !! end
10433
10434 !! test
10435 Magic Word: {{NAMESPACE}}
10436 !! options
10437 title=[[User:Ævar Arnfjörð Bjarmason]]
10438 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10439 !! wikitext
10440 {{NAMESPACE}}
10441 !! html/*
10442 <p>User
10443 </p>
10444 !! end
10445
10446 !! test
10447 Magic Word: {{NAMESPACEE}}
10448 !! options
10449 title=[[User:Ævar Arnfjörð Bjarmason]]
10450 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10451 !! wikitext
10452 {{NAMESPACEE}}
10453 !! html/*
10454 <p>User
10455 </p>
10456 !! end
10457
10458 !! test
10459 Magic Word: {{NAMESPACENUMBER}}
10460 !! options
10461 title=[[User:Ævar Arnfjörð Bjarmason]]
10462 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10463 !! wikitext
10464 {{NAMESPACENUMBER}}
10465 !! html/*
10466 <p>2
10467 </p>
10468 !! end
10469
10470 !! test
10471 Magic Word: {{SUBPAGENAME}}
10472 !! options
10473 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
10474 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10475 !! wikitext
10476 {{SUBPAGENAME}}
10477 !! html/*
10478 <p>sub ö
10479 </p>
10480 !! end
10481
10482 !! test
10483 Magic Word: {{SUBPAGENAMEE}}
10484 !! options
10485 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
10486 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10487 !! wikitext
10488 {{SUBPAGENAMEE}}
10489 !! html/*
10490 <p>sub_%C3%B6
10491 </p>
10492 !! end
10493
10494 !! test
10495 Magic Word: {{ROOTPAGENAME}}
10496 !! options
10497 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
10498 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10499 !! wikitext
10500 {{ROOTPAGENAME}}
10501 !! html/*
10502 <p>Ævar Arnfjörð Bjarmason
10503 </p>
10504 !! end
10505
10506 !! test
10507 Magic Word: {{ROOTPAGENAMEE}}
10508 !! options
10509 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
10510 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10511 !! wikitext
10512 {{ROOTPAGENAMEE}}
10513 !! html/*
10514 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10515 </p>
10516 !! end
10517
10518 !! test
10519 Magic Word: {{BASEPAGENAME}}
10520 !! options
10521 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
10522 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10523 !! wikitext
10524 {{BASEPAGENAME}}
10525 !! html/*
10526 <p>Ævar Arnfjörð Bjarmason
10527 </p>
10528 !! end
10529
10530 !! test
10531 Magic Word: {{BASEPAGENAMEE}}
10532 !! options
10533 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
10534 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10535 !! wikitext
10536 {{BASEPAGENAMEE}}
10537 !! html/*
10538 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10539 </p>
10540 !! end
10541
10542 !! test
10543 Magic Word: {{TALKPAGENAME}}
10544 !! options
10545 title=[[User:Ævar Arnfjörð Bjarmason]]
10546 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10547 !! wikitext
10548 {{TALKPAGENAME}}
10549 !! html/*
10550 <p>User talk:Ævar Arnfjörð Bjarmason
10551 </p>
10552 !! end
10553
10554 !! test
10555 Magic Word: {{TALKPAGENAMEE}}
10556 !! options
10557 title=[[User:Ævar Arnfjörð Bjarmason]]
10558 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10559 !! wikitext
10560 {{TALKPAGENAMEE}}
10561 !! html/*
10562 <p>User_talk:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10563 </p>
10564 !! end
10565
10566 !! test
10567 Magic Word: {{SUBJECTPAGENAME}}
10568 !! options
10569 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10570 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10571 !! wikitext
10572 {{SUBJECTPAGENAME}}
10573 !! html/*
10574 <p>User:Ævar Arnfjörð Bjarmason
10575 </p>
10576 !! end
10577
10578 !! test
10579 Magic Word: {{SUBJECTPAGENAMEE}}
10580 !! options
10581 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10582 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10583 !! wikitext
10584 {{SUBJECTPAGENAMEE}}
10585 !! html/*
10586 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10587 </p>
10588 !! end
10589
10590 !! test
10591 Magic Word: {{NUMBEROFFILES}}
10592 !! options
10593 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10594 !! wikitext
10595 {{NUMBEROFFILES}}
10596 !! html/*
10597 <p>7
10598 </p>
10599 !! end
10600
10601 !! test
10602 Magic Word: {{PAGENAME}}
10603 !! options
10604 title=[[User:Ævar Arnfjörð Bjarmason]]
10605 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10606 !! wikitext
10607 {{PAGENAME}}
10608 !! html/*
10609 <p>Ævar Arnfjörð Bjarmason
10610 </p>
10611 !! end
10612
10613 !! test
10614 Magic Word: {{PAGENAME}} with metacharacters
10615 !! options
10616 title=[['foo & bar = baz']]
10617 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10618 !! wikitext
10619 ''{{PAGENAME}}''
10620 !! html/php
10621 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
10622 </p>
10623 !! html+tidy
10624 <p><i>'foo &amp; bar = baz'</i></p>
10625 !! end
10626
10627 !! test
10628 Magic Word: {{PAGENAME}} with metacharacters (T28781)
10629 !! options
10630 title=[[*RFC 1234 http://example.com/]]
10631 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10632 !! wikitext
10633 {{PAGENAME}}
10634 !! html/php
10635 <p>&#42;RFC&#32;1234 http&#58;//example.com/
10636 </p>
10637 !! html+tidy
10638 <p>*RFC 1234 http://example.com/</p>
10639 !! end
10640
10641 !! test
10642 Magic Word: {{PAGENAMEE}}
10643 !! options
10644 title=[[User:Ævar Arnfjörð Bjarmason]]
10645 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10646 !! wikitext
10647 {{PAGENAMEE}}
10648 !! html/*
10649 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10650 </p>
10651 !! end
10652
10653 !! test
10654 Magic Word: {{PAGENAMEE}} with metacharacters (T28781)
10655 !! options
10656 title=[[*RFC 1234 http://example.com/]]
10657 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10658 !! wikitext
10659 {{PAGENAMEE}}
10660 !! html/php
10661 <p>&#42;RFC_1234_http&#58;//example.com/
10662 </p>
10663 !! html+tidy
10664 <p>*RFC_1234_http://example.com/</p>
10665 !! end
10666
10667 !! test
10668 Magic Word: {{REVISIONID}}
10669 !! options
10670 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10671 showflags
10672 !! wikitext
10673 {{REVISIONID}}
10674 !! html/*
10675 <p>1337
10676 </p>
10677 flags=vary-revision-id
10678 !! end
10679
10680 !! test
10681 Magic Word: {{SCRIPTPATH}}
10682 !! options
10683 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10684 !! wikitext
10685 {{SCRIPTPATH}}
10686 !! html/*
10687
10688 !! end
10689
10690 !! test
10691 Magic Word: {{STYLEPATH}}
10692 !! options
10693 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10694 !! wikitext
10695 {{STYLEPATH}}
10696 !! html/*
10697 <p>/skins
10698 </p>
10699 !! end
10700
10701 !! test
10702 Magic Word: {{SERVER}}
10703 !! options
10704 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10705 !! wikitext
10706 {{SERVER}}
10707 !! html/*
10708 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
10709 </p>
10710 !! end
10711
10712 !! test
10713 Magic Word: {{SERVERNAME}}
10714 !! options
10715 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10716 !! wikitext
10717 {{SERVERNAME}}
10718 !! html/*
10719 <p>example.org
10720 </p>
10721 !! end
10722
10723 !! test
10724 Magic Word: {{SITENAME}}
10725 !! options
10726 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10727 !! wikitext
10728 {{SITENAME}}
10729 !! html/*
10730 <p>MediaWiki
10731 </p>
10732 !! end
10733
10734 !! test
10735 Magic Word: {{PAGELANGUAGE}}
10736 !! options
10737 language=fr
10738 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10739 !! wikitext
10740 {{PAGELANGUAGE}}
10741 !! html/*
10742 <p>fr
10743 </p>
10744 !! end
10745
10746 !! test
10747 Magic Word: {{PAGELANGUAGE}} on a page with no explicitly set language
10748 !! options
10749 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10750 !! wikitext
10751 {{PAGELANGUAGE}}
10752 !! html/*
10753 <p>en
10754 </p>
10755 !! end
10756
10757 !! test
10758 Case-sensitive magic words, when cased differently, should just be template transclusions
10759 !! wikitext
10760 {{CurrentMonth}}
10761 {{currentday}}
10762 {{cURreNTweEK}}
10763 {{currentHour}}
10764 !! html
10765 <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>
10766 <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>
10767 <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>
10768 <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>
10769 </p>
10770 !! end
10771
10772 !! test
10773 Case-insensitive magic words should still work with weird casing.
10774 !! wikitext
10775 {{sErVeRNaMe}}
10776 {{LCFirst:AOEU}}
10777 {{ucFIRST:aoeu}}
10778 {{SERver}}
10779 !! html
10780 <p>example.org
10781 aOEU
10782 Aoeu
10783 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
10784 </p>
10785 !! end
10786
10787 # From plwiki:PLOS_ONE
10788 !! test
10789 Parsoid: Page property magic word with magic word contents
10790 !! wikitext
10791 {{DISPLAYTITLE:''{{PAGENAME}}''}}
10792 !! html/parsoid
10793 <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>"}]]}'/>
10794 !! end
10795
10796 # NOTE: mw:ExpandedAttrs is not the best typeof here. mw:Transclusion is better.
10797 # But, this is a limitation of our representation and is documented in
10798 # TemplateHandler.js in processSpecialMagicWord
10799 !! test
10800 Parsoid: Template-generated DISPLAYTITLE
10801 !! wikitext
10802 {{{{echo|DISPLAYTITLE}}:Foo}}
10803 !! options
10804 showtitle
10805 !! config
10806 wgAllowDisplayTitle=true
10807 wgRestrictDisplayTitle=false
10808 !! html/php
10809 Foo
10810
10811 !! html/parsoid
10812 <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"}]]}'/>
10813 !! end
10814
10815 !! test
10816 Namespace 1 {{ns:1}}
10817 !! wikitext
10818 {{ns:1}}
10819 !! html
10820 <p>Talk
10821 </p>
10822 !! end
10823
10824 !! test
10825 Namespace 1 {{ns:01}}
10826 !! wikitext
10827 {{ns:01}}
10828 !! html
10829 <p>Talk
10830 </p>
10831 !! end
10832
10833 !! test
10834 Namespace 0 {{ns:0}} (T6783)
10835 !! wikitext
10836 {{ns:0}}
10837 !! html
10838
10839 !! end
10840
10841 !! test
10842 Namespace 0 {{ns:00}} (T6783)
10843 !! wikitext
10844 {{ns:00}}
10845 !! html
10846
10847 !! end
10848
10849 !! test
10850 Namespace -1 {{ns:-1}}
10851 !! wikitext
10852 {{ns:-1}}
10853 !! html
10854 <p>Special
10855 </p>
10856 !! end
10857
10858 !! test
10859 Namespace User {{ns:User}}
10860 !! wikitext
10861 {{ns:User}}
10862 !! html
10863 <p>User
10864 </p>
10865 !! end
10866
10867 !! test
10868 Namespace User talk {{ns:User_talk}}
10869 !! wikitext
10870 {{ns:User_talk}}
10871 !! html
10872 <p>User talk
10873 </p>
10874 !! end
10875
10876 !! test
10877 Namespace User talk {{ns:uSeR tAlK}}
10878 !! wikitext
10879 {{ns:uSeR tAlK}}
10880 !! html
10881 <p>User talk
10882 </p>
10883 !! end
10884
10885 !! test
10886 Namespace File {{ns:File}}
10887 !! wikitext
10888 {{ns:File}}
10889 !! html
10890 <p>File
10891 </p>
10892 !! end
10893
10894 !! test
10895 Namespace File {{ns:Image}}
10896 !! wikitext
10897 {{ns:Image}}
10898 !! html
10899 <p>File
10900 </p>
10901 !! end
10902
10903 !! test
10904 Namespace (lang=de) Benutzer {{ns:User}}
10905 !! options
10906 language=de
10907 !! wikitext
10908 {{ns:User}}
10909 !! html
10910 <p>Benutzer
10911 </p>
10912 !! end
10913
10914 !! test
10915 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
10916 !! options
10917 language=de
10918 !! wikitext
10919 {{ns:3}}
10920 !! html
10921 <p>Benutzer Diskussion
10922 </p>
10923 !! end
10924
10925 !! test
10926 Urlencode
10927 !! wikitext
10928 {{urlencode:hi world?!}}
10929 {{urlencode:hi world?!|WIKI}}
10930 {{urlencode:hi world?!|PATH}}
10931 {{urlencode:hi world?!|QUERY}}
10932 !! html/php
10933 <p>hi+world%3F%21
10934 hi_world%3F!
10935 hi%20world%3F%21
10936 hi+world%3F%21
10937 </p>
10938 !! end
10939
10940 !! test
10941 Magic Word: prioritize type info over data-parsoid
10942 !! options
10943 parsoid=html2wt
10944 !! html/parsoid
10945 <meta property="mw:PageProp/forcetoc" data-parsoid='{"magicSrc":"__NOTOC__"}'/>
10946 !! wikitext
10947 __FORCETOC__
10948 !! end
10949
10950 !! test
10951 Magic Word: serialize on separate line (parsoid)
10952 !! options
10953 parsoid=wt2wt,html2wt
10954 !! wikitext
10955 foo
10956 __NOTOC__
10957 bar
10958 !! html/parsoid
10959 foo<meta property="mw:PageProp/notoc"/>bar
10960 !! end
10961
10962 !! test
10963 Magic Word: rt non-english wikis
10964 !! options
10965 parsoid=wt2wt
10966 language=de
10967 !! wikitext
10968 __NOEDITSECTION__
10969 !! html/parsoid
10970 <meta property="mw:PageProp/noeditsection" data-parsoid='{"magicSrc":"__NOEDITSECTION__"}'/>
10971 !! end
10972
10973 !!test
10974 __proto__ is treated as normal wikitext (T105997)
10975 !!wikitext
10976 __proto__
10977 !!html
10978 <p>__proto__
10979 </p>
10980 !!end
10981
10982 ###
10983 ### Magic links
10984 ###
10985 !! test
10986 Magic links: internal link to RFC (T2479)
10987 !! wikitext
10988 [[RFC 123]]
10989 !! html/php
10990 <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>
10991 </p>
10992 !! html/parsoid
10993 <p><a rel="mw:WikiLink" href="./RFC_123" title="RFC 123">RFC 123</a></p>
10994 !! end
10995
10996 !! test
10997 Magic links: RFC (T2479)
10998 !! wikitext
10999 RFC 822
11000 !! html/php
11001 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc822">RFC 822</a>
11002 </p>
11003 !! html/parsoid
11004 <p><a href="https://tools.ietf.org/html/rfc822" rel="mw:ExtLink">RFC 822</a></p>
11005 !! end
11006
11007 !! test
11008 Magic links: RFC (T67278)
11009 !! wikitext
11010 This is RFC 822 but thisRFC 822 is not RFC 822linked.
11011 !! html/php
11012 <p>This is <a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc822">RFC 822</a> but thisRFC 822 is not RFC 822linked.
11013 </p>
11014 !! html/parsoid
11015 <p>This is <a href="https://tools.ietf.org/html/rfc822" rel="mw:ExtLink">RFC 822</a> but thisRFC 822 is not RFC 822linked.</p>
11016 !! end
11017
11018 !! test
11019 Magic links: RFC (w/ non-newline whitespace, T30950/T31025)
11020 !! wikitext
11021 RFC &nbsp;&#160;&#0160;&#xA0;&#Xa0; 822
11022 RFC
11023 822
11024 !! html/php
11025 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc822">RFC 822</a>
11026 RFC
11027 822
11028 </p>
11029 !! html/parsoid
11030 <p><a href="https://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>
11031 RFC
11032 822</p>
11033 !! end
11034
11035 !! test
11036 Magic links: ISBN (T3937)
11037 !! wikitext
11038 ISBN 0-306-40615-2
11039 !! html/php
11040 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
11041 </p>
11042 !! html/parsoid
11043 <p><a href="./Special:BookSources/0306406152" rel="mw:WikiLink">ISBN 0-306-40615-2</a></p>
11044 !! end
11045
11046 !! test
11047 Magic links: ISBN (T67278)
11048 !! wikitext
11049 This is ISBN 978-0-316-09811-3 but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.
11050 !! html/php
11051 <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.
11052 </p>
11053 !! html/parsoid
11054 <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>
11055 !! end
11056
11057 !! test
11058 Magic links: ISBN (w/ non-newline whitespace, T30950/T31025)
11059 !! wikitext
11060 ISBN &nbsp;&#160;&#0160;&#xA0;&#Xa0; 978&nbsp;0&#160;316&#0160;09811&#xA0;3
11061 ISBN
11062 9780316098113
11063 ISBN 978
11064 0316098113
11065 !! html/php
11066 <p><a href="/wiki/Special:BookSources/9780316098113" class="internal mw-magiclink-isbn">ISBN 978 0 316 09811 3</a>
11067 ISBN
11068 9780316098113
11069 ISBN 978
11070 0316098113
11071 </p>
11072 !! html/parsoid
11073 <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>
11074 ISBN
11075 9780316098113
11076 ISBN 978
11077 0316098113</p>
11078 !! end
11079
11080 !! test
11081 Magic links: PMID incorrectly converts space to underscore
11082 !! wikitext
11083 PMID 1234
11084 !! html/php
11085 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
11086 </p>
11087 !! html/parsoid
11088 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract" rel="mw:ExtLink">PMID 1234</a></p>
11089 !! end
11090
11091 !! test
11092 Magic links: PMID (T67278)
11093 !! wikitext
11094 This is PMID 1234 but thisPMID 1234 is not PMID 1234linked.
11095 !! html/php
11096 <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.
11097 </p>
11098 !! html/parsoid
11099 <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>
11100 !! end
11101
11102 !! test
11103 Magic links: PMID (w/ non-newline whitespace, T30950/T31025)
11104 !! wikitext
11105 PMID &nbsp;&#160;&#0160;&#xA0;&#Xa0; 1234
11106 PMID
11107 1234
11108 !! html/php
11109 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
11110 PMID
11111 1234
11112 </p>
11113 !! html/parsoid
11114 <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>
11115 PMID
11116 1234</p>
11117 !! end
11118
11119 # <nowiki> nodes shouldn't be inserted during html2wt by Parsoid,
11120 # since these are ExtLinkText, not MagicLinkText
11121 !! test
11122 Magic links: use appropriate serialization for "almost" magic links.
11123 !! wikitext
11124 X[[Special:BookSources/0978739256|foo]]
11125
11126 X[https://tools.ietf.org/html/rfc1234 foo]
11127 !! html/php
11128 <p>X<a href="/wiki/Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a>
11129 </p><p>X<a rel="nofollow" class="external text" href="https://tools.ietf.org/html/rfc1234">foo</a>
11130 </p>
11131 !! html/parsoid
11132 <p>X<a rel="mw:WikiLink" href="./Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a></p>
11133 <p>X<a rel="mw:ExtLink" href="https://tools.ietf.org/html/rfc1234">foo</a></p>
11134 !! end
11135
11136 !! test
11137 Magic links: All disabled (T47942)
11138 !! options
11139 wgEnableMagicLinks={"ISBN":false, "PMID":false, "RFC":false}
11140 !! wikitext
11141 ISBN 0-306-40615-2
11142 PMID 1234
11143 RFC 4321
11144 !! html/php
11145 <p>ISBN 0-306-40615-2
11146 PMID 1234
11147 RFC 4321
11148 </p>
11149 !! end
11150
11151 ###
11152 ### Templates
11153 ####
11154
11155 !! test
11156 Nonexistent template
11157 !! wikitext
11158 {{thistemplatedoesnotexist}}
11159 !! html
11160 <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>
11161 </p>
11162 !! end
11163
11164 !! test
11165 Template with invalid target containing tags
11166 !! wikitext
11167 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
11168 !! html
11169 <p>{{a<b>b</b>|foo|a=b|a = b}}
11170 </p>
11171 !! end
11172
11173 !! test
11174 Template with invalid target containing unclosed tag
11175 !! wikitext
11176 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
11177 !! html
11178 <p>{{a<b>|foo|a=b|a = b}}</b>
11179 </p>
11180 !! end
11181
11182 !! test
11183 Template with invalid target containing wikilink
11184 !! wikitext
11185 {{[[Main Page]]}}
11186 !! html/php
11187 <p>{{<a href="/wiki/Main_Page" title="Main Page">Main Page</a>}}
11188 </p>
11189 !! html/parsoid
11190 <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>
11191 !! end
11192
11193 !! test
11194 Template with just whitespace in it, T70421
11195 !! wikitext
11196 {{echo|{{ }}}}
11197 !! html/parsoid
11198 <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>
11199 !! end
11200
11201 !! article
11202 Template:test
11203 !! text
11204 This is a test template
11205 !! endarticle
11206
11207 !! test
11208 Simple template
11209 !! wikitext
11210 {{test}}
11211 !! html
11212 <p>This is a test template
11213 </p>
11214 !! end
11215
11216 !! test
11217 Template with explicit namespace
11218 !! wikitext
11219 {{Template:test}}
11220 !! html
11221 <p>This is a test template
11222 </p>
11223 !! end
11224
11225
11226 !! article
11227 Template:paramtest
11228 !! text
11229 This is a test template with parameter {{{param}}}
11230 !! endarticle
11231
11232 !! test
11233 Template parameter
11234 !! wikitext
11235 {{paramtest|param=foo}}
11236 !! html
11237 <p>This is a test template with parameter foo
11238 </p>
11239 !! end
11240
11241 !! article
11242 Template:paramtestnum
11243 !! text
11244 [[{{{1}}}|{{{2}}}]]
11245 !! endarticle
11246
11247 !! test
11248 Template unnamed parameter
11249 !! wikitext
11250 {{paramtestnum|Main Page|the main page}}
11251 !! html
11252 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
11253 </p>
11254 !! end
11255
11256 !! article
11257 Template:templatesimple
11258 !! text
11259 (test)
11260 !! endarticle
11261
11262 !! article
11263 Template:templateredirect
11264 !! text
11265 #redirect [[Template:templatesimple]]
11266 !! endarticle
11267
11268 !! article
11269 Template:templateasargtestnum
11270 !! text
11271 {{{{{1}}}}}
11272 !! endarticle
11273
11274 !! article
11275 Template:templateasargtest
11276 !! text
11277 {{template{{{templ}}}}}
11278 !! endarticle
11279
11280 !! article
11281 Template:templateasargtest2
11282 !! text
11283 {{{{{templ}}}}}
11284 !! endarticle
11285
11286 !! test
11287 Template with template name as unnamed argument
11288 !! wikitext
11289 {{templateasargtestnum|templatesimple}}
11290 !! html
11291 <p>(test)
11292 </p>
11293 !! end
11294
11295 !! test
11296 Template with template name as argument
11297 !! wikitext
11298 {{templateasargtest|templ=simple}}
11299 !! html
11300 <p>(test)
11301 </p>
11302 !! end
11303
11304 !! test
11305 Template with template name as argument (2)
11306 !! wikitext
11307 {{templateasargtest2|templ=templatesimple}}
11308 !! html
11309 <p>(test)
11310 </p>
11311 !! end
11312
11313 !! article
11314 Template:templateasargtestdefault
11315 !! text
11316 {{{{{templ|templatesimple}}}}}
11317 !! endarticle
11318
11319 !! article
11320 Template:templa
11321 !! text
11322 '''templ'''
11323 !! endarticle
11324
11325 !! test
11326 Template with default value
11327 !! wikitext
11328 {{templateasargtestdefault}}
11329 !! html
11330 <p>(test)
11331 </p>
11332 !! end
11333
11334 !! test
11335 Template with default value (value set)
11336 !! wikitext
11337 {{templateasargtestdefault|templ=templa}}
11338 !! html
11339 <p><b>templ</b>
11340 </p>
11341 !! end
11342
11343 !! test
11344 Template redirect
11345 !! wikitext
11346 {{templateredirect}}
11347 !! html/php
11348 <p>(test)
11349 </p>
11350 !! html/parsoid
11351 <link rel="mw:PageProp/redirect" href="./Template:Templatesimple" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"templateredirect","href":"./Template:Templateredirect"},"params":{},"i":0}}]}'/>
11352 !! end
11353
11354 !! test
11355 Template with argument in separate line
11356 !! wikitext
11357 {{ templateasargtest |
11358 templ = simple }}
11359 !! html
11360 <p>(test)
11361 </p>
11362 !! end
11363
11364 !! test
11365 Template with complex template as argument
11366 !! wikitext
11367 {{paramtest|
11368 param ={{ templateasargtest |
11369 templ = simple }}}}
11370 !! html
11371 <p>This is a test template with parameter (test)
11372 </p>
11373 !! end
11374
11375 !! test
11376 Templates with templated name
11377 !! wikitext
11378 {{{{echo|echo}}|foo}}
11379 {{{{echo|inner list}} }}
11380 !! html
11381 <p>foo
11382 </p>
11383 <ul><li> item 1</li></ul>
11384
11385 !! html/parsoid
11386 <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>
11387 <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>
11388 !! end
11389
11390 ## Regression test; the output here isn't really that interesting.
11391 !! test
11392 Templates with templated name and top level template args
11393 !! wikitext
11394 {{1{{2{{{3}}}|4=5}}}}
11395 !! html/parsoid
11396 <p about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"1{{2{{{3}}}|4=5}}"},"params":{},"i":0}}]}'>{{1{{2{{{3}}}|4=5}}}}</p>
11397 !! end
11398
11399 # Parsoid markup is deliberate "broken". This is an edge case.
11400 # See long comment in TemplateHandler.js:convertAttribsToString.
11401 !! test
11402 Templates with invalid templated targets
11403 !! wikitext
11404 {{echo
11405 {{echo|foo}}
11406 }}
11407 !! html/php
11408 <p>{{echo
11409 foo
11410 }}
11411 </p>
11412 !! html/parsoid
11413 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo\n{{echo|foo}}\n"},"params":{},"i":0}}]}'>{{echo
11414 foo }}</p>
11415 !! end
11416
11417 !! test
11418 Template with thumb image (with link in description)
11419 !! wikitext
11420 {{paramtest|param=[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
11421 !! html/php
11422 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>
11423
11424 !! html+tidy
11425 <p>This is a test template with parameter</p>
11426 <div class="thumb tright">
11427 <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>
11428 <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>
11429 </div>
11430 </div>
11431 !! html/parsoid
11432 <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>
11433 !! end
11434
11435 !! article
11436 Template:complextemplate
11437 !! text
11438 {{{1}}} {{paramtest|
11439 param ={{{param}}}}}
11440 !! endarticle
11441
11442 !! test
11443 Template with complex arguments
11444 !! wikitext
11445 {{complextemplate|
11446 param ={{ templateasargtest |
11447 templ = simple }}|[[Template:complextemplate|link]]}}
11448 !! html
11449 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
11450 </p>
11451 !! end
11452
11453 !! test
11454 T2553: link with two variables in a piped link
11455 !! wikitext
11456 {|
11457 |[[{{{1}}}|{{{2}}}]]
11458 |}
11459 !! html/php
11460 <table>
11461 <tr>
11462 <td>[[{{{1}}}|{{{2}}}]]
11463 </td></tr></table>
11464
11465 !! html/parsoid
11466 <table>
11467 <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>
11468 </tbody></table>
11469 !! end
11470
11471 # See: T2553
11472 !! test
11473 Abort table cell attribute parsing on wikilink
11474 !! wikitext
11475 {|
11476 | testing [[one|two]] | three || four
11477 | testing one two | three || four
11478 | testing="[[one|two]]" | three || four
11479 |}
11480 !! html/php
11481 <table>
11482 <tr>
11483 <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>
11484 <td> four
11485 </td>
11486 <td> three </td>
11487 <td> four
11488 </td>
11489 <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>
11490 <td> four
11491 </td></tr></table>
11492
11493 !! html/parsoid
11494 <table>
11495 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'> testing <a rel="mw:WikiLink" href="./One" title="One" data-parsoid='{"stx":"piped","a":{"href":"./One"},"sa":{"href":"one"}}'>two</a> | three </td><td data-parsoid='{"stx":"row","autoInsertedEnd":true}'> four</td>
11496 <td data-parsoid='{"a":{"testing":null,"one":null,"two":null},"sa":{"testing":"","one":"","two":""},"autoInsertedEnd":true}'> three </td><td data-parsoid='{"stx":"row","autoInsertedEnd":true}'> four</td>
11497 <td> testing="<a rel="mw:WikiLink" href="./One" title="One" data-parsoid='{"stx":"piped","a":{"href":"./One"},"sa":{"href":"one"}}'>two</a>" | three </td><td data-parsoid='{"stx":"row","autoInsertedEnd":true}'> four</td></tr>
11498 </tbody></table>
11499 !! end
11500
11501 !! test
11502 Don't abort table cell attribute parsing if wikilink is found in template arg
11503 !! wikitext
11504 {|
11505 | Test {{#tag:ref|One two "[[three]]" four}}
11506 |}
11507 !! html/parsoid
11508 <table>
11509 <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>
11510 </tbody></table>
11511 !! end
11512
11513 !! test
11514 Magic variable as template parameter
11515 !! wikitext
11516 {{paramtest|param={{SITENAME}}}}
11517 !! html
11518 <p>This is a test template with parameter MediaWiki
11519 </p>
11520 !! end
11521
11522 !! article
11523 Template:linktest
11524 !! text
11525 [[{{{param}}}|link]]
11526 !! endarticle
11527
11528 !! test
11529 Template parameter as link source
11530 !! wikitext
11531 {{linktest|param=Main Page}}
11532 !! html
11533 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
11534 </p>
11535 !! end
11536
11537 !!article
11538 Template:paramtest2
11539 !! text
11540 including another template, {{paramtest|param={{{arg}}}}}
11541 !! endarticle
11542
11543 !! test
11544 Template passing argument to another template
11545 !! wikitext
11546 {{paramtest2|arg='hmm'}}
11547 !! html
11548 <p>including another template, This is a test template with parameter 'hmm'
11549 </p>
11550 !! end
11551
11552 !! article
11553 Template:Linktest2
11554 !! text
11555 Main Page
11556 !! endarticle
11557
11558 !! test
11559 Template as link source
11560 !! wikitext
11561 [[{{linktest2}}]]
11562
11563 [[{{linktest2}}|Main Page]]
11564
11565 [[{{linktest2}}]]Page
11566 !! html
11567 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
11568 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
11569 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
11570 </p>
11571 !! end
11572
11573
11574 !! article
11575 Template:loop1
11576 !! text
11577 {{loop2}}
11578 !! endarticle
11579
11580 !! article
11581 Template:loop2
11582 !! text
11583 {{loop1}}
11584 !! endarticle
11585
11586 !! test
11587 Template infinite loop
11588 !! wikitext
11589 {{loop1}}
11590 !! html
11591 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
11592 </p>
11593 !! end
11594
11595 !! test
11596 Template from main namespace
11597 !! wikitext
11598 {{:Main Page}}
11599 !! html
11600 <p>blah blah
11601 </p>
11602 !! end
11603
11604 !! article
11605 Template:table
11606 !! text
11607 {|
11608 | 1 || 2
11609 |-
11610 | 3 || 4
11611 |}
11612 !! endarticle
11613
11614 !! test
11615 T2529: Template with table, not included at beginning of line
11616 !! wikitext
11617 foo {{table}}
11618 !! html
11619 <p>foo
11620 </p>
11621 <table>
11622 <tr>
11623 <td> 1 </td>
11624 <td> 2
11625 </td></tr>
11626 <tr>
11627 <td> 3 </td>
11628 <td> 4
11629 </td></tr></table>
11630
11631 !! end
11632
11633 !! test
11634 T2523: Template shouldn't eat newline (or add an extra one before table)
11635 !! wikitext
11636 foo
11637 {{table}}
11638 !! html
11639 <p>foo
11640 </p>
11641 <table>
11642 <tr>
11643 <td> 1 </td>
11644 <td> 2
11645 </td></tr>
11646 <tr>
11647 <td> 3 </td>
11648 <td> 4
11649 </td></tr></table>
11650
11651 !! end
11652
11653 !! test
11654 T2041: Template parameters shown as broken links
11655 !! wikitext
11656 {{{parameter}}}
11657 !! html
11658 <p>{{{parameter}}}
11659 </p>
11660 !! end
11661
11662 !! test
11663 Template with targets containing wikilinks
11664 !! options
11665 parsoid=wt2html
11666 !! wikitext
11667 {{[[foo]]}}
11668
11669 {{[[{{echo|foo}}]]}}
11670
11671 {{{{echo|[[foo}}]]}}
11672 !! html/php
11673 <p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
11674 </p><p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
11675 </p><p>{{[[foo}}]]
11676 </p>
11677 !! html/parsoid
11678 <p>{{<a rel="mw:WikiLink" href="./Foo" title="Foo">foo</a>}}</p>
11679 <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>
11680 <p>{{<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[foo}}]]"}},"i":0}}]}'>[[foo}}]]</span></p>
11681 !! end
11682
11683 !! article
11684 Template:''
11685 !! text
11686 bar
11687 !! endarticle
11688
11689 !! test
11690 Templates: Double quotes as template target
11691 !! wikitext
11692 foo {{''}} baz
11693 !! html/php
11694 <p>foo bar baz
11695 </p>
11696 !! html/parsoid
11697 <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
11698 </p>
11699 !! end
11700
11701 ## This test is about making sure Parsoid's data-mw is well formed in the
11702 ## face of multiple templates with intersecting and overlapping ranges. The
11703 ## wikitext itself is wretched.
11704 !! test
11705 Templates with intersecting and overlapping ranges
11706 !! wikitext
11707 {|{{echo|
11708 <p>ha</p>}}
11709 {|{{echo|
11710 <p>ho</p>}}
11711 {{echo|{{!}}hi}}
11712 |}
11713 !! html/php+tidy
11714 <p>ha</p>
11715 <p>ho</p>
11716 <table>
11717 <tr>
11718 <td></td>
11719 </tr>
11720 <tr>
11721 <td>hi</td>
11722 </tr>
11723 </table>
11724 <table>
11725 <tr>
11726 <td></td>
11727 </tr>
11728 </table>
11729 !! html/parsoid
11730 <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":""}]]}'>
11731
11732 </table><p about="#mwt1">ho</p><table about="#mwt1" typeof="mw:ExpandedAttrs" data-mw='{"attribs":[[{"txt":"","html":""},{"html":""}]]}'>
11733
11734 <tbody><tr><td>hi</td></tr>
11735 </tbody></table>
11736 !! end
11737
11738 !! article
11739 Template:MSGNW test
11740 !! text
11741 ''None'' of '''this''' should be
11742 * interpreted
11743 but rather passed unmodified
11744 {{test}}
11745 <gallery>
11746 File:Foobar.jpg
11747 </gallery>
11748 <!-- comment -->
11749 !! endarticle
11750
11751 # hmm, fix this or just deprecate msgnw and document its behavior?
11752 !! test
11753 msgnw keyword
11754 !! wikitext
11755 {{msgnw:MSGNW test}}
11756 !! html/php
11757 <p>&#39;&#39;None&#39;&#39; of &#39;&#39;&#39;this&#39;&#39;&#39; should be
11758 &#42; interpreted
11759 &#32;but rather passed unmodified
11760 &#123;&#123;test&#125;&#125;
11761 &#60;gallery&#62;
11762 File:Foobar.jpg
11763 &#60;/gallery&#62;
11764 &#60;!-- comment --&#62;
11765 </p>
11766 !! end
11767
11768 !! test
11769 int keyword
11770 !! wikitext
11771 {{int:youhavenewmessages|lots of money|not!}}
11772 !! html
11773 <p>You have lots of money (not!).
11774 </p>
11775 !! end
11776
11777 !! test
11778 int keyword - non-existing message
11779 !! wikitext
11780 {{int:var}}
11781 !! html
11782 <p>⧼var⧽
11783 </p>
11784 !! end
11785
11786 !! article
11787 Template:Includes
11788 !! text
11789 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
11790 !! endarticle
11791
11792 !! test
11793 <includeonly> and <noinclude> being included
11794 !! wikitext
11795 {{Includes}}
11796 !! html
11797 <p>Foobar
11798 </p>
11799 !! end
11800
11801 !! article
11802 Template:Includes2
11803 !! text
11804 <onlyinclude>Foo</onlyinclude>bar
11805 !! endarticle
11806
11807 !! test
11808 <onlyinclude> being included
11809 !! wikitext
11810 {{Includes2}}
11811 !! html
11812 <p>Foo
11813 </p>
11814 !! end
11815
11816
11817 !! article
11818 Template:Includes3
11819 !! text
11820 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
11821 !! endarticle
11822
11823 !! test
11824 <onlyinclude> and <includeonly> being included
11825 !! wikitext
11826 {{Includes3}}
11827 !! html
11828 <p>Foo
11829 </p>
11830 !! end
11831
11832 !! test
11833 <includeonly> and <noinclude> on a page
11834 !! wikitext
11835 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
11836 !! html
11837 <p>Foozar
11838 </p>
11839 !! end
11840
11841 !! test
11842 Un-closed <noinclude>
11843 !! wikitext
11844 <noinclude>
11845 !! html
11846 !! end
11847
11848 !! test
11849 <onlyinclude> on a page
11850 !! wikitext
11851 <onlyinclude>Foo</onlyinclude>bar
11852 !! html
11853 <p>Foobar
11854 </p>
11855 !! end
11856
11857 !! test
11858 Un-closed <onlyinclude>
11859 !! wikitext
11860 <onlyinclude>
11861 !! html
11862 !! end
11863
11864 !!test
11865 Self-closed noinclude, includeonly, onlyinclude tags
11866 !! wikitext
11867 <noinclude />
11868 <includeonly />
11869 <onlyinclude />
11870 !! html
11871 <p><br />
11872 </p>
11873 !!end
11874
11875 !!test
11876 Unbalanced includeonly and noinclude tags
11877 !! wikitext
11878 {|
11879 |a</noinclude>
11880 |b</noinclude></noinclude>
11881 |c</noinclude></includeonly>
11882 |d</includeonly></includeonly>
11883 |}
11884 !! html
11885 <table>
11886 <tr>
11887 <td>a
11888 </td>
11889 <td>b
11890 </td>
11891 <td>c&lt;/includeonly&gt;
11892 </td>
11893 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
11894 </td></tr></table>
11895
11896 !!end
11897
11898 !! article
11899 Template:Includeonly section
11900 !! text
11901 <includeonly>
11902 ==Includeonly section==
11903 </includeonly>
11904 ==Section T-1==
11905 !!endarticle
11906
11907 !! test
11908 T8563: Edit link generation for section shown by <includeonly>
11909 !! wikitext
11910 {{includeonly section}}
11911 !! html
11912 <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>
11913 <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>
11914
11915 !! end
11916
11917 # Uses same input as the contents of [[Template:Includeonly section]]
11918 !! test
11919 T8563: Section extraction for section shown by <includeonly>
11920 !! options
11921 section=T-2
11922 !! wikitext
11923 <includeonly>
11924 ==Includeonly section==
11925 </includeonly>
11926 ==Section T-2==
11927 !! html
11928 ==Section T-2==
11929 !! end
11930
11931 !! test
11932 T8563: Edit link generation for section suppressed by <includeonly>
11933 !! wikitext
11934 <includeonly>
11935 ==Includeonly section==
11936 </includeonly>
11937 ==Section 1==
11938 !! html
11939 <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>
11940
11941 !! end
11942
11943 !! test
11944 T8563: Section extraction for section suppressed by <includeonly>
11945 !! options
11946 section=1
11947 !! wikitext
11948 <includeonly>
11949 ==Includeonly section==
11950 </includeonly>
11951 ==Section 1==
11952 !! html
11953 ==Section 1==
11954 !! end
11955
11956 !! test
11957 Un-closed <includeonly>
11958 !! wikitext
11959 <includeonly>
11960 !! html/php
11961 !! html/parsoid
11962 <meta typeof="mw:Includes/IncludeOnly" data-parsoid='{"src":"&lt;includeonly>"}'/>
11963 !! end
11964
11965 ## We used to, but no longer wt2wt this test since the default serializer
11966 ## will normalize the include directives to serialize on their own line.
11967 ## Selser will take care of preserving formatting in scenarios where they
11968 ## intermingled with other wikitext.
11969 !! test
11970 Includes and comments at SOL
11971 !! options
11972 parsoid=wt2html,html2html
11973 !! wikitext
11974 <!-- comment --><noinclude><!-- comment --></noinclude><!-- comment -->== hu ==
11975
11976 <noinclude>
11977 some
11978 </noinclude>* stuff
11979 * here
11980
11981 <includeonly>can have stuff</includeonly>=== here ===
11982
11983 !! html/php
11984 <h2><span class="mw-headline" id="hu">hu</span></h2>
11985 <p>some
11986 </p>
11987 <ul><li> stuff</li>
11988 <li> here</li></ul>
11989 <h3><span class="mw-headline" id="here">here</span></h3>
11990
11991 !! html/parsoid
11992 <!-- 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>
11993
11994 <meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/>
11995 <p>some</p>
11996 <meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"&lt;/noinclude>"}'/><ul><li> stuff</li>
11997 <li> here</li></ul>
11998
11999 <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>
12000
12001 !! end
12002
12003 # TODO: test with DOM fragment reuse!
12004 !! test
12005 Parsoid: DOM fragment reuse
12006 !! options
12007 parsoid=wt2wt,wt2html
12008 !! wikitext
12009 a{{echo|b<table></table>c}}d
12010
12011 a{{echo|b
12012 <table></table>
12013 c}}d
12014
12015 {{echo|a
12016
12017 <table></table>
12018
12019 b}}
12020 !! html
12021 <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>
12022
12023 <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">
12024 </span><table about="#mwt2" data-parsoid='{"stx":"html"}'></table><span about="#mwt2">
12025 </span><p about="#mwt2">cd</p>
12026
12027 <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">
12028
12029 </span><table about="#mwt3" data-parsoid='{"stx":"html"}'></table><span about="#mwt3">
12030
12031 </span><p about="#mwt3">b</p>
12032 !! end
12033
12034 !! test
12035 Parsoid: Merge double tds (T52603)
12036 !! options
12037 parsoid
12038 !! wikitext
12039 {|
12040 |{{echo|{{!}} foo}}
12041 |}
12042 !! html
12043 <table><tbody>
12044 <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>
12045 </tbody></table>
12046 !! end
12047
12048 !! test
12049 Parsoid: Merge double tds in nested transclusion content (T52603)
12050 !! options
12051 parsoid
12052 !! wikitext
12053 {{echo|<div>}}
12054 {|
12055 |{{echo|{{!}} foo}}
12056 |}
12057 {{echo|</div>}}
12058 !! html
12059 <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}}]}'>
12060 <table><tbody>
12061 <tr><td data-mw='{"parts":["|"]}'> foo</td></tr>
12062 </tbody></table>
12063 </div>
12064 !! end
12065
12066 ###
12067 ### <includeonly> and <noinclude> in attributes
12068 ###
12069 !!test
12070 0. includeonly around the entire attribute
12071 !! wikitext
12072 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
12073 !! html
12074 <p><span id="v2">bar</span>
12075 </p>
12076 !!end
12077
12078 !!test
12079 1. includeonly in html attr key
12080 !! wikitext
12081 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
12082 !! html
12083 <p><span id="foo">bar</span>
12084 </p>
12085 !!end
12086
12087 !!test
12088 2. includeonly in html attr value
12089 !! wikitext
12090 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
12091 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
12092 !! html
12093 <p><span id="v1">bar</span>
12094 <span id="v1">bar</span>
12095 </p>
12096 !!end
12097
12098 !!test
12099 3. includeonly in part of an attr value
12100 !! wikitext
12101 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
12102 !! html
12103 <p><span style="color:red;">bar</span>
12104 </p>
12105 !!end
12106
12107 !!test
12108 4. includeonly in table attributes
12109 !! wikitext
12110 {|
12111 |- <noinclude>
12112 |-
12113 |a
12114 </noinclude>
12115 |- <includeonly>
12116 |-
12117 |b
12118 </includeonly>
12119 |}
12120 !! html
12121 <table>
12122
12123
12124 <tr>
12125 <td>a
12126 </td></tr>
12127 </table>
12128
12129 !!end
12130
12131 ###
12132 ### Preprocessor precedence tests
12133 ### See: https://www.mediawiki.org/wiki/Preprocessor_ABNF
12134 ###
12135 ##{{[[-{{{{{{[[Foo|bar}}]]}-}}}}}]]
12136 !! test
12137 Preprocessor precedence 1: link is rightmost opening
12138 !! options
12139 parsoid=wt2html
12140 !! wikitext
12141 {{[[Foo|bar}}]]
12142
12143 But close-brace is not a valid character in a link title:
12144 {{[[Foo}}|bar]]
12145
12146 However, we can still tell this was handled as a link in the preprocessor:
12147 {{echo|[[Foo}}|bar]]|bat}}
12148 !! html/php
12149 <p>{{<a href="/wiki/Foo" title="Foo">bar}}</a>
12150 </p><p>But close-brace is not a valid character in a link title:
12151 {{[[Foo}}|bar]]
12152 </p><p>However, we can still tell this was handled as a link in the preprocessor:
12153 [[Foo}}|bar]]
12154 </p>
12155 !! html/parsoid
12156 <p>{{<a rel="mw:WikiLink" href="./Foo" title="Foo">bar}}</a></p>
12157 <p>But close-brace is not a valid character in a link title: {{[[Foo}}|bar]]</p>
12158 <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>
12159 !! end
12160
12161 !! test
12162 Preprocessor precedence 2: template is rightmost opening
12163 !! options
12164 language=zh
12165 !! wikitext
12166 -{{echo|foo}-}}-
12167 !! html/php
12168 <p>-foo}--
12169 </p>
12170 !! html/parsoid
12171 <p>-<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo}-"}},"i":0}}]}'>foo}-</span>-</p>
12172 !! end
12173
12174 !! test
12175 Preprocessor precedence 3: language converter is rightmost opening
12176 !! options
12177 language=zh
12178 parsoid=wt2html
12179 !! wikitext
12180 {{echo|hi}}
12181
12182 {{-{R|echo|hi}}}-
12183
12184 [[-{R|raw]]}-
12185 !! html/php
12186 <p>hi
12187 </p><p>{{echo|hi}}
12188 </p><p>[[raw]]
12189 </p>
12190 !! html/parsoid
12191 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"hi"}},"i":0}}]}'>hi</p>
12192 <p>{{<span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"echo|hi}}"}}'></span></p>
12193 <p>[[<span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"raw]]"}}'></span></p>
12194 !! end
12195
12196 !! test
12197 Preprocessor precedence 4: left-most angle bracket
12198 !! options
12199 language=zh
12200 !! wikitext
12201 <!--{raw}-->
12202 !! html/php
12203 !! html/parsoid
12204 <!--{raw}-->
12205 !! end
12206
12207 !! article
12208 Template:Precedence5
12209 !! text
12210 {{{{{1}}}}}
12211 !! endarticle
12212
12213 !! test
12214 Preprocessor precedence 5: tplarg takes precedence over template
12215 !! wikitext
12216 {{Precedence5|Bullet}}
12217 !! html/php
12218 <ul><li> Bar</li></ul>
12219
12220 !! html/parsoid
12221 <ul typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"Precedence5","href":"./Template:Precedence5"},"params":{"1":{"wt":"Bullet"}},"i":0}}]}'><li> Bar</li></ul>
12222 !! end
12223
12224 !! test
12225 Preprocessor precedence 6: broken link is rightmost opening
12226 !! options
12227 parsoid=wt2html
12228 !! wikitext
12229 {{echo|[[Foo}}
12230
12231 {{echo|[[Foo|bar|bat=baz}}
12232 !! html/php
12233 <p>{{echo|[[Foo}}
12234 </p><p>{{echo|[[Foo|bar|bat=baz}}
12235 </p>
12236 !! html/parsoid
12237 <p>{{echo|[[Foo}}</p>
12238 <p>{{echo|[[Foo|bar|bat=baz}}</p>
12239 !! end
12240
12241 # This next test exposes a difference between PHP and Parsoid:
12242 # Given [[Foo|{{echo|Bar]]x}}y]]z:
12243 # 1) Both PHP and Parsoid ignore the `]]` inside the `echo` in the
12244 # "preprocessor" stage. The `{{echo` extends until the `x}}`, and the
12245 # outer `[[Foo` extends until the `y]]`
12246 # 2a) But then the PHP preprocessor emits `[[Foo|Bar]]xy]]z` as an
12247 # intermediate result (after template expansion), and link processing
12248 # happens on this intermediate result, which moves the wikilink
12249 # boundary leftward to `[[Foo|Bar]]`
12250 # 2b) Parsoid works in a single step, so it's going to keep the
12251 # wikilink as extending to the `y]]`
12252 # 3a) Then PHP does linktrail processing which slurps up the trailing
12253 # `xy` inside the link.
12254 # 3b) Parsoid will do linktrail processing to slurp up the trailing
12255 # `z` inside the link.
12256 # This is "correct" behavior. Parsoid's basic worldview is that the
12257 # `]]` inside the template shouldn't be allowed to leak out to affect
12258 # the surrounding wikilink. PHP may match Parsoid (in the future)
12259 # if you use {{#balance}} (T114445).
12260
12261 !! test
12262 Preprocessor precedence 7: broken template is rightmost opening
12263 !! options
12264 parsoid=wt2html
12265 !! wikitext
12266 [[Foo|{{echo|Bar]]
12267
12268 [[Foo|{{echo|Bar]]-x}}-y]]-z
12269
12270 Careful: linktrails can move the end of the wikilink:
12271 [[Foo|{{echo|y']]a}}l]]l
12272 !! html/php
12273 <p><a href="/wiki/Foo" title="Foo">{{echo|Bar</a>
12274 </p><p><a href="/wiki/Foo" title="Foo">Bar</a>-x-y]]-z
12275 </p><p>Careful: linktrails can move the end of the wikilink:
12276 <a href="/wiki/Foo" title="Foo">y'al</a>]]l
12277 </p>
12278 !! html/parsoid
12279 <p>[[Foo|{{echo|Bar]]</p>
12280 <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>
12281 <p>Careful: linktrails can move the end of the wikilink:
12282 <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>
12283 !! end
12284
12285 !! test
12286 Preprocessor precedence 8: broken language converter is rightmost opening
12287 !! options
12288 language=zh
12289 !! wikitext
12290 [[Foo-{R|raw]]
12291 !! html
12292 <p>[[Foo-{R|raw]]
12293 </p>
12294 !! end
12295
12296 !! article
12297 Template:Preprocessor_precedence_9
12298 !! text
12299 ;4: {{{{1}}}}
12300 ;5: {{{{{2}}}}}
12301 ;6: {{{{{{3}}}}}}
12302 ;7: {{{{{{{4}}}}}}}
12303 !! endarticle
12304
12305 !! test
12306 Preprocessor precedence 9: groups of braces
12307 !! wikitext
12308 {{Preprocessor precedence 9|Four|Bullet|1|2}}
12309 !! html/php
12310 <dl><dt>4</dt>
12311 <dd> {Four}</dd>
12312 <dt>5</dt>
12313 <dd> </dd></dl>
12314 <ul><li> Bar</li></ul>
12315 <dl><dt>6</dt>
12316 <dd> Four</dd>
12317 <dt>7</dt>
12318 <dd> {Bullet}</dd></dl>
12319
12320 !! html/parsoid
12321 <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}}]}'>
12322 <dt>4</dt>
12323 <dd>{Four}</dd>
12324 <dt>5</dt>
12325 <dd></dd>
12326 </dl><ul about="#mwt1">
12327 <li>Bar</li>
12328 </ul><span about="#mwt1"> </span><dl about="#mwt1">
12329 <dt>6</dt>
12330 <dd>Four</dd>
12331 <dt>7</dt>
12332 <dd>{Bullet}</dd>
12333 </dl>
12334 !! end
12335
12336 !! article
12337 Template:Preprocessor_precedence_10
12338 !! text
12339 ;1: -{R|raw}-
12340 ;2: -{{Bullet}}-
12341 ;3: -{{{1}}}-
12342 ;4: -{{{{2}}}}-
12343 ;5: -{{{{{3}}}}}-
12344 ;6: -{{{{{{4}}}}}}-
12345 ;7: -{{{{{{{5}}}}}}}-
12346 !! endarticle
12347
12348 !! test
12349 Preprocessor precedence 10: groups of braces with leading dash
12350 !! options
12351 language=zh
12352 !! wikitext
12353 {{Preprocessor precedence 10|Three|raw2|Bullet|1|2}}
12354 !! html/php
12355 <dl><dt>1</dt>
12356 <dd> raw</dd>
12357 <dt>2</dt>
12358 <dd> -</dd></dl>
12359 <ul><li> Bar-</li></ul>
12360 <dl><dt>3</dt>
12361 <dd> -Three-</dd>
12362 <dt>4</dt>
12363 <dd> raw2</dd>
12364 <dt>5</dt>
12365 <dd> -</dd></dl>
12366 <ul><li> Bar-</li></ul>
12367 <dl><dt>6</dt>
12368 <dd> -Three-</dd>
12369 <dt>7</dt>
12370 <dd> raw2</dd></dl>
12371
12372 !! html/parsoid
12373 <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}}]}'>
12374 <dt>1</dt>
12375 <dd><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"raw"}}'></span></dd>
12376 <dt>2</dt>
12377 <dd>-</dd>
12378 </dl><ul about="#mwt1">
12379 <li>Bar-</li>
12380 </ul><span about="#mwt1"> </span><dl about="#mwt1">
12381 <dt>3</dt>
12382 <dd>-Three-</dd>
12383 <dt>4</dt>
12384 <dd><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"raw2"}}'></span></dd>
12385 <dt>5</dt>
12386 <dd>-</dd>
12387 </dl><ul about="#mwt1">
12388 <li>Bar-</li>
12389 </ul><span about="#mwt1"> </span><dl about="#mwt1">
12390 <dt>6</dt>
12391 <dd>-Three-</dd>
12392 <dt>7</dt>
12393 <dd><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"raw2"}}'></span></dd>
12394 </dl>
12395 !! end
12396
12397 !! test
12398 Preprocessor precedence 11: found during visual diff testing
12399 !! wikitext
12400 {{#tag:span|-{{#tag:span|-{{echo|x}}}}}}
12401
12402 {{echo|-{{echo|-{{echo|x}}}}}}
12403
12404 {{echo|-{{echo|x}}}}
12405 !! html/php
12406 <p><span>-<span>-x</span></span>
12407 </p><p>--x
12408 </p><p>-x
12409 </p>
12410 !! html/parsoid
12411 <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>
12412
12413 <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>
12414
12415 <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>
12416 !! end
12417
12418 !! test
12419 Preprocessor precedence 12: broken language converter closed by brace.
12420 !! options
12421 parsoid=wt2html
12422 !! wikitext
12423 This form breaks the template, which is unfortunate:
12424 * {{echo|foo-{bar}bat}}
12425
12426 But if the broken language converter markup is inside an extension
12427 tag, nothing bad happens:
12428 * <nowiki>foo-{bar}bat</nowiki>
12429 * {{echo|<nowiki>foo-{bar}bat</nowiki>}}
12430 * <pre>foo-{bar}bat</pre>
12431 * {{echo|<pre>foo-{bar}bat</pre>}}
12432
12433 <tag>foo-{bar}bat</tag>
12434 {{echo|<tag>foo-{bar}bat</tag>}}
12435
12436 !! html/php+tidy
12437 <p>This form breaks the template, which is unfortunate:</p>
12438 <ul>
12439 <li>{{echo|foo-{bar}bat}}</li>
12440 </ul>
12441 <p>But if the broken language converter markup is inside an extension tag, nothing bad happens:</p>
12442 <ul>
12443 <li>foo-{bar}bat</li>
12444 <li>foo-{bar}bat</li>
12445 <li>
12446 <pre>
12447 foo-{bar}bat
12448 </pre></li>
12449 <li>
12450 <pre>
12451 foo-{bar}bat
12452 </pre></li>
12453 </ul>
12454 <pre>
12455 'foo-{bar}bat'
12456 array (
12457 )
12458 </pre>
12459 <pre>
12460 'foo-{bar}bat'
12461 array (
12462 )
12463 </pre>
12464 !! html/parsoid
12465 <p>This form breaks the template, which is unfortunate:</p>
12466 <ul>
12467 <li>{{echo|foo-{bar}bat}}</li>
12468 </ul>
12469 <p>But if the broken language converter markup is inside an extension tag, nothing bad happens:</p>
12470 <ul>
12471 <li><span typeof="mw:Nowiki">foo-{bar}bat</span></li>
12472 <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>
12473 <li><pre typeof="mw:Extension/pre" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"foo-{bar}bat"}}'>foo-{bar}bat</pre></li>
12474 <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>
12475 </ul>
12476 <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>
12477 !! end
12478
12479 !! test
12480 Preprocessor precedence 13: broken language converter in external link
12481 !! options
12482 parsoid=wt2html
12483 !! wikitext
12484 * [http://example.com/-{foo Example in URL]
12485 * [http://example.com Example in -{link} description]
12486 * {{echo|[http://example.com/-{foo Breaks template, however]}}
12487 !! html/php+tidy
12488 <ul>
12489 <li><a rel="nofollow" class="external text" href="http://example.com/-{foo">Example in URL</a></li>
12490 <li><a rel="nofollow" class="external text" href="http://example.com">Example in -{link} description</a></li>
12491 <li>{{echo|<a rel="nofollow" class="external text" href="http://example.com/-{foo">Breaks template, however</a>}}</li>
12492 </ul>
12493 !! html/parsoid
12494 <ul>
12495 <li><a rel="mw:ExtLink" href="http://example.com/-{foo">Example in URL</a></li>
12496 <li><a rel="mw:ExtLink" href="http://example.com">Example in -{link} description</a></li>
12497 <li>{{echo|<a rel="mw:ExtLink" href="http://example.com/-{foo">Breaks template, however</a>}}</li>
12498 </ul>
12499 !! end
12500
12501 !! test
12502 Preprocessor precedence 14: broken language converter in comment
12503 !! wikitext
12504 * <!--{{foo}}--> ...should be ok
12505 * <!---{{foo}}--> ...extra dashes
12506 * {{echo|foo<!-- -{bar} -->bat}} ...should be ok
12507 !! html/php+tidy
12508 <ul>
12509 <li>...should be ok</li>
12510 <li>...extra dashes</li>
12511 <li>foobat ...should be ok</li>
12512 </ul>
12513 !! html/parsoid
12514 <ul>
12515 <li><!--{{foo}}--> ...should be ok</li>
12516 <li><!--&#x2D;{{foo}}--> ...extra dashes</li>
12517 <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>
12518 </ul>
12519 !! end
12520
12521 !! test
12522 Preprocessor precedence 15: broken brace markup in headings
12523 !! options
12524 parsoid=wt2html
12525 !! wikitext
12526 __NOTOC__ __NOEDITSECTION__
12527 ===1 foo[bar 1===
12528 1
12529 ===2 foo[[bar 2===
12530 2
12531 ===3 foo{bar 3===
12532 3
12533 ===4 foo{{bar 4===
12534 4
12535 ===5 foo{{{bar 5===
12536 5
12537 ===6 foo-{bar 6===
12538 6
12539 !! html/php+tidy
12540 <h3><span class="mw-headline" id="1_foo.5Bbar_1">1 foo[bar 1</span></h3>
12541 <p>1</p>
12542 <h3><span class="mw-headline" id="2_foo.5B.5Bbar_2">2 foo[[bar 2</span></h3>
12543 <p>2</p>
12544 <h3><span class="mw-headline" id="3_foo.7Bbar_3">3 foo{bar 3</span></h3>
12545 <p>3</p>
12546 <h3><span class="mw-headline" id="4_foo.7B.7Bbar_4">4 foo{{bar 4</span></h3>
12547 <p>4</p>
12548 <h3><span class="mw-headline" id="5_foo.7B.7B.7Bbar_5">5 foo{{{bar 5</span></h3>
12549 <p>5</p>
12550 <h3><span class="mw-headline" id="6_foo-.7Bbar_6">6 foo-{bar 6</span></h3>
12551 <p>6</p>
12552 !! html/parsoid
12553 <meta property="mw:PageProp/notoc"/> <meta property="mw:PageProp/noeditsection"/
12554 >
12555 <h3>1 foo[bar 1</h3>
12556 <p>1</p>
12557 <h3>2 foo[[bar 2</h3>
12558 <p>2</p>
12559 <h3>3 foo{bar 3</h3>
12560 <p>3</p>
12561 <h3>4 foo{{bar 4</h3>
12562 <p>4</p>
12563 <h3>5 foo{{{bar 5</h3>
12564 <p>5</p>
12565 <h3>6 foo-{bar 6</h3>
12566 <p>6</p>
12567 !! end
12568
12569 !! test
12570 Preprocessor precedence 16: matching closing braces to opening braces
12571 !! options
12572 language=zh
12573 parsoid=wt2html
12574 !! wikitext
12575 -{{{echo|foo}}bar}-
12576 !! html/php
12577 <p>foobar
12578 </p>
12579 !! html/parsoid
12580 <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>
12581 !! end
12582
12583 ###
12584 ### Token Stream Patcher tests
12585 ###
12586 ### These tests won't always pass wt2wt and other modes because
12587 ### on serialization, the table will be output on a new line.
12588 ### For now, we are blacklisting them, and using this to test selser.
12589 ###
12590
12591 !!test
12592 1. Table tag in SOL posn. should get reparsed correctly with valid TSR
12593 !!options
12594 parsoid=wt2html,wt2wt
12595 !!wikitext
12596 {{echo|}}{| width = '100%'
12597 |foo
12598 |}
12599 !!html/parsoid
12600 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":""}},"i":0}}]}'></span><table width="100%">
12601 <tbody><tr><td>foo</td></tr>
12602 </tbody></table>
12603 !!end
12604
12605 ## We used to, but no longer wt2wt this test since the default serializer
12606 ## will normalize the include directives to serialize on their own line.
12607 ## Selser will take care of preserving formatting in scenarios where they
12608 ## intermingled with other wikitext.
12609 !!test
12610 2. Table tag in SOL posn. should get reparsed correctly with valid TSR
12611 !!options
12612 parsoid=wt2html
12613 !!wikitext
12614 <includeonly>a</includeonly>{| {{{b}}}
12615 |c
12616 |}
12617 !!html/parsoid
12618 <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":""}]]}'>
12619 <tbody><tr><td>c</td></tr>
12620 </tbody></table>
12621 !!end
12622
12623 !! test
12624 Table wikitext syntax outside wiki-tables
12625 !! wikitext
12626 a
12627 |+ not a caption
12628 ! not a table heading
12629 |- not a table row
12630 | not a table cell
12631 | class="foo bar" | baz
12632 b
12633 |}
12634 |-
12635 c
12636 !! html
12637 <p>a
12638 |+ not a caption
12639 ! not a table heading
12640 |- not a table row
12641 | not a table cell
12642 | class="foo bar" | baz
12643 b
12644 |}
12645 |-
12646 c
12647 </p>
12648 !! end
12649
12650 ###
12651 ### Testing parsing of templates where a template arg
12652 ### has the same name as the template itself.
12653 ###
12654
12655 !! article
12656 Template:quote
12657 !! text
12658 {{{quote|{{{1}}}}}}
12659 !! endarticle
12660
12661 !!test
12662 Templates: Template Name/Arg clash: 1. Use of positional param
12663 !! wikitext
12664 {{quote|foo}}
12665 !! html
12666 <p>foo
12667 </p>
12668 !!end
12669
12670 !!test
12671 Templates: Template Name/Arg clash: 2. Use of named param
12672 !! wikitext
12673 {{quote|quote=foo}}
12674 !! html
12675 <p>foo
12676 </p>
12677 !!end
12678
12679 !!test
12680 Templates: Template Name/Arg clash: 3. Use of named param with empty input
12681 !! wikitext
12682 {{quote|quote}}
12683 !! html
12684 <p>quote
12685 </p>
12686 !!end
12687
12688 ###
12689 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
12690 ###
12691
12692 !!test
12693 Templates: 1. Simple use
12694 !! wikitext
12695 {{echo|Foo}}
12696 !! html
12697 <p>Foo
12698 </p>
12699 !!end
12700
12701 !!test
12702 Templates: 2. Inside a block tag
12703 !! wikitext
12704 <div>{{echo|Foo}}</div>
12705 <blockquote>{{echo|Foo}}</blockquote>
12706 !! html
12707 <div>Foo</div>
12708 <blockquote>Foo</blockquote>
12709
12710 !! html+tidy
12711 <div>Foo</div>
12712 <blockquote>
12713 <p>Foo</p>
12714 </blockquote>
12715 !!end
12716
12717 !!test
12718 Templates: P-wrapping: 1a. Templates on consecutive lines
12719 !! wikitext
12720 {{echo|Foo}}
12721 {{echo|bar}}
12722 !! html
12723 <p>Foo
12724 bar
12725 </p>
12726 !!end
12727
12728 !!test
12729 Templates: P-wrapping: 1b. Templates on consecutive lines
12730 !! wikitext
12731 Foo
12732
12733 {{echo|bar}}
12734 {{echo|baz}}
12735 !! html
12736 <p>Foo
12737 </p><p>bar
12738 baz
12739 </p>
12740 !!end
12741
12742 !!test
12743 Templates: P-wrapping: 1c. Templates on consecutive lines
12744 !! wikitext
12745 {{echo|Foo}}
12746 {{echo|bar}} <div>baz</div>
12747 !! html
12748 <p>Foo
12749 </p>
12750 bar <div>baz</div>
12751
12752 !! html+tidy
12753 <p>Foo</p>
12754 <p>bar</p>
12755 <div>baz</div>
12756 !! end
12757
12758 !!test
12759 Templates: P-wrapping: 1d. Template preceded by comment-only line
12760 !!options
12761 parsoid
12762 !! wikitext
12763 <!-- foo -->
12764 {{echo|Bar}}
12765 !! html
12766 <!-- foo -->
12767
12768 <p about="#mwt223" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Bar"}},"i":0}}]}'>Bar</p>
12769 !!end
12770
12771 !!test
12772 Templates: Inline Text: 1. Multiple template uses
12773 !! wikitext
12774 {{echo|Foo}}bar{{echo|baz}}
12775 !! html
12776 <p>Foobarbaz
12777 </p>
12778 !!end
12779
12780 !!test
12781 Templates: Inline Text: 2. Back-to-back template uses
12782 !! wikitext
12783 {{echo|Foo}}{{echo|bar}}
12784 !! html
12785 <p>Foobar
12786 </p>
12787 !!end
12788
12789 !!test
12790 Templates: Block Tags: 1. Multiple template uses
12791 !! wikitext
12792 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
12793 !! html
12794 <div>Foo</div><div>bar</div><div>baz</div>
12795
12796 !!end
12797
12798 !!test
12799 Templates: Block Tags: 2. Back-to-back template uses
12800 !! wikitext
12801 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
12802 !! html
12803 <div>Foo</div><div>bar</div>
12804
12805 !!end
12806
12807 # This is an edge case relating to paragraph wrapping.
12808 !!test
12809 Templates: Correctly encapsulate templates producing </p> tag without a corresponding <p> tag
12810 !! wikitext
12811 {{echo|a
12812 b</p>}}
12813 !! html/parsoid
12814 <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
12815 b</p>
12816 !!end
12817
12818 !!test
12819 Templates: Links: 1. Simple example
12820 !! wikitext
12821 {{echo|[[Foo|bar]]}}
12822 !! html
12823 <p><a href="/wiki/Foo" title="Foo">bar</a>
12824 </p>
12825 !!end
12826
12827 !!test
12828 Templates: Links: 2. Generation of link href
12829 !! wikitext
12830 [[{{echo|Foo}}|bar]]
12831 !! html
12832 <p><a href="/wiki/Foo" title="Foo">bar</a>
12833 </p>
12834 !!end
12835
12836 !!test
12837 Templates: Links: 3. Generation of part of a link href
12838 !! wikitext
12839 [[Fo{{echo|o}}|bar]]
12840
12841 [[Foo{{echo|bar}}]]
12842
12843 [[Foo{{echo|bar}}baz]]
12844
12845 [[Foo{{echo|bar}}|bar]]
12846
12847 [[:Foo{{echo|bar}}]]
12848
12849 [[:Foo{{echo|bar}}|bar]]
12850 !! html
12851 <p><a href="/wiki/Foo" title="Foo">bar</a>
12852 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
12853 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
12854 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
12855 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
12856 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
12857 </p>
12858 !!end
12859
12860 !!test
12861 Templates: Links: 4. Multiple templates generating link href
12862 !! wikitext
12863 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
12864 !! html
12865 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
12866 </p>
12867 !!end
12868
12869 !!test
12870 Templates: Links: 5. Generation of link text
12871 !! wikitext
12872 [[Foo|{{echo|bar}}]]
12873 !! html
12874 <p><a href="/wiki/Foo" title="Foo">bar</a>
12875 </p>
12876 !!end
12877
12878 !!test
12879 Templates: Links: 5. Nested templates (only outermost template should be marked)
12880 !! wikitext
12881 {{echo|[[{{echo|Foo}}|bar]]}}
12882 !! html
12883 <p><a href="/wiki/Foo" title="Foo">bar</a>
12884 </p>
12885 !!end
12886
12887 !!test
12888 Templates: HTML Tag: 1. Generation of HTML attr. key
12889 !! wikitext
12890 <div {{echo|style}}="color:red;">foo</div>
12891 !! html
12892 <div style="color:red;">foo</div>
12893
12894 !!end
12895
12896 !!test
12897 Templates: HTML Tag: 2. Generation of HTML attr. value
12898 !! wikitext
12899 <div style={{echo|'color:red;'}}>foo</div>
12900 !! html
12901 <div style="color:red;">foo</div>
12902
12903 !!end
12904
12905 !!test
12906 Templates: HTML Tag: 3. Generation of HTML attr key and value
12907 !! wikitext
12908 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
12909 !! html
12910 <div style="color:red;">foo</div>
12911
12912 !!end
12913
12914 !!test
12915 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
12916 !! wikitext
12917 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
12918 !! html
12919 <div title="This is a long title with just one piece templated">foo</div>
12920
12921 !!end
12922
12923 !!test
12924 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
12925 !! wikitext
12926 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
12927 !! html
12928 <div title="This is a long title with just one piece templated">foo</div>
12929
12930 !!end
12931
12932 !!test
12933 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
12934 !! wikitext
12935 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
12936 !! html
12937 <div title="This is a long title with just one piece templated">foo</div>
12938
12939 !!end
12940
12941 # SSS FIXME: While it is great we added support for all this,
12942 # do we want to make this part of the spec? Maybe we want to
12943 # deprecate this kind of usage in the future?
12944 !!test
12945 Templates: HTML Tag: 7. Generation of partial attribute key string
12946 !! wikitext
12947 <div st{{echo|yle}}="color:red;">foo</div>
12948 !! html
12949 <div style="color:red;">foo</div>
12950
12951 !!end
12952
12953 !! test
12954 Templates: HTML Tag: 8. Template-generated attribute (k=v)
12955 !! wikitext
12956 <div {{echo|1=id="v1"}}>bar</div>
12957 !! html
12958 <div id="v1">bar</div>
12959
12960 !!end
12961
12962 !! test
12963 Templates: HTML Tag: 9. Multiple template-generated attributes
12964 !! wikitext
12965 <div {{echo|1=id="v1" title="foo"}}>bar</div>
12966 !! html
12967 <div id="v1" title="foo">bar</div>
12968
12969 !!end
12970
12971 !! test
12972 Templates: Support for templates generating attributes and content
12973 !! wikitext
12974 {| {{mixed_attr_content_template}}
12975 |-
12976 |bar
12977 |}
12978 !! html/php
12979 <table style="color:red;" title="T48811">
12980
12981 <tr>
12982 <td>foo
12983 </td></tr>
12984 <tr>
12985 <td>bar
12986 </td></tr></table>
12987
12988 !! html/parsoid
12989 <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|}"]}'>
12990 <tbody><tr>
12991 <td>foo</td></tr>
12992 <tr>
12993 <td>bar</td></tr>
12994 </tbody></table>
12995 !!end
12996
12997 !! test
12998 1. Entities and nowikis inside templated attributes should be handled correctly
12999 !! wikitext
13000 <div {{echo|style{{=}}"background:&#35;f9f9f9;"}}>foo</div>
13001 !! html/php
13002 <div style="background:#f9f9f9;">foo</div>
13003
13004 !! html/parsoid
13005 <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>
13006 !! end
13007
13008 !! test
13009 2. Entities and nowikis inside templated attributes should be handled correctly
13010 !! wikitext
13011 {|
13012 |{{table_attribs_3}}
13013 |}
13014 !! html/php
13015 <table>
13016 <tr>
13017 <td style="background:#f9f9f9;">Foo
13018 </td></tr></table>
13019
13020 !! html/parsoid
13021 <table>
13022 <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>
13023 </tbody></table>
13024 !! end
13025
13026 !! test
13027 3. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
13028 !! wikitext
13029 {{tbl-start}}
13030 |{{table_attribs_3}}
13031 {{tbl-end}}
13032 !! html/php
13033 <table>
13034 <tr>
13035 <td style="background:#f9f9f9;">Foo
13036 </td></tr></table>
13037
13038 !! html/parsoid
13039 <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}}]}'>
13040 <tbody><tr><td style="background:#f9f9f9;">Foo</td></tr>
13041 </tbody></table>
13042 !! end
13043
13044 # T107622
13045 !! test
13046 4. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
13047 !! wikitext
13048 {|
13049 | {{table_attribs_6}} hi
13050 |}
13051 !! html/php
13052 <table>
13053 <tr>
13054 <td style="background: red;"> hi
13055 </td></tr></table>
13056
13057 !! html/parsoid
13058 <table>
13059 <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>
13060 </tbody></table>
13061 !! end
13062
13063 !!test
13064 Templates: HTML Tables: 1. Generating start of a HTML table
13065 !! wikitext
13066 {{echo|<table><tr><td>foo</td>}}</tr></table>
13067 !! html
13068 <table><tr><td>foo</td></tr></table>
13069
13070 !!end
13071
13072 !!test
13073 Templates: HTML Tables: 2a. Generating middle of a HTML table
13074 !! wikitext
13075 <table><tr>{{echo|<td>foo</td>}}</tr></table>
13076 !! html
13077 <table><tr><td>foo</td></tr></table>
13078
13079 !!end
13080
13081 !!test
13082 Templates: HTML Tables: 2b. Generating middle of a HTML table
13083 !! wikitext
13084 <table>{{echo|<tr><td>foo</td></tr>}}</table>
13085 !! html
13086 <table><tr><td>foo</td></tr></table>
13087
13088 !!end
13089
13090 !!test
13091 Templates: HTML Tables: 3. Generating end of a HTML table
13092 !! wikitext
13093 <table><tr>{{echo|<td>foo</td></tr></table>}}
13094 !! html
13095 <table><tr><td>foo</td></tr></table>
13096
13097 !!end
13098
13099 !!test
13100 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
13101 !! wikitext
13102 {{echo|<table>}}<tr><td>foo</td></tr></table>
13103 !! html
13104 <table><tr><td>foo</td></tr></table>
13105
13106 !!end
13107
13108 !!test
13109 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
13110 !! wikitext
13111 <table>{{echo|<tr>}}<td>foo</td></tr></table>
13112 !! html
13113 <table><tr><td>foo</td></tr></table>
13114
13115 !!end
13116
13117 !!test
13118 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
13119 !! wikitext
13120 <table><tr>{{echo|<td>}}foo</td></tr></table>
13121 !! html
13122 <table><tr><td>foo</td></tr></table>
13123
13124 !!end
13125
13126 !!test
13127 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
13128 !! wikitext
13129 <table><tr><td>foo{{echo|</td>}}</tr></table>
13130 !! html
13131 <table><tr><td>foo</td></tr></table>
13132
13133 !!end
13134
13135 !!test
13136 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
13137 !! wikitext
13138 <table><tr><td>foo</td>{{echo|</tr>}}</table>
13139 !! html
13140 <table><tr><td>foo</td></tr></table>
13141
13142 !!end
13143
13144 !!test
13145 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
13146 !! wikitext
13147 <table><tr><td>foo</td></tr>{{echo|</table>}}
13148 !! html
13149 <table><tr><td>foo</td></tr></table>
13150
13151 !!end
13152
13153 !!test
13154 Templates: HTML Tables: 5. Proper fostering of categories from inside
13155 !!options
13156 parsoid=wt2html,wt2wt
13157 !! wikitext
13158 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
13159 <!--Two categories (T52330)-->
13160 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
13161 !! html
13162 <link rel="mw:PageProp/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
13163 <!--Two categories (T52330)-->
13164 <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>
13165 !!end
13166
13167 !!test
13168 Templates: Wiki Tables: 1a. Fostering of entire template content
13169 !! wikitext
13170 {|
13171 {{echo|a}}
13172 |}
13173 !! html
13174 <table>
13175 a
13176 <tr><td></td></tr></table>
13177
13178 !! html+tidy
13179 <p>a</p>
13180 <table>
13181 <tr>
13182 <td></td>
13183 </tr>
13184 </table>
13185 !! end
13186
13187 !!test
13188 Templates: Wiki Tables: 1b. Fostering of entire template content
13189 !! wikitext
13190 {|
13191 {{echo|<div>}}
13192 foo
13193 {{echo|</div>}}
13194 |}
13195 !! html
13196 <table>
13197 <div>
13198 <p>foo
13199 </p>
13200 </div>
13201 <tr><td></td></tr></table>
13202
13203 !! html+tidy
13204 <div>
13205 <p>foo</p>
13206 </div>
13207 <table>
13208 <tr>
13209 <td></td>
13210 </tr>
13211 </table>
13212 !! end
13213
13214 !!test
13215 Templates: Wiki Tables: 2. Fostering of partial template content
13216 !! wikitext
13217 {|
13218 {{echo|a
13219 <div>b</div>}}
13220 |}
13221 !! html
13222 <table>
13223 a
13224 <div>b</div>
13225 <tr><td></td></tr></table>
13226
13227 !! html+tidy
13228 <p>a</p>
13229 <div>b</div>
13230 <table>
13231 <tr>
13232 <td></td>
13233 </tr>
13234 </table>
13235 !! end
13236
13237 !!test
13238 Templates: Wiki Tables: 3. td-content via multiple templates
13239 !! wikitext
13240 {|
13241 {{echo|{{pipe}}a}}{{echo|b}}
13242 |}
13243 !! html
13244 <table>
13245 <tr>
13246 <td>ab
13247 </td></tr></table>
13248
13249 !!end
13250
13251 !!test
13252 Templates: Wiki Tables: 4. Templated tags, no content
13253 !! wikitext
13254 {{tbl-start}}
13255 {{tbl-end}}
13256 !! html
13257 <table>
13258 <tr><td></td></tr></table>
13259
13260 !!end
13261
13262 !!test
13263 Templates: Wiki Tables: 5. Templated tags, regular td-tags
13264 !! wikitext
13265 {{tbl-start}}
13266 |foo
13267 {{tbl-end}}
13268 !! html
13269 <table>
13270 <tr>
13271 <td>foo
13272 </td></tr></table>
13273
13274 !!end
13275
13276 !!test
13277 Templates: Wiki Tables: 6. Templated tags, templated td-tags
13278 !! wikitext
13279 {{tbl-start}}
13280 {{!}}foo
13281 {{tbl-end}}
13282 !! html
13283 <table>
13284 <tr>
13285 <td>foo
13286 </td></tr></table>
13287
13288 !!end
13289
13290 ## This test case is very specific to Parsoid's internals
13291 ## and is hence only tested for Parsoid's code. Parsoid uses
13292 ## a <meta> marker tag for <ref> tags and they are expanded
13293 ## much later. We are verifying that this <meta> tag usage
13294 ## doesn't prevent foster parenting.
13295 !!test
13296 Templates: Wiki Tables: 7. Fosterable <ref>s should get fostered
13297 !!wikitext
13298 {{PartialTable}}<ref>foo</ref>
13299 |}
13300
13301 <references />
13302 !!html/parsoid
13303 <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">
13304 <tbody>
13305 </tbody></table>
13306
13307 <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>
13308 !!end
13309
13310 !! test
13311 Templates: Wiki Tables: 8. Fosterable meta-tags should get fostered
13312 !! wikitext
13313 {{echo|
13314 {{{!}}
13315 {{!}}-}}
13316 <onlyinclude>
13317 |foo
13318 </onlyinclude>
13319 {{!}}}
13320 !! html/parsoid
13321 <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{{!}}}"]}'>
13322 </span><meta typeof="mw:Includes/OnlyInclude" about="#mwt1"/><table about="#mwt1">
13323 <tbody><tr>
13324
13325 <td>foo
13326 <meta typeof="mw:Includes/OnlyInclude/End"/></td></tr>
13327 </tbody></table>
13328 !! end
13329
13330 !!test
13331 Templates: Lists: Multi-line list-items via templates
13332 !! wikitext
13333 *{{echo|a {{nonexistent|
13334 unused}}}}
13335 *{{echo|b {{nonexistent|
13336 unused}}}}
13337 !! html
13338 <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>
13339 <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>
13340
13341 !!end
13342
13343 !!test
13344 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
13345 !! wikitext
13346 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
13347 !! html
13348 <p><i>ab</i>c<i>d</i>e
13349 </p>
13350 !!end
13351
13352 !!test
13353 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
13354 (PHP parser generates misnested html)
13355 !! wikitext
13356 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
13357 !! html/parsoid
13358 <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>
13359 !!end
13360
13361 !!test
13362 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
13363 (PHP parser generates misnested html; Parsoid html2wt mode adds newlines between {{echo}}s)
13364 !! options
13365 parsoid=wt2html,wt2wt
13366 !! wikitext
13367 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
13368 !! html
13369 <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>
13370 <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>
13371 <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>
13372 !!end
13373
13374 !!test
13375 Templates: Ugly nesting: 4. Divs opened/closed across templates
13376 !! wikitext
13377 a<div>b{{echo|c</div>d}}e
13378 !! html
13379 a<div>bc</div>de
13380
13381 !! html+tidy
13382 <p>a</p>
13383 <div>bc</div>
13384 <p>de</p>
13385 !! end
13386
13387 !!test
13388 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
13389 (Parsoid-centric)
13390 !! options
13391 parsoid
13392 !! wikitext
13393 {|
13394 |{{echo|foo</table>}}
13395 |bar
13396 |}
13397 !! html
13398 <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|}"]}'>
13399
13400 <tbody>
13401 <tr>
13402 <td>foo</td></tr></tbody></table><span about="#mwt1">
13403 </span><span about="#mwt1">|bar</span><span about="#mwt1">
13404 |}</span>
13405 !!end
13406
13407 !!test
13408 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
13409 (Parsoid-centric)
13410 !! options
13411 parsoid
13412 !! wikitext
13413 <table>
13414 <tr>
13415 <td>
13416 <table>
13417 <tr>
13418 <td>1. {{echo|foo </table>}}</td>
13419 <td> bar </td>
13420 <td>2. {{echo|baz </table>}}</td>
13421 </tr>
13422 <tr>
13423 <td>abc</td>
13424 </tr>
13425 </table>
13426 </td>
13427 </tr>
13428 <tr>
13429 <td>xyz</td>
13430 </tr>
13431 </table>
13432 !! html
13433 <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>"]}'>
13434 <tbody><tr>
13435 <td>
13436 <table>
13437 <tbody><tr>
13438 <td>1. foo </td></tr></tbody></table></td>
13439 <td> bar </td>
13440 <td>2. baz </td></tr></tbody></table><span about="#mwt2">
13441 </span><span about="#mwt2">
13442 </span><span about="#mwt2">
13443 </span><span about="#mwt2">abc</span><span about="#mwt2">
13444 </span><span about="#mwt2">
13445 </span><span about="#mwt2">
13446 </span><span about="#mwt2">
13447 </span><span about="#mwt2">
13448 </span><span about="#mwt2">
13449 </span><span about="#mwt2">xyz</span><span about="#mwt2">
13450 </span><span about="#mwt2">
13451 </span>
13452 !!end
13453
13454 !! test
13455 Templates: Ugly templates: 3. newline-only template parameter
13456 !! wikitext
13457 foo {{echo|
13458 }}
13459 !! html
13460 <p>foo
13461 </p>
13462 !! end
13463
13464 # This looks like a bug: a single newline triggers p/br for some reason.
13465 !! test
13466 Templates: Ugly templates: 4. newline-only template parameter inconsistency
13467 !! wikitext
13468 {{echo|
13469 }}
13470 !! html
13471 <p><br />
13472 </p>
13473 !! end
13474
13475 # T66017 -- ugly wikitext with fostered content generates two template ranges that
13476 # have a true overlap (T1-start - T2-start - T1-end - T2-end).
13477 !! test
13478 Templates: Ugly templates: 5. Template encapsulation test: Non-trivial overlap of template ranges is properly handled
13479 !! wikitext
13480 {{echo|<table>}}
13481 {{echo|<div>foo}}
13482 {{echo|</table>}}
13483 !! html/parsoid
13484 <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
13485 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
13486 </table>
13487 !! end
13488
13489 # T66017 -- ugly wikitext with fostered content generates two template ranges
13490 # that are "identical" and generate nesting cycles in the algorithm
13491 !! test
13492 Templates: Ugly templates: 6. Template encapsulation test: Cyclical nesting of template ranges is properly handled
13493 !! wikitext
13494 {{echo|<table><tr><td><table>}}
13495 {{echo|<div>}}
13496 {{echo|</div>}}
13497 !! html/parsoid
13498 <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"}'>
13499 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
13500 </table></td></tr></tbody></table>
13501 !! end
13502
13503 !! test
13504 Templates: Parameters substituted at the top-level
13505 !! wikitext
13506 {{{foo|''who'' {{echo|me}}? '''never!'''}}}
13507
13508 {{{foo|bar|baz}}}
13509 !! html/php
13510 <p><i>who</i> me? <b>never!</b>
13511 </p><p>bar
13512 </p>
13513 !! html/parsoid
13514 <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>
13515
13516 <p about="#mwt3" typeof="mw:Param" data-mw='{"parts":[{"templatearg":{"target":{"wt":"foo"},"params":{"1":{"wt":"bar"},"2":{"wt":"baz"}},"i":0}}]}'>bar</p>
13517 !! end
13518
13519 !! test
13520 Templates: Param with empty arg in the final position
13521 !! wikitext
13522 {{{hi|}}}
13523 !! html/parsoid
13524 <span about="#mwt1" typeof="mw:Param" data-mw='{"parts":[{"templatearg":{"target":{"wt":"hi"},"params":{"1":{"wt":""}},"i":0}}]}'></span>
13525 !! end
13526
13527 !!test
13528 Parser Functions: 1. Simple example
13529 !! wikitext
13530 {{uc:foo}}
13531 !! html
13532 <p>FOO
13533 </p>
13534 !!end
13535
13536 !!test
13537 Parser Functions: 2. Nested use (only outermost should be marked up)
13538 !! wikitext
13539 {{uc:{{lc:FOO}}}}
13540 !! html
13541 <p>FOO
13542 </p>
13543 !!end
13544
13545 ###
13546 ### Pre-save transform tests
13547 ###
13548 !! test
13549 pre-save transform: subst:
13550 !! options
13551 pst
13552 !! wikitext
13553 {{subst:test}}
13554 !! html/php
13555 This is a test template
13556 !! end
13557
13558 !! test
13559 pre-save transform: normal template
13560 !! options
13561 pst
13562 !! wikitext
13563 {{test}}
13564 !! html/php
13565 {{test}}
13566 !! end
13567
13568 !! test
13569 pre-save transform: nonexistent template
13570 !! options
13571 pst
13572 !! wikitext
13573 {{thistemplatedoesnotexist}}
13574 !! html/php
13575 {{thistemplatedoesnotexist}}
13576 !! end
13577
13578 !! test
13579 pre-save transform: subst magic variables
13580 !! options
13581 pst
13582 !! wikitext
13583 {{subst:SITENAME}}
13584 !! html/php
13585 MediaWiki
13586 !! end
13587
13588 # This is T2089, which I fixed. -- wtm
13589 !! test
13590 pre-save transform: subst: templates with parameters
13591 !! options
13592 pst
13593 !! wikitext
13594 {{subst:paramtest|param="something else"}}
13595 !! html/php
13596 This is a test template with parameter "something else"
13597 !! end
13598
13599 !! article
13600 Template:nowikitest
13601 !! text
13602 <nowiki>'''not wiki'''</nowiki>
13603 !! endarticle
13604
13605 !! test
13606 pre-save transform: nowiki in subst (T3188)
13607 !! options
13608 pst
13609 !! wikitext
13610 {{subst:nowikitest}}
13611 !! html/php
13612 <nowiki>'''not wiki'''</nowiki>
13613 !! end
13614
13615 !! article
13616 Template:commenttest
13617 !! text
13618 This template has <!-- a comment --> in it.
13619 !! endarticle
13620
13621 !! test
13622 pre-save transform: comment in subst (T3936)
13623 !! options
13624 pst
13625 !! wikitext
13626 {{subst:commenttest}}
13627 !! html/php
13628 This template has <!-- a comment --> in it.
13629 !! end
13630
13631 !! test
13632 pre-save transform: unclosed tag
13633 !! options
13634 pst
13635 !! wikitext
13636 <nowiki>'''not wiki'''
13637 !! html/php
13638 <nowiki>'''not wiki'''
13639 !! end
13640
13641 !! test
13642 pre-save transform: mixed tag case
13643 !! options
13644 pst
13645 !! wikitext
13646 <NOwiki>'''not wiki'''</noWIKI>
13647 !! html/php
13648 <NOwiki>'''not wiki'''</noWIKI>
13649 !! end
13650
13651 !! test
13652 pre-save transform: unclosed comment in <nowiki>
13653 !! options
13654 pst
13655 !! wikitext
13656 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
13657 !! html/php
13658 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
13659 !!end
13660
13661 # Leading @ in this template definition works around a limitation
13662 # in parsoid's parserTests which otherwise strips the <span> from the
13663 # result (confusing it for a template wrapper)
13664 !! article
13665 Template:dangerous
13666 !!text
13667 @<span onmouseover="alert('crap')">Oh no</span>
13668 !!endarticle
13669
13670 !!test
13671 (confirming safety of fix for subst T3936)
13672 !! wikitext
13673 {{Template:dangerous}}
13674 !! html
13675 <p>@<span>Oh no</span>
13676 </p>
13677 !! end
13678
13679 !! test
13680 pre-save transform: comment containing gallery (T7024)
13681 !! options
13682 pst
13683 !! wikitext
13684 <!-- <gallery>data</gallery> -->
13685 !! html/php
13686 <!-- <gallery>data</gallery> -->
13687 !!end
13688
13689 !! test
13690 pre-save transform: comment containing extension
13691 !! options
13692 pst
13693 !! wikitext
13694 <!-- <tag>data</tag> -->
13695 !! html/php
13696 <!-- <tag>data</tag> -->
13697 !!end
13698
13699 !! test
13700 pre-save transform: comment containing nowiki
13701 !! options
13702 pst
13703 !! wikitext
13704 <!-- <nowiki>data</nowiki> -->
13705 !! html/php
13706 <!-- <nowiki>data</nowiki> -->
13707 !!end
13708
13709 !! test
13710 pre-save transform: <noinclude> in subst (T5298)
13711 !! options
13712 pst
13713 !! wikitext
13714 {{subst:Includes}}
13715 !! html/php
13716 Foobar
13717 !! end
13718
13719 !! test
13720 pre-save transform: <onlyinclude> in subst (T5298)
13721 !! options
13722 pst
13723 !! wikitext
13724 {{subst:Includes2}}
13725 !! html/php
13726 Foo
13727 !! end
13728
13729 !! article
13730 Template:SubstTest
13731 !!text
13732 {{<includeonly>subst:</includeonly>Includes}}
13733 !! endarticle
13734
13735 !! article
13736 Template:SafeSubstTest
13737 !! text
13738 {{<includeonly>safesubst:</includeonly>Includes}}
13739 !! endarticle
13740
13741 !! test
13742 T24297: safesubst: works during PST
13743 !! options
13744 pst
13745 !! wikitext
13746 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
13747 !! html/php
13748 FoobarFoobar
13749 !! end
13750
13751 !! test
13752 T24297: safesubst: works during normal parse
13753 !! wikitext
13754 {{SafeSubstTest}}
13755 !! html
13756 <p>Foobar
13757 </p>
13758 !! end
13759
13760 !! test
13761 subst: does not work during normal parse
13762 !! wikitext
13763 {{SubstTest}}
13764 !! html
13765 <p>{{subst:Includes}}
13766 </p>
13767 !! end
13768
13769 !! test
13770 pre-save transform: context links ("pipe trick")
13771 !! options
13772 pst
13773 !! wikitext
13774 [[Article (context)|]]
13775 [[Bar:Article|]]
13776 [[:Bar:Article|]]
13777 [[Bar:Article (context)|]]
13778 [[:Bar:Article (context)|]]
13779 [[|Article]]
13780 [[|Article (context)]]
13781 [[Bar:X (Y) Z|]]
13782 [[:Bar:X (Y) Z|]]
13783 !! html/php
13784 [[Article (context)|Article]]
13785 [[Bar:Article|Article]]
13786 [[:Bar:Article|Article]]
13787 [[Bar:Article (context)|Article]]
13788 [[:Bar:Article (context)|Article]]
13789 [[Article]]
13790 [[Article (context)]]
13791 [[Bar:X (Y) Z|X (Y) Z]]
13792 [[:Bar:X (Y) Z|X (Y) Z]]
13793 !! end
13794
13795 !! test
13796 pre-save transform: context links ("pipe trick") with interwiki prefix
13797 !! options
13798 pst
13799 !! wikitext
13800 [[interwiki:Article|]]
13801 [[:interwiki:Article|]]
13802 [[interwiki:Bar:Article|]]
13803 [[:interwiki:Bar:Article|]]
13804 !! html/php
13805 [[interwiki:Article|Article]]
13806 [[:interwiki:Article|Article]]
13807 [[interwiki:Bar:Article|Bar:Article]]
13808 [[:interwiki:Bar:Article|Bar:Article]]
13809 !! end
13810
13811 !! test
13812 pre-save transform: context links ("pipe trick") with parens in title
13813 !! options
13814 pst title=[[Somearticle (context)]]
13815 !! wikitext
13816 [[|Article]]
13817 !! html/php
13818 [[Article (context)|Article]]
13819 !! end
13820
13821 !! test
13822 pre-save transform: context links ("pipe trick") with comma in title
13823 !! options
13824 pst title=[[Someplace, Somewhere]]
13825 !! wikitext
13826 [[|Otherplace]]
13827 [[Otherplace, Elsewhere|]]
13828 [[Otherplace, Elsewhere, Anywhere|]]
13829 !! html/php
13830 [[Otherplace, Somewhere|Otherplace]]
13831 [[Otherplace, Elsewhere|Otherplace]]
13832 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
13833 !! end
13834
13835 !! test
13836 pre-save transform: context links ("pipe trick") with parens and comma
13837 !! options
13838 pst title=[[Someplace (IGNORED), Somewhere]]
13839 !! wikitext
13840 [[|Otherplace]]
13841 [[Otherplace (place), Elsewhere|]]
13842 !! html/php
13843 [[Otherplace, Somewhere|Otherplace]]
13844 [[Otherplace (place), Elsewhere|Otherplace]]
13845 !! end
13846
13847 !! test
13848 pre-save transform: context links ("pipe trick") with comma and parens
13849 !! options
13850 pst title=[[Who, me? (context)]]
13851 !! wikitext
13852 [[|Yes, you.]]
13853 [[Me, Myself, and I (1937 song)|]]
13854 !! html/php
13855 [[Yes, you. (context)|Yes, you.]]
13856 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
13857 !! end
13858
13859 !! test
13860 pre-save transform: context links ("pipe trick") with namespace
13861 !! options
13862 pst title=[[Ns:Somearticle]]
13863 !! wikitext
13864 [[|Article]]
13865 !! html/php
13866 [[Ns:Article|Article]]
13867 !! end
13868
13869 !! test
13870 pre-save transform: context links ("pipe trick") with namespace and parens
13871 !! options
13872 pst title=[[Ns:Somearticle (context)]]
13873 !! wikitext
13874 [[|Article]]
13875 !! html/php
13876 [[Ns:Article (context)|Article]]
13877 !! end
13878
13879 !! test
13880 pre-save transform: context links ("pipe trick") with namespace and comma
13881 !! options
13882 pst title=[[Ns:Somearticle, Context, Whatever]]
13883 !! wikitext
13884 [[|Article]]
13885 !! html/php
13886 [[Ns:Article, Context, Whatever|Article]]
13887 !! end
13888
13889 !! test
13890 pre-save transform: context links ("pipe trick") with namespace, comma and parens
13891 !! options
13892 pst title=[[Ns:Somearticle, Context (context)]]
13893 !! wikitext
13894 [[|Article]]
13895 !! html/php
13896 [[Ns:Article (context)|Article]]
13897 !! end
13898
13899 !! test
13900 pre-save transform: context links ("pipe trick") with namespace, parens and comma
13901 !! options
13902 pst title=[[Ns:Somearticle (IGNORED), Context]]
13903 !! wikitext
13904 [[|Article]]
13905 !! html/php
13906 [[Ns:Article, Context|Article]]
13907 !! end
13908
13909 !! test
13910 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, T32149)
13911 !! options
13912 pst
13913 !! wikitext
13914 [[Article(context)|]]
13915 [[Bar:Article(context)|]]
13916 [[:Bar:Article(context)|]]
13917 [[|Article(context)]]
13918 [[Bar:X(Y)Z|]]
13919 [[:Bar:X(Y)Z|]]
13920 !! html/php
13921 [[Article(context)|Article]]
13922 [[Bar:Article(context)|Article]]
13923 [[:Bar:Article(context)|Article]]
13924 [[Article(context)]]
13925 [[Bar:X(Y)Z|X(Y)Z]]
13926 [[:Bar:X(Y)Z|X(Y)Z]]
13927 !! end
13928
13929 !! test
13930 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, T32149)
13931 !! options
13932 pst
13933 !! wikitext
13934 [[Article (context)|]]
13935 [[Bar:Article (context)|]]
13936 [[:Bar:Article (context)|]]
13937 [[|Article (context)]]
13938 [[Bar:X (Y) Z|]]
13939 [[:Bar:X (Y) Z|]]
13940 !! html/php
13941 [[Article (context)|Article]]
13942 [[Bar:Article (context)|Article]]
13943 [[:Bar:Article (context)|Article]]
13944 [[Article (context)]]
13945 [[Bar:X (Y) Z|X (Y) Z]]
13946 [[:Bar:X (Y) Z|X (Y) Z]]
13947 !! end
13948
13949 !! test
13950 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, T32149)
13951 !! options
13952 pst
13953 !! wikitext
13954 [[Article(context)|]]
13955 [[Bar:Article(context)|]]
13956 [[:Bar:Article(context)|]]
13957 [[|Article(context)]]
13958 [[Bar:X(Y)Z|]]
13959 [[:Bar:X(Y)Z|]]
13960 !! html/php
13961 [[Article(context)|Article]]
13962 [[Bar:Article(context)|Article]]
13963 [[:Bar:Article(context)|Article]]
13964 [[Article(context)]]
13965 [[Bar:X(Y)Z|X(Y)Z]]
13966 [[:Bar:X(Y)Z|X(Y)Z]]
13967 !! end
13968
13969 !! test
13970 pre-save transform: context links ("pipe trick") with commas (T23660)
13971 !! options
13972 pst
13973 !! wikitext
13974 [[Article (context), context|]]
13975 [[Article (context),context|]]
13976 [[Bar:Article (context), context|]]
13977 [[Bar:Article (context),context|]]
13978 [[:Bar:Article (context), context|]]
13979 [[:Bar:Article (context),context|]]
13980 !! html/php
13981 [[Article (context), context|Article]]
13982 [[Article (context),context|Article]]
13983 [[Bar:Article (context), context|Article]]
13984 [[Bar:Article (context),context|Article]]
13985 [[:Bar:Article (context), context|Article]]
13986 [[:Bar:Article (context),context|Article]]
13987 !! end
13988
13989 !! test
13990 Parsoid: backwards pipe trick
13991 !! wikitext
13992 [[|'''bar''']]
13993 !! html/php
13994 <p>[[|<b>bar</b>]]
13995 </p>
13996 !! html/parsoid
13997 <p>[[|<b>bar</b>]]</p>
13998 !! end
13999
14000 !! test
14001 pre-save transform: trim trailing empty lines
14002 !! options
14003 pst
14004 !! wikitext
14005 Empty lines are trimmed
14006
14007
14008
14009
14010 !! html/php
14011 Empty lines are trimmed
14012 !! end
14013
14014 !! test
14015 pre-save transform: Signature expansion
14016 !! options
14017 pst
14018 !! wikitext
14019 * ~~~
14020 * ~~~~
14021 * ~~~~~
14022 * <noinclude>~~~</noinclude>
14023 * <includeonly>~~~</includeonly>
14024 * <onlyinclude>~~~</onlyinclude>
14025 !! html/php
14026 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
14027 * [[Special:Contributions/127.0.0.1|127.0.0.1]] 00:02, 1 January 1970 (UTC)
14028 * 00:02, 1 January 1970 (UTC)
14029 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
14030 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
14031 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
14032 !! end
14033
14034
14035 !! test
14036 ParserOutput flags from signature expansion (T84843)
14037 !! options
14038 pst
14039 showflags
14040 !! wikitext
14041 ~~~~
14042 !! html/php
14043 [[Special:Contributions/127.0.0.1|127.0.0.1]] 00:02, 1 January 1970 (UTC)
14044 flags=user-signature
14045 !! end
14046
14047
14048 !! test
14049 pre-save transform: Signature expansion in nowiki tags (T2093)
14050 !! options
14051 pst disabled
14052 !! wikitext
14053 Shall not expand:
14054
14055 <nowiki>~~~~</nowiki>
14056
14057 <includeonly><nowiki>~~~~</nowiki></includeonly>
14058
14059 <noinclude><nowiki>~~~~</nowiki></noinclude>
14060
14061 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
14062
14063 {{subst:Foo}} shall be converted to FOO
14064
14065 As well as inside noinclude/onlyinclude
14066 <noinclude>{{subst:Foo}}</noinclude>
14067 <onlyinclude>{{subst:Foo}}</onlyinclude>
14068
14069 But not inside includeonly
14070 <includeonly>{{subst:Foo}}</includeonly>
14071 !! html/php
14072 Shall not expand:
14073
14074 <nowiki>~~~~</nowiki>
14075
14076 <includeonly><nowiki>~~~~</nowiki></includeonly>
14077
14078 <noinclude><nowiki>~~~~</nowiki></noinclude>
14079
14080 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
14081
14082 FOO shall be converted to FOO
14083
14084 As well as inside noinclude/onlyinclude
14085 <noinclude>FOO</noinclude>
14086 <onlyinclude>FOO</onlyinclude>
14087
14088 But not inside includeonly
14089 <includeonly>{{subst:Foo}}</includeonly>
14090 !! end
14091
14092 !! test
14093 Parsoid: Recognize nowiki with trailing space in tags
14094 !! options
14095 parsoid=wt2html
14096 !! wikitext
14097 <nowiki ><div>[[foo]]</nowiki >
14098
14099 a<nowiki / >b
14100
14101 c<nowiki />d
14102
14103 e<nowiki/ >f
14104 !! html
14105 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
14106 <p>ab</p>
14107 <p>cd</p>
14108 <p>ef</p>
14109 !! end
14110
14111 !! test
14112 Parsoid: Recognize nowiki with odd capitalization
14113 !! options
14114 parsoid=wt2html
14115 !! wikitext
14116 <noWikI ><div>[[foo]]</Nowiki >
14117 !! html
14118 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
14119 !! end
14120
14121
14122 !! test
14123 Parsoid: Escape nowiki with trailing space in tags
14124 !! options
14125 parsoid=html2wt
14126 !! html/parsoid
14127 <p>&lt;nowiki &gt; foo &lt/nowiki ></p>
14128 <p>a&lt;nowiki /&gt;b</p>
14129 <p>c&lt;nowiki/ &gt;d</p>
14130 !! wikitext
14131 &lt;nowiki &gt; foo &lt;/nowiki &gt;
14132
14133 a&lt;nowiki /&gt;b
14134
14135 c&lt;nowiki/ &gt;d
14136 !! end
14137
14138 !! test
14139 Parsoid: Escape weird noWikI capitalizations
14140 !! options
14141 parsoid=html2wt
14142 !! html/parsoid
14143 <p>&lt;noWikI &gt; foo &lt/NoWikI ></p>
14144 !! wikitext
14145 &lt;noWikI &gt; foo &lt;/NoWikI &gt;
14146 !! end
14147
14148 ###
14149 ### Message transform tests
14150 ###
14151 !! test
14152 message transform: magic variables
14153 !! options
14154 msg
14155 !! wikitext
14156 {{SITENAME}}
14157 !! html
14158 MediaWiki
14159 !! end
14160
14161 !! test
14162 message transform: should not transform wiki markup
14163 !! options
14164 msg
14165 !! wikitext
14166 ''test''
14167 !! html
14168 ''test''
14169 !! end
14170
14171 !! test
14172 message transform: <noinclude> in transcluded template (T6926)
14173 !! options
14174 msg
14175 !! wikitext
14176 {{Includes}}
14177 !! html
14178 Foobar
14179 !! end
14180
14181 !! test
14182 message transform: <onlyinclude> in transcluded template (T6926)
14183 !! options
14184 msg
14185 !! wikitext
14186 {{Includes2}}
14187 !! html
14188 Foo
14189 !! end
14190
14191 !! test
14192 {{#special:}} page name, known
14193 !! options
14194 msg
14195 !! wikitext
14196 {{#special:Recentchanges}}
14197 !! html
14198 Special:RecentChanges
14199 !! end
14200
14201 !! test
14202 {{#special:}} page name with subpage, known
14203 !! options
14204 msg
14205 !! wikitext
14206 {{#special:Recentchanges/param}}
14207 !! html
14208 Special:RecentChanges/param
14209 !! end
14210
14211 !! test
14212 {{#special:}} page name, unknown
14213 !! options
14214 msg
14215 !! wikitext
14216 {{#special:foobar nonexistent}}
14217 !! html
14218 Special:Foobar nonexistent
14219 !! end
14220
14221 !! test
14222 {{#speciale:}} page name, known
14223 !! options
14224 msg
14225 !! wikitext
14226 {{#speciale:Recentchanges}}
14227 !! html
14228 Special:RecentChanges
14229 !! end
14230
14231 !! test
14232 {{#speciale:}} page name with subpage, known
14233 !! options
14234 msg
14235 !! wikitext
14236 {{#speciale:Recentchanges/param}}
14237 !! html
14238 Special:RecentChanges/param
14239 !! end
14240
14241 !! test
14242 {{#speciale:}} page name, unknown
14243 !! options
14244 msg
14245 !! wikitext
14246 {{#speciale:foobar nonexistent}}
14247 !! html
14248 Special:Foobar_nonexistent
14249 !! end
14250
14251 ###
14252 ### Images
14253 ###
14254 ### For Parsoid-specific tests, see
14255 #### https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
14256
14257 !! test
14258 Simple image
14259 !! options
14260 parsoid=wt2html,wt2wt,html2html
14261 !! wikitext
14262 [[Image:foobar.jpg]]
14263 !! html/php
14264 <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>
14265 </p>
14266 !! html/parsoid
14267 <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>
14268 !! end
14269
14270 !! test
14271 Serialize simple image with figure-inline wrapper
14272 !! options
14273 parsoid=html2wt
14274 !! html/parsoid
14275 <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>
14276 !! wikitext
14277 [[File:Foobar.jpg]]
14278 !! end
14279
14280 !! test
14281 Simple image (using File: namespace, now canonical)
14282 !! wikitext
14283 [[File:Foobar.jpg]]
14284 !! html/php
14285 <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>
14286 </p>
14287 !! html/parsoid
14288 <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>
14289 !! end
14290
14291 !! test
14292 Right-aligned image
14293 !! wikitext
14294 [[File:Foobar.jpg|right]]
14295 !! html/php
14296 <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>
14297
14298 !! html/parsoid
14299 <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>
14300 !! end
14301
14302 !! test
14303 Image with caption
14304 !! wikitext
14305 [[File:Foobar.jpg|right|Caption text]]
14306 !! html/php
14307 <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>
14308
14309 !! html/parsoid
14310 <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>
14311 !! end
14312
14313 !! test
14314 Image with caption, T55312 #1
14315 !! wikitext
14316 [[File:Foobar.jpg|right|Caption page stuff]]
14317 !! html/php
14318 <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>
14319
14320 !! html/parsoid
14321 <figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>Caption page stuff</figcaption></figure>
14322 !! end
14323
14324 !! test
14325 Image with caption, T55312 #2
14326 !! wikitext
14327 [[File:Foobar.jpg|right|Caption page=]]
14328 !! html/php
14329 <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>
14330
14331 !! html/parsoid
14332 <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>
14333 !! end
14334
14335 !! test
14336 Image with caption, T55312 #3
14337 !! wikitext
14338 [[File:Foobar.jpg|right|Caption page=stuff]]
14339 !! html/php
14340 <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>
14341
14342 !! html/parsoid
14343 <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>
14344 !! end
14345
14346 !! test
14347 Image caption with pipe entity
14348 !! wikitext
14349 [[File:Foobar.jpg|thumb|one &#x7C; two]]
14350 [[File:Foobar.jpg|thumb|one ''two'' &#x7C; three]]
14351 !! html/php
14352 <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>
14353 <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>
14354
14355 !! html/parsoid
14356 <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>
14357 <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>
14358 !! end
14359
14360 !! test
14361 Allow empty links in image captions (T62753)
14362 !! options
14363 thumbsize=220
14364 !! wikitext
14365 [[File:Foobar.jpg|thumb|Caption [[Link1]]
14366 [[]]
14367 [[Link2]]
14368 ]]
14369 !! html/php
14370 <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>
14371
14372 !! html/parsoid
14373 <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>
14374 [[]]
14375 <a rel="mw:WikiLink" href="./Link2" title="Link2" data-parsoid='{"stx":"simple","a":{"href":"./Link2"},"sa":{"href":"Link2"}}'>Link2</a>
14376 </figcaption></figure>
14377 !! end
14378
14379 !! test
14380 Titles in unlinked images (T23454)
14381 !! wikitext
14382 [[File:Foobar.jpg|link=|stuff]]
14383 !! html/php
14384 <p><img alt="stuff" src="http://example.com/images/3/3a/Foobar.jpg" title="stuff" width="1941" height="220" />
14385 </p>
14386 !! end
14387
14388 !! test
14389 Link with empty target
14390 !! wikitext
14391 [[]]
14392 !! html
14393 <p>[[]]
14394 </p>
14395 !! end
14396
14397 !! test
14398 Image with link trail
14399 !! wikitext
14400 Linktrails should not work for images: [[File:Foobar.jpg]]s
14401 !! html/php
14402 <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
14403 </p>
14404 !! html/parsoid
14405 <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>
14406 !! end
14407
14408 !! test
14409 Image with empty attribute
14410 !! options
14411 parsoid=wt2html,wt2wt,html2html
14412 !! wikitext
14413 [[File:Foobar.jpg|right||Caption text]]
14414 !! html/php
14415 <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>
14416
14417 !! html/parsoid
14418 <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>
14419 !! end
14420
14421 !! test
14422 1. Block image with individual attributes from templates
14423 !! wikitext
14424 [[File:Foobar.jpg|thumb|{{echo|137px}}|This is a caption]]
14425 !! html/php
14426 <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>
14427
14428 !! html/parsoid
14429 <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>
14430 !! end
14431
14432 !! test
14433 2. Block Image with individual attributes from templates
14434 !! wikitext
14435 [[File:Foobar.jpg|{{echo|thumb}}|{{echo|137px}}|This is a caption]]
14436 !! html/php
14437 <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>
14438
14439 !! html/parsoid
14440 <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>
14441 !! end
14442
14443 !! test
14444 3. Inline image with individual attributes from templates
14445 !! wikitext
14446 [[File:Foobar.jpg|{{echo|50px}}]]
14447 !! html/php
14448 <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>
14449 </p>
14450 !! html/parsoid
14451 <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>
14452 !! end
14453
14454 ## Parsoid does not provide editing support for images where templates produce multiple image attributes.
14455 ## To signal this, we add a 'mw:Placeholder' type to such images. This could change in the future.
14456 !! test
14457 Image with multiple attributes from the same template
14458 !! wikitext
14459 [[File:Foobar.jpg|{{image_attribs}}]]
14460 !! html/php
14461 <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>
14462
14463 !! html/parsoid
14464 <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>
14465 !! end
14466
14467 !! test
14468 Image with link tails
14469 !! options
14470 thumbsize=220
14471 !! wikitext
14472 123[[File:Foobar.jpg]]456
14473 123[[File:Foobar.jpg|right]]456
14474 123[[File:Foobar.jpg|thumb]]456
14475 !! html/php
14476 <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
14477 </p>
14478 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
14479 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
14480
14481 !! html/php+tidy
14482 <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>
14483 <p>123</p>
14484 <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>
14485 <p>456 123</p>
14486 <div class="thumb tright">
14487 <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>
14488 <div class="thumbcaption">
14489 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
14490 </div>
14491 </div>
14492 </div>
14493 <p>456</p>
14494 !! html/parsoid
14495 <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>
14496 <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>
14497 <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>
14498 !! end
14499
14500 !! test
14501 Image with multiple captions -- only last one is accepted
14502 !! wikitext
14503 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
14504 !! html/php
14505 <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>
14506
14507 !! html/parsoid
14508 <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>
14509 !! end
14510
14511 !! test
14512 Image with multiple widths -- use last
14513 !! wikitext
14514 [[File:Foobar.jpg|200px|300px|caption]]
14515 !! html/php
14516 <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>
14517 </p>
14518 !! html/parsoid
14519 <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>
14520 !! end
14521
14522 !! test
14523 Image with multiple alignments -- use first (T50664)
14524 !! options
14525 thumbsize=220
14526 !! wikitext
14527 [[File:Foobar.jpg|thumb|left|right|center|caption]]
14528
14529 [[File:Foobar.jpg|middle|text-top|caption]]
14530 !! html/php
14531 <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>
14532 <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>
14533 </p>
14534 !! html/parsoid
14535 <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>
14536 <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>
14537 !! end
14538
14539 !! test
14540 Image with width attribute at different positions
14541 !! wikitext
14542 [[File:Foobar.jpg|200px|right|Caption]]
14543 [[File:Foobar.jpg|right|200px|Caption]]
14544 [[File:Foobar.jpg|right|Caption|200px]]
14545 !! html/php
14546 <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>
14547 <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>
14548 <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>
14549
14550 !! html/parsoid
14551 <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>
14552 <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>
14553 <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>
14554 !! end
14555
14556 # a sad bit of backward-compatibility
14557 !! test
14558 Image with size specified with pxpx (T15500, T53628)
14559 !! options
14560 parsoid=wt2html,wt2wt,html2html
14561 !! wikitext
14562 [[File:Foobar.jpg|20pxpx]]
14563 [[File:Foobar.jpg|200x20pxpx]]
14564 !! html/php
14565 <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>
14566 <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>
14567 </p>
14568 !! html/parsoid
14569 <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>
14570 !! end
14571
14572 !! test
14573 Image with link parameter, wiki target
14574 !! wikitext
14575 [[File:Foobar.jpg|link=Main Page]]
14576 !! html/php
14577 <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>
14578 </p>
14579 !! html/parsoid
14580 <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>
14581 !! end
14582
14583 # parsoid T51293 (part 1)
14584 !! test
14585 Image with link parameter, URL target
14586 !! wikitext
14587 [[File:Foobar.jpg|link=http://example.com/]]
14588 !! html/php
14589 <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>
14590 </p>
14591 !! html/parsoid
14592 <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>
14593 !! end
14594
14595 # parsoid T51293 (part 2)
14596 !! test
14597 Image with link parameter, protocol-less URL target
14598 !! wikitext
14599 [[File:Foobar.jpg|link=//example.com/]]
14600 !! html/php
14601 <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>
14602 </p>
14603 !! html/parsoid
14604 <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>
14605 !! end
14606
14607 !! test
14608 Escaping non-block captions (T107435)
14609 !! options
14610 parsoid={
14611 "modes": ["wt2wt"],
14612 "changes": [
14613 ["[typeof~='mw:Image']", "attr", "data-mw", "{\"caption\": \"|\"}"]
14614 ]
14615 }
14616 !! wikitext
14617 [[Image:Foobar.jpg|caption]]
14618 !! wikitext/edited
14619 [[Image:Foobar.jpg|<nowiki>|</nowiki>]]
14620 !! end
14621
14622 # wgExternalLinkTarget not supported by Parsoid
14623 !! test
14624 Image with link parameter, wgExternalLinkTarget
14625 !! wikitext
14626 [[Image:foobar.jpg|link=http://example.com/]]
14627 !! config
14628 wgExternalLinkTarget='foobar'
14629 !! html/php
14630 <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>
14631 </p>
14632 !! end
14633
14634 !! test
14635 Image with link parameter, wgNoFollowLinks set to false
14636 !! wikitext
14637 [[Image:foobar.jpg|link=http://example.com/]]
14638 !! config
14639 wgNoFollowLinks=false
14640 !! html
14641 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
14642 </p>
14643 !! end
14644
14645 !! test
14646 Image with link parameter, wgNoFollowDomainExceptions
14647 !! wikitext
14648 [[Image:foobar.jpg|link=http://example.com/]]
14649 !! config
14650 wgNoFollowDomainExceptions='example.com'
14651 !! html
14652 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
14653 </p>
14654 !! end
14655
14656 # wgExternalLinkTarget not supported by Parsoid
14657 !! test
14658 Image with link parameter, wgExternalLinkTarget, unnamed parameter
14659 !! wikitext
14660 [[Image:foobar.jpg|link=http://example.com/|Title]]
14661 !! config
14662 wgExternalLinkTarget='foobar'
14663 !! html/php
14664 <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>
14665 </p>
14666 !! end
14667
14668 !! test
14669 Image with empty link parameter
14670 !! wikitext
14671 [[File:Foobar.jpg|link=]]
14672 !! html/php
14673 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
14674 </p>
14675 !! html/parsoid
14676 <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>
14677 !! end
14678
14679 !! test
14680 Image with link parameter (wiki target) and unnamed parameter
14681 !! wikitext
14682 [[File:Foobar.jpg|link=Main_Page|Title]]
14683 !! html/php
14684 <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>
14685 </p>
14686 !! html/parsoid
14687 <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>
14688 !! end
14689
14690 !! test
14691 Image with link parameter (URL target) and unnamed parameter
14692 !! wikitext
14693 [[File:Foobar.jpg|link=http://example.com/|Title]]
14694 !! html/php
14695 <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>
14696 </p>
14697 !! html/parsoid
14698 <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>
14699 !! end
14700
14701 !! test
14702 Thumbnail image with link parameter
14703 !! options
14704 thumbsize=220
14705 parsoid=wt2html,wt2wt,html2html
14706 !! wikitext
14707 [[File:Foobar.jpg|thumb|link=http://example.com/|Title]]
14708 !! html/php
14709 <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>
14710
14711 !! html/parsoid
14712 <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>
14713 !! end
14714
14715 !! test
14716 Manually-specified thumbnail image
14717 !! options
14718 thumbsize=220
14719 !! wikitext
14720 [[File:Foobar.jpg|thumbnail=Thumb.png|Title]]
14721 !! html/php
14722 <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>
14723
14724 !! html/parsoid
14725 <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>
14726 !! end
14727
14728 !! test
14729 Manually-specified thumbnail image with explicit link to wiki page
14730 !! options
14731 thumbsize=220
14732 parsoid=wt2html,wt2wt,html2html
14733 !! wikitext
14734 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|Title]]
14735 !! html/php
14736 <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>
14737
14738 !! html/parsoid
14739 <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>
14740 !! end
14741
14742 !! test
14743 Manually-specified thumbnail image with explicit link to url
14744 !! options
14745 thumbsize=220
14746 parsoid=wt2html,wt2wt,html2html
14747 !! wikitext
14748 [[File:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
14749 !! html/php
14750 <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>
14751
14752 !! html/parsoid
14753 <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>
14754 !! end
14755
14756 !! test
14757 Manually-specified thumbnail image with explicit no link
14758 !! options
14759 thumbsize=220
14760 parsoid=wt2html,wt2wt,html2html
14761 !! wikitext
14762 [[File:Foobar.jpg|thumb=Thumb.png|link=|Title]]
14763 !! html/php
14764 <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>
14765
14766 !! html/parsoid
14767 <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>
14768 !! end
14769
14770 !! test
14771 Manually-specified thumbnail image with explicit link and alt text
14772 !! options
14773 thumbsize=220
14774 parsoid=wt2html,wt2wt,html2html
14775 !! wikitext
14776 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|alt=alttext|Title]]
14777 !! html/php
14778 <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>
14779
14780 !! html/parsoid
14781 <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>
14782 !! end
14783
14784 !! test
14785 Image with frame and link
14786 !! options
14787 parsoid=wt2html,wt2wt,html2html
14788 !! wikitext
14789 [[File:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
14790 !! html/php
14791 <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>
14792
14793 !! html/parsoid
14794 <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>
14795 !! end
14796
14797 !! test
14798 Image with frame and link and explicit alt
14799 !! options
14800 parsoid=wt2html,wt2wt,html2html
14801 !! wikitext
14802 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
14803 !! html/php
14804 <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>
14805
14806 !! html/parsoid
14807 <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>
14808 !! end
14809
14810 !! test
14811 Image with wiki markup in implicit alt
14812 !! wikitext
14813 [[Image:Foobar.jpg|testing '''bold''' in alt]]
14814
14815 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
14816 !! html/php
14817 <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>
14818 </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>
14819 </p>
14820 !! html/parsoid
14821 <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>
14822
14823 <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>
14824 !! end
14825
14826 !! test
14827 Alt image option should handle most kinds of wikitext without barfing
14828 !! wikitext
14829 [[Image:Foobar.jpg|thumb|This is the image caption|alt=This is a [[link]] and a {{echo|''bold template''}}.]]
14830 !! html/php
14831 <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>
14832
14833 !! html/parsoid
14834 <figure class="mw-default-size" typeof="mw:Image/Thumb mw:ExpandedAttrs" about="#mwt2" data-parsoid='{"optList":[{"ck":"thumbnail","ak":"thumb"},{"ck":"caption","ak":"This is the image caption"},{"ck":"alt","ak":"alt=This is a [[link]] and a {{echo|&apos;&apos;bold template&apos;&apos;}}."}]}' data-mw='{"attribs":[["thumbnail",{"html":"thumb"}],["alt",{"html":"alt=This is a &lt;a rel=\"mw:WikiLink\" href=\"./Link\" title=\"Link\" data-parsoid=&apos;{\"stx\":\"simple\",\"a\":{\"href\":\"./Link\"},\"sa\":{\"href\":\"link\"},\"dsr\":[65,73,2,2]}&apos;>link&lt;/a> and a &lt;i about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&apos;{\"dsr\":[80,106,null,null],\"pi\":[[{\"k\":\"1\"}]]}&apos; data-mw=&apos;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"&amp;apos;&amp;apos;bold template&amp;apos;&amp;apos;\"}},\"i\":0}}]}&#39;>bold template&lt;/i>."}]]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img alt="This is a link and a bold template." resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220" data-parsoid='{"a":{"alt":"This is a link and a bold template.","resource":"./File:Foobar.jpg","height":"25","width":"220"},"sa":{"alt":"alt=This is a [[link]] and a {{echo|&#39;&#39;bold template&#39;&#39;}}.","resource":"Image:Foobar.jpg"}}'/></a><figcaption>This is the image caption</figcaption></figure>
14835 !! end
14836
14837 !! test
14838 Image with table with attributes in caption
14839 !! options
14840 parsoid=wt2html,html2html
14841 !! wikitext
14842 [[File:Foobar.jpg|thumb|
14843 {| class="123" |
14844 |- class="456" |
14845 | ha
14846 |}
14847 ]]
14848 !! html/parsoid
14849 <figure class="mw-default-size" typeof="mw:Image/Thumb" data-parsoid='{"optList":[{"ck":"thumbnail","ak":"thumb"},{"ck":"caption","ak":"\n{| class=\"123\" |\n|- class=\"456\" |\n| ha\n|}\n"}]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{"href":"File:Foobar.jpg"}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"25","width":"220"},"sa":{"resource":"File:Foobar.jpg"}}'/></a><figcaption>
14850 <table class="123">
14851 <tbody><tr class="456" data-parsoid='{"startTagSrc":"|-"}'>
14852 <td> ha</td></tr>
14853 </tbody></table>
14854 </figcaption></figure>
14855 !! end
14856
14857 !! test
14858 Image with table with rows from templates in caption
14859 !! wikitext
14860 [[File:Foobar.jpg|thumb|
14861 {|
14862 {{echo|{{!}} hi}}
14863 |}
14864 ]]
14865 !! html/parsoid
14866 <figure class="mw-default-size" typeof="mw:Image/Thumb" data-parsoid='{"optList":[{"ck":"thumbnail","ak":"thumb"},{"ck":"caption","ak":"\n{|\n{{echo|{{!}} hi}}\n|}\n"}]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{"href":"File:Foobar.jpg"}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"25","width":"220"},"sa":{"resource":"File:Foobar.jpg"}}'/></a><figcaption>
14867 <table>
14868 <tbody about="#mwt4" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"{{!}} hi"}},"i":0}},"\n"]}'><tr><td> hi</td></tr>
14869 </tbody></table>
14870 </figcaption></figure>
14871 !! end
14872
14873 !! test
14874 Image with nested tables in caption
14875 !! wikitext
14876 [[File:Foobar.jpg|thumb|Foo<br />
14877 {|
14878 |
14879 {|
14880 |z
14881 |}
14882 |}
14883 ]]
14884 !! html/parsoid
14885 <figure class="mw-default-size" typeof="mw:Image/Thumb" data-parsoid='{"optList":[{"ck":"thumbnail","ak":"thumb"},{"ck":"caption","ak":"Foo&lt;br/>\n{|\n|\n{|\n|z\n|}\n|}\n"}]}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"25","width":"220"},"sa":{"resource":"File:Foobar.jpg"}}'/></a><figcaption data-parsoid='{"dsr":[null,50,null,null]}'>Foo<br data-parsoid='{"stx":"html","selfClose":true}'/>
14886 <table>
14887 <tbody><tr><td>
14888 <table>
14889 <tbody><tr><td>z</td></tr>
14890 </tbody></table></td></tr>
14891 </tbody></table>
14892 </figcaption></figure>
14893 !! end
14894
14895 ###################
14896 # Conflicting image format options.
14897 # First option specified should 'win'.
14898 # All three cases in each test should be identical.
14899
14900 !! test
14901 Image with 'frameless' first.
14902 !! options
14903 parsoid=wt2html,wt2wt,html2html
14904 !! wikitext
14905 [[File:Foobar.jpg|frameless|caption]]
14906
14907 [[File:Foobar.jpg|frameless|frame|caption]]
14908
14909 [[File:Foobar.jpg|frameless|thumb|caption]]
14910 !! html/php
14911 <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>
14912 </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>
14913 </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>
14914 </p>
14915 !! html/parsoid
14916 <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>
14917 <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>
14918 <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>
14919 !! end
14920
14921 !! test
14922 Image with 'frame' first.
14923 !! options
14924 parsoid=wt2html,wt2wt,html2html
14925 !! wikitext
14926 [[File:Foobar.jpg|frame|caption]]
14927 [[File:Foobar.jpg|frame|frameless|caption]]
14928 [[File:Foobar.jpg|frame|thumb|caption]]
14929 !! html/php
14930 <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>
14931 <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>
14932 <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>
14933
14934 !! html/parsoid
14935 <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>
14936 <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>
14937 <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>
14938 !! end
14939
14940 !! test
14941 Image with 'thumb' first.
14942 !! options
14943 parsoid=wt2html,wt2wt,html2html
14944 !! wikitext
14945 [[File:Foobar.jpg|thumb|caption]]
14946 [[File:Foobar.jpg|thumb|frameless|caption]]
14947 [[File:Foobar.jpg|thumb|frame|caption]]
14948 !! html/php
14949 <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>
14950 <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>
14951 <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>
14952
14953 !! html/parsoid
14954 <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>
14955 <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>
14956 <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>
14957 !! end
14958
14959 ###################
14960 # Image sizing.
14961 # See https://www.mediawiki.org/wiki/Help:Images#Size_and_frame
14962 # and https://phabricator.wikimedia.org/T64258
14963 # Foobar has actual size of 1941x220
14964 # 1. Thumbs & frameless always reduce, can't be enlarged unless it's
14965 # a scalable format.
14966 # 2. Framed images always ignore size options; always render at default size.
14967 # 3. "Unspecified format" and border are the only types which can be
14968 # enlarged.
14969
14970 !! test
14971 Image: unspecified format and border enlarge
14972 !! options
14973 parsoid=wt2html,wt2wt,html2html
14974 !! wikitext
14975 [[File:Foobar.jpg|2000px]]
14976
14977 [[File:Foobar.jpg|border|2000px]]
14978 !! html/php
14979 <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>
14980 </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>
14981 </p>
14982 !! html/parsoid
14983 <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>
14984 <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>
14985 !! end
14986
14987 !! test
14988 Image: "unspecified format" and border reduce
14989 !! options
14990 parsoid=wt2html,wt2wt,html2html
14991 !! wikitext
14992 [[File:Foobar.jpg|1000px]]
14993
14994 [[File:Foobar.jpg|border|1000px]]
14995 !! html/php
14996 <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>
14997 </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>
14998 </p>
14999 !! html/parsoid
15000 <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>
15001 <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>
15002 !! end
15003
15004 !! test
15005 Image: thumbs reduce
15006 !! options
15007 parsoid=wt2html,wt2wt,html2html
15008 !! wikitext
15009 [[File:Foobar.jpg|thumb|50px]]
15010 !! html/php
15011 <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>
15012
15013 !! html/parsoid
15014 <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>
15015 !! end
15016
15017 !! test
15018 Image: bitmap thumbs can't be enlarged past original size, but vector can.
15019 !! options
15020 parsoid=wt2html,wt2wt,html2html
15021 !! wikitext
15022 [[File:Foobar.jpg|thumb|2000px]]
15023
15024 [[File:Foobar.svg|thumb|2000px]]
15025 !! html/php
15026 <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>
15027 <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>
15028
15029 !! html/parsoid
15030 <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>
15031 <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>
15032 !! end
15033
15034 !! test
15035 Image: frameless can reduce in size
15036 !! options
15037 parsoid=wt2html,wt2wt,html2html
15038 !! wikitext
15039 [[File:Foobar.jpg|frameless|50px]]
15040 !! html/php
15041 <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>
15042 </p>
15043 !! html/parsoid
15044 <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>
15045 !! end
15046
15047 !! test
15048 Image: bitmap frameless can't be enlarged past original size, but vector can
15049 !! options
15050 parsoid=wt2html,wt2wt,html2html
15051 !! wikitext
15052 [[File:Foobar.jpg|frameless|2000px]]
15053
15054 [[File:Foobar.svg|frameless|2000px]]
15055 !! html/php
15056 <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>
15057 </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>
15058 </p>
15059 !! html/parsoid
15060 <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>
15061 <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>
15062 !! end
15063
15064 !! test
15065 Image: framed images are always unscaled.
15066 !! options
15067 parsoid=wt2html,wt2wt,html2html
15068 !! wikitext
15069 [[File:Foobar.jpg|frame]]
15070
15071 [[File:Foobar.jpg|frame|50px]]
15072
15073 [[File:Foobar.jpg|frame|50x50px]]
15074
15075 [[File:Foobar.jpg|frame|2000px]]
15076 !! html/php
15077 <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>
15078 <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>
15079 <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>
15080 <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>
15081
15082 !! html/parsoid
15083 <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>
15084 <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>
15085 <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>
15086 <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>
15087 !! end
15088
15089 ###################
15090
15091 !! test
15092 Link to image page- image page normally doesn't exists, hence edit link
15093 Add test with existing image page
15094 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
15095 !! wikitext
15096 [[:Image:test]]
15097 !! html
15098 <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>
15099 </p>
15100 !! end
15101
15102 !! test
15103 T20784 Link to non-existent image page with caption should use caption as link text
15104 !! wikitext
15105 [[:Image:test|caption]]
15106 !! html
15107 <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>
15108 </p>
15109 !! end
15110
15111 !! test
15112 Frameless image caption with a free URL
15113 !! wikitext
15114 [[File:Foobar.jpg|http://example.com]]
15115 !! html/php
15116 <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>
15117 </p>
15118 !! html/parsoid
15119 <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>
15120 !! end
15121
15122 !! test
15123 Thumbnail image caption with a free URL
15124 !! options
15125 thumbsize=220
15126 !! wikitext
15127 [[File:Foobar.jpg|thumb|http://example.com]]
15128 !! html/php
15129 <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>
15130
15131 !! html/parsoid
15132 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></figcaption></figure>
15133 !! end
15134
15135 !! test
15136 Thumbnail image caption with a free URL and explicit alt
15137 !! options
15138 thumbsize=220
15139 parsoid=wt2html,wt2wt,html2html
15140 !! wikitext
15141 [[File:Foobar.jpg|thumb|http://example.com|alt=Alteration]]
15142 !! html/php
15143 <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>
15144
15145 !! html/parsoid
15146 <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>
15147 !! end
15148
15149 !! test
15150 SVG thumbnails with no language set
15151 !! options
15152 !! wikitext
15153 [[File:Foobar.svg|thumb|caption]]
15154 !! html/php
15155 <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>
15156
15157 !! html/parsoid
15158 <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>
15159 !! end
15160
15161 !! test
15162 SVG thumbnails with language de
15163 !! options
15164 parsoid=wt2html,wt2wt,html2html
15165 !! wikitext
15166 [[File:Foobar.svg|thumb|caption|lang=de]]
15167 !! html/php
15168 <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>
15169
15170 !! html/parsoid
15171 <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>
15172 !! end
15173
15174 !! test
15175 SVG thumbnails with invalid language code
15176 !! options
15177 parsoid=wt2html,wt2wt,html2html
15178 !! wikitext
15179 [[File:Foobar.svg|thumb|caption|lang=invalid:language:code]]
15180 !! html/php
15181 <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>
15182
15183 !! html/parsoid
15184 <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>
15185 !! end
15186
15187 !! test
15188 T3887: A ISBN with a thumbnail
15189 !! wikitext
15190 [[File:Foobar.jpg|thumb|ISBN 1235467890]]
15191 !! html/php
15192 <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>
15193
15194 !! html/parsoid
15195 <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>
15196 !! end
15197
15198 !! test
15199 T3887: A RFC with a thumbnail
15200 !! wikitext
15201 [[File:Foobar.jpg|thumb|This is RFC 12354]]
15202 !! html/php
15203 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>This is <a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc12354">RFC 12354</a></div></div></div>
15204
15205 !! html/parsoid
15206 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>This is <a href="https://tools.ietf.org/html/rfc12354" rel="mw:ExtLink">RFC 12354</a></figcaption></figure>
15207 !! end
15208
15209 !! test
15210 T3887: A mailto link with a thumbnail
15211 !! wikitext
15212 [[File:Foobar.jpg|thumb|Please mailto:nobody@example.com]]
15213 !! html/php
15214 <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>
15215
15216 !! html/parsoid
15217 <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>
15218 !! end
15219
15220 # Pending resolution to T2368
15221 !! test
15222 T2648: Frameless image caption with a link
15223 !! wikitext
15224 [[File:Foobar.jpg|text with a [[link]] in it]]
15225 !! html/php
15226 <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>
15227 </p>
15228 !! html/parsoid
15229 <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>
15230 !! end
15231
15232 !! test
15233 T2648: Frameless image caption with a link (suffix)
15234 !! wikitext
15235 [[File:Foobar.jpg|text with a [[link]]foo in it]]
15236 !! html/php
15237 <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>
15238 </p>
15239 !! html/parsoid
15240 <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>
15241 !! end
15242
15243 !! test
15244 T2648: Frameless image caption with an interwiki link
15245 !! wikitext
15246 [[File:Foobar.jpg|text with a [[MeatBall:Link]] in it]]
15247 !! html/php
15248 <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>
15249 </p>
15250 !! html/parsoid
15251 <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>
15252 !! end
15253
15254 !! test
15255 T2648: Frameless image caption with a piped interwiki link
15256 !! wikitext
15257 [[File:Foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
15258 !! html/php
15259 <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>
15260 </p>
15261 !! html/parsoid
15262 <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>
15263 !! end
15264
15265 !! test
15266 T107474: Frameless image caption with <nowiki>
15267 !! wikitext
15268 [[File:Foobar.jpg|<nowiki>text with a [[MeatBall:Link|link]] in it</nowiki>]]
15269 !! html/parsoid
15270 <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>
15271 !! end
15272
15273 !! test
15274 Escape HTML special chars in image alt text
15275 !! wikitext
15276 [[File:Foobar.jpg|& < > "]]
15277 !! html/php
15278 <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>
15279 </p>
15280 !! html/parsoid
15281 <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>
15282 !! end
15283
15284 !! test
15285 Escape HTML special chars in image alt text with LanguageConverter
15286 !! options
15287 language=zh
15288 !! wikitext
15289 [[File:Foobar.jpg|& < > "]]
15290 !! html/php
15291 <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>
15292 </p>
15293 !! html/parsoid
15294 <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>
15295 !! end
15296
15297 !! test
15298 Entities in file name and attributes
15299 !! wikitext
15300 [[File:7%25 solution.gif|manualthumb=7%25 solution.gif|link=7%25 solution|[[7%25 solution]]]]
15301 !! html/php
15302 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=7%25_solution.gif" class="new" title="File:7% solution.gif">7% solution</a>
15303 </p>
15304 !! html/parsoid
15305 <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>
15306 !! end
15307
15308 !! test
15309 T2499: Alt text should have &#1234;, not &amp;1234;
15310 !! wikitext
15311 [[File:Foobar.jpg|&#9792;]]
15312 !! html/php
15313 <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>
15314 </p>
15315 !! html/parsoid
15316 <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>
15317 !! end
15318
15319 !! test
15320 Broken image caption with link
15321 !! options
15322 parsoid=wt2html,wt2wt,html2html
15323 !! wikitext
15324 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
15325 !! html/php
15326 <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.
15327 </p>
15328 !! html/parsoid
15329 <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>
15330 !! end
15331
15332 !! test
15333 Image caption containing another image
15334 !! wikitext
15335 [[File:Foobar.jpg|thumb|This is a caption with another [[File:Thumb.png|image]] inside it!]]
15336 !! html/php
15337 <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>
15338
15339 !! html/parsoid
15340 <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>
15341 !! end
15342
15343 !! test
15344 Image: caption containing a newline
15345 !! wikitext
15346 [[File:Foobar.jpg|This
15347 *is some text]]
15348 !! html/php
15349 <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>
15350 </p>
15351 !! html/parsoid
15352 <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>
15353 !!end
15354
15355 !!test
15356 Image: caption containing leading space
15357 (The leading space should not trigger nowiki escaping in wt2wt mode)
15358 !! wikitext
15359 [[File:Foobar.jpg|thumb| bar]]
15360 !! html/php
15361 <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>
15362
15363 !! html/parsoid
15364 <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>
15365 !!end
15366
15367 !! test
15368 Image: caption containing a table
15369 !! options
15370 parsoid=wt2html,wt2wt,html2html
15371 !! wikitext
15372 [[Image:Foobar.jpg|thumb|200px|This is an example image thumbnail caption with a table
15373 {|
15374 ! Foo !! Bar
15375 |-
15376 | Foo1 || Bar1
15377 |}
15378 and some more text.]]
15379 !! html/php
15380 <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>
15381
15382 !! html/parsoid
15383 <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
15384 <table>
15385 <tbody>
15386 <tr><th>Foo </th><th>Bar</th></tr>
15387 <tr>
15388 <td>Foo1 </td>
15389 <td>Bar1</td></tr></tbody></table>and some more text.</figcaption></figure>
15390 !! end
15391
15392 !! test
15393 T5090: External links other than http: in image captions
15394 !! wikitext
15395 [[File:Foobar.jpg|thumb|200x200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
15396 !! html/php
15397 <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>
15398
15399 !! html/parsoid
15400 <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>
15401 !! end
15402
15403 !! test
15404 Custom class
15405 !! options
15406 parsoid=wt2html,wt2wt,html2html
15407 !! wikitext
15408 [[Image:foobar.jpg|a|class=b]]
15409 !! html/php
15410 <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>
15411 </p>
15412 !! html/parsoid
15413 <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>
15414 !! end
15415
15416 !! test
15417 Localized image handling (1).
15418 !! options
15419 parsoid=wt2html,wt2wt,html2html
15420 language=es
15421 !! wikitext
15422 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
15423 !! html/php
15424 <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>
15425
15426 !! html/parsoid
15427 <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>
15428 !! end
15429
15430 !! test
15431 Localized image handling (2).
15432 !! options
15433 thumbsize=220
15434 parsoid=wt2html,wt2wt,html2html
15435 language=es
15436 !! wikitext
15437 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
15438 !! html/php
15439 <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>
15440
15441 !! html/parsoid
15442 <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>
15443 !! end
15444
15445 !! test
15446 Localized image handling (3).
15447 !! options
15448 language=fa
15449 parsoid=html2wt
15450 !! html/parsoid
15451 <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>
15452 !! wikitext
15453 [[File:Foobar.jpg|بندانگشتی]]
15454 !! end
15455
15456 !! test
15457 "border", "frameless" and "class" attributes on an image.
15458 !! options
15459 thumbsize=220
15460 parsoid=wt2html,wt2wt,html2html
15461 !! wikitext
15462 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
15463 !! html/php
15464 <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>
15465 </p>
15466 !! html/parsoid
15467 <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>
15468 !! end
15469
15470 # Note that 'right' is the default alignment, despite the misspelled 'righ' below
15471 !! test
15472 Invalid image attributes (T64500)
15473 !! options
15474 thumbsize=220
15475 parsoid=wt2html,wt2wt,html2html
15476 !! wikitext
15477 [[File:Foobar.jpg|thumb|float|left|caption]]
15478
15479 [[File:Foobar.jpg|thumb|righ|caption]]
15480
15481 [[File:Foobar.jpg|bogus1|thumb|bogus2|left|bogus3|caption]]
15482 !! html/php
15483 <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>
15484 <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>
15485 <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>
15486
15487 !! html/parsoid
15488 <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>
15489 <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>
15490 <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>
15491 !! end
15492
15493 !! article
15494 File:Barfoo.jpg
15495 !! text
15496 #REDIRECT [[File:Barfoo.jpg]]
15497 !! endarticle
15498
15499 # FIXME: Parsoid should run this test -- but we'd need to teach the
15500 # mockAPI about the redirected Barfoo.jpg image.
15501 !! test
15502 Redirected image
15503 !! wikitext
15504 [[Image:Barfoo.jpg]]
15505 !! html/php
15506 <p><a href="/wiki/File:Barfoo.jpg" class="mw-redirect" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
15507 </p>
15508 !! end
15509
15510 !! test
15511 Missing image with uploads disabled
15512 !! options
15513 wgEnableUploads=0
15514 !! wikitext
15515 [[File:Foobaz.jpg]]
15516 !! html/php
15517 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
15518 </p>
15519 !! html/parsoid
15520 <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>
15521 !! end
15522
15523 # Parsoid-specific testing for images
15524 # https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
15525 # Currently imperfect due to a flaw in the Parsoid testrunner
15526 # Work in progress
15527 # THESE TESTS SHOULD BE MOVED UP and merged with the php-specific
15528 # image tests.
15529
15530 !! test
15531 Parsoid-specific image handling - simple image with size and middle alignment
15532 !! wikitext
15533 [[File:Foobar.jpg|middle|50px]]
15534 !! html/parsoid
15535 <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>
15536 !! end
15537
15538 !! test
15539 Parsoid-specific image handling - simple image with size, middle alignment,
15540 non-standard namespace alias
15541 !! options
15542 parsoid=wt2wt,wt2html,html2html
15543 !! wikitext
15544 [[Image:Foobar.jpg|middle|50px]]
15545 !! html/parsoid
15546 <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>
15547 !! end
15548
15549 !! test
15550 Parsoid-specific image handling - simple image with size and middle alignment
15551 (existing content)
15552 !! wikitext
15553 [[File:Foobar.jpg|50px|middle]]
15554 !! html/parsoid
15555 <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>
15556 !! end
15557
15558 !! test
15559 Parsoid-specific image handling - simple image with size and middle alignment
15560 and non-standard namespace name
15561 !! options
15562 parsoid=wt2html,wt2wt,html2html
15563 !! wikitext
15564 [[Image:Foobar.jpg|50px|middle]]
15565 !! html/parsoid
15566 <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>
15567 !! end
15568
15569 !! test
15570 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
15571 !! wikitext
15572 [[File:Foobar.jpg|500x10px|baseline|caption]]
15573 !! html/parsoid
15574 <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>
15575 !! end
15576
15577 !! test
15578 Parsoid-specific image handling - simple image with border and size spec
15579 !! wikitext
15580 [[File:Foobar.jpg|50px|border|caption]]
15581 !! html/parsoid
15582 <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>
15583 !! end
15584
15585 !! test
15586 Parsoid-specific image handling - thumbnail with halign, valign, and caption
15587 !! wikitext
15588 [[File:Foobar.jpg|left|baseline|thumb|caption content]]
15589 !! html/parsoid
15590 <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>
15591 !! end
15592
15593 !! test
15594 Parsoid-specific image handling - thumbnail with halign, valign, and caption
15595 (existing content)
15596 !! wikitext
15597 [[File:Foobar.jpg|thumb|left|baseline|caption content]]
15598 !! html/parsoid
15599 <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>
15600 !! end
15601
15602 !! test
15603 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
15604 !! wikitext
15605 [[Image:Foobar.jpg|right|middle|thumb|50x50px|caption]]
15606 !! html/parsoid
15607 <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>
15608 !! end
15609
15610 !! test
15611 Parsoid-specific image handling - thumbnail with specific size, halign,
15612 valign, and caption (existing content)
15613 !! wikitext
15614 [[File:Foobar.jpg|thumb|50x50px|right|middle|caption]]
15615 !! html/parsoid
15616 <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>
15617 !! end
15618
15619 !! test
15620 Parsoid-specific image handling - framed image with specific size and caption
15621 (size is ignored)
15622 !! options
15623 parsoid=wt2html,wt2wt,html2html
15624 !! wikitext
15625 [[File:Foobar.jpg|frame|500x50px|caption]]
15626 !! html/parsoid
15627 <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>
15628 !! end
15629
15630 !! test
15631 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption
15632 (size is ignored)
15633 !! options
15634 parsoid=wt2html,wt2wt,html2html
15635 !! wikitext
15636 [[File:Foobar.jpg|left|baseline|frame|500x50px|caption]]
15637 !! html/parsoid
15638 <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>
15639 !! end
15640
15641 !! test
15642 Parsoid-specific image handling - frameless image with specific size, border, and caption
15643 !! wikitext
15644 [[File:Foobar.jpg|frameless|442x50px|border|caption]]
15645 !! html/parsoid
15646 <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>
15647 !! end
15648
15649 !! test
15650 Parsoid-specific image handling - simple image with a formatted caption
15651 !! wikitext
15652 [[File:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
15653 !! html/parsoid
15654 <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>
15655 !! end
15656
15657 !! test
15658 Parsoid-specific image handling - caption with a template in it
15659 !! wikitext
15660 [[File:Foobar.jpg|thumb|200x23px|This caption has a {{echo|transclusion}} in it.]]
15661 !! html/parsoid
15662 <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>
15663 !! end
15664
15665 !! test
15666 Parsoid-specific image handling - caption with unbalanced tags in it
15667 !! options
15668 parsoid=wt2html,wt2wt,html2html
15669 !! wikitext
15670 foo
15671 [[File:Foobar.jpg|thumb|200x200px|This caption has a <center>unbalanced tag in it.]]
15672 bar
15673 !! html/parsoid
15674 <p>foo</p>
15675 <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>
15676 <p>bar</p>
15677 !! end
15678
15679 !! test
15680 Parsoid-specific image handling - empty caption (1)
15681 !! options
15682 parsoid=wt2html,wt2wt
15683 !! wikitext
15684 [[File:Foobar.jpg|thumb|]]
15685 !! html/parsoid
15686 <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>
15687 !! end
15688
15689 # empty captions don't get serialized unless we're in the "round trip" case
15690 !! test
15691 Parsoid-specific image handling - empty caption (2)
15692 !! options
15693 parsoid=html2wt
15694 !! html/parsoid
15695 <figure class="mw-default-size" typeof="mw:Image/Thumb">
15696 <a href="./File:Foobar.jpg">
15697 <img resource="./File:Foobar.jpg"
15698 src="//example.com/images/3/3a/Foobar.jpg"
15699 data-file-width="1941" data-file-height="220" data-file-type="bitmap"
15700 height="25" width="220"/>
15701 </a>
15702 <figcaption></figcaption>
15703 </figure>
15704 !! wikitext
15705 [[File:Foobar.jpg|thumb]]
15706 !! end
15707
15708 !! test
15709 Parsoid-specific image handling - whitespace caption
15710 !! wikitext
15711 [[File:Foobar.jpg|thumb| ]]
15712 !! html/parsoid
15713 <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>
15714 !! end
15715
15716 !! test
15717 Parsoid-specific image handling - lang option
15718 !! wikitext
15719 foo
15720 [[File:Foobar.svg|lang=de|caption]]
15721 bar
15722 !! html/parsoid
15723 <p>foo
15724 <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>
15725 bar</p>
15726 !! end
15727
15728 ## Edge case bugs in Parsoid from T93580
15729 !! test
15730 T93580: 1. Templated <ref> inside block images
15731 !! wikitext
15732 [[File:Foobar.jpg|thumb|Caption with templated ref: {{echo|<ref>foo</ref>}}]]
15733
15734 <references />
15735 !! html/parsoid
15736 <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>
15737
15738 <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>
15739 !! end
15740
15741 !! test
15742 T93580: 2. <ref> inside inline images
15743 !! wikitext
15744 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: <ref>foo</ref>]]
15745
15746 <references />
15747 !! html/parsoid
15748 <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>"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{"href":"File:Foobar.jpg"}}'><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
15749
15750 <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>
15751 !! end
15752
15753 !! test
15754 T93580: 3. Templated <ref> inside inline images
15755 !! wikitext
15756 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: {{echo|<ref>{{echo|foo}}</ref>}}]]
15757
15758 <references />
15759 !! html/parsoid
15760 <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>"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{"href":"File:Foobar.jpg"}}'><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
15761
15762 <ol class="mw-references references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><a href="./Main_Page#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo</span></li></ol>
15763 !! end
15764
15765 ###
15766 ### Subpages
15767 ###
15768 !! article
15769 Subpage test/subpage
15770 !! text
15771 foo
15772 !! endarticle
15773
15774 !! test
15775 Subpage link
15776 !! options
15777 subpage title=[[Subpage test]]
15778 !! wikitext
15779 [[/subpage]]
15780 !! html
15781 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
15782 </p>
15783 !! end
15784
15785 !! test
15786 Subpage noslash link
15787 !! options
15788 subpage title=[[Subpage test]]
15789 !! wikitext
15790 [[/subpage/]]
15791 !! html
15792 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
15793 </p>
15794 !! end
15795
15796 !! article
15797 Subpage test/1/2/subpage
15798 !! text
15799 blah
15800 !! endarticle
15801
15802 !! test
15803 Relative subpage noslash link
15804 !! options
15805 parsoid=wt2wt,wt2html,html2html
15806 subpage title=[[Subpage test/1/2/3/4]]
15807 !! wikitext
15808 [[../../subpage/]]
15809
15810 [[../../subpage]]
15811 !! html/php
15812 <p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a>
15813 </p><p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage test/1/2/subpage</a>
15814 </p>
15815 !! html/parsoid
15816 <p><a rel="mw:WikiLink" href="./Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a></p>
15817 <p><a rel="mw:WikiLink" href="./Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
15818 !! end
15819
15820 !! test
15821 Parsoid: dot-slash prefixed wikilinks
15822 !! wikitext
15823 [[./foo]]
15824
15825 [[././bar]]
15826
15827 [[././baz/]]
15828 !! html/php
15829 <p>[[./foo]]
15830 </p><p>[[././bar]]
15831 </p><p>[[././baz/]]
15832 </p>
15833 !! html/parsoid
15834 <p>[[./foo]]
15835 </p><p>[[././bar]]
15836 </p><p>[[././baz/]]
15837 </p>
15838 !! end
15839
15840 !! test
15841 Render invalid page names as plain text (T53090)
15842 !! wikitext
15843 [[./../foo|bar]]
15844 [[foo�|bar]]
15845 [[foo/.|bar]]
15846 [[foo/..|bar]]
15847 [[foo~~~bar]]
15848 [[foo>bar]]
15849 [[foo[bar]]
15850 [[.]]
15851 [[..]]
15852 [[foo././bar]]
15853 [[foo[http://example.com]xyz]]
15854
15855 [[{{echo|./../foo}}|bar]]
15856 [[{{echo|foo/.}}|bar]]
15857 [[{{echo|foo/..}}|bar]]
15858 [[{{echo|foo~~~~bar}}]]
15859 [[{{echo|foo>bar}}]]
15860 [[{{echo|foo././bar}}]]
15861 [[{{echo|foo{bar}}]]
15862 [[{{echo|foo}bar}}]]
15863 [[{{echo|foo[bar}}]]
15864 [[{{echo|foo]bar}}]]
15865 [[{{echo|foo<bar}}]]
15866 !!html/php
15867 <p>[[./../foo|bar]]
15868 [[foo�|bar]]
15869 [[foo/.|bar]]
15870 [[foo/..|bar]]
15871 [[foo~~~bar]]
15872 [[foo&gt;bar]]
15873 [[foo[bar]]
15874 [[.]]
15875 [[..]]
15876 [[foo././bar]]
15877 [[foo<a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>xyz]]
15878 </p><p>[[./../foo|bar]]
15879 [[foo/.|bar]]
15880 [[foo/..|bar]]
15881 [[foo~~~~bar]]
15882 [[foo&gt;bar]]
15883 [[foo././bar]]
15884 [[foo{bar]]
15885 [[foo}bar]]
15886 [[foo[bar]]
15887 [[foo]bar]]
15888 [[foo&lt;bar]]
15889 </p>
15890 !!html/parsoid
15891 <p>[[./../foo|bar]]
15892 [[foo�|bar]]
15893 [[foo/.|bar]]
15894 [[foo/..|bar]]
15895 [[foo~~~bar]]
15896 [[foo>bar]]
15897 [[foo[bar]]
15898 [[.]]
15899 [[..]]
15900 [[foo././bar]]
15901 [[foo<a rel="mw:ExtLink" href="http://example.com"></a>xyz]]</p>
15902
15903 <p>[[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"./../foo"}},"i":0}}]}'>./../foo</span>|bar]]
15904 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/."}},"i":0}}]}'>foo/.</span>|bar]]
15905 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/.."}},"i":0}}]}'>foo/..</span>|bar]]
15906 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo~~~~bar"}},"i":0}}]}'>foo~~~~bar</span>]]
15907 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo>bar"}},"i":0}}]}'>foo>bar</span>]]
15908 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo././bar"}},"i":0}}]}'>foo././bar</span>]]
15909 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo{bar"}},"i":0}}]}'>foo{bar</span>]]
15910 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo}bar"}},"i":0}}]}'>foo}bar</span>]]
15911 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo[bar"}},"i":0}}]}'>foo[bar</span>]]
15912 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo]bar"}},"i":0}}]}'>foo]bar</span>]]
15913 [[<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>
15914 !!end
15915
15916 !! test
15917 Disabled subpages
15918 !! wikitext
15919 [[/subpage]]
15920 !! html
15921 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
15922 </p>
15923 !! end
15924
15925 !! test
15926 T2561: {{/Subpage}}
15927 !! options
15928 subpage title=[[Page]]
15929 !! wikitext
15930 {{/Subpage}}
15931 !! html
15932 <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>
15933 </p>
15934 !! end
15935
15936 ###
15937 ### Categories
15938 ###
15939 !! article
15940 Category:MediaWiki User's Guide
15941 !! text
15942 blah
15943 !! endarticle
15944
15945 !! test
15946 Link to category
15947 !! wikitext
15948 [[:Category:MediaWiki User's Guide]]
15949 !! html
15950 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User&#39;s Guide">Category:MediaWiki User's Guide</a>
15951 </p>
15952 !! end
15953
15954 !! test
15955 Simple category
15956 !! options
15957 cat
15958 !! wikitext
15959 [[Category:MediaWiki User's Guide]]
15960 !! html/php
15961 cat=MediaWiki_User's_Guide sort=
15962 !! html/parsoid
15963 <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"}}'/>
15964 !! end
15965
15966 !! test
15967 PAGESINCATEGORY invalid title fatal (r33546 fix)
15968 !! wikitext
15969 {{PAGESINCATEGORY:<bogus>}}
15970 !! html
15971 <p>0
15972 </p>
15973 !! end
15974
15975 !! test
15976 Category with different sort key
15977 !! options
15978 cat
15979 !! wikitext
15980 [[Category:MediaWiki User's Guide|Foo]]
15981 !! html/php
15982 cat=MediaWiki_User's_Guide sort=Foo
15983 !! html/parsoid
15984 <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"}}'/>
15985 !! end
15986
15987 !! test
15988 Category with identical sort key
15989 !! options
15990 cat
15991 !! wikitext
15992 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
15993 !! html/php
15994 cat=MediaWiki_User's_Guide sort=MediaWiki User's Guide
15995 !! html/parsoid
15996 <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"}}'/>
15997 !! end
15998
15999 !! test
16000 Category with empty sort key
16001 !! options
16002 cat
16003 pst
16004 !! wikitext
16005 [[Category:MediaWiki User's Guide|]]
16006 !! html/php
16007 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
16008 !! end
16009
16010 !! test
16011 Category with empty sort key and parentheses
16012 !! options
16013 cat
16014 pst
16015 !! wikitext
16016 [[Category:Foo (bar)|]]
16017 !! html/php
16018 [[Category:Foo (bar)|Foo]]
16019 !! end
16020
16021 !! test
16022 Category with link tail
16023 !! options
16024 cat
16025 pst
16026 !! wikitext
16027 123[[Category:Foo]]456
16028 !! html/php
16029 123[[Category:Foo]]456
16030 !! end
16031
16032 !! test
16033 Category with template
16034 !! options
16035 cat
16036 pst
16037 !! wikitext
16038 [[Category:{{echo|Foo}}]]
16039 !! html/php
16040 [[Category:{{echo|Foo}}]]
16041 !! end
16042
16043 !! test
16044 Category with template in sort key
16045 !! options
16046 cat
16047 pst
16048 !! wikitext
16049 [[Category:Foo|{{echo|Bar}}]]
16050 !! html/php
16051 [[Category:Foo|{{echo|Bar}}]]
16052 !! end
16053
16054 !! test
16055 Category with template in sort key and title
16056 !! options
16057 cat
16058 pst
16059 !! wikitext
16060 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
16061 !! html/php
16062 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
16063 !! end
16064
16065 ## We used to, but no longer wt2wt this test since the default serializer
16066 ## will normalize all categories to serialize on their own line.
16067 ## This wikitext usage is going to be fairly uncommon in production and
16068 ## selser will take care of preserving formatting in those scenarios.
16069 !! test
16070 Category / paragraph interactions
16071 !! options
16072 parsoid=wt2html
16073 !! wikitext
16074 Foo [[Category:Baz]] Bar
16075
16076 Foo [[Category:Baz]]
16077 Bar
16078
16079 Foo
16080 [[Category:Baz]]
16081 Bar
16082
16083 Foo
16084 [[Category:Baz]] Bar
16085
16086 Foo
16087 [[Category:Baz]]
16088 [[Category:Baz]]
16089 [[Category:Baz]]
16090 Bar
16091
16092 [[Category:Baz]]
16093 [[Category:Baz]]
16094 [[Category:Baz]]
16095
16096 [[Category:Baz]]
16097 {{echo|[[Category:Baz]]}}
16098 [[Category:Baz]]
16099 !! html/php
16100 <p>Foo Bar
16101 </p><p>Foo
16102 Bar
16103 </p><p>Foo
16104 Bar
16105 </p><p>Foo Bar
16106 </p><p>Foo
16107 Bar
16108 </p>
16109 !! html/parsoid
16110 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
16111 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
16112 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
16113 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
16114 <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>
16115 <link rel="mw:PageProp/Category" href="./Category:Baz"/>
16116 !! end
16117
16118 ## We used to, but no longer wt2wt this test since the default serializer
16119 ## will normalize all categories to serialize on their own line.
16120 ## This wikitext usage is going to be fairly uncommon in production and
16121 ## selser will take care of preserving formatting in those scenarios.
16122 ##
16123 ## The whitespace on the empty line is part of the test. Please do not delete
16124 !! test
16125 1. Categories and newlines: All preceding newlines should be suppressed (courtesy T2087)
16126 !! options
16127 parsoid=wt2html
16128 !! wikitext
16129 This
16130
16131 [[Category:Foo]] and this should be part of same paragraph (not an indent-pre)
16132
16133 {{echo|[[Category:Foo]] and so should this!}}
16134 !! html/php
16135 <p>This and this should be part of same paragraph (not an indent-pre) and so should this!
16136 </p>
16137 !! html/parsoid
16138 <p>This
16139
16140 <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of same paragraph (not an indent-pre)
16141
16142 <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>
16143 !! end
16144
16145 ## Parsoid will not try to wt2wt this while preserving newlines because
16146 ## it suppresses excess newlines within list items -- and we don't want to
16147 ## introduce a special case just for categories, which is, in reality somewhat
16148 ## odd behavior -- categories are unlikely to be used in list items like this
16149 ## in top-level pages and are only likely to show up in template-generated
16150 ## list items where this RT-ing is a non-issue.
16151 ##
16152 ## The whitespace on the empty line is part of the test. Please do not delete
16153 !! test
16154 2. Categories and newlines: All preceding newlines should be suppressed (courtesy T2087)
16155 !! options
16156 parsoid=wt2html
16157 !! wikitext
16158 * This
16159
16160 [[Category:Foo]] and this should be part of the same list item
16161 * So should this
16162
16163 {{echo|[[Category:Foo]] and this should be part of the same list item}}
16164 !! html
16165 <ul><li>This and this should be part of the same list item</li>
16166 <li>So should this and this should be part of the same list item</li></ul>
16167 !! html/parsoid
16168 <ul>
16169 <li>This <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of the same list item</li>
16170 <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>
16171 </ul>
16172 !! end
16173
16174 ## Newlines and categories that follow the last item of a list
16175 ## are treated differently because this (list followed by categories)
16176 ## is an extremely common pattern on wikis.
16177 !! test
16178 3. Categories and newlines: newline suppression for last list item should RT properly
16179 !! wikitext
16180 * a
16181 * b
16182
16183 [[Category:Foo]]
16184
16185 [[Category:Bar]]
16186 [[Category:Baz]]
16187 !! html/parsoid
16188 <ul><li> a</li>
16189 <li> b</li></ul>
16190
16191 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
16192
16193 <link rel="mw:PageProp/Category" href="./Category:Bar" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
16194 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
16195 !! end
16196
16197 !! test
16198 4. Categories and newlines: newline suppression for last list item should RT properly
16199 !! wikitext
16200 * a
16201 **** b
16202
16203 [[Category:Foo]]
16204 !! html/parsoid
16205 <ul><li> a
16206 <ul><li><ul><li><ul><li> b</li></ul></li></ul></li></ul></li></ul>
16207
16208 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
16209 !! end
16210
16211 ## only wt2html for this to make sure the algo only applies to the rightmost path
16212 !! test
16213 5. Categories and newlines: migrateTrailingCategories dom pass should only run on the rightmost path of nested lists
16214 !! options
16215 parsoid=wt2html
16216 !! wikitext
16217 * a
16218 ** b
16219 [[Category:Foo]]
16220 * c
16221 ** d
16222 [[Category:Foo]]
16223 !! html/parsoid
16224 <ul><li> a
16225 <ul><li> b
16226 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/></li></ul></li>
16227 <li> c
16228 <ul><li> d</li></ul></li></ul>
16229 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
16230 !! end
16231
16232 ## We used to, but no longer wt2wt this test since the default serializer
16233 ## will normalize all categories to serialize on their own line.
16234 ## This wikitext usage is going to be fairly uncommon in production and
16235 ## selser will take care of preserving formatting in those scenarios.
16236 !! test
16237 6. Categories and newlines: migrateTrailingCategories dom pass should not migrate categories not preceded by newlines
16238 !! options
16239 parsoid=wt2html
16240 !! wikitext
16241 * a [[Category:Foo]]
16242 !! html/parsoid
16243 <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>
16244 !! end
16245
16246 # This test also demonstrates because of newline+category tunneling
16247 # through the list hander, template wrapping doesn't expand to the
16248 # containing list when the list item swallows the category.
16249 !! test
16250 7. Categories and newlines: migrateTrailingCategories dom pass should leave template content alone
16251 !! wikitext
16252 * {{echo|a
16253 [[Category:Foo]]}}
16254 !! html/parsoid
16255 <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
16256 </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>
16257 !! end
16258
16259 !! test
16260 8. Categories and newlines: migrateTrailingCategories dom pass should not get tripped by intervening templates
16261 !! wikitext
16262 * a
16263
16264 {{echo|[[Category:Foo]]
16265 [[Category:Bar]]}}
16266 [[Category:Baz]]
16267 !! html/parsoid
16268 <ul><li> a</li></ul>
16269
16270 <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">
16271 </span><link rel="mw:PageProp/Category" href="./Category:Bar" about="#mwt1" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
16272 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
16273 !! end
16274
16275 !! test
16276 9. Categories and newlines: should behave properly with linkprefix (T87753)
16277 !! options
16278 language=ar
16279 !! wikitext
16280 foo bar
16281 foo bar
16282 [[تصنيف:Foo]]
16283 [[تصنيف:Bar]]
16284 !! html/php
16285 <p>foo bar
16286 foo bar
16287 </p>
16288 !! html/parsoid
16289 <p>foo bar
16290 foo bar</p>
16291 <link rel="mw:PageProp/Category" href="./تصنيف:Foo"/>
16292 <link rel="mw:PageProp/Category" href="./تصنيف:Bar"/>
16293 !! end
16294
16295 !! test
16296 10. No regressions on internal links following category (T174639)
16297 !! options
16298 parsoid=wt2html,html2html
16299 !! wikitext
16300 [[Category:Foo]]<div>a
16301
16302 [[Foo]]</div>
16303 !! html/php
16304 <div>a
16305 <a href="/wiki/Foo" title="Foo">Foo</a></div>
16306
16307 !! html/parsoid
16308 <link rel="mw:PageProp/Category" href="./Category:Foo"/><div>a
16309
16310 <a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a></div>
16311 !! end
16312
16313 # Note that Parsoid differs slightly from PHP due to T175421
16314 !! test
16315 11. Special case where only newlines separate links (T175416)
16316 !! options
16317 parsoid=wt2html,html2html
16318 !! wikitext
16319 [[Category:Foo]]
16320
16321 [[Foo]][[es:Alimento]]
16322
16323 [[Foo]]
16324 !! html/php
16325 <p><br />
16326 <a href="/wiki/Foo" title="Foo">Foo</a>
16327 </p><p><a href="/wiki/Foo" title="Foo">Foo</a>
16328 </p>
16329 !! html/parsoid
16330 <link rel="mw:PageProp/Category" href="./Category:Foo"/>
16331
16332 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a></p><link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Alimento"/>
16333
16334 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a></p>
16335 !! end
16336
16337 !! test
16338 Category links with multiple namespaces
16339 !! wikitext
16340 [[Category:Project:Foo]]
16341 !! html/parsoid
16342 <link rel="mw:PageProp/Category" href="./Category:Project:Foo" />
16343 !! end
16344
16345 !! test
16346 Parsoid: Serialize link to category page with colon escape
16347 !! options
16348 parsoid
16349 !! wikitext
16350
16351 [[:Category:Foo]]
16352 [[:Category:Foo|Bar]]
16353 !! html
16354 <p>
16355 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Category:Foo</a>
16356 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Bar</a>
16357 </p>
16358 !! end
16359
16360 # We used to, but no longer wt2wt this test since the default serializer
16361 # will normalize all categories to serialize on their own line.
16362 # This wikitext usage is going to be fairly uncommon in production and
16363 # selser will take care of preventing whitespace insertion if this
16364 # occurs in an article.
16365 #
16366 # html2html disabled for the same reason (whitespace insertion between
16367 # x and y).
16368 #
16369 # html2wt disabled because it localizes the "Category" namespace.
16370 !! test
16371 Link prefix/suffixes aren't applied to category links
16372 !! options
16373 parsoid=wt2html
16374 language=is
16375 !! wikitext
16376 x[[Category:Foo]]y
16377 !! html/php
16378 <p>xy
16379 </p>
16380 !! html/parsoid
16381 <p>x<link rel="mw:PageProp/Category" href="./Flokkur:Foo" data-parsoid=""/>y</p>
16382 !! end
16383
16384 !! test
16385 Link prefix/suffixes aren't applied to language links
16386 !! options
16387 parsoid=wt2html
16388 language=is
16389 !! wikitext
16390 x[[es:Foo]]y
16391 !! html/php
16392 <p>xy
16393 </p>
16394 !! html/parsoid
16395 <p>x<link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo" data-parsoid=""/>y</p>
16396 !! end
16397
16398 !! test
16399 Parsoid: Serialize link to file page with colon escape
16400 !! options
16401 parsoid
16402 !! wikitext
16403
16404 [[:File:Foo.png]]
16405 [[:File:Foo.png|Bar]]
16406 !! html
16407 <p>
16408 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">File:Foo.png</a>
16409 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">Bar</a>
16410 </p>
16411 !! end
16412
16413 !! test
16414 Parsoid: Serialize a genuine category link without colon escape
16415 !! options
16416 parsoid
16417 !! wikitext
16418 [[Category:Foo]]
16419 [[Category:Foo|Bar]]
16420 !! html
16421 <link rel="mw:PageProp/Category" href="./Category:Foo">
16422 <link rel="mw:PageProp/Category" href="./Category:Foo#Bar">
16423 !! end
16424
16425 !! test
16426 Normalize hrefs properly before testing for invalid link targets (T72894)
16427 !! options
16428 parsoid=html2wt
16429 !! html/parsoid
16430 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne"/>
16431 !! wikitext
16432 [[Category:Toxine bactérienne]]
16433 !! end
16434
16435 !! test
16436 Parsoid: Defaultsort
16437 !! wikitext
16438 {{DEFAULTSORT:Foo}}
16439 !! html/parsoid
16440 <meta property="mw:PageProp/categorydefaultsort" content="Foo"/>
16441 !! end
16442
16443 # NOTE: mw:ExpandedAttrs is not the best typeof here. mw:Transclusion is better.
16444 # But, this is a limitation of our representation and is documented in
16445 # TemplateHandler.js in processSpecialMagicWord
16446 !! test
16447 Parsoid: Defaultsort (template-generated)
16448 !! wikitext
16449 {{{{echo|DEFAULTSORT}}:Foo}}
16450 !! html/parsoid
16451 <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"}]]}'/>
16452 !! end
16453
16454 ###
16455 ### Inter-language links
16456 ###
16457 !! test
16458 Interlanguage links
16459 !! options
16460 ill
16461 !! wikitext
16462 [[es:Alimento]]
16463 [[fr:Nourriture]]
16464 [[zh:食品]]
16465 !! html/php
16466 es:Alimento fr:Nourriture zh:食品
16467 !! html/parsoid
16468 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Alimento"/>
16469 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/Nourriture"/>
16470 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/食品"/>
16471 !! end
16472
16473 !! test
16474 Duplicate interlanguage links (T26502)
16475 !! options
16476 ill
16477 !! wikitext
16478 [[es:1]]
16479 [[es:2]]
16480 [[fr:1]]
16481 [[fr:2]]
16482 !! html/php
16483 es:1 fr:1
16484 !! html/parsoid
16485 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/1"/>
16486 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/2"/>
16487 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/1"/>
16488 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/2"/>
16489 !! end
16490
16491 ###
16492 ### Sections
16493 ###
16494 !! test
16495 Basic section headings
16496 !! wikitext
16497 == Headline 1 ==
16498 Some text
16499
16500 ==Headline 2==
16501 More
16502 ===Smaller headline===
16503 Blah blah
16504 !! html
16505 <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>
16506 <p>Some text
16507 </p>
16508 <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>
16509 <p>More
16510 </p>
16511 <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>
16512 <p>Blah blah
16513 </p>
16514 !! end
16515
16516 !! test
16517 Section headings with TOC
16518 !! wikitext
16519 == Headline 1 ==
16520 === Subheadline 1 ===
16521 ===== Skipping a level =====
16522 ====== Skipping a level ======
16523
16524 == Headline 2 ==
16525 Some text
16526 ===Another headline===
16527 !! html
16528 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
16529 <ul>
16530 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
16531 <ul>
16532 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
16533 <ul>
16534 <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>
16535 <ul>
16536 <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>
16537 </ul>
16538 </li>
16539 </ul>
16540 </li>
16541 </ul>
16542 </li>
16543 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
16544 <ul>
16545 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
16546 </ul>
16547 </li>
16548 </ul>
16549 </div>
16550
16551 <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>
16552 <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>
16553 <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>
16554 <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>
16555 <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>
16556 <p>Some text
16557 </p>
16558 <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>
16559
16560 !! end
16561
16562 !! test
16563 TOC anchors don't collide
16564 !! wikitext
16565 __FORCETOC__
16566 == Headline 2 ==
16567 == Headline ==
16568 == Headline 2 ==
16569 == Headline ==
16570 !! html/php
16571 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
16572 <ul>
16573 <li class="toclevel-1 tocsection-1"><a href="#Headline_2"><span class="tocnumber">1</span> <span class="toctext">Headline 2</span></a></li>
16574 <li class="toclevel-1 tocsection-2"><a href="#Headline"><span class="tocnumber">2</span> <span class="toctext">Headline</span></a></li>
16575 <li class="toclevel-1 tocsection-3"><a href="#Headline_2_2"><span class="tocnumber">3</span> <span class="toctext">Headline 2</span></a></li>
16576 <li class="toclevel-1 tocsection-4"><a href="#Headline_3"><span class="tocnumber">4</span> <span class="toctext">Headline</span></a></li>
16577 </ul>
16578 </div>
16579
16580 <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>
16581 <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>
16582 <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>
16583 <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>
16584
16585 !! end
16586
16587 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
16588 !! test
16589 Handling of sections up to level 6 and beyond
16590 !! wikitext
16591 = Level 1 Heading=
16592 == Level 2 Heading==
16593 === Level 3 Heading===
16594 ==== Level 4 Heading====
16595 ===== Level 5 Heading=====
16596 ====== Level 6 Heading======
16597 ======= Level 7 Heading=======
16598 ======== Level 8 Heading========
16599 ========= Level 9 Heading=========
16600 ========== Level 10 Heading==========
16601 !! html
16602 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
16603 <ul>
16604 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
16605 <ul>
16606 <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>
16607 <ul>
16608 <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>
16609 <ul>
16610 <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>
16611 <ul>
16612 <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>
16613 <ul>
16614 <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>
16615 <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>
16616 <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>
16617 <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>
16618 <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>
16619 </ul>
16620 </li>
16621 </ul>
16622 </li>
16623 </ul>
16624 </li>
16625 </ul>
16626 </li>
16627 </ul>
16628 </li>
16629 </ul>
16630 </div>
16631
16632 <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>
16633 <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>
16634 <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>
16635 <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>
16636 <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>
16637 <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>
16638 <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>
16639 <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>
16640 <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>
16641 <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>
16642
16643 !! end
16644
16645 !! test
16646 TOC regression (T11764)
16647 !! wikitext
16648 == title 1 ==
16649 === title 1.1 ===
16650 ==== title 1.1.1 ====
16651 === title 1.2 ===
16652 == title 2 ==
16653 === title 2.1 ===
16654 !! html
16655 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
16656 <ul>
16657 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
16658 <ul>
16659 <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>
16660 <ul>
16661 <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>
16662 </ul>
16663 </li>
16664 <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>
16665 </ul>
16666 </li>
16667 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
16668 <ul>
16669 <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>
16670 </ul>
16671 </li>
16672 </ul>
16673 </div>
16674
16675 <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>
16676 <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>
16677 <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>
16678 <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>
16679 <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>
16680 <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>
16681
16682 !! end
16683
16684 !! test
16685 TOC for heading containing <span id="..."></span> (T96153)
16686 !! wikitext
16687 __FORCETOC__
16688 ==<span id="old-anchor"></span>New title==
16689 !! html/php
16690 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
16691 <ul>
16692 <li class="toclevel-1 tocsection-1"><a href="#New_title"><span class="tocnumber">1</span> <span class="toctext">New title</span></a></li>
16693 </ul>
16694 </div>
16695
16696 <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>
16697
16698 !! end
16699
16700 !! test
16701 TOC with wgMaxTocLevel=3 (T8204)
16702 !! options
16703 wgMaxTocLevel=3
16704 !! wikitext
16705 == title 1 ==
16706 === title 1.1 ===
16707 ==== title 1.1.1 ====
16708 === title 1.2 ===
16709 == title 2 ==
16710 === title 2.1 ===
16711 !! html
16712 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
16713 <ul>
16714 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
16715 <ul>
16716 <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>
16717 <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>
16718 </ul>
16719 </li>
16720 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
16721 <ul>
16722 <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>
16723 </ul>
16724 </li>
16725 </ul>
16726 </div>
16727
16728 <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>
16729 <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>
16730 <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>
16731 <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>
16732 <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>
16733 <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>
16734
16735 !! end
16736
16737 !! test
16738 TOC with wgMaxTocLevel=3 and two level four headings (T8204)
16739 !! options
16740 wgMaxTocLevel=3
16741 !! wikitext
16742 ==Section 1==
16743 ===Section 1.1===
16744 ====Section 1.1.1====
16745 ====Section 1.1.1.1====
16746 ==Section 2==
16747 !! html
16748 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
16749 <ul>
16750 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
16751 <ul>
16752 <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>
16753 </ul>
16754 </li>
16755 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
16756 </ul>
16757 </div>
16758
16759 <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>
16760 <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>
16761 <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>
16762 <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>
16763 <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>
16764
16765 !! end
16766
16767
16768 !! test
16769 Resolving duplicate section names
16770 !! wikitext
16771 == Foo bar ==
16772 == Foo bar ==
16773 !! html
16774 <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>
16775 <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>
16776
16777 !! end
16778
16779 !! test
16780 Resolving duplicate section names with differing case (T12721)
16781 !! wikitext
16782 == Foo bar ==
16783 == Foo Bar ==
16784 !! html
16785 <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>
16786 <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>
16787
16788 !! end
16789
16790 !! article
16791 Template:sections
16792 !! text
16793 ===Section 1===
16794 ==Section 2==
16795 !! endarticle
16796
16797 !! test
16798 Template with sections, __NOTOC__
16799 !! wikitext
16800 __NOTOC__
16801 ==Section 0==
16802 {{sections}}
16803 ==Section 4==
16804 !! html
16805 <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>
16806 <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>
16807 <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>
16808 <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>
16809
16810 !! end
16811
16812 !! test
16813 __NOEDITSECTION__ keyword
16814 !! wikitext
16815 __NOEDITSECTION__
16816 ==Section 1==
16817 ==Section 2==
16818 !! html
16819 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
16820 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
16821
16822 !! end
16823
16824 !! test
16825 Link inside a section heading
16826 !! wikitext
16827 ==Section with a [[Main Page|link]] in it==
16828 !! html
16829 <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>
16830
16831 !! end
16832
16833 !! test
16834 TOC regression (T14077)
16835 !! wikitext
16836 __TOC__
16837 == title 1 ==
16838 === title 1.1 ===
16839 == title 2 ==
16840 !! html
16841 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
16842 <ul>
16843 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
16844 <ul>
16845 <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>
16846 </ul>
16847 </li>
16848 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
16849 </ul>
16850 </div>
16851
16852 <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>
16853 <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>
16854 <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>
16855
16856 !! end
16857
16858 !! test
16859 T3219 URL next to image (good)
16860 !! wikitext
16861 http://example.com [[File:Foobar.jpg]]
16862 !! html/php
16863 <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>
16864 </p>
16865 !! html/parsoid
16866 <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>
16867 !!end
16868
16869 !! test
16870 Short headings with trailing space should match behavior of Parser::doHeadings (T21910)
16871 !! wikitext
16872 ===
16873 The line above must have a trailing space!
16874 === <!--
16875 --> <!-- -->
16876 But just in case it doesn't...
16877 !! html
16878 <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>
16879 <p>The line above must have a trailing space!
16880 </p>
16881 <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>
16882 <p>But just in case it doesn't...
16883 </p>
16884 !! end
16885
16886 !! test
16887 Header with special characters (T27462)
16888 !! wikitext
16889 The tooltips shall not show entities to the user (ie. be double escaped)
16890
16891 == text > text ==
16892 section 1
16893
16894 == text < text ==
16895 section 2
16896
16897 == text & text ==
16898 section 3
16899
16900 == text ' text ==
16901 section 4
16902
16903 == text " text ==
16904 section 5
16905 !! html
16906 <p>The tooltips shall not show entities to the user (ie. be double escaped)
16907 </p>
16908 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
16909 <ul>
16910 <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>
16911 <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>
16912 <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>
16913 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
16914 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
16915 </ul>
16916 </div>
16917
16918 <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>
16919 <p>section 1
16920 </p>
16921 <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>
16922 <p>section 2
16923 </p>
16924 <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>
16925 <p>section 3
16926 </p>
16927 <h2><span class="mw-headline" id="text_.27_text">text ' text</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: text &#039; text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
16928 <p>section 4
16929 </p>
16930 <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>
16931 <p>section 5
16932 </p>
16933 !! end
16934
16935 !! test
16936 Header with space, plus and underscore as entity
16937 !! wikitext
16938 Id should not contain + for spaces
16939
16940 == Space between Text ==
16941 section 1
16942
16943 == Space-Entity&#32;between&#32;Text ==
16944 section 2
16945
16946 == Plus+between+Text ==
16947 section 3
16948
16949 == Plus-Entity&#43;between&#43;Text ==
16950 section 4
16951
16952 == Underscore_between_Text ==
16953 section 5
16954
16955 == Underscore-Entity&#95;between&#95;Text ==
16956 section 6
16957
16958 [[#Space between Text]]
16959 [[#Space-Entity&#32;between&#32;Text]]
16960 [[#Plus+between+Text]]
16961 [[#Plus-Entity&#43;between&#43;Text]]
16962 [[#Underscore_between_Text]]
16963 [[#Underscore-Entity&#95;between&#95;Text]]
16964 !! html
16965 <p>Id should not contain + for spaces
16966 </p>
16967 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
16968 <ul>
16969 <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>
16970 <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>
16971 <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>
16972 <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>
16973 <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>
16974 <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>
16975 </ul>
16976 </div>
16977
16978 <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>
16979 <p>section 1
16980 </p>
16981 <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>
16982 <p>section 2
16983 </p>
16984 <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>
16985 <p>section 3
16986 </p>
16987 <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>
16988 <p>section 4
16989 </p>
16990 <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>
16991 <p>section 5
16992 </p>
16993 <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>
16994 <p>section 6
16995 </p><p><a href="#Space_between_Text">#Space between Text</a>
16996 <a href="#Space-Entity_between_Text">#Space-Entity&#32;between&#32;Text</a>
16997 <a href="#Plus.2Bbetween.2BText">#Plus+between+Text</a>
16998 <a href="#Plus-Entity.2Bbetween.2BText">#Plus-Entity&#43;between&#43;Text</a>
16999 <a href="#Underscore_between_Text">#Underscore_between_Text</a>
17000 <a href="#Underscore-Entity_between_Text">#Underscore-Entity&#95;between&#95;Text</a>
17001 </p>
17002 !! end
17003
17004 !! test
17005 Headers with excess '=' characters
17006 (Are similar tests necessary beyond the 1st level?)
17007 !! wikitext
17008 =foo==
17009 ==foo=
17010 =''italic'' heading==
17011 ==''italic'' heading=
17012 !! html
17013 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
17014 <ul>
17015 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
17016 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
17017 <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>
17018 <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>
17019 </ul>
17020 </div>
17021
17022 <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>
17023 <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>
17024 <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>
17025 <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>
17026
17027 !! end
17028
17029 !! test
17030 HTML headers vs TOC (T25393)
17031 (__NOEDITSECTION__ for clearer output, doesn't matter here)
17032 !! wikitext
17033 <h1>Header 1</h1>
17034 == Header 1.1 ==
17035 == Header 1.2 ==
17036
17037 <h1>Header 2
17038 </h1>
17039 == Header 2.1 ==
17040 == Header 2.2 ==
17041 __NOEDITSECTION__
17042 !! html
17043 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
17044 <ul>
17045 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
17046 <ul>
17047 <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>
17048 <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>
17049 </ul>
17050 </li>
17051 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
17052 <ul>
17053 <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>
17054 <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>
17055 </ul>
17056 </li>
17057 </ul>
17058 </div>
17059
17060 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
17061 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
17062 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
17063 <h1><span class="mw-headline" id="Header_2">Header 2</span></h1>
17064 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
17065 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
17066
17067 !! end
17068
17069 !! test
17070 Single-line or multiline-comments can follow headings
17071 !! options
17072 parsoid=wt2html,wt2wt
17073 !! wikitext
17074 ==foo==<!---->
17075 ==bar==<!--c1-->
17076 ==baz==<!--
17077 c2
17078 c3-->
17079 !! html
17080 <h2><span class="mw-headline" id="foo">foo</span></h2>
17081 <h2><span class="mw-headline" id="bar">bar</span></h2>
17082 <h2><span class="mw-headline" id="baz">baz</span></h2>
17083
17084 !! end
17085
17086 !! test
17087 T3219 URL next to image (broken)
17088 !! wikitext
17089 http://example.com[[File:Foobar.jpg]]
17090 !! html/php
17091 <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>
17092 </p>
17093 !! html/parsoid
17094 <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>
17095 !!end
17096
17097 !! test
17098 T3186 news: in the middle of text
17099 !! wikitext
17100 http://en.wikinews.org/wiki/Wikinews:Workplace
17101 !! html
17102 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
17103 </p>
17104 !!end
17105
17106
17107 !! test
17108 Namespaced link must have a title
17109 !! wikitext
17110 [[Project:]]
17111 !! html
17112 <p>[[Project:]]
17113 </p>
17114 !!end
17115
17116 !! test
17117 Namespaced link must have a title (bad fragment version)
17118 !! wikitext
17119 [[Project:#fragment]]
17120 !! html
17121 <p>[[Project:#fragment]]
17122 </p>
17123 !!end
17124
17125
17126 ###
17127 ### HTML tags and HTML attributes
17128 ###
17129
17130 !! test
17131 div with no attributes
17132 !! wikitext
17133 <div>HTML rocks</div>
17134 !! html
17135 <div>HTML rocks</div>
17136
17137 !! end
17138
17139 !! test
17140 div with double-quoted attribute
17141 !! wikitext
17142 <div id="rock">HTML rocks</div>
17143 !! html
17144 <div id="rock">HTML rocks</div>
17145
17146 !! end
17147
17148 !! test
17149 div with single-quoted attribute
17150 !! wikitext
17151 <div id='rock'>HTML rocks</div>
17152 !! html
17153 <div id="rock">HTML rocks</div>
17154
17155 !! end
17156
17157 !! test
17158 div with unquoted attribute
17159 !! wikitext
17160 <div id=rock>HTML rocks</div>
17161 !! html
17162 <div id="rock">HTML rocks</div>
17163
17164 !! end
17165
17166 !! test
17167 div with illegal double attributes
17168 !! wikitext
17169 <div id="a" id="b">HTML rocks</div>
17170 !! html
17171 <div id="b">HTML rocks</div>
17172
17173 !!end
17174
17175 !! test
17176 div with empty attribute value, space before equals
17177 !! options
17178 parsoid=wt2html,html2html
17179 !! wikitext
17180 <div class =>HTML rocks</div>
17181 !! html/php
17182 <div class="">HTML rocks</div>
17183
17184 !! html/parsoid
17185 <div class="" data-parsoid='{"stx":"html"}'>HTML rocks</div>
17186 !! end
17187
17188 !! test
17189 div with multiple empty attribute values
17190 !! options
17191 parsoid=wt2html,html2html
17192 !! wikitext
17193 <div id= title=>HTML rocks</div>
17194 !! html/php
17195 <div id="title.3D">HTML rocks</div>
17196
17197 !! html/parsoid
17198 <div id="title.3D" data-parsoid='{"stx":"html"}'>HTML rocks</div>
17199 !! end
17200
17201 !! test
17202 table with multiple empty attribute values
17203 !! options
17204 parsoid=wt2html,html2html
17205 !! wikitext
17206 {| title= id=
17207 | hi
17208 |}
17209 !! html/php
17210 <table title="id=">
17211 <tr>
17212 <td> hi
17213 </td></tr></table>
17214
17215 !! html/parsoid
17216 <table title="id=">
17217 <tbody><tr><td> hi</td></tr>
17218 </tbody></table>
17219 !! end
17220
17221 !! test
17222 div with braces in attribute value
17223 !! wikitext
17224 <div title="{}">Foo</div>
17225 !! html/php
17226 <div title="&#123;&#125;">Foo</div>
17227
17228 !! html/parsoid
17229 <div title="{}">Foo</div>
17230 !! end
17231
17232 !! test
17233 div with empty attribute value, no space before equals
17234 !! options
17235 parsoid=wt2html,html2html
17236 !! wikitext
17237 <div class=>HTML rocks</div>
17238 !! html/php
17239 <div class="">HTML rocks</div>
17240
17241 !! html/parsoid
17242 <div class="">HTML rocks</div>
17243 !! end
17244
17245 !! test
17246 HTML multiple attributes correction
17247 !! wikitext
17248 <p class="error" class="awesome">Awesome!</p>
17249 !! html
17250 <p class="awesome">Awesome!</p>
17251
17252 !!end
17253
17254 !! test
17255 Table multiple attributes correction
17256 !! wikitext
17257 {|
17258 !+ class="error" class="awesome"| status
17259 |}
17260 !! html
17261 <table>
17262 <tr>
17263 <th class="awesome"> status
17264 </th></tr></table>
17265
17266 !!end
17267
17268 !! test
17269 DIV IN UPPERCASE
17270 !! wikitext
17271 <DIV ID="x">HTML ROCKS</DIV>
17272 !! html
17273 <div id="x">HTML ROCKS</div>
17274
17275 !!end
17276
17277 !! test
17278 Non-ASCII pseudo-tags are rendered as text
17279 !! wikitext
17280 <khyô>
17281 !! html
17282 <p>&lt;khyô&gt;
17283 </p>
17284 !! end
17285
17286 !! test
17287 Pseudo-tag with URL 'name' renders as url link
17288 !! wikitext
17289 <http://example.com/>
17290 !! html
17291 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
17292 </p>
17293 !! end
17294
17295 !! test
17296 text with amp in the middle of nowhere
17297 !! wikitext
17298 Remember AT&T?
17299 !! html
17300 <p>Remember AT&amp;T?
17301 </p>
17302 !! end
17303
17304 !! test
17305 text with character entity: eacute
17306 !! wikitext
17307 I always thought &eacute; was a cute letter.
17308 !! html
17309 <p>I always thought &#233; was a cute letter.
17310 </p>
17311 !! html+tidy
17312 <p>I always thought é was a cute letter.</p>
17313 !! end
17314
17315 !! test
17316 text with entity-escaped character entity-like string: eacute
17317 !! wikitext
17318 I always thought &amp;eacute; was a cute letter.
17319 !! html
17320 <p>I always thought &amp;eacute; was a cute letter.
17321 </p>
17322 !! end
17323
17324 !! test
17325 text with undefined character entity: xacute
17326 !! wikitext
17327 I always thought &xacute; was a cute letter.
17328 !! html
17329 <p>I always thought &amp;xacute; was a cute letter.
17330 </p>
17331 !! end
17332
17333 !! test
17334 HTML5 tags
17335 !! wikitext
17336 <data value="5">five</data>
17337 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
17338 <mark>This highlighted text</mark>
17339 !! html
17340 <p><data value="5">five</data>
17341 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
17342 <mark>This highlighted text</mark>
17343 </p>
17344 !! end
17345
17346 !! test
17347 HTML tag with leading space is parsed as text
17348 !! wikitext
17349 < div>foo< /div>
17350 !! html
17351 <p>&lt; div&gt;foo&lt; /div&gt;
17352 </p>
17353 !! end
17354
17355 ## Don't expect Parsoid and PHP to match, since PHP isn't exactly following
17356 ## the HTML5 parsing spec.
17357 !! test
17358 Element with broken attribute syntax
17359 !! options
17360 parsoid=wt2html
17361 !! wikitext
17362 <div style=" style="123">hi</div>
17363 <div =>ho</div>
17364 !! html/php
17365 <div style="123">hi</div>
17366 <div>ho</div>
17367
17368 !! html/parsoid
17369 <div style=" style=" data-parsoid='{"stx":"html","a":{"123\"":null},"sa":{"123\"":""}}'>hi</div>
17370 <div data-parsoid='{"stx":"html","a":{"=":null},"sa":{"=":""}}'>ho</div>
17371 !! end
17372
17373 ###
17374 ### Nesting tests (see T43545, T52604, T53081)
17375 ###
17376
17377 # This test case is fixed in Parsoid by domino 1.0.12. (T52604)
17378 # Note that html2wt is considerably more difficult if we use <b> in
17379 # the test case, instead of <small>
17380 !! test
17381 Ensure that HTML adoption agency algorithm is properly implemented.
17382 !! wikitext
17383 <small>X<small>Y</small>Z</small>
17384 !! html
17385 <p><small>X<small>Y</small>Z</small>
17386 </p>
17387 !! end
17388
17389 # This was T43545 in the PHP parser.
17390 # Note that tidy doesn't handle this correctly.
17391 !! test
17392 Nesting of <kbd>
17393 !! wikitext
17394 <kbd>X<kbd>Y</kbd>Z</kbd>
17395 !! html
17396 <p><kbd>X<kbd>Y</kbd>Z</kbd>
17397 </p>
17398 !! end
17399
17400 # The following cases were T53081 in the PHP parser.
17401 # Note that there are some other nestable tags (b, i, etc) which are
17402 # not covered; see T53081 for discussion.
17403
17404 # Note that tidy doesn't handle this correctly.
17405 !! test
17406 Nesting of <em>
17407 !! wikitext
17408 <em>X<em>Y</em>Z</em>
17409 !! html
17410 <p><em>X<em>Y</em>Z</em>
17411 </p>
17412 !! end
17413
17414 # Note that tidy doesn't handle this correctly.
17415 !! test
17416 Nesting of <strong>
17417 !! wikitext
17418 <strong>X<strong>Y</strong>Z</strong>
17419 !! html
17420 <p><strong>X<strong>Y</strong>Z</strong>
17421 </p>
17422 !! end
17423
17424 !! test
17425 Nesting of <q>
17426 !! wikitext
17427 <q>X<q>Y</q>Z</q>
17428 !! html+tidy
17429 <p><q>X<q>Y</q>Z</q></p>
17430 !! end
17431
17432 # Note that tidy doesn't handle this correctly.
17433 !! test
17434 Nesting of <ruby>
17435 !! wikitext
17436 <ruby>X<ruby>Y</ruby>Z</ruby>
17437 !! html
17438 <p><ruby>X<ruby>Y</ruby>Z</ruby>
17439 </p>
17440 !! end
17441
17442 # Note that tidy doesn't handle this correctly.
17443 !! test
17444 Nesting of <bdo>
17445 !! wikitext
17446 <bdo>X<bdo>Y</bdo>Z</bdo>
17447 !! html
17448 <p><bdo>X<bdo>Y</bdo>Z</bdo>
17449 </p>
17450 !! end
17451
17452
17453 ###
17454 ### Media links
17455 ###
17456
17457 !! test
17458 Media link
17459 !! wikitext
17460 [[Media:Foobar.jpg]]
17461 [[Media:Video.ogv]]
17462 [[:Media:Video.ogv]]
17463 !! html/php
17464 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
17465 <a href="http://example.com/images/0/00/Video.ogv" class="internal" title="Video.ogv">Media:Video.ogv</a>
17466 <a href="http://example.com/images/0/00/Video.ogv" class="internal" title="Video.ogv">Media:Video.ogv</a>
17467 </p>
17468 !! html/parsoid
17469 <p><a rel="mw:MediaLink" href="//example.com/images/3/3a/Foobar.jpg" title="Foobar.jpg">Media:Foobar.jpg</a>
17470 <a rel="mw:MediaLink" href="//example.com/images/0/00/Video.ogv" title="Video.ogv">Media:Video.ogv</a>
17471 <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>
17472 !! end
17473
17474 !! test
17475 Media link with text
17476 !! wikitext
17477 [[Media:Foobar.jpg|A neat file to look at]]
17478 !! html/php
17479 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
17480 </p>
17481 !! html/parsoid
17482 <p><a rel="mw:MediaLink" href="//example.com/images/3/3a/Foobar.jpg" title="Foobar.jpg">A neat file to look at</a></p>
17483 !! end
17484
17485 # FIXME: this is still bad HTML tag nesting
17486 # FIXME: doBlockLevels won't wrap this in a paragraph because it contains a div
17487 !! test
17488 Media link with nasty text
17489 !! wikitext
17490 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
17491 !! html/php
17492 <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>
17493
17494 !! html+php/tidy
17495 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Safe Link</a></p>
17496 <div style="display:none">" onmouseover="alert(document.cookie)" onfoo="</div>
17497 !! html/parsoid
17498 <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>
17499
17500 !! end
17501
17502 !! test
17503 Media link to nonexistent file (T3702)
17504 !! wikitext
17505 [[Media:No such.jpg]]
17506 [[Media:No_such file.jpg]]
17507 !! html/php
17508 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
17509 <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>
17510 </p>
17511 !! html/parsoid
17512 <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>
17513 <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>
17514 !! end
17515
17516 !! test
17517 Image link to nonexistent file (T3850 - good)
17518 !! wikitext
17519 [[File:No_such.jpg]]
17520 !! html/php
17521 <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>
17522 </p>
17523 !! html/parsoid
17524 <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>
17525 !! end
17526
17527 !! test
17528 :Image link to nonexistent file (T3850 - bad)
17529 !! wikitext
17530 [[:Image:No such.jpg]]
17531 !! html/php
17532 <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>
17533 </p>
17534 !! html/parsoid
17535 <p><a rel="mw:WikiLink" href="./File:No_such.jpg" title="File:No such.jpg">Image:No such.jpg</a></p>
17536 !! end
17537
17538 !! test
17539 Character reference normalization in link text (T3938)
17540 !! wikitext
17541 [[Main Page|this&that]]
17542 !! html
17543 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
17544 </p>
17545 !!end
17546
17547 !! article
17548 אַ
17549 !! text
17550 Test for unicode normalization
17551
17552 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
17553 !! endarticle
17554
17555 !! test
17556 (T21451) Links should refer to the normalized form.
17557 !! wikitext
17558 [[&#xFB2E;]]
17559 [[&#x5d0;&#x5b7;]]
17560 [[&#x5d0;ַ]]
17561 [[א&#x5b7;]]
17562 [[אַ]]
17563 !! html
17564 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
17565 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
17566 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
17567 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
17568 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
17569 </p>
17570 !! end
17571
17572 !! test
17573 Empty attribute crash test (T4067)
17574 !! wikitext
17575 <font color="">foo</font>
17576 !! html
17577 <p><font color="">foo</font>
17578 </p>
17579 !! end
17580
17581 !! test
17582 Empty attribute crash test single-quotes (T4067)
17583 !! wikitext
17584 <font color=''>foo</font>
17585 !! html
17586 <p><font color="">foo</font>
17587 </p>
17588 !! end
17589
17590 !! test
17591 Attribute test: equals, then nothing
17592 !! options
17593 parsoid=wt2html,html2html
17594 !! wikitext
17595 <font color=>foo</font>
17596 !! html/php
17597 <p><font color="">foo</font>
17598 </p>
17599 !! html/parsoid
17600 <p><font color="" data-parsoid='{"stx":"html"}'>foo</font></p>
17601 !! end
17602
17603 !! test
17604 Attribute test: unquoted value
17605 !! options
17606 parsoid=wt2html,html2html
17607 !! wikitext
17608 <font color=x>foo</font>
17609 !! html/php
17610 <p><font color="x">foo</font>
17611 </p>
17612 !! html/parsoid
17613 <p><font color="x" data-parsoid='{"stx":"html"}'>foo</font></p>
17614 !! end
17615
17616 !! test
17617 Attribute test: unquoted but illegal value (hash)
17618 !! wikitext
17619 <font color=#x>foo</font>
17620 !! html
17621 <p><font color="#x">foo</font>
17622 </p>
17623 !! end
17624
17625 # Parsoid does not serialize to empty attribute syntax,
17626 # so wt2wt and html2wt cases are skipped
17627 !! test
17628 Attribute test: no value (T54330)
17629 !! options
17630 parsoid=wt2html,html2html
17631 !! wikitext
17632 <font color>foo</font>
17633 !! html/php
17634 <p><font color="">foo</font>
17635 </p>
17636 !! html/parsoid
17637 <p><font color="">foo</font></p>
17638 !! end
17639
17640 !! test
17641 T4095: link with three closing brackets
17642 !! wikitext
17643 [[Main Page]]]
17644 !! html/php
17645 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
17646 </p>
17647 !! html/parsoid
17648 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a>]</p>
17649 !! end
17650
17651 !! test
17652 T4095: link with pipe and three closing brackets
17653 !! wikitext
17654 [[Main Page|link]]]
17655 !! html/php
17656 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
17657 </p>
17658 !! html/parsoid
17659 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">link</a>]</p>
17660 !! end
17661
17662 !! test
17663 T4095: link with pipe and three closing brackets, version 2
17664 !! wikitext
17665 [[Main Page|[http://example.com/]]]
17666 !! html/php
17667 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
17668 </p>
17669 !! html/parsoid
17670 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">[http://example.com/]</a></p>
17671 !! end
17672
17673
17674 ###
17675 ### Safety
17676 ###
17677
17678 !! article
17679 Template:Dangerous attribute
17680 !! text
17681 " onmouseover="alert(document.cookie)
17682 !! endarticle
17683
17684 !! article
17685 Template:Dangerous style attribute
17686 !! text
17687 border-size: expression(alert(document.cookie))
17688 !! endarticle
17689
17690 !! article
17691 Template:Div style
17692 !! text
17693 <div style="float: right; {{{1}}}">Magic div</div>
17694 !! endarticle
17695
17696 !! test
17697 T4304: HTML attribute safety (safe template; regression T4309)
17698 !! wikitext
17699 <div title="{{test}}"></div>
17700 !! html/php
17701 <div title="This is a test template"></div>
17702
17703 !! html/parsoid
17704 <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>
17705 !! end
17706
17707 # Parsoid has enough context to handle this case
17708 !! test
17709 T4304: HTML attribute safety (dangerous template; 2309)
17710 !! wikitext
17711 <div title="{{dangerous attribute}}"></div>
17712 !! html/php
17713 <div title=""></div>
17714
17715 !! html/parsoid
17716 <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>
17717 !! end
17718
17719 !! test
17720 T4304: HTML attribute safety (dangerous style template; 2309)
17721 !! wikitext
17722 <div style="{{dangerous style attribute}}"></div>
17723 !! html/php
17724 <div style="/* insecure input */"></div>
17725
17726 !! html/parsoid
17727 <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>
17728 !! end
17729
17730 !! test
17731 T4304: HTML attribute safety (safe parameter; 2309)
17732 !! wikitext
17733 {{div style|width: 200px}}
17734 !! html/php
17735 <div style="float: right; width: 200px">Magic div</div>
17736
17737 !! html/parsoid
17738 <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>
17739 !! end
17740
17741 !! test
17742 T4304: HTML attribute safety (unsafe parameter; 2309)
17743 !! wikitext
17744 {{div style|width: expression(alert(document.cookie))}}
17745 !! html/php
17746 <div style="/* insecure input */">Magic div</div>
17747
17748 !! html/parsoid
17749 <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>
17750 !! end
17751
17752 ## Parsoid output here differs; needs investigation.
17753 !! test
17754 T4304: HTML attribute safety (unsafe breakout parameter; 2309)
17755 !! wikitext
17756 {{div style|"><script>alert(document.cookie)</script>}}
17757 !! html
17758 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
17759
17760 !! end
17761
17762 ## Parsoid output here differs; needs investigation.
17763 !! test
17764 T4304: HTML attribute safety (unsafe breakout parameter 2; 2309)
17765 !! wikitext
17766 {{div style|" ><script>alert(document.cookie)</script>}}
17767 !! html
17768 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
17769
17770 !! end
17771
17772 !! test
17773 T4304: HTML attribute safety (link)
17774 !! wikitext
17775 <div title="[[Main Page]]"></div>
17776 !! html
17777 <div title="&#91;&#91;Main Page&#93;&#93;"></div>
17778
17779 !! end
17780
17781 !! test
17782 T4304: HTML attribute safety (italics)
17783 !! wikitext
17784 <div title="''foobar''"></div>
17785 !! html
17786 <div title="&#39;&#39;foobar&#39;&#39;"></div>
17787
17788 !! end
17789
17790 !! test
17791 T4304: HTML attribute safety (bold)
17792 !! wikitext
17793 <div title="'''foobar'''"></div>
17794 !! html
17795 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
17796
17797 !! end
17798
17799 !! test
17800 T4304: HTML attribute safety (ISBN)
17801 !! wikitext
17802 <div title="ISBN 1234567890"></div>
17803 !! html
17804 <div title="&#73;SBN 1234567890"></div>
17805
17806 !! end
17807
17808 !! test
17809 T4304: HTML attribute safety (RFC)
17810 !! wikitext
17811 <div title="RFC 1234"></div>
17812 !! html
17813 <div title="&#82;FC 1234"></div>
17814
17815 !! end
17816
17817 !! test
17818 T4304: HTML attribute safety (PMID)
17819 !! wikitext
17820 <div title="PMID 1234567890"></div>
17821 !! html
17822 <div title="&#80;MID 1234567890"></div>
17823
17824 !! end
17825
17826 !! test
17827 T4304: HTML attribute safety (web link)
17828 !! wikitext
17829 <div title="http://example.com/"></div>
17830 !! html
17831 <div title="http&#58;//example.com/"></div>
17832
17833 !! end
17834
17835 !! test
17836 T4304: HTML attribute safety (named web link)
17837 !! wikitext
17838 <div title="[http://example.com/ link]"></div>
17839 !! html
17840 <div title="&#91;http&#58;//example.com/ link&#93;"></div>
17841
17842 !! end
17843
17844 !! test
17845 T5244: HTML attribute safety (extension; safe)
17846 !! wikitext
17847 <div style="<nowiki>background:blue</nowiki>"></div>
17848 !! html/php
17849 <div style="background:blue"></div>
17850
17851 !! html/parsoid
17852 <div style="background:blue" data-parsoid='{"stx":"html","a":{"style":"background:blue"},"sa":{"style":"&lt;nowiki>background:blue&lt;/nowiki>"}}'></div>
17853 !! end
17854
17855 !! test
17856 T5244: HTML attribute safety (extension; unsafe)
17857 !! wikitext
17858 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
17859 !! html/php
17860 <div style="/* insecure input */"></div>
17861
17862 !! html/parsoid
17863 <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>
17864 !! end
17865
17866 # More MSIE fun discovered by Tom Gilder
17867
17868 !! test
17869 MSIE CSS safety test: spurious slash
17870 !! wikitext
17871 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
17872 !! html/php
17873 <div style="/* insecure input */">evil</div>
17874
17875 !! html/parsoid
17876 <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>
17877 !! end
17878
17879 !! test
17880 MSIE CSS safety test: hex code
17881 !! wikitext
17882 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
17883 !! html/php
17884 <div style="/* insecure input */">evil</div>
17885
17886 !! html/parsoid
17887 <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>
17888 !! end
17889
17890 !! test
17891 MSIE CSS safety test: comment in url
17892 !! wikitext
17893 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
17894 !! html/php
17895 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
17896
17897 !! html/parsoid
17898 <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>
17899 !! end
17900
17901 !! test
17902 MSIE CSS safety test: comment in expression
17903 !! wikitext
17904 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
17905 !! html/php
17906 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
17907
17908 !! html/parsoid
17909 <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>
17910 !! end
17911
17912 !! test
17913 CSS safety test (all browsers): vertical tab (T57332 / CVE-2013-4567)
17914 !! wikitext
17915 <p style="font-size: 100px; background-image:url\b(https://www.google.com/images/srpr/logo6w.png)">A</p>
17916 !! html/php
17917 <p style="/* invalid control char */">A</p>
17918
17919 !! html/parsoid
17920 <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>
17921 !! end
17922
17923 !! test
17924 MSIE 6 CSS safety test: Fullwidth (T57332)
17925 !! wikitext
17926 <p style="font-size: 100px; color: expression((title='XSSed'),'red')">A</p>
17927 <div style="top:EXPRESSION(alert())">B</div>
17928 !! html/php
17929 <p style="/* insecure input */">A</p>
17930 <div style="/* insecure input */">B</div>
17931
17932 !! html/parsoid
17933 <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>
17934 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"top:EXPRESSION(alert())"}}'>B</div>
17935 !! end
17936
17937 !! test
17938 MSIE 6 CSS safety test: IPA extensions (T57332)
17939 !! wikitext
17940 <div style="background-image:uʀʟ(javascript:alert())">A</div>
17941 <p style="font-size: 100px; color: expʀessɪoɴ((title='XSSed'),'red')">B</p>
17942 !! html/php
17943 <div style="/* insecure input */">A</div>
17944 <p style="/* insecure input */">B</p>
17945
17946 !! html/parsoid
17947 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"background-image:uʀʟ(javascript:alert())"}}'>A</div>
17948 <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>
17949 !! end
17950
17951 !! test
17952 MSIE 6 CSS safety test: sup/sub script (T57332)
17953 !! wikitext
17954 <div style="background-image:url⁽javascript:alert())">A</div>
17955 <div style="background-image:url₍javascript:alert())">B</div>
17956 <p style="font-size: 100px; color: expressioⁿ((title='XSSed'),'red')">C</p>
17957 !! html/php
17958 <div style="/* insecure input */">A</div>
17959 <div style="/* insecure input */">B</div>
17960 <p style="/* insecure input */">C</p>
17961
17962 !! html/parsoid
17963 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"background-image:url⁽javascript:alert())"}}'>A</div>
17964 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"background-image:url₍javascript:alert())"}}'>B</div>
17965 <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>
17966 !! end
17967
17968 !! test
17969 Opera -o-link CSS
17970 !! options
17971 parsoid=wt2html,html2html
17972 !! wikitext
17973 <div
17974 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;"
17975 style="-o-link:attr(title);-o-link-source:current">X</div>
17976 !! html/php
17977 <div title="data:text/html,&lt;img src=1 onerror=alert(1)&gt;" style="/* insecure input */">X</div>
17978
17979 !! html/parsoid
17980 <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>
17981 !! end
17982
17983 !! test
17984 MSIE 6 CSS safety test: Repetition markers (T57332)
17985 !! wikitext
17986 <p style="font-size: 100px; color: expres〱ion((title='XSSed'),'red')">A</p>
17987 <p style="font-size: 100px; color: expresゝion((title='XSSed'),'red')">B</p>
17988 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">C</p>
17989 <p style="font-size: 100px; color: expresヽion((title='XSSed'),'red')">D</p>
17990 <p style="font-size: 100px; color: expresﹽion((title='XSSed'),'red')">E</p>
17991 <p style="font-size: 100px; color: expresﹼion((title='XSSed'),'red')">F</p>
17992 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">G</p>
17993 !! html/php
17994 <p style="/* insecure input */">A</p>
17995 <p style="/* insecure input */">B</p>
17996 <p style="/* insecure input */">C</p>
17997 <p style="/* insecure input */">D</p>
17998 <p style="/* insecure input */">E</p>
17999 <p style="/* insecure input */">F</p>
18000 <p style="/* insecure input */">G</p>
18001
18002 !! html/parsoid
18003 <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>
18004 <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>
18005 <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>
18006 <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>
18007 <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>
18008 <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>
18009 <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>
18010 !! end
18011
18012 !! test
18013 Table attribute legitimate extension
18014 !! wikitext
18015 {|
18016 !+ style="<nowiki>color:blue</nowiki>"| status
18017 |}
18018 !! html
18019 <table>
18020 <tr>
18021 <th style="color:blue"> status
18022 </th></tr></table>
18023
18024 !!end
18025
18026 !! test
18027 Table attribute safety
18028 !! wikitext
18029 {|
18030 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
18031 |}
18032 !! html
18033 <table>
18034 <tr>
18035 <th style="/* insecure input */"> status
18036 </th></tr></table>
18037
18038 !! end
18039
18040 !! test
18041 CSS line continuation 1
18042 !! wikitext
18043 <div style="background-image: u\&#10;rl(test.jpg);"></div>
18044 !! html
18045 <div style="/* insecure input */"></div>
18046
18047 !! end
18048
18049 !! test
18050 CSS line continuation 2
18051 !! wikitext
18052 <div style="background-image: u\&#13;rl(test.jpg); "></div>
18053 !! html
18054 <div style="/* invalid control char */"></div>
18055
18056 !! end
18057
18058 !! article
18059 Template:Identity
18060 !! text
18061 {{{1}}}
18062 !! endarticle
18063
18064 !! test
18065 Expansion of multi-line templates in attribute values (T8255)
18066 !! wikitext
18067 <div style="background: {{identity|#00FF00}}">-</div>
18068 !! html
18069 <div style="background: #00FF00">-</div>
18070
18071 !! end
18072
18073 !! test
18074 Expansion of multi-line templates in attribute values (T8255 sanity check)
18075 !! wikitext
18076 <div style="background:
18077 #00FF00">-</div>
18078 !! html/php
18079 <div style="background: #00FF00">-</div>
18080
18081 !! html/parsoid
18082 <div style="background:
18083 #00FF00">-</div>
18084 !! end
18085
18086 !! test
18087 Expansion of multi-line templates in attribute values (T8255 sanity check 2)
18088 !! wikitext
18089 <div style="background: &#10;#00FF00">-</div>
18090 !! html
18091 <div style="background: &#10;#00FF00">-</div>
18092
18093 !! end
18094
18095 !! test
18096 Tags which are hidden from Tidy cannot pass through the Sanitizer
18097 !! wikitext
18098 <mw:toc><script>alert();</script></mw:toc>
18099 !! html+tidy
18100 <p>&lt;mw:toc&gt;&lt;script&gt;alert();&lt;/script&gt;&lt;/mw:toc&gt;</p>
18101 !! end
18102
18103 ###
18104 ### Parser hooks (see tests/parser/parserTestsParserHook.php for the <tag> extension)
18105 ###
18106
18107 !! test
18108 Parser hook: empty input
18109 !! wikitext
18110 <tag></tag>
18111 !! html/php
18112 <pre>
18113 ''
18114 array (
18115 )
18116 </pre>
18117
18118 !! html/parsoid
18119 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
18120 !! end
18121
18122 ## Don't expect parsoid to rt this form.
18123 !! test
18124 Parser hook: empty input using terminated empty elements
18125 !! options
18126 parsoid=wt2html,html2html
18127 !! wikitext
18128 <tag/>
18129 !! html/php
18130 <pre>
18131 NULL
18132 array (
18133 )
18134 </pre>
18135
18136 !! html/parsoid
18137 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":null}' data-parsoid='{}' about="#mwt2"></pre>
18138 !! end
18139
18140 !! test
18141 Parser hook: empty input using terminated empty elements (space before)
18142 !! wikitext
18143 <tag />
18144 !! html/php
18145 <pre>
18146 NULL
18147 array (
18148 )
18149 </pre>
18150
18151 !! html/parsoid
18152 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":null}' data-parsoid='{}' about="#mwt2"></pre>
18153 !! end
18154
18155 !! test
18156 Parser hook: basic input
18157 !! wikitext
18158 <tag>input</tag>
18159 !! html/php
18160 <pre>
18161 'input'
18162 array (
18163 )
18164 </pre>
18165
18166 !! html/parsoid
18167 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
18168 !! end
18169
18170 ## Don't expect parsoid to rt this form.
18171 !! test
18172 Parser hook: case insensitive
18173 !! options
18174 parsoid=wt2html,html2html
18175 !! wikitext
18176 <TAG>input</TAG>
18177 !! html/php
18178 <pre>
18179 'input'
18180 array (
18181 )
18182 </pre>
18183
18184 !! html/parsoid
18185 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
18186 !! end
18187
18188 ## Don't expect parsoid to rt this form.
18189 !! test
18190 Parser hook: case insensitive, redux
18191 !! options
18192 parsoid=wt2html,html2html
18193 !! wikitext
18194 <TaG>input</TAg>
18195 !! html/php
18196 <pre>
18197 'input'
18198 array (
18199 )
18200 </pre>
18201
18202 !! html/parsoid
18203 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
18204 !! end
18205
18206 !! test
18207 Parser hook: nested tags
18208 !! wikitext
18209 <tag><tag></tag></tag>
18210 !! html/php
18211 <pre>
18212 '<tag>'
18213 array (
18214 )
18215 </pre>&lt;/tag&gt;
18216
18217 !! html/parsoid
18218 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"&lt;tag>"}}' data-parsoid='{}' about="#mwt2"></pre>&lt;/tag>
18219 !! end
18220
18221 !! test
18222 Parser hook: basic arguments
18223 !! wikitext
18224 <tag width="200" height="100" depth="50" square=""></tag>
18225 !! html/php
18226 <pre>
18227 ''
18228 array (
18229 'width' => '200',
18230 'height' => '100',
18231 'depth' => '50',
18232 'square' => '',
18233 )
18234 </pre>
18235
18236 !! html/parsoid
18237 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
18238 !! end
18239
18240 ## Don't expect parsoid to rt this form.
18241 !! test
18242 Parser hook: basic arguments, variations
18243 !! options
18244 parsoid=wt2html,html2html
18245 !! wikitext
18246 <tag width=200 height = "100" depth = '50' square></tag>
18247 !! html/php
18248 <pre>
18249 ''
18250 array (
18251 'width' => '200',
18252 'height' => '100',
18253 'depth' => '50',
18254 'square' => '',
18255 )
18256 </pre>
18257
18258 !! html/parsoid
18259 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
18260 !! end
18261
18262 !! test
18263 Parser hook: argument containing a forward slash (T7344)
18264 !! wikitext
18265 <tag filename="/tmp/bla"></tag>
18266 !! html/php
18267 <pre>
18268 ''
18269 array (
18270 'filename' => '/tmp/bla',
18271 )
18272 </pre>
18273
18274 !! html/parsoid
18275 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"filename":"/tmp/bla"},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
18276 !! end
18277
18278 ## Don't expect parsoid to rt this form.
18279 !! test
18280 Parser hook: empty input using terminated empty elements (T4374)
18281 !! options
18282 parsoid=wt2html,html2html
18283 !! wikitext
18284 <tag foo=bar/>text
18285 !! html/php
18286 <pre>
18287 NULL
18288 array (
18289 'foo' => 'bar',
18290 )
18291 </pre>text
18292
18293 !! html/parsoid
18294 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"foo":"bar"},"body":null}' data-parsoid='{}' about="#mwt2"></pre>text
18295 !! end
18296
18297 ## </tag> should be output literally since there is no matching tag that begins it
18298 ## Don't expect parsoid to rt this form.
18299 !! test
18300 Parser hook: basic arguments using terminated empty elements (T4374)
18301 !! options
18302 parsoid=wt2html
18303 !! wikitext
18304 <tag width=200 height = "100" depth = '50' square/>
18305 other stuff
18306 </tag>
18307 !! html/php
18308 <pre>
18309 NULL
18310 array (
18311 'width' => '200',
18312 'height' => '100',
18313 'depth' => '50',
18314 'square' => '',
18315 )
18316 </pre>
18317 <p>other stuff
18318 &lt;/tag&gt;
18319 </p>
18320 !! html/parsoid
18321 <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
18322 &lt;/tag></p>
18323 !! end
18324
18325 ## Don't expect parsoid to rt this form.
18326 !! test
18327 Parser hook: Don't allow unclosed extension tags
18328 !! options
18329 parsoid=wt2html
18330 !! wikitext
18331 test <tag>123
18332
18333 this is a '''test'''
18334 !! html/php
18335 <p>test &lt;tag&gt;123
18336 </p><p>this is a <b>test</b>
18337 </p>
18338 !! html/parsoid
18339 <p>test &lt;tag>123</p>
18340
18341 <p>this is a <b>test</b></p>
18342 !! end
18343
18344 ###
18345 ### (see tests/parser/parserTestsParserHook.php for the <statictag> extension)
18346 ###
18347
18348 !! test
18349 Parser hook: static parser hook not inside a comment
18350 !! wikitext
18351 <statictag>hello, world</statictag>
18352
18353 <statictag action="flush" />
18354 !! html/php
18355 <p><br />
18356 hello, world
18357 </p>
18358 !! html/parsoid
18359 <p><span typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{},"body":{"extsrc":"hello, world"}}' data-parsoid='{}' about="#mwt2"></span></p>
18360 <p typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{"action":"flush"},"body":null}' data-parsoid='{}' about="#mwt4">hello, world</p>
18361 !! end
18362
18363 !! test
18364 Parser hook: static parser hook inside a comment
18365 !! wikitext
18366 <!-- <statictag>hello, world</statictag> -->
18367 <statictag action="flush" />
18368 !! html/php
18369 <p><br />
18370 </p>
18371 !! html/parsoid
18372 <!-- <statictag&#x3E;hello, world</statictag&#x3E; -->
18373 <p typeof='mw:Extension/statictag' data-mw='{"name":"statictag","attrs":{"action":"flush"},"body":null}' data-parsoid='{}' about='#mwt2'></p>
18374 !! end
18375
18376 # Nested template calls; this case was broken by Parser.php rev 1.506,
18377 # since reverted.
18378
18379 !! article
18380 Template:One-parameter
18381 !! text
18382 (My parameter is: {{{1}}})
18383 !! endarticle
18384
18385 !! article
18386 Template:Map-one-parameter
18387 !! text
18388 {{{{{1}}}|{{{2}}}}}
18389 !! endarticle
18390
18391 !! test
18392 Nested template calls
18393 !! wikitext
18394 {{Map-one-parameter|One-parameter|param}}
18395 !! html
18396 <p>(My parameter is: param)
18397 </p>
18398 !! end
18399
18400
18401 ###
18402 ### Sanitizer
18403 ###
18404
18405 # HTML+Tidy strips out empty tags completely. Parsoid doesn't.
18406 # FIXME: Wikitext for this first test doesn't match its title.
18407 !! test
18408 Sanitizer: Closing of open tags
18409 !! wikitext
18410 <s></s><table></table>
18411 !! html/php+tidy
18412
18413 !! html/parsoid
18414 <s></s><table></table>
18415 !! end
18416
18417 !! test
18418 Sanitizer: Closing of open but not closed tags
18419 !! wikitext
18420 <s>foo
18421 !! html
18422 <p><s>foo</s>
18423 </p>
18424 !! end
18425
18426 !! test
18427 Sanitizer: Closing of closed but not open tags
18428 !! options
18429 parsoid=wt2html
18430 !! wikitext
18431 </s>
18432 !! html/php+tidy
18433 !! html/parsoid
18434 !! end
18435
18436 !! test
18437 Sanitizer: Closing of closed but not open table tags
18438 !! options
18439 parsoid=wt2html
18440 !! wikitext
18441 Table not started</td></tr></table>
18442 !! html/php+tidy
18443 <p>Table not started</p>
18444 !! html/parsoid
18445 <p>Table not started</p>
18446 !! end
18447
18448 !! test
18449 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
18450 !! wikitext
18451 <span id="æ: v">byte</span>[[#æ: v|backlink]]
18452 !! html/php
18453 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
18454 </p>
18455 !! html/parsoid
18456 <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>
18457 !! end
18458
18459 # In HTML5, the restrictions are that id must contain at least one character,
18460 # and must not contain any space characters.
18461 !! test
18462 Sanitizer: Validating the contents of the id attribute (T6515)
18463 !! options
18464 disabled
18465 !! wikitext
18466 <br id="" /><br id="a space" />
18467 !! html
18468 Something ...
18469 !! end
18470
18471 # In HTML5, id must be unique amongst all the ids in the element's home subtree.
18472 !! test
18473 Sanitizer: Validating id attribute uniqueness (T6515, T8301)
18474 !! options
18475 disabled
18476 !! wikitext
18477 <br id="foo" /><br id="foo" />
18478 !! html
18479 Something need to be done. foo-2 ?
18480 !! end
18481
18482 !! test
18483 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
18484 !! wikitext
18485 <div itemscope>
18486 <meta itemprop="hello" content="world">
18487 <meta http-equiv="refresh" content="5">
18488 <meta itemprop="hello" http-equiv="refresh" content="5">
18489 <link itemprop="hello" href="{{SERVER}}">
18490 <link rel="stylesheet" href="{{SERVER}}">
18491 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
18492 </div>
18493 !! html
18494 <div itemscope="">
18495 <p> <meta itemprop="hello" content="world" />
18496 &lt;meta http-equiv="refresh" content="5"&gt;
18497 <meta itemprop="hello" content="5" />
18498 <link itemprop="hello" href="http&#58;//example.org" />
18499 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
18500 <link itemprop="hello" href="http&#58;//example.org" />
18501 </p>
18502 </div>
18503
18504 !! end
18505
18506 !! test
18507 Sanitizer: Strip comments from CSS attributes
18508 !! options
18509 parsoid=wt2html,wt2wt
18510 !! wikitext
18511 <span style="margin:/*negate mbox-text padding */-0.125em -0.45em; /*rainbow*/rgba(255, 0, 0, 0.3)">2013</span>
18512 !! html/php
18513 <p><span style="margin: -0.125em -0.45em; rgba(255, 0, 0, 0.3)">2013</span>
18514 </p>
18515 !! html/parsoid
18516 <p><span style="margin: -0.125em -0.45em; rgba(255, 0, 0, 0.3)">2013</span></p>
18517 !! end
18518
18519 !! test
18520 Language converter: output gets cut off unexpectedly (T7757)
18521 !! options
18522 language=zh
18523 !! wikitext
18524 this bit is safe: }-
18525
18526 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
18527
18528 then we get cut off here: }-
18529
18530 all additional text is vanished
18531 !! html/php
18532 <p>this bit is safe: }-
18533 </p><p>but if we add a conversion instance: xxx
18534 </p><p>then we get cut off here: }-
18535 </p><p>all additional text is vanished
18536 </p>
18537 !! html/parsoid
18538 <p>this bit is safe: }-</p>
18539 <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>
18540 <p>then we get cut off here: }-</p>
18541 <p>all additional text is vanished</p>
18542 !! end
18543
18544 !! test
18545 Language converter glossary rules inside attributes (T119158)
18546 !! options
18547 language=sr variant=sr-el
18548 !! wikitext
18549 -{H|foAjrjvi=>sr-el:" onload="alert(1)" data-foo="}-
18550
18551 [[File:Foobar.jpg|alt=-{}-foAjrjvi-{}-]]
18552 !! html
18553 <p>
18554 </p><p><a href="/wiki/%D0%94%D0%B0%D1%82%D0%BE%D1%82%D0%B5%D0%BA%D0%B0:Foobar.jpg" class="image"><img alt="&quot; onload=&quot;alert(1)&quot; data-foo=&quot;" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
18555 </p>
18556 !! end
18557
18558 !! test
18559 Self closed html pairs (T7487)
18560 !! wikitext
18561 <center><font id="bug" />Centered text</center>
18562 <div><font id="bug2" />In div text</div>
18563 !! html+tidy
18564 <center><font id="bug"></font>Centered text</center>
18565 <div><font id="bug2"></font>In div text</div>
18566 !! end
18567
18568 #
18569 #
18570 #
18571
18572 !! test
18573 Punctuation: nbsp before exclamation
18574 !! wikitext
18575 C'est grave !
18576 !! html
18577 <p>C'est grave&#160;!
18578 </p>
18579 !! end
18580
18581 !! test
18582 Punctuation: CSS !important (T13874)
18583 !! wikitext
18584 <div style="width:50% !important">important</div>
18585 !! html
18586 <div style="width:50% !important">important</div>
18587
18588 !!end
18589
18590 !! test
18591 Punctuation: CSS ! important (T13874; with space after)
18592 !! wikitext
18593 <div style="width:50% ! important">important</div>
18594 !! html
18595 <div style="width:50% ! important">important</div>
18596
18597 !!end
18598
18599 !! test
18600 HTML bullet list, closed tags (T7497)
18601 !! wikitext
18602 <ul>
18603 <li>One</li>
18604 <li>Two</li>
18605 </ul>
18606 !! html/php
18607 <ul>
18608 <li>One</li>
18609 <li>Two</li>
18610 </ul>
18611
18612 !! html/parsoid
18613 <ul data-parsoid='{"stx":"html"}'>
18614 <li data-parsoid='{"stx":"html"}'>One</li>
18615 <li data-parsoid='{"stx":"html"}'>Two</li>
18616 </ul>
18617
18618 !! end
18619
18620 !! test
18621 HTML bullet list, unclosed tags (T7497)
18622 !! wikitext
18623 <ul>
18624 <li>One
18625 <li>Two
18626 </ul>
18627 !! html/php+tidy
18628 <ul>
18629 <li>One</li>
18630 <li>Two</li>
18631 </ul>
18632 !! html/parsoid
18633 <ul data-parsoid='{"stx":"html"}'>
18634 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
18635 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
18636 </ul>
18637
18638 !! end
18639
18640 !! test
18641 HTML ordered list, closed tags (T7497)
18642 !! wikitext
18643 <ol>
18644 <li>One</li>
18645 <li>Two</li>
18646 </ol>
18647 !! html/php
18648 <ol>
18649 <li>One</li>
18650 <li>Two</li>
18651 </ol>
18652
18653 !! html/parsoid
18654 <ol data-parsoid='{"stx":"html"}'>
18655 <li data-parsoid='{"stx":"html"}'>One</li>
18656 <li data-parsoid='{"stx":"html"}'>Two</li>
18657 </ol>
18658
18659 !! end
18660
18661 !! test
18662 HTML ordered list, unclosed tags (T7497)
18663 !! options
18664 !! wikitext
18665 <ol>
18666 <li>One
18667 <li>Two
18668 </ol>
18669 !! html/php+tidy
18670 <ol>
18671 <li>One</li>
18672 <li>Two</li>
18673 </ol>
18674 !! html/parsoid
18675 <ol data-parsoid='{"stx":"html"}'>
18676 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
18677 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
18678 </ol>
18679
18680 !! end
18681
18682 !! test
18683 HTML nested bullet list, closed tags (T7497)
18684 !! wikitext
18685 <ul>
18686 <li>One</li>
18687 <li>Two:
18688 <ul>
18689 <li>Sub-one</li>
18690 <li>Sub-two</li>
18691 </ul>
18692 </li>
18693 </ul>
18694 !! html/php
18695 <ul>
18696 <li>One</li>
18697 <li>Two:
18698 <ul>
18699 <li>Sub-one</li>
18700 <li>Sub-two</li>
18701 </ul>
18702 </li>
18703 </ul>
18704
18705 !! html/parsoid
18706 <ul data-parsoid='{"stx":"html"}'>
18707 <li data-parsoid='{"stx":"html"}'>One</li>
18708 <li data-parsoid='{"stx":"html"}'>Two:
18709 <ul data-parsoid='{"stx":"html"}'>
18710 <li data-parsoid='{"stx":"html"}'>Sub-one</li>
18711 <li data-parsoid='{"stx":"html"}'>Sub-two</li>
18712 </ul>
18713 </li>
18714 </ul>
18715 !! end
18716
18717 !! test
18718 HTML nested bullet list, open tags (T7497)
18719 !! wikitext
18720 <ul>
18721 <li>One
18722 <li>Two:
18723 <ul>
18724 <li>Sub-one
18725 <li>Sub-two
18726 </ul>
18727 </ul>
18728 !! html/php+tidy
18729 <ul>
18730 <li>One</li>
18731 <li>Two:
18732 <ul>
18733 <li>Sub-one</li>
18734 <li>Sub-two</li>
18735 </ul>
18736 </li>
18737 </ul>
18738 !! html/parsoid
18739 <ul>
18740 <li>One
18741 </li>
18742 <li>Two:
18743 <ul>
18744 <li>Sub-one
18745 </li>
18746 <li>Sub-two
18747 </li>
18748 </ul>
18749 </li>
18750 </ul>
18751
18752 !! end
18753
18754 !! test
18755 HTML nested ordered list, closed tags (T7497)
18756 !! wikitext
18757 <ol>
18758 <li>One</li>
18759 <li>Two:
18760 <ol>
18761 <li>Sub-one</li>
18762 <li>Sub-two</li>
18763 </ol>
18764 </li>
18765 </ol>
18766 !! html
18767 <ol>
18768 <li>One</li>
18769 <li>Two:
18770 <ol>
18771 <li>Sub-one</li>
18772 <li>Sub-two</li>
18773 </ol>
18774 </li>
18775 </ol>
18776
18777 !! end
18778
18779 !! test
18780 HTML nested ordered list, open tags (T7497)
18781 !! wikitext
18782 <ol>
18783 <li>One
18784 <li>Two:
18785 <ol>
18786 <li>Sub-one
18787 <li>Sub-two
18788 </ol>
18789 </ol>
18790 !! html/php
18791 <ol>
18792 <li>One
18793 <li>Two:
18794 <ol>
18795 <li>Sub-one
18796 <li>Sub-two
18797 </ol>
18798 </ol>
18799
18800 !! html/parsoid
18801 <ol>
18802 <li>One
18803 </li>
18804 <li>Two:
18805 <ol>
18806 <li>Sub-one
18807 </li>
18808 <li>Sub-two
18809 </li>
18810 </ol>
18811 </li>
18812 </ol>
18813
18814 !! end
18815
18816 !! test
18817 HTML ordered list item with parameters oddity
18818 !! wikitext
18819 <ol><li id="fragment">One</li>
18820 </ol>
18821 !! html
18822 <ol><li id="fragment">One</li>
18823 </ol>
18824
18825 !! end
18826
18827 # parsoid doesn't explicitly mark autonumbered links, see T55505
18828 !!test
18829 T7918: autonumbering
18830 !! wikitext
18831 [http://first/] [http://second] [ftp://ftp]
18832
18833 ftp://inlineftp
18834
18835 [mailto:enclosed@mail.tld With target]
18836
18837 [mailto:enclosed@mail.tld]
18838
18839 mailto:inline@mail.tld
18840 !! html/php
18841 <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>
18842 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
18843 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
18844 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
18845 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
18846 </p>
18847 !! html/parsoid
18848 <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>
18849 <p><a rel="mw:ExtLink" href="ftp://inlineftp">ftp://inlineftp</a></p>
18850 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld">With target</a></p>
18851 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld"></a></p>
18852 <p><a rel="mw:ExtLink" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a></p>
18853 !! end
18854
18855
18856 #
18857 # Security and HTML correctness
18858 # From Nick Jenkins' fuzz testing
18859 #
18860
18861 !! test
18862 Fuzz testing: Parser13
18863 !! wikitext
18864 {|
18865 | http://a|
18866 !! html
18867 <table>
18868 <tr>
18869 <td>
18870 </td>
18871 </tr>
18872 </table>
18873
18874 !! end
18875
18876 !! test
18877 Fuzz testing: Parser14
18878 !! wikitext
18879 == onmouseover= ==
18880 http://__TOC__
18881 !! html
18882 <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>
18883 http://<div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
18884 <ul>
18885 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
18886 </ul>
18887 </div>
18888
18889
18890 !! html+tidy
18891 <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>
18892 <p>http://</p>
18893 <div id="toc" class="toc">
18894 <div class="toctitle">
18895 <h2>Contents</h2>
18896 </div>
18897 <ul>
18898 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
18899 </ul>
18900 </div>
18901 <p></p>
18902 !! end
18903
18904 !! test
18905 Fuzz testing: Parser14-table
18906 !! options
18907 parsoid=wt2html,html2html
18908 !! wikitext
18909 ==a==
18910 {| STYLE=__TOC__
18911 !! html
18912 <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>
18913 <table style="&#95;_TOC&#95;_">
18914 <tr><td></td></tr>
18915 </table>
18916
18917 !! html+tidy
18918 <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>
18919 <table style="__TOC__">
18920 <tr>
18921 <td></td>
18922 </tr>
18923 </table>
18924 !! html/parsoid
18925 <h2>a</h2>
18926 <table style="__TOC__"></table>
18927 !! end
18928
18929 # Known to produce bogus xml (extra </td>)
18930 !! test
18931 Fuzz testing: Parser16
18932 !! wikitext
18933 {|
18934 !https://||||||
18935 !! html
18936 <table>
18937 <tr>
18938 <th>https://</th>
18939 <th></th>
18940 <th></th>
18941 <th>
18942 </td>
18943 </tr>
18944 </table>
18945
18946 !! html+tidy
18947 <table>
18948 <tr>
18949 <th>https://</th>
18950 <th></th>
18951 <th></th>
18952 <th></th>
18953 </tr>
18954 </table>
18955 !! end
18956
18957 !! test
18958 Fuzz testing: Parser21
18959 !! wikitext
18960 {|
18961 ! irc://{{ftp://a" onmouseover="alert('hello world');"
18962 |
18963 !! html
18964 <table>
18965 <tr>
18966 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
18967 </th>
18968 <td>
18969 </td>
18970 </tr>
18971 </table>
18972
18973 !! end
18974
18975 !! test
18976 Fuzz testing: Parser22
18977 !! wikitext
18978 http://===r:::https://b
18979
18980 {|
18981 !! html
18982 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
18983 </p>
18984 <table>
18985 <tr><td></td></tr>
18986 </table>
18987
18988 !! end
18989
18990 # Known to produce bad XML for now
18991 !! test
18992 Fuzz testing: Parser24
18993 !! options
18994 parsoid=wt2html
18995 !! wikitext
18996 {|
18997 {{{|
18998 <u CLASS=
18999 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
19000 <br style="onmouseover='alert(document.cookie);' " />
19001
19002 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
19003 |
19004 !! html/php
19005 <table>
19006 {{{|
19007 <u class="&#124;">}}}} &gt;
19008 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
19009
19010 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
19011 <tr>
19012 <td></u>
19013 </td>
19014 </tr>
19015 </table>
19016
19017 !! html/parsoid
19018 <p data-parsoid='{"fostered":true,"autoInsertedEnd":true}'>{{{|
19019 <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>"}'/>}}}} >
19020 <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}'>
19021
19022
19023
19024 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'></td></tr></tbody></table>
19025 !! end
19026
19027 # Note: the current result listed for this is not what the original one was,
19028 # but the original bug was JavaScript injection, which is fixed in any case.
19029 # It's not clear that the original result listed was any more correct than the
19030 # current one. Original result:
19031 # <p>{{{|
19032 # </p>
19033 # <li class="&#124;&#124;">
19034 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
19035 !!test
19036 Fuzz testing: Parser25 (T8055)
19037 !! wikitext
19038 {{{
19039 |
19040 <LI CLASS=||
19041 >
19042 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
19043 !! html/php
19044 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
19045 </p>
19046 !! html/parsoid
19047 <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"]}'>
19048 </span><p about="#mwt1">&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b></p>
19049 !! end
19050
19051 !!test
19052 Fuzz testing: URL adjacent extension (with space, clean)
19053 !! wikitext
19054 http://example.com <nowiki>junk</nowiki>
19055 !! html/php
19056 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
19057 </p>
19058 !! html/parsoid
19059 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a> <span typeof="mw:Nowiki">junk</span></p>
19060 !! end
19061
19062 !!test
19063 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
19064 !! wikitext
19065 http://example.com<nowiki>junk</nowiki>
19066 !! html/php
19067 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
19068 </p>
19069 !! html/parsoid
19070 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a><span typeof="mw:Nowiki">junk</span></p>
19071 !! end
19072
19073 !! test
19074 Fuzz testing: URL adjacent extension (no space, dirty; pre)
19075 !! wikitext
19076 http://example.com<pre>junk</pre>
19077 !! html/php
19078 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
19079
19080 !! html/php+tidy
19081 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></p>
19082 <pre>
19083 junk
19084 </pre>
19085 !! html/parsoid
19086 <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>
19087 !! end
19088
19089 !! test
19090 Fuzz testing: image with bogus manual thumbnail
19091 !! wikitext
19092 [[Image:foobar.jpg|thumbnail= ]]
19093 !! html/php
19094 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
19095
19096 !! html/parsoid
19097 <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>
19098 !! end
19099
19100 !! test
19101 Fuzz testing: encoded newline in generated HTML replacements (T8577)
19102 !! wikitext
19103 <pre dir="&#10;"></pre>
19104 !! html/php
19105 <pre dir="&#10;"></pre>
19106
19107 !! html/parsoid
19108 <pre typeof="mw:Extension/pre" about="#mwt2" dir="&amp;#10;" data-mw='{"name":"pre","attrs":{"dir":"&amp;#10;"},"body":{"extsrc":""}}'></pre>
19109 !! end
19110
19111 !! test
19112 Parsing optional HTML elements (T8171)
19113 !! options
19114 !! wikitext
19115 <table>
19116 <tr>
19117 <td> Some tabular data</td>
19118 <td> More tabular data ...
19119 <td> And yet som tabular data</td>
19120 </tr>
19121 </table>
19122 !! html
19123 <table>
19124 <tr>
19125 <td> Some tabular data</td>
19126 <td> More tabular data ...
19127 </td><td> And yet som tabular data</td>
19128 </tr>
19129 </table>
19130
19131 !! end
19132
19133 !! test
19134 Correct handling of <td>, <tr> (T8171)
19135 !! options
19136 !! wikitext
19137 <table>
19138 <tr>
19139 <td> Some tabular data</td>
19140 <td> More tabular data ...</td>
19141 <td> And yet som tabular data</td>
19142 </tr>
19143 </table>
19144 !! html
19145 <table>
19146 <tr>
19147 <td> Some tabular data</td>
19148 <td> More tabular data ...</td>
19149 <td> And yet som tabular data</td>
19150 </tr>
19151 </table>
19152
19153 !! end
19154
19155
19156 !! test
19157 Parsing crashing regression (fr:JavaScript)
19158 !! wikitext
19159 </body></x>
19160 !! html
19161 <p>&lt;/body&gt;&lt;/x&gt;
19162 </p>
19163 !! end
19164
19165 !! test
19166 Inline wiki vs wiki block nesting
19167 !! wikitext
19168 '''Bold paragraph
19169
19170 New wiki paragraph
19171 !! html
19172 <p><b>Bold paragraph</b>
19173 </p><p>New wiki paragraph
19174 </p>
19175 !! end
19176
19177 # FIXME: The current php output is documented
19178 # and desired output is the parsoid target.
19179 !! test
19180 Inline HTML vs wiki block nesting
19181 !! wikitext
19182 <b>Bold paragraph
19183
19184 New wiki paragraph
19185 !! html/php
19186 <p><b>Bold paragraph
19187 </p><p>New wiki paragraph</b>
19188 </p>
19189 !! html/parsoid
19190 <p><b>Bold paragraph</b>
19191 </p><p>New wiki paragraph
19192 </p>
19193 !! end
19194
19195 # Original result was this:
19196 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
19197 # </p>
19198 # While that might be marginally more intuitive, maybe, the six-apostrophe
19199 # construct is clearly pathological and the result stated here (which is what
19200 # the parser actually does) is about as reasonable as anything.
19201 !!test
19202 Mixing markup for italics and bold
19203 !! options
19204 !! wikitext
19205 '''bold''''''bold''bolditalics'''''
19206 !! html
19207 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
19208 </p>
19209 !! end
19210
19211
19212 !! article
19213 Xyzzyx
19214 !! text
19215 Article for special page transclusion test
19216 !! endarticle
19217
19218 !! test
19219 Special page transclusion
19220 !! options
19221 !! wikitext
19222 {{Special:Prefixindex/Xyzzyx}}
19223 !! html
19224 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
19225 </ul>
19226
19227 !! end
19228
19229 !! test
19230 Special page transclusion twice (T7021)
19231 !! options
19232 !! wikitext
19233 {{Special:Prefixindex/Xyzzyx}}
19234 {{Special:Prefixindex/Xyzzyx}}
19235 !! html
19236 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
19237 </ul>
19238 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
19239 </ul>
19240
19241 !! end
19242
19243 !! test
19244 Transclusion of default MediaWiki message
19245 !! wikitext
19246 {{MediaWiki:Mainpage}}
19247 !! html
19248 <p>Main Page
19249 </p>
19250 !! end
19251
19252 !! test
19253 Transclusion of nonexistent MediaWiki message
19254 !! wikitext
19255 {{MediaWiki:Mainpagexxx}}
19256 !! html
19257 <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>
19258 </p>
19259 !! end
19260
19261 !! test
19262 Transclusion of MediaWiki message with underscore
19263 !! wikitext
19264 {{MediaWiki:history_short}}
19265 !! html
19266 <p>History
19267 </p>
19268 !! end
19269
19270 !! test
19271 Transclusion of MediaWiki message with space
19272 !! wikitext
19273 {{MediaWiki:history short}}
19274 !! html
19275 <p>History
19276 </p>
19277 !! end
19278
19279 !! test
19280 Invalid header with following text
19281 !! wikitext
19282 = x = y
19283 !! html
19284 <p>= x = y
19285 </p>
19286 !! end
19287
19288
19289 !! test
19290 Section extraction test (section 0)
19291 !! options
19292 section=0
19293 !! wikitext
19294 start
19295 ==a==
19296 ===aa===
19297 ====aaa====
19298 ==b==
19299 ===ba===
19300 ===bb===
19301 ====bba====
19302 ===bc===
19303 ==c==
19304 ===ca===
19305 !! html/php
19306 start
19307 !! end
19308
19309 !! test
19310 Section extraction test (section 1)
19311 !! options
19312 section=1
19313 !! wikitext
19314 start
19315 ==a==
19316 ===aa===
19317 ====aaa====
19318 ==b==
19319 ===ba===
19320 ===bb===
19321 ====bba====
19322 ===bc===
19323 ==c==
19324 ===ca===
19325 !! html/php
19326 ==a==
19327 ===aa===
19328 ====aaa====
19329 !! end
19330
19331 !! test
19332 Section extraction test (section 2)
19333 !! options
19334 section=2
19335 !! wikitext
19336 start
19337 ==a==
19338 ===aa===
19339 ====aaa====
19340 ==b==
19341 ===ba===
19342 ===bb===
19343 ====bba====
19344 ===bc===
19345 ==c==
19346 ===ca===
19347 !! html/php
19348 ===aa===
19349 ====aaa====
19350 !! end
19351
19352 !! test
19353 Section extraction test (section 3)
19354 !! options
19355 section=3
19356 !! wikitext
19357 start
19358 ==a==
19359 ===aa===
19360 ====aaa====
19361 ==b==
19362 ===ba===
19363 ===bb===
19364 ====bba====
19365 ===bc===
19366 ==c==
19367 ===ca===
19368 !! html/php
19369 ====aaa====
19370 !! end
19371
19372 !! test
19373 Section extraction test (section 4)
19374 !! options
19375 section=4
19376 !! wikitext
19377 start
19378 ==a==
19379 ===aa===
19380 ====aaa====
19381 ==b==
19382 ===ba===
19383 ===bb===
19384 ====bba====
19385 ===bc===
19386 ==c==
19387 ===ca===
19388 !! html/php
19389 ==b==
19390 ===ba===
19391 ===bb===
19392 ====bba====
19393 ===bc===
19394 !! end
19395
19396 !! test
19397 Section extraction test (section 5)
19398 !! options
19399 section=5
19400 !! wikitext
19401 start
19402 ==a==
19403 ===aa===
19404 ====aaa====
19405 ==b==
19406 ===ba===
19407 ===bb===
19408 ====bba====
19409 ===bc===
19410 ==c==
19411 ===ca===
19412 !! html/php
19413 ===ba===
19414 !! end
19415
19416 !! test
19417 Section extraction test (section 6)
19418 !! options
19419 section=6
19420 !! wikitext
19421 start
19422 ==a==
19423 ===aa===
19424 ====aaa====
19425 ==b==
19426 ===ba===
19427 ===bb===
19428 ====bba====
19429 ===bc===
19430 ==c==
19431 ===ca===
19432 !! html/php
19433 ===bb===
19434 ====bba====
19435 !! end
19436
19437 !! test
19438 Section extraction test (section 7)
19439 !! options
19440 section=7
19441 !! wikitext
19442 start
19443 ==a==
19444 ===aa===
19445 ====aaa====
19446 ==b==
19447 ===ba===
19448 ===bb===
19449 ====bba====
19450 ===bc===
19451 ==c==
19452 ===ca===
19453 !! html/php
19454 ====bba====
19455 !! end
19456
19457 !! test
19458 Section extraction test (section 8)
19459 !! options
19460 section=8
19461 !! wikitext
19462 start
19463 ==a==
19464 ===aa===
19465 ====aaa====
19466 ==b==
19467 ===ba===
19468 ===bb===
19469 ====bba====
19470 ===bc===
19471 ==c==
19472 ===ca===
19473 !! html/php
19474 ===bc===
19475 !! end
19476
19477 !! test
19478 Section extraction test (section 9)
19479 !! options
19480 section=9
19481 !! wikitext
19482 start
19483 ==a==
19484 ===aa===
19485 ====aaa====
19486 ==b==
19487 ===ba===
19488 ===bb===
19489 ====bba====
19490 ===bc===
19491 ==c==
19492 ===ca===
19493 !! html/php
19494 ==c==
19495 ===ca===
19496 !! end
19497
19498 !! test
19499 Section extraction test (section 10)
19500 !! options
19501 section=10
19502 !! wikitext
19503 start
19504 ==a==
19505 ===aa===
19506 ====aaa====
19507 ==b==
19508 ===ba===
19509 ===bb===
19510 ====bba====
19511 ===bc===
19512 ==c==
19513 ===ca===
19514 !! html/php
19515 ===ca===
19516 !! end
19517
19518 !! test
19519 Section extraction test (nonexistent section 11)
19520 !! options
19521 section=11
19522 !! wikitext
19523 start
19524 ==a==
19525 ===aa===
19526 ====aaa====
19527 ==b==
19528 ===ba===
19529 ===bb===
19530 ====bba====
19531 ===bc===
19532 ==c==
19533 ===ca===
19534 !! html/php
19535 !! end
19536
19537 !! test
19538 Section extraction test with bogus heading (section 1)
19539 !! options
19540 section=1
19541 !! wikitext
19542 ==a==
19543 ==bogus== not a legal section
19544 ==b==
19545 !! html/php
19546 ==a==
19547 ==bogus== not a legal section
19548 !! end
19549
19550 !! test
19551 Section extraction test with bogus heading (section 2)
19552 !! options
19553 section=2
19554 !! wikitext
19555 ==a==
19556 ==bogus== not a legal section
19557 ==b==
19558 !! html/php
19559 ==b==
19560 !! end
19561
19562 !! test
19563 Section extraction test with comment after heading (section 1)
19564 !! options
19565 section=1
19566 !! wikitext
19567 ==a==
19568 ==b== <!-- -->
19569 ==c==
19570 !! html/php
19571 ==a==
19572 !! end
19573
19574 !! test
19575 Section extraction test with comment after heading (section 2)
19576 !! options
19577 section=2
19578 !! wikitext
19579 ==a==
19580 ==b== <!-- -->
19581 ==c==
19582 !! html/php
19583 ==b== <!-- -->
19584 !! end
19585
19586 !! test
19587 Section extraction test with bogus <nowiki> heading (section 1)
19588 !! options
19589 section=1
19590 !! wikitext
19591 ==a==
19592 ==bogus== <nowiki>not a legal section</nowiki>
19593 ==b==
19594 !! html/php
19595 ==a==
19596 ==bogus== <nowiki>not a legal section</nowiki>
19597 !! end
19598
19599 !! test
19600 Section extraction test with bogus <nowiki> heading (section 2)
19601 !! options
19602 section=2
19603 !! wikitext
19604 ==a==
19605 ==bogus== <nowiki>not a legal section</nowiki>
19606 ==b==
19607 !! html/php
19608 ==b==
19609 !! end
19610
19611 # Formerly testing for T4587, now resolved by the use of unmarked sections
19612 # instead of respecting commented sections
19613 !! test
19614 Section extraction prefixed by comment (section 1)
19615 !! options
19616 section=1
19617 !! wikitext
19618 <!-- -->==sec1==
19619 ==sec2==
19620 !! html/php
19621 ==sec2==
19622 !!end
19623
19624 !! test
19625 Section extraction prefixed by comment (section 2)
19626 !! options
19627 section=2
19628 !! wikitext
19629 <!-- -->==sec1==
19630 ==sec2==
19631 !! html/php
19632
19633 !!end
19634
19635 # Formerly testing for T4607, now resolved by the use of unmarked sections
19636 # instead of respecting HTML-style headings
19637 !! test
19638 Section extraction, mixed wiki and html (section 1)
19639 !! options
19640 section=1
19641 !! wikitext
19642 <h2>unmarked</h2>
19643 unmarked
19644 ==1==
19645 one
19646 ==2==
19647 two
19648 !! html/php
19649 ==1==
19650 one
19651 !! end
19652
19653 !! test
19654 Section extraction, mixed wiki and html (section 2)
19655 !! options
19656 section=2
19657 !! wikitext
19658 <h2>unmarked</h2>
19659 unmarked
19660 ==1==
19661 one
19662 ==2==
19663 two
19664 !! html/php
19665 ==2==
19666 two
19667 !! end
19668
19669
19670 # Formerly testing for T5342
19671 !! test
19672 Section extraction, heading surrounded by <noinclude>
19673 !! options
19674 section=1
19675 !! wikitext
19676 <noinclude>==unmarked==</noinclude>
19677 ==marked==
19678 !! html/php
19679 ==marked==
19680 !!end
19681
19682 # Test behavior of T21910
19683 !! test
19684 Sectiion with all-equals
19685 !! options
19686 section=2
19687 !! wikitext
19688 ===
19689 The line above must have a trailing space
19690 === <!--
19691 --> <!-- -->
19692 But just in case it doesn't...
19693 !! html/php
19694 === <!--
19695 --> <!-- -->
19696 But just in case it doesn't...
19697 !! end
19698
19699 !! test
19700 Section replacement test (section 0)
19701 !! options
19702 replace=0,"xxx"
19703 !! wikitext
19704 start
19705 ==a==
19706 ===aa===
19707 ====aaa====
19708 ==b==
19709 ===ba===
19710 ===bb===
19711 ====bba====
19712 ===bc===
19713 ==c==
19714 ===ca===
19715 !! html/php
19716 xxx
19717
19718 ==a==
19719 ===aa===
19720 ====aaa====
19721 ==b==
19722 ===ba===
19723 ===bb===
19724 ====bba====
19725 ===bc===
19726 ==c==
19727 ===ca===
19728 !! end
19729
19730 !! test
19731 Section replacement test (section 1)
19732 !! options
19733 replace=1,"xxx"
19734 !! wikitext
19735 start
19736 ==a==
19737 ===aa===
19738 ====aaa====
19739 ==b==
19740 ===ba===
19741 ===bb===
19742 ====bba====
19743 ===bc===
19744 ==c==
19745 ===ca===
19746 !! html/php
19747 start
19748 xxx
19749
19750 ==b==
19751 ===ba===
19752 ===bb===
19753 ====bba====
19754 ===bc===
19755 ==c==
19756 ===ca===
19757 !! end
19758
19759 !! test
19760 Section replacement test (section 2)
19761 !! options
19762 replace=2,"xxx"
19763 !! wikitext
19764 start
19765 ==a==
19766 ===aa===
19767 ====aaa====
19768 ==b==
19769 ===ba===
19770 ===bb===
19771 ====bba====
19772 ===bc===
19773 ==c==
19774 ===ca===
19775 !! html/php
19776 start
19777 ==a==
19778 xxx
19779
19780 ==b==
19781 ===ba===
19782 ===bb===
19783 ====bba====
19784 ===bc===
19785 ==c==
19786 ===ca===
19787 !! end
19788
19789 !! test
19790 Section replacement test (section 3)
19791 !! options
19792 replace=3,"xxx"
19793 !! wikitext
19794 start
19795 ==a==
19796 ===aa===
19797 ====aaa====
19798 ==b==
19799 ===ba===
19800 ===bb===
19801 ====bba====
19802 ===bc===
19803 ==c==
19804 ===ca===
19805 !! html/php
19806 start
19807 ==a==
19808 ===aa===
19809 xxx
19810
19811 ==b==
19812 ===ba===
19813 ===bb===
19814 ====bba====
19815 ===bc===
19816 ==c==
19817 ===ca===
19818 !! end
19819
19820 !! test
19821 Section replacement test (section 4)
19822 !! options
19823 replace=4,"xxx"
19824 !! wikitext
19825 start
19826 ==a==
19827 ===aa===
19828 ====aaa====
19829 ==b==
19830 ===ba===
19831 ===bb===
19832 ====bba====
19833 ===bc===
19834 ==c==
19835 ===ca===
19836 !! html/php
19837 start
19838 ==a==
19839 ===aa===
19840 ====aaa====
19841 xxx
19842
19843 ==c==
19844 ===ca===
19845 !! end
19846
19847 !! test
19848 Section replacement test (section 5)
19849 !! options
19850 replace=5,"xxx"
19851 !! wikitext
19852 start
19853 ==a==
19854 ===aa===
19855 ====aaa====
19856 ==b==
19857 ===ba===
19858 ===bb===
19859 ====bba====
19860 ===bc===
19861 ==c==
19862 ===ca===
19863 !! html/php
19864 start
19865 ==a==
19866 ===aa===
19867 ====aaa====
19868 ==b==
19869 xxx
19870
19871 ===bb===
19872 ====bba====
19873 ===bc===
19874 ==c==
19875 ===ca===
19876 !! end
19877
19878 !! test
19879 Section replacement test (section 6)
19880 !! options
19881 replace=6,"xxx"
19882 !! wikitext
19883 start
19884 ==a==
19885 ===aa===
19886 ====aaa====
19887 ==b==
19888 ===ba===
19889 ===bb===
19890 ====bba====
19891 ===bc===
19892 ==c==
19893 ===ca===
19894 !! html/php
19895 start
19896 ==a==
19897 ===aa===
19898 ====aaa====
19899 ==b==
19900 ===ba===
19901 xxx
19902
19903 ===bc===
19904 ==c==
19905 ===ca===
19906 !! end
19907
19908 !! test
19909 Section replacement test (section 7)
19910 !! options
19911 replace=7,"xxx"
19912 !! wikitext
19913 start
19914 ==a==
19915 ===aa===
19916 ====aaa====
19917 ==b==
19918 ===ba===
19919 ===bb===
19920 ====bba====
19921 ===bc===
19922 ==c==
19923 ===ca===
19924 !! html/php
19925 start
19926 ==a==
19927 ===aa===
19928 ====aaa====
19929 ==b==
19930 ===ba===
19931 ===bb===
19932 xxx
19933
19934 ===bc===
19935 ==c==
19936 ===ca===
19937 !! end
19938
19939 !! test
19940 Section replacement test (section 8)
19941 !! options
19942 replace=8,"xxx"
19943 !! wikitext
19944 start
19945 ==a==
19946 ===aa===
19947 ====aaa====
19948 ==b==
19949 ===ba===
19950 ===bb===
19951 ====bba====
19952 ===bc===
19953 ==c==
19954 ===ca===
19955 !! html/php
19956 start
19957 ==a==
19958 ===aa===
19959 ====aaa====
19960 ==b==
19961 ===ba===
19962 ===bb===
19963 ====bba====
19964 xxx
19965
19966 ==c==
19967 ===ca===
19968 !!end
19969
19970 !! test
19971 Section replacement test (section 9)
19972 !! options
19973 replace=9,"xxx"
19974 !! wikitext
19975 start
19976 ==a==
19977 ===aa===
19978 ====aaa====
19979 ==b==
19980 ===ba===
19981 ===bb===
19982 ====bba====
19983 ===bc===
19984 ==c==
19985 ===ca===
19986 !! html/php
19987 start
19988 ==a==
19989 ===aa===
19990 ====aaa====
19991 ==b==
19992 ===ba===
19993 ===bb===
19994 ====bba====
19995 ===bc===
19996 xxx
19997 !! end
19998
19999 !! test
20000 Section replacement test (section 10)
20001 !! options
20002 replace=10,"xxx"
20003 !! wikitext
20004 start
20005 ==a==
20006 ===aa===
20007 ====aaa====
20008 ==b==
20009 ===ba===
20010 ===bb===
20011 ====bba====
20012 ===bc===
20013 ==c==
20014 ===ca===
20015 !! html/php
20016 start
20017 ==a==
20018 ===aa===
20019 ====aaa====
20020 ==b==
20021 ===ba===
20022 ===bb===
20023 ====bba====
20024 ===bc===
20025 ==c==
20026 xxx
20027 !! end
20028
20029 !! test
20030 Section replacement test with initial whitespace (T15728)
20031 !! options
20032 replace=2,"xxx"
20033 !! wikitext
20034 Preformatted initial line
20035 ==a==
20036 ===a===
20037 !! html/php
20038 Preformatted initial line
20039 ==a==
20040 xxx
20041 !! end
20042
20043
20044 !! test
20045 Section extraction, heading followed by pre with 20 spaces (T8398)
20046 !! options
20047 section=1
20048 !! wikitext
20049 ==a==
20050 a
20051 !! html/php
20052 ==a==
20053 a
20054 !! end
20055
20056 !! test
20057 Section extraction, heading followed by pre with 19 spaces (T8398 sanity check)
20058 !! options
20059 section=1
20060 !! wikitext
20061 ==a==
20062 a
20063 !! html/php
20064 ==a==
20065 a
20066 !! end
20067
20068
20069 !! test
20070 Section extraction, <pre> around bogus header (T12309)
20071 !! options
20072 section=2
20073 !! wikitext
20074 == Section One ==
20075 <pre>
20076 =======
20077 </pre>
20078
20079 == Section Two ==
20080 stuff
20081 !! html/php
20082 == Section Two ==
20083 stuff
20084 !! end
20085
20086 !! test
20087 Section replacement, <pre> around bogus header (T12309)
20088 !! options
20089 replace=2,"xxx"
20090 !! wikitext
20091 == Section One ==
20092 <pre>
20093 =======
20094 </pre>
20095
20096 == Section Two ==
20097 stuff
20098 !! html/php
20099 == Section One ==
20100 <pre>
20101 =======
20102 </pre>
20103
20104 xxx
20105 !! end
20106
20107 !! test
20108 Handling of &#x0A; in URLs
20109 !! wikitext
20110 ** irc://&#x0A;a
20111 !! html/php
20112 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
20113
20114 !! html/parsoid
20115 <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>
20116 !! end
20117
20118 !! test
20119 Handling of %0A in URLs
20120 !! wikitext
20121 ** irc://%0Aa
20122 !! html/php
20123 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
20124
20125 !! html/parsoid
20126 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
20127 !! end
20128
20129 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
20130 !! test
20131 5 quotes, code coverage +1 line
20132 !! options
20133 parsoid=wt2html
20134 !! wikitext
20135 '''''
20136 !! html/php
20137 !! html/parsoid
20138 <b><i></i></b>
20139 !! end
20140
20141 # same html as previous, but wikitext adjusted to match parsoid html2wt
20142 # note that wt2html and html2html will put the <i> before the <b>
20143 !! test
20144 5 quotes, code coverage +1 line w/ nowiki (1)
20145 !! options
20146 parsoid=wt2wt,html2wt
20147 !! wikitext
20148 '''''<nowiki/>'''''
20149 !! html/php
20150 <p><i></i>
20151 </p>
20152 !! html/parsoid
20153 <p><b><i></i></b></p>
20154 !! end
20155
20156 # same as previous, just swapping the <i> and <b>
20157 !! test
20158 5 quotes, code coverage +1 line w/ nowiki (2)
20159 !! wikitext
20160 '''''<nowiki/>'''''
20161 !! html/php
20162 <p><i></i>
20163 </p>
20164 !! html/parsoid
20165 <p><i><b></b></i></p>
20166 !! end
20167
20168 !! test
20169 Special:Search page linking.
20170 !! wikitext
20171 {{Special:search}}
20172 !! html
20173 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
20174 </p>
20175 !! end
20176
20177 !! test
20178 {{!}} is a magic word
20179 !! wikitext
20180 {{!}} is a magic word there and {{!}} is still a magic word here
20181 | is not a magic word here but {{!}} is still a magic word here
20182 !! html/php
20183 <p>| is a magic word there and | is still a magic word here
20184 | is not a magic word here but | is still a magic word here
20185 </p>
20186 !! html/parsoid
20187 <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
20188 | 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>
20189 !! end
20190
20191 !! test
20192 Say the magic word
20193 !! options
20194 title=[[Parser test]]
20195 !! wikitext
20196 * {{PAGENAME}}
20197 * {{PAGENAMEE}}
20198 * {{FULLPAGENAME}}
20199 * {{FULLPAGENAMEE}}
20200 * {{BASEPAGENAME}}
20201 * {{BASEPAGENAMEE}}
20202 * {{SUBPAGENAME}}
20203 * {{SUBPAGENAMEE}}
20204 * {{ROOTPAGENAME}}
20205 * {{ROOTPAGENAMEE}}
20206 * {{TALKPAGENAME}}
20207 * {{TALKPAGENAMEE}}
20208 * {{SUBJECTPAGENAME}}
20209 * {{SUBJECTPAGENAMEE}}
20210 * {{NAMESPACEE}}
20211 * {{NAMESPACE}}
20212 * {{NAMESPACENUMBER}}
20213 * {{TALKSPACE}}
20214 * {{TALKSPACEE}}
20215 * {{SUBJECTSPACE}}
20216 * {{SUBJECTSPACEE}}
20217 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
20218 !! html
20219 <ul><li> Parser test</li>
20220 <li> Parser_test</li>
20221 <li> Parser test</li>
20222 <li> Parser_test</li>
20223 <li> Parser test</li>
20224 <li> Parser_test</li>
20225 <li> Parser test</li>
20226 <li> Parser_test</li>
20227 <li> Parser test</li>
20228 <li> Parser_test</li>
20229 <li> Talk:Parser test</li>
20230 <li> Talk:Parser_test</li>
20231 <li> Parser test</li>
20232 <li> Parser_test</li>
20233 <li> </li>
20234 <li> </li>
20235 <li> 0</li>
20236 <li> Talk</li>
20237 <li> Talk</li>
20238 <li> </li>
20239 <li> </li>
20240 <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>
20241
20242 !! end
20243 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
20244
20245 !! test
20246 Gallery with valid attributes
20247 !! wikitext
20248 <gallery type="123" summary="345">
20249 File:File:Foobar.jpg
20250 </gallery>
20251 !! html/php
20252 <ul class="gallery mw-gallery-traditional" type="123">
20253 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20254 <div class="thumb" style="height: 150px;">File:Foobar.jpg</div>
20255 <div class="gallerytext">
20256 </div>
20257 </div></li>
20258 </ul>
20259
20260 !! html/parsoid
20261 <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"}}'>
20262 <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>
20263 </ul>
20264 !! end
20265
20266 ## Parsoid thinks the "centre" here is a property, not a caption.
20267 !! test
20268 Gallery
20269 !! options
20270 parsoid={
20271 "modes": ["wt2html"],
20272 "nativeGallery": true
20273 }
20274 !! wikitext
20275 <gallery>
20276 image1.png |
20277 image2.gif|||||
20278
20279 image3|
20280 image4 |300px| centre
20281 image5.svg| http://///////
20282 [[x|xx]]]]
20283 * image6
20284 </gallery>
20285 !! html/php
20286 <ul class="gallery mw-gallery-traditional">
20287 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20288 <div class="thumb" style="height: 150px;">Image1.png</div>
20289 <div class="gallerytext">
20290 </div>
20291 </div></li>
20292 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20293 <div class="thumb" style="height: 150px;">Image2.gif</div>
20294 <div class="gallerytext">
20295 </div>
20296 </div></li>
20297 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20298 <div class="thumb" style="height: 150px;">Image3</div>
20299 <div class="gallerytext">
20300 </div>
20301 </div></li>
20302 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20303 <div class="thumb" style="height: 150px;">Image4</div>
20304 <div class="gallerytext">
20305 <pre>centre
20306 </pre>
20307 </div>
20308 </div></li>
20309 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20310 <div class="thumb" style="height: 150px;">Image5.svg</div>
20311 <div class="gallerytext">
20312 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
20313 </p>
20314 </div>
20315 </div></li>
20316 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20317 <div class="thumb" style="height: 150px;">* image6</div>
20318 <div class="gallerytext">
20319 </div>
20320 </div></li>
20321 </ul>
20322
20323 !! html/parsoid
20324 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt3" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20325 <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>
20326 <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>
20327 <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>
20328 <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>
20329 <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>
20330 <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>
20331 </ul>
20332 !! end
20333
20334 !! test
20335 Gallery (with options, html)
20336 !! options
20337 parsoid={
20338 "modes": ["wt2html", "html2html"],
20339 "nativeGallery": true
20340 }
20341 !! wikitext
20342 <gallery widths="70px" heights="40px" perrow="2" caption="Foo [[Main Page]]">
20343 File:Nonexistent.jpg|caption
20344 File:Nonexistent.jpg
20345 image:foobar.jpg|some '''caption''' [[Main Page]]
20346 image:foobar.jpg
20347 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
20348 </gallery>
20349 !! html/php
20350 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
20351 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
20352 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20353 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
20354 <div class="gallerytext">
20355 <p>caption
20356 </p>
20357 </div>
20358 </div></li>
20359 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20360 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
20361 <div class="gallerytext">
20362 </div>
20363 </div></li>
20364 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20365 <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>
20366 <div class="gallerytext">
20367 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
20368 </p>
20369 </div>
20370 </div></li>
20371 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20372 <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>
20373 <div class="gallerytext">
20374 </div>
20375 </div></li>
20376 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20377 <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>
20378 <div class="gallerytext">
20379 <p>blabla.
20380 </p>
20381 </div>
20382 </div></li>
20383 </ul>
20384
20385 !! html/parsoid
20386 <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":{}}'>
20387 <li class="gallerycaption">Foo <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a></li>
20388 <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>
20389 <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>
20390 <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>
20391 <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>
20392 <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>
20393 </ul>
20394 !! end
20395
20396 !! test
20397 Gallery (with options, extsrc)
20398 !! options
20399 parsoid={
20400 "nativeGallery": false
20401 }
20402 !! wikitext
20403 <gallery widths="70px" heights="40px" perrow="2" caption="Foo [[Main Page]]">
20404 File:Nonexistent.jpg|caption
20405 File:Nonexistent.jpg
20406 image:foobar.jpg|some '''caption''' [[Main Page]]
20407 image:foobar.jpg
20408 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
20409 </gallery>
20410 !! html/php
20411 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
20412 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
20413 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20414 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
20415 <div class="gallerytext">
20416 <p>caption
20417 </p>
20418 </div>
20419 </div></li>
20420 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20421 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
20422 <div class="gallerytext">
20423 </div>
20424 </div></li>
20425 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20426 <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>
20427 <div class="gallerytext">
20428 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
20429 </p>
20430 </div>
20431 </div></li>
20432 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20433 <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>
20434 <div class="gallerytext">
20435 </div>
20436 </div></li>
20437 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20438 <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>
20439 <div class="gallerytext">
20440 <p>blabla.
20441 </p>
20442 </div>
20443 </div></li>
20444 </ul>
20445
20446 !! html/parsoid
20447 <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"}}'>
20448 <li class="gallerycaption">Foo <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a></li>
20449 <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>
20450 <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>
20451 <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>
20452 <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>
20453 <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>
20454 </ul>
20455 !! end
20456
20457 !! test
20458 Gallery with link that has fragment
20459 !! options
20460 parsoid={
20461 "modes": ["wt2html", "html2html"],
20462 "nativeGallery": true
20463 }
20464 !! wikitext
20465 <gallery>
20466 image:foobar.jpg|link=Main_Page
20467 image:foobar.jpg|link=Main_Page#section
20468 image:foobar.jpg|link=Main Page#section|caption
20469 </gallery>
20470 !! html/php
20471 <ul class="gallery mw-gallery-traditional">
20472 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20473 <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>
20474 <div class="gallerytext">
20475 </div>
20476 </div></li>
20477 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20478 <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>
20479 <div class="gallerytext">
20480 </div>
20481 </div></li>
20482 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20483 <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>
20484 <div class="gallerytext">
20485 <p>caption
20486 </p>
20487 </div>
20488 </div></li>
20489 </ul>
20490
20491 !! html/parsoid
20492 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20493 <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>
20494 <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>
20495 <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>
20496 </ul>
20497 !! end
20498
20499 ## Whoops, Parsoid shouldn't be parsing templates in the attribute caption!
20500 !! test
20501 Gallery with template inside caption
20502 !! options
20503 parsoid={
20504 "nativeGallery": true
20505 }
20506 !! wikitext
20507 <gallery caption="{{echo|hi}}">
20508 File:Foobar.jpg|{{echo|ho}}
20509 </gallery>
20510 !! html/php
20511 <ul class="gallery mw-gallery-traditional">
20512 <li class='gallerycaption'>{{echo|hi}}</li>
20513 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20514 <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>
20515 <div class="gallerytext">
20516 <p>ho
20517 </p>
20518 </div>
20519 </div></li>
20520 </ul>
20521
20522 !! html/parsoid
20523 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt6" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20524 <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>
20525 <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>
20526 </ul>
20527 !! end
20528
20529 !! test
20530 Gallery with wikitext inside caption
20531 !! options
20532 parsoid={
20533 "nativeGallery": true
20534 }
20535 !! wikitext
20536 <gallery>
20537 File:Foobar.jpg|alt=galleryalt|[[File:Foobar.jpg|alt=inneralt|20x20px|desc]]
20538 File:Foobar.jpg|alt=galleryalt|{{Test|unamedParam|alt=param}}
20539 </gallery>
20540 !! html/php
20541 <ul class="gallery mw-gallery-traditional">
20542 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20543 <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>
20544 <div class="gallerytext">
20545 <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>
20546 </p>
20547 </div>
20548 </div></li>
20549 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20550 <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>
20551 <div class="gallerytext">
20552 <p>This is a test template
20553 </p>
20554 </div>
20555 </div></li>
20556 </ul>
20557
20558 !! html/parsoid
20559 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt6" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20560 <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>
20561 <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>
20562 </ul>
20563 !! end
20564
20565 !! test
20566 Gallery (with showfilename option)
20567 !! options
20568 parsoid={
20569 "nativeGallery": true
20570 }
20571 !! wikitext
20572 <gallery showfilename="">
20573 File:Nonexistent.jpg|caption
20574 File:Nonexistent.jpg
20575 File:Foobar.jpg|some '''caption''' [[Main Page]]
20576 File:Foobar.jpg
20577 </gallery>
20578 !! html/php
20579 <ul class="gallery mw-gallery-traditional">
20580 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20581 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
20582 <div class="gallerytext">
20583 <p><a href="/wiki/File:Nonexistent.jpg" class="galleryfilename galleryfilename-truncate" title="File:Nonexistent.jpg">Nonexistent.jpg</a>
20584 caption
20585 </p>
20586 </div>
20587 </div></li>
20588 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20589 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
20590 <div class="gallerytext">
20591 <p><a href="/wiki/File:Nonexistent.jpg" class="galleryfilename galleryfilename-truncate" title="File:Nonexistent.jpg">Nonexistent.jpg</a>
20592 </p>
20593 </div>
20594 </div></li>
20595 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20596 <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>
20597 <div class="gallerytext">
20598 <p><a href="/wiki/File:Foobar.jpg" class="galleryfilename galleryfilename-truncate" title="File:Foobar.jpg">Foobar.jpg</a>
20599 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
20600 </p>
20601 </div>
20602 </div></li>
20603 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20604 <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>
20605 <div class="gallerytext">
20606 <p><a href="/wiki/File:Foobar.jpg" class="galleryfilename galleryfilename-truncate" title="File:Foobar.jpg">Foobar.jpg</a>
20607 </p>
20608 </div>
20609 </div></li>
20610 </ul>
20611
20612 !! html/parsoid
20613 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt3" data-mw='{"name":"gallery","attrs":{"showfilename":""},"body":{}}'>
20614 <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>
20615 <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>
20616 <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>
20617 <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>
20618 </ul>
20619 !! end
20620
20621 ## Should Parsoid be preserving these variations? See T151367
20622 !! test
20623 Gallery (with namespace-less filenames)
20624 !! options
20625 parsoid={
20626 "modes": ["wt2html", "html2html"],
20627 "nativeGallery": true
20628 }
20629 !! wikitext
20630 <gallery>
20631 File:Nonexistent.jpg
20632 Nonexistent.jpg
20633 image:foobar.jpg
20634 foobar.jpg
20635 </gallery>
20636 !! html/php
20637 <ul class="gallery mw-gallery-traditional">
20638 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20639 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
20640 <div class="gallerytext">
20641 </div>
20642 </div></li>
20643 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20644 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
20645 <div class="gallerytext">
20646 </div>
20647 </div></li>
20648 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20649 <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>
20650 <div class="gallerytext">
20651 </div>
20652 </div></li>
20653 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20654 <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>
20655 <div class="gallerytext">
20656 </div>
20657 </div></li>
20658 </ul>
20659
20660 !! html/parsoid
20661 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20662 <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>
20663 <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>
20664 <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>
20665 <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>
20666 </ul>
20667 !! end
20668
20669 !! test
20670 Gallery override link with WikiLink (T36852)
20671 !! options
20672 parsoid={
20673 "nativeGallery": true
20674 }
20675 !! wikitext
20676 <gallery>
20677 File:Foobar.jpg|alt=galleryalt|link=InterWikiLink
20678 </gallery>
20679 !! html/php
20680 <ul class="gallery mw-gallery-traditional">
20681 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20682 <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>
20683 <div class="gallerytext">
20684 </div>
20685 </div></li>
20686 </ul>
20687
20688 !! html/parsoid
20689 <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":{}}'>
20690 <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>
20691 </ul>
20692 !! end
20693
20694 !! test
20695 Gallery override link with absolute external link (T36852)
20696 !! options
20697 parsoid={
20698 "nativeGallery": true
20699 }
20700 !! wikitext
20701 <gallery>
20702 File:Foobar.jpg|alt=galleryalt|link=http://www.example.org
20703 </gallery>
20704 !! html/php
20705 <ul class="gallery mw-gallery-traditional">
20706 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20707 <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>
20708 <div class="gallerytext">
20709 </div>
20710 </div></li>
20711 </ul>
20712
20713 !! html/parsoid
20714 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20715 <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>
20716 </ul>
20717 !! end
20718
20719 !! test
20720 Gallery override link with absolute external link with LanguageConverter
20721 !! options
20722 language=zh
20723 !! input
20724 <gallery>
20725 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
20726 </gallery>
20727 !! result
20728 <ul class="gallery mw-gallery-traditional">
20729 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20730 <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>
20731 <div class="gallerytext">
20732 <p>caption
20733 </p>
20734 </div>
20735 </div></li>
20736 </ul>
20737
20738 !! end
20739
20740 !! test
20741 Gallery override link with malicious javascript (T36852)
20742 !! options
20743 parsoid={
20744 "modes": ["wt2html", "html2html"],
20745 "nativeGallery": true
20746 }
20747 !! wikitext
20748 <gallery>
20749 File:Foobar.jpg|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
20750 </gallery>
20751 !! html/php
20752 <ul class="gallery mw-gallery-traditional">
20753 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20754 <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>
20755 <div class="gallerytext">
20756 </div>
20757 </div></li>
20758 </ul>
20759
20760 !! html/parsoid
20761 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20762 <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>
20763 </ul>
20764 !! end
20765
20766 # Note that parsoid uses the invalid link as a caption, PHP does not.
20767 !! test
20768 Gallery with invalid title as link (T45964)
20769 !! options
20770 parsoid={
20771 "modes": ["wt2html", "html2html"],
20772 "nativeGallery": true
20773 }
20774 !! wikitext
20775 <gallery>
20776 File:Foobar.jpg|link=<
20777 </gallery>
20778 !! html/php
20779 <ul class="gallery mw-gallery-traditional">
20780 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20781 <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>
20782 <div class="gallerytext">
20783 </div>
20784 </div></li>
20785 </ul>
20786
20787 !! html/parsoid
20788 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20789 <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>
20790 </ul>
20791 !! end
20792
20793 !! test
20794 Serialize gallery without attrs in data-mw
20795 !! options
20796 parsoid={
20797 "modes": ["html2wt"],
20798 "nativeGallery": true
20799 }
20800 !! html/parsoid
20801 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","body":{}}'>
20802 <li class="gallerycaption">123</li>
20803 <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>
20804 </ul>
20805 !! wikitext
20806 <gallery caption="123">
20807 File:Test.png
20808 </gallery>
20809 !! end
20810
20811 !! test
20812 Gallery with class and style attributes
20813 !! options
20814 parsoid={
20815 "nativeGallery": true
20816 }
20817 !! wikitext
20818 <gallery class="center" style="text-align: center;">
20819 File:Foobar.jpg
20820 </gallery>
20821 !! html/php
20822 <ul class="gallery mw-gallery-traditional center" style="text-align: center;">
20823 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20824 <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>
20825 <div class="gallerytext">
20826 </div>
20827 </div></li>
20828 </ul>
20829
20830 !! html/parsoid
20831 <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":{}}'>
20832 <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>
20833 </ul>
20834 !! end
20835
20836 !! test
20837 Gallery in slideshow mode
20838 !! options
20839 parsoid={
20840 "nativeGallery": true
20841 }
20842 !! wikitext
20843 <gallery mode="slideshow" showthumbnails="">
20844 File:Foobar.jpg
20845 </gallery>
20846 !! html/php
20847 <ul class="gallery mw-gallery-slideshow" data-showthumbnails="1">
20848 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20849 <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>
20850 <div class="gallerytext">
20851 </div>
20852 </div></li>
20853 </ul>
20854
20855 !! html/parsoid
20856 <ul class="gallery mw-gallery-slideshow" data-showthumbnails="1" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{"mode":"slideshow","showthumbnails":""},"body":{}}'>
20857 <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>
20858 </ul>
20859 !! end
20860
20861 !! test
20862 HTML Hex character encoding (spells the word "JavaScript")
20863 !! options
20864 parsoid=wt2html,wt2wt,html2html
20865 !! wikitext
20866 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
20867 !! html/php
20868 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
20869 </p>
20870 !! html/php+tidy
20871 <p>JavaScript</p>
20872 !! html/parsoid
20873 <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>
20874 !! end
20875
20876 !! test
20877 HTML Hex character encoding bogus encoding (T28437 regression check)
20878 !! wikitext
20879 &#xsee;&#XSEE;
20880 !! html/php
20881 <p>&amp;#xsee;&amp;#XSEE;
20882 </p>
20883 !! html/parsoid
20884 <p>&amp;#xsee;&amp;#XSEE;</p>
20885 !! end
20886
20887 !! test
20888 HTML Hex character encoding mixed case
20889 !! options
20890 parsoid=wt2html,wt2wt,html2html
20891 !! wikitext
20892 &#xEE;&#Xee;
20893 !! html/php
20894 <p>&#xee;&#xee;
20895 </p>
20896 !! html/php+tidy
20897 <p>îî</p>
20898 !! html/parsoid
20899 <p><span typeof="mw:Entity">î</span><span typeof="mw:Entity">î</span></p>
20900 !! end
20901
20902 # See: https://www.w3.org/TR/html5/syntax.html#character-references
20903 # Note that U+000C (form feed) is not a valid XML character, so
20904 # it is banned even though allowed in HTML5.
20905 !! test
20906 Illegal character references (T106578)
20907 !! wikitext
20908 ; Null: &#00;
20909 ; FF: &#xC;
20910 ; CR: &#xD;
20911 ; Control (low): &#8;
20912 ; Control (high): &#x7F; &#x9F;
20913 ; Surrogate: &#xD83D;&#xDCA9;
20914 ; This is an okay astral character: &#x1F4A9;
20915 !! html+tidy
20916 <dl>
20917 <dt>Null</dt>
20918 <dd>&amp;#00;</dd>
20919 <dt>FF</dt>
20920 <dd>&amp;#xC;</dd>
20921 <dt>CR</dt>
20922 <dd>&amp;#xD;</dd>
20923 <dt>Control (low)</dt>
20924 <dd>&amp;#8;</dd>
20925 <dt>Control (high)</dt>
20926 <dd>&amp;#x7F; &amp;#x9F;</dd>
20927 <dt>Surrogate</dt>
20928 <dd>&amp;#xD83D;&amp;#xDCA9;</dd>
20929 <dt>This is an okay astral character</dt>
20930 <dd>💩</dd>
20931 </dl>
20932 !! end
20933
20934 !! test
20935 __FORCETOC__ override
20936 !! wikitext
20937 __NEWSECTIONLINK__
20938 __FORCETOC__
20939 !! html/php
20940 <p><br />
20941 </p>
20942 !! end
20943
20944 !! test
20945 ISBN code coverage
20946 !! wikitext
20947 ISBN 978-0-1234-56&#x20;789
20948 !! html
20949 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
20950 </p>
20951 !! html+tidy
20952 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a> 789</p>
20953 !! html/parsoid
20954 <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>
20955 !! end
20956
20957 !! test
20958 ISBN followed by 5 spaces
20959 !! wikitext
20960 ISBN
20961 !! html
20962 <p>ISBN
20963 </p>
20964 !! end
20965
20966 !! test
20967 Double ISBN
20968 !! wikitext
20969 ISBN ISBN 1234567890
20970 !! html/php
20971 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
20972 </p>
20973 !! html/parsoid
20974 <p>ISBN <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a></p>
20975 !! end
20976
20977 # Uppercase X and lowercase x as well
20978 !! test
20979 ISBN with an X
20980 !! wikitext
20981 ISBN 3-462-04561-X
20982 ISBN 3-462-04561-x
20983 ISBN 080442957X
20984 ISBN 080442957x
20985 ISBN 978080442957X
20986 ISBN 978080442957x
20987 !! html/php
20988 <p><a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-X</a>
20989 <a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-x</a>
20990 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957X</a>
20991 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957x</a>
20992 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957X</a>
20993 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957x</a>
20994 </p>
20995 !! html/parsoid
20996 <p><a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-X</a>
20997 <a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-x</a>
20998 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957X</a>
20999 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957x</a>
21000 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957X</a>
21001 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957x</a></p>
21002 !! end
21003
21004 !! test
21005 ISBN with empty prefix (parsoid test)
21006 !! wikitext
21007 ISBN 1234567890
21008 !! html/php
21009 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
21010 </p>
21011 !! html/parsoid
21012 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink">ISBN 1234567890</a></p>
21013 !! end
21014
21015 !! test
21016 T24905: <abbr> followed by ISBN followed by </a>
21017 !! wikitext
21018 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
21019 !! html/php
21020 <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>
21021 </p>
21022 !! html/parsoid
21023 <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>
21024 !! end
21025
21026 !! test
21027 Double RFC
21028 !! wikitext
21029 RFC RFC 1234
21030 !! html
21031 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc1234">RFC 1234</a>
21032 </p>
21033 !! end
21034
21035 !! test
21036 Double RFC with a wiki link
21037 !! wikitext
21038 RFC [[RFC 1234]]
21039 !! html
21040 <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>
21041 </p>
21042 !! end
21043
21044 !! test
21045 RFC code coverage
21046 !! wikitext
21047 RFC 983&#x20;987
21048 !! html
21049 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
21050 </p>
21051 !! html+tidy
21052 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc983">RFC 983</a> 987</p>
21053 !! end
21054
21055 !! test
21056 Centre-aligned image
21057 !! wikitext
21058 [[Image:foobar.jpg|centre]]
21059 !! html
21060 <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>
21061
21062 !!end
21063
21064 !! test
21065 None-aligned image
21066 !! wikitext
21067 [[Image:foobar.jpg|none]]
21068 !! html
21069 <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>
21070
21071 !!end
21072
21073 !! test
21074 Width + Height sized image (using px) (height is ignored)
21075 !! wikitext
21076 [[Image:foobar.jpg|640x480px]]
21077 !! html
21078 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/640px-Foobar.jpg" width="640" height="73" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/960px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/1280px-Foobar.jpg 2x" /></a>
21079 </p>
21080 !!end
21081
21082 !! test
21083 Width-sized image (using px, no following whitespace)
21084 !! wikitext
21085 [[Image:foobar.jpg|640px]]
21086 !! html
21087 <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>
21088 </p>
21089 !!end
21090
21091 !! test
21092 Width-sized image (using px, with following whitespace - test regression from r39467)
21093 !! wikitext
21094 [[Image:foobar.jpg|640px ]]
21095 !! html
21096 <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>
21097 </p>
21098 !!end
21099
21100 !! test
21101 Width-sized image (using px, with preceding whitespace - test regression from r39467)
21102 !! wikitext
21103 [[Image:foobar.jpg| 640px]]
21104 !! html
21105 <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>
21106 </p>
21107 !!end
21108
21109 !! test
21110 Image with page parameter
21111 !! options
21112 djvu
21113 !! wikitext
21114 [[File:LoremIpsum.djvu|page=2]]
21115 !! html/php
21116 <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>
21117 </p>
21118 !! html/parsoid
21119 <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>
21120 !! end
21121
21122 !! test
21123 Another italics / bold test
21124 !! wikitext
21125 ''' ''x'
21126 !! html
21127 <pre>'<i> </i>x'
21128 </pre>
21129 !!end
21130
21131 # FIXME: The php output seems broken. It's interleaving some open/close tags.
21132 !! test
21133 dt/dd/dl test
21134 !! wikitext
21135 :;;;::
21136 !! html/php
21137 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dt></dl></dd></dl></dd></dl></dd></dl></dd></dl></dd></dl>
21138
21139 !! html/parsoid
21140 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dd></dl></dd></dl></dt></dl></dt></dl></dt></dl></dd></dl>
21141
21142 !!end
21143
21144 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
21145 !! test
21146 Images with the "|" character in the comment
21147 !! wikitext
21148 [[File:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
21149 !! html/php
21150 <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>
21151
21152 !! html/parsoid
21153 <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>
21154 !! end
21155
21156 !! test
21157 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
21158 !! wikitext
21159 <html><script>alert(1);</script></html>
21160 !! html
21161 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
21162 </p>
21163 !! end
21164
21165 !! test
21166 HTML with raw HTML ($wgRawHtml==true)
21167 !! options
21168 wgRawHtml=1
21169 !! wikitext
21170 <html><script>alert(1);</script></html>
21171 !! html/php
21172 <p><script>alert(1);</script>
21173 </p>
21174 !! end
21175
21176 !! test
21177 Parents of subpages, one level up
21178 !! options
21179 subpage title=[[Subpage test/L1/L2/L3]]
21180 !! wikitext
21181 [[../|L2]]
21182 !! html
21183 <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>
21184 </p>
21185 !! end
21186
21187
21188 !! test
21189 Parents of subpages, one level up, not named
21190 !! options
21191 subpage title=[[Subpage test/L1/L2/L3]]
21192 !! wikitext
21193 [[../]]
21194 !! html
21195 <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>
21196 </p>
21197 !! end
21198
21199
21200
21201 !! test
21202 Parents of subpages, two levels up
21203 !! options
21204 subpage title=[[Subpage test/L1/L2/L3]]
21205 !! wikitext
21206 [[../../|L1]]2
21207
21208 [[../../|L1]]l
21209 !! html
21210 <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
21211 </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>
21212 </p>
21213 !! end
21214
21215 !! test
21216 Parents of subpages, two levels up, without trailing slash or name.
21217 !! options
21218 subpage title=[[Subpage test/L1/L2/L3]]
21219 !! wikitext
21220 [[../..]]
21221 !! html
21222 <p>[[../..]]
21223 </p>
21224 !! end
21225
21226 !! test
21227 Parents of subpages, two levels up, with lots of extra trailing slashes.
21228 !! options
21229 subpage title=[[Subpage test/L1/L2/L3]]
21230 !! wikitext
21231 [[../../////]]
21232 !! html
21233 <p><a href="/index.php?title=Subpage_test/L1&amp;action=edit&amp;redlink=1" class="new" title="Subpage test/L1 (page does not exist)">Subpage test/L1</a>
21234 </p>
21235 !! end
21236
21237 !! article
21238 Subpage test/L1/L2/L3Sibling
21239 !! text
21240 Sibling article
21241 !! endarticle
21242
21243 !! test
21244 Transclusion of a sibling page (one level up)
21245 !! options
21246 subpage title=[[Subpage test/L1/L2/L3]]
21247 !! wikitext
21248 {{../L3Sibling}}
21249 !! html
21250 <p>Sibling article
21251 </p>
21252 !! end
21253
21254 !! test
21255 Transclusion of a child page
21256 !! options
21257 subpage title=[[Subpage test/L1/L2]]
21258 !! wikitext
21259 {{/L3Sibling}}
21260 !! html
21261 <p>Sibling article
21262 </p>
21263 !! end
21264
21265 # This is wt2html only in Parsoid because we add <nowiki>
21266 # because of {{..}} and we don't expect to fix that to
21267 # eliminate the nowikis selective for {{..}} markup.
21268 !! test
21269 Non-transclusion because of too many up levels
21270 !! options
21271 subpage title=[[Subpage test/L1/L2/L3]]
21272 parsoid=wt2html
21273 !! wikitext
21274 {{../../../../More than parent}}
21275 !! html/php
21276 <p>{{../../../../More than parent}}
21277 </p>
21278 !! html/parsoid
21279 <p>{{../../../../More than parent}}</p>
21280 !! end
21281
21282 !! test
21283 Definition list code coverage
21284 !! wikitext
21285 ; title : def
21286 ; title : def
21287 ;title: def
21288 !! html/php
21289 <dl><dt> title &#160;</dt>
21290 <dd> def</dd>
21291 <dt> title&#160;</dt>
21292 <dd> def</dd>
21293 <dt>title</dt>
21294 <dd> def</dd></dl>
21295
21296 !! html/parsoid
21297 <dl><dt> title <span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
21298 <dt> title<span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
21299 <dt>title</dt><dd> def</dd></dl>
21300 !! end
21301
21302 !! test
21303 Don't fall for the self-closing div
21304 !! wikitext
21305 <div>hello world</div/>
21306 !! html
21307 <div>hello world</div>
21308
21309 !! end
21310
21311 !! test
21312 MSGNW magic word
21313 !! wikitext
21314 {{MSGNW:msg}}
21315 !! html/php
21316 <p>&#91;&#91;:Template:Msg&#93;&#93;
21317 </p>
21318 !! end
21319
21320 !! test
21321 RAW magic word
21322 !! wikitext
21323 {{RAW:QUERTY}}
21324 !! html
21325 <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>
21326 </p>
21327 !! end
21328
21329 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
21330 !! test
21331 Always escape literal '>' in output, not just after '<'
21332 !! wikitext
21333 ><>
21334 !! html
21335 <p>&gt;&lt;&gt;
21336 </p>
21337 !! end
21338
21339 !! test
21340 Template caching
21341 !! wikitext
21342 {{Test}}
21343 {{Test}}
21344 !! html
21345 <p>This is a test template
21346 This is a test template
21347 </p>
21348 !! end
21349
21350
21351 !! article
21352 MediaWiki:Fake
21353 !! text
21354 ==header==
21355 !! endarticle
21356
21357 !! test
21358 Inclusion of !userCanEdit() content
21359 !! wikitext
21360 {{MediaWiki:Fake}}
21361 !! html
21362 <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>
21363
21364 !! end
21365
21366
21367 !! test
21368 Out-of-order TOC heading levels
21369 !! wikitext
21370 ==2==
21371 ======6======
21372 ===3===
21373 =1=
21374 =====5=====
21375 ==2==
21376 !! html
21377 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
21378 <ul>
21379 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
21380 <ul>
21381 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
21382 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
21383 </ul>
21384 </li>
21385 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
21386 <ul>
21387 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
21388 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
21389 </ul>
21390 </li>
21391 </ul>
21392 </div>
21393
21394 <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>
21395 <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>
21396 <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>
21397 <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>
21398 <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>
21399 <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>
21400
21401 !! end
21402
21403
21404 !! test
21405 ISBN with a dummy number
21406 !! wikitext
21407 ISBN ---
21408 !! html
21409 <p>ISBN ---
21410 </p>
21411 !! end
21412
21413
21414 !! test
21415 ISBN with space-delimited number
21416 !! wikitext
21417 ISBN 92 9017 032 8
21418 !! html/php
21419 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
21420 </p>
21421 !! html/parsoid
21422 <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>
21423 !! end
21424
21425
21426 !! test
21427 ISBN with multiple spaces, no number
21428 !! wikitext
21429 ISBN foo
21430 !! html
21431 <p>ISBN foo
21432 </p>
21433 !! end
21434
21435
21436 !! test
21437 ISBN length
21438 !! wikitext
21439 ISBN 123456789
21440
21441 ISBN 1234567890
21442
21443 ISBN 12345678901
21444 !! html/php
21445 <p>ISBN 123456789
21446 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
21447 </p><p>ISBN 12345678901
21448 </p>
21449 !! html/parsoid
21450 <p>ISBN 123456789</p>
21451
21452 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a></p>
21453
21454 <p>ISBN 12345678901</p>
21455 !! end
21456
21457
21458 !! test
21459 ISBN with trailing year (T9110)
21460 !! wikitext
21461 ISBN 1-234-56789-0 - 2006
21462
21463 ISBN 1 234 56789 0 - 2006
21464 !! html/php
21465 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
21466 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
21467 </p>
21468 !! html/parsoid
21469 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1-234-56789-0</a> - 2006</p>
21470
21471 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1 234 56789 0</a> - 2006</p>
21472 !! end
21473
21474
21475 !! test
21476 anchorencode
21477 !! wikitext
21478 {{anchorencode:foo bar©#%n}}
21479 !! html
21480 <p>foo_bar.C2.A9.23.25n
21481 </p>
21482 !! end
21483
21484 !! test
21485 anchorencode trims spaces
21486 !! wikitext
21487 {{anchorencode: __pretty__please__}}
21488 !! html
21489 <p>pretty_please
21490 </p>
21491 !! end
21492
21493 !! test
21494 anchorencode deals with links
21495 !! wikitext
21496 {{anchorencode: [[hello|world]] [[hi]]}}
21497 !! html
21498 <p>world_hi
21499 </p>
21500 !! end
21501
21502 !! test
21503 anchorencode deals with templates
21504 !! wikitext
21505 {{anchorencode: {{Foo}} }}
21506 !! html
21507 <p>FOO
21508 </p>
21509 !! end
21510
21511 !! test
21512 anchorencode encodes like the TOC generator: (T20431)
21513 !! wikitext
21514 === _ +:.3A%3A&&amp;]] ===
21515 {{anchorencode: _ +:.3A%3A&&amp;]] }}
21516 __NOEDITSECTION__
21517 !! html
21518 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
21519 <p>.2B:.3A.253A.26.26.5D.5D
21520 </p>
21521 !! end
21522
21523 !! test
21524 T8200: blockquotes and paragraph formatting
21525 !! wikitext
21526 <blockquote>
21527 foo
21528 </blockquote>
21529
21530 bar
21531
21532 baz
21533 !! html
21534 <blockquote>
21535 <p>foo
21536 </p>
21537 </blockquote>
21538 <p>bar
21539 </p>
21540 <pre>baz
21541 </pre>
21542 !! end
21543
21544 !! test
21545 T10293: Use of center tag ruins paragraph formatting
21546 !! wikitext
21547 <center>
21548 foo
21549 </center>
21550
21551 bar
21552
21553 baz
21554 !! html
21555 <center>
21556 <p>foo
21557 </p>
21558 </center>
21559 <p>bar
21560 </p>
21561 <pre>baz
21562 </pre>
21563 !! end
21564
21565 !!test
21566 Parsing of overlapping (improperly nested) inline html tags
21567 !! wikitext
21568 <span><s>x</span></s>
21569 !! html/php
21570 <p><span><s>x&lt;/span&gt;</s></span>
21571 </p>
21572 !! html/parsoid
21573 <p><span><s>x</s></span>
21574 </p>
21575 !!end
21576
21577 ###
21578 ### Language variants related tests
21579 ###
21580
21581 # Parsoid does not mark self-links.
21582 # Parsoid does not convert links; PHP will do any necessary redirects.
21583
21584 !! test
21585 Self-link in language variants
21586 !! options
21587 title=[[Dunav]] language=sr
21588 !! wikitext
21589 Both [[Dunav]] and [[Дунав]] are names for this river.
21590 !! html/php
21591 <p>Both <a class="mw-selflink selflink">Dunav</a> and <a class="mw-selflink selflink">Дунав</a> are names for this river.
21592 </p>
21593 !! html/parsoid
21594 <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>
21595 !! end
21596
21597 !! article
21598 Дуна
21599 !! text
21600 content
21601 !! endarticle
21602
21603 !! test
21604 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
21605 !! options
21606 title=[[Duna]] language=sr
21607 !! wikitext
21608 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
21609 !! html/php
21610 <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.
21611 </p>
21612 !! html/parsoid
21613 <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>
21614 !! end
21615
21616 !! test
21617 Link to a section of a variant of this title shouldn't be parsed as self-link
21618 !! options
21619 title=[[Duna]] language=sr
21620 !! wikitext
21621 [[Dуна]] is a self-link while [[Dunа#Foo]] and [[Dуна#Foo]] are not self-links.
21622 !! html/php
21623 <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.
21624 </p>
21625 !! html/parsoid
21626 <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>
21627 !! end
21628
21629 !! test
21630 Link to pages in language variants
21631 !! options
21632 language=sr
21633 !! wikitext
21634 Main Page can be written as [[Маин Паге]]
21635 !! html/php
21636 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
21637 </p>
21638 !! html/parsoid
21639 <p>Main Page can be written as <a rel="mw:WikiLink" href="./Маин_Паге" title="Маин Паге">Маин Паге</a></p>
21640 !! end
21641
21642
21643 !! test
21644 Multiple links to pages in language variants
21645 !! options
21646 language=sr
21647 !! wikitext
21648 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
21649 !! html/php
21650 <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>.
21651 </p>
21652 !! html/parsoid
21653 <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>
21654 !! end
21655
21656
21657 !! test
21658 Simple template in language variants
21659 !! options
21660 language=sr
21661 !! wikitext
21662 {{тест}}
21663 !! html/php
21664 <p>This is a test template
21665 </p>
21666 !! end
21667
21668
21669 !! test
21670 Template with explicit namespace in language variants
21671 !! options
21672 language=sr
21673 !! wikitext
21674 {{Template:тест}}
21675 !! html/php
21676 <p>This is a test template
21677 </p>
21678 !! end
21679
21680
21681 !! test
21682 Basic test for template parameter in language variants
21683 !! options
21684 language=sr
21685 !! wikitext
21686 {{парамтест|param=foo}}
21687 !! html/php
21688 <p>This is a test template with parameter foo
21689 </p>
21690 !! end
21691
21692 !! test
21693 Simple category in language variants
21694 !! options
21695 language=sr cat
21696 !! wikitext
21697 [[Category:МедиаWики Усер'с Гуиде]]
21698 !! html/php
21699 cat=МедиаWики_Усер'с_Гуиде sort=
21700 !! html/parsoid
21701 <link rel="mw:PageProp/Category" href="./Категорија:МедиаWики_Усер'с_Гуиде" data-parsoid='{"stx":"simple","a":{"href":"./Категорија:МедиаWики_Усер&#39;с_Гуиде"},"sa":{"href":"Category:МедиаWики Усер&#39;с Гуиде"}}'/>
21702 !! end
21703
21704 !! article
21705 Category:分类
21706 !! text
21707 blah
21708 !! endarticle
21709
21710 !! article
21711 Category:分類
21712 !! text
21713 blah
21714 !! endarticle
21715
21716 ## We used to, but no longer wt2wt this test since the default serializer
21717 ## will normalize all categories to serialize on their own line.
21718 ## This wikitext usage is going to be fairly uncommon in production and
21719 ## selser will take care of preserving formatting in those scenarios.
21720 !! test
21721 Don't convert blue categorylinks to another variant (T35210)
21722 !! options
21723 cat
21724 language=zh
21725 parsoid=wt2html
21726 !! wikitext
21727 [[A]][[Category:分类]]
21728 !! html/php
21729 cat=分类 sort=
21730 !! html/parsoid
21731 <p><a rel="mw:WikiLink" href="./A" title="A">A</a></p>
21732 <link rel="mw:PageProp/Category" href="./Category:分类"/>
21733 !! end
21734
21735 !! test
21736 Stripping -{}- tags (language variants)
21737 !! options
21738 language=sr
21739 !! wikitext
21740 Latin proverb: -{Ne nuntium necare}-
21741 !! html/php
21742 <p>Latin proverb: Ne nuntium necare
21743 </p>
21744 !! html/parsoid
21745 <p>Latin proverb: <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Ne nuntium necare"}}'></span></p>
21746 !! end
21747
21748
21749 !! test
21750 Prevent conversion with -{}- tags (language variants)
21751 !! options
21752 language=sr variant=sr-ec
21753 !! wikitext
21754 Latinski: -{Ne nuntium necare}-
21755 !! html/php
21756 <p>Латински: Ne nuntium necare
21757 </p>
21758 !! html/parsoid
21759 <p>Latinski: <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Ne nuntium necare"}}'></span></p>
21760 !! end
21761
21762
21763 !! test
21764 Prevent conversion of text with -{}- tags (language variants)
21765 !! options
21766 language=sr variant=sr-ec
21767 !! wikitext
21768 Latinski: -{Ne nuntium necare}-
21769 !! html/php
21770 <p>Латински: Ne nuntium necare
21771 </p>
21772 !! html/parsoid
21773 <p>Latinski: <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Ne nuntium necare"}}'></span></p>
21774 !! end
21775
21776
21777 !! test
21778 Prevent conversion of links with -{}- tags (language variants)
21779 !! options
21780 language=sr variant=sr-ec
21781 !! wikitext
21782 -{[[Main Page]]}-
21783 !! html/php
21784 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
21785 </p>
21786 !! html/parsoid
21787 <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>
21788 !! end
21789
21790
21791 !! test
21792 -{}- tags within headlines (within html for parserConvert())
21793 !! options
21794 language=sr variant=sr-ec
21795 !! wikitext
21796 == -{Naslov}- ==
21797
21798 Note that even an unprotected headline ID is not affected by language
21799 conversion:
21800
21801 == Latinski ==
21802 !! html/php
21803 <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>
21804 <p>Ноте тхат евен ан унпротецтед хеадлине ИД ис нот аффецтед бy лангуаге
21805 цонверсион:
21806 </p>
21807 <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>
21808
21809 !! html/parsoid
21810 <h2 id="-.7BNaslov.7D-"><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Naslov"}}'></span></h2>
21811
21812 <p>Note that even an unprotected headline ID is not affected by language
21813 conversion:</p>
21814
21815 <h2 id="Latinski">Latinski</h2>
21816 !! end
21817
21818 !! test
21819 Explicit definition of language variant alternatives
21820 !! options
21821 language=zh variant=zh-tw
21822 !! wikitext
21823 -{zh:China;zh-tw:Taiwan}-, not China
21824 !! html/php
21825 <p>Taiwan, not China
21826 </p>
21827 !! html/parsoid
21828 <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>
21829 !! end
21830
21831 !! test
21832 Filter syntax for language variants
21833 !! options
21834 language=zh variant=zh-tw
21835 !! wikitext
21836 foo-{zh;zh-hans;zh-hant|blog, WEBJOURNAL, WEBLOG}-quux
21837 !! html/php
21838 <p>fooblog, WEBJOURNAL, WEBLOGquux
21839 </p>
21840 !! html/parsoid
21841 <p>foo<span typeof="mw:LanguageVariant" data-mw-variant='{"filter":{"l":["zh","zh-hans","zh-hant"],"t":"blog, WEBJOURNAL, WEBLOG"}}'></span>quux</p>
21842 !! end
21843
21844 # Note that Parsoid post-processing for language variants needs to
21845 # update the `title` attribute here, based on the mw:ExpandedAttrs property
21846 !! test
21847 Conversion around HTML tags
21848 !! options
21849 language=sr variant=sr-ec
21850 !! wikitext
21851 -{H|span=>sr-ec:script;title=>sr-ec:src}-
21852 <span title="La-{sr-el:L;sr-ec:C}-tin">ski</span>
21853 !! html/php
21854 <p>
21855 <span title="ЛаCтин">ски</span>
21856 </p>
21857 !! html/parsoid
21858 <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"}]}'/>
21859 <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>
21860 !! end
21861
21862 !! test
21863 Explicit session-wise two-way language variant mapping (A flag and - flag)
21864 !! options
21865 language=zh variant=zh-tw
21866 !! wikitext
21867 This is -{zh:China; zh-tw:Taiwan}-, but we'll forget that now.
21868
21869 Taiwan is not China.
21870
21871 But -{A|zh:China; zh-tw:Taiwan}- is China,
21872
21873 (This-{-|zh:China; zh-tw:Taiwan}- should be stripped!)
21874
21875 and -{China}- is China.
21876 !! html/php
21877 <p>This is Taiwan, but we'll forget that now.
21878 </p><p>Taiwan is not China.
21879 </p><p>But Taiwan is Taiwan,
21880 </p><p>(This should be stripped!)
21881 </p><p>and China is China.
21882 </p>
21883 !! html/parsoid
21884 <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>
21885 <p>Taiwan is not China.</p>
21886 <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>
21887 <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>
21888 <p>and <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"China"}}'></span> is China.</p>
21889 !! end
21890
21891 !! test
21892 Explicit session-wise one-way language variant mapping (A flag and - flag)
21893 !! options
21894 language=zh variant=zh-tw
21895 !! wikitext
21896 This is -{COUNTRY=>zh:China;COUNTRY=>zh-tw:Taiwan}-, but we'll forget that now.
21897
21898 COUNTRY is China or Taiwan.
21899
21900 But -{A|COUNTRY=>zh:China;COUNTRY=>zh-tw:Taiwan}- is COUNTRY,
21901
21902 (This-{-|COUNTRY=>zh:China;COUNTRY=>zh-tw:Taiwan}- should be stripped!)
21903
21904 and -{COUNTRY}- is COUNTRY.
21905 !! html/php
21906 <p>This is Taiwan, but we'll forget that now.
21907 </p><p>COUNTRY is China or Taiwan.
21908 </p><p>But Taiwan is Taiwan,
21909 </p><p>(This should be stripped!)
21910 </p><p>and COUNTRY is COUNTRY.
21911 </p>
21912 !! html/parsoid
21913 <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>
21914 <p>COUNTRY is China or Taiwan.</p>
21915 <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>
21916 <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>
21917 <p>and <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"COUNTRY"}}'></span> is COUNTRY.</p>
21918 !! end
21919
21920 !! test
21921 Explicit session-wise two-way language variant mapping (H flag for hide)
21922 !! options
21923 language=zh variant=zh-tw
21924 !! wikitext
21925 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
21926
21927 Taiwan is China.
21928 !! html/php
21929 <p>(This should be stripped!)
21930 </p><p>Taiwan is Taiwan.
21931 </p>
21932 !! html/parsoid
21933 <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>
21934 <p>Taiwan is China.</p>
21935 !! end
21936
21937 !! test
21938 Explicit session-wise one-way language variant mapping (H flag for hide)
21939 !! options
21940 language=zh variant=zh-tw
21941 !! wikitext
21942 (This-{H|COUNTRY=>zh:China;COUNTRY=>zh-tw:Taiwan}- should be stripped!)
21943
21944 COUNTRY is Taiwan or China.
21945 !! html/php
21946 <p>(This should be stripped!)
21947 </p><p>Taiwan is Taiwan or China.
21948 </p>
21949 !! html/parsoid
21950 <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>
21951 <p>COUNTRY is Taiwan or China.</p>
21952 !! end
21953
21954 ## Note that parsoid test runner does not support 'showtitle' option.
21955 !! test
21956 Adding explicit conversion rule for title (T flag)
21957 !! options
21958 language=zh variant=zh-tw showtitle
21959 !! wikitext
21960 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
21961
21962 Taiwan is China.
21963 !! html/php
21964 Taiwan
21965 <p>Should be stripped!
21966 </p><p>Taiwan is China.
21967 </p>
21968 !! html/parsoid
21969 <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>
21970 <p>Taiwan is China.</p>
21971 !! end
21972
21973 !! test
21974 Code coverage: T combined with H flag
21975 !! options
21976 language=zh variant=zh-tw showtitle
21977 !! wikitext
21978 Should be stripped-{T;H|zh:China; zh-tw:Taiwan}-!
21979
21980 Taiwan is China.
21981 !! html/php
21982 Taiwan
21983 <p>Should be stripped!
21984 </p><p>Taiwan is Taiwan.
21985 </p>
21986 !! html/parsoid
21987 <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>
21988 <p>Taiwan is China.</p>
21989 !! end
21990
21991 !! test
21992 Code coverage: T with no variants
21993 !! options
21994 language=zh variant=zh-tw showtitle
21995 !! wikitext
21996 -{H|zh:China; zh-tw:Taiwan}-
21997 Taiwan is China.-{T|Taiwan is China}-
21998 !! html/php
21999 Taiwan is China
22000 <p>
22001 Taiwan is Taiwan.
22002 </p>
22003 !! html/parsoid
22004 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"zh","t":"China"},{"l":"zh-tw","t":"Taiwan"}]}'/>
22005 Taiwan is China.<meta typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Taiwan is China"},"title":true}'/></p>
22006 !! end
22007
22008 !! test
22009 Code coverage: rules with no variants
22010 !! options
22011 language=zh variant=zh-tw
22012 !! wikitext
22013 -{H|zh:China; zh-tw:Taiwan}-
22014 Taiwan is China.
22015 -{H|China}-
22016 Taiwan is China.
22017 !! html/php
22018 <p>
22019 Taiwan is Taiwan.
22020
22021 Taiwan is China.
22022 </p>
22023 !! html/parsoid
22024 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"zh","t":"China"},{"l":"zh-tw","t":"Taiwan"}]}'/>
22025 Taiwan is China.
22026 <meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"*","t":"China"}]}'/>
22027 Taiwan is China.</p>
22028 !! end
22029
22030
22031 !! test
22032 Code coverage: D flag for conversion rule
22033 !! options
22034 language=zh variant=zh-tw
22035 !! wikitext
22036 -{D|zh-cn:XA; zh-tw:YA}-
22037 -{A;D|zh-cn:XB; zh-tw:YB}-
22038 -{D;H|zh-cn:XC; zh-tw:YC}-
22039
22040 -{D;H|FOO=>zh-tw:BAR;FOO=>zh-cn:BAT}-
22041
22042 -{D|0=>zh-tw:1}-
22043 -{A;D|2=>zh-tw:3}-
22044 -{D;H|4=>zh-tw:5}-
22045
22046 XA XB XC YA YB YC FOO BAR BAT 012345
22047 !! html/php
22048 <p>大陆:XA;台灣:YA;
22049
22050 大陆:XC;台灣:YC;
22051 </p><p>FOO⇒台灣:BAR;FOO⇒大陆:BAT;
22052 </p><p>0⇒台灣:1;
22053
22054 4⇒台灣:5;
22055 </p><p>XA YB YC YA YB YC BAR BAR BAT 013355
22056 </p>
22057 !! html/parsoid
22058 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"describe":true,"twoway":[{"l":"zh-cn","t":"XA"},{"l":"zh-tw","t":"YA"}]}'></span>
22059 <meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"describe":true,"twoway":[{"l":"zh-cn","t":"XB"},{"l":"zh-tw","t":"YB"}]}'/>
22060 <span typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"describe":true,"twoway":[{"l":"zh-cn","t":"XC"},{"l":"zh-tw","t":"YC"}]}'></span></p>
22061 <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>
22062 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"describe":true,"oneway":[{"f":"0","l":"zh-tw","t":"1"}]}'></span>
22063 <meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"describe":true,"oneway":[{"f":"2","l":"zh-tw","t":"3"}]}'/>
22064 <span typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"describe":true,"oneway":[{"f":"4","l":"zh-tw","t":"5"}]}'></span></p>
22065 <p>XA XB XC YA YB YC FOO BAR BAT 012345</p>
22066 !! end
22067
22068 !! test
22069 Code coverage: N flag for conversion rule
22070 !! options
22071 language=zh variant=zh-cn
22072 !! wikitext
22073 -{N|zh-cn}-
22074
22075 -{N|zh-tw}-
22076
22077 -{N|sr-ec}-
22078 !! html/php
22079 <p>大陆
22080 </p><p>台灣
22081 </p><p>српски (ћирилица)‎
22082 </p>
22083 !! html/parsoid
22084 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"name":{"t":"zh-cn"}}'></span></p>
22085 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"name":{"t":"zh-tw"}}'></span></p>
22086 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"name":{"t":"sr-ec"}}'></span></p>
22087 !! end
22088
22089 # html2wt suppresses the bogus 'D' flag, so this is wt2html only
22090 !! test
22091 Code coverage: N flag for conversion rule (wt2html only)
22092 !! options
22093 language=zh variant=zh-cn
22094 parsoid=wt2html,html2html
22095 !! wikitext
22096 -{D;N|en}-
22097 !! html/php
22098 <p>English
22099 </p>
22100 !! html/parsoid
22101 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"name":{"t":"en"}}' data-parsoid='{"fl":["D","N"]}'></span></p>
22102 !! end
22103
22104 !! test
22105 Testing that changing the language variant here in the tests actually works
22106 !! options
22107 language=zh variant=zh showtitle
22108 !! wikitext
22109 Should be stripped-{T|zh:China; zh-tw:Taiwan}-!
22110 !! html/php
22111 China
22112 <p>Should be stripped!
22113 </p>
22114 !! html/parsoid
22115 <p>Should be stripped<meta typeof="mw:LanguageVariant" data-mw-variant='{"title":true,"twoway":[{"l":"zh","t":"China"},{"l":"zh-tw","t":"Taiwan"}]}'/>!</p>
22116 !! end
22117
22118 !! test
22119 Recursive conversion of alt and title attrs shouldn't clear converter state
22120 !! options
22121 language=zh variant=zh-cn
22122 showtitle
22123 !! wikitext
22124 -{H|zh-cn:Exclamation; zh-tw:exclamation}-
22125 Should be stripped-{T|zh-cn:China; zh-tw:Taiwan}-<span title="exclamation">!</span>
22126 !! html/php
22127 China
22128 <p>
22129 Should be stripped<span title="Exclamation">!</span>
22130 </p>
22131 !! html/parsoid
22132 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"zh-cn","t":"Exclamation"},{"l":"zh-tw","t":"exclamation"}]}'/>
22133 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>
22134 !! end
22135
22136 !! test
22137 T26072: more test on conversion rule for title
22138 !! options
22139 language=zh variant=zh-tw showtitle
22140 !! wikitext
22141 This should be stripped-{T|zh:China; zh-tw:Taiwan}-!
22142
22143 This won't take interferes with the title rule-{H|zh:Beijing; zh-tw:Taipei}-.
22144 !! html/php
22145 Taiwan
22146 <p>This should be stripped!
22147 </p><p>This won't take interferes with the title rule.
22148 </p>
22149 !! html/parsoid
22150 <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>
22151 <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>
22152 !! end
22153
22154 !! test
22155 Partly disable title conversion if variant == main language code
22156 !! options
22157 language=zh variant=zh title=[[ZH]] showtitle
22158 !! wikitext
22159 -{T|zh-cn:CN;zh-tw:TW}-
22160 !! html/php
22161 ZH
22162 <p>
22163 </p>
22164 !! html/parsoid
22165 <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>
22166 !! end
22167
22168 !! test
22169 Partly disable title conversion if variant == main language code, more
22170 !! options
22171 language=zh variant=zh title=[[ZH]] showtitle
22172 !! wikitext
22173 -{T|TW}-
22174 !! html/php
22175 ZH
22176 <p>
22177 </p>
22178 !! html/parsoid
22179 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"TW"},"title":true}'/></p>
22180 !! end
22181
22182 !! test
22183 Raw output of variant escape tags (R flag)
22184 !! options
22185 language=zh variant=zh-tw
22186 !! wikitext
22187 Raw: -{R|zh:China;zh-tw:Taiwan}-
22188 !! html/php
22189 <p>Raw: zh:China;zh-tw:Taiwan
22190 </p>
22191 !! html/parsoid
22192 <p>Raw: <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"zh:China;zh-tw:Taiwan"}}'></span></p>
22193 !! end
22194
22195 # html2wt suppresses the bogus 'D' flags, so this is wt2html only
22196 !! test
22197 Raw output of variant escape tags (R flag) (wt2html only)
22198 !! options
22199 language=zh variant=zh-tw
22200 parsoid=wt2html,html2html
22201 !! wikitext
22202 -{Variant}- -{D|syntax}- -{D;R|options}-
22203 !! html/php
22204 <p>Variant syntax options
22205 </p>
22206 !! html/parsoid
22207 <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>
22208 !! end
22209
22210 !! test
22211 Nested markup inside raw output of variant escape tags (R flag)
22212 !! options
22213 language=zh variant=zh-tw
22214 !! wikitext
22215 Nested raw: -{R|nested -{zh:China;zh-tw:Taiwan}- nested}-
22216 !! html/php
22217 <p>Nested raw: nested Taiwan nested
22218 </p>
22219 !! html/parsoid
22220 <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>
22221 !! end
22222
22223 !! test
22224 Nested markup and spaces inside raw output of variant escape tags (R flag)
22225 !! options
22226 language=zh variant=zh-tw
22227 !! wikitext
22228 X-{ outer -{ inner }- outer }-X
22229 !! html/php
22230 <p>X outer inner outer X
22231 </p>
22232 !! html/parsoid
22233 <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>
22234 !! end
22235
22236 !! test
22237 Templates inside raw output of variant escape tags (R flag)
22238 !! options
22239 language=zh variant=zh-tw
22240 !! wikitext
22241 Nested raw: -{R|nested {{echo|hi}} templates}-
22242 !! html/php
22243 <p>Nested raw: nested hi templates
22244 </p>
22245 !! html/parsoid
22246 <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>
22247 !! end
22248
22249 !! test
22250 Strings evaluating false shouldn't be ignored by Language converter (T51072)
22251 !! options
22252 language=zh variant=zh-cn
22253 !! input
22254 -{zh-cn:0;zh-sg:1;zh-tw:2;zh-hk:3}-
22255 !! html/php
22256 <p>0
22257 </p>
22258 !! html/parsoid
22259 <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>
22260 !! end
22261
22262 !! test
22263 Conversion rules from [numeric-only string] to [something else] (T48634)
22264 !! options
22265 language=zh variant=zh-cn
22266 !! input
22267 -{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
22268 !! html/php
22269 <p>D12345EE12345
22270 </p>
22271 !! html/parsoid
22272 <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>
22273 !! end
22274
22275 !! test
22276 Two-way converter rule entries with an empty value should be ignored (T53551)
22277 !! options
22278 language=zh variant=zh-cn
22279 !! input
22280 -{H|zh-cn:foo;zh-tw:;}-foobar
22281 !! html/php
22282 <p>foobar
22283 </p>
22284 !! html/parsoid
22285 <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>
22286 !! end
22287
22288 !! test
22289 One-way converter rule entries with an empty "from" string should be ignored (T53551)
22290 !! options
22291 language=zh variant=zh-cn
22292 !! input
22293 -{H|=>zh-cn:foo;}-foobar
22294 !! html/php
22295 <p>foobar
22296 </p>
22297 !! html/parsoid
22298 <p><meta typeof="mw:LanguageVariant" data-parsoid='{"tSp":[5]}' data-mw-variant='{"add":true,"oneway":[{"f":"","l":"zh-cn","t":"foo"}]}'/>foobar</p>
22299 !! end
22300
22301 !! test
22302 Empty converter rule entries shouldn't be inserted into the conversion table (T53551)
22303 !! options
22304 language=zh variant=zh-cn
22305 !! input
22306 -{H|}-foobar
22307 !! html/php
22308 <p>foobar
22309 </p>
22310 !! html/parsoid
22311 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"*","t":""}]}'/>foobar</p>
22312 !! end
22313
22314 !! test
22315 Nested using of manual convert syntax
22316 !! options
22317 language=zh variant=zh-hk
22318 !! wikitext
22319 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
22320 !! html/php
22321 <p>Nested: Hello Hong Kong!
22322 </p>
22323 !! html/parsoid
22324 <p>Nested: <span typeof="mw:LanguageVariant" data-parsoid='{"tSp":[7]}' data-mw-variant='{"twoway":[{"l":"zh-hans","t":"Hi &lt;span typeof=\"mw:LanguageVariant\" data-mw-variant=&apos;{\"twoway\":[{\"l\":\"zh-cn\",\"t\":\"China\"},{\"l\":\"zh-sg\",\"t\":\"Singapore\"}]}&apos; data-parsoid=&apos;{\"fl\":[],\"tSp\":[7],\"dsr\":[21,53,null,2]}&apos;>&lt;/span>"},{"l":"zh-hant","t":"Hello &lt;span typeof=\"mw:LanguageVariant\" data-mw-variant=&apos;{\"twoway\":[{\"l\":\"zh-tw\",\"t\":\"Taiwan\"},{\"l\":\"zh-hk\",\"t\":\"H&amp;lt;span typeof=\\\"mw:LanguageVariant\\\" data-mw-variant=&amp;apos;{\\\"disabled\\\":{\\\"t\\\":\\\"ong\\\"}}&amp;apos; data-parsoid=&amp;apos;{\\\"fl\\\":[],\\\"dsr\\\":[90,97,null,2]}&amp;apos;>&amp;lt;/span> K&amp;lt;span typeof=\\\"mw:LanguageVariant\\\" data-mw-variant=&amp;apos;{\\\"disabled\\\":{\\\"t\\\":\\\"\\\"}}&amp;apos; data-parsoid=&amp;apos;{\\\"fl\\\":[],\\\"dsr\\\":[99,103,null,2]}&amp;apos;>&amp;lt;/span>ong\"}]}&apos; data-parsoid=&apos;{\"fl\":[],\"tSp\":[7],\"dsr\":[68,109,null,2]}&apos;>&lt;/span>"}]}'></span>!</p>
22325 !! end
22326
22327 !! test
22328 HTML markups with conversion syntax in attribs, nested in other conversion blocks
22329 !! options
22330 language=zh variant=zh-cn
22331 !! wikitext
22332 -{zh;zh-hans;zh-hant|<span title="-{X}-">A</span>}-
22333 !! html/php
22334 <p><span title="X">A</span>
22335 </p>
22336 !! html/parsoid
22337 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"filter":{"l":["zh","zh-hans","zh-hant"],"t":"&lt;span title=\"\" about=\"#mwt1\" typeof=\"mw:ExpandedAttrs\" data-parsoid=&#39;{\"stx\":\"html\",\"a\":{\"title\":\"\"},\"sa\":{\"title\":\"-{X}-\"},\"dsr\":[21,49,20,7]}&#39; data-mw=&#39;{\"attribs\":[[{\"txt\":\"title\"},{\"html\":\"&amp;lt;span typeof=\\\"mw:LanguageVariant\\\" data-mw-variant=&amp;apos;{\\\"disabled\\\":{\\\"t\\\":\\\"X\\\"}}&amp;apos; data-parsoid=&amp;apos;{\\\"fl\\\":[],\\\"dsr\\\":[34,39,null,2]}&amp;apos;>&amp;lt;/span>\"}]]}&#39;>A&lt;/span>"}}'></span></p>
22338 !! end
22339
22340 !! test
22341 HTML markups with conversion syntax in attribs, nested in other conversion blocks (not working yet in PHP parser)
22342 !! options
22343 language=zh variant=zh-cn
22344 !! wikitext
22345 -{<span title="-{X}-">A</span>}-
22346 !! html/php+disabled
22347 <p><span title="X">A</span>
22348 </p>
22349 !! html/parsoid
22350 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"&lt;span title=\"\" about=\"#mwt1\" typeof=\"mw:ExpandedAttrs\" data-parsoid=&#39;{\"stx\":\"html\",\"a\":{\"title\":\"\"},\"sa\":{\"title\":\"-{X}-\"},\"dsr\":[2,30,20,7]}&#39; data-mw=&#39;{\"attribs\":[[{\"txt\":\"title\"},{\"html\":\"&amp;lt;span typeof=\\\"mw:LanguageVariant\\\" data-mw-variant=&amp;apos;{\\\"disabled\\\":{\\\"t\\\":\\\"X\\\"}}&amp;apos; data-parsoid=&amp;apos;{\\\"fl\\\":[],\\\"dsr\\\":[15,20,null,2]}&amp;apos;>&amp;lt;/span>\"}]]}&#39;>A&lt;/span>"}}'></span></p>
22351 !! end
22352
22353 # Parsoid and PHP disagree on how to parse this example: Parsoid
22354 # insists that the content of a language converter element be a valid
22355 # DOM fragment or attribute string
22356 !! test
22357 Language converter markup with block content
22358 !! options
22359 language=zh variant=zh-cn
22360 !! wikitext
22361 <span>a-{b<div>c}-d
22362
22363 <span>a-{zh;zh-hans;zh-hant|b<div>c}-d
22364
22365 <span>a-{H|0=>zh-cn:x<span>y;0=>zh-tw:b<div>c}-d
22366 !! html/php+tidy
22367 <p><span>ab</span></p>
22368 <div><span>cd <span>ab</span></span>
22369 <div><span>cd <span>ad</span></span></div>
22370 </div>
22371 !! html/parsoid
22372 <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>
22373
22374 <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>
22375
22376 <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>
22377 !! end
22378
22379 !! test
22380 LanguageConverter selser (1)
22381 !! options
22382 language=zh variant=zh-cn
22383 parsoid={
22384 "modes": ["wt2wt", "selser"],
22385 "changes": [
22386 ["span[typeof]", "attr", "data-mw-variant", "{\"disabled\":{\"t\":\"edited\"}}"]
22387 ]
22388 }
22389 !! wikitext
22390 -{raw}-
22391 !! wikitext/edited
22392 -{edited}-
22393 !! end
22394
22395 !! test
22396 LanguageConverter selser (2)
22397 !! options
22398 language=zh variant=zh-cn
22399 parsoid={
22400 "modes": ["wt2wt", "selser"],
22401 "changes": [
22402 ["span[class='x']", "contents", "text", "-{foo}-"],
22403 ["a", "contents", "text", "-{"],
22404 ["span[typeof]", "attr", "data-mw", "{\"parts\":[{\"template\":{\"target\":{\"wt\":\"1x\",\"href\":\"./Template:1x\"},\"params\":{\"1\":{\"wt\":\"-{\"}},\"i\":0}}]}"]
22405 ]
22406 }
22407 !! wikitext
22408 <span class="x">TEXT1</span>
22409 [http://example.com TEXT2]
22410 [[Foo|TEXT3]]
22411 {{echo|TEXT4}}
22412 !! wikitext/edited
22413 <span class="x"><nowiki>-{foo}-</nowiki></span>
22414 [http://example.com -{]
22415 [[Foo|<nowiki>-{</nowiki>]]
22416 {{1x|<nowiki>-{</nowiki>}}
22417 !! end
22418
22419 # Tests LanguageVariantText in ConstrainedText
22420 !! test
22421 LanguageConverter selser (3)
22422 !! options
22423 language=zh variant=zh-cn
22424 parsoid={
22425 "modes": ["wt2wt", "selser"],
22426 "changes": [
22427 ["td > span", "attr", "typeof", "mw:LanguageVariant"],
22428 ["td > span", "attr", "data-mw-variant", "{\"disabled\":{\"t\":\"edited\"}}"]
22429 ]
22430 }
22431 !! wikitext
22432 {|
22433 |-
22434 |<span>Foo</span>
22435 |}
22436 !! wikitext/edited
22437 {|
22438 |-
22439 |<nowiki/>-{edited}-
22440 |}
22441 !! end
22442
22443 # Tests LanguageVariantText._fromSelSer
22444 !! test
22445 LanguageConverter selser (4)
22446 !! options
22447 language=zh variant=zh-cn
22448 parsoid={
22449 "modes": ["wt2wt", "selser"],
22450 "changes": [
22451 ["td > span.x", "remove"]
22452 ]
22453 }
22454 !! wikitext
22455 {|
22456 |-
22457 |<span class="x">Foo</span>-{Bar}-
22458 ||<span class="x">Foo</span>-{Bar}-
22459 |}
22460 !! wikitext/edited
22461 {|
22462 |-
22463 |<nowiki/>-{Bar}-
22464 ||-{Bar}-
22465 |}
22466 !! end
22467
22468 # Since Parsoid is starting to emit canonical wikitext for links,
22469 # [http://example.com http://example.com] will not RT back to that
22470 # form anymore.
22471 # Parsoid does not language-convert links (it is done in a
22472 # post-processing step)
22473 !! test
22474 Proper conversion of text in external links
22475 !! options
22476 language=sr variant=sr-ec
22477 parsoid=wt2html
22478 !! wikitext
22479 http://www.google.com
22480 gopher://www.google.com
22481 [http://www.google.com http://www.google.com]
22482 [gopher://www.google.com gopher://www.google.com]
22483 [https://www.google.com irc://www.google.com]
22484 [ftp://www.google.com www.google.com/ftp://dir]
22485 [//www.google.com www.google.com]
22486 !! html/php
22487 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
22488 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
22489 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
22490 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
22491 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
22492 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
22493 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
22494 </p>
22495 !! html/parsoid
22496 <p><a rel="mw:ExtLink" href="http://www.google.com">http://www.google.com</a>
22497 <a rel="mw:ExtLink" href="gopher://www.google.com">gopher://www.google.com</a>
22498 <a rel="mw:ExtLink" href="http://www.google.com">http://www.google.com</a>
22499 <a rel="mw:ExtLink" href="gopher://www.google.com">gopher://www.google.com</a>
22500 <a rel="mw:ExtLink" href="https://www.google.com">irc://www.google.com</a>
22501 <a rel="mw:ExtLink" href="ftp://www.google.com">www.google.com/ftp://dir</a>
22502 <a rel="mw:ExtLink" href="//www.google.com">www.google.com</a></p>
22503 !! end
22504
22505 !! test
22506 Do not convert roman numbers to language variants
22507 !! options
22508 language=sr variant=sr-ec
22509 !! wikitext
22510 Fridrih IV je car.
22511 !! html/php
22512 <p>Фридрих IV је цар.
22513 </p>
22514 !! html/parsoid
22515 <p>Fridrih IV je car.</p>
22516 !! end
22517
22518 !! test
22519 Unclosed language converter markup "-{"
22520 !! options
22521 language=sr
22522 !! wikitext
22523 -{T|hello
22524 !! html
22525 <p>-{T|hello
22526 </p>
22527 !! end
22528
22529 !! test
22530 Don't convert raw rule "-{R|=&gt;}-" to "=>"
22531 !! options
22532 language=sr
22533 !! wikitext
22534 -{R|=&gt;}-
22535 !! html/php
22536 <p>=&gt;
22537 </p>
22538 !! html/parsoid
22539 <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>
22540 !!end
22541
22542 !! test
22543 Don't break link parsing if language converter markup is in the caption.
22544 !! options
22545 language=sr variant=sr-ec
22546 !! wikitext
22547 [[Main Page|-{R|main page}-]]
22548 !! html/php
22549 <p><a href="/wiki/Main_Page" title="Маин Паге">main page</a>
22550 </p>
22551 !! html/parsoid
22552 <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>
22553 !! end
22554
22555 !! test
22556 T146304: Don't break template parsing if language converter markup is in the parameter.
22557 !! options
22558 language=sr variant=sr-ec
22559 !! wikitext
22560 {{echo|-{R|foo}-}}
22561 !! html/php
22562 <p>foo
22563 </p>
22564 !! html/parsoid
22565 <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>
22566 !! end
22567
22568 !! test
22569 T146305: Don't break image parsing if language converter markup is in the caption.
22570 !! options
22571 language=sr
22572 !! wikitext
22573 [[Датотека:Foobar.jpg|thumb|-{R|caption:}-]]
22574 !! html/php
22575 <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>
22576
22577 !! html/parsoid
22578 <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>
22579 !! end
22580
22581 !! test
22582 T146305: Don't break image parsing if nested language converter markup is in the caption.
22583 !! options
22584 language=zh variant=zh-cn
22585 !! wikitext
22586 [[File:Foobar.jpg|thumb|-{|zh-cn:blog (hk: -{zh-hans|WEBJOURNAL}-, tw: -{zh-hans|WEBLOG}-)}-]]
22587 !! html/php
22588 <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>
22589
22590 !! html/parsoid
22591 <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>
22592 !! end
22593
22594 # XXX html2wt disabled because rich markup in alt is not preserved.
22595 !! test
22596 Don't break gallery if language converter markup is inside.
22597 !! options
22598 language=zh
22599 !! wikitext
22600 <gallery>
22601 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=-{R|foo}-|-{R|bar}-]]|alt=-{R|bat}-
22602 File:foobar.jpg|{{Test|unamedParam|alt=-{R|param}-}}|alt=galleryalt
22603 </gallery>
22604 !! html/php
22605 <ul class="gallery mw-gallery-traditional">
22606 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
22607 <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>
22608 <div class="gallerytext">
22609 <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>
22610 </p>
22611 </div>
22612 </div></li>
22613 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
22614 <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>
22615 <div class="gallerytext">
22616 <p>This is a test template
22617 </p>
22618 </div>
22619 </div></li>
22620 </ul>
22621
22622 !! html/parsoid
22623 <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"}}'>
22624 <li class="gallerybox">
22625 <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>
22626 <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>
22627 </li>
22628 <li class="gallerybox">
22629 <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>
22630 <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>
22631 </li>
22632 </ul>
22633 !! end
22634
22635 !! test
22636 T153135: Don't break list handling if language converter markup is in the item.
22637 !! options
22638 language=zh variant=zh-cn
22639 !! wikitext
22640 ;-{zh-cn:AAA;zh-tw:BBB}-
22641 ;-{R|foo:bar}-
22642 !! html/php
22643 <dl><dt>AAA</dt>
22644 <dt>foo:bar</dt></dl>
22645
22646 !! html/parsoid
22647 <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>
22648 <dt data-parsoid='{"dsr":[25,39,1,0]}'><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"foo:bar"}}'></span></dt>
22649 </dl>
22650 !! end
22651
22652 // Note that parsoid does not protect colons unless language converter
22653 // markup is properly nested, because it is a backtracking parser.
22654 !! test
22655 T153135: Unclosed markup in definition list (code coverage)
22656 !! options
22657 language=zh variant=zh-cn
22658 !! wikitext
22659 ;<b>foo:bar
22660 ;-{zh-cn:AAA
22661 !! html/php+tidy
22662 <dl>
22663 <dt><b>foo:bar</b></dt>
22664 <dt><b>-{zh-cn:AAA</b></dt>
22665 </dl>
22666 !! html/parsoid
22667 <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}'>
22668 <dt data-parsoid='{"dsr":[12,20,1,0]}'>-{zh-cn</dt>
22669 <dd data-parsoid='{"stx":"row","dsr":[20,24,1,0]}'>AAA</dd>
22670 </b></dl>
22671 !! end
22672
22673 !! test
22674 T153135: Nested language converter markup in definition list (code coverage)
22675 !! options
22676 language=zh variant=zh-cn
22677 !! wikitext
22678 ;-{|zh-cn:AAA -{zh-hans|foo:bar}- -{R|bat:baz}-}-:def
22679 !! html/php
22680 <dl><dt>AAA foo:bar bat:baz</dt>
22681 <dd>def</dd></dl>
22682
22683 !! html/parsoid
22684 <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>
22685 <dd data-parsoid='{"stx":"row","dsr":[49,53,1,0]}'>def</dd>
22686 </dl>
22687 !! end
22688
22689 # html2wt mode disabled due to <nowiki> insertion.
22690 !! test
22691 T153140: Don't break table handling if language converter markup is in the cell.
22692 !! options
22693 language=sr variant=sr-ec
22694 parsoid=wt2html,wt2wt,html2html
22695 !! wikitext
22696 {|
22697 |-
22698 | -{R|B}-
22699 |}
22700 !! html/php
22701 <table>
22702
22703 <tr>
22704 <td> B
22705 </td></tr></table>
22706
22707 !! html/parsoid
22708 <table>
22709 <tbody>
22710 <tr>
22711 <td><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"B"}}'></span></td>
22712 </tr>
22713 </tbody>
22714 </table>
22715 !! end
22716
22717 !! test
22718 Language converter tricky html2wt cases (1)
22719 !! options
22720 language=sr
22721 parsoid=html2wt,wt2wt
22722 !! html/parsoid
22723 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"}-"}}'></span></p>
22724 !! wikitext
22725 -{<nowiki>}-</nowiki>}-
22726 !! html/php
22727 <p>&#125;-
22728 </p>
22729 !! end
22730
22731 !! test
22732 Language converter tricky html2wt cases (2)
22733 !! options
22734 language=sr
22735 parsoid=html2wt,wt2wt
22736 !! html/parsoid
22737 <p>-{foo}-</p>
22738 !! wikitext
22739 <nowiki>-{foo}-</nowiki>
22740 !! html/php
22741 <p>-&#123;foo&#125;-
22742 </p>
22743 !! end
22744
22745 !! test
22746 Language converter tricky html2wt cases (3)
22747 !! options
22748 language=sr
22749 parsoid=html2wt,wt2wt
22750 !! html/parsoid
22751 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"|"}}'></span></p>
22752 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"R|raw"}}'></span></p>
22753 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"-{foo}-"}}'></span></p>
22754 !! wikitext
22755 -{R||}-
22756
22757 -{R|R|raw}-
22758
22759 -{<nowiki>-{foo}-</nowiki>}-
22760 !! html/php
22761 <p>|
22762 </p><p>R|raw
22763 </p><p>-&#123;foo&#125;-
22764 </p>
22765 !! end
22766
22767 !! test
22768 Language converter tricky html2wt cases (4)
22769 !! options
22770 language=sr
22771 parsoid=html2wt,wt2wt
22772 !! html/parsoid
22773 <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>
22774 !! wikitext
22775 -{R|{{echo|hey}}}-
22776 !! html/php
22777 <p>hey
22778 </p>
22779 !! end
22780
22781 # Note that the <nowiki> escaping added by parsoid for source text,
22782 # destination text, and language names only works on the PHP side
22783 # for *destination text*. (HTML entity escaping wouldn't work
22784 # any better.) This is probably a bug, at least for source texts.
22785 # (For language names PHP uses a precise regexp based on the languages
22786 # it currently knows have variants, which is fragile since this set
22787 # can grow/shrink over time.)
22788 !! test
22789 Language converter tricky html2wt cases (5)
22790 !! options
22791 language=zh variant=zh-cn
22792 !! html/parsoid
22793 <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>
22794 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"oneway":[{"f":"A","l":"bo:g;us","t":"B"}]}'/></p>
22795 <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>
22796 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"twoway":[{"l":"bo:g;us","t":"xyz"},{"l":"zh-cn","t":"abc"}]}'></span></p>
22797 <p>a:b=>c xyz</p>
22798 !! wikitext
22799 -{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
22800
22801 -{H|A=><nowiki>bo:g;us</nowiki>:B}-
22802
22803 -{A|zh-tw:xyz; zh-cn:<nowiki>0;zh-tw:bar</nowiki>}-
22804
22805 -{<nowiki>bo:g;us</nowiki>:xyz; zh-cn:abc}-
22806
22807 a:b=>c xyz
22808 !! html/php+disabled
22809 <p>foobat;xyz=&gt;zh-cn:abc
22810 </p><p>A
22811 </p><p>0;zh-tw:bar
22812 </p><p>abc
22813 </p><p>a:b=&gt;c 0;zh-tw:bar
22814 </p>
22815 !! end
22816
22817 !! test
22818 T179579: Nowiki and lc interaction
22819 !! options
22820 parsoid=wt2html
22821 language=sr
22822 !! wikitext
22823 -{</nowiki>123}-
22824
22825 -{123<nowiki>|</nowiki>456}-
22826 !! html/parsoid
22827 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"&amp;lt;/nowiki>123"}}' data-parsoid='{"fl":[],"src":"-{&lt;/nowiki>123}-"}'></span></p>
22828
22829 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"123&lt;span typeof=\"mw:Nowiki\" data-parsoid=&#39;{\"dsr\":[23,41,8,9]}&#39;>|&lt;/span>456"}}' data-parsoid='{"fl":[],"src":"-{123&lt;nowiki>|&lt;/nowiki>456}-"}'></span></p>
22830 !! end
22831
22832 !! test
22833 T2529: Uncovered bullet
22834 !! wikitext
22835 * Foo {{bullet}}
22836 !! html
22837 <ul><li> Foo </li>
22838 <li> Bar</li></ul>
22839
22840 !! end
22841
22842 # Plain MediaWiki does not remove empty lists, but tidy actually does.
22843 # Templates in Wikipedia rely on this behavior, as tidy has always been
22844 # enabled there. These tests are normally run *without* tidy, so specify the
22845 # full output here.
22846 # To test realistic parsing behavior, apply a tidy-like transformation to both
22847 # the expected output and your parser's output.
22848 !! test
22849 T2529: Uncovered bullet leaving empty list, normally removed by tidy
22850 !! wikitext
22851 ******* Foo {{bullet}}
22852 !! html
22853 <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>
22854 <li> Bar</li></ul>
22855
22856 !! end
22857
22858 !! test
22859 T2529: Uncovered table already at line-start
22860 !! wikitext
22861 x
22862
22863 {{table}}
22864 y
22865 !! html
22866 <p>x
22867 </p>
22868 <table>
22869 <tr>
22870 <td> 1 </td>
22871 <td> 2
22872 </td></tr>
22873 <tr>
22874 <td> 3 </td>
22875 <td> 4
22876 </td></tr></table>
22877 <p>y
22878 </p>
22879 !! end
22880
22881 !! test
22882 T2529: Uncovered bullet in parser function result
22883 !! wikitext
22884 * Foo {{lc:{{bullet}} }}
22885 !! html
22886 <ul><li> Foo </li>
22887 <li> bar</li></ul>
22888
22889 !! end
22890
22891 !! test
22892 T7678: Double-parsed template argument
22893 !! wikitext
22894 {{lc:{{{1}}}|hello}}
22895 !! html
22896 <p>{{{1}}}
22897 </p>
22898 !! end
22899
22900 !! test
22901 T7678: Double-parsed template invocation
22902 !! wikitext
22903 {{lc:{{paramtest {{!}} param = hello }} }}
22904 !! html
22905 <p>{{paramtest | param = hello }}
22906 </p>
22907 !! end
22908
22909 !! test
22910 Case insensitivity of parser functions for non-ASCII characters (T10143)
22911 !! options
22912 language=cs
22913 title=[[Main Page]]
22914 !! wikitext
22915 {{PRVNÍVELKÉ:ěščř}}
22916 {{prvnívelké:ěščř}}
22917 {{PRVNÍMALÉ:ěščř}}
22918 {{prvnímalé:ěščř}}
22919 {{MALÁ:ěščř}}
22920 {{malá:ěščř}}
22921 {{VELKÁ:ěščř}}
22922 {{velká:ěščř}}
22923 !! html
22924 <p>Ěščř
22925 Ěščř
22926 ěščř
22927 ěščř
22928 ěščř
22929 ěščř
22930 ĚŠČŘ
22931 ĚŠČŘ
22932 </p>
22933 !! end
22934
22935 !! test
22936 Morwen/13: Unclosed link followed by heading
22937 !! wikitext
22938 [[link
22939 ==heading==
22940 !! html
22941 <p>[[link
22942 </p>
22943 <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>
22944
22945 !! end
22946
22947 !! test
22948 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
22949 !! wikitext
22950 {{foo|
22951 =heading=
22952 !! html
22953 <p>{{foo|
22954 </p>
22955 <h1><span class="mw-headline" id="heading">heading</span></h1>
22956
22957 !! end
22958
22959 !! test
22960 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
22961 !! wikitext
22962 {{foo|
22963 ==heading==
22964 !! html
22965 <p>{{foo|
22966 </p>
22967 <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>
22968
22969 !! end
22970
22971 !! test
22972 Tildes in comments
22973 !! options
22974 pst
22975 !! wikitext
22976 <!-- ~~~~ -->
22977 !! html/php
22978 <!-- ~~~~ -->
22979 !! end
22980
22981 !! test
22982 Paragraphs inside divs (no extra line breaks)
22983 !! wikitext
22984 <div>Line one
22985
22986 Line two</div>
22987 !! html
22988 <div>Line one
22989 Line two</div>
22990
22991 !! end
22992
22993 !! test
22994 Paragraphs inside divs (extra line break on open)
22995 !! wikitext
22996 <div>
22997 Line one
22998
22999 Line two</div>
23000 !! html
23001 <div>
23002 <p>Line one
23003 </p>
23004 Line two</div>
23005
23006 !! end
23007
23008 !! test
23009 Paragraphs inside divs (extra line break on close)
23010 !! wikitext
23011 <div>Line one
23012
23013 Line two
23014 </div>
23015 !! html
23016 <div>Line one
23017 <p>Line two
23018 </p>
23019 </div>
23020
23021 !! end
23022
23023 !! test
23024 Paragraphs inside divs (extra line break on open and close)
23025 !! wikitext
23026 <div>
23027 Line one
23028
23029 Line two
23030 </div>
23031 !! html
23032 <div>
23033 <p>Line one
23034 </p><p>Line two
23035 </p>
23036 </div>
23037
23038 !! end
23039
23040 !! test
23041 Nesting tags, paragraphs on lines which begin with <div>
23042 !! wikitext
23043 <div></div><strong>A
23044 B</strong>
23045 !! html/php+tidy
23046 <p><strong>A</strong></p>
23047 <p><strong>B</strong></p>
23048 !! html/parsoid
23049 <div></div>
23050 <p><strong>A
23051 B</strong>
23052 </p>
23053 !! end
23054
23055 # T8200: <blockquote> should behave like <div> with respect to line breaks
23056 !! test
23057 T8200: paragraphs inside blockquotes (no extra line breaks)
23058 !! wikitext
23059 <blockquote>Line one
23060
23061 Line two</blockquote>
23062 !! html
23063 <blockquote>Line one
23064 Line two</blockquote>
23065
23066 !! html+tidy
23067 <blockquote>
23068 <p>Line one Line two</p>
23069 </blockquote>
23070 !! end
23071
23072 !! test
23073 T8200: paragraphs inside blockquotes (extra line break on open)
23074 !! wikitext
23075 <blockquote>
23076 Line one
23077
23078 Line two</blockquote>
23079 !! html
23080 <blockquote>
23081 <p>Line one
23082 </p>
23083 Line two</blockquote>
23084
23085 !! html+tidy
23086 <blockquote>
23087 <p>Line one</p>
23088 Line two</blockquote>
23089 !! end
23090
23091 !! test
23092 T8200: paragraphs inside blockquotes (extra line break on close)
23093 !! wikitext
23094 <blockquote>Line one
23095
23096 Line two
23097 </blockquote>
23098 !! html
23099 <blockquote>Line one
23100 <p>Line two
23101 </p>
23102 </blockquote>
23103
23104 !! html+tidy
23105 <blockquote>
23106 <p>Line one</p>
23107 <p>Line two</p>
23108 </blockquote>
23109 !! end
23110
23111 !! test
23112 T8200: paragraphs inside blockquotes (extra line break on open and close)
23113 !! wikitext
23114 <blockquote>
23115 Line one
23116
23117 Line two
23118 </blockquote>
23119 !! html
23120 <blockquote>
23121 <p>Line one
23122 </p><p>Line two
23123 </p>
23124 </blockquote>
23125
23126 !! html+tidy
23127 <blockquote>
23128 <p>Line one</p>
23129 <p>Line two</p>
23130 </blockquote>
23131 !! end
23132
23133 !! test
23134 Paragraphs inside blockquotes/divs (no extra line breaks)
23135 !! wikitext
23136 <blockquote><div>Line one
23137
23138 Line two</div></blockquote>
23139 !! html
23140 <blockquote><div>Line one
23141 Line two</div></blockquote>
23142
23143 !! end
23144
23145 !! test
23146 Paragraphs inside blockquotes/divs (extra line break on open)
23147 !! wikitext
23148 <blockquote><div>
23149 Line one
23150
23151 Line two</div></blockquote>
23152 !! html
23153 <blockquote><div>
23154 <p>Line one
23155 </p>
23156 Line two</div></blockquote>
23157
23158 !! end
23159
23160 !! test
23161 Paragraphs inside blockquotes/divs (extra line break on close)
23162 !! wikitext
23163 <blockquote><div>Line one
23164
23165 Line two
23166 </div></blockquote>
23167 !! html
23168 <blockquote><div>Line one
23169 <p>Line two
23170 </p>
23171 </div></blockquote>
23172
23173 !! end
23174
23175 !! test
23176 Paragraphs inside blockquotes/divs (extra line break on open and close)
23177 !! wikitext
23178 <blockquote><div>
23179 Line one
23180
23181 Line two
23182 </div></blockquote>
23183 !! html
23184 <blockquote><div>
23185 <p>Line one
23186 </p><p>Line two
23187 </p>
23188 </div></blockquote>
23189
23190 !! end
23191
23192 !! test
23193 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
23194 !! options
23195 wgLinkHolderBatchSize=0
23196 !! wikitext
23197 [[meatball:1]]
23198 [[meatball:2]]
23199 [[meatball:3]]
23200 !! html
23201 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
23202 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
23203 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
23204 </p>
23205 !! end
23206
23207 !! test
23208 Free external link invading image caption
23209 !! wikitext
23210 [[Image:Foobar.jpg|thumb|http://x|hello]]
23211 !! html
23212 <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>
23213
23214 !! end
23215
23216 !! test
23217 T17196: localised external link numbers
23218 !! options
23219 language=fa
23220 !! wikitext
23221 [http://en.wikipedia.org/]
23222 !! html/php
23223 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
23224 </p>
23225 !! html/parsoid
23226 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/"></a></p>
23227 !! end
23228
23229 !! test
23230 Multibyte character in padleft
23231 !! wikitext
23232 {{padleft:-Hello|7|Æ}}
23233 !! html
23234 <p>Æ-Hello
23235 </p>
23236 !! end
23237
23238 !! test
23239 Multibyte character in padright
23240 !! wikitext
23241 {{padright:Hello-|7|Æ}}
23242 !! html
23243 <p>Hello-Æ
23244 </p>
23245 !! end
23246
23247 !!test
23248 formatdate parser function
23249 !! wikitext
23250 {{#formatdate:2009-03-24}}
23251 !! html
23252 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
23253 </p>
23254 !! end
23255
23256 !!test
23257 formatdate parser function, with default format
23258 !! wikitext
23259 {{#formatdate:2009-03-24|mdy}}
23260 !! html
23261 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
23262 </p>
23263 !! end
23264
23265 !! test
23266 Spacing of numbers in formatted dates
23267 !! wikitext
23268 {{#formatdate:January 15}}
23269 !! html
23270 <p><span class="mw-formatted-date" title="01-15">January 15</span>
23271 </p>
23272 !! end
23273
23274 !! test
23275 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
23276 !! options
23277 language=nl title=[[MediaWiki:Common.css]]
23278 !! wikitext
23279 {{#formatdate:2009-03-24|dmy}}
23280 !! html
23281 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
23282 </p>
23283 !! end
23284
23285 #
23286 #
23287 #
23288
23289 #
23290 # Edit comments
23291 #
23292
23293 !! test
23294 Edit comment with link
23295 !! options
23296 comment
23297 !! wikitext
23298 I like the [[Main Page]] a lot
23299 !! html/php
23300 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
23301 !!end
23302
23303 !! test
23304 Edit comment with link and link text
23305 !! options
23306 comment
23307 !! wikitext
23308 I like the [[Main Page|best pages]] a lot
23309 !! html/php
23310 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
23311 !!end
23312
23313 !! test
23314 Edit comment with link and link text with suffix
23315 !! options
23316 comment
23317 !! wikitext
23318 I like the [[Main Page|best page]]s a lot
23319 !! html/php
23320 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
23321 !!end
23322
23323 !! test
23324 Edit comment with section link (non-local, eg in history list)
23325 !! options
23326 comment title=[[Main Page]]
23327 !! wikitext
23328 /* External links */ removed bogus entries
23329 !! html/php
23330 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
23331 !!end
23332
23333 !! test
23334 Edit comment with section link and text before it (non-local, eg in history list)
23335 !! options
23336 comment title=[[Main Page]]
23337 !! wikitext
23338 pre-comment text /* External links */ removed bogus entries
23339 !! html/php
23340 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>
23341 !!end
23342
23343 !! test
23344 Edit comment with section link (local, eg in diff view)
23345 !! options
23346 comment local title=[[Main Page]]
23347 !! wikitext
23348 /* External links */ removed bogus entries
23349 !! html/php
23350 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
23351 !!end
23352
23353 !! test
23354 Edit comment with subpage link (T16080)
23355 !! options
23356 comment
23357 subpage
23358 title=[[Subpage test]]
23359 !! wikitext
23360 Poked at a [[/subpage]] here...
23361 !! html/php
23362 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
23363 !!end
23364
23365 !! test
23366 Edit comment with subpage link and link text (T16080)
23367 !! options
23368 comment
23369 subpage
23370 title=[[Subpage test]]
23371 !! wikitext
23372 Poked at a [[/subpage|neat little page]] here...
23373 !! html/php
23374 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
23375 !!end
23376
23377 !! test
23378 Edit comment with bogus subpage link in non-subpage NS (T16080)
23379 !! options
23380 comment
23381 title=[[Subpage test]]
23382 !! wikitext
23383 Poked at a [[/subpage]] here...
23384 !! html/php
23385 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...
23386 !!end
23387
23388 !! test
23389 Edit comment with bare anchor link (local, as on diff)
23390 !! options
23391 comment
23392 local
23393 title=[[Main Page]]
23394 !! wikitext
23395 [[#section]]
23396 !! html/php
23397 <a href="#section">#section</a>
23398 !! end
23399
23400 !! test
23401 Edit comment with bare anchor link (non-local, as on history)
23402 !! options
23403 comment
23404 title=[[Main Page]]
23405 !! wikitext
23406 [[#section]]
23407 !! html/php
23408 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
23409 !! end
23410
23411 !! test
23412 Anchor starting with underscore
23413 !! options
23414 title=[[Foo]]
23415 !! wikitext
23416 [[#_ref|One]]
23417 !! html/php
23418 <p><a href="#_ref">One</a>
23419 </p>
23420 !! html/parsoid
23421 <p><a rel="mw:WikiLink" href="./Foo#_ref" data-parsoid='{"stx":"piped","a":{"href":"./Foo#_ref"},"sa":{"href":"#_ref"}}'>One</a></p>
23422 !! end
23423
23424 !! test
23425 Id starting with underscore
23426 !! wikitext
23427 <div id="_ref"></div>
23428 !! html/*
23429 <div id="_ref"></div>
23430
23431 !! end
23432
23433 !! test
23434 Edit comment with link with more than one pipe (T99346)
23435 !! options
23436 comment
23437 !! wikitext
23438 [[Main Page|Many|pipes]]
23439 !! html/php
23440 <a href="/wiki/Main_Page" title="Main Page">Many|pipes</a>
23441 !! end
23442
23443 !! test
23444 Complex edit comment with link with more than one pipe (T99346)
23445 !! options
23446 comment
23447 !! wikitext
23448 Created page with "<noinclude>[[Category:Requests for permissions/Bot|{{subst:#titleparts:{{subst:PAGENAME}}|1|3}}]]</noinclude> === [[User:MineoBot|]] 8=== {{Request for permissions/links|Mineo..."
23449 !! html/php
23450 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;
23451 !! end
23452
23453 !! test
23454 Space normalisation on autocomment (T24784)
23455 !! options
23456 comment
23457 title=[[Main Page]]
23458 !! wikitext
23459 /* __hello__world__ */
23460 !! html/php
23461 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
23462 !! end
23463
23464 !! test
23465 percent-encoding and + signs in comments (T28410)
23466 !! options
23467 comment
23468 !! wikitext
23469 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
23470 !! html/php
23471 <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>
23472 !! end
23473
23474 # Parsoid doesn't support this yet: see T75581
23475 # but it *should* omit the 'src' attribute if the image is bad.
23476 # PHP side of tests was disabled in
23477 # mediawiki/core:6bd31e7d95161a6e88fa86df60871051da997c3c
23478 # because of issues in the PHP parserTests infrastructure
23479 # (but the output below is indeed what the PHP side emits)
23480 !! test
23481 Bad images - basic functionality
23482 !! wikitext
23483 [[File:Bad.jpg]]
23484 !! DISABLED/html/php
23485 !! html/parsoid
23486 <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>
23487 !! end
23488
23489 !! test
23490 Bad images - T18039: text after bad image disappears
23491 !! wikitext
23492 Foo bar
23493 [[File:Bad.jpg]]
23494 Bar foo
23495 !! DISABLED/html/php
23496 <p>Foo bar
23497 </p><p>Bar foo
23498 </p>
23499 !! html/parsoid
23500 <p>Foo bar
23501 <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>
23502 Bar foo</p>
23503 !! end
23504
23505 !! test
23506 Verify that displaytitle works (T24501) no displaytitle
23507 !! options
23508 showtitle
23509 !! config
23510 wgAllowDisplayTitle=true
23511 wgRestrictDisplayTitle=false
23512 !! wikitext
23513 this is not the the title
23514 !! html/php
23515 Parser test
23516 <p>this is not the the title
23517 </p>
23518 !! end
23519
23520 !! test
23521 Verify that displaytitle works (T24501) RestrictDisplayTitle=false
23522 !! options
23523 showtitle
23524 title=[[Screen]]
23525 !! config
23526 wgAllowDisplayTitle=true
23527 wgRestrictDisplayTitle=false
23528 !! wikitext
23529 this is not the the title
23530 {{DISPLAYTITLE:whatever}}
23531 !! html/php
23532 whatever
23533 <p>this is not the the title
23534 </p>
23535 !! end
23536
23537 !! test
23538 Verify that displaytitle works (T24501) RestrictDisplayTitle=true mismatch
23539 !! options
23540 showtitle
23541 title=[[Screen]]
23542 !! config
23543 wgAllowDisplayTitle=true
23544 wgRestrictDisplayTitle=true
23545 !! wikitext
23546 this is not the the title
23547 {{DISPLAYTITLE:whatever}}
23548 !! html/php
23549 Screen
23550 <p>this is not the the title
23551 </p>
23552 !! end
23553
23554 !! test
23555 Verify that displaytitle works (T24501) RestrictDisplayTitle=true matching
23556 !! options
23557 showtitle
23558 title=[[Screen]]
23559 !! config
23560 wgAllowDisplayTitle=true
23561 wgRestrictDisplayTitle=true
23562 !! wikitext
23563 this is not the the title
23564 {{DISPLAYTITLE:screen}}
23565 !! html/php
23566 screen
23567 <p>this is not the the title
23568 </p>
23569 !! end
23570
23571 !! test
23572 Verify that displaytitle works (T24501) AllowDisplayTitle=false
23573 !! options
23574 showtitle
23575 title=[[Screen]]
23576 !! config
23577 wgAllowDisplayTitle=false
23578 !! wikitext
23579 this is not the the title
23580 {{DISPLAYTITLE:screen}}
23581 !! html/php
23582 Screen
23583 <p>this is not the the title
23584 <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>
23585 </p>
23586 !! end
23587
23588 !! test
23589 Verify that displaytitle works (T24501) AllowDisplayTitle=false no DISPLAYTITLE
23590 !! options
23591 showtitle
23592 title=[[Screen]]
23593 !! config
23594 wgAllowDisplayTitle=false
23595 !! wikitext
23596 this is not the the title
23597 !! html/php
23598 Screen
23599 <p>this is not the the title
23600 </p>
23601 !! end
23602
23603 !! test
23604 Verify that displaytitle handles inline CSS styles (T28547) - rejected value
23605 !! options
23606 showtitle
23607 title=[[Screen]]
23608 !! config
23609 wgAllowDisplayTitle=true
23610 wgRestrictDisplayTitle=true
23611 !! wikitext
23612 this is not the the title
23613 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
23614 !! html/php
23615 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
23616 <p>this is not the the title
23617 </p>
23618 !! end
23619
23620 !! test
23621 Verify that displaytitle handles inline CSS styles (T28547) - accepted value
23622 !! options
23623 showtitle
23624 title=[[Screen]]
23625 !! config
23626 wgAllowDisplayTitle=true
23627 wgRestrictDisplayTitle=true
23628 !! wikitext
23629 this is not the the title
23630 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
23631 !! html/php
23632 <span style="color: red;">s</span>creen
23633 <p>this is not the the title
23634 </p>
23635 !! end
23636
23637 !! test
23638 Page status indicators: Empty name is invalid
23639 !! options
23640 showindicators
23641 !! wikitext
23642 <indicator name=" "></indicator>
23643 <indicator></indicator>
23644 !! html/php
23645 <p><span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
23646 <span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
23647 </p>
23648 !! end
23649
23650 !! test
23651 Page status indicators: Weird syntaxes that are okay
23652 !! options
23653 showindicators
23654 !! wikitext
23655 <indicator name="empty" />
23656 <indicator name="name"></indicator>
23657 !! html/php
23658 empty=
23659 name=
23660 <p><br />
23661 </p>
23662 !! end
23663
23664 !! test
23665 Page status indicators: Torture test
23666 !! options
23667 showindicators
23668 !! wikitext
23669 <indicator name="01">hello world</indicator>
23670 <indicator name="02">[[Main Page]]</indicator>
23671 <indicator name="03">[[File:Foobar.jpg|25px|link=]]</indicator>
23672 <indicator name="04">[[File:Foobar.jpg|25px]]</indicator>
23673 <indicator name="05">* foo
23674 * bar</indicator>
23675 <indicator name="06"><nowiki>foo</nowiki></indicator>
23676 <indicator name="07"> Preformatted</indicator>
23677 <indicator name="08"><div>Broken tag</indicator>
23678 <indicator name="09">{| class=wikitable
23679 | cell
23680 |}</indicator>
23681 <indicator name="10">Two
23682
23683 paragraphs</indicator>
23684 !! html/php
23685 01=hello world
23686 02=<a href="/wiki/Main_Page" title="Main Page">Main Page</a>
23687 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" />
23688 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>
23689 05=<ul><li> foo</li>
23690 <li> bar</li></ul>
23691
23692 06=foo
23693 07=<pre>Preformatted
23694 </pre>
23695 08=<div>Broken tag</div>
23696
23697 09=<table class="wikitable">
23698 <tr>
23699 <td> cell
23700 </td></tr></table>
23701
23702 10=<p>Two
23703 </p><p>paragraphs
23704 </p>
23705 <p><br />
23706 </p><p><br />
23707 </p><p><br />
23708 </p><p><br />
23709 </p><p><br />
23710 </p>
23711 !! end
23712
23713 !! test
23714 preload: check <noinclude> and <includeonly>
23715 !! options
23716 preload
23717 !! wikitext
23718 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
23719 !! html/php
23720 Hello kind world.
23721 !! end
23722
23723 !! test
23724 preload: check <onlyinclude>
23725 !! options
23726 preload
23727 !! wikitext
23728 Goodbye <onlyinclude>Hello world</onlyinclude>
23729 !! html/php
23730 Hello world
23731 !! end
23732
23733 !! test
23734 preload: can pass tags through if we want to
23735 !! options
23736 preload
23737 !! wikitext
23738 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
23739 !! html/php
23740 <includeonly>Hello world</includeonly>
23741 !! end
23742
23743 !! test
23744 preload: check that it doesn't try to do tricks
23745 !! options
23746 preload
23747 !! wikitext
23748 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
23749 !! html/php
23750 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
23751 !! end
23752
23753 !! test
23754 Play a bit with r67090 and T5158
23755 !! wikitext
23756 <div style="width:50% !important">&nbsp;</div>
23757 <div style="width:50%&nbsp;!important">&nbsp;</div>
23758 <div style="width:50%&#160;!important">&nbsp;</div>
23759 <div style="border : solid;">&nbsp;</div>
23760 !! html/php
23761 <div style="width:50% !important">&#160;</div>
23762 <div style="width:50% !important">&#160;</div>
23763 <div style="width:50% !important">&#160;</div>
23764 <div style="border&#160;: solid;">&#160;</div>
23765
23766 !! html/parsoid
23767 <div style="width:50% !important" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
23768 <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>
23769 <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>
23770 <div style="border : solid;" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
23771
23772 !! end
23773
23774 !! test
23775 HTML5 data attributes
23776 !! wikitext
23777 <span data-foo="bar">Baz</span>
23778 <p data-abc-def_hij="">Quuz</p>
23779 !! html/php
23780 <p><span data-foo="bar">Baz</span>
23781 </p>
23782 <p data-abc-def_hij="">Quuz</p>
23783
23784 !! html/parsoid
23785 <p><span data-foo="bar" data-parsoid='{"stx":"html"}'>Baz</span></p>
23786 <p data-abc-def_hij="" data-parsoid='{"stx":"html"}'>Quuz</p>
23787 !! end
23788
23789 !! test
23790 Strip reserved data attributes
23791 !! wikitext
23792 <div data-mw="foo" data-parsoid="bar" data-mw-someext="baz" data-ok="fred" data-ooui="xyzzy" data-bad:ns="ns">d</div>
23793 !! html/php
23794 <div data-ok="fred">d</div>
23795
23796 !! html/parsoid
23797 <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>
23798 !! end
23799
23800 !! test
23801 percent-encoding and + signs in internal links (T28410)
23802 !! wikitext
23803 [[User:+%]] [[Page+title%]]
23804 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
23805 [[%]] [[+]] [[File:%+abc%39|foo|[[bar]]]]
23806 [[%33%45]] [[%33%45+]]
23807 !! html/php
23808 <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>
23809 <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>
23810 <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>
23811 <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>
23812 </p>
23813 !! html/parsoid
23814 <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>
23815 <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>
23816 <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>
23817 <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>
23818 !! end
23819
23820 !! test
23821 Special characters in embedded file links (T29679)
23822 !! wikitext
23823 [[File:Contains & ampersand.jpg]]
23824 [[File:Does not exist.jpg|Title with & ampersand]]
23825 !! html/php
23826 <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>
23827 <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>
23828 </p>
23829 !! html/parsoid
23830 <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>
23831 <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>
23832 !! end
23833
23834 !! test
23835 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
23836 !! wikitext
23837 Text&apos;s been normalized?
23838 !! html
23839 <p>Text&#39;s been normalized?
23840 </p>
23841 !! end
23842
23843 !! test
23844 T21052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
23845 !! wikitext
23846 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
23847 !! html
23848 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
23849 </p>
23850 !! end
23851
23852 !! test
23853 T21052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
23854 !! wikitext
23855 [http://www.example.org/ ideograms]
23856 !! html
23857 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
23858 </p>
23859 !! end
23860
23861 !! test
23862 T21052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
23863 !! wikitext
23864 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
23865 !! html
23866 <p><img src="http://www.example.org/pic.png" alt="pic.png"/> &lt;-- U+3000 (vim: ^Vu3000)
23867 </p>
23868 !! end
23869
23870 !! article
23871 Mediawiki:loop1
23872 !! text
23873 {{Identical|A}}
23874 !! endarticle
23875
23876 !! article
23877 Mediawiki:loop2
23878 !! text
23879 {{Identical|B}}
23880 !! endarticle
23881
23882 !! article
23883 Template:Identical
23884 !! text
23885 {{int:loop1}}
23886 {{int:loop2}}
23887 !! endarticle
23888
23889 !! test
23890 T33098 Template which includes system messages which includes the template
23891 !! wikitext
23892 {{Identical}}
23893 !! html
23894 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
23895 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
23896 </p>
23897 !! end
23898
23899 !! test
23900 T33490 Turkish: ucfirst 'blah'
23901 !! options
23902 language=tr
23903 !! wikitext
23904 {{ucfirst:blah}}
23905 !! html
23906 <p>Blah
23907 </p>
23908 !! end
23909
23910 !! test
23911 T33490 Turkish: ucfirst 'ix'
23912 !! options
23913 language=tr
23914 !! wikitext
23915 {{ucfirst:ix}}
23916 !! html
23917 <p>İx
23918 </p>
23919 !! end
23920
23921 !! test
23922 T33490 Turkish: lcfirst 'BLAH'
23923 !! options
23924 language=tr
23925 !! wikitext
23926 {{lcfirst:BLAH}}
23927 !! html
23928 <p>bLAH
23929 </p>
23930 !! end
23931
23932 !! test
23933 T33490 Turkish: ucfırst (with a dotless i)
23934 !! options
23935 language=tr
23936 !! wikitext
23937 {{ucfırst:blah}}
23938 !! html
23939 <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>
23940 </p>
23941 !! end
23942
23943 !! test
23944 T33490 ucfırst (with a dotless i) with English language
23945 !! options
23946 language=en
23947 !! wikitext
23948 {{ucfırst:blah}}
23949 !! html
23950 <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>
23951 </p>
23952 !! end
23953
23954 # Note that Parsoid doesn't emit an explicit TOC.
23955 # Note also that the html2wt direction tends to emit an extra newline
23956 # between the __TOC__ magicword and the first heading unless *both*
23957 # the <meta> and the <h2> have a data-parsoid attribute set (even if
23958 # it's "{}").
23959
23960 !! test
23961 T28375: TOC with italics
23962 !! options
23963 title=[[Main Page]]
23964 !! wikitext
23965 __TOC__
23966 == ''Lost'' episodes ==
23967 !! html/php
23968 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
23969 <ul>
23970 <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>
23971 </ul>
23972 </div>
23973
23974 <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>
23975
23976 !! html/parsoid
23977 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
23978 <h2 data-parsoid='{}'> <i>Lost</i> episodes </h2>
23979 !! end
23980
23981 !! test
23982 T28375: TOC with bold
23983 !! options
23984 title=[[Main Page]]
23985 !! wikitext
23986 __TOC__
23987 == '''should be bold''' then normal text ==
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="#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>
23992 </ul>
23993 </div>
23994
23995 <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>
23996
23997 !! html/parsoid
23998 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
23999 <h2 data-parsoid='{}'> <b>should be bold</b> then normal text </h2>
24000 !! end
24001
24002 !! test
24003 T35845: Headings become cursive in TOC when they contain an image
24004 !! options
24005 title=[[Main Page]]
24006 !! wikitext
24007 __TOC__
24008 == Image [[Image:foobar.jpg]] ==
24009 !! html/php
24010 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
24011 <ul>
24012 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
24013 </ul>
24014 </div>
24015
24016 <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>
24017
24018 !! html/parsoid
24019 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24020 <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>
24021 !! end
24022
24023 !! test
24024 T35845 (2): Headings become bold in TOC when they contain a blockquote
24025 !! options
24026 title=[[Main Page]]
24027 !! wikitext
24028 __TOC__
24029 == <blockquote>Quote</blockquote> ==
24030 !! html/php
24031 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
24032 <ul>
24033 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
24034 </ul>
24035 </div>
24036
24037 <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>
24038
24039 !! html/php+tidy
24040 <p></p>
24041 <div id="toc" class="toc">
24042 <div class="toctitle">
24043 <h2>Contents</h2>
24044 </div>
24045 <ul>
24046 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
24047 </ul>
24048 </div>
24049 <p></p>
24050 <h2><span class="mw-headline" id="Quote"></span></h2>
24051 <blockquote>
24052 <p><span class="mw-headline" id="Quote">Quote</span></p>
24053 </blockquote>
24054 <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>
24055 !! html/parsoid
24056 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24057 <h2 data-parsoid='{}'> <blockquote>Quote</blockquote> </h2>
24058 !! end
24059
24060 !! test
24061 Unclosed tags in TOC
24062 !! options
24063 title=[[Main Page]]
24064 !! wikitext
24065 __TOC__
24066 == Proof: 2 < 3 ==
24067 <small>Hanc marginis exiguitas non caperet.</small>
24068 QED
24069 !! html/php
24070 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
24071 <ul>
24072 <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>
24073 </ul>
24074 </div>
24075
24076 <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>
24077 <p><small>Hanc marginis exiguitas non caperet.</small>
24078 QED
24079 </p>
24080 !! html/parsoid
24081 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24082 <h2 data-parsoid='{}'> Proof: 2 &lt; 3 </h2>
24083 <p><small>Hanc marginis exiguitas non caperet.</small>
24084 QED</p>
24085 !! end
24086
24087 !! test
24088 Multiple tags in TOC
24089 !! wikitext
24090 __TOC__
24091 == <i>Foo</i> <b>Bar</b> ==
24092
24093 == <i>Foo</i> <blockquote>Bar</blockquote> ==
24094 !! html/php
24095 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
24096 <ul>
24097 <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>
24098 <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>
24099 </ul>
24100 </div>
24101
24102 <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>
24103 <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>
24104
24105 !! html/php+tidy
24106 <p></p>
24107 <div id="toc" class="toc">
24108 <div class="toctitle">
24109 <h2>Contents</h2>
24110 </div>
24111 <ul>
24112 <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>
24113 <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>
24114 </ul>
24115 </div>
24116 <p></p>
24117 <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>
24118 <h2><span class="mw-headline" id="Foo_Bar_2"><i>Foo</i></span></h2>
24119 <blockquote>
24120 <p><span class="mw-headline" id="Foo_Bar_2">Bar</span></p>
24121 </blockquote>
24122 <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>
24123 !! html/parsoid
24124 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24125 <h2 data-parsoid='{}'> <i data-parsoid='{"stx":"html"}'>Foo</i> <b data-parsoid='{"stx":"html"}'>Bar</b> </h2>
24126 <h2> <i data-parsoid='{"stx":"html"}'>Foo</i> <blockquote>Bar</blockquote> </h2>
24127 !! end
24128
24129 # Don't expect Parsoid to roundtrip this until the php parser comes closer to
24130 # html5 tag parsing.
24131 !! test
24132 Tags with parameters in TOC
24133 !! options
24134 parsoid=wt2html
24135 !! wikitext
24136 __TOC__
24137 == <sup class="in-h2">Hello</sup> ==
24138
24139 == <sup class="a > b">Evilbye</sup> ==
24140 !! html/php
24141 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
24142 <ul>
24143 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
24144 <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>
24145 </ul>
24146 </div>
24147
24148 <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>
24149 <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>
24150
24151 !! html/parsoid
24152 <meta property="mw:PageProp/toc" />
24153 <h2> <sup class="in-h2" data-parsoid='{"stx":"html"}'>Hello</sup> </h2>
24154
24155 <h2> <sup class="a " data-parsoid='{"stx":"html"}'> b">Evilbye</sup> </h2>
24156 !! end
24157
24158 !! test
24159 span tags with directionality in TOC
24160 !! wikitext
24161 __TOC__
24162 == <span dir="ltr">C++</span> ==
24163
24164 == <span dir="rtl">זבנג!</span> ==
24165
24166 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
24167
24168 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
24169
24170 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
24171 !! html/php
24172 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
24173 <ul>
24174 <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>
24175 <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>
24176 <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>
24177 <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>
24178 <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>
24179 </ul>
24180 </div>
24181
24182 <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>
24183 <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>
24184 <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>
24185 <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>
24186 <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>
24187
24188 !! html/parsoid
24189 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24190 <h2 data-parsoid='{}'> <span dir="ltr">C++</span> </h2>
24191 <h2> <span dir="rtl">זבנג!</span> </h2>
24192 <h2> <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> </h2>
24193 <h2> <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> </h2>
24194 <h2> <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> </h2>
24195 !! end
24196
24197 !! test
24198 T74884: bdi element in ToC
24199 !! wikitext
24200 __TOC__
24201 == <bdi>test</bdi> ==
24202 !! html/php
24203 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
24204 <ul>
24205 <li class="toclevel-1 tocsection-1"><a href="#test"><span class="tocnumber">1</span> <span class="toctext"><bdi>test</bdi></span></a></li>
24206 </ul>
24207 </div>
24208
24209 <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>
24210
24211 !! html/parsoid
24212 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24213 <h2 data-parsoid='{}'> <bdi>test</bdi> </h2>
24214 !! end
24215
24216 !! test
24217 T35715: s/strike element in ToC
24218 !! wikitext
24219 __TOC__
24220 == <s>test</s> test <strike>test</strike> ==
24221 !! html/php
24222 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
24223 <ul>
24224 <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>
24225 </ul>
24226 </div>
24227
24228 <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>
24229
24230 !! html/parsoid
24231 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24232 <h2 data-parsoid='{}'> <s>test</s> test <strike>test</strike> </h2>
24233 !! end
24234
24235 # Note that the html output does not have the <p></p>, but the
24236 # html+tidy output *does*. This is because the empty <p></p> is
24237 # removed by the sanitizer, but only when tidy is *not* enabled (!).
24238 !! test
24239 Empty <p> tag in TOC, removed by Sanitizer (T92892)
24240 !! wikitext
24241 __TOC__
24242 == x ==
24243 !! html/php
24244 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
24245 <ul>
24246 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
24247 </ul>
24248 </div>
24249
24250 <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>
24251
24252 !! html/php+tidy
24253 <p></p>
24254 <div id="toc" class="toc">
24255 <div class="toctitle">
24256 <h2>Contents</h2>
24257 </div>
24258 <ul>
24259 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
24260 </ul>
24261 </div>
24262 <p></p>
24263 <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>
24264 !! html/parsoid
24265 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24266 <h2 data-parsoid='{}'> x </h2>
24267 !! end
24268
24269 !! article
24270 MediaWiki:T34057
24271 !! text
24272 == {{int:headline_sample}} ==
24273 !! endarticle
24274
24275 !! test
24276 T34057: Title needed when expanding <h> nodes.
24277 !! options
24278 title=[[Main Page]]
24279 !! wikitext
24280 {{int:T34057}}
24281 !! html
24282 <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>
24283
24284 !! end
24285
24286 !! test
24287 Strip marker in urlencode
24288 !! wikitext
24289 {{urlencode:x<nowiki/>y}}
24290 {{urlencode:x<nowiki/>y|wiki}}
24291 {{urlencode:x<nowiki/>y|path}}
24292 {{urlencode:x<pre id="one">two</pre>y}}
24293 !! html/php
24294 <p>xy
24295 xy
24296 xy
24297 xy
24298 </p>
24299 !! end
24300
24301 !! test
24302 Strip marker in lc
24303 !! wikitext
24304 {{lc:x<nowiki/>y}}
24305 !! html
24306 <p>xy
24307 </p>
24308 !! end
24309
24310 !! test
24311 Strip marker in uc
24312 !! wikitext
24313 {{uc:x<nowiki/>y}}
24314 !! html
24315 <p>XY
24316 </p>
24317 !! end
24318
24319 !! test
24320 Strip marker in formatNum
24321 !! wikitext
24322 {{formatnum:1<nowiki/>2}}
24323 {{formatnum:1<nowiki/>2|R}}
24324 !! html
24325 <p>12
24326 12
24327 </p>
24328 !! end
24329
24330 !! test
24331 Check noCommafy in formatNum
24332 !! options
24333 language=be-tarask
24334 !! wikitext
24335 {{formatnum:123456.78}}
24336 {{formatnum:123456.78|NOSEP}}
24337 !! html
24338 <p>123 456,78
24339 123456.78
24340 </p>
24341 !! end
24342
24343 !! test
24344 Wrong option for formatNum (T58199)
24345 !! wikitext
24346 {{formatnum:1,234.56|Random}}
24347 {{formatnum:1,234.56|EVERYTHING}}
24348 {{formatnum:1234.56|any argument that has the string 'NOSEP'}}
24349 !! html
24350 <p>1,234.56
24351 1,234.56
24352 1,234.56
24353 </p>
24354 !! end
24355
24356 !! test
24357 Strip marker in grammar
24358 !! options
24359 language=fi
24360 !! wikitext
24361 {{grammar:elative|foo<nowiki/>bar}}
24362 !! html
24363 <p>foobarista
24364 </p>
24365 !! end
24366
24367 !! test
24368 Strip marker in padleft
24369 !! wikitext
24370 {{padleft:|2|x<nowiki/>y}}
24371 !! html
24372 <p>xy
24373 </p>
24374 !! end
24375
24376 !! test
24377 Strip marker in padright
24378 !! wikitext
24379 {{padright:|2|x<nowiki/>y}}
24380 !! html
24381 <p>xy
24382 </p>
24383 !! end
24384
24385 !! test
24386 Strip marker in anchorencode
24387 !! wikitext
24388 {{anchorencode:x<nowiki/>y}}
24389 !! html
24390 <p>xy
24391 </p>
24392 !! end
24393
24394 !! test
24395 nowiki inside link inside heading (T20295)
24396 !! wikitext
24397 ==[[foo|x<nowiki>y</nowiki>z]]==
24398 !! html
24399 <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>
24400
24401 !! end
24402
24403 !! test
24404 new support for bdi element (T33817)
24405 !! wikitext
24406 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
24407 !! html
24408 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
24409
24410 !!end
24411
24412 !! test
24413 Ignore pipe between table row attributes
24414 !! wikitext
24415 {|
24416 | quux
24417 |- id=foo | style='color: red'
24418 | bar
24419 |}
24420 !! html
24421 <table>
24422 <tr>
24423 <td> quux
24424 </td></tr>
24425 <tr id="foo" style="color: red">
24426 <td> bar
24427 </td></tr></table>
24428
24429 !! end
24430
24431 !!test
24432 Language parser function
24433 !! wikitext
24434 {{#language:ar}}
24435 !! html
24436 <p>العربية
24437 </p>
24438 !! end
24439
24440 !!test
24441 Padleft and padright as substr
24442 !! wikitext
24443 {{padleft:|3|abcde}}
24444 {{padright:|3|abcde}}
24445 !! html
24446 <p>abc
24447 abc
24448 </p>
24449 !! end
24450
24451 !!test
24452 Special parser function
24453 !! wikitext
24454 {{#special:RandomPage}}
24455 {{#special:BaDtItLe}}
24456 {{#special:Foobar}}
24457 !! html
24458 <p>Special:Random
24459 Special:Badtitle
24460 Special:Foobar
24461 </p>
24462 !! end
24463
24464 !!test
24465 T36939 - Case insensitive link parsing ([HttP://])
24466 !! wikitext
24467 [HttP://MediaWiki.Org/]
24468 !! html/php
24469 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
24470 </p>
24471 !! html/parsoid
24472 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/"></a></p>
24473 !! end
24474
24475 !!test
24476 T36939 - Case insensitive link parsing ([HttP:// title])
24477 !! wikitext
24478 [HttP://MediaWiki.Org/ MediaWiki]
24479 !! html
24480 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
24481 </p>
24482 !! end
24483
24484 !!test
24485 T36939 - Case insensitive link parsing (HttP://)
24486 !! wikitext
24487 HttP://MediaWiki.Org/
24488 !! html/php
24489 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
24490 </p>
24491 !! html/parsoid
24492 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a></p>
24493 !! end
24494
24495 !!test
24496 Disable TOC
24497 !! options
24498 notoc
24499 !! wikitext
24500 Lead
24501 == Section 1 ==
24502 == Section 2 ==
24503 == Section 3 ==
24504 == Section 4 ==
24505 == Section 5 ==
24506 !! html
24507 <p>Lead
24508 </p>
24509
24510 <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>
24511 <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>
24512 <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>
24513 <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>
24514 <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>
24515
24516 !! end
24517
24518
24519 ###
24520 ### Parsoid-specific tests
24521 ### Parsoid-PHP parser incompatibilities
24522 ###
24523 !!test
24524 1. SOL-sensitive wikitext tokens as template-args
24525 !!options
24526 parsoid=wt2html,wt2wt
24527 !! wikitext
24528 {{echo|*a}}
24529 {{echo|#a}}
24530 {{echo|:a}}
24531 !! html
24532 <span about="#mwt1" typeof="mw:Transclusion">
24533 </span><ul about="#mwt1"><li>a</li>
24534 </ul>
24535 <span about="#mwt2" typeof="mw:Transclusion">
24536 </span><ol about="#mwt2"><li>a</li>
24537 </ol>
24538 <span about="#mwt3" typeof="mw:Transclusion">
24539 </span><dl about="#mwt3"><dd>a</dd>
24540 </dl>
24541 !!end
24542
24543 #### -----------------------------------------------------------------
24544 #### Parsoid-specific functionality tests
24545 #### -----------------------------------------------------------------
24546
24547 # T65642/T68749: Formatting elt fixup around images is cleaned up.
24548 # We know wt2wt will fail, but we expect selser to pass.
24549 # Due to the nature of our testing, wt2wt and selser tests will enter the
24550 # blacklist and we'll catch selser regressions based on changes to the
24551 # blacklist entries for selser tests.
24552 !! test
24553 1. Bad treebuilder fixup of formatting elt is cleaned up
24554 !! options
24555 parsoid=wt2html,wt2wt
24556 !! wikitext
24557 {|
24558 |
24559 <small>
24560 [[Image:Foobar.jpg|right|Test]]
24561 </small>
24562 |}
24563 !! html/parsoid
24564 <table>
24565 <tbody><tr><td>
24566 <small>
24567 <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>
24568 </small>
24569 </td></tr>
24570 </tbody></table>
24571 !! end
24572
24573 !! test
24574 2. Bad treebuilder fixup of formatting elt is cleaned up
24575 !! options
24576 parsoid=wt2html,wt2wt
24577 !! wikitext
24578 '''foo[[File:Foobar.jpg|thumb|caption]]bar'''
24579
24580 <small>[[Image:Foobar.jpg|right|300px]]</small>
24581 !! html/parsoid
24582
24583 <p><b>foo</b></p>
24584 <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>
24585 <p><b>bar</b></p>
24586 <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>
24587 !! end
24588
24589 !! test
24590 3. Bad treebuilder fixup of formatting elt is cleaned up
24591 !! options
24592 parsoid=wt2html,wt2wt
24593 !! wikitext
24594 <small>'''foo[[File:Foobar.jpg|thumb|caption]]bar'''</small>
24595 !! html/parsoid
24596 <p><small><b>foo</b></small></p>
24597 <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>
24598 <p><small><b>bar</b></small></p>
24599 !! end
24600
24601 !! test
24602 4. Bad treebuilder fixup of formatting elt is cleaned up: formatting tags around captionless images are ignored
24603 !! options
24604 parsoid=wt2html,wt2wt
24605 !! wikitext
24606 '''<small>[[Image:Foobar.jpg|right|300px]]</small>'''
24607 !! html/parsoid
24608 <b><small><figure class="mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="34" width="300"/></a></figure></small></b>
24609 !! end
24610
24611 #### ----------------------------------------------------------------
24612 #### Parsoid-only testing of Parsoid's impl of LST
24613 #### Not implemented yet, see
24614 #### https://www.mediawiki.org/wiki/Parsoid/HTML_based_LST
24615 #### ----------------------------------------------------------------
24616
24617 ## We still need to support serializing the older format while content is stored.
24618 !! test
24619 LST Sections: Backwards compatibility
24620 !! options
24621 parsoid={
24622 "suppressErrors": true,
24623 "modes": ["html2wt"]
24624 }
24625 !! wikitext
24626 <section begin="2011-05-16" />
24627 <section end="2014-04-10 (MW 1.23wmf22)" />
24628 !! html/parsoid
24629 <p><meta typeof="mw:Extension/LabeledSectionTransclusion/begin" content="2011-05-16"/>
24630 <meta typeof="mw:Extension/LabeledSectionTransclusion/end" content="2014-04-10 (MW 1.23wmf22)"/></p>
24631 !! end
24632
24633 !! test
24634 LST Sections: Newfangled approach
24635 !! wikitext
24636 <section begin="2011-05-16" />
24637 <section end="2014-04-10 (MW 1.23wmf22)" />
24638 !! html/parsoid
24639 <p><span typeof="mw:Extension/section" about="#mwt4" data-mw='{"name":"section","attrs":{"begin":"2011-05-16"},"body":null}'>
24640 </span>
24641 <span typeof="mw:Extension/section" about="#mwt6" data-mw='{"name":"section","attrs":{"end":"2014-04-10 (MW 1.23wmf22)"},"body":null}'>
24642 </span></p>
24643 !! end
24644
24645 #--------- Test stripping of empty nodes in template content ----------
24646
24647 !! test
24648 Empty LI and TR nodes should be stripped from template content
24649 !! wikitext
24650 {{EmptyLITest}}
24651 {{EmptyTRTest}}
24652 !! html/parsoid
24653 <ul about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyLITest","href":"./Template:EmptyLITest"},"params":{},"i":0}}]}'>
24654 <li>a</li>
24655 <li>b</li>
24656 </ul>
24657 <table about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRTest","href":"./Template:EmptyTRTest"},"params":{},"i":0}}]}'>
24658 <tbody>
24659 <tr>
24660 <td>foo</td>
24661 </tr>
24662 <tr>
24663 <td>bar</td>
24664 </tr>
24665 </tbody>
24666 </table>
24667 !! end
24668
24669 !! test
24670 Empty LI and TR nodes should not be stripped from top-level content
24671 !! wikitext
24672 * a
24673 *
24674 * b
24675 {|
24676 |-
24677 |-
24678 |foo
24679 |}
24680 !! html/parsoid
24681 <ul>
24682 <li> a</li>
24683 <li class='mw-empty-elt'></li>
24684 <li> b</li>
24685 </ul>
24686 <table>
24687 <tbody>
24688 <tr class='mw-empty-elt'></tr>
24689 <tr>
24690 <td>foo</td>
24691 </tr>
24692 </tbody>
24693 </table>
24694 !! end
24695
24696 !! test
24697 Empty TR nodes should not be stripped if they have any attributes set
24698 !! wikitext
24699 {{EmptyTRWithHTMLAttrTest}}
24700 !! html/parsoid
24701 <table about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRWithHTMLAttrTest","href":"./Template:EmptyTRWithHTMLAttrTest"},"params":{},"i":0}}]}'>
24702 <tr align='center'></tr>
24703 <tr><td>foo</td></tr>
24704 <tr align='center'></tr>
24705 <tr><td>bar</td></tr>
24706 </table>
24707 !! end
24708
24709 #### ----------------------------------------------------------------
24710 #### The following section of tests are primarily to test
24711 #### wikitext escaping capabilities of Parsoid. Given that
24712 #### escaping can be done any number of ways, the wikitext (input)
24713 #### is always adjusted to reflect how Parsoid adds nowiki
24714 #### escape tags.
24715 ####
24716 #### We are marking several tests as parsoid-only since the
24717 #### HTML in the result section is different from what the
24718 #### PHP parser generates for it.
24719 #### ----------------------------------------------------------------
24720
24721
24722 #### --------------- Headings ---------------
24723 #### 0. Unnested
24724 #### 1. Nested inside html <h1>=foo=</h1>
24725 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
24726 #### 3. Nested inside html with wikitext split by html tags
24727 #### 4. No escape needed
24728 #### 5. Empty headings <h1></h1>
24729 #### 6. Heading chars in SOL context
24730 #### ----------------------------------------
24731 !! test
24732 Headings: 0. Unnested
24733 !! options
24734 parsoid=html2wt
24735 !! html/parsoid
24736 <p>=foo=</p>
24737
24738 <p> =foo=
24739 <!--cmt-->
24740 =foo=</p>
24741
24742 <p>=foo<i>a</i>=</p>
24743 !! wikitext
24744 <nowiki>=foo=</nowiki>
24745
24746 <nowiki> </nowiki>=foo=
24747 <!--cmt-->
24748 <nowiki>=foo=</nowiki>
24749
24750 =foo''a''<nowiki>=</nowiki>
24751 !!end
24752
24753 # New headings and existing headings are handled differently
24754 !! test
24755 Headings: 1. Nested inside html
24756 !! options
24757 parsoid=html2wt
24758 !! html/parsoid
24759 <h1>=foo=</h1>
24760 <h2>=foo=</h2>
24761 <h3>=foo=</h3>
24762
24763 <h1 data-parsoid=''>=foo=</h1>
24764 <h2 data-parsoid=''>=foo=</h2>
24765 <h3 data-parsoid=''>=foo=</h3>
24766 <h4 data-parsoid=''>=foo=</h4>
24767 <h5 data-parsoid=''>=foo=</h5>
24768 <h6 data-parsoid=''>=foo=</h6>
24769 !! wikitext
24770 = =foo= =
24771
24772 == =foo= ==
24773
24774 === =foo= ===
24775
24776 =<nowiki>=foo=</nowiki>=
24777 ==<nowiki>=foo=</nowiki>==
24778 ===<nowiki>=foo=</nowiki>===
24779 ====<nowiki>=foo=</nowiki>====
24780 =====<nowiki>=foo=</nowiki>=====
24781 ======<nowiki>=foo=</nowiki>======
24782
24783 !!end
24784
24785 !! test
24786 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
24787 !! options
24788 parsoid=html2wt
24789 !! html/parsoid
24790 <h1>foo</h1>*bar
24791 <h1>foo</h1>=bar
24792 <h1>foo</h1>=bar=
24793 !! wikitext
24794 = foo =
24795 <nowiki>*</nowiki>bar
24796
24797 = foo =
24798 =bar
24799
24800 = foo =
24801 <nowiki>=bar=</nowiki>
24802 !!end
24803
24804 !! test
24805 Headings: 3. Nested inside html with wikitext split by html tags
24806 !! options
24807 parsoid=html2wt
24808 !! html/parsoid
24809 <h1>=<b>bold</b>foo=</h1>
24810 !! wikitext
24811 = ='''bold'''foo= =
24812 !!end
24813
24814 !! test
24815 Headings: 4a. No escaping needed (testing just h1 and h2)
24816 !! options
24817 parsoid=html2wt
24818 !! html/parsoid
24819 <h1>=foo</h1>
24820 <h1>foo=</h1>
24821 <h1> =foo= </h1>
24822 <h1>=foo= bar</h1>
24823 <h2>=foo</h2>
24824 <h2>foo=</h2>
24825 <h1>=</h1>
24826 <h1><i>=</i>foo=</h1>
24827 !! wikitext
24828 = =foo =
24829
24830 = foo= =
24831
24832 = =foo= =
24833
24834 = =foo= bar =
24835
24836 == =foo ==
24837
24838 == foo= ==
24839
24840 = = =
24841
24842 = ''=''foo= =
24843 !!end
24844
24845 !! test
24846 Headings: 4b. No escaping needed (inside p-tags)
24847 !! options
24848 parsoid=html2wt
24849 !! html/parsoid
24850 <p>===
24851 =foo= x
24852 =foo= <s></s>
24853 </p>
24854 !! wikitext
24855 ===
24856 =foo= x
24857 =foo= <s></s>
24858 !!end
24859
24860 !! test
24861 Headings: 5. Empty headings
24862 !! options
24863 parsoid=html2wt
24864 !! html/parsoid
24865 <h1 data-parsoid='{}'></h1>
24866
24867 <h2 data-parsoid='{}'></h2>
24868
24869 <h3 data-parsoid='{}'></h3>
24870
24871 <h4 data-parsoid='{}'></h4>
24872
24873 <h5 data-parsoid='{}'></h5>
24874
24875 <h6 data-parsoid='{}'></h6>
24876 !! wikitext
24877 =<nowiki/>=
24878
24879 ==<nowiki/>==
24880
24881 ===<nowiki/>===
24882
24883 ====<nowiki/>====
24884
24885 =====<nowiki/>=====
24886
24887 ======<nowiki/>======
24888 !!end
24889
24890 !! test
24891 Headings: 6a. Heading chars in SOL context (with trailing spaces)
24892 !! options
24893 parsoid=html2wt
24894 !! html/parsoid
24895 <p>=a=</p>
24896
24897 <p>=a=</p>
24898
24899 <p>=a=</p>
24900 !! wikitext
24901 <nowiki>=a=</nowiki>
24902
24903 <nowiki>=a=</nowiki>
24904
24905 <nowiki>=a=</nowiki>
24906 !!end
24907
24908 !! test
24909 Headings: 6b. Heading chars in SOL context (with trailing newlines)
24910 !! options
24911 parsoid=html2wt
24912 !! html/parsoid
24913 <p>=a=
24914 b</p>
24915
24916 <p>=a=
24917 b</p>
24918
24919 <p>=a=
24920 b</p>
24921 !! wikitext
24922 <nowiki>=a=</nowiki>
24923 b
24924
24925 <nowiki>=a=</nowiki>
24926 b
24927
24928 <nowiki>=a=</nowiki>
24929 b
24930 !!end
24931
24932 !! test
24933 Headings: 6c. Heading chars in SOL context (leading newline break)
24934 !! options
24935 parsoid=html2wt
24936 !! html/parsoid
24937 <p>a
24938 =b=</p>
24939 !! wikitext
24940 a
24941 <nowiki>=b=</nowiki>
24942 !!end
24943
24944 !! test
24945 Headings: 6d. Heading chars in SOL context (with interspersed comments)
24946 !! options
24947 parsoid=html2wt
24948 !! html/parsoid
24949 <!--c0--><p>=a=</p>
24950
24951 <!--c1--><p>=a=</p> <!--c2--> <!--c3-->
24952 !! wikitext
24953 <!--c0--><nowiki>=a=</nowiki>
24954
24955 <!--c1--><nowiki>=a=</nowiki> <!--c2--> <!--c3-->
24956 !!end
24957
24958 !! test
24959 Headings: 6d. Heading chars in SOL context (No escaping needed)
24960 !! options
24961 parsoid=html2wt
24962 !! html/parsoid
24963 =a=<div>b</div>
24964 !! wikitext
24965 =a=<div>b</div>
24966 !!end
24967
24968 !! test
24969 Headings: 7. Insert a newline between new content and headings
24970 !! options
24971 parsoid=html2wt
24972 !! html/parsoid
24973 <h2>NEW</h2>
24974 <p>new</p>
24975 <h2 data-parsoid='{}'>A</h2>
24976 <p data-parsoid='{}'>a</p>
24977 !! wikitext
24978 == NEW ==
24979 new
24980
24981 ==A==
24982 a
24983
24984 !! end
24985
24986 #### --------------- Lists ---------------
24987 #### 0. Outside nests (*foo, etc.)
24988 #### 1. Nested inside html <ul><li>*foo</li></ul>
24989 #### 2. Inside definition lists
24990 #### 3. Only bullets at start should be escaped
24991 #### 4. No escapes needed
24992 #### 5. No unnecessary escapes
24993 #### 6. Escape bullets in SOL position
24994 #### 7. Escape bullets in a multi-line context
24995 #### ----------------------------------------
24996
24997 !! test
24998 Lists: 0. Outside nests
24999 !! options
25000 parsoid=html2wt
25001 !! html/parsoid
25002 <p>*foo</p>
25003
25004 <p>#foo</p>
25005
25006 <p>;Foo:bar</p>
25007 !! wikitext
25008 <nowiki>*</nowiki>foo
25009
25010 <nowiki>#</nowiki>foo
25011
25012 <nowiki>;</nowiki>Foo<nowiki>:</nowiki>bar
25013 !!end
25014
25015 ## Making these next 3 tests Parsoid-only since they are html2wt tests
25016 ## to test wikitext escaping, and insignificant whitespace diffs
25017 ## cause PHP parser tests to barf
25018 !! test
25019 Lists: 1. Nested inside html (No unnecessary escapes)
25020 !! options
25021 parsoid=html2wt
25022 !! html/parsoid
25023 <ul>
25024 <li>*foo</li>
25025 <li>#foo</li>
25026 <li>:foo</li>
25027 <li>;foo</li>
25028 <li data-parsoid='{}'>*foo</li>
25029 <li data-parsoid='{}'>#foo</li>
25030 <li data-parsoid='{}'>:foo</li>
25031 <li data-parsoid='{}'>;foo</li>
25032 </ul>
25033
25034 <ol>
25035 <li>*foo</li>
25036 <li>#foo</li>
25037 <li>:foo</li>
25038 <li>;foo</li>
25039 <li data-parsoid='{}'>*foo</li>
25040 <li data-parsoid='{}'>#foo</li>
25041 <li data-parsoid='{}'>:foo</li>
25042 <li data-parsoid='{}'>;foo</li>
25043 </ol>
25044 !! wikitext
25045 * *foo
25046 * #foo
25047 * :foo
25048 * ;foo
25049 *<nowiki>*foo</nowiki>
25050 *<nowiki>#foo</nowiki>
25051 *<nowiki>:foo</nowiki>
25052 *<nowiki>;foo</nowiki>
25053
25054 # *foo
25055 # #foo
25056 # :foo
25057 # ;foo
25058 #<nowiki>*foo</nowiki>
25059 #<nowiki>#foo</nowiki>
25060 #<nowiki>:foo</nowiki>
25061 #<nowiki>;foo</nowiki>
25062 !!end
25063
25064 !! test
25065 Lists: 2. Inside definition lists
25066 !! options
25067 parsoid=html2wt
25068 !! html/parsoid
25069 <dl><dt>;foo</dt></dl>
25070 <dl><dt>:foo</dt></dl>
25071 <dl><dt>:foo</dt>
25072 <dd>bar</dd></dl>
25073 <dl><dd>:foo</dd></dl>
25074 !! wikitext
25075 ; ;foo
25076
25077 ; <nowiki>:foo</nowiki>
25078
25079 ; <nowiki>:foo</nowiki>
25080 : bar
25081
25082 : :foo
25083 !!end
25084
25085 !! test
25086 Lists: 3. Only bullets at start of text in wikitext-generated HTML should be escaped
25087 !! options
25088 parsoid=html2wt
25089 !! html/parsoid
25090 <ul>
25091 <li>*foo*bar</li>
25092 <li data-parsoid='{}'>*foo<i>it</i>*bar</li>
25093 </ul>
25094 !! wikitext
25095 * *foo*bar
25096 *<nowiki>*foo</nowiki>''it''*bar
25097 !!end
25098
25099 !! test
25100 Lists: 4. No escapes needed
25101 !! options
25102 parsoid=html2wt
25103 !! html/parsoid
25104 <ul>
25105 <li>foo*bar
25106 </li>
25107 </ul>
25108 <ul>
25109 <li><i>foo</i>*bar
25110 </li>
25111 </ul>
25112 <ul>
25113 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>: bar
25114 </li>
25115 </ul>
25116 <ul>
25117 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>*bar
25118 </li>
25119 </ul>
25120 !! wikitext
25121 *foo*bar
25122
25123 *''foo''*bar
25124
25125 *[[Foo]]: bar
25126
25127 *[[Foo]]*bar
25128 !!end
25129
25130 !! test
25131 Lists: 5. No unnecessary escapes
25132 !! options
25133 parsoid=html2wt
25134 !! html/parsoid
25135 <ul><li> bar <span>[[foo]]</span></li></ul>
25136 <ul><li> =bar <span>[[foo]]</span></li></ul>
25137 <ul><li> [[bar <span>[[foo]]</span></li></ul>
25138 <ul><li> ]]bar <span>[[foo]]</span></li></ul>
25139 <ul><li> =bar <span>foo]]</span>=</li></ul>
25140 <ul><li> <s></s>: a</li></ul>
25141 <ul><li> <i>* foo</i></li></ul>
25142
25143 !! wikitext
25144 * bar <span><nowiki>[[foo]]</nowiki></span>
25145
25146 * =bar <span><nowiki>[[foo]]</nowiki></span>
25147
25148 * [[bar <span><nowiki>[[foo]]</nowiki></span>
25149
25150 * ]]bar <span><nowiki>[[foo]]</nowiki></span>
25151
25152 * =bar <span>foo]]</span>=
25153
25154 * <s></s>: a
25155
25156 * ''* foo''
25157 !!end
25158
25159 !! test
25160 Lists: 6. Escape bullets in SOL position
25161 !! options
25162 parsoid=html2wt
25163 !! html/parsoid
25164 <p><!--cmt-->*foo</p>
25165 !! wikitext
25166 <!--cmt--><nowiki>*</nowiki>foo
25167 !!end
25168
25169 !! test
25170 Lists: 7. Escape bullets in a multi-line context
25171 !! options
25172 parsoid=html2wt
25173 !! html/parsoid
25174 <p>a
25175 *b
25176 </p>
25177 !! wikitext
25178 a
25179 <nowiki>*</nowiki>b
25180 !!end
25181
25182 !! test
25183 Lists: 8. Escape colons only if not present in tags
25184 !! options
25185 parsoid=html2wt
25186 !! html/parsoid
25187 <dl><dt>a:b<i>c:d</i></dt></dl>
25188 !! wikitext
25189 ; <nowiki>a:b</nowiki>''c:d''
25190 !! end
25191
25192 #### --------------- HRs ---------------
25193 #### 1. Single line
25194 #### -----------------------------------
25195
25196 !! test
25197 HRs: 1. Single line
25198 !! options
25199 parsoid=html2wt
25200 !! html/parsoid
25201 <hr />----
25202 <hr />=foo=
25203 <hr />*foo
25204 !! wikitext
25205 ----<nowiki>----</nowiki>
25206 ----=foo=
25207 ----*foo
25208 !! end
25209
25210 #### --------------- Tables ---------------
25211 #### 1a. Simple example
25212 #### 1b. No escaping needed (!foo)
25213 #### 1c. No escaping needed (|foo)
25214 #### 1d. No escaping needed (|}foo)
25215 ####
25216 #### 2a. Nested in td (<td>foo|bar</td>)
25217 #### 2b. Nested in td (<td>foo||bar</td>)
25218 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
25219 ####
25220 #### 3a. Nested in th (<th>foo!bar</th>)
25221 #### 3b. Nested in th (<th>foo!!bar</th>)
25222 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
25223 ####
25224 #### 4a. Escape -
25225 #### 4b. Escape +
25226 #### 4c. No escaping needed
25227 #### --------------------------------------
25228
25229 !! test
25230 Tables: 1a. Simple example
25231 !! options
25232 parsoid=html2wt
25233 !! html/parsoid
25234 <p>{|
25235 |}
25236 </p>
25237 !! wikitext
25238 <nowiki>{|</nowiki>
25239 |}
25240 !! end
25241
25242 !! test
25243 Tables: 1b. No escaping needed
25244 !! options
25245 parsoid=html2wt
25246 !! html/parsoid
25247 <p>!foo
25248 </p>
25249 !! wikitext
25250 !foo
25251 !! end
25252
25253 !! test
25254 Tables: 1c. No escaping needed
25255 !! options
25256 parsoid=html2wt
25257 !! html/parsoid
25258 <p>|foo
25259 </p>
25260 !! wikitext
25261 |foo
25262 !! end
25263
25264 !! test
25265 Tables: 1d. No escaping needed
25266 !! options
25267 parsoid=html2wt
25268 !! html/parsoid
25269 <p>|}foo
25270 </p>
25271 !! wikitext
25272 |}foo
25273 !! end
25274
25275 !! test
25276 Tables: 2a. Nested in td
25277 !! options
25278 parsoid=html2wt
25279 !! html/parsoid
25280 <table><tbody><tr>
25281 <td>foo|bar</td></tr>
25282 <tr><td>x<div>a|b</div></td>
25283 </tbody></table>
25284 !! wikitext
25285 {|
25286 |<nowiki>foo|bar</nowiki>
25287 |-
25288 |x<div><nowiki>a|b</nowiki></div>
25289 |}
25290 !! html/php+tidy
25291 <table>
25292 <tr>
25293 <td>foo|bar</td>
25294 </tr>
25295 <tr>
25296 <td>x
25297 <div>a|b</div>
25298 </td>
25299 </tr>
25300 </table>
25301 !! end
25302
25303 !! test
25304 Tables: 2b. Nested in td
25305 !! options
25306 parsoid=html2wt
25307 !! html/parsoid
25308 <table><tbody><tr>
25309 <td>foo||bar</td>
25310 <td>a<i>b||c</i></td>
25311 <td>a<i><div>b||c</div></i></td>
25312 </tr></tbody></table>
25313 !! wikitext
25314 {|
25315 |<nowiki>foo||bar</nowiki>
25316 |a''<nowiki>b||c</nowiki>''
25317 |a''<div><nowiki>b||c</nowiki></div>''
25318 |}
25319 !! html/php
25320 <table>
25321 <tr>
25322 <td>foo||bar
25323 </td>
25324 <td>a<i>b||c</i>
25325 </td>
25326 <td>a<i><div>b||c</div></i>
25327 </td></tr></table>
25328
25329 !! end
25330
25331 !! test
25332 Tables: 2c. Nested in td -- no escaping needed
25333 !! options
25334 parsoid=html2wt
25335 !! html/*
25336 <table>
25337 <tr>
25338 <td>foo!!bar
25339 </td></tr></table>
25340
25341 !! wikitext
25342 {|
25343 |foo!!bar
25344 |}
25345 !! end
25346
25347 !! test
25348 Tables: 3a. Nested in th
25349 !! options
25350 parsoid=html2wt
25351 !! html/*
25352 <table>
25353 <tr>
25354 <th>foo!bar
25355 </th></tr></table>
25356
25357 !! wikitext
25358 {|
25359 !foo!bar
25360 |}
25361 !! end
25362
25363 !! test
25364 Tables: 3b. Nested in th
25365 !! options
25366 parsoid=html2wt
25367 !! html/parsoid
25368 <table><tbody>
25369 <tr><th>foo!!bar</th>
25370 <th><i>foo|bar</i></th>
25371 <th><i>foo!!bar</i></th>
25372 <th><i><span>foo!!bar</span></i></th>
25373 </tr></tbody></table>
25374 !! wikitext
25375 {|
25376 !<nowiki>foo!!bar</nowiki>
25377 !''<nowiki>foo|bar</nowiki>''
25378 !''<nowiki>foo!!bar</nowiki>''
25379 !''<span><nowiki>foo!!bar</nowiki></span>''
25380 |}
25381 !! html/php
25382 <table>
25383 <tr>
25384 <th>foo!!bar
25385 </th>
25386 <th><i>foo|bar</i>
25387 </th>
25388 <th><i>foo!!bar</i>
25389 </th>
25390 <th><i><span>foo!!bar</span></i>
25391 </th></tr></table>
25392
25393 !! end
25394
25395 !! test
25396 Tables: 3c. Nested in th
25397 !! options
25398 parsoid=html2wt
25399 !! html/parsoid
25400 <table><tbody>
25401 <tr><th>foo||bar</th>
25402 <th><span typeof="mw:Nowiki">foo||bar</span></th>
25403 </tr></tbody></table>
25404 !! wikitext
25405 {|
25406 !<nowiki>foo||bar</nowiki>
25407 !<nowiki>foo||bar</nowiki>
25408 |}
25409 !! html/php
25410 <table>
25411 <tr>
25412 <th>foo||bar
25413 </th>
25414 <th>foo||bar
25415 </th></tr></table>
25416
25417 !! end
25418
25419 !! test
25420 Tables: 4a. Escape -
25421 !! options
25422 parsoid=html2wt
25423 !! html/*
25424 <table>
25425 <tr>
25426 <th>-bar
25427 </th></tr>
25428 <tr>
25429 <td>-bar
25430 </td></tr></table>
25431
25432 !! wikitext
25433 {|
25434 !-bar
25435 |-
25436 |<nowiki>-bar</nowiki>
25437 |}
25438 !! end
25439
25440 !! test
25441 Tables: 4b. Escape +
25442 !! options
25443 parsoid=html2wt
25444 !! html/*
25445 <table>
25446 <tr>
25447 <th>+bar
25448 </th></tr>
25449 <tr>
25450 <td>+bar
25451 </td></tr></table>
25452
25453 !! wikitext
25454 {|
25455 !+bar
25456 |-
25457 |<nowiki>+bar</nowiki>
25458 |}
25459 !! end
25460
25461 !! test
25462 Tables: 4c. No escaping needed
25463 !! options
25464 parsoid=html2wt
25465 !! html/parsoid
25466 <table><tbody>
25467 <tr><td>foo-bar</td><td>foo+bar</td></tr>
25468 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
25469 <tr><td>foo
25470 <p>bar|baz
25471 +bar
25472 -bar</p></td></tr>
25473 <tr><td>x
25474 <div>a|b</div></td>
25475 </tbody></table>
25476 !! wikitext
25477 {|
25478 |foo-bar
25479 |foo+bar
25480 |-
25481 |''foo''-bar
25482 |''foo''+bar
25483 |-
25484 |foo
25485 bar|baz
25486 +bar
25487 -bar
25488 |-
25489 |x
25490 <div>a|b</div>
25491 |}
25492 !! html/php
25493 <table>
25494 <tr>
25495 <td>foo-bar
25496 </td>
25497 <td>foo+bar
25498 </td></tr>
25499 <tr>
25500 <td><i>foo</i>-bar
25501 </td>
25502 <td><i>foo</i>+bar
25503 </td></tr>
25504 <tr>
25505 <td>foo
25506 <p>bar|baz
25507 +bar
25508 -bar
25509 </p>
25510 </td></tr>
25511 <tr>
25512 <td>x
25513 <div>a|b</div>
25514 </td></tr></table>
25515
25516 !! end
25517
25518 !! test
25519 Tables: 4d. No escaping needed
25520 !! options
25521 parsoid=html2wt
25522 !! html/parsoid
25523 <table>
25524 <tbody><tr><td><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>-bar</td>
25525 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>+1</td>
25526 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>-2</td></tr>
25527 </tbody></table>
25528 !! wikitext
25529 {|
25530 |[[Foo]]-bar
25531 ||+1
25532 ||-2
25533 |}
25534 !! html/php
25535 <table>
25536 <tr>
25537 <td><a href="/wiki/Foo" title="Foo">Foo</a>-bar
25538 </td>
25539 <td>+1
25540 </td>
25541 <td>-2
25542 </td></tr></table>
25543
25544 !! end
25545
25546 !! test
25547 T97430: Don't emit empty nowiki pairs around marker meta tags
25548 !! options
25549 parsoid=html2wt
25550 !! html/parsoid
25551 <p>*This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
25552 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.</p>
25553 !! wikitext
25554 <nowiki>*</nowiki>This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
25555 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.
25556 !! end
25557
25558 !! test
25559 Unclosed xmlish element in table line shouldn't eat end delimiters
25560 !! options
25561 parsoid=html2wt
25562 !! html/parsoid
25563 <table>
25564 <tbody><tr><td> &lt;foo</td>
25565 <td> bar></td></tr>
25566 </tbody></table>
25567 !! wikitext
25568 {|
25569 | <foo
25570 | bar>
25571 |}
25572 !! html/php
25573 <table>
25574 <tr>
25575 <td> &lt;foo
25576 </td>
25577 <td> bar&gt;
25578 </td></tr></table>
25579
25580 !! end
25581
25582 #### --------------- Links ----------------
25583 #### 1. Quote marks in link text
25584 #### 2. Wikilinks: Escapes needed
25585 #### 3. Wikilinks: No escapes needed
25586 #### 4. Extlinks: Escapes needed
25587 #### 5. Extlinks: No escapes needed
25588 #### --------------------------------------
25589 !! test
25590 Links 1. WikiLinks: No escapes needed
25591 !! options
25592 parsoid=html2wt
25593 !! html/parsoid
25594 <p><a rel="mw:WikiLink" href="Foo" title="Foo">Foo<i>boo</i></a>
25595 <a rel="mw:WikiLink" href="Foo" title="Foo">[Foobar]</a>
25596 <a rel="mw:WikiLink" href="Foo" title="Foo">x [Foobar] x</a></p>
25597 !! wikitext
25598 [[Foo|Foo''boo'']]
25599 [[Foo|[Foobar]]]
25600 [[Foo|x [Foobar] x]]
25601 !! html/php
25602 <p><a href="/wiki/Foo" title="Foo">Foo<i>boo</i></a>
25603 <a href="/wiki/Foo" title="Foo">[Foobar]</a>
25604 <a href="/wiki/Foo" title="Foo">x [Foobar] x</a>
25605 </p>
25606 !! end
25607
25608 !! test
25609 Links 2. WikiLinks: Escapes needed
25610 !! options
25611 parsoid=html2wt
25612 !! html/parsoid
25613 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
25614 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
25615 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
25616 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
25617 <a href="Foo" rel="mw:WikiLink">|Bar</a>
25618 <a href="Foo" rel="mw:WikiLink">]]bar</a>
25619 <a href="Foo" rel="mw:WikiLink">[[bar</a>
25620 <a href="Foo" rel="mw:WikiLink">x [[ y</a>
25621 <a href="Foo" rel="mw:WikiLink">x ]] y</a>
25622 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
25623 !! wikitext
25624 [[Foo|<nowiki>Foobar]</nowiki>]]
25625 [[Foo|x <nowiki>[http://google.com g]</nowiki> x]]
25626 [[Foo|<nowiki>[[Bar]]</nowiki>]]
25627 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
25628 [[Foo|<nowiki>|Bar</nowiki>]]
25629 [[Foo|<nowiki>]]bar</nowiki>]]
25630 [[Foo|<nowiki>[[bar</nowiki>]]
25631 [[Foo|<nowiki>x [[ y</nowiki>]]
25632 [[Foo|<nowiki>x ]] y</nowiki>]]
25633 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
25634 !! html/php
25635 <p><a href="/wiki/Foo" title="Foo">Foobar]</a>
25636 <a href="/wiki/Foo" title="Foo">x [http://google.com g] x</a>
25637 <a href="/wiki/Foo" title="Foo">[[Bar]]</a>
25638 <a href="/wiki/Foo" title="Foo">x [[Bar]] x</a>
25639 <a href="/wiki/Foo" title="Foo">|Bar</a>
25640 <a href="/wiki/Foo" title="Foo">]]bar</a>
25641 <a href="/wiki/Foo" title="Foo">[[bar</a>
25642 <a href="/wiki/Foo" title="Foo">x [[ y</a>
25643 <a href="/wiki/Foo" title="Foo">x ]] y</a>
25644 <a href="/wiki/Foo" title="Foo">x ]] y [[ z</a>
25645 </p>
25646 !! end
25647
25648 !! test
25649 Links 3. WikiLinks: No escapes needed
25650 !! options
25651 parsoid=html2wt
25652 !! html/parsoid
25653 <p><a rel="mw:WikiLink" href="Foo">[Foobar</a>
25654 <a rel="mw:WikiLink" href="Foo" title="Foo">foo|bar</a></p>
25655 !! wikitext
25656 [[Foo|[Foobar]]
25657 [[Foo|foo|bar]]
25658 !! html/php
25659 <p><a href="/wiki/Foo" title="Foo">[Foobar</a>
25660 <a href="/wiki/Foo" title="Foo">foo|bar</a>
25661 </p>
25662 !! end
25663
25664 !! test
25665 Links 4. ExtLinks: Escapes needed
25666 !! options
25667 parsoid=html2wt
25668 !! html/parsoid
25669 <p><a rel="mw:ExtLink" href="http://google.com">[google]</a>
25670 <a rel="mw:ExtLink" href="http://google.com">google]</a>
25671 <a rel="mw:ExtLink" href="http://google.com">goog] le</a></p>
25672 <p>[http://google.com]</p>
25673 <p>[http://google.com google]</p>
25674 <p>[<a rel="mw:ExtLink" href="http://google.com">http://google.com</a>]</p>
25675 <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>
25676 !! wikitext
25677 [http://google.com <nowiki>[google]</nowiki>]
25678 [http://google.com <nowiki>google]</nowiki>]
25679 [http://google.com <nowiki>goog] le</nowiki>]
25680
25681 <nowiki>[http://google.com]</nowiki>
25682
25683 <nowiki>[http://google.com google]</nowiki>
25684
25685 [http://google.com<nowiki>]</nowiki>
25686
25687 [{{echo|http://google.com}}<nowiki>]</nowiki>
25688 !! html/php
25689 <p><a rel="nofollow" class="external text" href="http://google.com">[google]</a>
25690 <a rel="nofollow" class="external text" href="http://google.com">google]</a>
25691 <a rel="nofollow" class="external text" href="http://google.com">goog] le</a>
25692 </p><p>[http://google.com]
25693 </p><p>[http://google.com google]
25694 </p><p>[<a rel="nofollow" class="external free" href="http://google.com">http://google.com</a>]
25695 </p><p>[<a rel="nofollow" class="external free" href="http://google.com">http://google.com</a>]
25696 </p>
25697 !! end
25698
25699 !! test
25700 Links 5. ExtLinks: No escapes needed
25701 !! options
25702 parsoid=html2wt
25703 !! html/parsoid
25704 <p><a rel="mw:ExtLink" href="http://google.com">[google</a></p>
25705 <p>[<a ref="mw:ExtLink" href="http://google.com"></a>]</p>
25706 !! wikitext
25707 [http://google.com [google]
25708
25709 [[http://google.com]]
25710 !! html/php
25711 <p><a rel="nofollow" class="external text" href="http://google.com">[google</a>
25712 </p><p>[<a rel="nofollow" class="external autonumber" href="http://google.com">[1]</a>]
25713 </p>
25714 !! end
25715
25716 !! test
25717 Links 6. Add <nowiki/>s between text-nodes and url-links when required (T66300)
25718 !! options
25719 parsoid=html2wt
25720 !! html/parsoid
25721 <p>x<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>y
25722 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>?x
25723 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>&amp;x
25724 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>'x
25725 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,x
25726 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.x
25727 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
25728 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>:x
25729 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
25730 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>!x
25731 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>=x
25732 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>(x)
25733 <a rel="mw:ExtLink" href="http://example.com(x" data-parsoid='{"stx":"url"}'>http://example.com(x</a>)
25734 </p>
25735 !! wikitext
25736 x<nowiki/>http://example.com<nowiki/>y
25737 http://example.com<nowiki/>?x
25738 http://example.com<nowiki/>&x
25739 http://example.com<nowiki/>'x
25740 http://example.com<nowiki/>,x
25741 http://example.com<nowiki/>.x
25742 http://example.com<nowiki/>;x
25743 http://example.com<nowiki/>:x
25744 http://example.com<nowiki/>;x
25745 http://example.com<nowiki/>!x
25746 http://example.com<nowiki/>=x
25747 http://example.com<nowiki/>(x)
25748 http://example.com(x<nowiki/>)
25749 !! end
25750
25751 !! test
25752 Links 7a. Don't add spurious <nowiki/>s between text-nodes and url-links (T66300)
25753 !! options
25754 parsoid=html2wt
25755 !! html/parsoid
25756 <p>x
25757 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>
25758 y
25759 "<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>"
25760 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>)
25761 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>) foo
25762 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,
25763 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>, foo
25764 </p>
25765 !! wikitext
25766 x
25767 http://example.com
25768 y
25769 "http://example.com"
25770 (http://example.com)
25771 (http://example.com) foo
25772 http://example.com,
25773 http://example.com, foo
25774 !! html/php
25775 <p>x
25776 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
25777 y
25778 "<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>"
25779 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
25780 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>) foo
25781 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
25782 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>, foo
25783 </p>
25784 !! end
25785
25786 !! test
25787 Links 7b. Don't add spurious <nowiki/>s between text-nodes and url-links (T66300)
25788 !! options
25789 parsoid=html2wt
25790 !! html/parsoid
25791 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.,;:!?\
25792 -<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:</p>
25793 !! wikitext
25794 http://example.com.,;:!?\
25795 -http://example.com:
25796 !! html/php
25797 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.,;:!?\
25798 -<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
25799 </p>
25800 !! end
25801
25802 !! test
25803 Links 8. Add <nowiki/>s between text-nodes and RFC-links when required (T66300)
25804 !! options
25805 parsoid=html2wt
25806 !! html/parsoid
25807 <p><a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>4
25808 <a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
25809 X<a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y</p>
25810 !! wikitext
25811 RFC 123<nowiki/>4
25812 RFC 123<nowiki/>y
25813 X<nowiki/>RFC 123<nowiki/>y
25814 !! end
25815
25816 !! test
25817 Links 9. Don't add spurious <nowiki/>s between text-nodes and RFC-links (T66300)
25818 !! options
25819 parsoid=html2wt
25820 !! html/parsoid
25821 <p><a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>?foo
25822 <a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>&amp;foo
25823 -<a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>-
25824 </p>
25825 !! wikitext
25826 RFC 123?foo
25827 RFC 123&foo
25828 -RFC 123-
25829 !! html/php
25830 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc123">RFC 123</a>?foo
25831 <a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc123">RFC 123</a>&amp;foo
25832 -<a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc123">RFC 123</a>-
25833 </p>
25834 !! end
25835
25836 !! test
25837 Links 10. Add <nowiki/>s between text-nodes and PMID-links when required (T66300)
25838 !! options
25839 parsoid=html2wt
25840 !! html/parsoid
25841 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>4
25842 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
25843 X<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
25844 !! wikitext
25845 PMID 123<nowiki/>4
25846 PMID 123<nowiki/>y
25847 X<nowiki/>PMID 123<nowiki/>y
25848 !! end
25849
25850 !! test
25851 Links 11. Don't add spurious <nowiki/>s between text-nodes and PMID-links (T66300)
25852 !! options
25853 parsoid=html2wt
25854 !! html/parsoid
25855 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>?foo
25856 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>&foo
25857 -<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>-
25858 </p>
25859 !! wikitext
25860 PMID 123?foo
25861 PMID 123&foo
25862 -PMID 123-
25863 !! html/php
25864 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>?foo
25865 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>&amp;foo
25866 -<a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>-
25867 </p>
25868 !! end
25869
25870 !! test
25871 Links 12. Add <nowiki/>s between text-nodes and ISBN-links when required (T66300)
25872 !! options
25873 parsoid=html2wt
25874 !! html/parsoid
25875 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>1
25876 <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>x
25877 a<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>b
25878 </p>
25879 !! wikitext
25880 ISBN 1234567890<nowiki/>1
25881 ISBN 1234567890<nowiki/>x
25882 a<nowiki/>ISBN 1234567890<nowiki/>b
25883 !! end
25884
25885 !! test
25886 Links 13. Don't add spurious <nowiki/>s between text-nodes and ISBN-links (T66300)
25887 !! options
25888 parsoid=html2wt
25889 !! html/parsoid
25890 <p>-<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>'s
25891 !! wikitext
25892 -ISBN 1234567890's
25893 !! html/php
25894 <p>-<a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>'s
25895 </p>
25896 !! end
25897
25898 !! test
25899 Links 14. Protect link-like plain text. (Parsoid bug T78425)
25900 !! options
25901 parsoid=html2wt
25902 !! html/*
25903 <p>this is not a link: http://example.com
25904 </p>
25905 !! wikitext
25906 this is not a link: <nowiki>http://example.com</nowiki>
25907 !! end
25908
25909 !! test
25910 Links 15. Link trails can't become link prefixes.
25911 !! options
25912 language=is
25913 parsoid=html2wt
25914 !! html/parsoid
25915 <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>
25916 !! wikitext
25917 [[Söfnuður]]-[[00]]
25918 !! html/php
25919 <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>
25920 </p>
25921 !! end
25922
25923 #### --------------- Quotes ---------------
25924 #### 1. Quotes inside <b> and <i>
25925 #### 2. Link fragments separated by <i> and <b> tags
25926 #### 3. Link fragments inside <i> and <b>
25927 #### 4. No escaping needed
25928 #### --------------------------------------
25929 !! test
25930 1a. Quotes inside <b> and <i>
25931 !! options
25932 parsoid=html2wt
25933 !! html/*
25934 <p><i>'foo'</i>
25935 <i>''foo''</i>
25936 <i>'''foo'''</i>
25937 <i>foo</i>'s
25938 <b>'foo'</b>
25939 <b>''foo''</b>
25940 <b>'''foo'''</b>
25941 <b>foo'<i>bar'</i>baz</b>
25942 <b>foo</b>'s
25943 '<i>foo</i>
25944 <i>foo</i>'
25945 <i>foo'</i>'
25946 '<i>foo</i>'
25947 '<b>foo</b>
25948 <b>foo</b>'
25949 '<b>foo</b>'
25950 <i>fools'<span> errand</span></i>
25951 <i><span>fool</span>'s errand</i>
25952 '<i>foo</i> bar '<i>baz</i>
25953 a|!*#-:;+-~[]{}b'<i>x</i>
25954 </p>
25955 !! wikitext
25956 ''<nowiki/>'foo'''
25957 ''<nowiki>''foo''</nowiki>''
25958 ''<nowiki>'''foo'''</nowiki>''
25959 ''foo''<nowiki/>'s
25960 '''<nowiki/>'foo''''
25961 '''<nowiki>''foo''</nowiki>'''
25962 '''<nowiki>'''foo'''</nowiki>'''
25963 '''foo'<nowiki/>''bar'<nowiki/>''baz'''
25964 '''foo'''<nowiki/>'s
25965 '''foo''
25966 ''foo''<nowiki/>'
25967 ''foo'''<nowiki/>'
25968 '''foo''<nowiki/>'
25969 ''''foo'''
25970 '''foo'''<nowiki/>'
25971 ''''foo'''<nowiki/>'
25972 ''fools'<span> errand</span>''
25973 ''<span>fool</span>'s errand''
25974 '<nowiki/>''foo'' bar '''baz''
25975 a|!*#-:;+-~[]{}b'''x''
25976 !! end
25977
25978 !! test
25979 1b. Quotes inside <b> and <i> with other tags on same line
25980 !! options
25981 parsoid=html2wt
25982 !! html/parsoid
25983 '<i>a</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
25984 <i>a'</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
25985 <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>
25986 <a rel="mw:WikiLink" href="Foo" title="Foo">foo</a> x'<i><a href="Bar" rel="mw:WikiLink" title="Bar">bar</a></i>
25987 '<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>
25988 '<i>foo</i> <div title="name">test</div>
25989 '<i>foo</i> and <br data-parsoid='{"stx":"html","noClose":true}'/> bar
25990 <ol class="mw-references references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
25991 <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>
25992 </ol>
25993 !! wikitext
25994 '''a'' foo ''[[bar]]''
25995 ''a''' foo ''[[bar]]''
25996 ''a''' foo '''{{echo|[[bar]]}}'''
25997 [[foo]] x'''[[bar]]''
25998 '''foo'' <ref>test</ref>
25999 '''foo'' <div title="name">test</div>
26000 '''foo'' and <br> bar
26001 <references />
26002 !! end
26003
26004 !! test
26005 2. Link fragments separated by <i> and <b> tags
26006 !! options
26007 parsoid=html2wt
26008 !! html/parsoid
26009 <p>[[<i>foo</i>hello]]</p>
26010 <p>[[<b>foo</b>hello]]</p>
26011 !! wikitext
26012 [[''foo''<nowiki>hello]]</nowiki>
26013
26014 [['''foo'''<nowiki>hello]]</nowiki>
26015 !! end
26016
26017 # FIXME: Escaping one or both of [[ and ]] is also acceptable --
26018 # this is one of the shortcomings of this format
26019 !! test
26020 3. Link fragments inside <i> and <b>
26021 !! options
26022 parsoid=html2wt
26023 !! html/parsoid
26024 <p><i>[[foo</i>]]</p>
26025 <p><b>[[foo</b>]]</p>
26026 !! wikitext
26027 ''[[foo''<nowiki>]]</nowiki>
26028
26029 '''[[foo'''<nowiki>]]</nowiki>
26030 !! end
26031
26032 !! test
26033 4. No escaping needed
26034 !! options
26035 parsoid=html2wt
26036 !! html/parsoid
26037 <p>'<span><i>bar</i></span>'
26038 '<span><b>bar</b></span>'
26039 'a:b'foo
26040 </p>
26041 !! wikitext
26042 '<span>''bar''</span>'
26043 '<span>'''bar'''</span>'
26044 'a:b'foo
26045 !! end
26046
26047 #### ----------- Paragraphs ---------------
26048 #### 1. No unnecessary escapes
26049 #### --------------------------------------
26050
26051 !! test
26052 1. No unnecessary escapes
26053 !! options
26054 parsoid=html2wt
26055 !! html/parsoid
26056 <p>bar <span>[[foo]]</span>
26057 </p><p>=bar <span>[[foo]]</span>
26058 </p><p>[[bar <span>[[foo]]</span>
26059 </p><p>]]bar <span>[[foo]]</span>
26060 </p><p>=bar <span>foo]]</span>=
26061 </p>
26062 !! wikitext
26063 bar <span><nowiki>[[foo]]</nowiki></span>
26064
26065 =bar <span><nowiki>[[foo]]</nowiki></span>
26066
26067 [[bar <span><nowiki>[[foo]]</nowiki></span>
26068
26069 ]]bar <span><nowiki>[[foo]]</nowiki></span>
26070
26071 =bar <span>foo]]</span><nowiki>=</nowiki>
26072 !!end
26073
26074 #### ----------------------- PRE --------------------------
26075 #### 1. Leading whitespace in SOL context should be escaped
26076 #### ------------------------------------------------------
26077 !! test
26078 1. Leading whitespace in SOL context should be escaped
26079 !! options
26080 parsoid=html2wt
26081 !! html/parsoid
26082 <p> a</p>
26083
26084 <p> a</p>
26085
26086 <p> a(tab)</p>
26087
26088 <p> a
26089 <!--cmt-->
26090 a</p>
26091
26092 <p>a
26093 b</p>
26094
26095 <p>a
26096 b</p>
26097
26098 <p>a
26099 b</p>
26100 !! wikitext
26101 <nowiki> </nowiki>a
26102
26103 <nowiki> </nowiki> a
26104
26105 a(tab)
26106
26107 <nowiki> </nowiki> a
26108 <!--cmt-->
26109 <nowiki> </nowiki>a
26110
26111 a
26112 <nowiki> </nowiki>b
26113
26114 a
26115 b
26116
26117 a
26118 b
26119 !! html/php
26120 <p> a
26121 </p><p> a
26122 </p><p> a(tab)
26123 </p><p> a
26124 a
26125 </p><p>a
26126 b
26127 </p><p>a
26128 b
26129 </p><p>a
26130 b
26131 </p>
26132 !! end
26133
26134 !! test
26135 2. Leading whitespace in non-indent-pre contexts should not be escaped
26136 !! options
26137 parsoid=html2wt
26138 !! html/parsoid
26139 <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>
26140 <ol class="mw-references references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
26141 <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>
26142 b</span></li>
26143 </ol>
26144 !! wikitext
26145 foo <ref>''a''
26146 b</ref>
26147 <references />
26148 !! end
26149
26150 !! test
26151 3. Leading whitespace in indent-pre suppressing contexts should not be escaped
26152 !! options
26153 parsoid=html2wt
26154 !! html/parsoid
26155 <blockquote>
26156 <p>
26157 a
26158 <span>b</span>
26159 c</p>
26160 </blockquote>
26161 !! wikitext
26162 <blockquote>
26163 a
26164 <span>b</span>
26165 c
26166 </blockquote>
26167 !! end
26168
26169 !! test
26170 4. Leading whitespace in indent-pre suppressing contexts should not be escaped
26171 !! options
26172 parsoid=html2wt
26173 !! html/parsoid
26174 <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>
26175 !! wikitext
26176 [[File:Foobar.jpg|thumb|caption]]
26177 !! end
26178
26179 !! test
26180 5. Nowiki escaping should account for indent-pres
26181 !! options
26182 parsoid=html2wt
26183 !! html/parsoid
26184 <pre>==foo==</pre>
26185 !! wikitext
26186 ==foo==
26187 !! end
26188
26189 !!test
26190 T95794: nowiki escaping should account for leading space at start-of-line in an indent-pre block
26191 !! options
26192 parsoid=html2wt
26193 !! html/parsoid
26194 <pre>
26195 * foo
26196 * bar
26197 </pre>
26198 !! wikitext
26199 * foo
26200 * bar
26201 !! end
26202
26203 #### --------------- Behavior Switches --------------------
26204
26205 !! test
26206 1. Valid behavior switches should be escaped
26207 !! options
26208 parsoid=html2wt
26209 !! html/parsoid
26210 __TOC__
26211 <i>__TOC__</i>
26212 !! wikitext
26213 <nowiki>__TOC__</nowiki>
26214 ''<nowiki>__TOC__</nowiki>''
26215 !! end
26216
26217 !! test
26218 2. Invalid behavior switches should not be escaped
26219 !! options
26220 parsoid=html2wt
26221 !! html/parsoid
26222 __TOO__
26223 __|__
26224 !! wikitext
26225 __TOO__
26226 __|__
26227 !! end
26228
26229 # We use indent-pre as an indirect way to test for sol-transparent behavior.
26230 !! test
26231 Behavior switches should be SOL-transparent
26232 !! options
26233 parsoid=html2wt
26234 !! html/parsoid
26235 <meta property="mw:PageProp/toc" />
26236
26237 <!-- this one's bogus -->
26238 <pre>__TOO__</pre>
26239
26240 <pre data-parsoid='{}'><meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/> foo</pre>
26241
26242 <meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/><pre data-parsoid='{}'>bar</pre>
26243 !! wikitext
26244 __TOC__
26245
26246 <!-- this one's bogus -->
26247 __TOO__
26248
26249 __TOC__ foo
26250
26251 __TOC__
26252 bar
26253 !! end
26254
26255 #### --------------- HTML tags ---------------
26256 #### 1. a tags
26257 #### 2. other tags
26258 #### 3. multi-line html tag
26259 #### 4. extension tags
26260 #### -----------------------------------------
26261 !! test
26262 1. a tags
26263 !! options
26264 parsoid=html2wt
26265 !! html/parsoid
26266 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
26267 !! wikitext
26268 <a href="http://google.com">google</a>
26269 !! end
26270
26271 !! test
26272 2. other tags
26273 !! options
26274 parsoid=html2wt
26275 !! html/parsoid
26276 <ul><li> &lt;div&gt;foo&lt;/div&gt;</li>
26277 <li> &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;</li>
26278 <li> &lt;td&gt;</li></ul>
26279
26280 !! wikitext
26281 * <nowiki><div>foo</div></nowiki>
26282 * <nowiki><div style="color:red">foo</div></nowiki>
26283 * <nowiki><td></nowiki>
26284 !! end
26285
26286 !! test
26287 3. multi-line html tag
26288 !! options
26289 parsoid=html2wt
26290 !! html/parsoid
26291 <p>&lt;div
26292 &gt;foo&lt;/div
26293 &gt;
26294 </p>
26295 !! wikitext
26296 <nowiki><div
26297 >foo</div
26298 ></nowiki>
26299 !! end
26300
26301 !! test
26302 4. extension tags
26303 !! options
26304 parsoid=html2wt
26305 !! html/parsoid
26306 <p>&lt;ref&gt;foo&lt;/ref&gt;
26307 </p><p>&lt;ref&gt;bar
26308 </p><p>baz&lt;/ref&gt;
26309 </p>
26310 !! wikitext
26311 <nowiki><ref>foo</ref></nowiki>
26312
26313 <nowiki><ref>bar</nowiki>
26314
26315 baz<nowiki></ref></nowiki>
26316 !! end
26317
26318 #### --------------- Others ---------------
26319 !! test
26320 Escaping nowikis
26321 !! options
26322 parsoid=html2wt
26323 !! html/parsoid
26324 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
26325 </p>
26326 !! wikitext
26327 &lt;nowiki&gt;foo&lt;/nowiki&gt;
26328 !! end
26329
26330 ## The quote-char in the input is necessary for triggering the bug
26331 !! test
26332 (T54035) Nowiki-escaping should not get tripped by " :" in text
26333 !! options
26334 parsoid=html2wt
26335 !! html/parsoid
26336 <p>foo's bar :</p>
26337 !! wikitext
26338 foo's bar :
26339 !! end
26340
26341 #----------- End of wikitext escaping tests --------------
26342
26343 !! test
26344
26345 Tag-like HTML structures are passed through as text
26346 !! wikitext
26347 <x y>
26348
26349 <x.y>
26350
26351 <x-y>
26352
26353 1>2
26354
26355 x<y
26356
26357 a>b
26358
26359 1<d e>f
26360 !! html
26361 <p>&lt;x y&gt;
26362 </p><p>&lt;x.y&gt;
26363 </p><p>&lt;x-y&gt;
26364 </p><p>1&gt;2
26365 </p><p>x&lt;y
26366 </p><p>a&gt;b
26367 </p><p>1&lt;d e&gt;f
26368 </p>
26369 !! end
26370
26371 !! test
26372 HTML tag with necessary entities in attributes
26373 !! wikitext
26374 <span title="&amp;amp;">foo</span>
26375 !! html
26376 <p><span title="&amp;amp;">foo</span>
26377 </p>
26378 !! end
26379
26380 !! test
26381 HTML tag with 'unnecessary' entity encoding in attributes
26382 !! wikitext
26383 <span title="&amp;">foo</span>
26384 !! html
26385 <p><span title="&amp;">foo</span>
26386 </p>
26387 !! end
26388
26389 !! test
26390 HTML tag with broken attribute value quoting
26391 !! options
26392 parsoid=wt2html,html2html
26393 !! wikitext
26394 <span title="Hello world>Foo</span>
26395 !! html/php
26396 <p><span title="Hello world">Foo</span>
26397 </p>
26398 !! html/parsoid
26399 <p><span title="Hello world">Foo</span></p>
26400 !! end
26401
26402 !! test
26403 Self-closed tag with broken attribute value quoting
26404 !! options
26405 parsoid=wt2html,html2html
26406 !! wikitext
26407 <div title="Hello world />Foo
26408 !! html/php+tidy
26409 <div title="Hello world"></div>
26410 <p>Foo</p>
26411 !! html/parsoid
26412 <div title="Hello world " data-parsoid='{"stx":"html","selfClose":true}'></div><p>Foo</p>
26413 !! end
26414
26415 !! test
26416 Table with broken attribute value quoting
26417 !! options
26418 parsoid=wt2html,html2html
26419 !! wikitext
26420 {|
26421 | title="Hello world|Foo
26422 |}
26423 !! html/php
26424 <table>
26425 <tr>
26426 <td title="Hello world">Foo
26427 </td></tr></table>
26428
26429 !! html/parsoid
26430 <table>
26431 <tr>
26432 <td title="Hello world">Foo
26433 </td></tr></table>
26434
26435 !! end
26436
26437 !! test
26438 Table with broken attribute value quoting on consecutive lines
26439 !! options
26440 parsoid=wt2html,html2html
26441 !! wikitext
26442 {|
26443 | title="Hello world|Foo
26444 | style="color:red|Bar
26445 |}
26446 !! html/php
26447 <table>
26448 <tr>
26449 <td title="Hello world">Foo
26450 </td>
26451 <td style="color:red">Bar
26452 </td></tr></table>
26453
26454 !! html/parsoid
26455 <table><tbody>
26456 <tr>
26457 <td title="Hello world">Foo
26458 </td><td style="color: red">Bar
26459 </td></tr></tbody></table>
26460
26461 !! end
26462
26463 !!test
26464 Accept empty td cell attribute
26465 !! wikitext
26466 {|
26467 | align="center" | foo || |
26468 |}
26469 !! html
26470 <table>
26471 <tr>
26472 <td align="center"> foo </td>
26473 <td>
26474 </td></tr></table>
26475
26476 !!end
26477
26478 !!test
26479 Non-empty attributes in th-cells
26480 !! wikitext
26481 {|
26482 ! Foo !! style="color: red" | Bar
26483 |}
26484 !! html
26485 <table>
26486 <tr>
26487 <th> Foo </th>
26488 <th style="color: red"> Bar
26489 </th></tr></table>
26490
26491 !!end
26492
26493 !!test
26494 Accept empty attributes in th-cells
26495 !! wikitext
26496 {|
26497 !| foo !!| bar
26498 |}
26499 !! html
26500 <table>
26501 <tr>
26502 <th> foo </th>
26503 <th> bar
26504 </th></tr></table>
26505
26506 !!end
26507
26508 !!test
26509 Empty table rows go away
26510 !! wikitext
26511 {|
26512 | Hello
26513 | there
26514 |- class="foo"
26515 |-
26516 |}
26517 !! html
26518 <table>
26519 <tr>
26520 <td> Hello
26521 </td>
26522 <td> there
26523 </td></tr>
26524
26525 </table>
26526
26527 !! end
26528
26529 ###
26530 ### Parsoid-centric tests for testing RTing of inter-element separators
26531 ### Edge cases not tested by existing parser tests and specific to
26532 ### Parsoid-specific serialization strategies.
26533 ###
26534
26535 !!test
26536 RT-ed inter-element separators should be valid separators
26537 !! wikitext
26538 {|
26539 |- [[foo]]
26540 |}
26541 !! html/php
26542 <table>
26543
26544 </table>
26545
26546 !! html/parsoid
26547 <table>
26548 <tbody><tr class='mw-empty-elt' data-parsoid='{"startTagSrc":"|-","a":{"[[foo]]":null},"sa":{"[[foo]]":""},"autoInsertedEnd":true}'></tr>
26549 </tbody></table>
26550 !!end
26551
26552 # Parsoid-only since PHP parser relies on Tidy for correct output
26553 !!test
26554 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
26555 !!options
26556 parsoid
26557 !! wikitext
26558 {|
26559 |<small>foo
26560 bar
26561 |}
26562
26563 {|
26564 |<small>foo<small>
26565 |}
26566 !! html
26567 <table>
26568 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'>foo
26569 <p>bar</p></small></td></tr>
26570 </tbody></table>
26571
26572 <table>
26573 <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>
26574 </tbody></table>
26575 !!end
26576
26577 # Note that the "style" attribute is really a template parameter here.
26578 # The = would have to be {{=}} if you wanted the literal.
26579 !!test
26580 Empty TD followed by TD with tpl-generated attribute
26581 !! wikitext
26582 {|
26583 |-
26584 |
26585 |{{echo|style='color:red'}}|foo
26586 |}
26587 !! html
26588 <table>
26589
26590 <tr>
26591 <td>
26592 </td>
26593 <td>foo
26594 </td></tr></table>
26595
26596 !!end
26597
26598 !!test
26599 Indented table with an empty td
26600 !! wikitext
26601 {|
26602 |-
26603 |
26604 |foo
26605 |}
26606 !! html
26607 <table>
26608
26609 <tr>
26610 <td>
26611 </td>
26612 <td>foo
26613 </td></tr></table>
26614
26615 !!end
26616
26617 ## We have some newline diffs RT-ing this edge case
26618 ## and it is not important enough -- we seem to be emitting
26619 ## at most 2 newlines after a </tr> and this is unrelated to
26620 ## the issue from T85627 that this is testing.
26621 !!test
26622 Indented table with blank lines in between (T85627)
26623 !! options
26624 parsoid=wt2html
26625 !! wikitext
26626 {|
26627 |foo
26628
26629
26630 |}
26631 !! html
26632 <table>
26633
26634 <tr>
26635 <td>foo
26636 </td></tr></table>
26637
26638 !!end
26639
26640 !!test
26641 Indented block & table
26642 !! wikitext
26643 <div>foo</div>
26644 {|
26645 |foo
26646 |}
26647 !! html/php
26648 <div>foo</div>
26649 <table>
26650 <tr>
26651 <td>foo
26652 </td></tr></table>
26653
26654 !! html/parsoid
26655 <div data-parsoid='{"stx":"html"}'>foo</div>
26656 <table><tbody>
26657 <tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>foo</td></tr>
26658 </tbody></table>
26659 !!end
26660
26661 !! test
26662 Indent and comment before table row
26663 !! wikitext
26664 {|
26665 <!--hi-->|-
26666 | there
26667 |}
26668 !! html/php
26669 <table>
26670
26671 <tr>
26672 <td> there
26673 </td></tr></table>
26674
26675 !! html/parsoid
26676 <table>
26677 <!--hi--><tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
26678 <td data-parsoid='{"autoInsertedEnd":true}'> there</td></tr>
26679 </tbody></table>
26680 !! end
26681
26682 # Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext
26683 !!test
26684 Empty TR followed by a template-generated TR
26685 !!options
26686 parsoid
26687 !! wikitext
26688 {|
26689 |-
26690 {{echo|<tr><td>foo</td></tr>}}
26691 |}
26692 !! html
26693 <table>
26694 <tbody>
26695 <tr class='mw-empty-elt'></tr>
26696 <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}}]}'>
26697 <td>foo</td></tr>
26698 </tbody></table>
26699 !!end
26700
26701 ## PHP and parsoid output differ for this, and since this is primarily
26702 ## for testing Parsoid's serializer, marking this Parsoid only
26703 !!test
26704 Empty TR followed by mixed-ws-comment line should RT correctly
26705 !!options
26706 parsoid
26707 !! wikitext
26708 {|
26709 |-
26710 <!--c-->
26711 |-
26712 <!--c--> <!--d-->
26713 |}
26714 !! html
26715 <table>
26716 <tbody>
26717 <tr class='mw-empty-elt'></tr>
26718 <!--c-->
26719 <tr>
26720 <!--c--> </tr><!--d-->
26721 </tbody></table>
26722
26723 !!end
26724
26725 !!test
26726 Multi-line image caption generated by templates with/without trailing newlines
26727 !! wikitext
26728 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
26729 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
26730 !! html/parsoid
26731 <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>
26732 <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>
26733 !!end
26734
26735 !! test
26736 New element inserted (without intervening newlines) after an old sol-transparent node should serialize correctly
26737 !! options
26738 parsoid=html2wt
26739 !! html/parsoid
26740 <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>
26741
26742 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{}'/><h1>new heading</h1>
26743 !! wikitext
26744 <includeonly>foo</includeonly>
26745 new para
26746
26747 [[Category:Foo]]
26748
26749 = new heading =
26750 !! end
26751
26752 ## PHP emits broken html for this, and since this is primarily
26753 ## a Parsoid serializer test, marking this Parsoid only
26754 !!test
26755 Improperly nested inline or quotes tags with whitespace in between
26756 !! wikitext
26757 <span> <s>x</span> </s>
26758 ''' ''x''' ''
26759 !! html/parsoid
26760 <p><span> <s>x</s></span><s> </s>
26761 <b> <i>x</i></b><i> </i>
26762 </p>
26763 !!end
26764
26765 !!test
26766 Encapsulate protected attributes from wt
26767 !! wikitext
26768 <div typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
26769
26770 {| typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true"
26771 | ok
26772 |}
26773 !! html/parsoid
26774 <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>
26775
26776 <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">
26777 <tbody><tr><td data-parsoid='{"autoInsertedEnd":true}'> ok</td></tr>
26778 </tbody></table>
26779 !!end
26780
26781 ## Currently the p-wrapper is fragile in how it adds / removes transformations.
26782 ## Having nested or stray pre tags results in the attempt to add duplicates,
26783 ## causing an assertion fail. This test tries to prevent that situation.
26784 !!test
26785 Ensure ParagraphWrapper can deal with stray closing pre tags
26786 !!options
26787 parsoid=wt2html
26788 !! wikitext
26789 plain text</pre>
26790 !! html/parsoid
26791 plain text
26792 !!end
26793
26794 !!test
26795 1. Ensure fostered text content is wrapped in element nodes
26796 !!options
26797 parsoid=wt2html
26798 !! wikitext
26799 <table>hi</table><table>ho</table>
26800 !! html/parsoid
26801 <p>hi</p>
26802 <table></table>
26803 <p>ho</p>
26804 <table></table>
26805 !!end
26806
26807 !!test
26808 2. Ensure fostered text content is wrapped in element nodes (traps regressions around fostered marker on the element getting lost)
26809 !!options
26810 parsoid=wt2html,wt2wt
26811 !! wikitext
26812 <table>
26813 <tr> || ||
26814 <td> a
26815 </table>
26816 !! html/parsoid
26817 <p> || ||
26818 </p><table>
26819 <tbody><tr><td> a</td></tr>
26820 </tbody></table>
26821 !!end
26822
26823 !!test
26824 Encapsulation properly handles null DSR information from foster box
26825 !!options
26826 parsoid=wt2html,wt2wt
26827 !! wikitext
26828 {{echo|<table>foo<tr><td>bar</td></tr></table>}}
26829 !! html/parsoid
26830 <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>
26831 !!end
26832
26833 !!test
26834 1. Encapsulate foster-parented transclusion content
26835 !!options
26836 parsoid=wt2wt,wt2html
26837 !! wikitext
26838 <table>{{echo|foo<tr><td>bar</td></tr>}}</table>
26839 !! html/parsoid
26840 <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>
26841 <tbody>
26842 <tr>
26843 <td>bar</td>
26844 </tr>
26845 </tbody>
26846 </table>
26847 !!end
26848
26849 !!test
26850 2. Encapsulate foster-parented transclusion content
26851 !!options
26852 parsoid=wt2wt,wt2html
26853 !! wikitext
26854 <table><div>{{echo|foo}}</div><tr><td>bar</td></tr></table>
26855 !! html/parsoid
26856 <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>
26857 <table>
26858 <tbody>
26859 <tr>
26860 <td>bar</td>
26861 </tr>
26862 </tbody>
26863 </table>
26864 !!end
26865
26866 !!test
26867 3. Encapsulate foster-parented transclusion content
26868 !!options
26869 parsoid=wt2wt,wt2html
26870 !! wikitext
26871 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
26872 !! html/parsoid
26873 <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;]}">
26874 <p>foo</p>
26875 </div>
26876 <table>
26877 <tbody>
26878 <tr>
26879 <td>bar</td>
26880 </tr>
26881 </tbody>
26882 </table>
26883 !!end
26884
26885 !!test
26886 4. Encapsulate foster-parented transclusion content
26887 !!options
26888 parsoid=wt2wt,wt2html
26889 !! wikitext
26890 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
26891 !! html/parsoid
26892 <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;]}">
26893 <p>foo</p>
26894 </div>
26895 <table>
26896 <tbody>
26897 <tr>
26898 <td>bar</td>
26899 </tr>
26900 </tbody>
26901 </table>
26902 !!end
26903
26904 !!test
26905 5. Encapsulate foster-parented transclusion content
26906 !!options
26907 parsoid=wt2wt,wt2html
26908 !! wikitext
26909 <table><tr><td><div><p>{{echo|foo</p></div></td>foo}}</tr></table>
26910 !! html/parsoid
26911 <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>
26912 <table>
26913 <tbody>
26914 <tr>
26915 <td>
26916 <div>
26917 <p>foo</p>
26918 </div>
26919 </td>
26920 </tr>
26921 </tbody>
26922 </table>
26923 !!end
26924
26925 !!test
26926 6. Encapsulate foster-parented transclusion content
26927 !!options
26928 parsoid=wt2wt,wt2html
26929 !! wikitext
26930 <table><tr><td><div><p>{{echo|foo</p></div></td>foo</tr></table>}}<p>ok</p>
26931 !! html/parsoid
26932 <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>
26933 <table>
26934 <tbody>
26935 <tr>
26936 <td>
26937 <div>
26938 <p>foo</p>
26939 </div>
26940 </td>
26941 </tr>
26942 </tbody>
26943 </table>
26944 <p>ok</p>
26945 !!end
26946
26947 !!test
26948 7. Encapsulate foster-parented transclusion content
26949 !!options
26950 parsoid=wt2wt,wt2html
26951 !! wikitext
26952 <table>{{echo|<p>foo</p>}}<td>bar</td></table>
26953 !! html/parsoid
26954 <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>
26955 <table>
26956 <tbody>
26957 <tr>
26958 <td>bar</td>
26959 </tr>
26960 </tbody>
26961 </table>
26962 !!end
26963
26964 # Note that the wt is broken on purpose: the = should be {{=}} if you
26965 # don't want it to be a template parameter key.
26966 !!test
26967 8. Encapsulate foster-parented transclusion content
26968 !!options
26969 parsoid=wt2wt,wt2html
26970 !! wikitext
26971 {{echo|a
26972 }}{|{{echo|style='color:red'}}
26973 |-
26974 |b
26975 |}
26976 !! html/parsoid
26977 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\n"}},"i":0}}]}'>a</p>
26978 <span> </span>
26979 <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>
26980 <table>
26981 <tbody>
26982 <tr>
26983 <td>b</td>
26984 </tr>
26985 </tbody>
26986 </table>
26987 !!end
26988
26989 !!test
26990 9. Encapsulate foster-parented transclusion content
26991 !!options
26992 parsoid=wt2wt,wt2html
26993 !! wikitext
26994 <table>{{echo|hi</table>hello}}
26995 !! html/parsoid
26996 <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>
26997 !!end
26998
26999 !!test
27000 Table in fosterable position
27001 !!options
27002 parsoid=wt2html
27003 !! wikitext
27004 {{OpenTable}}
27005 <div>
27006 {|
27007 |}
27008 </div>
27009 |}
27010 !! html/parsoid
27011 <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">
27012 </span>
27013 <table about="#mwt1" data-parsoid='{"autoInsertedEnd":true}'></table>
27014
27015 <table>
27016 </table>
27017 !!end
27018
27019 # Parsoid only for T66747
27020 !! test
27021 Properly encapsulate empty-content transclusions in fosterable positions
27022 !! wikitext
27023 <table>
27024 {{#if:|
27025 <td>foo</td>
27026 }}
27027 </table>
27028 !! html/parsoid
27029 <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"}]]}'>
27030
27031 </table>
27032 !! end
27033
27034 !! test
27035 Always encapsulate foster box when template range is expanded to table
27036 !! options
27037 parsoid=wt2wt
27038 !! wikitext
27039 {|
27040 hello
27041 {{OpenTable}}
27042 |}
27043 !! html/parsoid
27044
27045 !! end
27046
27047 !! test
27048 T115289: Unclosed table
27049 !! wikitext
27050 {{echo|<table>}}<!--c-->[[Category:Two]]
27051 !! html/parsoid
27052 <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>
27053 !! end
27054
27055 !! test
27056 T115289: Don't migrate newlines out of tables with fostered content
27057 !! wikitext
27058 <table><td></td>{{echo|<tr>[[Category:One]]}}<!--c-->[[Category:Two]]
27059 !! html/parsoid
27060 <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>
27061 !! end
27062
27063 !! test
27064 T73074: More fostering fun
27065 !! wikitext
27066 <table><td></td>{{echo|<tr>}}<!--c-->[[Category:Two]]
27067 !! html/parsoid
27068 <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>
27069 !! end
27070
27071 !!test
27072 Support <object> element with .data attribute
27073 !!options
27074 parsoid=html2wt
27075 !! html/parsoid
27076 <object data="test.swf"></object>
27077 !! wikitext
27078 <object data="test.swf"></object>
27079 !!end
27080
27081 !! test
27082 Don't block XML namespace declaration
27083 !! wikitext
27084 <span xmlns:dct="http://purl.org/dc/terms/" property="dct:title">MediaWiki</span>
27085 !! html/php
27086 <p><span xmlns:dct="http&#58;//purl.org/dc/terms/" property="dct:title">MediaWiki</span>
27087 </p>
27088 !! html/parsoid
27089 <p><span xmlns:dct="http://purl.org/dc/terms/" data-x-property="dct:title" data-parsoid='{"stx":"html"}'>MediaWiki</span></p>
27090 !! end
27091
27092 # -----------------------------------------------------------------
27093 # The following section of tests are primarily to spec requirements
27094 # around Parsoid's serialization (old, new, edited content)
27095 #
27096 # All these tests are marked Parsoid html2wt and html2html only
27097 # ----------------------------------------------------------------
27098
27099 !! test
27100 Ignore rel attribute in a-tags during serialization to url-links
27101 !! options
27102 parsoid=html2wt
27103 !! html/parsoid
27104 <a href='http://en.wikipedia.org/wiki/Foobar'>http://en.wikipedia.org/wiki/Foobar</a>
27105 <a href='http://en.wikipedia.org/wiki/Foobar' rel='mw:ExtLink'>http://en.wikipedia.org/wiki/Foobar</a>
27106 <a href='http://en.wikipedia.org/wiki/Foobar' rel='mw:WikiLink'>http://en.wikipedia.org/wiki/Foobar</a>
27107 !! wikitext
27108 http://en.wikipedia.org/wiki/Foobar
27109 http://en.wikipedia.org/wiki/Foobar
27110 http://en.wikipedia.org/wiki/Foobar
27111 !! end
27112
27113 # 'mi' is a localinterwiki prefix as well as a language
27114 !! test
27115 Serialize interwiki links pointing to the current wiki as plain wiki links (T67869)
27116 !! options
27117 parsoid=html2wt
27118 !! html/parsoid
27119 <p><a rel="mw:ExtLink" href="http://mi.wikipedia.org/wiki/Foo">Foo</a></p>
27120 !! wikitext
27121 [[Foo]]
27122 !! end
27123
27124 !! test
27125 Parsoid should accept interwiki shortcuts
27126 !! options
27127 parsoid=html2wt
27128 !! html/parsoid
27129 <p><a rel='mw:WikiLink' href='./fr:Foo'>Foo</a>
27130 <a rel='mw:ExtLink' href='./fr:Foo'>Foo</a>
27131 <a href='./fr:Foo'>Foo</a></p>
27132 <p><a rel='mw:WikiLink' href='fr%3AFoo'>Foo</a>
27133 <a rel='mw:ExtLink' href='fr%3AFoo'>Foo</a>
27134 <a href='fr%3AFoo'>Foo</a></p>
27135 <p><a href='FR%3AFoo'>Foo</a>
27136 <a href='./FR:Foo'>Foo</a></p>
27137 !! wikitext
27138 [[:fr:Foo|Foo]]
27139 [[:fr:Foo|Foo]]
27140 [[:fr:Foo|Foo]]
27141
27142 [[:fr:Foo|Foo]]
27143 [[:fr:Foo|Foo]]
27144 [[:fr:Foo|Foo]]
27145
27146 [[:fr:Foo|Foo]]
27147 [[:fr:Foo|Foo]]
27148 !! end
27149
27150 !! test
27151 Parsoid should not accept invalid interwiki shortcuts
27152 !! options
27153 parsoid=html2wt
27154 !! html/parsoid
27155 <p><a rel='mw:WikiLink' href='news:Foo'>Foo</a>
27156 <a rel='mw:ExtLink' href='news:Foo'>Foo</a>
27157 <a href='news:Foo'>Foo</a></p>
27158 !! wikitext
27159 [news:Foo Foo]
27160 [news:Foo Foo]
27161 [news:Foo Foo]
27162 !! end
27163
27164 # See T93839
27165 !! test
27166 New wikilinks should be serialized properly
27167 !! options
27168 parsoid=html2wt
27169 !! html/parsoid
27170 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{}'>Foo</a>
27171 <a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>
27172 <a href="//en.wikipedia.org/wiki/Foo">//en.wikipedia.org/wiki/Foo</a>
27173 <a href="http://en.wikipedia.org/wiki/Foo">http://en.wikipedia.org/wiki/Foo</a>
27174 <a href="//en.wikipedia.org/wiki/Foo_bar">//en.wikipedia.org/wiki/Foo bar</a>
27175 !! wikitext
27176 [[Foo]]
27177 [[Foo]]
27178 [[:en:Foo|//en.wikipedia.org/wiki/Foo]]
27179 http://en.wikipedia.org/wiki/Foo
27180 [[:en:Foo_bar|//en.wikipedia.org/wiki/Foo bar]]
27181 !! end
27182
27183 !! test
27184 New wiki links (href variations)
27185 !! options
27186 parsoid=html2wt
27187 !! html/parsoid
27188 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
27189 <a rel="mw:WikiLink" href="Foo_bar">Foo_bar</a>
27190 <a rel="mw:WikiLink" href="Foo bar">Foo_bar</a>
27191 <a rel="mw:WikiLink" href="./Toxine_bact%C3%A9rienne">Toxine bactérienne</a>
27192 !! wikitext
27193 [[Foo_bar]]
27194 [[Foo_bar]]
27195 [[Foo_bar]]
27196 [[Toxine bactérienne]]
27197 !! end
27198
27199 !! test
27200 New wiki links (content string variations)
27201 !! options
27202 parsoid=html2wt
27203 !! html/parsoid
27204 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
27205 <a rel="mw:WikiLink" href="./Foo_bar">Foo bar</a>
27206 <a rel="mw:WikiLink" href="./Foo_bar">./Foo_bar</a>
27207 !! wikitext
27208 [[Foo_bar]]
27209 [[Foo bar]]
27210 [[Foo_bar|./Foo_bar]]
27211 !! end
27212
27213 !! test
27214 New category links (href variations)
27215 !! options
27216 parsoid=html2wt
27217 !! html/parsoid
27218 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne" />
27219 <link rel="mw:PageProp/Category" href="./Category:Toxine_bact%C3%A9rienne" />
27220 <link rel="mw:PageProp/Category" href="Category:Toxine_bact%C3%A9rienne" />
27221 !! wikitext
27222 [[Category:Toxine bactérienne]]
27223 [[Category:Toxine bactérienne]]
27224 [[Category:Toxine bactérienne]]
27225 !! end
27226
27227 !! test
27228 New sol transparent links don't need indent-pre nowiki protection
27229 !! options
27230 parsoid=html2wt
27231 language=de
27232 !! html/parsoid
27233 <link rel="mw:PageProp/redirect" href="./Main_Page">
27234 <!-- this is good --> <link rel="mw:PageProp/Category" href="./Category:Good" />
27235 <!-- this is great --> <link rel="mw:PageProp/Category" href="./Kategorie:Great" />
27236 !! wikitext
27237 #WEITERLEITUNG [[Main Page]]
27238 <!-- this is good --> [[Category:Good]]
27239 <!-- this is great --> [[Kategorie:Great]]
27240 !! end
27241
27242 !! test
27243 New interlanguage links (href variations)
27244 !! options
27245 parsoid=html2wt
27246 !! html/parsoid
27247 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine bactérienne" />
27248 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bactérienne" />
27249 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bact%C3%A9rienne" />
27250 !! wikitext
27251 [[es:Toxine bactérienne]]
27252 [[es:Toxine_bactérienne]]
27253 [[es:Toxine_bactérienne]]
27254 !! end
27255
27256 !! test
27257 Image: Modifying size of an image (1)
27258 !! options
27259 parsoid={
27260 "modes": ["wt2wt"],
27261 "changes": [
27262 ["img[height]", "attr", "height", "22"],
27263 ["img[width]", "attr", "width", "200"]
27264 ]
27265 }
27266 !! wikitext
27267 [[Image:Foobar.jpg|230x230px]]
27268 !! wikitext/edited
27269 [[Image:Foobar.jpg|200x200px]]
27270 !!end
27271
27272 !! test
27273 Image: Modifying size of an image (2)
27274 !! options
27275 parsoid={
27276 "modes": ["wt2wt"],
27277 "changes": [
27278 ["img[height]", "attr", "height", "100"],
27279 ["img[width]", "attr", "width", "500"]
27280 ]
27281 }
27282 !! wikitext
27283 [[Image:Foobar.jpg|230x230px]]
27284 !! wikitext/edited
27285 [[Image:Foobar.jpg|500x500px]]
27286 !!end
27287
27288 # Change in size is ignored so long as class='mw-default-size'
27289 !! test
27290 Image: Modifying size of an image (3)
27291 !! options
27292 parsoid={
27293 "modes": ["wt2wt"],
27294 "changes": [
27295 ["figure[class]", "removeClass", "mw-default-size"],
27296 ["figure img", "attr", "height", "19"],
27297 ["figure img", "attr", "width", "170"]
27298 ]
27299 }
27300 !! wikitext
27301 [[Image:Foobar.jpg|thumb]]
27302 !! wikitext/edited
27303 [[Image:Foobar.jpg|thumb|170x170px]]
27304 !!end
27305
27306 !! test
27307 Image: Modifying alignment of an image (T50665)
27308 !! options
27309 parsoid={
27310 "modes": ["wt2wt"],
27311 "changes": [
27312 ["figure[class]", "removeClass", "mw-halign-right"],
27313 ["figure[class]", "addClass", "mw-halign-left"]
27314 ]
27315 }
27316 !! wikitext
27317 [[Image:Foobar.jpg|thumb|caption|right]]
27318 !! wikitext/edited
27319 [[Image:Foobar.jpg|thumb|caption|left]]
27320 !! end
27321
27322 !! test
27323 Image: Modifying mw-default-size of an frameless image (T64805)
27324 !! options
27325 parsoid={
27326 "modes": ["wt2wt"],
27327 "changes": [
27328 ["figure.mw-default-size", "removeClass", "mw-default-size"]
27329 ]
27330 }
27331 !! wikitext
27332 [[Image:Foobar.jpg|frameless|right]]
27333 !! wikitext/edited
27334 [[Image:Foobar.jpg|frameless|right|220x220px]]
27335 !! end
27336
27337 !! test
27338 Image: Modifying valign of an image (T51221)
27339 !! options
27340 parsoid={
27341 "modes": ["wt2wt"],
27342 "changes": [
27343 ["*[typeof=\"mw:Image\"]", "removeClass", "mw-valign-middle"],
27344 ["*[typeof=\"mw:Image\"]", "addClass", "mw-valign-text-top"]
27345 ]
27346 }
27347 !! wikitext
27348 [[File:Foobar.jpg|20px|middle]]
27349 !! wikitext/edited
27350 [[File:Foobar.jpg|20px|text-top]]
27351 !! end
27352
27353 !! test
27354 Image: Modifying alt attribute of an image (T58400)
27355 !! options
27356 parsoid={
27357 "modes": ["wt2wt"],
27358 "changes": [
27359 ["img[alt]", "attr", "alt", "some alternate edited text"]
27360 ]
27361 }
27362 !! wikitext
27363 [[File:Foobar.jpg|thumb|some caption|alt=some alternate text]]
27364 !! wikitext/edited
27365 [[File:Foobar.jpg|thumb|some caption|alt=some alternate edited text]]
27366 !!end
27367
27368 !! test
27369 Image: Modifying caption of an image
27370 !! options
27371 parsoid={
27372 "modes": ["wt2wt"],
27373 "changes": [
27374 ["figcaption", "text", "new caption"]
27375 ]
27376 }
27377 !! wikitext
27378 [[Image:Foobar.jpg|thumb|original caption]]
27379 !! wikitext/edited
27380 [[Image:Foobar.jpg|thumb|new caption]]
27381 !!end
27382
27383 !! test
27384 Image: empty alt attribute (T50924)
27385 !! options
27386 parsoid
27387 !! wikitext
27388 [[File:Foobar.jpg|thumb|alt=|bar]]
27389 !! html
27390 <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>
27391 !! end
27392
27393 !! test
27394 Image: new attributes should be serialized in wiki's language for RTL languages (T53852)
27395 !! options
27396 parsoid=html2wt
27397 language=ar
27398 disabled
27399 !! html/parsoid
27400 <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>
27401 !! wikitext
27402 [[Imagen:Foobar.jpg|derecha|miniaturadeimagen]]
27403 !! end
27404
27405 !! test
27406 Image: Block level image should have \n before and after
27407 !! wikitext
27408 123
27409 [[File:Foobar.jpg|right|thumb|150x150px]]
27410 456
27411 !! html/parsoid
27412 <p>123</p>
27413 <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>
27414 <p>456</p>
27415 !! end
27416
27417 !! test
27418 Image: New block level image should have \n before and after (existing content)
27419 !! wikitext
27420 123
27421 [[File:Foobar.jpg|right|thumb|150x150px]]
27422 456
27423 !! html/parsoid
27424 <p>123</p>
27425 <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>
27426 <p>456</p>
27427 !! end
27428
27429 !! test
27430 Image: upright option (parsoid)
27431 !! wikitext
27432 [[File:Foobar.jpg|thumb|upright|caption]]
27433 [[File:Foobar.jpg|thumb|upright=0.5|caption]]
27434 [[File:Foobar.jpg|thumb|500x500px|upright=0.5|caption]]
27435 !! html/parsoid
27436 <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>
27437 <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>
27438 <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>
27439 !! end
27440
27441 !! test
27442 Image: upright option is ignored on inline and frame images (parsoid)
27443 !! wikitext
27444 [[File:Foobar.jpg|500x500px|upright=0.5|caption]]
27445 !! html/parsoid
27446 <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>
27447 !! end
27448
27449 !! test
27450 Image: in template parameter with empty parameter
27451 !! wikitext
27452 {{echo|[[File:Foobar.jpg|link=]]}}
27453 !! html/parsoid
27454 <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>
27455 !! end
27456
27457 !! test
27458 Image: from basic HTML (1)
27459 !! options
27460 parsoid=html2wt
27461 !! html/parsoid
27462 <span typeof="mw:Image">
27463 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
27464 </span>
27465 !! wikitext
27466 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
27467 !! end
27468
27469 !! test
27470 Image: from basic HTML (2)
27471 !! options
27472 parsoid=html2wt
27473 !! html/parsoid
27474 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
27475 !! wikitext
27476 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
27477 !! end
27478
27479 !! test
27480 Image: from basic HTML (3)
27481 !! options
27482 parsoid=html2wt
27483 !! html/parsoid
27484 <a href="Main"><img src="./File:Foobar.jpg" width=100 height=100 alt="Alt"></a>
27485 !! wikitext
27486 [[File:Foobar.jpg|link=Main|alt=Alt|100x100px]]
27487 !! end
27488
27489 !! test
27490 Image: from basic HTML (4)
27491 !! options
27492 parsoid=html2wt
27493 !! html/parsoid
27494 <img src="./File:Foobar.jpg">
27495 !! wikitext
27496 [[File:Foobar.jpg|link=]]
27497 !! end
27498
27499 !! test
27500 Image: Invalid title as link
27501 !! wikitext
27502 [[File:Foobar.jpg|link=<]]
27503 !! html/php
27504 <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>
27505 </p>
27506 !! html/parsoid
27507 <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>
27508 !! end
27509
27510 !! test
27511 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
27512 !! options
27513 parsoid=html2wt
27514 !! html/parsoid
27515 <ul>
27516 <li><p>foo</p></li>
27517 </ul>
27518 !! wikitext
27519 * foo
27520 !! end
27521
27522 !! test
27523 Lists: Serialize correctly even when list tags has unneeded whitespace between tags
27524 !! options
27525 parsoid=html2wt
27526 !! html/parsoid
27527 <ul> <li>foo</li></ul>
27528 !! wikitext
27529 * foo
27530 !! end
27531
27532 !! test
27533 Don't strip leading whitespace when handling indent-pre suppressing tags
27534 !! options
27535 parsoid=html2wt
27536 !! html/parsoid
27537 <table>
27538 <tr><td> indented row</td></tr>
27539 </table>
27540 <blockquote><p>
27541 <b>This is very bold of you!</b>
27542 </p>
27543 <table><tr><td>
27544 indented cell (no pre-wrapping!)
27545 </td></tr></table>
27546 </blockquote>
27547 <p>foo</p>
27548 <div>bar</div>
27549 !! wikitext
27550 {|
27551 | indented row
27552 |}
27553 <blockquote>
27554 '''This is very bold of you!'''
27555
27556 {|
27557 |
27558 indented cell (no pre-wrapping!)
27559 |}
27560 </blockquote>
27561 foo
27562 <div>bar</div>
27563 !! end
27564
27565 !! test
27566 Nowiki-wrap leading whitespace when handling indent-pre inducing tags
27567 !! options
27568 parsoid=html2wt
27569 !! html/parsoid
27570 <p>foo</p>
27571 <span>bar</span>
27572
27573 <span>foo2
27574 </span>bar2
27575
27576 <div>foo</div>
27577 <span>bar</span>
27578
27579 <div>
27580 <span>foo</span>
27581 </div>
27582 !! wikitext
27583 foo
27584
27585 <span>bar</span>
27586
27587 <span>foo2
27588 <nowiki> </nowiki></span>bar2
27589
27590 <div>foo</div>
27591 <nowiki> </nowiki><span>bar</span>
27592
27593 <div>
27594 <nowiki> </nowiki><span>foo</span>
27595 </div>
27596 !! end
27597
27598 !! test
27599 Lists: Dont insert newlines in a serialized list item.
27600 !! options
27601 parsoid=html2wt
27602 !! html/parsoid
27603 <ul><li>a<br>b</li><li>c</li></ul>
27604 !! wikitext
27605 * a<br>b
27606 * c
27607 !! end
27608
27609 !! test
27610 1. Headings: Force sol-transparent links and behavior switches to serialize before/after
27611 !! options
27612 parsoid={
27613 "modes": ["html2wt"],
27614 "scrubWikitext": false
27615 }
27616 !! html/parsoid
27617 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
27618 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
27619
27620 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
27621 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
27622
27623 <h2 data-parsoid='{}'>howdy<link href="./Category:A5" rel="mw:PageProp/Category" /></h2>
27624
27625 <h2><meta property="mw:PageProp/toc" /> ok</h2>
27626 !! wikitext
27627 == hello there [[Category:A1]] ==
27628
27629 == [[Category:A2]] hi pal ==
27630
27631 == <!--foo--> [[Category:A3]] how goes it ==
27632
27633 == it goes well [[Category:A4]] <!--bar--> ==
27634
27635 ==howdy [[Category:A5]]==
27636
27637 == __TOC__ ok ==
27638 !! end
27639
27640 !! test
27641 2. Headings: Force sol-transparent links and behavior switches to serialize before/after
27642 !! options
27643 parsoid={
27644 "modes": ["html2wt"],
27645 "scrubWikitext": true
27646 }
27647 !! html/parsoid
27648 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
27649 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
27650
27651 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
27652 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
27653
27654 <h2><meta property="mw:PageProp/toc" /> ok</h2>
27655 !! wikitext
27656 == hello there ==
27657 [[Category:A1]]
27658 [[Category:A2]]
27659
27660 == hi pal ==
27661
27662 <!--foo--> [[Category:A3]]
27663
27664 == how goes it ==
27665
27666 == it goes well ==
27667 [[Category:A4]] <!--bar-->
27668
27669 __TOC__
27670
27671 == ok ==
27672 !! end
27673
27674 !! test
27675 Headings: Don't hoist metas that come from templates
27676 !! options
27677 parsoid={
27678 "modes": ["html2wt"],
27679 "scrubWikitext": true
27680 }
27681 !! html/parsoid
27682 <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>
27683 !! wikitext
27684 == {{echo|foo [[Category:Foo]]}} ==
27685 !! end
27686
27687 !! test
27688 Headings: Category in ref isn't hoisted
27689 !! options
27690 parsoid={
27691 "modes": ["html2wt"],
27692 "scrubWikitext": true
27693 }
27694 !! html/parsoid
27695 <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>
27696
27697 <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>
27698 !! wikitext
27699 == foo <ref>bar
27700 [[Category:Baz]] </ref> ==
27701
27702 <references />
27703 !! end
27704
27705 !! test
27706 Parsoid: Serialize positional parameters with = in them as named parameter
27707 !! options
27708 parsoid=html2wt
27709 !! html/parsoid
27710 <p about="#mwt1" typeof="mw:Transclusion"
27711 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
27712
27713 <p about="#mwt1" typeof="mw:Transclusion"
27714 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}, "2":{"wt":"bar"}},"i":0}}]}'>foo</p>
27715
27716 <!--Orig params with data-parsoid has heuristics for handling = chars-->
27717 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
27718 <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>
27719 !! wikitext
27720 {{echo|1=f=oo}}
27721
27722 {{echo|1=f=oo|2=bar}}
27723
27724 <!--Orig params with data-parsoid has heuristics for handling = chars-->
27725 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
27726 {{echo|<nowiki>f=oo</nowiki>|bar}}
27727 !! end
27728
27729 !! test
27730 Parsoid: Serialize positional parameters with = in extlink as named parameter
27731 !! options
27732 parsoid=html2wt
27733 !! html/parsoid
27734 <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>
27735 !! wikitext
27736 {{echo|1=http://stuff?is=ok}}
27737 !! end
27738
27739 !! test
27740 Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
27741 !! options
27742 parsoid=html2wt
27743 !! html/parsoid
27744 <div>a<p>b</p></div>
27745 <div>a
27746 <p>b</p></div>
27747 <div>
27748 a
27749 <p>b</p></div>
27750 !! wikitext
27751 <div>a
27752 b
27753 </div>
27754 <div>a
27755 b
27756 </div>
27757 <div>
27758 a
27759
27760 b
27761 </div>
27762 !! end
27763
27764 !! test
27765 Substrings resembling wikitext in hrefs should not get nowiki escapes
27766 !! options
27767 parsoid=html2wt
27768 !! html/parsoid
27769 <a rel="mw:WikiLink" href="./Foo''bar''baz">Foo''bar''baz</a>
27770 !! wikitext
27771 [[Foo''bar''baz]]
27772 !! end
27773
27774 !! test
27775 Enforce single-line context in the serializer
27776 !! options
27777 parsoid=html2wt
27778 !! html/parsoid
27779 <h2>testing
27780 123</h2>
27781
27782 <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">
27783 </span><span about="#mwt1">you</span> </h2>
27784
27785 <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>
27786
27787 <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
27788 there</span></li></ol>
27789
27790 <ul><li>asd
27791 sdf</li></ul>
27792
27793 <ul><li>foo
27794 bar
27795 baz</li>
27796 <li>foo <b>bar</b>
27797 baz</li></ul>
27798
27799 <dl><dt>hi
27800 ho </dt><dd data-parsoid='{"stx":"row"}'> hi
27801 ho</dd></dl>
27802
27803 <dl><dd> <table>
27804 <tbody><tr><td> ha
27805 ha
27806 ha</td></tr>
27807 </tbody></table></dd></dl>
27808 !! wikitext
27809 == testing 123 ==
27810
27811 == hi {{bogus|there
27812 you}} ==
27813
27814 == foo <ref>hello
27815 there</ref> ==
27816
27817 <references />
27818
27819 * asd sdf
27820
27821 * foo bar baz
27822 * foo '''bar''' baz
27823
27824 ; hi ho : hi ho
27825
27826 : {|
27827 | ha
27828 ha
27829 ha
27830 |}
27831 !! end
27832
27833 !! test
27834 Serialize new placeholder space without spans
27835 !! options
27836 parsoid=html2wt
27837 !! html/parsoid
27838 <p>foo<span typeof="mw:Placeholder"> </span>: bar</p>
27839
27840 <p>foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span>: bar</p>
27841
27842 <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>
27843 !! wikitext
27844 foo : bar
27845
27846 foo : bar
27847
27848 <ref>foo : bar</ref>ok
27849 !! end
27850
27851
27852 #-----------------------
27853 # Tag minimization tests
27854 #-----------------------
27855
27856 !! test
27857 1. I/B quote minimization: wikitext-only tags should be combined
27858 !! options
27859 parsoid=html2wt
27860 !! html/parsoid
27861 <p><i>A</i><i>B</i></p>
27862 <p><b>A</b><b>B</b></p>
27863 <p><i>A</i><b><i>B</i></b></p>
27864 <p><b>A</b><i><b>B</b></i></p>
27865 <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
27866 <p><i><b>A</b></i><i><b>B</b></i></p>
27867 <p><i><b>A</b></i><b><i>B</i></b></p>
27868 <p><b><i>A</i></b><i><b>B</b></i></p>
27869 !! wikitext
27870 ''AB''
27871
27872 '''AB'''
27873
27874 ''A'''B'''''
27875
27876 '''A''B'''''
27877
27878 '''A''BC''D'''
27879
27880 '''''AB'''''
27881
27882 '''''AB'''''
27883
27884 '''''AB'''''
27885 !! end
27886
27887 !! test
27888 2. I/B quote minimization: wikitext and html tags should not be combined
27889 !! options
27890 parsoid=html2wt
27891 !! html/parsoid
27892 <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
27893 <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
27894 !! wikitext
27895 ''A''<i>B</i>
27896
27897 ''A''<nowiki/>'''<i>B</i>'''
27898 !! end
27899
27900 !! test
27901 3. I/B quote minimization: templated content stops minimization
27902 !! options
27903 parsoid=html2wt
27904 !! html/parsoid
27905 <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>
27906 <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>
27907 !! wikitext
27908 ''A''{{echo|''B''}}
27909
27910 ''A''{{echo|'''''B'''''}}
27911 !! end
27912
27913 !! test
27914 4. I/B quote minimization: new content should be mimimized with adjacent old content
27915 !! options
27916 parsoid=html2wt
27917 !! html/parsoid
27918 <p><i>A</i><i>B</i></p>
27919 <p><b>A</b><b>B</b></p>
27920 <p><i>A</i><b><i>B</i></b></p>
27921 !! wikitext
27922 ''AB''
27923
27924 '''AB'''
27925
27926 ''A'''B'''''
27927 !! end
27928
27929 !! test
27930 5a. Merge adjacent quote nodes if they've been edited
27931 !! options
27932 parsoid={
27933 "modes": ["wt2wt", "selser"],
27934 "changes": [
27935 ["p", "contents", "remove", ":contains('b')"]
27936 ]
27937 }
27938 !! wikitext
27939 ''a''b''c''
27940 !! wikitext/edited
27941 ''ac''
27942 !! end
27943
27944 !! test
27945 5b. Merge adjacent quote nodes if they've been edited
27946 !! options
27947 parsoid={
27948 "modes": ["wt2wt", "selser"],
27949 "changes": [
27950 ["#x", "remove"]
27951 ]
27952 }
27953 !! wikitext
27954 ''a''<span id="x">b</span>''c''
27955 !! wikitext/edited
27956 ''ac''
27957 !! end
27958
27959 !! test
27960 1. Merge adjacent link nodes as long as at least one element is new
27961 !! options
27962 parsoid={
27963 "modes": ["html2wt"],
27964 "scrubWikitext": true
27965 }
27966 !! html/parsoid
27967 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
27968 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
27969 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a data-parsoid="{}" rel="mw:WikiLink" href="./Football">ball</a>
27970 !! wikitext
27971 [[Football]]
27972 [[Football]]
27973 [[Football|Foot]][[Football|ball]]
27974 !! end
27975
27976 !! test
27977 2. Merge adjacent link nodes and enable additional normalizations
27978 !! options
27979 parsoid={
27980 "modes": ["html2wt"],
27981 "scrubWikitext": true
27982 }
27983 !! html/parsoid
27984 <a rel="mw:WikiLink" href="./Football"><i>Foot</i></a><a rel="mw:WikiLink" href="./Football"><i>ball</i></a>
27985 !! wikitext
27986 [[Football|''Football'']]
27987 !! end
27988
27989 !! test
27990 3. Don't merge adjacent link nodes if scrubWikitext is false
27991 !! options
27992 parsoid={
27993 "modes": ["html2wt"],
27994 "scrubWikitext": false
27995 }
27996 !! html/parsoid
27997 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
27998 !! wikitext
27999 [[Football|Foot]][[Football|ball]]
28000 !! end
28001
28002 #------------------------------
28003 # End of tag minimization tests
28004 #------------------------------
28005
28006 !!test
28007 T56262: New entities
28008 !! options
28009 parsoid=html2wt
28010 !! html/parsoid
28011 <span typeof="mw:Entity">&nbsp;</span>
28012 !! wikitext
28013 &nbsp;
28014 !! end
28015
28016 ## Note that there is no wikitext output for 'unknownproperty' ##
28017 ## Unknown magic words are silently dropped ##
28018
28019 !! test
28020 Magic words
28021 !! options
28022 parsoid=html2wt
28023 !! html/parsoid
28024 <meta property='mw:PageProp/toc' />
28025 <meta property='mw:PageProp/notoc' />
28026 <meta property='mw:PageProp/forcetoc' />
28027 <meta property='mw:PageProp/index' />
28028 <meta property='mw:PageProp/noindex' />
28029 <meta property='mw:PageProp/nogallery' />
28030 <meta property='mw:PageProp/noeditsection' />
28031 <meta property='mw:PageProp/notitleconvert' />
28032 <meta property='mw:PageProp/nocontentconvert' />
28033 <meta property='mw:PageProp/unknownproperty' />
28034 !! wikitext
28035 __TOC__
28036 __NOTOC__
28037 __FORCETOC__
28038 __INDEX__
28039 __NOINDEX__
28040 __NOGALLERY__
28041 __NOEDITSECTION__
28042 __NOTITLECONVERT__
28043 __NOCONTENTCONVERT__
28044 !! end
28045
28046 !! test
28047 Consecutive <pre>s should not get merged
28048 !! options
28049 parsoid=html2wt,html2html
28050 !! html/parsoid
28051 <pre>a</pre><pre>b</pre>
28052
28053 <pre>c
28054 </pre><pre>
28055 d</pre>
28056
28057 <pre>e
28058
28059 </pre><pre>
28060
28061 f</pre>
28062 !! wikitext
28063 a
28064
28065 b
28066
28067 c
28068
28069 d
28070
28071 e
28072
28073
28074
28075 f
28076 !! end
28077
28078 !! test
28079 Edited ISBN links not serializable as ISBN links should serialize as wikilinks
28080 !! options
28081 parsoid=html2wt
28082 !! html/parsoid
28083 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink">ISBN 1234567895</a>
28084 !! wikitext
28085 [[Special:BookSources/1234567890|ISBN 1234567895]]
28086 !! end
28087
28088 !! test
28089 Edited RFC links not serializable as RFC links should serialize as extlinks
28090 !! options
28091 parsoid=html2wt
28092 !! html/parsoid
28093 <a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink">New RFC</a>
28094 !! wikitext
28095 [https://tools.ietf.org/html/rfc123 New RFC]
28096 !! end
28097
28098 !! test
28099 Edited PMID links not serializable as PMID links should serialize as extlinks
28100 !! options
28101 parsoid=html2wt
28102 !! html/parsoid
28103 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink">New PMID</a>
28104 !! wikitext
28105 [//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract New PMID]
28106 !! end
28107
28108 !! test
28109 WTS of autolinks with trailing/surrounding context
28110 !! options
28111 parsoid=html2wt
28112 !! html/parsoid
28113 <p><a href="http://cscott.net">http://cscott.net</a><b>foo</b></p>
28114 <p><a href="http://cscott.net">http://cscott.net</a><b data-parsoid='{"stx":"html"}'>foo</b></p>
28115 <p><b><a href="http://cscott.net">http://cscott.net</a></b></p>
28116 <p><b><a href="http://cscott.net">http://cscott.net</a> </b></p>
28117 <p><b><a href="http://cscott.net">http://cscott.net</a>x</b></p>
28118 <p><a href="http://cscott.net">http://cscott.net</a>x</p>
28119 !! wikitext
28120 http://cscott.net'''foo'''
28121
28122 http://cscott.net<b>foo</b>
28123
28124 '''http://cscott.net'''
28125
28126 '''http://cscott.net '''
28127
28128 '''http://cscott.net<nowiki/>x'''
28129
28130 http://cscott.net<nowiki/>x
28131 !! end
28132
28133 !! test
28134 WTS of autolinks with nowikis (round-trip)
28135 !! wikitext
28136 x<nowiki/>http://cscott.net<nowiki/>x
28137 !! html/parsoid
28138 <p>x<a rel="mw:ExtLink" href="http://cscott.net">http://cscott.net</a>x</p>
28139 !! end
28140
28141 # this is the "easy" test because it leaves in place all the
28142 # data-parsoid information indicating this is an autolink
28143 !! test
28144 WTS of autolinks with escapes (editing)
28145 !! options
28146 parsoid={
28147 "modes": ["wt2wt"],
28148 "changes": [
28149 [ "span", "remove" ]
28150 ]
28151 }
28152 !! wikitext
28153 x<nowiki/>http://cscott.net<nowiki/>x
28154 !! wikitext/edited
28155 x<nowiki/>http://cscott.net<nowiki/>x
28156 !! end
28157
28158 !! test
28159 WTS of edited autolink-like text (T103364)
28160 !! options
28161 parsoid={
28162 "modes": ["wt2wt"],
28163 "changes": [
28164 [ "span[typeof]", "removeAttr", "typeof" ]
28165 ]
28166 }
28167 !! wikitext
28168 Not a link: <nowiki>http://example.com</nowiki>.
28169 !! wikitext/edited
28170 Not a link: <span><nowiki>http://example.com</nowiki></span>.
28171 !! end
28172
28173 !! test
28174 WTS of newly-authored autolink-like text (T103364)
28175 !! options
28176 parsoid=html2wt
28177 !! html/parsoid
28178 <p>http://example.com is not a link.</p>
28179 !! wikitext
28180 <nowiki>http://example.com</nowiki> is not a link.
28181 !! end
28182
28183 !! test
28184 WTS of autolink-like text after an autolink (T108563)
28185 !! options
28186 parsoid=html2wt
28187 !! html/parsoid
28188 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a> http://example.com is not a link.</p>
28189 !! wikitext
28190 http://example.com <nowiki>http://example.com</nowiki> is not a link.
28191 !! end
28192
28193 !! test
28194 Magic links inside links (not autolinked)
28195 !! wikitext
28196 [[Foo|http://example.com]]
28197 [[Foo|RFC 1234]]
28198 [[Foo|PMID 1234]]
28199 [[Foo|ISBN 123456789x]]
28200
28201 [http://foo.com http://example.com]
28202 [http://foo.com RFC 1234]
28203 [http://foo.com PMID 1234]
28204 [http://foo.com ISBN 123456789x]
28205 !! html+tidy
28206 <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>
28207 <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>
28208 !! html/parsoid
28209 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">http://example.com</a>
28210 <a rel="mw:WikiLink" href="./Foo" title="Foo">RFC 1234</a>
28211 <a rel="mw:WikiLink" href="./Foo" title="Foo">PMID 1234</a>
28212 <a rel="mw:WikiLink" href="./Foo" title="Foo">ISBN 123456789x</a></p>
28213
28214 <p><a rel="mw:ExtLink" href="http://foo.com">http://example.com</a>
28215 <a rel="mw:ExtLink" href="http://foo.com">RFC 1234</a>
28216 <a rel="mw:ExtLink" href="http://foo.com">PMID 1234</a>
28217 <a rel="mw:ExtLink" href="http://foo.com">ISBN 123456789x</a></p>
28218 !! end
28219
28220 !! test
28221 Magic links inside image captions (autolinked)
28222 !! wikitext
28223 [[File:Foobar.jpg|thumb|http://example.com]]
28224 [[File:Foobar.jpg|thumb|RFC 1234]]
28225 [[File:Foobar.jpg|thumb|PMID 1234]]
28226 [[File:Foobar.jpg|thumb|ISBN 123456789x]]
28227 !! html+tidy
28228 <div class="thumb tright">
28229 <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>
28230 <div class="thumbcaption">
28231 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
28232 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></div>
28233 </div>
28234 </div>
28235 <div class="thumb tright">
28236 <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>
28237 <div class="thumbcaption">
28238 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
28239 <a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc1234">RFC 1234</a></div>
28240 </div>
28241 </div>
28242 <div class="thumb tright">
28243 <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>
28244 <div class="thumbcaption">
28245 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
28246 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a></div>
28247 </div>
28248 </div>
28249 <div class="thumb tright">
28250 <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>
28251 <div class="thumbcaption">
28252 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
28253 <a href="/wiki/Special:BookSources/123456789X" class="internal mw-magiclink-isbn">ISBN 123456789x</a></div>
28254 </div>
28255 </div>
28256 !! html/parsoid
28257 <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>
28258 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption><a href="https://tools.ietf.org/html/rfc1234" rel="mw:ExtLink">RFC 1234</a></figcaption></figure>
28259 <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>
28260 <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>
28261 !! end
28262
28263 !! test
28264 WTS of magic word text (T109371)
28265 !! options
28266 parsoid=html2wt
28267 !! html/parsoid
28268 <p>RFC 1234</p>
28269 <p><a href="http://foo.com" rel="mw:ExtLink">RFC 1234</a></p>
28270 <p><a href="./Foo" rel="mw:WikiLink">RFC 1234</a></p>
28271 !! wikitext
28272 <nowiki>RFC 1234</nowiki>
28273
28274 [http://foo.com RFC 1234]
28275
28276 [[Foo|RFC 1234]]
28277 !! end
28278
28279 !! test
28280 Edited Redirect link should emit a non-piped wikitext link
28281 !! options
28282 parsoid=html2wt
28283 !! html/parsoid
28284 <link rel="mw:PageProp/redirect" href="Bar" data-parsoid='{"a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>
28285 !! wikitext
28286 #REDIRECT [[Bar]]
28287 !! end
28288
28289 !! test
28290 T75121: Infer extension name from typeOf if data-mw is not present
28291 !! options
28292 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
28293 !! html/parsoid
28294 <div typeOf="mw:Extension/foo"></div>
28295 !! wikitext
28296 <foo />
28297 !! end
28298
28299 # Note that the <p> wrapping isn't present in PHP parser output
28300 # The important thing for this test is that P-wrapping doesn't
28301 # interfere with the <nowiki> protection for leading - in <td>
28302 # (which isn't necessary for <th>).
28303 !! test
28304 T88318: p-wrapped dash in table.
28305 !! options
28306 parsoid=html2wt,wt2wt
28307 !! html/parsoid
28308 <table><tbody>
28309 <tr><th><p>-</p></th><th><p>- </p></th></tr>
28310 <tr><td><p>-</p></td><td><p>- </p></td></tr>
28311 <tr><td><small>-</small></td><td><br/><p>-</p></td><td><br/>-</td></tr>
28312 </tbody></table>
28313 !! wikitext
28314 {|
28315 !-
28316 !-
28317 |-
28318 |<nowiki>-</nowiki>
28319 |<nowiki>- </nowiki>
28320 |-
28321 |<small>-</small>
28322 |<br>
28323 -
28324 |<br>
28325 -
28326 |}
28327 !! html/php+tidy
28328 <table>
28329 <tr>
28330 <th>-</th>
28331 <th>-</th>
28332 </tr>
28333 <tr>
28334 <td>-</td>
28335 <td>-</td>
28336 </tr>
28337 <tr>
28338 <td><small>-</small></td>
28339 <td><br />
28340 <p>-</p>
28341 </td>
28342 <td><br />
28343 <p>-</p>
28344 </td>
28345 </tr>
28346 </table>
28347 !! end
28348
28349 !! test
28350 T149209: WTS: Handle newlines in table cells properly
28351 !! options
28352 parsoid=html2wt
28353 !! html/parsoid
28354 <table>
28355 <tbody>
28356 <tr><td>a
28357 b
28358 </td><td data-parsoid='{"stx":"row"}'>c</td></tr>
28359 <tr><td><p>x</p>
28360 </td><td data-parsoid='{"stx":"row", "startTagSrc": "{{!}}{{!}}"}'>y</td></tr>
28361 </tbody></table>
28362 <table>
28363 <tbody>
28364 <tr><th>a
28365 b
28366 </th><th data-parsoid='{"stx":"row"}'>c</th></tr>
28367 <tr><th><p>x</h>
28368 </th><th data-parsoid='{"stx":"row"}'>y</th></tr>
28369 </tbody></table>
28370 !! wikitext
28371 {|
28372 |a
28373 b
28374 |c
28375 |-
28376 |x
28377 {{!}}y
28378 |}
28379 {|
28380 !a
28381 b
28382 !c
28383 |-
28384 !x
28385 !y
28386 |}
28387 !! end
28388
28389 !! test
28390 T149209: Selser: Handle newlines in table cells properly
28391 !! options
28392 parsoid={
28393 "modes": ["selser"],
28394 "changes": [
28395 [ "#h1", "html", "a\nb\n" ],
28396 [ "#h2", "html", "a\nb\n" ],
28397 [ "#c1", "html", "a\nb\n" ],
28398 [ "#c2", "html", "<p>a</p>" ],
28399 [ "#c3", "html", "<p>a</p>" ],
28400 [ "#c4", "html", "edit-me<p>a</p>" ]
28401 ]
28402 }
28403 !! wikitext
28404 {|
28405 ! id="h1" |edit-me!!1
28406 |-
28407 ! id="h2" |edit-me||2
28408 |-
28409 | id="c1" |edit-me||3
28410 |-
28411 | id="c2" |edit-me||4
28412 |-
28413 | id="c3" |edit-me||p||q||r
28414 |-
28415 | id="c4" |edit-me||p||q||r
28416 |}
28417 !! wikitext/edited
28418 {|
28419 ! id="h1" |a
28420 b
28421 !1
28422 |-
28423 ! id="h2" |a
28424 b
28425 !2
28426 |-
28427 | id="c1" |a
28428 b
28429 |3
28430 |-
28431 | id="c2" |a
28432 |4
28433 |-
28434 | id="c3" |a
28435 |p||q||r
28436 |-
28437 | id="c4" |edit-me
28438 a
28439 |p||q||r
28440 |}
28441 !! end
28442
28443 !! test
28444 HTML id attribute with Parsoid-like element ids should not be serialized to wikitext
28445 !! options
28446 parsoid=html2wt
28447 !! html/parsoid
28448 <table id='mwAb'>
28449 <td id='mwAc'>foo</td>
28450 <td id='serialize-this'>bar</td>
28451 </table>
28452 !! wikitext
28453 {|
28454 |foo
28455 | id="serialize-this" |bar
28456 |}
28457 !! end
28458
28459 !! test
28460 Parsoid-like element ids should not be serialized to wikitext unless shadowed
28461 !! options
28462 parsoid=html2wt
28463 !! html/parsoid
28464 <div id="mwAQ" data-parsoid='{"stx":"html","a":{"id":"mwAQ"},"sa":{"id":"hello"}}'>ok</div>
28465 !! wikitext
28466 <div id="hello">ok</div>
28467 !! end
28468
28469 !! test
28470 WTS change modes
28471 !! options
28472 parsoid={
28473 "modes": ["wt2wt"],
28474 "changes": [
28475 [ "#xyz", "before", "<b>before</b> stuff " ],
28476 [ "#xyz", "after", " stuff <i>after</i>" ],
28477 [ "#xyz", "html", "x <b>y</b> z" ]
28478 ]
28479 }
28480 !! wikitext
28481 <span id="xyz">hello</span>
28482 !! wikitext/edited
28483 '''before''' stuff <span id="xyz">x '''y''' z</span> stuff ''after''
28484 !! end
28485
28486 !! test
28487 Never serialize a-tag as html, regardless of what data-parsoid has to say
28488 !! options
28489 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
28490 !! html/parsoid
28491 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"html"}'>Foo</a>
28492 !! wikitext
28493 [[Foo]]
28494 !! end
28495
28496 ## SSS FIXME: This is broken output nevertheless.
28497 ## What might be a reasonable non-broken output for this?
28498 ## This is an edge case unlikely to be seen in production
28499 ## that I am not wasting more time on this right now.
28500 !! test
28501 Never serialize a-tag as html, no matter what attributes it has
28502 !! options
28503 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
28504 !! html/parsoid
28505 <a bad='true' href='http://boo.org'><img src='http://boohoo.org' /></a>
28506 !! wikitext
28507 [http://boo.org http://boohoo.org]
28508 !! end
28509
28510 # Misnested is an indication that selser can reuse the source but these have
28511 # shown to sneak through on occasion. See T101768.
28512 # The original wikitext here is: [http://test.com [[one]] two three]
28513 !! test
28514 Strip span tags added to mark misnested links
28515 !! options
28516 parsoid=html2wt
28517 !! html/parsoid
28518 <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>
28519 !! wikitext
28520 [http://test.com][[one]] two three
28521 !! end
28522
28523 !! test
28524 Catch regression when unpacking misnested links
28525 !! options
28526 parsoid=wt2html
28527 !! wikitext
28528 {{echo|hi}}[http://example.com [[ho]]]
28529 !! html/parsoid
28530 <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>
28531 !! end
28532
28533 !! test
28534 Use data-parsoid.firstWikitextNode to compute newline constraints for template content
28535 !! options
28536 parsoid=html2wt
28537 !! html/parsoid
28538 <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|}"]}'>
28539 <tbody><tr><td>d
28540 </td></tr>
28541 </tbody></table>
28542 !! wikitext
28543 {{echo|a}}
28544 {|{{echo|c
28545 {{!}}d
28546 }}
28547 |}
28548 !! end
28549
28550 ## This test verifies the presence and computation of this attribute indirectly
28551 ## by making an edit and ensuring that the serialization is correct (which it would be
28552 ## only if firstWikitextNode is properly set).
28553 !! test
28554 data-parsoid.firstWikitextNode should be computed properly in the presence of fostered content
28555 !! options
28556 parsoid= {
28557 "modes": ["wt2wt"],
28558 "changes": [
28559 [ "div#x", "remove" ],
28560 [ "div", "before", "<div>new</div>" ]
28561 ]
28562 }
28563 !! wikitext
28564 <div id="x">foo</div>
28565 {|
28566 {{echo|<div>boo</div>
28567 {{!}}b}}
28568 |c
28569 |}
28570 !! wikitext/edited
28571
28572 <div>new</div>
28573 {|
28574 {{echo|<div>boo</div>
28575 {{!}}b}}
28576 |c
28577 |}
28578 !! end
28579
28580 # --------------------------------------------
28581 # Tests spec'ing wikitext serialization norms |
28582 # --------------------------------------------
28583
28584 !! test
28585 Serialize multi-line indent-pre starting with wikitext syntax
28586 !! options
28587 parsoid=html2wt
28588 !! html/parsoid
28589 <pre>* 1
28590 ** 2
28591 * 3</pre>
28592 !! wikitext
28593 * 1
28594 ** 2
28595 * 3
28596 !! end
28597
28598 !! test
28599 1. Categories should always be serialized on their own line
28600 !! options
28601 parsoid=html2wt
28602 !! html/parsoid
28603 foo<link rel="mw:PageProp/Category" href="./Category:Foo">bar
28604 !! wikitext
28605 foo
28606 [[Category:Foo]]
28607 bar
28608 !! end
28609
28610 !! test
28611 2. Categories that are part of templates should not introduce a line break
28612 !! wikitext
28613 foo {{echo|<span>bar</span> [[Category:baz]]}} bar
28614 !! html/parsoid
28615 <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>
28616 !! end
28617
28618 # Careful while editing these next 2 tests. There are \u200f characters
28619 # before and after the <link> tags in the HTML and following some
28620 # of the categories in wikitext
28621 # Do not remove these characters in edits.
28622 #
28623 # As part of the serialization, these bidi characters will get stripped.
28624 !! test
28625 RTL (\u200f) and LTR (\u200e) markers around category tags should be stripped
28626 !! options
28627 parsoid={
28628 "modes": ["html2wt"],
28629 "scrubWikitext": true
28630 }
28631 !! html/parsoid
28632 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏
28633 ‏<link rel="mw:PageProp/Category" href="./קטגוריה:_שיטות_משפט" />‏</p>
28634 !! wikitext
28635 [[קטגוריה:טקסים]]
28636 [[קטגוריה: שיטות משפט]]
28637 !! end
28638
28639 !! test
28640 RTL (\u200f) and LTR (\u200e) markers should not be stripped if followed by a text node
28641 !! options
28642 parsoid={
28643 "modes": ["html2wt"],
28644 "scrubWikitext": true
28645 }
28646 !! html/parsoid
28647 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏y</p>
28648 !! wikitext
28649 [[קטגוריה:טקסים]]
28650 ‏y
28651 !! end
28652
28653 !! test
28654 Lists: Add space after bullets
28655 !! options
28656 parsoid=html2wt
28657 !! html/parsoid
28658 <ul>
28659 <li>foo</li>
28660 <li> bar</li>
28661 <li><span> baz</span></li>
28662 </ul>
28663 !! wikitext
28664 * foo
28665 * bar
28666 * <span> baz</span>
28667 !! end
28668
28669 !! test
28670 1. Headings: Add space before/after == (T53744)
28671 !! options
28672 parsoid=html2wt
28673 !! html/parsoid
28674 <h2>foo</h2>
28675 <h2> bar</h2>
28676 <h2>baz </h2>
28677 <h2><span> baz</span></h2>
28678 !! wikitext
28679 == foo ==
28680
28681 == bar ==
28682
28683 == baz ==
28684
28685 == <span> baz</span> ==
28686 !! end
28687
28688 !! test
28689 2. Headings: Add space before/after == even after hoisted content
28690 !! options
28691 parsoid={
28692 "modes": ["html2wt"],
28693 "scrubWikitext": true
28694 }
28695 !! html/parsoid
28696 <h2> <link href="./Category:A2" rel="mw:PageProp/Category" />ok</h2>
28697 !! wikitext
28698 [[Category:A2]]
28699
28700 == ok ==
28701 !! end
28702
28703 !! test
28704 1. Headings: suppress newly created empty headings
28705 !! options
28706 parsoid={
28707 "modes": ["html2wt"],
28708 "scrubWikitext": true
28709 }
28710 !! html/parsoid
28711 <h2></h2>
28712 !! wikitext
28713 !! end
28714
28715 !! test
28716 2. Headings: don't suppress empty headings if scrubWikitext is false
28717 !! options
28718 parsoid=html2wt
28719 !! html/parsoid
28720 <h2></h2>
28721 !! wikitext
28722 ==<nowiki/>==
28723 !! end
28724
28725 !! test
28726 3. Headings: suppress empty headings on edits
28727 !! options
28728 parsoid={
28729 "modes": ["selser"],
28730 "scrubWikitext": true,
28731 "changes": [
28732 [ "#x", "remove"]
28733 ]
28734 }
28735 !! wikitext
28736 ==<span id="x">foo</span>==
28737 !! wikitext/edited
28738 !! end
28739
28740 !! test
28741 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = true)
28742 !! options
28743 parsoid={
28744 "modes": ["html2wt"],
28745 "scrubWikitext": true
28746 }
28747 !! html/parsoid
28748 <h2>foo<br/>bar</h2>
28749 <h2>foo <span><br/>bar</span> baz</h2>
28750 !! wikitext
28751 == foo bar ==
28752
28753 == foo <span> bar</span> baz ==
28754 !! end
28755
28756 !! test
28757 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = false)
28758 !! options
28759 parsoid={
28760 "modes": ["html2wt"],
28761 "scrubWikitext": false
28762 }
28763 !! html/parsoid
28764 <h2>foo<br/>bar</h2>
28765 !! wikitext
28766 == foo<br> bar ==
28767 !! end
28768
28769 !! test
28770 1. WT Quote Tags: suppress newly created empty style tags
28771 !! options
28772 parsoid={
28773 "modes": ["html2wt"],
28774 "scrubWikitext": true
28775 }
28776 !! html/parsoid
28777 <i></i><b></b>
28778 !! wikitext
28779 !! end
28780
28781 !! test
28782 2. WT Quote Tags: don't suppress empty style tags if scrubWikitext is false
28783 !! options
28784 parsoid=html2wt
28785 !! html/parsoid
28786 <i></i><b></b>
28787 !! wikitext
28788 ''<nowiki/>'''''<nowiki/>'''
28789 !! end
28790
28791 !! test
28792 3. WT Quote Tags: suppress empty style tags on edits
28793 !! options
28794 parsoid={
28795 "modes": ["selser"],
28796 "scrubWikitext": true,
28797 "changes": [
28798 [ "#x", "remove"]
28799 ]
28800 }
28801 !! wikitext
28802 '''<span id="x">foo</span>'''
28803 !! wikitext/edited
28804 !! end
28805
28806 !! test
28807 1. Anchors: suppress newly created empty anchors
28808 !! options
28809 parsoid={
28810 "modes": ["html2wt"],
28811 "scrubWikitext": true
28812 }
28813 !! html/parsoid
28814 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
28815 !! wikitext
28816 !! end
28817
28818 !! test
28819 2. Anchors: don't suppress empty anchors if scrubWikitext is false
28820 !! options
28821 parsoid={
28822 "modes": ["html2wt"],
28823 "scrubWikitext": false
28824 }
28825 !! html/parsoid
28826 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
28827 !! wikitext
28828 [[Test|<nowiki/>]]
28829 !! end
28830
28831 !! test
28832 3. Anchors: suppress empty anchors on edits
28833 !! options
28834 parsoid={
28835 "modes": ["selser"],
28836 "scrubWikitext": true,
28837 "changes": [
28838 [ "#x", "remove"]
28839 ]
28840 }
28841 !! wikitext
28842 [[Test|<span id="x">foo</span>]]
28843 !! wikitext/edited
28844 !! end
28845
28846 !! test
28847 3a. Anchors: do not suppress numbered extlinks
28848 !! options
28849 parsoid={
28850 "modes": ["wt2wt"],
28851 "scrubWikitext": true
28852 }
28853 !! wikitext
28854 [http://foo.com]
28855 !! html/parsoid
28856 <a rel="mw:ExtLink" href="http://foo.com"></a>
28857 !! end
28858
28859 !! test
28860 3b. Anchors: do not suppress numbered extlinks
28861 !! options
28862 parsoid={
28863 "modes": ["wt2wt"],
28864 "scrubWikitext": true,
28865 "changes": [
28866 [ "#x", "remove"]
28867 ]
28868 }
28869 !! wikitext
28870 [http://foo.com <span id="x">foo</span>]
28871 !! wikitext/edited
28872 [http://foo.com]
28873 !! end
28874
28875 !!test
28876 Normalizations should be restricted to edited content
28877 !!options
28878 parsoid={
28879 "modes": ["selser"],
28880 "scrubWikitext": true,
28881 "changes": [
28882 [ "h1", "before", "<i></i>"]
28883 ]
28884 }
28885 !!wikitext
28886 a
28887 = =
28888 b
28889 !!wikitext/edited
28890 a
28891 = =
28892 b
28893 !!end
28894
28895 !! test
28896 1. Multiple normalizations (html2wt)
28897 !! options
28898 parsoid={
28899 "modes": ["html2wt"],
28900 "scrubWikitext": true
28901 }
28902 !! html
28903 <h2><i></i></h2>
28904 <p><a href='Foo' rel='mw:WikiLink'>foo<i></i>
28905 </a><b><i></i></b>x</p>
28906 !! wikitext
28907
28908 [[foo]]
28909 x
28910
28911 !! end
28912
28913 !! test
28914 2. Multiple normalizations (selser)
28915 !! options
28916 parsoid={
28917 "modes": ["selser"],
28918 "scrubWikitext": true,
28919 "changes": [
28920 [ "#x", "after", "<h1><i></i></h1>\n<p> x<b></b></p>"]
28921 ]
28922 }
28923 !! wikitext
28924 <span id="x">foo</span>
28925 !! wikitext/edited
28926 <span id="x">foo</span>
28927
28928 x
28929 !! end
28930
28931 !! test
28932 1. Indent Pre Nowiki: suppress whitespace at the start of new paragraph
28933 !! options
28934 parsoid={
28935 "modes": ["html2wt"],
28936 "scrubWikitext": true
28937 }
28938 !! html/parsoid
28939 <p> hi</p>
28940 <p> hello</p>
28941 !! wikitext
28942 hi
28943
28944 hello
28945 !! end
28946
28947 !! test
28948 2. Indent Pre Nowiki: don't suppress whitespace at the start of new paragraph if scrubWikitext is false
28949 !! options
28950 parsoid=html2wt
28951 !! html/parsoid
28952 <p> hi</p>
28953 <p> hello</p>
28954 !! wikitext
28955 <nowiki> </nowiki>hi
28956
28957 <nowiki> </nowiki> hello
28958 !! end
28959
28960 !! test
28961 3. Indent Pre Nowiki: suppress whitespace after newlines in new paragraph or table cell
28962 !! options
28963 parsoid={
28964 "modes": ["html2wt"],
28965 "scrubWikitext": true
28966 }
28967 !! html/parsoid
28968 <p>Foo
28969 bar
28970 baz</p>
28971
28972 <table><tr><td>Foo
28973 bar
28974 baz bang</td></tr></table>
28975
28976 <p><!--boo--> foo
28977 bar</p>
28978
28979 <p> foo
28980 bar<span>boo</span></p>
28981 !! wikitext
28982 Foo
28983 bar
28984 baz
28985
28986 {|
28987 |Foo
28988 bar
28989 baz bang
28990 |}
28991
28992 <!--boo-->foo
28993 bar
28994
28995 foo
28996 bar<span>boo</span>
28997 !! end
28998
28999 !! test
29000 4. Indent Pre Nowiki: suppress leading whitespace in edited paragraphs
29001 !! options
29002 parsoid={
29003 "modes": ["selser"],
29004 "scrubWikitext": true,
29005 "changes": [
29006 [ "p", "html", " a\n b" ]
29007 ]
29008 }
29009 !! wikitext
29010 xyz
29011 !! wikitext/edited
29012 a
29013 b
29014 !! end
29015
29016 !! test
29017 1. New links that end in spaces
29018 !! options
29019 parsoid={
29020 "modes": ["html2wt"],
29021 "scrubWikitext": false
29022 }
29023 !! html/parsoid
29024 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
29025 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
29026 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
29027 !! wikitext
29028 [[Berlin ]]<nowiki/>is the capital of Germany.
29029
29030 [[Foo ]]'''bar'''
29031
29032 [[Boston ]] is a city.
29033 !! end
29034
29035 !! test
29036 2. New links that end in spaces
29037 !! options
29038 parsoid={
29039 "modes": ["html2wt"],
29040 "scrubWikitext": true
29041 }
29042 !! html/parsoid
29043 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
29044 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
29045 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
29046 !! wikitext
29047 [[Berlin]] is the capital of Germany.
29048
29049 [[Foo]] '''bar'''
29050
29051 [[Boston]] is a city.
29052 !! end
29053
29054 !! test
29055 1. Table cells with escapable prefixes
29056 !! options
29057 parsoid={
29058 "modes": ["html2wt"],
29059 "scrubWikitext": false
29060 }
29061 !! html
29062 <table>
29063 <tr><td>a</td></tr>
29064 <tr><td>-</td></tr>
29065 <tr><td>+</td></tr>
29066 </table>
29067 !! wikitext
29068 {|
29069 |a
29070 |-
29071 |<nowiki>-</nowiki>
29072 |-
29073 |<nowiki>+</nowiki>
29074 |}
29075 !! end
29076
29077 !! test
29078 2. Table cells with escapable prefixes
29079 !! options
29080 parsoid={
29081 "modes": ["html2wt"],
29082 "scrubWikitext": true
29083 }
29084 !! html
29085 <table>
29086 <tr><td>a</td></tr>
29087 <tr><td>-</td></tr>
29088 <tr><td>+</td></tr>
29089 </table>
29090 !! wikitext
29091 {|
29092 |a
29093 |-
29094 | -
29095 |-
29096 | +
29097 |}
29098 !! end
29099
29100 !! test
29101 3a. Table cells with escapable prefixes after edits
29102 !! options
29103 parsoid={
29104 "modes": ["selser"],
29105 "scrubWikitext": true,
29106 "changes": [
29107 [ "table tbody tr:first-child td:first-child", "remove"]
29108 ]
29109 }
29110 !! wikitext
29111 {|
29112 |a||-
29113 |}
29114 !! wikitext/edited
29115 {|
29116 | -
29117 |}
29118 !! end
29119
29120 !! test
29121 3b. Table cells with escapable prefixes after edits
29122 !! options
29123 parsoid={
29124 "modes": ["selser"],
29125 "scrubWikitext": true,
29126 "changes": [
29127 [ "table tbody tr:first-child td:first-child", "html", "-" ],
29128 [ "#x", "remove" ]
29129 ]
29130 }
29131 !! wikitext
29132 {|
29133 |pqr
29134 |<span id="x">foo</span>+
29135 |}
29136 !! wikitext/edited
29137 {|
29138 | -
29139 | +
29140 |}
29141 !! end
29142
29143 # FIXME: This test will fail because
29144 # normalization doesn't realize that the id attribute
29145 # will eliminate the escapable scenario
29146 !! test
29147 4a. Table cells without escapable prefixes after edits
29148 !! options
29149 parsoid={
29150 "modes": ["selser"],
29151 "scrubWikitext": true,
29152 "changes": [
29153 [ "#x", "html", "-" ]
29154 ]
29155 }
29156 !! wikitext
29157 {|
29158 | id="x" |abcd
29159 |}
29160 !! wikitext/edited
29161 {|
29162 | id="x" |-
29163 |}
29164 !! end
29165
29166 ## This tests normalizer's ability to discriminate between
29167 ## cells having identical content.
29168 !! test
29169 4b. Table cells without escapable prefixes after edits
29170 !! options
29171 parsoid={
29172 "modes": ["selser"],
29173 "scrubWikitext": true,
29174 "changes": [
29175 [ "td", "html", "-" ]
29176 ]
29177 }
29178 !! wikitext
29179 {|
29180 |a||b
29181 |}
29182 !! wikitext/edited
29183 {|
29184 | -||-
29185 |}
29186 !! end
29187
29188 ## This tests normalizer's ability to not be tripped by
29189 ## comments (and whitespace)
29190 !! test
29191 4c. Table cells without escapable prefixes after edits
29192 !! options
29193 parsoid={
29194 "modes": ["selser"],
29195 "scrubWikitext": true,
29196 "changes": [
29197 [ "table tbody tr td:first-child", "remove" ]
29198 ]
29199 }
29200 !! wikitext
29201 {|
29202 |-
29203 <!--foo--> |a||-
29204 |}
29205 !! wikitext/edited
29206 {|
29207 |-
29208 <!--foo--> | -
29209 |}
29210 !! end
29211
29212 ## This tests normalizer's ability to handle HTML cells
29213 !! test
29214 4d. Table cells without escapable prefixes after edits
29215 !! options
29216 parsoid={
29217 "modes": ["selser"],
29218 "scrubWikitext": true,
29219 "changes": [
29220 [ "td", "html", "-" ]
29221 ]
29222 }
29223 !! wikitext
29224 <table>
29225 <tr><td>a</td></tr>
29226 </table>
29227 !! wikitext/edited
29228 <table>
29229 <tr><td>-</td></tr>
29230 </table>
29231 !! end
29232
29233 ## T111151 Remove font elements without attributes
29234 !! test
29235 5a. font tags without attributes should be dropped in scrubWikitext mode
29236 !! options
29237 parsoid={
29238 "modes": ["html2wt"],
29239 "scrubWikitext": true
29240 }
29241 !! html
29242 <font>foo</font>
29243 <font><font>bar</font></font>
29244 <font class="x">boo</font>
29245 !! wikitext
29246 foo
29247 bar
29248 <font class="x">boo</font>
29249 !! end
29250
29251 !! test
29252 5b. font tags should not be dropped without scrubWikitext being enabled
29253 !! options
29254 parsoid={
29255 "modes": ["html2wt"],
29256 "scrubWikitext": false
29257 }
29258 !! html
29259 <font>foo</font>
29260 !! wikitext
29261 <font>foo</font>
29262 !! end
29263
29264 !! test
29265 Escape nowiki DOM elements
29266 !! options
29267 parsoid=html2wt
29268 !! html/parsoid
29269 <nowiki><i>foo</i></nowiki>
29270 !! wikitext
29271 &lt;nowiki&gt;''foo''&lt;/nowiki&gt;
29272 !! end
29273
29274 # This is meant to be an interim fix while we go about figuring out
29275 # how to not introduce these trailing <nowiki/>s in the first place.
29276 !! test
29277 T115717: Strip trailing <nowiki/>s (without affecting valid uses)
29278 !! options
29279 parsoid=html2wt
29280 !! html/parsoid
29281 <p>x<meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/>
29282 y</p>
29283 <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>
29284 <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>
29285 !! wikitext
29286 x
29287 y
29288
29289 {{echo|
29290 1 = <nowiki/>}}
29291
29292 {{echo|
29293 1 = <nowiki/>
29294 }}
29295 !! end
29296
29297 # ---------------------------------------------------
29298 # End of tests spec'ing wikitext serialization norms |
29299 # ---------------------------------------------------
29300
29301 # T104032
29302 !! test
29303 Bare inline nodes not wrapped inside p-tags should be treated as p-wrapped
29304 !! options
29305 parsoid=html2wt
29306 !! html/parsoid
29307 a<p>b</p>
29308 <b>c</b><p>d</p>
29309 <table><tr>
29310 <td>a<p>b</p></td>
29311 <td><b>c</b><p>d</p></td>
29312 </tr></table>
29313 !! wikitext
29314 a
29315
29316 b
29317
29318 '''c'''
29319
29320 d
29321 {|
29322 |a
29323 b
29324 |'''c'''
29325 d
29326 |}
29327 !! end
29328
29329 !! test
29330 Anchor without href scenarios
29331 !! options
29332 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
29333 !! html/parsoid
29334 <a class="bc"></a>
29335 <a class="no">dice</a>
29336 <a name="foo"></a>
29337 !! wikitext
29338
29339 dice
29340 <span name="foo"></span>
29341 !! end
29342
29343 !! test
29344 New transclusion added after a list should be serialized after the list
29345 !! options
29346 parsoid=html2wt
29347 !! html/parsoid
29348 <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>
29349 !! wikitext
29350 * a
29351 {{echo|foo}}
29352 !! end
29353
29354 # -----------------------------------------------------------------
29355 # End of section for Parsoid-only html2wt tests for serialization
29356 # of new content
29357 # -----------------------------------------------------------------
29358
29359 # -----------------------------------------------------------------
29360 # The following section of tests are primarily to spec behavior of
29361 # the selective serializer. All these tests have manual selser
29362 # changes. The automated selser changes for all tests handle the
29363 # wide variation of changes, but these tests here capture specs
29364 # deterministically.
29365 # ----------------------------------------------------------------
29366
29367 ## T90517
29368 !! test
29369 Selser: New comments should not be lost
29370 !! options
29371 parsoid={
29372 "modes": ["selser"],
29373 "changes": [
29374 [ "#a", "after", "<!--c1-->" ],
29375 [ "#b", "before", "<!--c2-->" ]
29376 ]
29377 }
29378 !! wikitext
29379 <span id="a">a</span>
29380
29381 <span id="b">b</span>
29382 !! wikitext/edited
29383 <span id="a">a</span><!--c1-->
29384
29385 <!--c2--><span id="b">b</span>
29386 !! end
29387
29388 ## T89383
29389 !! test
29390 Selser: Check for validity of DSR before using it
29391 !! options
29392 parsoid={
29393 "modes": ["selser"],
29394 "changes": [
29395 [ "#a", "before", "<meta property='mw:PageProp/displaytitle' content='foo'>" ]
29396 ]
29397 }
29398 !! wikitext
29399 <span id="a">a</span>
29400 !! wikitext/edited
29401 {{DISPLAYTITLE:foo}}
29402 <span id="a">a</span>
29403 !! end
29404
29405 !! test
29406 1. DOMDiff: Changes to <ref> content should be looked up using id
29407 !! options
29408 parsoid={
29409 "modes": ["selser"],
29410 "changes": [
29411 ["#X", "after", "bar"],
29412 ["#Y", "after", "baz"]
29413 ]
29414 }
29415 !! wikitext
29416 X <ref><span id="X">foo</span></ref>
29417 Y <ref name="a" />
29418 <references>
29419 <ref name="a"><span id="Y">foo</span></ref>
29420 </references>
29421 !! wikitext/edited
29422 X <ref><span id="X">foo</span>bar</ref>
29423 Y <ref name="a" />
29424 <references>
29425 <ref name="a"><span id="Y">foo</span>baz</ref>
29426 </references>
29427 !! end
29428
29429 !! test
29430 2. DOMDiff: Changes to <ref> content should be looked up using id
29431 !! options
29432 parsoid={
29433 "modes": ["selser"],
29434 "changes": [
29435 ["#Z", "after", "bar"]
29436 ]
29437 }
29438 !! wikitext
29439 A <ref>foo bar for a</ref>
29440 B <ref group="X" name="b" />
29441
29442 <references />
29443
29444 <references group="X">
29445 <ref name="b"><span id="Z">foo</span></ref>
29446 </references>
29447 !! wikitext/edited
29448 A <ref>foo bar for a</ref>
29449 B <ref group="X" name="b" />
29450
29451 <references />
29452
29453 <references group="X">
29454 <ref name="b"><span id="Z">foo</span>bar</ref>
29455 </references>
29456 !! end
29457
29458 !! test
29459 DOMDiff: Edits to content nested in elements with templated attributes should not be lost (T139388)
29460 !! options
29461 parsoid={
29462 "modes": ["selser"],
29463 "changes": [
29464 [ "div:first-child", "text", "bar" ]
29465 ]
29466 }
29467 !! wikitext
29468 <div style="{{1x|color:red;}}%">foo</div>
29469 !! wikitext/edited
29470 <div style="{{1x|color:red;}}%">bar</div>
29471 !! end
29472
29473 !! test
29474 Empty LI (T49673)
29475 !! wikitext
29476 * a
29477 *
29478 *
29479 * b
29480 !! html/php+tidy
29481 <ul>
29482 <li>a</li>
29483 <li class="mw-empty-elt"></li>
29484 <li class="mw-empty-elt"></li>
29485 <li>b</li>
29486 </ul>
29487 !! end
29488
29489 !! test
29490 Thumbnail output
29491 !! wikitext
29492 [[File:Thumb.png|thumb]]
29493 !! html/php+tidy
29494 <div class="thumb tright">
29495 <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>
29496 <div class="thumbcaption">
29497 <div class="magnify"><a href="/wiki/File:Thumb.png" class="internal" title="Enlarge"></a></div>
29498 </div>
29499 </div>
29500 </div>
29501 !! end
29502
29503 !! test
29504 unclosed internal link XSS (T137264)
29505 !! wikitext
29506 [[#%3Cscript%3Ealert(1)%3C/script%3E|
29507 !! html/php
29508 <p>[[#&lt;script&gt;alert(1)&lt;/script&gt;|
29509 </p>
29510 !! html/parsoid
29511 <p>[[#%3Cscript%3Ealert(1)%3C/script%3E|</p>
29512 !! end
29513
29514 # Use $wgRawHtml to inject a <style> tag, since you normally can't in wikitext
29515 # (Parsoid doesn't support $wgRawHtml==true)
29516 !! test
29517 Validating that <style> isn't eaten by tidy (T167349)
29518 !! options
29519 wgRawHtml=1
29520 !! wikitext
29521 <div class="foo">
29522 <html><style>.foo::before { content: "<foo>"; }</style></html>
29523 <html><style data-mw-foobar="baz">.foo::after { content: "<bar>"; }</style></html>
29524 </div>
29525 !! html/php+tidy
29526 <div class="foo">
29527 <style>.foo::before { content: "<foo>"; }</style>
29528 <style data-mw-foobar="baz">.foo::after { content: "<bar>"; }</style>
29529 </div>
29530 !! end
29531
29532 !! test
29533 Decoding of HTML entities in headings and links for IDs and link fragments (T103714)
29534 !! wikitext
29535 == A&B&amp;C&amp;amp;D&amp;amp;amp;E ==
29536 [[#A&B&amp;C&amp;amp;D&amp;amp;amp;E]]
29537 !! html/php
29538 <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>
29539 <p><a href="#A.26B.26C.26amp.3BD.26amp.3Bamp.3BE">#A&amp;B&amp;C&amp;amp;D&amp;amp;amp;E</a>
29540 </p>
29541 !! end
29542
29543 !! test
29544 Decoding of HTML entities in indicator names for IDs (T104196)
29545 !! options
29546 showindicators
29547 !! wikitext
29548 <indicator name="1&2&amp;3&amp;amp;4&amp;amp;amp;5">Indicator</indicator>
29549 !! html/php
29550 1&2&3&amp;4&amp;amp;5=Indicator
29551
29552 !! end
29553
29554 !! test
29555 HTML5 ids: fallback to legacy
29556 !! config
29557 wgFragmentMode=[ 'html5', 'legacy' ]
29558 !! wikitext
29559 == Foo bar ==
29560
29561 == foo Bar ==
29562
29563 == Тест ==
29564
29565 == Тест ==
29566
29567 == тест ==
29568
29569 == Hey < # " > % : ' ==
29570 [[#Foo bar]] [[#foo Bar]] [[#Тест]] [[#тест]] [[#Hey < # " > % : ']]
29571
29572 {{anchorencode:💩}} <span id="{{anchorencode:💩}}"></span>
29573
29574 <!-- These two links should produce identical HTML -->
29575 [[#啤酒]] [[#%E5%95%A4%E9%85%92]]
29576
29577 !! html/php
29578 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
29579 <ul>
29580 <li class="toclevel-1 tocsection-1"><a href="#Foo_bar"><span class="tocnumber">1</span> <span class="toctext">Foo bar</span></a></li>
29581 <li class="toclevel-1 tocsection-2"><a href="#foo_Bar_2"><span class="tocnumber">2</span> <span class="toctext">foo Bar</span></a></li>
29582 <li class="toclevel-1 tocsection-3"><a href="#Тест"><span class="tocnumber">3</span> <span class="toctext">Тест</span></a></li>
29583 <li class="toclevel-1 tocsection-4"><a href="#Тест_2"><span class="tocnumber">4</span> <span class="toctext">Тест</span></a></li>
29584 <li class="toclevel-1 tocsection-5"><a href="#тест"><span class="tocnumber">5</span> <span class="toctext">тест</span></a></li>
29585 <li class="toclevel-1 tocsection-6"><a href="#Hey_&lt;_#_&quot;_&gt;_%_:_&#39;"><span class="tocnumber">6</span> <span class="toctext">Hey &lt; # " &gt;&#160;%&#160;: '</span></a></li>
29586 </ul>
29587 </div>
29588
29589 <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>
29590 <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>
29591 <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>
29592 <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>
29593 <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>
29594 <h2><span id="Hey_.3C_.23_.22_.3E_.25_:_.27"></span><span class="mw-headline" id="Hey_&lt;_#_&quot;_&gt;_%_:_'">Hey &lt; # " &gt;&#160;%&#160;: '</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: Hey &lt; # &quot; &gt; % : &#039;">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
29595 <p><a href="#Foo_bar">#Foo bar</a> <a href="#foo_Bar">#foo Bar</a> <a href="#Тест">#Тест</a> <a href="#тест">#тест</a> <a href="#Hey_&lt;_#_&quot;_&gt;_%_:_&#39;">#Hey &lt; # " &gt;&#160;%&#160;: '</a>
29596 </p><p>💩 <span id="💩"></span>
29597 </p><p><a href="#啤酒">#啤酒</a> <a href="#啤酒">#啤酒</a>
29598 </p>
29599 !! end
29600
29601 !! test
29602 HTML5 ids: legacy with a fallback to modern
29603 !! config
29604 wgFragmentMode=[ 'legacy', 'html5' ]
29605 !! wikitext
29606 == Foo bar ==
29607
29608 == foo Bar ==
29609
29610 == Тест ==
29611
29612 == Тест ==
29613
29614 == тест ==
29615
29616 == Hey < # " > % : ' ==
29617 [[#Foo bar]] [[#foo Bar]] [[#Тест]] [[#тест]] [[#Hey < # " > % : ']]
29618
29619 {{anchorencode:💩}} <span id="{{anchorencode:💩}}"></span>
29620
29621 <!-- These two links should produce identical HTML -->
29622 [[#啤酒]] [[#%E5%95%A4%E9%85%92]]
29623
29624 !! html/php
29625 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
29626 <ul>
29627 <li class="toclevel-1 tocsection-1"><a href="#Foo_bar"><span class="tocnumber">1</span> <span class="toctext">Foo bar</span></a></li>
29628 <li class="toclevel-1 tocsection-2"><a href="#foo_Bar_2"><span class="tocnumber">2</span> <span class="toctext">foo Bar</span></a></li>
29629 <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>
29630 <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>
29631 <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>
29632 <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>
29633 </ul>
29634 </div>
29635
29636 <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>
29637 <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>
29638 <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>
29639 <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>
29640 <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>
29641 <h2><span id="Hey_&lt;_#_&quot;_&gt;_%_:_'"></span><span class="mw-headline" id="Hey_.3C_.23_.22_.3E_.25_:_.27">Hey &lt; # " &gt;&#160;%&#160;: '</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: Hey &lt; # &quot; &gt; % : &#039;">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
29642 <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>
29643 </p><p>.F0.9F.92.A9 <span id=".F0.9F.92.A9"></span>
29644 </p><p><a href="#.E5.95.A4.E9.85.92">#啤酒</a> <a href="#.E5.95.A4.E9.85.92">#啤酒</a>
29645 </p>
29646 !! end
29647
29648 !! test
29649 HTML5 ids: no legacy
29650 !! config
29651 wgFragmentMode=[ 'html5' ]
29652 !! wikitext
29653 == Foo bar ==
29654
29655 == foo Bar ==
29656
29657 == Тест ==
29658
29659 == Тест ==
29660
29661 == тест ==
29662
29663 == Hey < # " > % : ' ==
29664 [[#Foo bar]] [[#foo Bar]] [[#Тест]] [[#тест]] [[#Hey < # " > % : ']]
29665
29666 {{anchorencode:💩}} <span id="{{anchorencode:💩}}"></span>
29667
29668 <!-- These two links should produce identical HTML -->
29669 [[#啤酒]] [[#%E5%95%A4%E9%85%92]]
29670
29671 !! html/php
29672 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
29673 <ul>
29674 <li class="toclevel-1 tocsection-1"><a href="#Foo_bar"><span class="tocnumber">1</span> <span class="toctext">Foo bar</span></a></li>
29675 <li class="toclevel-1 tocsection-2"><a href="#foo_Bar_2"><span class="tocnumber">2</span> <span class="toctext">foo Bar</span></a></li>
29676 <li class="toclevel-1 tocsection-3"><a href="#Тест"><span class="tocnumber">3</span> <span class="toctext">Тест</span></a></li>
29677 <li class="toclevel-1 tocsection-4"><a href="#Тест_2"><span class="tocnumber">4</span> <span class="toctext">Тест</span></a></li>
29678 <li class="toclevel-1 tocsection-5"><a href="#тест"><span class="tocnumber">5</span> <span class="toctext">тест</span></a></li>
29679 <li class="toclevel-1 tocsection-6"><a href="#Hey_&lt;_#_&quot;_&gt;_%_:_&#39;"><span class="tocnumber">6</span> <span class="toctext">Hey &lt; # " &gt;&#160;%&#160;: '</span></a></li>
29680 </ul>
29681 </div>
29682
29683 <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>
29684 <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>
29685 <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>
29686 <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>
29687 <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>
29688 <h2><span class="mw-headline" id="Hey_&lt;_#_&quot;_&gt;_%_:_'">Hey &lt; # " &gt;&#160;%&#160;: '</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: Hey &lt; # &quot; &gt; % : &#039;">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
29689 <p><a href="#Foo_bar">#Foo bar</a> <a href="#foo_Bar">#foo Bar</a> <a href="#Тест">#Тест</a> <a href="#тест">#тест</a> <a href="#Hey_&lt;_#_&quot;_&gt;_%_:_&#39;">#Hey &lt; # " &gt;&#160;%&#160;: '</a>
29690 </p><p>💩 <span id="💩"></span>
29691 </p><p><a href="#啤酒">#啤酒</a> <a href="#啤酒">#啤酒</a>
29692 </p>
29693 !! end
29694
29695 !! test
29696 T90902: Normalize weird characters in section IDs
29697 !! config
29698 wgFragmentMode=[ 'html5', 'legacy' ]
29699 !! wikitext
29700 == Foo&nbsp;bar ==
29701 [[#Foo&nbsp;bar]]
29702
29703 !! html/php
29704 <h2><span class="mw-headline" id="Foo_bar">Foo&#160;bar</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Foo bar">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
29705 <p><a href="#Foo_bar">#Foo&#160;bar</a>
29706 </p>
29707 !! end
29708
29709 !! test
29710 T51672: Test for brackets in attributes of elements in external link texts
29711 !! wikitext
29712 [http://example.com/ link <span title="title with [brackets]">span</span>]
29713 [http://example.com/ link <span title="title with &#91;brackets&#93;">span</span>]
29714
29715 !! html/php
29716 <p><a rel="nofollow" class="external text" href="http://example.com/">link <span title="title with &#91;brackets&#93;">span</span></a>
29717 <a rel="nofollow" class="external text" href="http://example.com/">link <span title="title with &#91;brackets&#93;">span</span></a>
29718 </p>
29719 !! end
29720
29721 !! test
29722 T72875: Test for brackets in attributes of elements in internal link texts
29723 !! wikitext
29724 [[Foo|link <span title="title with [[double brackets]]">span</span>]]
29725 [[Foo|link <span title="title with &#91;&#91;double brackets&#93;&#93;">span</span>]]
29726
29727 !! html/php
29728 <p><a href="/wiki/Foo" title="Foo">link <span title="title with &#91;&#91;double brackets&#93;&#93;">span</span></a>
29729 <a href="/wiki/Foo" title="Foo">link <span title="title with &#91;&#91;double brackets&#93;&#93;">span</span></a>
29730 </p>
29731 !! end