Sync up with Parsoid parserTests.txt
[lhc/web/wiklou.git] / tests / parser / parserTests.txt
1 # MediaWiki Parser test cases
2 # Some taken from https://meta.wikimedia.org/wiki/Parser_testing
3 # All (C) their respective authors and released under the GPL
4 #
5 # The syntax should be fairly self-explanatory.
6 #
7 # Currently supported test options:
8 # One of the following three:
9 #
10 # (default) generate HTML output
11 # pst apply pre-save transform
12 # msg apply message transform
13 #
14 # Plus any combination of these:
15 #
16 # cat add category links
17 # (ignored by Parsoid, since it emits <link>s)
18 # ill add inter-language links
19 # (ignored by Parsoid, since it emits <link>s)
20 # subpage enable subpages (disabled by default)
21 # title=[[XXX]] run test using article title XXX
22 # language=XXX set content language to XXX for this test
23 # variant=XXX set the variant of language for this test (eg zh-tw)
24 # disabled do not run test
25 # parsoid parsoid-specific options (not run by PHP parser unless
26 # the test includes an html/php section)
27 # php php-only test (not run by the parsoid parser unless
28 # the test includes an html/parsoid section)
29 # showtitle make the first line the title
30 # showindicators make the first lines the page status indicators
31 # comment run through Linker::formatComment() instead of main parser
32 # local format section links in edit comment text as local links
33 # notoc disable table of contents
34 # thumbsize=NNN set the default thumb size to NNNpx for this test
35 # wrap include the normal wrapper <div class="mw-parser-output"> (since 1.30)
36 #
37 # You can also set the following parser properties via test options:
38 # wgEnableUploads, wgAllowExternalImages, wgMaxTocLevel,
39 # wgLinkHolderBatchSize, wgRawHtml, wgInterwikiMagic,
40 # wgEnableMagicLinks
41 #
42 # For testing purposes, temporary articles can created:
43 # !!article / NAMESPACE:TITLE / !!text / ARTICLE TEXT / !!endarticle
44 # where '/' denotes a newline.
45
46 # This is the standard article assumed to exist.
47 !! article
48 Main Page
49 !! text
50 blah blah
51 !! endarticle
52
53 !!article
54 Foo
55 !!text
56 FOO
57 !!endarticle
58
59 !!article
60 Template:Foo
61 !!text
62 FOO
63 !!endarticle
64
65 !! article
66 Template:Blank
67 !! text
68 !! endarticle
69
70 !! article
71 Template:pipe
72 !! text
73 |
74 !! endarticle
75
76 !! article
77 Template:=
78 !! text
79 <nowiki>=</nowiki>
80 !! endarticle
81
82 !!article
83 MediaWiki:bad image list
84 !!text
85 * [[File:Bad.jpg]] except [[Nasty page]]
86 !!endarticle
87
88 !! article
89 Template:inner list
90 !! text
91 * item 1
92 !! endarticle
93
94 !! article
95 Template:tbl-start
96 !! text
97 {|
98 !! endarticle
99
100 !! article
101 Template:tbl-end
102 !! text
103 |}
104 !! endarticle
105
106 !! article
107 Template:echo
108 !! text
109 {{{1}}}
110 !! endarticle
111
112 // For Serbian; localize Template namespace
113 !! article
114 Шаблон:Echo
115 !! text
116 {{{1}}}
117 !! endarticle
118
119 !! article
120 Template:echo_with_span
121 !! text
122 <span>{{{1}}}</span>
123 !! endarticle
124
125 !! article
126 Template:echo_with_div
127 !! text
128 <div>{{{1}}}</div>
129 !! endarticle
130
131 !! article
132 Template:blank_param
133 !! text
134 {{{1}}}
135 {{{}}}
136 !! endarticle
137
138 !! article
139 Template:table_attribs
140 !! text
141 <noinclude>
142 |</noinclude>style="color:red;"|Foo
143 !! endarticle
144
145 !! article
146 Template:table_attribs_2
147 !! text
148 <noinclude>
149 |</noinclude>style="color:red;"|Foo
150 |Bar||Baz
151 !! endarticle
152
153 !! article
154 Template:table_attribs_3
155 !! text
156 <noinclude>
157 |</noinclude>style{{=}}"background:&#35;f9f9f9;"|Foo
158 !! endarticle
159
160 !! article
161 Template:table_attribs_4
162 !! text
163 | style="background-color:#DC241f;" width="10px" |
164 !! endarticle
165
166 !! article
167 Template:table_attribs_5
168 !! text
169 <noinclude>
170 |</noinclude>style="color:red;"||Bar
171 !! endarticle
172
173 !! article
174 Template:table_attribs_6
175 !! text
176 style="background: <nowiki>
177
178
179 red;</nowiki>" |
180 !! endarticle
181
182 !! article
183 Template:table_attribs_7
184 !! text
185 <noinclude>
186 |</noinclude>style{{=}}"background:&#35;f9f9f9;"|Foo<ref>foo</ref>
187 !! endarticle
188
189 !! article
190 Template:table_header_cells
191 !! text
192 {{table_attribs}}!!style='color:red;'|''Bar''||style='color:brown;'|''Foo'' and Baz
193 !! endarticle
194
195 !! article
196 Template:table_cells
197 !! text
198 {{table_attribs}}||style='color:red;'|''Bar''||style='color:brown;'|''Foo'' and Baz
199 !! endarticle
200
201 !! article
202 Template:PartialTable
203 !! text
204 {|
205 |-
206 !! endarticle
207
208 !! article
209 Template:image_attribs
210 !! text
211 <noinclude>
212 [[File:foobar.jpg|</noinclude>right|Caption text<noinclude>]]</noinclude>
213 !! endarticle
214
215 ## See T48811 for details
216 !! article
217 Template:mixed_attr_content_template
218 !! text
219 style="color:red;" title="T48811"
220 |-
221 |foo
222 !! endarticle
223
224 !! article
225 Template:definition_list
226 !! text
227 one
228 ::two
229 !! endarticle
230
231 !! article
232 A?b
233 !! text
234 Weirdo titles!
235 !! endarticle
236
237 !!article
238 Template:Bullet
239 !!text
240 * Bar
241 !!endarticle
242
243 !!article
244 Template:OpenTable
245 !!text
246 {|
247 !!endarticle
248
249 !!article
250 Template:EmptyLITest
251 !!text
252 *a
253 *
254 *
255 *b
256 !!endarticle
257
258 !!article
259 Template:EmptyTRTest
260 !!text
261 {|
262 |-
263 |-
264 |foo
265 |-
266 |-
267 |bar
268 |}
269 !!endarticle
270
271 !!article
272 Template:EmptyTRWithHTMLAttrTest
273 !!text
274 <table>
275 <tr align="center"></tr>
276 <tr><td>foo</td></tr>
277 <tr align="center"></tr>
278 <tr><td>bar</td></tr>
279 </table>
280 !!endarticle
281
282 !! article
283 Template:CircularRef
284 !! text
285 <ref>{{CircularRef}}</ref>
286 !! endarticle
287
288 !! article
289 Template:With: Colon
290 !! text
291 Template with colon
292 !! endarticle
293
294 ###
295 ### Basic tests
296 ###
297 !! test
298 Blank input
299 !! wikitext
300 !! html
301 !! end
302
303 !! test
304 CircularRef
305 !! wikitext
306 {{CircularRef}}
307 <references />
308 !! html/parsoid
309 <p><span about="#mwt1" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Transclusion mw:Extension/ref" data-parsoid='{"pi":[[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"CircularRef","href":"./Template:CircularRef"},"params":{},"i":0}}]}'><a href="./Main_Page#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></span></p>
310 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><a href="./Main_Page#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text" data-parsoid="{}">Error: Expansion loop detected at <a data-parsoid='{"a":{"href":null},"sa":{"href":"Template:CircularRef"}}'>Template:CircularRef</a></span></li></ol>
311 !! end
312
313 !! test
314 Simple paragraph
315 !! wikitext
316 This is a simple paragraph.
317 !! html
318 <p>This is a simple paragraph.
319 </p>
320 !! end
321
322 !! test
323 Paragraphs with extra newline spacing
324 !! wikitext
325 foo
326
327 bar
328
329
330 baz
331
332
333
334 booz
335 !! html
336 <p>foo
337 </p><p>bar
338 </p><p><br />
339 baz
340 </p><p><br />
341 </p><p>booz
342 </p>
343 !! end
344
345 !! test
346 Paragraphs with newline spacing with comment lines in between
347 !! wikitext
348 ----
349 a
350 <!--foo-->
351 b
352 ----
353 a
354 <!--foo--><!--More than 1 comment, still stripped-->
355 b
356 ----
357 a
358 <!--foo--> <!----> <!-- bar -->
359 b
360 ----
361 a
362 <!--foo-->
363
364 b
365 ----
366 a
367
368 <!--foo-->
369 b
370 ----
371 a
372 <!--foo-->
373
374
375 b
376 ----
377 a
378
379
380 <!--foo-->
381 b
382 ----
383 !! html
384 <hr />
385 <p>a
386 b
387 </p>
388 <hr />
389 <p>a
390 b
391 </p>
392 <hr />
393 <p>a
394 b
395 </p>
396 <hr />
397 <p>a
398 </p><p>b
399 </p>
400 <hr />
401 <p>a
402 </p><p>b
403 </p>
404 <hr />
405 <p>a
406 </p><p><br />
407 b
408 </p>
409 <hr />
410 <p>a
411 </p><p><br />
412 b
413 </p>
414 <hr />
415
416 !! end
417
418 !! test
419 Paragraphs with newline spacing with non-empty white-space lines in between
420 !! wikitext
421 ----
422 a
423
424 b
425 ----
426 a
427
428
429 b
430 ----
431 !! html
432 <hr />
433 <p>a
434 </p><p>b
435 </p>
436 <hr />
437 <p>a
438 </p><p><br />
439 b
440 </p>
441 <hr />
442
443 !! end
444
445 !! test
446 Paragraphs with newline spacing with non-empty mixed comment and white-space lines in between
447 !! wikitext
448 ----
449 a
450 <!--foo-->
451 b
452 ----
453 a
454 <!--foo--><!--More than 1 comment doesn't disable stripping of this line!-->
455 b
456 ----
457 a
458
459 <!--foo-->
460 <!--bar-->
461 b
462 ----
463 a
464
465 <!--foo-->
466 <!--bar-->
467
468 b
469 ----
470 !! html
471 <hr />
472 <p>a
473 b
474 </p>
475 <hr />
476 <p>a
477 b
478 </p>
479 <hr />
480 <p>a
481 </p><p>b
482 </p>
483 <hr />
484 <p>a
485 </p><p><br />
486 b
487 </p>
488 <hr />
489
490 !! end
491
492 !! test
493 Extra newlines: More paragraphs with indented comment
494 !! wikitext
495 a
496
497 <!--boo-->
498
499 b
500 !! html
501 <p>a
502 </p><p><br />
503 b
504 </p>
505 !!end
506
507 !! test
508 Extra newlines followed by heading
509 !! wikitext
510 a
511
512
513
514 =b=
515 [[a]]
516
517
518 =b=
519 !! html
520 <p>a
521 </p><p><br />
522 </p>
523 <h1><span class="mw-headline" id="b">b</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: b">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
524 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
525 </p><p><br />
526 </p>
527 <h1><span class="mw-headline" id="b_2">b</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: b">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
528
529 !! end
530
531 !! test
532 Extra newlines between heading and content are swallowed
533 !! wikitext
534 =b=
535
536
537
538 [[a]]
539 !! html
540 <h1><span class="mw-headline" id="b">b</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: b">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
541 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
542 </p>
543 !! end
544
545 !! test
546 Heading with line break in nowiki
547 !! options
548 parsoid=wt2html
549 !! wikitext
550 == A <nowiki>B
551 C</nowiki> ==
552 !! html
553 <h2><span class="mw-headline" id="A_B.0AC">A B
554 C</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: A B&#10;C">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
555
556 !! html/parsoid
557 <h2 id="A_B.0AC">A <span typeof="mw:Nowiki">B
558 C</span> </h2>
559 !! end
560
561 !! test
562 Parsing an URL
563 !! wikitext
564 http://fr.wikipedia.org/wiki/🍺
565 <!-- EasterEgg we love beer, better be able be able to link to it -->
566 !! html
567 <p><a rel="nofollow" class="external free" href="http://fr.wikipedia.org/wiki/🍺">http://fr.wikipedia.org/wiki/🍺</a>
568 </p>
569 !! end
570
571 # Note that the html+tidy output removes the spaces after the <li>,
572 # which is a bug (https://sourceforge.net/p/tidy/bugs/945/, etc).
573 # This is an issue for all tests with lists. We intentionally do
574 # *not* add html+tidy clauses for these, as we don't want to
575 # document/test the broken behavior. (Parsoid matches the non-tidy
576 # output in these cases.)
577
578 !! test
579 Simple list
580 !! wikitext
581 * Item 1
582 * Item 2
583 !! html
584 <ul><li> Item 1</li>
585 <li> Item 2</li></ul>
586
587 !! end
588
589 !! test
590 Italics and bold
591 !! wikitext
592 * plain
593 * plain''italic''plain
594 * plain''italic''plain''italic''plain
595 * plain'''bold'''plain
596 * plain'''bold'''plain'''bold'''plain
597 * plain''italic''plain'''bold'''plain
598 * plain'''bold'''plain''italic''plain
599 * plain''italic'''bold-italic'''italic''plain
600 * plain'''bold''bold-italic''bold'''plain
601 * plain'''''bold-italic'''italic''plain
602 * plain'''''bold-italic''bold'''plain
603 * plain''italic'''bold-italic'''''plain
604 * plain'''bold''bold-italic'''''plain
605 * plain l'''italic''plain
606 * plain l''''bold''' plain
607 !! html
608 <ul><li> plain</li>
609 <li> plain<i>italic</i>plain</li>
610 <li> plain<i>italic</i>plain<i>italic</i>plain</li>
611 <li> plain<b>bold</b>plain</li>
612 <li> plain<b>bold</b>plain<b>bold</b>plain</li>
613 <li> plain<i>italic</i>plain<b>bold</b>plain</li>
614 <li> plain<b>bold</b>plain<i>italic</i>plain</li>
615 <li> plain<i>italic<b>bold-italic</b>italic</i>plain</li>
616 <li> plain<b>bold<i>bold-italic</i>bold</b>plain</li>
617 <li> plain<i><b>bold-italic</b>italic</i>plain</li>
618 <li> plain<b><i>bold-italic</i>bold</b>plain</li>
619 <li> plain<i>italic<b>bold-italic</b></i>plain</li>
620 <li> plain<b>bold<i>bold-italic</i></b>plain</li>
621 <li> plain l'<i>italic</i>plain</li>
622 <li> plain l'<b>bold</b> plain</li></ul>
623
624 !! end
625
626 # this example taken from the [[simple:Moon]] article (T49326)
627 !! test
628 Italics and possessives (1)
629 !! wikitext
630 obtained by ''[[Lunar Prospector]]'''s gamma-ray spectrometer
631 !! html
632 <p>obtained by <i><a href="/index.php?title=Lunar_Prospector&amp;action=edit&amp;redlink=1" class="new" title="Lunar Prospector (page does not exist)">Lunar Prospector</a>'</i>s gamma-ray spectrometer
633 </p>
634 !! end
635
636 # this example taken from [[en:Flaming Pie]] (T51926)
637 !! test
638 Italics and possessives (2)
639 !! wikitext
640 '''''Flaming Pie''''' is ... released in 1997. In ''Flaming Pie'''s liner notes
641 !! html
642 <p><i><b>Flaming Pie</b></i> is ... released in 1997. In <i>Flaming Pie'</i>s liner notes
643 </p>
644 !! end
645
646 # this example taken from [[en:Dictionary]] (T51926)
647 !! test
648 Italics and possessives (3)
649 !! wikitext
650 The first monolingual dictionary written in a Romance language was ''Sebastián Covarrubias''' ''Tesoro de la lengua castellana o española'', published in 1611 in Madrid. In 1612 the first edition of the ''Vocabolario dell'[[Accademia della Crusca]]'', for Italian, was published. In 1690 in Rotterdam was published, posthumously, the ''Dictionnaire Universel''.
651 !! html
652 <p>The first monolingual dictionary written in a Romance language was <i>Sebastián Covarrubias'</i> <i>Tesoro de la lengua castellana o española</i>, published in 1611 in Madrid. In 1612 the first edition of the <i>Vocabolario dell'<a href="/index.php?title=Accademia_della_Crusca&amp;action=edit&amp;redlink=1" class="new" title="Accademia della Crusca (page does not exist)">Accademia della Crusca</a></i>, for Italian, was published. In 1690 in Rotterdam was published, posthumously, the <i>Dictionnaire Universel</i>.
653 </p>
654 !! end
655
656
657 ###
658 ### 2-quote opening sequence tests
659 ###
660 !! test
661 Italics and bold: 2-quote opening sequence: (2,2)
662 !! wikitext
663 ''foo''
664 !! html
665 <p><i>foo</i>
666 </p>
667 !!end
668
669 !! test
670 Italics and bold: 2-quote opening sequence: (2,3)
671 !! wikitext
672 ''foo'''
673 !! html/*
674 <p><i>foo'</i>
675 </p>
676 !!end
677
678 !! test
679 Italics and bold: 2-quote opening sequence: (2,4)
680 !! options
681 parsoid=wt2html
682 !! wikitext
683 ''foo''''
684 !! html/*
685 <p><i>foo''</i>
686 </p>
687 !!end
688
689 # same html as previous, but wikitext adjusted to match parsoid html2wt
690 !! test
691 Italics and bold: 2-quote opening sequence: (2,4) w/ nowiki
692 !! wikitext
693 ''foo<nowiki>''</nowiki>''
694 !! html
695 <p><i>foo''</i>
696 </p>
697 !! end
698
699 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
700 !! test
701 Italics and bold: 2-quote opening sequence: (2,5)
702 !! options
703 parsoid=wt2html
704 !! wikitext
705 ''foo'''''
706 !! html/php
707 <p><i>foo</i>
708 </p>
709 !! html/parsoid
710 <p><i>foo</i><b></b>
711 </p>
712 !!end
713
714 # same html as previous, but wikitext adjusted to match parsoid html2wt
715 !! test
716 Italics and bold: 2-quote opening sequence: (2,5+3) w/ nowiki
717 !! wikitext
718 ''foo'''''<nowiki/>'''
719 !! html/php
720 <p><i>foo</i>
721 </p>
722 !! html/parsoid
723 <p><i>foo</i><b></b>
724 </p>
725 !! end
726
727
728 ###
729 ### 3-quote opening sequence tests
730 ###
731
732 !! test
733 Italics and bold: 3-quote opening sequence: (3,2)
734 !! wikitext
735 '''foo''
736 !! html/*
737 <p>'<i>foo</i>
738 </p>
739 !!end
740
741 !! test
742 Italics and bold: 3-quote opening sequence: (3,3)
743 !! wikitext
744 '''foo'''
745 !! html
746 <p><b>foo</b>
747 </p>
748 !!end
749
750 !! test
751 Italics and bold: 3-quote opening sequence: (3,4)
752 !! wikitext
753 '''foo''''
754 !! html/*
755 <p><b>foo'</b>
756 </p>
757 !!end
758
759 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
760 !! test
761 Italics and bold: 3-quote opening sequence: (3,5)
762 !! options
763 parsoid=wt2html
764 !! wikitext
765 '''foo'''''
766 !! html/php
767 <p><b>foo</b>
768 </p>
769 !! html/parsoid
770 <p><b>foo</b><i></i>
771 </p>
772 !!end
773
774 # same html as previous, but wikitext adjusted to match parsoid html2wt
775 !! test
776 Italics and bold: 3-quote opening sequence: (3,5+2) w/ nowiki
777 !! wikitext
778 '''foo'''''<nowiki/>''
779 !! html/php
780 <p><b>foo</b>
781 </p>
782 !! html/parsoid
783 <p><b>foo</b><i></i>
784 </p>
785 !! end
786
787
788 ###
789 ### 4-quote opening sequence tests
790 ###
791
792 !! test
793 Italics and bold: 4-quote opening sequence: (4,2)
794 !! options
795 parsoid=wt2html
796 !! wikitext
797 ''''foo''
798 !! html/*
799 <p>''<i>foo</i>
800 </p>
801 !!end
802
803 # same html as previous, but wikitext adjusted to match parsoid html2wt
804 !! test
805 Italics and bold: 4-quote opening sequence: (4,2) w/ nowiki
806 !! wikitext
807 <nowiki>''</nowiki>''foo''
808 !! html
809 <p>''<i>foo</i>
810 </p>
811 !! end
812
813 !! test
814 Italics and bold: 4-quote opening sequence: (4,3)
815 !! wikitext
816 ''''foo'''
817 !! html/*
818 <p>'<b>foo</b>
819 </p>
820 !!end
821
822 !! test
823 Italics and bold: 4-quote opening sequence: (4,4)
824 !! options
825 parsoid=wt2html
826 !! wikitext
827 ''''foo''''
828 !! html/*
829 <p>'<b>foo'</b>
830 </p>
831 !!end
832
833 # same html as previous, but wikitext adjusted to match parsoid html2wt
834 !! test
835 Italics and bold: 4-quote opening sequence: (4,4) w/ nowiki
836 !! wikitext
837 '<nowiki/>'''foo''''
838 !! html
839 <p>'<b>foo'</b>
840 </p>
841 !! end
842
843 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
844 !! test
845 Italics and bold: 4-quote opening sequence: (4,5)
846 !! options
847 parsoid=wt2html
848 !! wikitext
849 ''''foo'''''
850 !! html/php
851 <p>'<b>foo</b>
852 </p>
853 !! html/parsoid
854 <p>'<b>foo</b><i></i>
855 </p>
856 !!end
857
858 # same html as previous, but wikitext adjusted to match parsoid html2wt
859 !! test
860 Italics and bold: 4-quote opening sequence: (4,5+2) w/ nowiki
861 !! wikitext
862 '<nowiki/>'''foo'''''<nowiki/>''
863 !! html/php
864 <p>'<b>foo</b>
865 </p>
866 !! html/parsoid
867 <p>'<b>foo</b><i></i>
868 </p>
869 !! end
870
871
872 ###
873 ### 5-quote opening sequence tests
874 ###
875
876 !! test
877 Italics and bold: 5-quote opening sequence: (5,2)
878 !! options
879 parsoid=wt2html
880 !! wikitext
881 '''''foo''
882 !! html/*
883 <p><b><i>foo</i></b>
884 </p>
885 !!end
886
887 # same html as previous, but wikitext adjusted to match parsoid html2wt
888 !! test
889 Italics and bold: 5-quote opening sequence: (5,2+3)
890 !! wikitext
891 '''''foo'''''
892 !! html/*
893 <p><i><b>foo</b></i>
894 </p>
895 !! end
896
897 !! test
898 Italics and bold: 5-quote opening sequence: (5,3)
899 !! options
900 parsoid=wt2html
901 !! wikitext
902 '''''foo'''
903 !! html/*
904 <p><i><b>foo</b></i>
905 </p>
906 !!end
907
908 # same html as previous, but wikitext adjusted to match parsoid html2wt
909 !! test
910 Italics and bold: 5-quote opening sequence: (5,3+2)
911 !! wikitext
912 '''''foo'''''
913 !! html
914 <p><i><b>foo</b></i>
915 </p>
916 !! end
917
918 !! test
919 Italics and bold: 5-quote opening sequence: (5,4)
920 !! options
921 parsoid=wt2html
922 !! wikitext
923 '''''foo''''
924 !! html/*
925 <p><i><b>foo'</b></i>
926 </p>
927 !!end
928
929 !! test
930 Italics and bold: 5-quote opening sequence: (5,5)
931 !! wikitext
932 '''''foo'''''
933 !! html
934 <p><i><b>foo</b></i>
935 </p>
936 !!end
937
938 !! test
939 Italics and bold: 5-quote opening sequence: (5,6)
940 !! wikitext
941 '''''foo''''''
942 !! html/*
943 <p><i><b>foo'</b></i>
944 </p>
945 !! end
946
947 ###
948 ### multiple quote sequences in a line
949 ###
950
951 !! test
952 Italics and bold: multiple quote sequences: (2,4,2)
953 !! options
954 parsoid=wt2html
955 !! wikitext
956 ''foo''''bar''
957 !! html/*
958 <p><i>foo'<b>bar</b></i>
959 </p>
960 !! end
961
962 # same html as previous, but wikitext adjusted to match parsoid html2wt
963 !! test
964 Italics and bold: multiple quote sequences: (2,4,2+3) w/ nowiki
965 !! wikitext
966 ''foo'<nowiki/>'''bar'''''
967 !! html
968 <p><i>foo'<b>bar</b></i>
969 </p>
970 !! end
971
972 !! test
973 Italics and bold: multiple quote sequences: (2,4,3)
974 !! options
975 parsoid=wt2html
976 !! wikitext
977 ''foo''''bar'''
978 !! html/*
979 <p><i>foo'<b>bar</b></i>
980 </p>
981 !! end
982
983 # same html as previous, but wikitext adjusted to match parsoid html2wt
984 !! test
985 Italics and bold: multiple quote sequences: (2,4,3+2) w/ nowiki
986 !! wikitext
987 ''foo'<nowiki/>'''bar'''''
988 !! html
989 <p><i>foo'<b>bar</b></i>
990 </p>
991 !! end
992
993 !! test
994 Italics and bold: multiple quote sequences: (2,4,4)
995 !! options
996 parsoid=wt2html
997 !! wikitext
998 ''foo''''bar''''
999 !! html/*
1000 <p><i>foo'<b>bar'</b></i>
1001 </p>
1002 !! end
1003
1004 # same html as previous, but wikitext adjusted to match parsoid html2wt
1005 !! test
1006 Italics and bold: multiple quote sequences: (2,4,4+2) w/ nowiki
1007 !! wikitext
1008 ''foo'<nowiki/>'''bar'<nowiki/>'''''
1009 !! html
1010 <p><i>foo'<b>bar'</b></i>
1011 </p>
1012 !! end
1013
1014 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
1015 !! test
1016 Italics and bold: multiple quote sequences: (3,4,2)
1017 !! options
1018 parsoid=wt2html
1019 !! wikitext
1020 '''foo''''bar''
1021 !! html/php
1022 <p><b>foo'</b>bar
1023 </p>
1024 !! html/parsoid
1025 <p><b>foo'</b>bar<i></i>
1026 </p>
1027 !! end
1028
1029 # same html as previous, but wikitext adjusted to match parsoid html2wt
1030 !! test
1031 Italics and bold: multiple quote sequences: (3,4,2+2) w/ nowiki
1032 !! wikitext
1033 '''foo''''bar''<nowiki/>''
1034 !! html/php
1035 <p><b>foo'</b>bar
1036 </p>
1037 !! html/parsoid
1038 <p><b>foo'</b>bar<i></i>
1039 </p>
1040 !! end
1041
1042 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
1043 !! test
1044 Italics and bold: multiple quote sequences: (3,4,3)
1045 !! options
1046 parsoid=wt2html
1047 !! wikitext
1048 '''foo''''bar'''
1049 !! html/php
1050 <p><b>foo'</b>bar
1051 </p>
1052 !! html/parsoid
1053 <p><b>foo'</b>bar<b></b>
1054 </p>
1055 !! end
1056
1057 # same html as previous, but wikitext adjusted to match parsoid html2wt
1058 !! test
1059 Italics and bold: multiple quote sequences: (3,4,3+3) w/ nowiki
1060 !! wikitext
1061 '''foo''''bar'''<nowiki/>'''
1062 !! html/php
1063 <p><b>foo'</b>bar
1064 </p>
1065 !! html/parsoid
1066 <p><b>foo'</b>bar<b></b>
1067 </p>
1068 !! end
1069
1070 ###
1071 ### other quote tests
1072 ###
1073 !! test
1074 Italics and bold: other quote tests: (2,3,5)
1075 !! wikitext
1076 ''this is about '''foo's family'''''
1077 !! html
1078 <p><i>this is about <b>foo's family</b></i>
1079 </p>
1080 !!end
1081
1082
1083 !! test
1084 Italics and bold: other quote tests: (2,(3,3),2)
1085 !! wikitext
1086 ''this is about '''foo's''' family''
1087 !! html
1088 <p><i>this is about <b>foo's</b> family</i>
1089 </p>
1090 !!end
1091
1092
1093 !! test
1094 Italics and bold: other quote tests: (3,2,3,2)
1095 !! options
1096 parsoid=wt2html
1097 !! wikitext
1098 '''this is about ''foo'''s family''
1099 !! html/*
1100 <p><b>this is about <i>foo</i></b><i>s family</i>
1101 </p>
1102 !!end
1103
1104
1105 # same html as previous, but wikitext adjusted to match parsoid html2wt
1106 !! test
1107 Italics and bold: other quote tests: (3,2,3+2+2,2)
1108 !! wikitext
1109 '''this is about ''foo'''''<nowiki/>''s family''
1110 !! html
1111 <p><b>this is about <i>foo</i></b><i>s family</i>
1112 </p>
1113 !! end
1114
1115
1116 !! test
1117 Italics and bold: other quote tests: (3,2,3,3)
1118 !! wikitext
1119 '''this is about ''foo'''s family'''
1120 !! html/*
1121 <p>'<i>this is about </i>foo<b>s family</b>
1122 </p>
1123 !!end
1124
1125
1126 !! test
1127 Italics and bold: other quote tests: (3,(2,2),3)
1128 !! wikitext
1129 '''this is about ''foo's'' family'''
1130 !! html
1131 <p><b>this is about <i>foo's</i> family</b>
1132 </p>
1133 !!end
1134
1135
1136 !! test
1137 Italicized possessive
1138 !! wikitext
1139 The ''[[Main Page]]'''s talk page.
1140 !! html/php
1141 <p>The <i><a href="/wiki/Main_Page" title="Main Page">Main Page</a>'</i>s talk page.
1142 </p>
1143 !! html/parsoid
1144 <p>The <i><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a>'</i>s talk page.</p>
1145 !! end
1146
1147 !! test
1148 Parsoid only: Quote balancing context should be restricted to td/th cells on the same wikitext line
1149 (Requires tidy for PHP parser output to be fixed up)
1150 !! options
1151 parsoid=wt2html,wt2wt
1152 !! wikitext
1153 {|
1154 !''a!!''b
1155 |''a||''b
1156 |}
1157 !! html/php+tidy
1158 <table>
1159 <tr>
1160 <th><i>a</i></th>
1161 <th><i>b</i></th>
1162 <td><i>a</i></td>
1163 <td><i>b</i></td>
1164 </tr>
1165 </table>
1166 !! html/parsoid
1167 <table>
1168 <tbody><tr><th><i>a</i></th><th><i>b</i></th>
1169 <td><i>a</i></td><td><i>b</i></td></tr>
1170 </tbody></table>
1171 !! end
1172
1173 ###
1174 ### Non-html5 tags
1175 ###
1176
1177 !! test
1178 Non-html5 tags should be accepted
1179 !! wikitext
1180 <center>''foo''</center>
1181 <big>''foo''</big>
1182 <font>''foo''</font>
1183 <strike>''foo''</strike>
1184 <tt>''foo''</tt>
1185 !! html
1186 <center><i>foo</i></center>
1187 <p><big><i>foo</i></big>
1188 <font><i>foo</i></font>
1189 <strike><i>foo</i></strike>
1190 <tt><i>foo</i></tt>
1191 </p>
1192 !! end
1193
1194 !! test
1195 <wbr> is valid wikitext (T54468)
1196 !! wikitext
1197 <wbr>
1198 !! html
1199 <p><wbr />
1200 </p>
1201 !! end
1202
1203 # <strike> is HTML4, <s> is HTML4/5.
1204 !! test
1205 <s> or <strike> for strikethrough
1206 !! wikitext
1207 <strike>strike</strike>
1208
1209 <s>s</s>
1210 !! html
1211 <p><strike>strike</strike>
1212 </p><p><s>s</s>
1213 </p>
1214 !! end
1215
1216 ## a not permitted
1217 ## i,b,br omitted
1218 !! test
1219 Text-level semantic html elements in wikitext
1220 !! wikitext
1221 <em>text</em>
1222 <strong>text</strong>
1223 <small>text</small>
1224 <s>text</s>
1225 <cite>text</cite>
1226 <q>text</q>
1227 <dfn>text</dfn>
1228 <abbr>text</abbr>
1229 <data>text</data>
1230 <time>text</time>
1231 <code>text</code>
1232 <var>text</var>
1233 <samp>text</samp>
1234 <kbd>text</kbd>
1235 <sub>text</sub>
1236 <u>text</u>
1237 <mark>text</mark>
1238 <ruby><rb>明日</rb><rp>(</rp><rt>Ashita</rt><rp> </rp><rtc>あした</rtc><rp>)</rp></ruby>
1239 <bdi>text</bdi>
1240 <bdo>text</bdo>
1241 <span>text</span>
1242 <wbr />
1243 !! html
1244 <p><em>text</em>
1245 <strong>text</strong>
1246 <small>text</small>
1247 <s>text</s>
1248 <cite>text</cite>
1249 <q>text</q>
1250 <dfn>text</dfn>
1251 <abbr>text</abbr>
1252 <data>text</data>
1253 <time>text</time>
1254 <code>text</code>
1255 <var>text</var>
1256 <samp>text</samp>
1257 <kbd>text</kbd>
1258 <sub>text</sub>
1259 <u>text</u>
1260 <mark>text</mark>
1261 <ruby><rb>明日</rb><rp>(</rp><rt>Ashita</rt><rp> </rp><rtc>あした</rtc><rp>)</rp></ruby>
1262 <bdi>text</bdi>
1263 <bdo>text</bdo>
1264 <span>text</span>
1265 <wbr />
1266 </p>
1267 !! end
1268
1269 # test cases taken from
1270 # https://www.w3.org/TR/html5/text-level-semantics.html#the-ruby-element
1271 !! test
1272 Ruby markup (W3C-style)
1273 !! wikitext
1274 ; Mono-ruby for individual base characters
1275 : <ruby>日<rt>に</rt>本<rt>ほん</rt>語<rt>ご</rt></ruby>
1276 ; Group ruby
1277 : <ruby>今日<rt>きょう</rt></ruby>
1278 ; Jukugo ruby
1279 : <ruby>法<rb>華</rb><rb>経</rb><rt>ほ</rt><rt>け</rt><rt>きょう</rt></ruby>
1280 ; Inline ruby
1281 : <ruby>東<rb>京</rb><rp>(</rp><rt>とう</rt><rt>きょう</rt><rp>)</rp></ruby>
1282 ; Double-sided ruby
1283 : <ruby><rb>旧</rb><rb>金</rb><rb>山</rb><rt>jiù</rt><rt>jīn</rt><rt>shān</rt><rtc>San Francisco</rtc></ruby>
1284 <ruby>
1285 <rb>♥</rb><rtc><rt>Heart</rt></rtc><rtc lang="fr"><rt>Cœur</rt></rtc>
1286 <rb>☘</rb><rtc><rt>Shamrock</rt></rtc><rtc lang="fr"><rt>Trèfle</rt></rtc>
1287 <rb>✶</rb><rtc><rt>Star</rt></rtc><rtc lang="fr"><rt>Étoile</rt></rtc>
1288 </ruby>
1289 !! html
1290 <dl><dt> Mono-ruby for individual base characters</dt>
1291 <dd> <ruby>日<rt>に</rt>本<rt>ほん</rt>語<rt>ご</rt></ruby></dd>
1292 <dt> Group ruby</dt>
1293 <dd> <ruby>今日<rt>きょう</rt></ruby></dd>
1294 <dt> Jukugo ruby</dt>
1295 <dd> <ruby>法<rb>華</rb><rb>経</rb><rt>ほ</rt><rt>け</rt><rt>きょう</rt></ruby></dd>
1296 <dt> Inline ruby</dt>
1297 <dd> <ruby>東<rb>京</rb><rp>(</rp><rt>とう</rt><rt>きょう</rt><rp>)</rp></ruby></dd>
1298 <dt> Double-sided ruby</dt>
1299 <dd> <ruby><rb>旧</rb><rb>金</rb><rb>山</rb><rt>jiù</rt><rt>jīn</rt><rt>shān</rt><rtc>San Francisco</rtc></ruby></dd></dl>
1300 <p><ruby>
1301 <rb>♥</rb><rtc><rt>Heart</rt></rtc><rtc lang="fr"><rt>Cœur</rt></rtc>
1302 <rb>☘</rb><rtc><rt>Shamrock</rt></rtc><rtc lang="fr"><rt>Trèfle</rt></rtc>
1303 <rb>✶</rb><rtc><rt>Star</rt></rtc><rtc lang="fr"><rt>Étoile</rt></rtc>
1304 </ruby>
1305 </p>
1306 !! end
1307
1308 # The next two test different paths in the sanitizer.
1309 !! test
1310 Non-word characters don't terminate tag names (T19663, T42670, T54022)
1311 !! wikitext
1312 <blockquote|>a</blockquote>
1313
1314 <b→> doesn't terminate </b→>
1315
1316 <bä> doesn't terminate </bä>
1317
1318 <boo> doesn't terminate </boo>
1319
1320 <s.foo> doesn't terminate </s.foo>
1321
1322 <sub-ID#1>
1323 !! html
1324 <p>&lt;blockquote|&gt;a&lt;/blockquote&gt;
1325 </p><p>&lt;b→&gt; doesn't terminate &lt;/b→&gt;
1326 </p><p>&lt;bä&gt; doesn't terminate &lt;/bä&gt;
1327 </p><p>&lt;boo&gt; doesn't terminate &lt;/boo&gt;
1328 </p><p>&lt;s.foo&gt; doesn't terminate &lt;/s.foo&gt;
1329 </p><p>&lt;sub-ID#1&gt;
1330 </p>
1331 !! end
1332
1333 # There is a tidy bug here: https://sourceforge.net/p/tidy/bugs/946/
1334 # If the non-word-character tag made it through the sanitizer, tidy
1335 # would munge it up.
1336 !! test
1337 Non-word characters don't terminate tag names + tidy
1338 !! wikitext
1339 <blockquote|>a</blockquote>
1340
1341 <b→> doesn't terminate </b→>
1342
1343 <bä> doesn't terminate </bä>
1344
1345 <boo> doesn't terminate </boo>
1346
1347 <s.foo> doesn't terminate </s.foo>
1348
1349 <sub-ID#1>
1350 !! html+tidy
1351 <p>&lt;blockquote|&gt;a</p>
1352 <p>&lt;b→&gt; doesn't terminate &lt;/b→&gt;</p>
1353 <p>&lt;bä&gt; doesn't terminate &lt;/bä&gt;</p>
1354 <p>&lt;boo&gt; doesn't terminate &lt;/boo&gt;</p>
1355 <p>&lt;s.foo&gt; doesn't terminate &lt;/s.foo&gt;</p>
1356 <p>&lt;sub-ID#1&gt;</p>
1357 !! end
1358
1359 ###
1360 ### See tests/parser/parserTestsParserHook.php for the <tåg> extension)
1361 ### This checks that HTML5 tags (with non-word characters in the tag
1362 ### name) make it safely through the parser -- the Sanitizer will
1363 ### munge them later, as it should.
1364 ###
1365 !! test
1366 Non-word characters are valid in extension tags (T19663)
1367 !! wikitext
1368 <tåg>tåg</tåg>
1369 !! html/php
1370 <pre>
1371 'tåg'
1372 array (
1373 )
1374 </pre>
1375
1376 !! html/parsoid
1377 <pre typeof="mw:Extension/tåg" data-mw='{"name":"tåg","attrs":{},"body":{"extsrc":"tåg"}}' data-parsoid='{}' about="#mwt2"></pre>
1378 !! end
1379
1380 !! test
1381 Isolated close tags should be treated as literal text (T54760)
1382 !! options
1383 parsoid=wt2html
1384 !! wikitext
1385 </b>
1386
1387 <s.foo>s</s>
1388 !! html/php+tidy
1389 <p>&lt;s.foo&gt;s</p>
1390 !! html/parsoid
1391 <p>&lt;s.foo&gt;s</p>
1392 !! end
1393
1394 ###
1395 ### Special characters
1396 ###
1397
1398 !! test
1399 Bare pipe character (T54363)
1400 !! wikitext
1401 |
1402 !! html
1403 <p>|
1404 </p>
1405 !! end
1406
1407 !! test
1408 Bare pipe character from a template (T54363)
1409 !! wikitext
1410 {{pipe}}
1411 !! html
1412 <p>|
1413 </p>
1414 !! end
1415
1416 ###
1417 ### <nowiki> test cases
1418 ###
1419
1420 !! test
1421 <nowiki> unordered list
1422 !! wikitext
1423 <nowiki>* This is not an unordered list item.</nowiki>
1424 !! html/php
1425 <p>* This is not an unordered list item.
1426 </p>
1427 !! html/parsoid
1428 <p><span typeof="mw:Nowiki">* This is not an unordered list item.</span></p>
1429 !! end
1430
1431 !! test
1432 <nowiki> spacing
1433 !! wikitext
1434 <nowiki>Lorem ipsum dolor
1435
1436 sed abit.
1437 sed nullum.
1438
1439 :and a colon
1440 </nowiki>
1441 !! html/php
1442 <p>Lorem ipsum dolor
1443
1444 sed abit.
1445 sed nullum.
1446
1447 :and a colon
1448
1449 </p>
1450 !! html/parsoid
1451 <p><span typeof="mw:Nowiki">Lorem ipsum dolor
1452
1453 sed abit.
1454 sed nullum.
1455
1456 :and a colon
1457 </span></p>
1458 !! end
1459
1460 !! test
1461 Don't parse <nowiki><span class="error"></nowiki> (T149622)
1462 !! wikitext
1463 <nowiki><span class="error"></nowiki>
1464 !! html/php
1465 <p>&lt;span class="error"&gt;
1466 </p>
1467 !! html/parsoid
1468 <p><span typeof="mw:Nowiki">&lt;span class="error"></span></p>
1469 !! end
1470
1471 !! test
1472 nowiki 3
1473 !! wikitext
1474 :There is not nowiki.
1475 :There is <nowiki>nowiki</nowiki>.
1476
1477 #There is not nowiki.
1478 #There is <nowiki>nowiki</nowiki>.
1479
1480 *There is not nowiki.
1481 *There is <nowiki>nowiki</nowiki>.
1482 !! html/php
1483 <dl><dd>There is not nowiki.</dd>
1484 <dd>There is nowiki.</dd></dl>
1485 <ol><li>There is not nowiki.</li>
1486 <li>There is nowiki.</li></ol>
1487 <ul><li>There is not nowiki.</li>
1488 <li>There is nowiki.</li></ul>
1489
1490 !! html/parsoid
1491 <dl><dd data-parsoid='{}'>There is not nowiki.</dd>
1492 <dd data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</dd></dl>
1493
1494 <ol><li data-parsoid='{}'>There is not nowiki.</li>
1495 <li data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</li></ol>
1496
1497 <ul><li data-parsoid='{}'>There is not nowiki.</li>
1498 <li data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</li></ul>
1499 !! end
1500
1501 !! test
1502 Entities inside <nowiki>
1503 !! wikitext
1504 <nowiki>&lt;</nowiki>
1505 !! html/php
1506 <p>&lt;
1507 </p>
1508 !! html/parsoid
1509 <p><span typeof="mw:Nowiki"><span typeof="mw:Entity" data-parsoid='{"src":"&amp;lt;","srcContent":"&lt;"}'>&lt;</span></span></p>
1510 !! end
1511
1512 !! test
1513 Entities inside template parameters
1514 !! wikitext
1515 {{echo|&ndash;}}
1516 !! html/php+tidy
1517 <p>–</p>
1518 !! html/parsoid
1519 <p><span typeof="mw:Transclusion mw:Entity" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&amp;ndash;"}},"i":0}}]}'>&ndash;</span></p>
1520 !! end
1521
1522 !! test
1523 Properly escape nowiki when combined with other wiki markup
1524 !! options
1525 parsoid=html2wt
1526 !! html/parsoid
1527 <p>* &lt;/nowiki&gt; tag</p>
1528 !! wikitext
1529 <nowiki>*</nowiki> <nowiki>&lt;/nowiki&gt;</nowiki> tag
1530 !! end
1531
1532 !! test
1533 T93824: Put escaped HTML tags inside nowiki
1534 !! options
1535 parsoid=html2wt
1536 !! html/parsoid
1537 <p>&lt;h2&gt;foo&lt;/h2&gt;</p>
1538 !! wikitext
1539 <nowiki><h2>foo</h2></nowiki>
1540 !! end
1541
1542 !! test
1543 T71950: 1. Put nowiki as close to cause as possible, even with non-quote escapable chars
1544 !! options
1545 parsoid=html2wt
1546 !! html/parsoid
1547 <p>This text: L'<a rel="mw:WikiLink" href="./Foo">Foo</a>
1548 This text: L''<a rel="mw:WikiLink" href="./Foo">Foo</a>
1549 This text: L'''<a rel="mw:WikiLink" href="./Foo">Foo</a>''</p>
1550 !! wikitext
1551 This text: L'[[Foo]]
1552 This text: L<nowiki>''</nowiki>[[Foo]]
1553 This text: L<nowiki>'''</nowiki>[[Foo]]<nowiki>''</nowiki>
1554 !! end
1555
1556 # This test fails because wikitext whitespace is not normalized before comparing.
1557 !! test
1558 T71950: 2. Put nowiki as close to cause as possible, after ' :'
1559 !! options
1560 parsoid=html2wt
1561 !! html/parsoid
1562 <p>This text : L''<a rel="mw:WikiLink" href="./Foo">Foo</a>
1563 </p>
1564 !! wikitext
1565 This text : L<nowiki>''</nowiki>[[Foo]]
1566 !! end
1567
1568 # This test and the next one are html2wt only as they test that incorrect wikitext
1569 # passed in template arguments gets escaped or wrapped in nowikis where required.
1570 !! test
1571 T71482: Use {{!}} instead of nowiki for single pipe in template argument
1572 !! options
1573 parsoid=html2wt
1574 !! html/parsoid
1575 <p><span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;foo|bar&quot;}},&quot;i&quot;:0}}]}" about="#mwt1"></span>
1576 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;foo|bar |[[&quot;}},&quot;i&quot;:0}}]}" about="#mwt2"></p>
1577 !! wikitext
1578 {{echo|foo{{!}}bar}}
1579 {{echo|<nowiki>foo|bar |[[</nowiki>}}
1580 !! end
1581
1582 !! test
1583 T53961: Output correct nowikis in template arguments
1584 !! options
1585 parsoid=html2wt
1586 !! html/parsoid
1587 <p><span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;a [ b&quot;}},&quot;i&quot;:0}}]}" about="#mwt1"></span>
1588 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;a }} b&quot;}},&quot;i&quot;:0}}]}" about="#mwt2"></span>
1589 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;a [[ b&quot;}},&quot;i&quot;:0}}]}" about="#mwt3"></span>
1590 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;a | {{ ]]&quot;}},&quot;i&quot;:0}}]}" about="#mwt4"></span>
1591 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;a }&quot;}},&quot;i&quot;:0}}]}" about="#mwt5"></span></p>
1592 !! wikitext
1593 {{echo|a [ b}}
1594 {{echo|<nowiki>a }} b</nowiki>}}
1595 {{echo|<nowiki>a [[ b</nowiki>}}
1596 {{echo|<nowiki>a | {{ ]]</nowiki>}}
1597 {{echo|a <nowiki>}</nowiki>}}
1598 !! end
1599
1600 !! test
1601 Cases where "!!" needs nowiki protection
1602 !! options
1603 parsoid=html2wt
1604 !! html/parsoid
1605 <table>
1606 <tr><th>this needs protection !! here</th></tr>
1607 </table>
1608
1609 <table>
1610 <tr><th>this does not need
1611 protection !! here</th></tr>
1612 </table>
1613 !! wikitext
1614 {|
1615 !<nowiki>this needs protection !! here</nowiki>
1616 |}
1617
1618 {|
1619 !this does not need
1620 protection !! here
1621 |}
1622 !! end
1623
1624 ###
1625 ### Comments
1626 ###
1627 !! test
1628 Comments and Indent-Pre
1629 !! wikitext
1630 <!-- comment 1 --> asdf
1631
1632 <!-- comment 1 --> asdf
1633 <!-- comment 2 -->
1634
1635 <!-- comment 1 --> asdf
1636 <!-- comment 2 -->xyz
1637
1638 <!-- comment 1 --> asdf
1639 <!-- comment 2 --> xyz
1640 !! html
1641 <pre>asdf
1642 </pre>
1643 <pre>asdf
1644 </pre>
1645 <pre>asdf
1646 </pre>
1647 <p>xyz
1648 </p>
1649 <pre>asdf
1650 xyz
1651 </pre>
1652 !! end
1653
1654 !! test
1655 Comment test 2a
1656 !! wikitext
1657 asdf
1658 <!-- comment 1 -->
1659 jkl
1660 !! html
1661 <p>asdf
1662 jkl
1663 </p>
1664 !! end
1665
1666 !! test
1667 Comment test 2b
1668 !! wikitext
1669 asdf
1670 <!-- comment 1 -->
1671
1672 jkl
1673 !! html
1674 <p>asdf
1675 </p><p>jkl
1676 </p>
1677 !! end
1678
1679 !! test
1680 Comment test 3
1681 !! wikitext
1682 asdf
1683 <!-- comment 1 -->
1684 <!-- comment 2 -->
1685 jkl
1686 !! html
1687 <p>asdf
1688 jkl
1689 </p>
1690 !! end
1691
1692 !! test
1693 Comment test 4
1694 !! wikitext
1695 asdf<!-- comment 1 -->jkl
1696 !! html
1697 <p>asdfjkl
1698 </p>
1699 !! end
1700
1701 !! test
1702 Comment spacing
1703 !! wikitext
1704 a
1705 <!-- foo --> b <!-- bar -->
1706 c
1707 !! html
1708 <p>a
1709 </p>
1710 <pre> b
1711 </pre>
1712 <p>c
1713 </p>
1714 !! end
1715
1716 !! test
1717 Comment whitespace
1718 !! wikitext
1719 <!-- returns a single newline, not nothing, since the newline after > is not stripped -->
1720 !! html
1721
1722 !! end
1723
1724 !! test
1725 Comment semantics and delimiters
1726 !! wikitext
1727 <!-- --><!----><!-----><!------>
1728 !! html/php
1729
1730 !! html/parsoid
1731 <!-- --><!----><!--&#x2D;--><!--&#x2D;&#x2D;-->
1732 !! end
1733
1734 !! test
1735 Comment semantics and delimiters, redux
1736 !! wikitext
1737 <!-- In SGML every "foo" here would actually show up in the text -- foo -- bar
1738 -- foo -- funky huh? ... -->
1739 !! html/php
1740
1741 !! html/parsoid
1742 <!-- In SGML every "foo" here would actually show up in the text &#x2D;&#x2D; foo &#x2D;&#x2D; bar
1743 &#x2D;&#x2D; foo &#x2D;&#x2D; funky huh? ... -->
1744 !! end
1745
1746 !! test
1747 Comment semantics and delimiters: directors cut
1748 !! wikitext
1749 <!-- ... However we like to keep things simple and somewhat XML-ish so we eat
1750 everything starting with < followed by !-- until the first -- and > we see,
1751 that wouldn't be valid XML however, since in XML -- has to terminate a comment
1752 -->-->
1753 !! html/php
1754 <p>--&gt;
1755 </p>
1756 !! html/parsoid
1757 <!-- ... However we like to keep things simple and somewhat XML&#x2D;ish so we eat
1758 everything starting with < followed by !&#x2D;&#x2D; until the first &#x2D;&#x2D; and &#x3E; we see,
1759 that wouldn't be valid XML however, since in XML &#x2D;&#x2D; has to terminate a comment
1760 --><p>--></p>
1761 !! end
1762
1763 !! test
1764 Comment semantics: nesting
1765 !! wikitext
1766 <!--<!-- no, we're not going to do anything fancy here -->-->
1767 !! html/php
1768 <p>--&gt;
1769 </p>
1770 !! html/parsoid
1771 <!--<!&#x2D;&#x2D; no, we're not going to do anything fancy here --><p>--></p>
1772 !! end
1773
1774 # Parsoid closes the unclosed comment, even if it means a slight
1775 # round-trip diff.
1776 !! test
1777 Comment semantics: unclosed comment at end
1778 !! options
1779 parsoid=wt2html,html2html
1780 !! wikitext
1781 <!--This comment will run out to the end of the document
1782 !! html/php
1783
1784 !! html/parsoid
1785 <!--This comment will run out to the end of the document-->
1786 !! end
1787
1788 !! test
1789 Comment semantics: normalize comments to play nice with XML and browsers
1790 !! wikitext
1791 <!-- Browsers --!> think this is closed -->
1792 <!--> This would normally be text -->
1793 <!---> As would this -->
1794 <!-- XML doesn't like trailing dashes -------->
1795 <!-- Nor doubled hyphens -- anywhere in the data -->
1796 But this is not a comment.
1797 !! html/php
1798 <p>But this is not a comment.
1799 </p>
1800 !! html/parsoid
1801 <!-- Browsers &#x2D;&#x2D;!&#x3E; think this is closed -->
1802 <!--&#x3E; This would normally be text -->
1803 <!--&#x2D;&#x3E; As would this -->
1804 <!-- XML doesn't like trailing dashes &#x2D;&#x2D;&#x2D;&#x2D;&#x2D;&#x2D;-->
1805 <!-- Nor doubled hyphens &#x2D;&#x2D; anywhere in the data -->
1806 <p>But this is not a comment.</p>
1807 !! end
1808
1809 !! test
1810 Comment semantics: round-trip even text which contains encoded -->
1811 !! wikitext
1812 <!-- hello & goodbye - > --&gt; --&amp;gt; --&xx -->
1813 !! html/parsoid
1814 <!-- hello &#x26; goodbye &#x2D; &#x3E; &#x2D;&#x2D;&#x3E; &#x2D;&#x2D;&#x26;gt; &#x2D;&#x2D;&#x26;xx -->
1815 !! end
1816
1817 !! test
1818 Comment in template title
1819 !! wikitext
1820 {{f<!---->oo}}
1821 !! html
1822 <p>FOO
1823 </p>
1824 !! end
1825
1826 !! test
1827 Comment on its own line post-expand
1828 !! wikitext
1829 a
1830 {{blank}}<!---->
1831 b
1832 !! html
1833 <p>a
1834 </p><p>b
1835 </p>
1836 !! end
1837
1838 !! test
1839 Comment on its own line post-expand with non-significant whitespace
1840 !! wikitext
1841 a
1842 {{blank}} <!---->
1843 b
1844 !! html
1845 <p>a
1846 </p><p>b
1847 </p>
1848 !! end
1849
1850 !! test
1851 Multiple comments should still parse as SOL-transparent
1852 !! options
1853 parsoid=wt2html,wt2wt
1854 !! wikitext
1855 <!--c1-->*a
1856 <!--c2--><!--c3--><!--c4-->*b
1857 !! html/php
1858 <ul><li>a</li>
1859 <li>b</li></ul>
1860
1861 !! html/parsoid
1862 <!--c1--><ul>
1863 <li>a
1864 </li>
1865 <!--c2--><!--c3--><!--c4-->
1866 <li>b
1867 </li>
1868 </ul>
1869 !! end
1870
1871 ## Make sure ">" gets escaped in comments to avoid XSS
1872 !! test
1873 IE conditional comments
1874 !! wikitext
1875 <!--[if lt IE 9]>
1876 <script>alert('hi');</script>
1877 <![endif]-->
1878 !! html/parsoid
1879 <!--[if lt IE 9]&#x3E;
1880 <script&#x3E;alert('hi');</script&#x3E;
1881 <![endif]-->
1882 !! end
1883
1884 ###
1885 ### paragraph wrapping tests
1886 ###
1887 !! test
1888 No block tags
1889 !! wikitext
1890 a
1891
1892 b
1893 !! html
1894 <p>a
1895 </p><p>b
1896 </p>
1897 !! end
1898
1899 !! test
1900 Block tag on one line (<div>)
1901 !! wikitext
1902 a <div>foo</div>
1903
1904 b
1905 !! html
1906 a <div>foo</div>
1907 <p>b
1908 </p>
1909 !! html+tidy
1910 <p>a</p>
1911 <div>foo</div>
1912 <p>b</p>
1913 !! end
1914
1915 !! test
1916 Block tag on one line (<blockquote>)
1917 !! wikitext
1918 a <blockquote>foo</blockquote>
1919
1920 b
1921 !! html
1922 a <blockquote>foo</blockquote>
1923 <p>b
1924 </p>
1925 !! html+tidy
1926 <p>a</p>
1927 <blockquote>
1928 <p>foo</p>
1929 </blockquote>
1930 <p>b</p>
1931 !! end
1932
1933 !! test
1934 Block tag on both lines (<div>)
1935 !! wikitext
1936 a <div>foo</div>
1937
1938 b <div>foo</div>
1939 !! html
1940 a <div>foo</div>
1941 b <div>foo</div>
1942
1943 !! html+tidy
1944 <p>a</p>
1945 <div>foo</div>
1946 <p>b</p>
1947 <div>foo</div>
1948 !! end
1949
1950 !! test
1951 Block tag on both lines (<blockquote>)
1952 !! wikitext
1953 a <blockquote>foo</blockquote>
1954
1955 b <blockquote>foo</blockquote>
1956 !! html
1957 a <blockquote>foo</blockquote>
1958 b <blockquote>foo</blockquote>
1959
1960 !! html+tidy
1961 <p>a</p>
1962 <blockquote>
1963 <p>foo</p>
1964 </blockquote>
1965 <p>b</p>
1966 <blockquote>
1967 <p>foo</p>
1968 </blockquote>
1969 !! end
1970
1971 !! test
1972 Multiple lines without block tags
1973 !! wikitext
1974 <div>foo</div> a
1975 b
1976 c
1977 d<!--foo--> e
1978 x <div>foo</div> z
1979 !! html
1980 <div>foo</div> a
1981 <p>b
1982 c
1983 d e
1984 </p>
1985 x <div>foo</div> z
1986
1987 !! html+tidy
1988 <div>foo</div>
1989 <p>a</p>
1990 <p>b c d e</p>
1991 <p>x</p>
1992 <div>foo</div>
1993 <p>z</p>
1994 !! end
1995
1996 # Tidy strips out the empty <div> tags. Parsoid doesn't.
1997 # So, we have a separate section for Parsoid. We don't want
1998 # to mimic this stripping behavior in Parsoid. It affects
1999 # editing experience and also requires us to maintain additional
2000 # info for RT-ing.
2001 !! test
2002 Empty lines between lines with block tags
2003 !! wikitext
2004 <div></div>
2005
2006
2007 <div></div>a
2008
2009 b
2010 <div>a</div>b
2011
2012 <div>b</div>d
2013
2014
2015 <div>e</div>
2016 !! html
2017 <div></div>
2018 <p><br />
2019 </p>
2020 <div></div>a
2021 <p>b
2022 </p>
2023 <div>a</div>b
2024 <div>b</div>d
2025 <p><br />
2026 </p>
2027 <div>e</div>
2028
2029 !! html+tidy
2030 <p><br /></p>
2031 <p>a</p>
2032 <p>b</p>
2033 <div>a</div>
2034 <p>b</p>
2035 <div>b</div>
2036 <p>d</p>
2037 <p><br /></p>
2038 <div>e</div>
2039 !! html/parsoid
2040 <div data-parsoid='{"stx":"html"}'></div>
2041
2042 <p><br /></p>
2043 <div data-parsoid='{"stx":"html"}'></div><p>a</p>
2044
2045 <p>b</p>
2046 <div data-parsoid='{"stx":"html"}'>a</div><p>b</p>
2047
2048 <div data-parsoid='{"stx":"html"}'>b</div><p>d</p>
2049
2050 <p><br /></p>
2051 <div data-parsoid='{"stx":"html"}'>e</div>
2052 !! end
2053
2054 ## PHP parser emits output which is broken
2055 !! test
2056 Unclosed HTML p-tags should be handled properly
2057 !! wikitext
2058 <div><p>foo</div>
2059 a
2060
2061 b
2062 !! html/php+tidy
2063 <div>
2064 <p>foo</p>
2065 </div>
2066 <p>a</p>
2067 <p>b</p>
2068 !! html/parsoid
2069 <div data-parsoid='{"stx":"html"}'><p data-parsoid='{"stx":"html", "autoInsertedEnd":true}'>foo</p></div>
2070 <p>a</p>
2071 <p>b</p>
2072 !! end
2073
2074 ## SSS FIXME: I can come up with other scenarios where this doesn't work because
2075 ## of eager output of buffered tokens in the p-wrapper. But, I'm going to ignore
2076 ## them for now.
2077 !! test
2078 1. P-wrapping should leave sol-transparent tags outside p-tags where possible
2079 !! options
2080 parsoid=wt2html
2081 !! wikitext
2082 a [[Category:A1]] [[Category:A2]]
2083 [[Category:A3]]
2084 [[Category:A4]]
2085 !! html/parsoid
2086 <p>a</p>
2087 <link rel="mw:PageProp/Category" href="./Category:A1"/> <link rel="mw:PageProp/Category" href="./Category:A2"/> <link rel="mw:PageProp/Category" href="./Category:A3"/> <link rel="mw:PageProp/Category" href="./Category:A4"/>
2088 !! end
2089
2090 !! test
2091 2. P-wrapping should leave sol-transparent tags outside p-tags where possible
2092 !! options
2093 parsoid=wt2html
2094 !! wikitext
2095 [[Category:A1]]a
2096 !! html/parsoid
2097 <link rel="mw:PageProp/Category" href="./Category:A1"/><p>a</p>
2098 !! end
2099
2100 ###
2101 ### Preformatted text
2102 ###
2103 !! test
2104 Preformatted text
2105 !! wikitext
2106 This is some
2107 Preformatted text
2108 With ''italic''
2109 And '''bold'''
2110 And a [[Main Page|link]]
2111 !! html
2112 <pre>This is some
2113 Preformatted text
2114 With <i>italic</i>
2115 And <b>bold</b>
2116 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
2117 </pre>
2118 !! end
2119
2120 !! test
2121 Tabs don't trigger preformatted text
2122 !! wikitext
2123 This is not
2124 preformatted text.
2125 This is preformatted text.
2126 So is this.
2127 !! html/php
2128 <p> This is not
2129 preformatted text.
2130 </p>
2131 <pre>This is preformatted text.
2132 So is this.
2133 </pre>
2134 !! html/parsoid
2135 <p> This is not
2136 preformatted text.</p>
2137 <pre>This is preformatted text.
2138 So is this.</pre>
2139 !! end
2140
2141 !! test
2142 Space before tab needs nowiki pre protection
2143 !! options
2144 parsoid=html2wt
2145 !! html/parsoid
2146 <p> a</p>
2147 !! wikitext
2148 <nowiki> </nowiki> a
2149 !! end
2150
2151 !! test
2152 Ident preformatting with inline content
2153 !! wikitext
2154 a
2155 ''b''
2156 !! html
2157 <pre>a
2158 <i>b</i>
2159 </pre>
2160 !! end
2161
2162 !! test
2163 <pre> with <nowiki> inside (compatibility with 1.6 and earlier)
2164 !! wikitext
2165 <pre><nowiki>
2166 <b>
2167 <cite>
2168 <em>
2169 </nowiki></pre>
2170 !! html
2171 <pre>
2172 &lt;b&gt;
2173 &lt;cite&gt;
2174 &lt;em&gt;
2175 </pre>
2176
2177 !! end
2178
2179 !! test
2180 Regression with preformatted in <center>
2181 !! wikitext
2182 <center>
2183 Blah
2184 </center>
2185 !! html
2186 <center>
2187 <pre>Blah
2188 </pre>
2189 </center>
2190
2191 !! end
2192
2193 !! test
2194 T54763: Preformatted in <blockquote>
2195 !! wikitext
2196 <blockquote>
2197 Blah
2198 {|
2199 |
2200 indented cell (no pre-wrapping!)
2201 |}
2202 </blockquote>
2203 !! html
2204 <blockquote>
2205 <p> Blah
2206 </p>
2207 <table>
2208 <tr>
2209 <td>
2210 <p> indented cell (no pre-wrapping!)
2211 </p>
2212 </td></tr></table>
2213 </blockquote>
2214
2215 !! end
2216
2217 !! test
2218 T53086: Double newlines in blockquotes should be turned into paragraphs
2219 !! wikitext
2220 <blockquote>
2221 Foo
2222
2223 Bar
2224 </blockquote>
2225 !! html
2226 <blockquote>
2227 <p>Foo
2228 </p><p>Bar
2229 </p>
2230 </blockquote>
2231
2232 !! end
2233
2234 !! test
2235 T17491: <ins>/<del> in blockquote
2236 !! wikitext
2237 <blockquote>
2238 Foo <del>bar</del> <ins>baz</ins> quux
2239 </blockquote>
2240 !! html
2241 <blockquote>
2242 <p>Foo <del>bar</del> <ins>baz</ins> quux
2243 </p>
2244 </blockquote>
2245
2246 !! end
2247
2248 # Note that the p-wrapping is newline sensitive, which could be
2249 # considered a bug: tidy will wrap only the 'Foo' in the example
2250 # below in a <p> tag. (see comment 23-25 of T8200)
2251 !! test
2252 T17491: <ins>/<del> in blockquote (2)
2253 !! wikitext
2254 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
2255 </blockquote>
2256 !! html
2257 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
2258 </blockquote>
2259
2260 !! html+tidy
2261 <blockquote>
2262 <p>Foo</p>
2263 <del>bar</del> <ins>baz</ins> quux</blockquote>
2264 !! end
2265
2266 !! test
2267 <pre> with attributes (T5202)
2268 !! wikitext
2269 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
2270 !! html
2271 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
2272
2273 !! end
2274
2275 !! test
2276 <pre> with width attribute (T5202)
2277 !! wikitext
2278 <pre width="8">Narrow screen goodies</pre>
2279 !! html
2280 <pre width="8">Narrow screen goodies</pre>
2281
2282 !! end
2283
2284 !! test
2285 <pre> with forbidden attribute (T5202)
2286 !! wikitext
2287 <pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
2288 !! html
2289 <pre width="8">Narrow screen goodies</pre>
2290
2291 !! end
2292
2293 !! test
2294 Entities inside <pre>
2295 !! wikitext
2296 <pre>&lt;</pre>
2297 !! html
2298 <pre>&lt;</pre>
2299
2300 !! end
2301
2302 !! test
2303 <pre> with forbidden attribute values (T5202)
2304 !! wikitext
2305 <pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
2306 !! html
2307 <pre width="8" style="/* insecure input */">Narrow screen goodies</pre>
2308
2309 !! end
2310
2311 !! test
2312 <nowiki> inside <pre> (T15238)
2313 !! wikitext
2314 <pre>
2315 <nowiki>
2316 </pre>
2317 <pre>
2318 <nowiki></nowiki>
2319 </pre>
2320 <pre><nowiki><nowiki></nowiki>Foo<nowiki></nowiki></nowiki></pre>
2321 !! html
2322 <pre>
2323 &lt;nowiki&gt;
2324 </pre>
2325 <pre>
2326
2327 </pre>
2328 <pre>&lt;nowiki&gt;Foo&lt;/nowiki&gt;</pre>
2329
2330 !! end
2331
2332 !! test
2333 <nowiki> inside of #tag:pre
2334 !! wikitext
2335 {{#tag:pre|Foo <nowiki>&rarr;bar</nowiki>}}
2336 !! html/php
2337 <pre>Foo &#8594;bar</pre>
2338
2339 !! html/parsoid
2340 <pre about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"#tag:pre","function":"tag"},"params":{"1":{"wt":"Foo &lt;nowiki>&amp;rarr;bar&lt;/nowiki>"}},"i":0}}]}'>Foo <span typeof="mw:Entity">→</span>bar</pre>
2341 !! end
2342
2343 ## Don't expect this to rt, Parsoid drops the unmatched closing pre tags that
2344 ## aren't enclosed in nowikis.
2345 !! test
2346 <nowiki> and <pre> preference (first one wins)
2347 !! options
2348 parsoid=wt2html
2349 !! wikitext
2350 <pre>
2351 <nowiki>
2352 </pre>
2353 </nowiki>
2354 </pre>
2355
2356 <nowiki>
2357 <pre>
2358 <nowiki>
2359 </pre>
2360 </nowiki>
2361 </pre>
2362
2363 !! html/php
2364 <pre>
2365 &lt;nowiki&gt;
2366 </pre>
2367 <p>&lt;/nowiki&gt;
2368 &lt;/pre&gt;
2369 </p><p>
2370 &lt;pre&gt;
2371 &lt;nowiki&gt;
2372 &lt;/pre&gt;
2373
2374 &lt;/pre&gt;
2375 </p>
2376 !! html/parsoid
2377 <pre typeof="mw:Extension/pre" about="#mwt2" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\n&lt;nowiki>\n"}}'>&lt;nowiki>
2378 </pre>
2379 <p>&lt;/nowiki></p>
2380
2381
2382 <p><span typeof="mw:Nowiki">
2383 &lt;pre>
2384 &lt;nowiki>
2385 &lt;/pre>
2386 </span></p>
2387 !! end
2388
2389 !! test
2390 </pre> inside nowiki
2391 !! wikitext
2392 <nowiki></pre></nowiki>
2393 !! html
2394 <p>&lt;/pre&gt;
2395 </p>
2396 !! end
2397
2398 # Parsoid doesn't strip empty tags, like Tidy does.
2399 !! test
2400 Empty pre; pre inside other HTML tags (T56946)
2401 !! wikitext
2402 a
2403
2404 <div><pre>
2405 foo
2406 </pre></div>
2407 <pre></pre>
2408 !! html/php
2409 <p>a
2410 </p>
2411 <div><pre>
2412 foo
2413 </pre></div>
2414 <pre></pre>
2415
2416 !! html/php+tidy
2417 <p>a</p>
2418 <div>
2419 <pre>
2420 foo
2421 </pre></div>
2422 !! html/parsoid
2423 <p>a</p>
2424
2425 <div data-parsoid='{"stx":"html"}'><pre typeof="mw:Extension/pre" about="#mwt2" data-parsoid='{"stx":"html"}' data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\nfoo\n"}}'>foo
2426 </pre></div>
2427 <pre typeof="mw:Extension/pre" about="#mwt4" data-parsoid='{"stx":"html"}' data-mw='{"name":"pre","attrs":{},"body":{"extsrc":""}}'></pre>
2428 !! end
2429
2430 !! test
2431 HTML pre followed by indent-pre
2432 !! wikitext
2433 <pre>foo</pre>
2434 bar
2435 !! html
2436 <pre>foo</pre>
2437 <pre>bar
2438 </pre>
2439 !! end
2440
2441 # Note that tidy removes the empty <p> tags from the start and end.
2442 # Parsoid does not, by design.
2443 !! test
2444 Block tag pre
2445 !! wikitext
2446 <p><pre>foo</pre></p>
2447 !! html/php+tidy
2448 <pre>
2449 foo
2450 </pre>
2451 !! html/parsoid
2452 <p data-parsoid='{"stx":"html","autoInsertedEnd":true}'></p><pre typeof="mw:Extension/pre" about="#mwt2" data-parsoid='{"stx":"html"}' data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"foo"}}'>foo</pre><p data-parsoid='{"autoInsertedStart":true,"stx":"html"}'></p>
2453 !! end
2454
2455 !!test
2456 Templates: Indent-Pre: 1a. Templates that break a line should suppress <pre>
2457 !! wikitext
2458 {{echo|}}
2459 !! html
2460
2461 !!end
2462
2463 !!test
2464 Templates: Indent-Pre: 1b. Templates that break a line should suppress <pre>
2465 !! wikitext
2466 {{echo|
2467 foo}}
2468 !! html
2469 <p>foo
2470 </p>
2471 !!end
2472
2473 !! test
2474 Templates: Indent-Pre: 1c: Wrapping should be based on expanded content
2475 !! wikitext
2476 {{echo|a
2477 b}}
2478 !! html
2479 <pre>a
2480 </pre>
2481 <p>b
2482 </p>
2483 !!end
2484
2485 !! test
2486 Templates: Indent-Pre: 1d: Wrapping should be based on expanded content
2487 !! wikitext
2488 {{echo|a
2489 b
2490 c
2491 d
2492 e
2493 }}
2494 !! html
2495 <pre>a
2496 </pre>
2497 <p>b
2498 c
2499 </p>
2500 <pre>d
2501 </pre>
2502 <p>e
2503 </p>
2504 !!end
2505
2506 !!test
2507 Templates: Indent-Pre: 1e. Wrapping should be based on expanded content
2508 !! wikitext
2509 {{echo| foo}}
2510
2511 {{echo| foo}}{{echo| bar}}
2512
2513 {{echo| foo}}
2514 {{echo| bar}}
2515
2516 {{echo|<!--cmt--> foo}}
2517
2518 <!--cmt-->{{echo| foo}}
2519
2520 {{echo|{{echo| }}bar}}
2521 !! html
2522 <pre>foo
2523 </pre>
2524 <pre>foo bar
2525 </pre>
2526 <pre>foo
2527 bar
2528 </pre>
2529 <pre>foo
2530 </pre>
2531 <pre>foo
2532 </pre>
2533 <pre>bar
2534 </pre>
2535 !!end
2536
2537 !! test
2538 Templates: Indent-Pre: 1f: Wrapping should be based on expanded content
2539 !! wikitext
2540 {{echo| }}a
2541
2542 {{echo|
2543 }}a
2544
2545 {{echo|
2546 b}}
2547
2548 {{echo|a
2549 }}b
2550
2551 {{echo|a
2552 }} b
2553 !! html
2554 <pre>a
2555 </pre>
2556 <p><br />
2557 </p>
2558 <pre>a
2559 </pre>
2560 <p><br />
2561 </p>
2562 <pre>b
2563 </pre>
2564 <p>a
2565 </p>
2566 <pre>b
2567 </pre>
2568 <p>a
2569 </p>
2570 <pre>b
2571 </pre>
2572 !!end
2573
2574 ## Hmm, should Parsoid rt this?
2575 !! test
2576 Pres with newline attributes
2577 !! options
2578 parsoid=wt2html,html2html
2579 !! wikitext
2580 <pre class="one
2581 two">hi</pre>
2582 !! html/php
2583 <pre class="one two">hi</pre>
2584
2585 !! html/parsoid
2586 <pre typeof="mw:Extension/pre" about="#mwt2" class="one two" data-mw='{"name":"pre","attrs":{"class":"one two"},"body":{"extsrc":"hi"}}'>hi</pre>
2587 !! end
2588
2589 !! test
2590 Things that look like <pre> tags aren't treated as such
2591 !! wikitext
2592 Barack Obama <President> of the United States
2593 <President></President>
2594 !! html
2595 <p>Barack Obama &lt;President&gt; of the United States
2596 &lt;President&gt;&lt;/President&gt;
2597 </p>
2598 !! end
2599
2600 !! test
2601 Handle broken pre-like tags (T66025)
2602 !! options
2603 parsoid=wt2html
2604 !! wikitext
2605 {{echo|<pre <pre>x</pre>}}
2606
2607 <table><pre </table>
2608 !! html/php
2609 <pre>x</pre>
2610 <table>&lt;pre </table>
2611
2612 !! html/php+tidy
2613 <pre>
2614 x
2615 </pre>
2616 <p>&lt;pre</p>
2617 !! html/parsoid
2618 <pre about="#mwt1" typeof="mw:Transclusion mw:Extension/pre" data-parsoid='{"a":{"&lt;pre":null},"sa":{"&lt;pre":""},"stx":"html","pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;pre &lt;pre>x&lt;/pre>"}},"i":0}}]}'>x</pre>
2619
2620
2621 <p>&lt;pre </p>
2622
2623 <table></table>
2624 !! end
2625
2626 !! test
2627 Parsoid: handle pre with space after attribute
2628 !! options
2629 parsoid=wt2html
2630 !! wikitext
2631 <pre style="width:50%;" >{{echo|foo}}</pre>
2632 !! html/php
2633 <pre style="width:50%;">{{echo|foo}}</pre>
2634
2635 !! html/parsoid
2636 <pre typeof="mw:Extension/pre" about="#mwt2" style="width:50%;" data-mw='{"name":"pre","attrs":{"style":"width:50%;"},"body":{"extsrc":"{{echo|foo}}"}}'>{{echo|foo}}</pre>
2637 !! end
2638
2639 # TODO / maybe: fix wt2wt for this
2640 !! test
2641 Parsoid: Don't paragraph-wrap fosterable content
2642 !! options
2643 parsoid=wt2html
2644 !! wikitext
2645 {|
2646 <td></td>
2647 <td></td>
2648
2649
2650
2651 |}
2652 !! html
2653 <table>
2654
2655 <tbody>
2656 <tr>
2657 <td></td>
2658
2659 <td></td></tr>
2660
2661
2662
2663 </tbody></table>
2664 !! end
2665
2666 !! test
2667 Parsoid: Don't paragraph-wrap fosterable content even if table syntax is unbalanced
2668 !! options
2669 parsoid=wt2html
2670 !! wikitext
2671 {|
2672 <td>
2673 <td>
2674 </td>
2675
2676
2677
2678 |}
2679 !! html
2680 <table>
2681
2682 <tbody>
2683 <tr>
2684 <td></td>
2685
2686 <td>
2687 </td></tr>
2688
2689
2690
2691 </tbody></table>
2692 !! end
2693
2694
2695 #--------------------------------------------------------------------
2696 # Transclusion parameter whitespace stripping tests
2697 # Behavior is different for positional and named parameters
2698 #--------------------------------------------------------------------
2699 !! test
2700 Templates: Strip leading and trailing whitespace from named-param values
2701 !! wikitext
2702 {{echo|1= a }}
2703
2704 {{echo|1= {{echo|b}} }}
2705
2706 {{echo| 1 =
2707 c }}
2708
2709 {{echo| 1 =
2710 * d
2711 }}
2712 !! html
2713 <p>a
2714 </p><p>b
2715 </p><p>c
2716 </p>
2717 <ul><li> d</li></ul>
2718
2719 !! end
2720
2721 !! test
2722 Templates: Don't strip whitespace from positional-param values
2723 !! wikitext
2724 {{echo|a }}
2725
2726 {{echo|{{echo|b}} }}
2727
2728 {{echo| c
2729 }}
2730
2731 {{echo| {{echo|d}}
2732 }}
2733
2734 {{echo|
2735 e}}
2736
2737 {{echo|
2738 * f}}
2739
2740 {{echo|
2741 }}g
2742 !! html
2743 <p>a
2744 </p><p>b
2745 </p>
2746 <pre>c
2747 </pre>
2748 <p><br />
2749 </p>
2750 <pre>d
2751 </pre>
2752 <p><br />
2753 </p>
2754 <pre>e
2755 </pre>
2756 <p><br />
2757 </p>
2758 <ul><li> f</li></ul>
2759 <p><br />
2760 </p>
2761 <pre>g
2762 </pre>
2763 !! end
2764
2765 !! test
2766 Templates: Don't recognize targets split by newlines
2767 !! options
2768 parsoid=wt2html
2769 !! wikitext
2770 {{ech
2771 o|foo}}
2772 !! html/php
2773 <p>{{ech
2774 o|foo}}
2775 </p>
2776 !! html/parsoid
2777 <p>{{ech
2778 o|foo}}</p>
2779 !! end
2780
2781 !! test
2782 Templates: Recognize targets when newlines and comments don't split the target
2783 !! options
2784 parsoid=wt2html
2785 !! wikitext
2786 {{
2787 <!--X--> ech<!--X-->o<!--X-->
2788 <!--X--> <!--X-->
2789
2790 |foo}}
2791 !! html/php
2792 <p>foo
2793 </p>
2794 !! html/parsoid
2795 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"ech&lt;!--X-->o&lt;!--X--> \n &lt;!--X--> &lt;!--X-->\n\n ","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2796 !! end
2797
2798 !! test
2799 Templates: Handle empty comment-and-ws-only lines correctly
2800 !! wikitext
2801 {{echo|foo
2802 <!--should be ignored-->
2803 <!--should be ignored as well-->
2804 bar}}
2805 !! html/php
2806 <p>foo
2807 bar
2808 </p>
2809 !! html/parsoid
2810 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo\n&lt;!--should be ignored-->\n &lt;!--should be ignored as well-->\nbar"}},"i":0}}]}'>foo <!--should be ignored--> <!--should be ignored as well--> bar</p>
2811 !! end
2812
2813 !! test
2814 Templates: Handle comments in the target
2815 !! wikitext
2816 {{echo
2817 <!-- should be ignored -->
2818 |foo}}
2819
2820 {{echo
2821 <!-- should be ignored and spaces on next line should not trip us up (T147742) -->
2822 |foo}}
2823
2824 {{echo<!-- should be ignored -->
2825 |foo}}
2826
2827 {{echo<!-- should be ignored -->|foo}}
2828
2829 {{<!-- should be ignored -->echo|foo}}
2830 !! html/php
2831 <p>foo
2832 </p><p>foo
2833 </p><p>foo
2834 </p><p>foo
2835 </p><p>foo
2836 </p>
2837 !! html/parsoid
2838 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo\n&lt;!-- should be ignored -->\n","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2839
2840 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo\n&lt;!-- should be ignored and spaces on next line should not trip us up (T147742) -->\n ","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2841
2842 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo&lt;!-- should be ignored -->\n","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2843
2844 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo&lt;!-- should be ignored -->","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2845
2846 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2847 !! end
2848
2849 !! test
2850 Templates: Handle comments in parameter names (T69657)
2851 !! wikitext
2852 {{echo|1
2853 <!-- should be ignored -->
2854 =foo}}
2855
2856 {{echo|
2857 <!-- should be ignored -->
2858 1 = foo}}
2859
2860 {{echo|1<!-- should be ignored -->=foo}}
2861
2862 {{echo|<!-- should be ignored -->1=foo}}
2863 !! html/php
2864 <p>foo
2865 </p><p>foo
2866 </p><p>foo
2867 </p><p>foo
2868 </p>
2869 !! html/parsoid
2870 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo","key":{"wt":"1\n&lt;!-- should be ignored -->"}}},"i":0}}]}'>foo</p>
2871
2872 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo","key":{"wt":"&lt;!-- should be ignored -->\n1"}}},"i":0}}]}'>foo</p>
2873
2874 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo","key":{"wt":"1&lt;!-- should be ignored -->"}}},"i":0}}]}'>foo</p>
2875
2876 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo","key":{"wt":"&lt;!-- should be ignored -->1"}}},"i":0}}]}'>foo</p>
2877 !! end
2878
2879 !! test
2880 Templates: Other wikitext in parameter names (T69657)
2881 !! wikitext
2882 {{echo|''1''=foo}}
2883 !! html/php
2884 <p>{{{1}}}
2885 </p>
2886 !! html/parsoid
2887 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"&#39;&#39;1&#39;&#39;":{"wt":"foo"}},"i":0}}]}'>{{{1}}}</p>
2888 !! end
2889
2890 !! test
2891 Templates: With colons
2892 !! wikitext
2893 {{With: Colon}}
2894 !! html/php
2895 <p>Template with colon
2896 </p>
2897 !! html/parsoid
2898 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"With: Colon","href":"./Template:With:_Colon"},"params":{},"i":0}}]}'>Template with colon</p>
2899 !! end
2900
2901 #--------------------------------------------------------------------
2902 # Transclusion parameter escaping tests
2903 #--------------------------------------------------------------------
2904
2905 !! test
2906 Templates: Parsoid parameter escaping test 1
2907 !! wikitext
2908 {{echo|[foo]|{{echo|[bar]}}}}
2909 !! html/php+tidy
2910 <p>[foo]</p>
2911 !! html/parsoid
2912 <p about="#mwt1" typeof="mw:Transclusion"
2913 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[foo]"},"2":{"wt":"{{echo|[bar]}}"}},"i":0}}]}'>[foo]</p>
2914 !! end
2915
2916 !! test
2917 Parsoid: Pipes in external links in template parameter
2918 !! wikitext
2919 {{echo|[{{echo|http://example.com}} link]}}
2920 !! html/php+tidy
2921 <p><a rel="nofollow" class="external text" href="http://example.com">link</a></p>
2922 !! html/parsoid
2923 <p><a rel="mw:ExtLink" href="http://example.com" about="#mwt31" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[{{echo|http://example.com}} link]"}},"i":0}}]}'>link</a></p>
2924 !! end
2925
2926 !! test
2927 Parsoid: pipe in transclusion parameter
2928 !! wikitext
2929 {{echo|http://foo.com/a&#124;b}}
2930 !! html/php+tidy
2931 <p><a rel="nofollow" class="external free" href="http://foo.com/a%7Cb">http://foo.com/a%7Cb</a></p>
2932 !! html/parsoid
2933 <p><a rel="mw:ExtLink" href="http://foo.com/a%7Cb" about="#mwt1"
2934 typeof="mw:Transclusion"
2935 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"http://foo.com/a&amp;#124;b"}},"i":0}}]}'>http://foo.com/a%7Cb</a></p>
2936 !! end
2937
2938 !! test
2939 Parsoid: Pipe in external link target and content in template parameter
2940 !! options
2941 parsoid=html2wt,wt2wt
2942 !! wikitext
2943 {{echo|[http://foo.com/a&#124;b a&#124;b]}}
2944 !! html/php+tidy
2945 <p><a rel="nofollow" class="external text" href="http://foo.com/a%7Cb">a|b</a></p>
2946 !! html/parsoid
2947 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2948 typeof="mw:Transclusion"
2949 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},
2950 "params":{"1":{"wt":"[http://foo.com/a|b a|b]"}},"i":0}}]}'>a|b</a></p>
2951 !! end
2952
2953 !! test
2954 Parsoid: Pipe in template with nested template in external link target in template parameter (seriously)
2955 !! options
2956 parsoid
2957 !! wikitext
2958 {{echo|[{{fullurl:{{FULLPAGENAME}}|action=edit}} bar]}}
2959 !! html
2960 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[{{fullurl:{{FULLPAGENAME}}|action=edit}} bar]"}},"i":0}}]}'>[Main Page bar]</p>
2961 !! end
2962
2963 !! test
2964 Templates: Don't escape already nowiki-escaped text in template parameters
2965 !! options
2966 parsoid=html2wt,wt2wt
2967 !! wikitext
2968 {{echo|foo<nowiki>|</nowiki>bar}}
2969 {{echo|<nowiki>&lt;div&gt;</nowiki>}}
2970 {{echo|<nowiki></nowiki>}}
2971 !! html/php+tidy
2972 <p>foo|bar &lt;div&gt;</p>
2973 !! html/parsoid
2974 <p><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo<nowiki>|</nowiki>bar"}},"i":0}}]}'}'>foo</span><span typeof="mw:Nowiki" about="#mwt1">|</span><span about="#mwt1">bar</span>
2975 <span typeof="mw:Transclusion mw:Nowiki" about="#mwt2" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<nowiki>&amp;lt;div&amp;gt;</nowiki>"}},"i":0}}]}'><span typeof="mw:Entity">&lt;</span>div<span typeof="mw:Entity">&gt;</span></span>
2976 <span typeof="mw:Transclusion mw:Nowiki" about="#mwt3" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<nowiki></nowiki>"}},"i":0}}]}'></span>
2977 </p>
2978 !! end
2979
2980 ## T54824
2981 !! test
2982 Templates: '=' char in nested transclusions should not trigger nowiki escapes or conversion to named param
2983 !! options
2984 parsoid=html2wt,wt2wt
2985 !! wikitext
2986 {{echo|{{echo|1=bar}}}}
2987 !! html/php+tidy
2988 <p>bar</p>
2989 !! html/parsoid
2990 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"{{echo|1=bar}}"}},"i":0}}]}'>bar</p>
2991 !! end
2992
2993 ## T58733
2994 !! test
2995 Templates parameters with special tokenizing behavior dont get modified because of arg escaping
2996 !! wikitext
2997 {{echo|a : b}}
2998 !! html/php+tidy
2999 <p>a&#160;: b</p>
3000 !! html/parsoid
3001 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a : b"}},"i":0}}]}'>a<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"isDisplayHack":true}'> </span>: b</p>
3002 !! end
3003
3004 ## T73412
3005 !! test
3006 Templates: Preserve blank parameter names
3007 !! wikitext
3008 {{echo|=foo}}
3009 !! html/php+tidy
3010 <p>{{{1}}}</p>
3011 !! html/parsoid
3012 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"":{"wt":"foo"}},"i":0}}]}'>{{{1}}}</p>
3013 !! end
3014
3015 !! test
3016 Templates: Preserve blank parameter names in other positions
3017 !! wikitext
3018 {{blank_param|bar|=foo}}
3019 !! html/php+tidy
3020 <p>bar foo</p>
3021 !! html/parsoid
3022 <p about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"},{"k":"","named":true}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"blank_param","href":"./Template:Blank_param"},"params":{"1":{"wt":"bar"},"":{"wt":"foo"}},"i":0}}]}'>bar
3023 foo</p>
3024 !! end
3025
3026 ###
3027 ### Parsoid-centric tests for testing RT edge cases for pre
3028 ###
3029
3030 !!test
3031 1a. Indent-Pre and Comments
3032 !! wikitext
3033 a
3034 <!--a-->
3035 c
3036 !! html
3037 <pre>a
3038 </pre>
3039 <p>c
3040 </p>
3041 !!end
3042
3043 !!test
3044 1b. Indent-Pre and Comments
3045 !! wikitext
3046 a
3047 <!--a-->
3048 c
3049 !! html
3050 <pre>a
3051 </pre>
3052 <p>c
3053 </p>
3054 !!end
3055
3056 !!test
3057 1c. Indent-Pre and Comments
3058 !! wikitext
3059 <!--a--> a
3060
3061 <!--a--> a
3062 !! html
3063 <pre> a
3064 </pre>
3065 <pre> a
3066 </pre>
3067 !!end
3068
3069 !!test
3070 1d. Indent-Pre and Comments
3071 (Pre-handler currently cannot distinguish between comment/ws order and normalizes them to [comment,ws] order)
3072 !! wikitext
3073 <!--a--> a
3074
3075 <!--b-->b
3076 !! html
3077 <pre>a
3078 </pre>
3079 <pre>b
3080 </pre>
3081 !!end
3082
3083 !!test
3084 2a. Indent-Pre and tables
3085 !! wikitext
3086 {|
3087 |-
3088 !h1!!h2
3089 |foo||bar
3090 |}
3091 !! html
3092 <table>
3093
3094 <tr>
3095 <th>h1</th>
3096 <th>h2
3097 </th>
3098 <td>foo</td>
3099 <td>bar
3100 </td></tr></table>
3101
3102 !!end
3103
3104 !!test
3105 2b. Indent-Pre and tables
3106 !! wikitext
3107 {|
3108 |-
3109 |foo
3110 |}
3111 !! html
3112 <table>
3113
3114 <tr>
3115 <td>foo
3116 </td></tr></table>
3117
3118 !!end
3119
3120 !!test
3121 2c. Indent-Pre and tables (T44252)
3122 !! wikitext
3123 {|
3124 |+ foo
3125 ! | bar
3126 |}
3127 !! html
3128 <table>
3129 <caption> foo
3130 </caption>
3131 <tr>
3132 <th> bar
3133 </th></tr></table>
3134
3135 !!end
3136
3137 !!test
3138 2d. Indent-Pre and tables
3139 !! wikitext
3140 a
3141 {|
3142 | b
3143 |}
3144 !! html/php
3145 <pre>a
3146 </pre>
3147 <table>
3148 <tr>
3149 <td> b
3150 </td></tr></table>
3151
3152 !! html/parsoid
3153 <pre>a</pre>
3154 <table>
3155 <tbody><tr><td> b</td></tr>
3156 </tbody></table>
3157 !!end
3158
3159 !!test
3160 2e. Indent-Pre and table-line syntax
3161 !! wikitext
3162 a
3163 | b
3164 | c
3165 !! html/php
3166 <pre>a
3167 | b
3168 | c
3169 </pre>
3170 !!end
3171
3172 !!test
3173 2f. Indent-pre started by table-line syntax
3174 !! wikitext
3175 a
3176 | b
3177 | c
3178 !! html/php
3179 <p>a
3180 </p>
3181 <pre>| b
3182 | c
3183 </pre>
3184 !! html/parsoid
3185 <p>a</p>
3186 <pre>
3187 | b
3188 | c</pre>
3189 !!end
3190
3191 !! test
3192 2g. Indented table markup mixed with indented pre content (proposed in T8200)
3193 !! wikitext
3194 <table>
3195 <tr>
3196 <td>
3197 Text that should be rendered preformatted
3198 </td>
3199 </tr>
3200 </table>
3201 !! html
3202 <table>
3203 <tr>
3204 <td>
3205 <pre>Text that should be rendered preformatted
3206 </pre>
3207 </td>
3208 </tr>
3209 </table>
3210
3211 !! end
3212
3213 !!test
3214 3a. Indent-Pre and block tags (single-line html)
3215 !! wikitext
3216 a <p> foo </p>
3217 b <div> foo </div>
3218 c <blockquote> foo </blockquote>
3219 <span> foo </span>
3220 !! html
3221 a <p> foo </p>
3222 b <div> foo </div>
3223 c <blockquote> foo </blockquote>
3224 <pre><span> foo </span>
3225 </pre>
3226 !! html/parsoid
3227 <p>a </p><p data-parsoid='{"stx":"html"}'> foo </p>
3228 <p>b </p><div data-parsoid='{"stx":"html"}'> foo </div>
3229 <p>c </p><blockquote data-parsoid='{"stx":"html"}'> foo </blockquote>
3230 <pre><span> foo </span>
3231 </pre>
3232 !! html+tidy
3233 <p>a</p>
3234 <p>foo</p>
3235 <p>b</p>
3236 <div>foo</div>
3237 <p>c</p>
3238 <blockquote>
3239 <p>foo</p>
3240 </blockquote>
3241 <pre>
3242 <span> foo </span>
3243 </pre>
3244 !! end
3245
3246 !!test
3247 3b. Indent-Pre and block tags (multi-line html)
3248 !! wikitext
3249 a <span>foo</span>
3250 b <div> foo </div>
3251 !! html
3252 <pre>a <span>foo</span>
3253 </pre>
3254 b <div> foo </div>
3255
3256 !! html/parsoid
3257 <pre>a <span data-parsoid='{"stx":"html"}'>foo</span></pre>
3258 b <div data-parsoid='{"stx":"html"}'> foo </div>
3259 !! html+tidy
3260 <pre>
3261 a <span>foo</span>
3262 </pre>
3263 <p>b</p>
3264 <div>foo</div>
3265 !!end
3266
3267 !!test
3268 3c. Indent-Pre and block tags (pre-content on separate line)
3269 !! wikitext
3270 <p>
3271 foo
3272 </p>
3273
3274 <div>
3275 foo
3276 </div>
3277
3278 <center>
3279 foo
3280 </center>
3281
3282 <blockquote>
3283 foo
3284 </blockquote>
3285
3286 <blockquote>
3287 <pre>
3288 foo
3289 </pre>
3290 </blockquote>
3291
3292 <table><tr><td>
3293 foo
3294 </td></tr></table>
3295
3296 <ul><li>
3297 foo
3298 </li></ul>
3299
3300 !! html
3301 <p>
3302 foo
3303 </p>
3304 <div>
3305 <pre>foo
3306 </pre>
3307 </div>
3308 <center>
3309 <pre>foo
3310 </pre>
3311 </center>
3312 <blockquote>
3313 <p> foo
3314 </p>
3315 </blockquote>
3316 <blockquote>
3317 <pre>
3318 foo
3319 </pre>
3320 </blockquote>
3321 <table><tr><td>
3322 <pre>foo
3323 </pre>
3324 </td></tr></table>
3325 <ul><li>
3326 foo
3327 </li></ul>
3328
3329 !!end
3330
3331 !! test
3332 4. Indent-Pre and extension tags
3333 !! wikitext
3334 a <tag />
3335 !! html/php
3336 a <pre>
3337 NULL
3338 array (
3339 )
3340 </pre>
3341
3342 !! html/parsoid
3343 a <pre typeof="mw:Extension/tag" about="#mwt2" data-parsoid='{}' data-mw='{"name":"tag","attrs":{},"body":null}'></pre>
3344 !! end
3345
3346 !! test
3347 5. Indent-Pre and html pre
3348 !! wikitext
3349 <pre class="123">hi</pre>
3350 !! html/php
3351 <pre class="123">hi</pre>
3352
3353 !! html/parsoid
3354 <pre typeof="mw:Extension/pre" about="#mwt2" class="123" data-mw='{"name":"pre","attrs":{"class":"123"},"body":{"extsrc":"hi"}}'>hi</pre>
3355 !! end
3356
3357 !!test
3358 Render paragraphs when indent-pre is suppressed in blocklevels
3359 !! wikitext
3360 <blockquote>
3361 foo
3362
3363 bar
3364 </blockquote>
3365 !! html
3366 <blockquote>
3367 <p> foo
3368 </p><p> bar
3369 </p>
3370 </blockquote>
3371
3372 !!end
3373
3374 !!test
3375 4. Multiple spaces at start-of-line
3376 !! wikitext
3377 <p> foo </p>
3378 foo
3379 {|
3380 |foo
3381 |}
3382 !! html
3383 <p> foo </p>
3384 <pre> foo
3385 </pre>
3386 <table>
3387 <tr>
3388 <td>foo
3389 </td></tr></table>
3390
3391 !!end
3392
3393 ## NOTE: the leading white-space chars on empty line are significant
3394 !! test
3395 5a. White-space in indent-pre
3396 !! wikitext
3397 a<br />
3398
3399 b
3400 !! html
3401 <pre>a<br />
3402
3403 b
3404 </pre>
3405 !! end
3406
3407 ## NOTE: the leading white-space chars on empty line are significant
3408 !! test
3409 5b. White-space in indent-pre
3410 !! wikitext
3411 a
3412
3413 b
3414
3415
3416 c
3417 !! html
3418 <pre>a
3419
3420 b
3421
3422
3423 c
3424 </pre>
3425 !! end
3426
3427 !! test
3428 5c. White-space in indent-pre
3429 !! wikitext
3430 ''a''
3431 ''b''
3432 ''c''
3433 !! html
3434 <pre><i>a</i>
3435 <i>b</i>
3436 <i>c</i>
3437 </pre>
3438 !! end
3439
3440 !! test
3441 6. Pre-blocks should extend across lines with leading WS even when there is no wrappable content
3442 !! wikitext
3443 a
3444
3445 <!-- continue -->
3446 b
3447
3448 c
3449
3450 d
3451 !! html
3452 <pre>a
3453
3454 b
3455 </pre>
3456 <pre>c
3457
3458 </pre>
3459 <p>d
3460 </p>
3461 !! end
3462
3463 !! test
3464 7a. Indent-pre and category links
3465 !! options
3466 parsoid=wt2html,wt2wt
3467 !! wikitext
3468 [[Category:foo]] <!-- No pre-wrapping -->
3469 {{echo| [[Category:foo]]}} <!-- No pre-wrapping -->
3470 !! html/php+tidy
3471 !! html/parsoid
3472 <link rel="mw:PageProp/Category" href="./Category:Foo"> <!-- No pre&#x2D;wrapping -->
3473 <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":" [[Category:foo]]"}},"i":0}}]}'> </span><link rel="mw:PageProp/Category" href="./Category:Foo" about="#mwt1"> <!-- No pre&#x2D;wrapping -->
3474 !! end
3475
3476 ## We used to, but no longer wt2wt this test since the default serializer
3477 ## will normalize all categories to serialize on their own line.
3478 ## This wikitext usage is going to be fairly uncommon in production and
3479 ## selser will take care of preserving formatting in those scenarios.
3480 !! test
3481 7b. Indent-pre and category links
3482 !! options
3483 parsoid=wt2html
3484 !! wikitext
3485 [[Category:foo]] a
3486 [[Category:foo]] {{echo|b}}
3487 !! html/parsoid
3488 <pre><link rel="mw:PageProp/Category" href="./Category:Foo"> a
3489 <link rel="mw:PageProp/Category" href="./Category:Foo"> <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"b"}},"i":0}}]}'>b</span></pre>
3490 !! end
3491
3492 !! test
3493 Indent-Pre: Newlines in comments shouldn't affect sol state
3494 !! wikitext
3495 a <!--
3496 foo
3497 --> b
3498 !! html/php+tidy
3499 <p>a b</p>
3500 !! html/parsoid
3501 <p>a <!--
3502 foo
3503 --> b</p>
3504 !! end
3505
3506 ###
3507 ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
3508 ###
3509
3510 !!test
3511 HTML-pre: 1. embedded newlines
3512 !! wikitext
3513 <pre>foo</pre>
3514
3515 <pre>
3516 foo
3517 </pre>
3518
3519 <pre>
3520
3521 foo
3522 </pre>
3523
3524 <pre>
3525
3526
3527 foo
3528 </pre>
3529 !! html/php+tidy
3530 <pre>
3531 foo
3532 </pre>
3533 <pre>
3534 foo
3535 </pre>
3536 <pre>
3537
3538 foo
3539 </pre>
3540 <pre>
3541
3542
3543 foo
3544 </pre>
3545 !! html/parsoid
3546 <pre typeof="mw:Extension/pre" about="#mwt2" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"foo"}}'>foo</pre>
3547
3548 <pre typeof="mw:Extension/pre" about="#mwt4" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\nfoo\n"}}'>foo
3549 </pre>
3550
3551 <pre typeof="mw:Extension/pre" about="#mwt6" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\n\nfoo\n"}}'>
3552
3553 foo
3554 </pre>
3555
3556 <pre typeof="mw:Extension/pre" about="#mwt8" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\n\n\nfoo\n"}}'>
3557
3558
3559 foo
3560 </pre>
3561 !!end
3562
3563 !! test
3564 HTML-pre: big spaces
3565 !! wikitext
3566 <pre>
3567
3568
3569
3570
3571 haha
3572
3573
3574
3575
3576 haha
3577
3578
3579
3580
3581 </pre>
3582 !! html/php+tidy
3583 <pre>
3584
3585
3586
3587
3588 haha
3589
3590
3591
3592
3593 haha
3594
3595
3596
3597
3598 </pre>
3599 !! html/parsoid
3600 <pre typeof="mw:Extension/pre" about="#mwt2" data-parsoid='{"stx":"html"}' data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\n\n\n\n\nhaha\n\n\n\n\nhaha\n\n\n\n\n"}}'>
3601
3602
3603
3604
3605 haha
3606
3607
3608
3609
3610 haha
3611
3612
3613
3614
3615 </pre>
3616 !! end
3617
3618 !!test
3619 HTML-pre: 2: indented text
3620 !! wikitext
3621 <pre>
3622 foo
3623 </pre>
3624 !! html
3625 <pre>
3626 foo
3627 </pre>
3628
3629 !!end
3630
3631 !!test
3632 HTML-pre: 3: other wikitext
3633 !! wikitext
3634 <pre>
3635 * foo
3636 # bar
3637 = no-h =
3638 '' no-italic ''
3639 [[ NoLink ]]
3640 </pre>
3641 !! html/php
3642 <pre>
3643 * foo
3644 # bar
3645 = no-h =
3646 '' no-italic ''
3647 [[ NoLink ]]
3648 </pre>
3649
3650 !! html/parsoid
3651 <pre typeof="mw:Extension/pre" about="#mwt2" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\n* foo\n# bar\n= no-h =\n&#39;&#39; no-italic &#39;&#39;\n[[ NoLink ]]\n"}}'>* foo
3652 # bar
3653 = no-h =
3654 '' no-italic ''
3655 [[ NoLink ]]
3656 </pre>
3657 !!end
3658
3659 ###
3660 ### Definition lists
3661 ###
3662 !! test
3663 Simple definition
3664 !! wikitext
3665 ; name : Definition
3666 !! html
3667 <dl><dt> name&#160;</dt>
3668 <dd> Definition</dd></dl>
3669
3670 !! end
3671
3672 !! test
3673 Definition list for indentation only
3674 !! wikitext
3675 : Indented text
3676 !! html
3677 <dl><dd> Indented text</dd></dl>
3678
3679 !! end
3680
3681 !! test
3682 Definition list with no space
3683 !! wikitext
3684 ;name:Definition
3685 !! html
3686 <dl><dt>name</dt>
3687 <dd>Definition</dd></dl>
3688
3689 !!end
3690
3691 !! test
3692 Definition list with URL link
3693 !! wikitext
3694 ; http://example.com/ : definition
3695 !! html
3696 <dl><dt> <a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&#160;</dt>
3697 <dd> definition</dd></dl>
3698
3699 !! end
3700
3701 !! test
3702 Definition list with bracketed URL link
3703 !! wikitext
3704 ;[http://www.example.com/ Example]:Something about it
3705 !! html
3706 <dl><dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt>
3707 <dd>Something about it</dd></dl>
3708
3709 !! end
3710
3711 !! test
3712 Definition list with wikilink containing colon
3713 !! wikitext
3714 ; [[Help:FAQ]]: The least-read page on Wikipedia
3715 !! html
3716 <dl><dt> <a href="/index.php?title=Help:FAQ&amp;action=edit&amp;redlink=1" class="new" title="Help:FAQ (page does not exist)">Help:FAQ</a></dt>
3717 <dd> The least-read page on Wikipedia</dd></dl>
3718
3719 !! end
3720
3721 # At Brion's and JeLuF's insistence... :)
3722 !! test
3723 Definition list with news link containing colon
3724 !! wikitext
3725 ; news:alt.wikipedia.rox: This isn't even a real newsgroup!
3726 !! html/php
3727 <dl><dt> <a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a></dt>
3728 <dd> This isn't even a real newsgroup!</dd></dl>
3729
3730 !! html/parsoid
3731 <dl><dt> <a rel="mw:ExtLink" href="news:alt.wikipedia.rox" data-parsoid='{"stx":"url"}'>news:alt.wikipedia.rox</a></dt><dd data-parsoid='{"stx":"row"}'> This isn't even a real newsgroup!</dd></dl>
3732 !! end
3733
3734 !! test
3735 Malformed definition list with colon
3736 !! wikitext
3737 ; news:alt.wikipedia.rox -- don't crash or enter an infinite loop
3738 !! html
3739 <dl><dt> <a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a> -- don't crash or enter an infinite loop</dt></dl>
3740
3741 !! end
3742
3743 !! test
3744 Definition lists: colon in external link text
3745 !! wikitext
3746 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
3747 !! html
3748 <dl><dt> <a rel="nofollow" class="external text" href="http://www.wikipedia2.org/">Wikipedia&#160;: The Next Generation</a></dt>
3749 <dd> OK, I made that up</dd></dl>
3750
3751 !! end
3752
3753 !! test
3754 Definition lists: colon in HTML attribute
3755 !! wikitext
3756 ;<b style="display: inline">bold</b>
3757 !! html
3758 <dl><dt><b style="display: inline">bold</b></dt></dl>
3759
3760 !! end
3761
3762 !! test
3763 Definition lists: self-closed tag
3764 !! wikitext
3765 ;one<br/>two : two-line fun
3766 !! html
3767 <dl><dt>one<br />two&#160;</dt>
3768 <dd> two-line fun</dd></dl>
3769
3770 !! end
3771
3772 !! test
3773 Definition lists: ignore colons inside tags
3774 !! wikitext
3775 ;one <b>two : tag <i>fun:</i>:</b>: def
3776 !! html
3777 <dl><dt>one <b>two&#160;: tag <i>fun:</i>:</b></dt>
3778 <dd> def</dd></dl>
3779
3780 !! end
3781
3782 !! test
3783 Definition lists: excess closed tags
3784 !! wikitext
3785 ;one</b>two : bad tag fun
3786 !! html/php+tidy
3787 <dl>
3788 <dt>onetwo&#160;</dt>
3789 <dd>bad tag fun</dd>
3790 </dl>
3791 !! html/parsoid
3792 <dl>
3793 <dt>onetwo</dt>
3794 <dd>bad tag fun</dd>
3795 </dl>
3796 !! end
3797
3798 !! test
3799 T13748: Literal closing tags
3800 !! wikitext
3801 <dl>
3802 <dt>test 1</dt>
3803 <dd>test test test test test</dd>
3804 <dt>test 2</dt>
3805 <dd>test test test test test</dd>
3806 </dl>
3807 !! html
3808 <dl>
3809 <dt>test 1</dt>
3810 <dd>test test test test test</dd>
3811 <dt>test 2</dt>
3812 <dd>test test test test test</dd>
3813 </dl>
3814
3815 !! end
3816
3817 !! test
3818 Definition and unordered list using wiki syntax nested in unordered list using html tags.
3819 !! wikitext
3820 <ul><li>
3821 ; term : description
3822 * unordered
3823 </li></ul>
3824 !! html
3825 <ul><li>
3826 <dl><dt> term&#160;</dt>
3827 <dd> description</dd></dl>
3828 <ul><li> unordered</li></ul>
3829 </li></ul>
3830
3831 !! end
3832
3833 !! test
3834 Definition list with empty definition and following paragraph
3835 !! wikitext
3836 ; term:
3837 Paragraph text
3838 !! html
3839 <dl><dt> term</dt>
3840 <dd></dd></dl>
3841 <p>Paragraph text
3842 </p>
3843 !! end
3844
3845 !! test
3846 Nested definition lists using html syntax
3847 !! wikitext
3848 <dl><dt>x</dt>
3849 <dd>a</dd>
3850 <dd>b</dd></dl>
3851 !! html
3852 <dl><dt>x</dt>
3853 <dd>a</dd>
3854 <dd>b</dd></dl>
3855
3856 !! end
3857
3858 !! test
3859 Definition Lists: No nesting: Multiple dd's
3860 !! wikitext
3861 ;x
3862 :a
3863 :b
3864 !! html
3865 <dl><dt>x</dt>
3866 <dd>a</dd>
3867 <dd>b</dd></dl>
3868
3869 !! end
3870
3871 !! test
3872 Definition Lists: Indentation: Regular
3873 !! wikitext
3874 :i1
3875 ::i2
3876 :::i3
3877 !! html
3878 <dl><dd>i1
3879 <dl><dd>i2
3880 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3881
3882 !! end
3883
3884 !! test
3885 Definition Lists: Indentation: Missing 1st level
3886 !! wikitext
3887 ::i2
3888 :::i3
3889 !! html
3890 <dl><dd><dl><dd>i2
3891 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3892
3893 !! end
3894
3895 !! test
3896 Definition Lists: Indentation: Multi-level indent
3897 !! wikitext
3898 :::i3
3899 !! html
3900 <dl><dd><dl><dd><dl><dd>i3</dd></dl></dd></dl></dd></dl>
3901
3902 !! end
3903
3904 !! test
3905 Definition Lists: Hacky use to indent tables
3906 !! wikitext
3907 ::{|
3908 |foo
3909 |bar
3910 |}
3911 this text
3912 should be left alone
3913 !! html
3914 <dl><dd><dl><dd><table>
3915 <tr>
3916 <td>foo
3917 </td>
3918 <td>bar
3919 </td></tr></table></dd></dl></dd></dl>
3920 <p>this text
3921 should be left alone
3922 </p>
3923 !! end
3924
3925 !! test
3926 Definition Lists: Hacky use to indent tables, with comments (T65979)
3927 !! wikitext
3928 <!-- foo -->
3929 ::{|
3930 |foo
3931 |bar
3932 |}<!-- bar -->
3933 this text
3934 should be left alone
3935 !! html/parsoid
3936 <!-- foo -->
3937 <dl><dd><dl><dd><table><tr>
3938 <td>foo</td>
3939 <td>bar</td>
3940 </tr></table><!-- bar --></dd></dl></dd></dl>
3941 <p>this text
3942 should be left alone</p>
3943 !! end
3944
3945 !! test
3946 Definition Lists: Hacky use to indent tables, with comment before table
3947 !! wikitext
3948 ::<!-- foo -->{|
3949 |foo
3950 |}
3951 !! html/parsoid
3952 <dl><dd><dl><dd><!-- foo --><table><tr>
3953 <td>foo</td>
3954 </tr></table></dd></dl></dd></dl>
3955 !! end
3956
3957 # The trailing whitespace in this test is to catch a regression in
3958 # Parsoid after T54473.
3959 !! test
3960 Definition Lists: Hacky use to indent tables (WS-insensitive)
3961 !! wikitext
3962 : {|
3963 |a
3964 |}
3965 !! html/php
3966 <dl><dd><table>
3967 <tr>
3968 <td>a
3969 </td></tr></table></dd></dl>
3970
3971 !! html/parsoid
3972 <dl><dd> <table>
3973 <tbody><tr><td>a</td></tr>
3974 </tbody></table> </dd></dl>
3975 !! end
3976
3977 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
3978 ## as an empty dt item. It also ignores all but the last ";" when followed
3979 ## by ":" later on. So, ";" are not ignored in ";;;t3" but are ignored in
3980 ## ";;;t3 :d1". So, PHP parser behavior is a little inconsistent wrt multiple
3981 ## ";"s.
3982 ##
3983 ## Ex: ";;t2 ::d2" is transformed into:
3984 ##
3985 ## <dl>
3986 ## <dt>t2 </dt>
3987 ## <dd>
3988 ## <dl>
3989 ## <dt></dt>
3990 ## <dd>d2</dd>
3991 ## </dl>
3992 ## </dd>
3993 ## </dl>
3994 ##
3995 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
3996 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
3997 ##
3998 ## <dl>
3999 ## <dt>
4000 ## <dl>
4001 ## <dt>t2 </dt>
4002 ## <dd>:d2</dd>
4003 ## </dl>
4004 ## </dt>
4005 ## </dl>
4006 ##
4007 ## All Parsoid only definition list tests have this difference.
4008 ##
4009 ## See also: https://phabricator.wikimedia.org/T8569
4010 ## and https://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
4011
4012 !! test
4013 Table / list interaction: indented table with lists in table contents
4014 !! wikitext
4015 :{|
4016 |-
4017 | a
4018 * b
4019 |-
4020 | c
4021 * d
4022 |}
4023 !! html
4024 <dl><dd><table>
4025
4026 <tr>
4027 <td> a
4028 <ul><li> b</li></ul>
4029 </td></tr>
4030 <tr>
4031 <td> c
4032 <ul><li> d</li></ul>
4033 </td></tr></table></dd></dl>
4034
4035 !! end
4036
4037 !!test
4038 Table / list interaction: lists nested in tables nested in indented lists
4039 !! wikitext
4040 :{|
4041 |
4042 :a
4043 :b
4044 |
4045 *c
4046 *d
4047 |}
4048
4049 *e
4050 *f
4051 !! html
4052 <dl><dd><table>
4053 <tr>
4054 <td>
4055 <dl><dd>a</dd>
4056 <dd>b</dd></dl>
4057 </td>
4058 <td>
4059 <ul><li>c</li>
4060 <li>d</li></ul>
4061 </td></tr></table></dd></dl>
4062 <ul><li>e</li>
4063 <li>f</li></ul>
4064
4065 !!end
4066
4067 !! test
4068 Definition Lists: Nesting: Multi-level (Parsoid only)
4069 !! options
4070 parsoid
4071 !! wikitext
4072 ;t1 :d1
4073 ;;t2 ::d2
4074 ;;;t3 :::d3
4075 !! html
4076 <dl>
4077 <dt>t1 </dt>
4078 <dd>d1</dd>
4079 <dt>
4080 <dl>
4081 <dt>t2 </dt>
4082 <dd>:d2</dd>
4083 <dt>
4084 <dl>
4085 <dt>t3 </dt>
4086 <dd>::d3</dd>
4087 </dl>
4088 </dt>
4089 </dl>
4090 </dt>
4091 </dl>
4092
4093
4094 !! end
4095
4096
4097 !! test
4098 Definition Lists: Nesting: Test 2 (Parsoid only)
4099 !! wikitext
4100 ;t1
4101 ::d2
4102 !! html/php+tidy
4103 <dl>
4104 <dt>t1</dt>
4105 <dd>
4106 <dl>
4107 <dd>d2</dd>
4108 </dl>
4109 </dd>
4110 </dl>
4111 !! html/parsoid
4112 <dl>
4113 <dt>t1</dt>
4114 <dd>
4115 <dl>
4116 <dd>d2</dd>
4117 </dl>
4118 </dd>
4119 </dl>
4120
4121 !! end
4122
4123
4124 !! test
4125 Definition Lists: Nesting: Test 3 (Parsoid only)
4126 !! wikitext
4127 :;t1
4128 ::::d2
4129 !! html/php+tidy
4130 <dl>
4131 <dd>
4132 <dl>
4133 <dt>t1</dt>
4134 <dd>
4135 <dl>
4136 <dd>
4137 <dl>
4138 <dd>d2</dd>
4139 </dl>
4140 </dd>
4141 </dl>
4142 </dd>
4143 </dl>
4144 </dd>
4145 </dl>
4146 !! html/parsoid
4147 <dl>
4148 <dd>
4149 <dl>
4150 <dt>t1</dt>
4151 <dd>
4152 <dl>
4153 <dd>
4154 <dl>
4155 <dd>d2</dd>
4156 </dl>
4157 </dd>
4158 </dl>
4159 </dd>
4160 </dl>
4161 </dd>
4162 </dl>
4163
4164 !! end
4165
4166
4167 !! test
4168 Definition Lists: Nesting: Test 4
4169 !! wikitext
4170 ::;t3
4171 :::d3
4172 !! html
4173 <dl><dd><dl><dd><dl><dt>t3</dt>
4174 <dd>d3</dd></dl></dd></dl></dd></dl>
4175
4176 !! end
4177
4178
4179 ## The Parsoid team believes the following three test exposes a
4180 ## bug in the PHP parser. (Parsoid team thinks the PHP parser is
4181 ## wrong to close the <dl> after the <dt> containing the <ul>.)
4182 ## It also exposes a "misfeature" in tidy, which doesn't like
4183 ## <dl> tags with a single <dt> child; it converts the <dt> into
4184 ## a <dd> in that case. (Parsoid leaves the <dt> alone!)
4185 !! test
4186 Definition Lists: Mixed Lists: Test 1
4187 !! wikitext
4188 :;* foo
4189 ::* bar
4190 :; baz
4191 !! html/php
4192 <dl><dd><dl><dt><ul><li> foo</li>
4193 <li> bar</li></ul></dt></dl>
4194 <dl><dt> baz</dt></dl></dd></dl>
4195
4196 !! html/php+tidy
4197 <dl>
4198 <dd>
4199 <dl>
4200 <dd>
4201 <ul>
4202 <li>foo</li>
4203 <li>bar</li>
4204 </ul>
4205 </dd>
4206 </dl>
4207 <dl>
4208 <dt>baz</dt>
4209 </dl>
4210 </dd>
4211 </dl>
4212 !! html/parsoid
4213 <dl>
4214 <dd><dl>
4215 <dt><ul>
4216 <li> foo
4217 </li>
4218 </ul></dt>
4219 <dd><ul>
4220 <li> bar
4221 </li>
4222 </ul></dd>
4223 <dt> baz</dt>
4224 </dl></dd>
4225 </dl>
4226 !! end
4227
4228 !! test
4229 Definition Lists: Mixed Lists: Test 2
4230 !! wikitext
4231 *: d1
4232 *: d2
4233 !! html
4234 <ul><li><dl><dd> d1</dd>
4235 <dd> d2</dd></dl></li></ul>
4236
4237 !! end
4238
4239
4240 !! test
4241 Definition Lists: Mixed Lists: Test 3
4242 !! wikitext
4243 *::: d1
4244 *::: d2
4245 !! html
4246 <ul><li><dl><dd><dl><dd><dl><dd> d1</dd>
4247 <dd> d2</dd></dl></dd></dl></dd></dl></li></ul>
4248
4249 !! end
4250
4251
4252 !! test
4253 Definition Lists: Mixed Lists: Test 4
4254 !! wikitext
4255 *;d1 :d2
4256 *;d3 :d4
4257 !! html
4258 <ul><li><dl><dt>d1&#160;</dt>
4259 <dd>d2</dd>
4260 <dt>d3&#160;</dt>
4261 <dd>d4</dd></dl></li></ul>
4262
4263 !! end
4264
4265
4266 !! test
4267 Definition Lists: Mixed Lists: Test 5
4268 !! wikitext
4269 *:d1
4270 *:: d2
4271 !! html
4272 <ul><li><dl><dd>d1
4273 <dl><dd> d2</dd></dl></dd></dl></li></ul>
4274
4275 !! end
4276
4277
4278 !! test
4279 Definition Lists: Mixed Lists: Test 6
4280 !! wikitext
4281 #*:d1
4282 #*::: d3
4283 !! html
4284 <ol><li><ul><li><dl><dd>d1
4285 <dl><dd><dl><dd> d3</dd></dl></dd></dl></dd></dl></li></ul></li></ol>
4286
4287 !! end
4288
4289
4290 !! test
4291 Definition Lists: Mixed Lists: Test 7
4292 !! wikitext
4293 :* d1
4294 :* d2
4295 !! html
4296 <dl><dd><ul><li> d1</li>
4297 <li> d2</li></ul></dd></dl>
4298
4299 !! end
4300
4301
4302 !! test
4303 Definition Lists: Mixed Lists: Test 8
4304 !! wikitext
4305 :* d1
4306 ::* d2
4307 !! html
4308 <dl><dd><ul><li> d1</li></ul>
4309 <dl><dd><ul><li> d2</li></ul></dd></dl></dd></dl>
4310
4311 !! end
4312
4313
4314 !! test
4315 Definition Lists: Mixed Lists: Test 9
4316 !! wikitext
4317 *;foo :bar
4318 !! html
4319 <ul><li><dl><dt>foo&#160;</dt>
4320 <dd>bar</dd></dl></li></ul>
4321
4322 !! end
4323
4324
4325 !! test
4326 Definition Lists: Mixed Lists: Test 10
4327 !! wikitext
4328 *#;foo :bar
4329 !! html
4330 <ul><li><ol><li><dl><dt>foo&#160;</dt>
4331 <dd>bar</dd></dl></li></ol></li></ul>
4332
4333 !! end
4334
4335 # The Parsoid team disagrees with the PHP parser's seemingly-random
4336 # rules regarding dd/dt on the next two tests. Parsoid is more
4337 # consistent, and recognizes the shared nesting and keeps the
4338 # still-open tags around until the nesting is complete.
4339 # (And tidy again converts <dt> to <dd> before 'bar'.)
4340
4341 !! test
4342 Definition Lists: Mixed Lists: Test 11
4343 !! wikitext
4344 *#*#;*;;foo :bar
4345 *#*#;boo :baz
4346 !! html/php
4347 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt>
4348 <dd><ul><li><dl><dt><dl><dt>bar</dt></dl></dd></dl></li></ul></dd></dl>
4349 <dl><dt>boo&#160;</dt>
4350 <dd>baz</dd></dl></li></ol></li></ul></li></ol></li></ul>
4351
4352 !! html/php+tidy
4353 <ul>
4354 <li>
4355 <ol>
4356 <li>
4357 <ul>
4358 <li>
4359 <ol>
4360 <li>
4361 <dl>
4362 <dt>foo&#160;</dt>
4363 <dd>
4364 <ul>
4365 <li>
4366 <dl>
4367 <dd>
4368 <dl>
4369 <dt>bar</dt>
4370 </dl>
4371 </dd>
4372 </dl>
4373 </li>
4374 </ul>
4375 </dd>
4376 </dl>
4377 <dl>
4378 <dt>boo&#160;</dt>
4379 <dd>baz</dd>
4380 </dl>
4381 </li>
4382 </ol>
4383 </li>
4384 </ul>
4385 </li>
4386 </ol>
4387 </li>
4388 </ul>
4389 !! html/parsoid
4390 <ul>
4391 <li>
4392 <ol>
4393 <li>
4394 <ul>
4395 <li>
4396 <ol>
4397 <li>
4398 <dl>
4399 <dt>
4400 <ul>
4401 <li>
4402 <dl>
4403 <dt>
4404 <dl>
4405 <dt>foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
4406 <dd data-parsoid='{"stx":"row"}'>bar</dd>
4407 </dl></dt>
4408 </dl></li>
4409 </ul></dt>
4410 <dt>boo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
4411 <dd data-parsoid='{"stx":"row"}'>baz</dd>
4412 </dl></li>
4413 </ol></li>
4414 </ul></li>
4415 </ol></li>
4416 </ul>
4417 !! end
4418
4419
4420 # Another case where tidy converts a <dt> to a <dd> (but Parsoid doesn't).
4421 # From whitelist:
4422 # * The test is wrong, there are two colons where there should be :;
4423 # * The PHP parser is wrong to close the <dl> after the <dt> containing the <ul>.
4424 !! test
4425 Definition Lists: Weird Ones: Test 1
4426 !! wikitext
4427 *#;*::;; foo : bar (who uses this?)
4428 !! html/php
4429 <ul><li><ol><li><dl><dt> foo&#160;</dt>
4430 <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>
4431
4432 !! html/php+tidy
4433 <ul>
4434 <li>
4435 <ol>
4436 <li>
4437 <dl>
4438 <dt>foo&#160;</dt>
4439 <dd>
4440 <ul>
4441 <li>
4442 <dl>
4443 <dd>
4444 <dl>
4445 <dd>
4446 <dl>
4447 <dd>
4448 <dl>
4449 <dt>bar (who uses this?)</dt>
4450 </dl>
4451 </dd>
4452 </dl>
4453 </dd>
4454 </dl>
4455 </dd>
4456 </dl>
4457 </li>
4458 </ul>
4459 </dd>
4460 </dl>
4461 </li>
4462 </ol>
4463 </li>
4464 </ul>
4465 !! html/parsoid
4466 <ul>
4467 <li>
4468 <ol>
4469 <li>
4470 <dl>
4471 <dt>
4472 <ul>
4473 <li>
4474 <dl>
4475 <dd>
4476 <dl>
4477 <dd>
4478 <dl>
4479 <dt>
4480 <dl>
4481 <dt> foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span></dt>
4482 <dd data-parsoid='{"stx":"row"}'> bar (who uses this?)</dd>
4483 </dl></dt>
4484 </dl></dd>
4485 </dl></dd>
4486 </dl></li>
4487 </ul></dt>
4488 </dl></li>
4489 </ol></li>
4490 </ul>
4491 !! end
4492
4493 !! test
4494 Definition Lists: colons occurring in tags
4495 !! wikitext
4496 ;a:b
4497 ;'''a:b'''
4498 ;<i>a:b</i>
4499 ;<span>a:b</span>
4500 ;<div>a:b</div>
4501 ;<div>a
4502 :b</div>
4503 ;{{echo|a:b}}
4504 ;{{echo|''a:b''}}
4505 ;;;''a:b''
4506 !! html+tidy
4507 <dl>
4508 <dt>a</dt>
4509 <dd>b</dd>
4510 <dt><b>a:b</b></dt>
4511 <dt><i>a:b</i></dt>
4512 <dt><span>a:b</span></dt>
4513 <dd>
4514 <div>a:b</div>
4515 </dd>
4516 <dd>
4517 <div>a
4518 <dl>
4519 <dd>b</dd>
4520 </dl>
4521 </div>
4522 </dd>
4523 <dt>a</dt>
4524 <dd>b</dd>
4525 <dt><i>a:b</i></dt>
4526 </dl>
4527 <dl>
4528 <dd>
4529 <dl>
4530 <dd>
4531 <dl>
4532 <dt><i>a:b</i></dt>
4533 </dl>
4534 </dd>
4535 </dl>
4536 </dd>
4537 </dl>
4538 !! html/parsoid
4539 <dl><dt>a</dt><dd data-parsoid='{"stx":"row"}'>b</dd>
4540 <dt><b>a:b</b></dt>
4541 <dt><i data-parsoid='{"stx":"html"}'>a:b</i></dt>
4542 <dt><span data-parsoid='{"stx":"html"}'>a:b</span></dt>
4543 <dt><div data-parsoid='{"stx":"html"}'>a:b</div></dt>
4544 <dt><div data-parsoid='{"stx":"html","autoInsertedEnd":true}'>a</div></dt>
4545 <dd>b</dd>
4546 <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>
4547 <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>
4548 <dl><dt><dl><dt><i>a:b</i></dt></dl></dt></dl></dt></dl>
4549 !! end
4550
4551 !! test
4552 Definition Lists: colons and tables 1
4553 !! wikitext
4554 :{|
4555 | x
4556 |}
4557 :{|
4558 | y
4559 |}
4560 !! html
4561 <dl><dd><table>
4562 <tr>
4563 <td> x
4564 </td></tr></table></dd></dl>
4565 <dl><dd><table>
4566 <tr>
4567 <td> y
4568 </td></tr></table></dd></dl>
4569
4570 !! end
4571
4572 # Parsoid's output (as documented below) differs from php's in this case.
4573 # This is probably a bug. If we fixup parsoid to match php's output, the
4574 # above test should pass and the below test case can be removed. It is
4575 # unclear which output is more desirable.
4576
4577 !! test
4578 Definition Lists: colons and tables 2
4579 !! wikitext
4580 :{|
4581 | x
4582 |}
4583 :{|
4584 | y
4585 |}
4586 !! html/parsoid
4587 <dl><dd><table>
4588 <tr>
4589 <td> x
4590 </td></tr></table></dd>
4591 <dd><table>
4592 <tr>
4593 <td> y
4594 </td></tr></table></dd></dl>
4595 !! end
4596
4597 !! test
4598 Definition Lists: template interaction
4599 !! wikitext
4600 ::{{definition_list}}
4601
4602 :one
4603 ::{{definition_list}}
4604 :::two
4605 :::three
4606 ::four
4607 !! html/parsoid
4608 <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">
4609 </span><dd about="#mwt1">two</dd></dl></dd></dl>
4610
4611 <dl><dd data-parsoid='{}'>one
4612 <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">
4613 </span><dd about="#mwt2">two
4614 <dl><dd>two</dd>
4615 <dd>three</dd></dl></dd>
4616 <dd data-parsoid='{}'>four</dd></dl></dd></dl>
4617 !! end
4618
4619
4620 ###
4621 ### External links
4622 ###
4623 !! test
4624 External links: non-bracketed
4625 !! wikitext
4626 Non-bracketed: http://example.com
4627 !! html
4628 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4629 </p>
4630 !! end
4631
4632 # parsoid doesn't explicitly mark autonumbered links, see T55505
4633 !! test
4634 External links: numbered
4635 !! wikitext
4636 Numbered: [http://example.com]
4637 Numbered: [http://example.net]
4638 Numbered: [http://example.com]
4639 !! html/php
4640 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
4641 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
4642 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
4643 </p>
4644 !! html/parsoid
4645 <p>Numbered: <a rel="mw:ExtLink" href="http://example.com"></a>
4646 Numbered: <a rel="mw:ExtLink" href="http://example.net"></a>
4647 Numbered: <a rel="mw:ExtLink" href="http://example.com"></a></p>
4648 !!end
4649
4650 !! test
4651 External links: specified text
4652 !! wikitext
4653 Specified text: [http://example.com link]
4654 !! html
4655 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
4656 </p>
4657 !!end
4658
4659 !! test
4660 External links: trail
4661 !! wikitext
4662 Linktrails should not work for external links: [http://example.com link]s
4663 !! html
4664 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
4665 </p>
4666 !! end
4667
4668 !! test
4669 External links: dollar sign in URL
4670 !! wikitext
4671 http://example.com/1$2345
4672 !! html
4673 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
4674 </p>
4675 !! end
4676
4677 # parsoid doesn't explicitly mark autonumbered links, see T55505
4678 !! test
4679 External links: dollar sign in URL (autonumber)
4680 !! wikitext
4681 [http://example.com/1$2345]
4682 !! html/php
4683 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
4684 </p>
4685 !! html/parsoid
4686 <p><a rel="mw:ExtLink" href="http://example.com/1$2345"></a></p>
4687 !!end
4688
4689 !! test
4690 External links: open square bracket forbidden in URL (T6377)
4691 !! options
4692 parsoid=wt2html,wt2wt,html2html
4693 !! wikitext
4694 http://example.com/1[2345
4695 !! html/php
4696 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
4697 </p>
4698 !! html/parsoid
4699 <p><a rel="mw:ExtLink" href="http://example.com/1">http://example.com/1</a>[2345</p>
4700 !! end
4701
4702 !! test
4703 External links: open square bracket forbidden in URL (named) (T6377)
4704 !! options
4705 parsoid=wt2html,html2html
4706 !! wikitext
4707 [http://example.com/1[2345]
4708 !! html/php
4709 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4710 </p>
4711 !! html/parsoid
4712 <p><a rel="mw:ExtLink" href="http://example.com/1">[2345</a></p>
4713 !!end
4714
4715 # parsoid adds a space before the link name
4716 !! test
4717 External links: open square bracket forbidden in URL (named) (T6377)
4718 Parsoid variant.
4719 !! wikitext
4720 [http://example.com/1 [2345]
4721 !! html
4722 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4723 </p>
4724 !!end
4725
4726 !! test
4727 External links: nowiki in URL link text (T8230)
4728 !! wikitext
4729 [http://example.com/ <nowiki>''example site''</nowiki>]
4730 !! html
4731 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
4732 </p>
4733 !! end
4734
4735 !! test
4736 External links: newline forbidden in text (T8230 regression check)
4737 !! wikitext
4738 [http://example.com/ first
4739 second]
4740 !! html
4741 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
4742 second]
4743 </p>
4744 !!end
4745
4746 !! test
4747 External links: Pipe char between url and text
4748 !! wikitext
4749 [http://example.com | link]
4750 !! html
4751 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
4752 </p>
4753 !!end
4754
4755 !! test
4756 External links: protocol-relative URL in brackets
4757 !! wikitext
4758 [//example.com/ Test]
4759 !! html
4760 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
4761 </p>
4762 !! end
4763
4764 # parsoid doesn't explicitly mark autonumbered links, see T55505
4765 !! test
4766 External links: protocol-relative URL in brackets without text
4767 !! wikitext
4768 [//example.com]
4769 !! html/php
4770 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
4771 </p>
4772 !! html/parsoid
4773 <p><a rel="mw:ExtLink" href="//example.com"></a></p>
4774 !! end
4775
4776 !! test
4777 External links: protocol-relative URL in free text is left alone
4778 !! wikitext
4779 //example.com/Foo
4780 !! html
4781 <p>//example.com/Foo
4782 </p>
4783 !!end
4784
4785 !! test
4786 External links: protocol-relative URL in the middle of a word is left alone (T32269)
4787 !! wikitext
4788 foo//example.com/Foo
4789 !! html
4790 <p>foo//example.com/Foo
4791 </p>
4792 !! end
4793
4794 !! test
4795 External links: with no contents
4796 !! wikitext
4797 [http://en.wikipedia.org/wiki/Foo]
4798
4799 [[wikipedia:Foo|Bar]]
4800
4801 [[wikipedia:Foo|<span>Bar</span>]]
4802 !! html/php
4803 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/wiki/Foo">[1]</a>
4804 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
4805 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo"><span>Bar</span></a>
4806 </p>
4807 !! html/parsoid
4808 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo"></a></p>
4809 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo">Bar</a></p>
4810 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo"><span>Bar</span></a></p>
4811 !! end
4812
4813 !! test
4814 External links: Free with trailing punctuation
4815 !! wikitext
4816 http://example.com,
4817 http://example.com;
4818 http://example.com\
4819 http://example.com.
4820 http://example.com:
4821 http://example.com!
4822 http://example.com?
4823 http://example.com)
4824 http://example.com/url_with_(brackets)
4825 (http://example.com/url_without_brackets)
4826 http://example.com/url_with_entity&amp;
4827 http://example.com/url_with_entity&#x26;
4828 http://example.com/url_with_entity&#038;
4829 http://example.com/url_with_entity&nbsp;
4830 http://example.com/url_with_entity&#xA0;
4831 http://example.com/url_with_entity&#160;
4832 http://example.com/url_with_entity&lt;
4833 http://example.com/url_with_entity&#x3C;
4834 http://example.com/url_with_entity&#60;
4835 !! html/php
4836 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
4837 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>;
4838 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>\
4839 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.
4840 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
4841 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>!
4842 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>?
4843 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
4844 <a rel="nofollow" class="external free" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
4845 (<a rel="nofollow" class="external free" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
4846 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4847 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4848 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4849 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#160;
4850 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#xa0;
4851 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#160;
4852 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&lt;
4853 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#x3c;
4854 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#60;
4855 </p>
4856 !! html/parsoid
4857 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>,
4858 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>;
4859 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>\
4860 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>.
4861 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:
4862 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>!
4863 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>?
4864 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)
4865 <a rel="mw:ExtLink" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
4866 (<a rel="mw:ExtLink" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
4867 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4868 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4869 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4870 <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>
4871 <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>
4872 <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>
4873 <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>
4874 <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>
4875 <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>
4876 !! end
4877
4878 !! test
4879 External links: tricky Parsoid html2html case
4880 !! options
4881 parsoid=wt2html,wt2wt,html2html
4882 !! wikitext
4883 http://example.com/url_with_entity&amp;amp;
4884 !! html/php
4885 <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>;
4886 </p>
4887 !! html/parsoid
4888 <p><a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;amp">http://example.com/url_with_entity&amp;amp</a>;</p>
4889 !! end
4890
4891 !! test
4892 External links: Free with trailing quotes (T113666)
4893 !! wikitext
4894 '''News:''' Stuff here
4895
4896 news:'a'b''c''d e
4897 !! html/php
4898 <p><b>News:</b> Stuff here
4899 </p><p><a rel="nofollow" class="external free" href="news:'a'b">news:'a'b</a><i>c</i>d e
4900 </p>
4901 !! html/parsoid
4902 <p><b>News:</b> Stuff here</p>
4903 <p><a rel="mw:ExtLink" href="news:'a'b">news:'a'b</a><i>c</i>d e</p>
4904 !! end
4905
4906 !! test
4907 External links: with entity
4908 !! wikitext
4909 [http://&#x20;www.librarieswithoutborders.org Libraries without borders]
4910 !! html/php
4911 <p><a rel="nofollow" class="external text" href="http://+www.librarieswithoutborders.org">Libraries without borders</a>
4912 </p>
4913 !! html/parsoid
4914 <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>
4915 !! end
4916
4917 !! test
4918 External links: Lone protocols are never linked (T105697)
4919 !! wikitext
4920 http://
4921 http://;
4922 (http://)
4923 bitcoin:
4924 bitcoin:;
4925 (bitcoin:)
4926 !! html
4927 <p>http://
4928 http://;
4929 (http://)
4930 bitcoin:
4931 bitcoin:;
4932 (bitcoin:)
4933 </p>
4934 !! end
4935
4936 !! test
4937 External links: No preceding word characters allowed (T67278)
4938 !! wikitext
4939 NOPEhttp://example.com
4940 N0http://example.com
4941 ok:http://example.com
4942 ok-http://example.com
4943 !! html
4944 <p>NOPEhttp://example.com
4945 N0http://example.com
4946 ok:<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4947 ok-<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4948 </p>
4949 !! end
4950
4951 !! test
4952 External links: nofollow domain exception
4953 !! wikitext
4954 A [https://no-nofollow.org/foobar link], and another [https://example.org link].
4955 !! html
4956 <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>.
4957 </p>
4958 !!end
4959
4960 !! test
4961 External image
4962 !! wikitext
4963 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4964 !! html
4965 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png"/>
4966 </p>
4967 !! end
4968
4969 !! test
4970 External image from https
4971 !! wikitext
4972 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4973 !! html
4974 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png"/>
4975 </p>
4976 !! end
4977
4978 !! test
4979 External image (when not allowed)
4980 !! options
4981 wgAllowExternalImages=0
4982 !! wikitext
4983 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4984 !! html
4985 <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>
4986 </p>
4987 !! end
4988
4989 !! test
4990 Link to non-http image, no img tag
4991 !! wikitext
4992 Link to non-http image, no img tag: ftp://example.com/test.jpg
4993 !! html
4994 <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>
4995 </p>
4996 !! end
4997
4998 !! test
4999 External links: terminating separator
5000 !! wikitext
5001 Terminating separator: http://example.com/thing,
5002 !! html
5003 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
5004 </p>
5005 !! end
5006
5007 !! test
5008 External links: intervening separator
5009 !! wikitext
5010 Intervening separator: http://example.com/1,2,3
5011 !! html
5012 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
5013 </p>
5014 !! end
5015
5016 !! test
5017 External links: old bug with URL in query
5018 !! wikitext
5019 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
5020 !! html
5021 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
5022 </p>
5023 !! end
5024
5025 !! test
5026 External links: old URL-in-URL bug, mixed protocols
5027 !! wikitext
5028 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
5029 !! html
5030 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
5031 </p>
5032 !!end
5033
5034 # Since Parsoid is starting to emit canonical wikitext for links,
5035 # [http://example.com http://example.com] will not RT back to that
5036 # form anymore.
5037 !! test
5038 External links: URL in text
5039 !! options
5040 parsoid=wt2html
5041 !! wikitext
5042 URL in text: [http://example.com http://example.com]
5043 !! html/php
5044 <p>URL in text: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
5045 </p>
5046 !! html/parsoid
5047 <p>URL in text: <a rel="mw:ExtLink" href="http://example.com">http://example.com</a></p>
5048 !! end
5049
5050 !! test
5051 External links: Clickable images
5052 !! wikitext
5053 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
5054 !! html/php
5055 <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>
5056 </p>
5057 !! html/parsoid
5058 <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>
5059 !! end
5060
5061 !! test
5062 External links: raw ampersand
5063 !! wikitext
5064 Old &amp; use: http://x&y
5065 !! html
5066 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
5067 </p>
5068 !! end
5069
5070 !! test
5071 External links: encoded ampersand
5072 !! wikitext
5073 Old &amp; use: http://x&amp;y
5074 !! html/php
5075 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
5076 </p>
5077 !! html/parsoid
5078 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y">http://x&amp;y</a></p>
5079 !! end
5080
5081 !! test
5082 External links: encoded equals (T8102)
5083 !! wikitext
5084 http://example.com/?foo&#61;bar
5085 !! html/php
5086 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
5087 </p>
5088 !! html/parsoid
5089 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a></p>
5090 !! end
5091
5092 ##
5093 ## Note that parsoid doesn't explicit mark autonumbered links, nor
5094 ## does it number them. As discussed in T55505, we can identify
5095 ## autonumbered links via CSS.
5096 ##
5097
5098 !! test
5099 External links: [raw ampersand]
5100 !! wikitext
5101 Old &amp; use: [http://x&y]
5102 !! html/php
5103 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
5104 </p>
5105 !! html/parsoid
5106 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
5107 !! end
5108
5109 # note that parsoid html is identical to [raw ampersand] case; so html2wt
5110 # mode will return the [raw ampersand] wikitext
5111 !! test
5112 External links: [encoded ampersand]
5113 !! options
5114 parsoid=wt2html,wt2wt,html2html
5115 !! wikitext
5116 Old &amp; use: [http://x&amp;y]
5117 !! html/php
5118 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
5119 </p>
5120 !! html/parsoid
5121 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
5122 !! end
5123
5124 !! test
5125 External links: [raw equals]
5126 !! wikitext
5127 [http://example.com/?foo=bar]
5128 !! html/php
5129 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
5130 </p>
5131 !! html/parsoid
5132 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
5133 !! end
5134
5135 # note that parsoid html is identical to [raw equals] case; so html2wt
5136 # mode will return the [raw equals] wikitext
5137 !! test
5138 External links: [encoded equals] (T8102)
5139 !! options
5140 parsoid=wt2html,wt2wt,html2html
5141 !! wikitext
5142 [http://example.com/?foo&#61;bar]
5143 !! html/php
5144 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
5145 </p>
5146 !! html/parsoid
5147 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
5148 !! end
5149
5150 # xxx parsoid strips the IDN character, so the round-trip tests will
5151 # obviously fail and are disabled. --cscott
5152 !! test
5153 External links: [IDN ignored character reference in hostname; strip it right off]
5154 !! options
5155 parsoid=wt2html,wt2wt,html2html
5156 !! wikitext
5157 [http://e&zwnj;xample.com/]
5158 !! html/php
5159 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
5160 </p>
5161 !! html/parsoid
5162 <p><a rel="mw:ExtLink" href="http://example.com/"></a></p>
5163 !! end
5164
5165 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
5166 # Where an external link could easily circumvent the sanitization of the text of
5167 # a link like this (where an IDN-ignore character is in the URL somewhere), this
5168 # test demands a higher standard. That's a bit strange.
5169 #
5170 # Example:
5171 #
5172 # http://e‌xample.com -> [http://example.com|http://example.com]
5173 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
5174 #
5175 # The first example is sanitized, but the second is not. Any security benefits
5176 # from this production are trivial to circumvent. Either remove this test and
5177 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
5178 # the test accordingly.
5179 #
5180 # All our love,
5181 # The Parsoid team.
5182 # xxx parsoid strips the IDN character, so the round-trip tests will
5183 # obviously fail and are disabled. --cscott
5184 !! test
5185 External links: IDN ignored character reference in hostname; strip it right off
5186 !! options
5187 parsoid=wt2html,html2html
5188 !! wikitext
5189 http://e&zwnj;xample.com/
5190 !! html/php
5191 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
5192 </p>
5193 !! html/parsoid
5194 <p><a rel="mw:ExtLink" href="http://example.com/">http://example.com/</a></p>
5195 !! end
5196
5197 !! test
5198 External links: www.jpeg.org (T2554)
5199 !! wikitext
5200 http://www.jpeg.org
5201 !! html
5202 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
5203 </p>
5204 !! end
5205
5206 # parsoid doesn't explicitly mark autonumbered links, see T55505
5207 !! test
5208 External links: URL within URL (T2002)
5209 !! wikitext
5210 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
5211 !! html/php
5212 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
5213 </p>
5214 !! html/parsoid
5215 <p><a rel="mw:ExtLink" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp"></a></p>
5216 !! end
5217
5218 !! test
5219 T2361: URL inside bracketed URL
5220 !! wikitext
5221 [http://www.example.com/foo http://www.example.com/bar]
5222 !! html
5223 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
5224 </p>
5225 !! end
5226
5227 !! test
5228 T2361: URL within URL, not bracketed
5229 !! wikitext
5230 http://www.example.com/foo?=http://www.example.com/bar
5231 !! html
5232 <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>
5233 </p>
5234 !! end
5235
5236 !! test
5237 T2289: ">"-token in URL-tail
5238 !! wikitext
5239 http://www.example.com/<hello>
5240 !! html
5241 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
5242 </p>
5243 !!end
5244
5245 !! test
5246 T2289: literal ">"-token in URL-tail
5247 !! wikitext
5248 http://www.example.com/<b>html</b>
5249 !! html/php
5250 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
5251 </p>
5252 !! html/parsoid
5253 <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>
5254 !! end
5255
5256 !! test
5257 T2289: ">"-token in bracketed URL
5258 !! wikitext
5259 [http://www.example.com/<hello> stuff]
5260 !! html
5261 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
5262 </p>
5263 !!end
5264
5265 !! test
5266 T2289: literal ">"-token in bracketed URL
5267 !! wikitext
5268 [http://www.example.com/<b>html</b> stuff]
5269 !! html
5270 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
5271 </p>
5272 !!end
5273
5274 !! test
5275 T2289: literal double quote at end of URL
5276 !! wikitext
5277 http://www.example.com/"hello"
5278 !! html
5279 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
5280 </p>
5281 !!end
5282
5283 !! test
5284 T2289: literal double quote in bracketed URL
5285 !! wikitext
5286 [http://www.example.com/"hello" stuff]
5287 !! html
5288 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
5289 </p>
5290 !!end
5291
5292 !! test
5293 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (T7081)
5294 !! wikitext
5295 [http://www.example.com test]
5296 !! html
5297 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
5298 </p>
5299 !! end
5300
5301 !! test
5302 External links: link text with spaces
5303 !! wikitext
5304 [http://www.example.com a b c]
5305 [http://www.example.com ''a'' ''b'']
5306 !! html
5307 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
5308 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
5309 </p>
5310 !! end
5311
5312 !! test
5313 External links: wiki links within external link (T5695)
5314 !! options
5315 parsoid=wt2html,html2html
5316 !! wikitext
5317 [http://example.com [[wikilink]] embedded in ext link]
5318 !! html/php
5319 <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>
5320 </p>
5321 !! html/parsoid
5322 <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>
5323 !! end
5324
5325 !! test
5326 T2787: Links with one slash after the url protocol are invalid
5327 !! wikitext
5328 http:/example.com
5329
5330 [http:/example.com title]
5331 !! html
5332 <p>http:/example.com
5333 </p><p>[http:/example.com title]
5334 </p>
5335 !! end
5336
5337 !! test
5338 Bracketed external links with template-generated invalid target
5339 !! wikitext
5340 [{{echo|http:/example.com}} title]
5341 !! html
5342 <p>[http:/example.com title]
5343 </p>
5344 !! end
5345
5346 # wt2html only because Parsoid would want to add <nowiki>s coming from html
5347 !! test
5348 Broken wikilinks (but not external links) prevent templates from closing
5349 !! options
5350 parsoid=wt2html
5351 !! wikitext
5352 [http://example.com x
5353
5354 {{echo|[http://example.com x}}
5355
5356 [[Foo
5357
5358 {{echo|[[Foo}}
5359 !! html/php
5360 <p>[<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> x
5361 </p><p>[<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> x
5362 </p><p>[[Foo
5363 </p><p>{{echo|[[Foo}}
5364 </p>
5365 !! html/parsoid
5366 <p>[<a rel="mw:ExtLink" href="http://example.com">http://example.com</a> x</p>
5367 <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>
5368 <p>[[Foo</p>
5369 <p>{{echo|[[Foo}}</p>
5370 !! end
5371
5372 !! test
5373 Wikilinks with embedded newlines are not broken
5374 !! wikitext
5375 {{echo|[[ Foo
5376 B
5377 C]]}}
5378 !! html/php
5379 <p>[[ Foo
5380 B
5381 C]]
5382 </p>
5383 !! html/parsoid
5384 <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>
5385 !! end
5386
5387 !! test
5388 Broken templates
5389 !! options
5390 parsoid=wt2html
5391 !! wikitext
5392 {{echo|[[Foo|}}]]
5393
5394 [[Foo|{{echo|]]}}
5395 !! html/php
5396 <p>{{echo|<a href="/wiki/Foo" title="Foo">}}</a>
5397 </p><p>[[Foo|]]
5398 </p>
5399 !! html/parsoid
5400 <p>{{echo|<a rel="mw:WikiLink" href="./Foo" title="Foo">}}</a></p>
5401 <p>[[Foo|<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"]]"}},"i":0}}]}'>]]</span></p>
5402 !! end
5403
5404 !! test
5405 T4702: Mismatched <i>, <b> and <a> tags are invalid
5406 !! wikitext
5407 ''[http://example.com text'']
5408 [http://example.com '''text]'''
5409 ''Something [http://example.com in italic'']
5410 ''Something [http://example.com mixed''''', even bold]'''
5411 '''''Now [http://example.com both''''']
5412 !! html
5413 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
5414 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
5415 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
5416 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
5417 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
5418 </p>
5419 !! end
5420
5421
5422 !! test
5423 T6781: %26 in URL
5424 !! wikitext
5425 http://www.example.com/?title=AT%26T
5426 !! html/php
5427 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
5428 </p>
5429 !! html/parsoid
5430 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a></p>
5431 !! end
5432
5433 # According to https://www.w3.org/TR/2011/WD-html5-20110525/Overview.html#parsing-urls a plain
5434 # % is actually legal in HTML5. Any change in output would need testing though.
5435 !! test
5436 T6781, T7267: %25 in URL
5437 !! wikitext
5438 http://www.example.com/?title=100%25_Bran
5439 !! html/php
5440 <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>
5441 </p>
5442 !! html/parsoid
5443 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran">http://www.example.com/?title=100%25_Bran</a></p>
5444 !! end
5445
5446 !! test
5447 T6781, T7267: %28, %29 in URL
5448 !! wikitext
5449 http://www.example.com/?title=Ben-Hur_%281959_film%29
5450 !! html/php
5451 <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>
5452 </p>
5453 !! html/parsoid
5454 <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>
5455 !! end
5456
5457
5458 !! test
5459 T6781: %26 in autonumber URL
5460 !! wikitext
5461 [http://www.example.com/?title=AT%26T]
5462 !! html/php
5463 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
5464 </p>
5465 !! html/parsoid
5466 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T"></a></p>
5467 !! end
5468
5469 !! test
5470 T6781, T7267: %26 in autonumber URL
5471 !! wikitext
5472 [http://www.example.com/?title=100%25_Bran]
5473 !! html/php
5474 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
5475 </p>
5476 !! html/parsoid
5477 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran"></a></p>
5478 !! end
5479
5480 !! test
5481 T6781, T7267: %28, %29 in autonumber URL
5482 !! wikitext
5483 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
5484 !! html/php
5485 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
5486 </p>
5487 !! html/parsoid
5488 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29"></a></p>
5489 !! end
5490
5491
5492 !! test
5493 T6781: %26 in bracketed URL
5494 !! wikitext
5495 [http://www.example.com/?title=AT%26T link]
5496 !! html/php
5497 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
5498 </p>
5499 !! html/parsoid
5500 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">link</a></p>
5501 !! end
5502
5503 !! test
5504 T6781, T7267: %25 in bracketed URL
5505 !! wikitext
5506 [http://www.example.com/?title=100%25_Bran link]
5507 !! html
5508 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
5509 </p>
5510 !! end
5511
5512 !! test
5513 T6781, T7267: %28, %29 in bracketed URL
5514 !! wikitext
5515 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
5516 !! html/php
5517 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
5518 </p>
5519 !! html/parsoid
5520 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a></p>
5521 !! end
5522
5523 !! test
5524 External link containing a period in the anchor. (T65947)
5525 !! wikitext
5526 [//foo.org/bar#baz. bang]
5527
5528 [//foo.org/bar. bang]
5529 !! html/php
5530 <p><a rel="nofollow" class="external text" href="//foo.org/bar#baz.">bang</a>
5531 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar.">bang</a>
5532 </p>
5533 !! html/parsoid
5534 <p><a rel="mw:ExtLink" href="//foo.org/bar#baz.">bang</a></p>
5535 <p><a rel="mw:ExtLink" href="//foo.org/bar.">bang</a></p>
5536 !! end
5537
5538 !! test
5539 External link containing a single quote. (T65947)
5540 !! wikitext
5541 [//foo.org/bar'baz]
5542
5543 [//foo.org/bar'baz bang]
5544 !! html/php
5545 <p><a rel="nofollow" class="external autonumber" href="//foo.org/bar'baz">[1]</a>
5546 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar'baz">bang</a>
5547 </p>
5548 !! html/parsoid
5549 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz"></a></p>
5550 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz">bang</a></p>
5551 !! end
5552
5553 !! test
5554 External link containing double-single-quotes in text '' (T6598 sanity check)
5555 !! wikitext
5556 Some [http://example.com/ pretty ''italics'' and stuff]!
5557 !! html
5558 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
5559 </p>
5560 !! end
5561
5562 !! test
5563 External link containing double-single-quotes in text embedded in italics (T6598 sanity check)
5564 !! wikitext
5565 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
5566 !! html
5567 <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>
5568 </p>
5569 !! end
5570
5571 !! test
5572 External link containing double-single-quotes with no space separating the url from text in italics
5573 !! wikitext
5574 [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]].]
5575 !! html/php
5576 <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>
5577 </p>
5578 !! html/php+tidy
5579 <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>
5580 !! html/parsoid
5581 <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>
5582 !! end
5583
5584 !! test
5585 External link with comments in link text
5586 !! wikitext
5587 [http://www.google.com Google <!-- comment -->]
5588 !! html/php
5589 <p><a rel="nofollow" class="external text" href="http://www.google.com">Google </a>
5590 </p>
5591 !! html/parsoid
5592 <p><a rel="mw:ExtLink" href="http://www.google.com">Google <!-- comment --></a></p>
5593 !! end
5594
5595 !! test
5596 External link to bare IPv4 address
5597 !! wikitext
5598 [http://192.168.0.1 Link]
5599 !! html/php
5600 <p><a rel="nofollow" class="external text" href="http://192.168.0.1">Link</a>
5601 </p>
5602 !! html/parsoid
5603 <p><a rel="mw:ExtLink" href="http://192.168.0.1">Link</a></p>
5604 !! end
5605
5606 !! test
5607 URL-encoding in URL functions (single parameter)
5608 !! wikitext
5609 {{localurl:Some page|amp=&}}
5610 !! html
5611 <p>/index.php?title=Some_page&amp;amp=&amp;
5612 </p>
5613 !! end
5614
5615 !! test
5616 URL-encoding in URL functions (multiple parameters)
5617 !! wikitext
5618 {{localurl:Some page|q=?&amp=&}}
5619 !! html
5620 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
5621 </p>
5622 !! end
5623
5624 !! test
5625 Brackets in urls
5626 !! wikitext
5627 http://example.com/index.php?foozoid%5B%5D=bar
5628
5629 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
5630 !! html/php
5631 <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>
5632 </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>
5633 </p>
5634 !! html/parsoid
5635 <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>
5636
5637 <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>
5638 !! end
5639
5640 !! test
5641 IPv6 urls, autolink format (T23261)
5642 !! wikitext
5643 http://[2404:130:0:1000::187:2]/index.php
5644
5645 Examples from RFC 2373, section 2.2:
5646 * http://[1080::8:800:200C:417A]/unicast
5647 * http://[FF01::101]/multicast
5648 * http://[::1]/loopback
5649 * http://[::]/unspecified
5650 * http://[::13.1.68.3]/ipv4compat
5651 * http://[::FFFF:129.144.52.38]/ipv4compat
5652
5653 Examples from RFC 2732, section 2:
5654 * http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html
5655 * http://[1080:0:0:0:8:800:200C:417A]/index.html
5656 * http://[3ffe:2a00:100:7031::1]
5657 * http://[1080::8:800:200C:417A]/foo
5658 * http://[::192.9.5.5]/ipng
5659 * http://[::FFFF:129.144.52.38]:80/index.html
5660 * http://[2010:836B:4179::836B:4179]
5661
5662 !! html/php
5663 <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>
5664 </p><p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2373">RFC 2373</a>, section 2.2:
5665 </p>
5666 <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>
5667 <li> <a rel="nofollow" class="external free" href="http://[FF01::101]/multicast">http://[FF01::101]/multicast</a></li>
5668 <li> <a rel="nofollow" class="external free" href="http://[::1]/loopback">http://[::1]/loopback</a></li>
5669 <li> <a rel="nofollow" class="external free" href="http://[::]/unspecified">http://[::]/unspecified</a></li>
5670 <li> <a rel="nofollow" class="external free" href="http://[::13.1.68.3]/ipv4compat">http://[::13.1.68.3]/ipv4compat</a></li>
5671 <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>
5672 <p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2732">RFC 2732</a>, section 2:
5673 </p>
5674 <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>
5675 <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>
5676 <li> <a rel="nofollow" class="external free" href="http://[3ffe:2a00:100:7031::1]">http://[3ffe:2a00:100:7031::1]</a></li>
5677 <li> <a rel="nofollow" class="external free" href="http://[1080::8:800:200C:417A]/foo">http://[1080::8:800:200C:417A]/foo</a></li>
5678 <li> <a rel="nofollow" class="external free" href="http://[::192.9.5.5]/ipng">http://[::192.9.5.5]/ipng</a></li>
5679 <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>
5680 <li> <a rel="nofollow" class="external free" href="http://[2010:836B:4179::836B:4179]">http://[2010:836B:4179::836B:4179]</a></li></ul>
5681
5682 !! html/parsoid
5683 <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>
5684
5685 <p>Examples from <a href="//tools.ietf.org/html/rfc2373" rel="mw:ExtLink">RFC 2373</a>, section 2.2:</p>
5686 <ul><li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/unicast">http://[1080::8:800:200C:417A]/unicast</a></li>
5687 <li> <a rel="mw:ExtLink" href="http://[FF01::101]/multicast">http://[FF01::101]/multicast</a></li>
5688 <li> <a rel="mw:ExtLink" href="http://[::1]/loopback">http://[::1]/loopback</a></li>
5689 <li> <a rel="mw:ExtLink" href="http://[::]/unspecified">http://[::]/unspecified</a></li>
5690 <li> <a rel="mw:ExtLink" href="http://[::13.1.68.3]/ipv4compat">http://[::13.1.68.3]/ipv4compat</a></li>
5691 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]/ipv4compat">http://[::FFFF:129.144.52.38]/ipv4compat</a></li></ul>
5692
5693 <p>Examples from <a href="//tools.ietf.org/html/rfc2732" rel="mw:ExtLink">RFC 2732</a>, section 2:</p>
5694 <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>
5695 <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>
5696 <li> <a rel="mw:ExtLink" href="http://[3ffe:2a00:100:7031::1]">http://[3ffe:2a00:100:7031::1]</a></li>
5697 <li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/foo">http://[1080::8:800:200C:417A]/foo</a></li>
5698 <li> <a rel="mw:ExtLink" href="http://[::192.9.5.5]/ipng">http://[::192.9.5.5]/ipng</a></li>
5699 <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>
5700 <li> <a rel="mw:ExtLink" href="http://[2010:836B:4179::836B:4179]">http://[2010:836B:4179::836B:4179]</a></li></ul>
5701 !! end
5702
5703 !! test
5704 IPv6 urls, bracketed format (T23261)
5705 !! wikitext
5706 [http://[2404:130:0:1000::187:2]/index.php test]
5707
5708 Examples from RFC 2373, section 2.2:
5709 * [http://[1080::8:800:200C:417A] unicast]
5710 * [http://[FF01::101] multicast]
5711 * [http://[::1]/ loopback]
5712 * [http://[::] unspecified]
5713 * [http://[::13.1.68.3] ipv4compat]
5714 * [http://[::FFFF:129.144.52.38] ipv4compat]
5715
5716 Examples from RFC 2732, section 2:
5717 * [http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html 1]
5718 * [http://[1080:0:0:0:8:800:200C:417A]/index.html 2]
5719 * [http://[3ffe:2a00:100:7031::1] 3]
5720 * [http://[1080::8:800:200C:417A]/foo 4]
5721 * [http://[::192.9.5.5]/ipng 5]
5722 * [http://[::FFFF:129.144.52.38]:80/index.html 6]
5723 * [http://[2010:836B:4179::836B:4179] 7]
5724
5725 !! html/php
5726 <p><a rel="nofollow" class="external text" href="http://[2404:130:0:1000::187:2]/index.php">test</a>
5727 </p><p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2373">RFC 2373</a>, section 2.2:
5728 </p>
5729 <ul><li> <a rel="nofollow" class="external text" href="http://[1080::8:800:200C:417A]">unicast</a></li>
5730 <li> <a rel="nofollow" class="external text" href="http://[FF01::101]">multicast</a></li>
5731 <li> <a rel="nofollow" class="external text" href="http://[::1]/">loopback</a></li>
5732 <li> <a rel="nofollow" class="external text" href="http://[::]">unspecified</a></li>
5733 <li> <a rel="nofollow" class="external text" href="http://[::13.1.68.3]">ipv4compat</a></li>
5734 <li> <a rel="nofollow" class="external text" href="http://[::FFFF:129.144.52.38]">ipv4compat</a></li></ul>
5735 <p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2732">RFC 2732</a>, section 2:
5736 </p>
5737 <ul><li> <a rel="nofollow" class="external text" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">1</a></li>
5738 <li> <a rel="nofollow" class="external text" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">2</a></li>
5739 <li> <a rel="nofollow" class="external text" href="http://[3ffe:2a00:100:7031::1]">3</a></li>
5740 <li> <a rel="nofollow" class="external text" href="http://[1080::8:800:200C:417A]/foo">4</a></li>
5741 <li> <a rel="nofollow" class="external text" href="http://[::192.9.5.5]/ipng">5</a></li>
5742 <li> <a rel="nofollow" class="external text" href="http://[::FFFF:129.144.52.38]:80/index.html">6</a></li>
5743 <li> <a rel="nofollow" class="external text" href="http://[2010:836B:4179::836B:4179]">7</a></li></ul>
5744
5745 !! html/parsoid
5746 <p><a rel="mw:ExtLink" href="http://[2404:130:0:1000::187:2]/index.php">test</a></p>
5747
5748 <p>Examples from <a href="//tools.ietf.org/html/rfc2373" rel="mw:ExtLink">RFC 2373</a>, section 2.2:</p>
5749 <ul><li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]">unicast</a></li>
5750 <li> <a rel="mw:ExtLink" href="http://[FF01::101]">multicast</a></li>
5751 <li> <a rel="mw:ExtLink" href="http://[::1]/">loopback</a></li>
5752 <li> <a rel="mw:ExtLink" href="http://[::]">unspecified</a></li>
5753 <li> <a rel="mw:ExtLink" href="http://[::13.1.68.3]">ipv4compat</a></li>
5754 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]">ipv4compat</a></li></ul>
5755
5756 <p>Examples from <a href="//tools.ietf.org/html/rfc2732" rel="mw:ExtLink">RFC 2732</a>, section 2:</p>
5757 <ul><li> <a rel="mw:ExtLink" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">1</a></li>
5758 <li> <a rel="mw:ExtLink" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">2</a></li>
5759 <li> <a rel="mw:ExtLink" href="http://[3ffe:2a00:100:7031::1]">3</a></li>
5760 <li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/foo">4</a></li>
5761 <li> <a rel="mw:ExtLink" href="http://[::192.9.5.5]/ipng">5</a></li>
5762 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]:80/index.html">6</a></li>
5763 <li> <a rel="mw:ExtLink" href="http://[2010:836B:4179::836B:4179]">7</a></li></ul>
5764 !! end
5765
5766 !! test
5767 Non-extlinks in brackets
5768 !! wikitext
5769 [foo]
5770 [foo bar]
5771 [foo ''bar'']
5772 [fool's] errand
5773 [fool's errand]
5774 [{{echo|foo}}]
5775 [{{echo|foo}} bar]
5776 [{{echo|foo}} ''bar'']
5777 [{{echo|foo}}l's] errand
5778 [{{echo|foo}}l's errand]
5779 [url={{echo|foo}}]
5780 [url=http://example.com]
5781 [http:// bare protocols don't count]
5782 !! html/php
5783 <p>[foo]
5784 [foo bar]
5785 [foo <i>bar</i>]
5786 [fool's] errand
5787 [fool's errand]
5788 [foo]
5789 [foo bar]
5790 [foo <i>bar</i>]
5791 [fool's] errand
5792 [fool's errand]
5793 [url=foo]
5794 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
5795 [http:// bare protocols don't count]
5796 </p>
5797 !! html/parsoid
5798 <p>[foo]
5799 [foo bar]
5800 [foo <i>bar</i>]
5801 [fool's] errand
5802 [fool's errand]
5803 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}"}'>foo</span>]
5804 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}"}'>foo</span> bar]
5805 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}"}'>foo</span> <i>bar</i>]
5806 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}l&#39;s"}'>fool's</span>] errand
5807 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}l&#39;s"}'>fool's</span> errand]
5808 [<span typeof="mw:Placeholder" data-parsoid='{"src":"url={{echo|foo}}"}'>url=foo</span>]
5809 [url=<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>]
5810 [http:// bare protocols don't count]</p>
5811 !! end
5812
5813 !! test
5814 Percent encoding in external links
5815 !! wikitext
5816 [https://github.com/search?l=&q=ResourceLoader+%40wikimedia Search]
5817 !! html/php
5818 <p><a rel="nofollow" class="external text" href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a>
5819 </p>
5820 !! html/parsoid
5821 <p><a rel="mw:ExtLink"
5822 href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a></p>
5823 !! end
5824
5825 !! test
5826 Use url link syntax for links where the content is equal the link target
5827 !! wikitext
5828 http://example.com
5829 !! html/php
5830 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
5831 </p>
5832 !! html/parsoid
5833 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></p>
5834 !! end
5835
5836 !! test
5837 Parenthesis in external links, especially URL links
5838 !! wikitext
5839 http://example.com)
5840
5841 http://example.com/test)
5842
5843 http://example.com/(test)
5844
5845 http://example.com/((test)
5846
5847 (http://example.com/(test))
5848
5849 (http://example.com/(test)))))
5850
5851 http://example.com/a)b
5852
5853 [http://example.com) foo]
5854 !! html/php
5855 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5856 </p><p><a rel="nofollow" class="external free" href="http://example.com/test">http://example.com/test</a>)
5857 </p><p><a rel="nofollow" class="external free" href="http://example.com/(test)">http://example.com/(test)</a>
5858 </p><p><a rel="nofollow" class="external free" href="http://example.com/((test)">http://example.com/((test)</a>
5859 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test))">http://example.com/(test))</a>
5860 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test)))))">http://example.com/(test)))))</a>
5861 </p><p><a rel="nofollow" class="external free" href="http://example.com/a)b">http://example.com/a)b</a>
5862 </p><p><a rel="nofollow" class="external text" href="http://example.com)">foo</a>
5863 </p>
5864 !! html/parsoid
5865 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)</p>
5866 <p><a rel="mw:ExtLink" href="http://example.com/test">http://example.com/test</a>)</p>
5867 <p><a rel="mw:ExtLink" href="http://example.com/(test)">http://example.com/(test)</a></p>
5868 <p><a rel="mw:ExtLink" href="http://example.com/((test)">http://example.com/((test)</a></p>
5869 <p>(<a rel="mw:ExtLink" href="http://example.com/(test))">http://example.com/(test))</a></p>
5870 <p>(<a rel="mw:ExtLink" href="http://example.com/(test)))))">http://example.com/(test)))))</a></p>
5871 <p><a rel="mw:ExtLink" href="http://example.com/a)b">http://example.com/a)b</a></p>
5872 <p><a rel="mw:ExtLink" href="http://example.com)">foo</a></p>
5873 !! end
5874
5875 !! test
5876 Parenthesis in external links, w/ transclusion or comment
5877 !! wikitext
5878 (http://example.com/{{echo|hi}})
5879
5880 (http://example.com<!-- hi -->)
5881 !! html/php
5882 <p>(<a rel="nofollow" class="external free" href="http://example.com/hi">http://example.com/hi</a>)
5883 </p><p>(<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5884 </p>
5885 !! html/parsoid
5886 <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>
5887
5888 <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>
5889 !! end
5890
5891 !! test
5892 Serialize <a> tags with invalid link targets as plain text
5893 !! options
5894 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
5895 !! html/parsoid
5896 <a rel="mw:WikiLink" href="[[foo]]">text</a>
5897 <a rel="mw:WikiLink" href="[[foo]]">*text</a>
5898 <a rel="mw:WikiLink" href="[[foo]]">[[foo]]</a>
5899 <a rel="mw:WikiLink" href="[[foo]]">*a [[foo]]</a>
5900 !! wikitext
5901 text
5902 <nowiki>*</nowiki>text
5903 <nowiki>[[foo]]</nowiki>
5904 <nowiki>*</nowiki>a <nowiki>[[foo]]</nowiki>
5905 !! end
5906
5907 !! test
5908 mw:ExtLink -vs- mw:WikiLink (T94723)
5909 !! options
5910 parsoid=html2wt
5911 !! html/parsoid
5912 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"piped","a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>Bar</a>
5913 <a rel="mw:WikiLink" href="./Foo" title="Foo">Bar</a>
5914 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
5915 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
5916 <p>
5917 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
5918 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
5919 </p>
5920 !! wikitext
5921 [[Foo|Bar]]
5922 [[Foo|Bar]]
5923 [[wikipedia:Foo|Bar]]
5924 [[wikipedia:Foo|Bar]]
5925
5926 [[wikipedia:European_Robin|European Robin]]
5927 [[wikipedia:European_Robin|European Robin]]
5928 !! end
5929
5930 !! test
5931 mw:ExtLink linking to a interwiki URL can be round-tripped losslessly (T94723)
5932 !! options
5933 parsoid=wt2wt
5934 !! wikitext
5935 [http://en.wikipedia.org/wiki/European_Robin European Robin]
5936 !! html/parsoid
5937 THIS SECTION IS NOT USED (but Parsoid won't run the test without it)
5938 !! end
5939
5940
5941 ###
5942 ### Quotes
5943 ###
5944
5945 !! test
5946 Quotes
5947 !! wikitext
5948 Normal text. '''Bold text.''' Normal text. ''Italic text.''
5949
5950 Normal text. '''''Bold italic text.''''' Normal text.
5951 !! html
5952 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
5953 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
5954 </p>
5955 !! end
5956
5957
5958 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
5959 # parser strips. The wikitext contains just the first half of the bold
5960 # quote pair.
5961 !! test
5962 Unclosed and unmatched quotes
5963 !! wikitext
5964 '''''Bold italic text '''with bold deactivated''' in between.'''''
5965
5966 '''''Bold italic text ''with italic deactivated'' in between.'''''
5967
5968 '''Bold text..
5969
5970 ..spanning two paragraphs (should not work).'''
5971
5972 '''Bold tag left open
5973
5974 ''Italic tag left open
5975
5976 Normal text.
5977
5978 <!-- Unmatching number of opening, closing tags: -->
5979 '''This year''''s election ''should'' beat '''last year''''s.
5980
5981 ''Tom'''s car is bigger than ''Susan'''s.
5982
5983 Plain ''italic'''s plain
5984 !! html/php
5985 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
5986 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
5987 </p><p><b>Bold text..</b>
5988 </p><p>..spanning two paragraphs (should not work).
5989 </p><p><b>Bold tag left open</b>
5990 </p><p><i>Italic tag left open</i>
5991 </p><p>Normal text.
5992 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
5993 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
5994 </p><p>Plain <i>italic'</i>s plain
5995 </p>
5996 !! html/parsoid
5997 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
5998 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
5999 </p><p><b>Bold text..</b>
6000 </p><p>..spanning two paragraphs (should not work).<b></b>
6001 </p><p><b>Bold tag left open</b>
6002 </p><p><i>Italic tag left open</i>
6003 </p><p>Normal text.
6004 </p>
6005 <!-- Unmatching number of opening, closing tags: -->
6006 <p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
6007 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
6008 </p><p>Plain <i>italic'</i>s plain
6009 </p>
6010 !! end
6011
6012 ###
6013 ### Tables
6014 ###
6015 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
6016 ###
6017
6018 # This should not produce <table></table> as <table><tr><td></td></tr></table>
6019 # is the bare minimum required by the spec, see:
6020 # https://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
6021 # Parsoid team replies: empty table tags are legal in HTML5
6022 !! test
6023 A table with no data.
6024 !! options
6025 parsoid=wt2html
6026 !! wikitext
6027 {||}
6028 !! html/php
6029
6030 !! html/parsoid
6031 <table></table>
6032
6033 !! end
6034
6035 !! test
6036 A table with stray table end tags on start tag line (wt2html)
6037 !! options
6038 parsoid=wt2html
6039 !! wikitext
6040 {|style="color: red;"|}
6041
6042 {|style="color: red;" |}
6043 |foo
6044 |}
6045
6046 {|style="color: red;"|} id="foo"
6047 |foo
6048 |}
6049
6050 {|style="color: red;" |} id="foo"
6051 |foo
6052 |}
6053 !! html
6054 <table style="color: red;"></table>
6055
6056 <table style="color: red;">
6057 <tbody><tr>
6058 <td>foo</td>
6059 </tr></tbody>
6060 </table>
6061
6062 <table style="color: red;" id="foo">
6063 <tbody><tr>
6064 <td>foo</td>
6065 </tr></tbody>
6066 </table>
6067
6068 <table style="color: red;" id="foo">
6069 <tbody><tr>
6070 <td>foo</td>
6071 </tr></tbody>
6072 </table>
6073
6074 !! end
6075
6076 !! test
6077 A table with no data (take 2)
6078 !! wikitext
6079 {|
6080 |}
6081 !! html/parsoid
6082 <table></table>
6083 !! end
6084
6085 # A table with nothing but a caption is invalid XHTML, we might want to render
6086 # this as <p>caption</p>
6087 # Parsoid team replies: table with only a caption is legal in HTML5
6088 !! test
6089 A table with nothing but a caption
6090 !! wikitext
6091 {|
6092 |+ caption
6093 |}
6094 !! html/php
6095 <table>
6096 <caption> caption
6097 </caption><tr><td></td></tr></table>
6098
6099 !! html/parsoid
6100 <table><caption> caption</caption></table>
6101 !! end
6102
6103 !! test
6104 A table with caption with default-spaced attributes and a table row
6105 !! wikitext
6106 {|
6107 |+ style="color: red;" | caption1
6108 |-
6109 | foo
6110 |}
6111 !! html
6112 <table>
6113 <caption style="color: red;"> caption1
6114 </caption>
6115 <tr>
6116 <td> foo
6117 </td></tr></table>
6118
6119 !! end
6120
6121 !! test
6122 A table with captions with non-default spaced attributes and a table row
6123 !! wikitext
6124 {|
6125 |+style="color: red;"|caption2
6126 |+ style="color: red;"| caption3
6127 |-
6128 | foo
6129 |}
6130 !! html
6131 <table>
6132 <caption style="color: red;">caption2
6133 </caption>
6134 <caption style="color: red;"> caption3
6135 </caption>
6136 <tr>
6137 <td> foo
6138 </td></tr></table>
6139
6140 !! end
6141
6142 !! test
6143 Table td-cell syntax variations
6144 !! wikitext
6145 {|
6146 | foo bar foo | baz
6147 | foo bar foo || baz
6148 | style='color:red;' | baz
6149 | style='color:red;' || baz
6150 |}
6151 !! html
6152 <table>
6153 <tr>
6154 <td> baz
6155 </td>
6156 <td> foo bar foo </td>
6157 <td> baz
6158 </td>
6159 <td style="color:red;"> baz
6160 </td>
6161 <td> style='color:red;' </td>
6162 <td> baz
6163 </td></tr></table>
6164
6165 !! end
6166
6167 !! test
6168 Simple table
6169 !! wikitext
6170 {|
6171 | 1 || 2
6172 |-
6173 | 3 || 4
6174 |}
6175 !! html
6176 <table>
6177 <tr>
6178 <td> 1 </td>
6179 <td> 2
6180 </td></tr>
6181 <tr>
6182 <td> 3 </td>
6183 <td> 4
6184 </td></tr></table>
6185
6186 !! end
6187
6188 !! test
6189 Simple table but with multiple dashes for row wikitext
6190 !! wikitext
6191 {|
6192 | foo
6193 |-----
6194 | bar
6195 |}
6196 !! html
6197 <table>
6198 <tr>
6199 <td> foo
6200 </td></tr>
6201 <tr>
6202 <td> bar
6203 </td></tr></table>
6204
6205 !! end
6206
6207 !! test
6208 Multiplication table
6209 !! wikitext
6210 {| border="1" cellpadding="2"
6211 |+Multiplication table
6212 |-
6213 ! &times; !! 1 !! 2 !! 3
6214 |-
6215 ! 1
6216 | 1 || 2 || 3
6217 |-
6218 ! 2
6219 | 2 || 4 || 6
6220 |-
6221 ! 3
6222 | 3 || 6 || 9
6223 |-
6224 ! 4
6225 | 4 || 8 || 12
6226 |-
6227 ! 5
6228 | 5 || 10 || 15
6229 |}
6230 !! html
6231 <table border="1" cellpadding="2">
6232 <caption>Multiplication table
6233 </caption>
6234 <tr>
6235 <th> &#215; </th>
6236 <th> 1 </th>
6237 <th> 2 </th>
6238 <th> 3
6239 </th></tr>
6240 <tr>
6241 <th> 1
6242 </th>
6243 <td> 1 </td>
6244 <td> 2 </td>
6245 <td> 3
6246 </td></tr>
6247 <tr>
6248 <th> 2
6249 </th>
6250 <td> 2 </td>
6251 <td> 4 </td>
6252 <td> 6
6253 </td></tr>
6254 <tr>
6255 <th> 3
6256 </th>
6257 <td> 3 </td>
6258 <td> 6 </td>
6259 <td> 9
6260 </td></tr>
6261 <tr>
6262 <th> 4
6263 </th>
6264 <td> 4 </td>
6265 <td> 8 </td>
6266 <td> 12
6267 </td></tr>
6268 <tr>
6269 <th> 5
6270 </th>
6271 <td> 5 </td>
6272 <td> 10 </td>
6273 <td> 15
6274 </td></tr></table>
6275
6276 !! end
6277
6278 !! test
6279 Accept "||" in table headings
6280 !! wikitext
6281 {|
6282 !h1 || h2
6283 |}
6284 !! html
6285 <table>
6286 <tr>
6287 <th>h1 </th>
6288 <th> h2
6289 </th></tr></table>
6290
6291 !! end
6292
6293 !! test
6294 Accept "!!" in table data
6295 !! wikitext
6296 {|
6297 | Foo!! ||
6298 |}
6299 !! html
6300 <table>
6301 <tr>
6302 <td> Foo!! </td>
6303 <td>
6304 </td></tr></table>
6305
6306 !! html/parsoid
6307 <table>
6308 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'> Foo!! </td><td data-parsoid='{"stx_v":"row","autoInsertedEnd":true}'></td></tr>
6309 </tbody></table>
6310 !! end
6311
6312 !! test
6313 Accept "||" in indented table headings
6314 !! wikitext
6315 :{|
6316 !h1 || h2
6317 |}
6318 !! html
6319 <dl><dd><table>
6320 <tr>
6321 <th>h1 </th>
6322 <th> h2
6323 </th></tr></table></dd></dl>
6324
6325 !! end
6326
6327 !! test
6328 Accept "!!" in templates
6329 !! wikitext
6330 {|
6331 !a {{echo|b!!c}}
6332 |}
6333 !! html/php
6334 <table>
6335 <tr>
6336 <th>a b</th>
6337 <th>c
6338 </th></tr></table>
6339
6340 !! html/parsoid
6341 <table>
6342 <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>
6343 !! end
6344
6345 !! test
6346 Accept "!!" in table headings after newline
6347 !! wikitext
6348 {|
6349 !a
6350 b!!c
6351 |}
6352 !! html/php
6353 <table>
6354 <tr>
6355 <th>a
6356 <p>b!!c
6357 </p>
6358 </th></tr></table>
6359
6360 !! html/parsoid
6361 <table>
6362 <tbody><tr><th>a
6363 <p>b!!c</p></th></tr>
6364 </tbody></table>
6365 !! end
6366
6367 !! test
6368 Accept "!!" in table data of mixed wikitext / html syntax
6369 !! wikitext
6370 {|
6371 !a
6372 <tr><td>b!!c</td></tr>
6373 |}
6374 !! html+tidy
6375 <table>
6376 <tr>
6377 <th>a</th>
6378 </tr>
6379 <tr>
6380 <td>b!!c</td>
6381 </tr>
6382 </table>
6383 !! html/parsoid
6384 <table>
6385 <tbody><tr><th>a</th></tr>
6386 <tr data-parsoid='{"stx":"html"}'><td data-parsoid='{"stx":"html"}'>b!!c</td></tr>
6387 </tbody></table>
6388 !! end
6389
6390 !! test
6391 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
6392 !! wikitext
6393 {|
6394 !| h1
6395 || a
6396 |}
6397 !! html
6398 <table>
6399 <tr>
6400 <th> h1
6401 </th>
6402 <td> a
6403 </td></tr></table>
6404
6405 !! end
6406
6407 !!test
6408 Accept "| !" at start of line in tables (ignore !-attribute)
6409 !! wikitext
6410 {|
6411 |-
6412 | !style="color:red" | bar
6413 |}
6414 !! html
6415 <table>
6416
6417 <tr>
6418 <td> bar
6419 </td></tr></table>
6420
6421 !!end
6422
6423 !!test
6424 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 +/-
6425 !! wikitext
6426 {|
6427 |-
6428 |style='color:red;'|+1
6429 |style='color:blue;'|-1
6430 |-
6431 | 1 || 2 || 3
6432 | 1 ||+2 ||-3
6433 |-
6434 | +1
6435 | -1
6436 |}
6437 !! html
6438 <table>
6439
6440 <tr>
6441 <td style="color:red;">+1
6442 </td>
6443 <td style="color:blue;">-1
6444 </td></tr>
6445 <tr>
6446 <td> 1 </td>
6447 <td> 2 </td>
6448 <td> 3
6449 </td>
6450 <td> 1 </td>
6451 <td>+2 </td>
6452 <td>-3
6453 </td></tr>
6454 <tr>
6455 <td> +1
6456 </td>
6457 <td> -1
6458 </td></tr></table>
6459
6460 !!end
6461
6462 !! test
6463 Table rowspan
6464 !! wikitext
6465 {| border=1
6466 | Cell 1, row 1
6467 |rowspan=2| Cell 2, row 1 (and 2)
6468 | Cell 3, row 1
6469 |-
6470 | Cell 1, row 2
6471 | Cell 3, row 2
6472 |}
6473 !! html
6474 <table border="1">
6475 <tr>
6476 <td> Cell 1, row 1
6477 </td>
6478 <td rowspan="2"> Cell 2, row 1 (and 2)
6479 </td>
6480 <td> Cell 3, row 1
6481 </td></tr>
6482 <tr>
6483 <td> Cell 1, row 2
6484 </td>
6485 <td> Cell 3, row 2
6486 </td></tr></table>
6487
6488 !! end
6489
6490 !! test
6491 Nested table
6492 !! wikitext
6493 {| border=1
6494 | &alpha;
6495 |
6496 {| bgcolor=#ABCDEF border=2
6497 |nested
6498 |-
6499 |table
6500 |}
6501 |the original table again
6502 |}
6503 !! html
6504 <table border="1">
6505 <tr>
6506 <td> &#945;
6507 </td>
6508 <td>
6509 <table bgcolor="#ABCDEF" border="2">
6510 <tr>
6511 <td>nested
6512 </td></tr>
6513 <tr>
6514 <td>table
6515 </td></tr></table>
6516 </td>
6517 <td>the original table again
6518 </td></tr></table>
6519
6520 !! end
6521
6522 !! test
6523 Invalid attributes in table cell (T3830)
6524 !! wikitext
6525 {|
6526 |Cell:|broken
6527 |}
6528 !! html
6529 <table>
6530 <tr>
6531 <td>broken
6532 </td></tr></table>
6533
6534 !! end
6535
6536 !! test
6537 Table cell attributes: Pipes protected by nowikis should be treated as a plain character
6538 !! wikitext
6539 {|
6540 | title="foo" |bar
6541 | title="foo<nowiki>|</nowiki>" |bar
6542 | title="foo<nowiki>|</nowiki>" bar
6543 |}
6544 !! html/php
6545 <table>
6546 <tr>
6547 <td title="foo">bar
6548 </td>
6549 <td title="foo&#124;">bar
6550 </td>
6551 <td> title="foo|" bar
6552 </td></tr></table>
6553
6554 !! html/parsoid
6555 <table>
6556 <tbody><tr><td title="foo">bar</td>
6557 <td title="foo|" data-parsoid='{"a":{"title":"foo|"},"sa":{"title":"foo&lt;nowiki>|&lt;/nowiki>"},"autoInsertedEnd":true}'>bar</td>
6558 <td> title="foo<span typeof="mw:Nowiki">|</span>" bar</td></tr>
6559 </tbody></table>
6560 !! end
6561
6562 # See: http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html
6563 # N.B. The "|}" to close the table is missing from the input, so parsoid's
6564 # *2wt modes will fail.
6565 !! test
6566 Table security: embedded pipes
6567 !! options
6568 parsoid=wt2html,html2html
6569 !! wikitext
6570 {|
6571 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
6572 !! html/php
6573 <table>
6574 <tr>
6575 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
6576 <td>]" onmouseover="alert(document.cookie)"&gt;test
6577 </td>
6578 </tr>
6579 </table>
6580
6581 !! html/parsoid
6582 <table><tbody>
6583 <tr>
6584 <td data-parsoid='{"startTagSrc":"| ","attrSepSrc":"|","autoInsertedEnd":true}'>[<a rel="mw:ExtLink" href="ftp://%7Cx" data-parsoid='{"stx":"url","a":{"href":"ftp://%7Cx"},"sa":{"href":"ftp://|x"}}'>ftp://%7Cx</a></td><td data-parsoid='{"stx_v":"row","autoInsertedEnd":true}'>]" onmouseover="alert(document.cookie)">test</td></tr></tbody></table>
6585 !! end
6586
6587 !! test
6588 Element attributes with double ! should not be broken up by <th>
6589 !! wikitext
6590 {|
6591 ! hi <div class="!!">ha</div> ho
6592 |}
6593 !! html/php
6594 <table>
6595 <tr>
6596 <th> hi <div class="!!">ha</div> ho
6597 </th></tr></table>
6598
6599 !! html/parsoid
6600 <table>
6601 <tbody><tr><th> hi <div class="!!" data-parsoid='{"stx":"html"}'>ha</div> ho</th></tr>
6602 </tbody></table>
6603 !! end
6604
6605 !! test
6606 ! and || in element attributes should not be parsed as <th>/<td>
6607 !! wikitext
6608 {|
6609 | <div style="color: red !important;" data-contrived="put this here ||">hi</div>
6610 |}
6611 !! html/php
6612 <table>
6613 <tr>
6614 <td> <div style="color: red !important;" data-contrived="put this here &#124;&#124;">hi</div>
6615 </td></tr></table>
6616
6617 !! html/parsoid
6618 <table>
6619 <tbody><tr><td> <div style="color: red !important;" data-contrived="put this here ||" data-parsoid='{"stx":"html"}'>hi</div></td></tr>
6620 </tbody></table>
6621 !! end
6622
6623 # FIXME: The output seems broken. Filed as T110268.
6624 !! test
6625 ! and || in td attributes should not be parsed as <th>/<td>
6626 !! options
6627 parsoid=wt2html
6628 !! wikitext
6629 {|
6630 | style="color: red !important;" data-contrived="put this here ||" | foo
6631 |}
6632 !! html/php
6633 <table>
6634 <tr>
6635 <td> style="color: red !important;" data-contrived="put this here </td>
6636 <td> foo
6637 </td></tr></table>
6638
6639 !! html/parsoid
6640 <table>
6641 <tbody><tr><td> style="color: red !important;" data-contrived="put this here </td><td data-parsoid='{"stx_v":"row","a":{"\"":null},"sa":{"\"":""},"autoInsertedEnd":true}'> foo</td></tr>
6642 </tbody></table>
6643 !! end
6644
6645 !! test
6646 Break on | in element attribute in template
6647 !! options
6648 parsoid=wt2html,html2html
6649 !! wikitext
6650 {{echo|1=<div class="hi|ho">ha</div>}}
6651 !! html/php
6652 <p>ho"&gt;ha&lt;/div&gt;
6653 </p>
6654 !! html/parsoid
6655 <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>
6656 !! end
6657
6658 !! test
6659 Break on | in element attribute name in template
6660 !! wikitext
6661 {{echo|<div cla|ss="hiho">ha</div>}}
6662 !! html/parsoid
6663 <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>
6664 !! end
6665
6666 !! test
6667 Don't break on | in extension attribute in template
6668 !! wikitext
6669 {{echo|<ref name="hi|ho">ha</ref>}}
6670
6671 <references />
6672 !! html/parsoid
6673 <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>
6674
6675 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-hi.7Cho-1" id="cite_note-hi.7Cho-1"><a href="./Main_Page#cite_ref-hi.7Cho_1-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-hi.7Cho-1" class="mw-reference-text">ha</span></li></ol>
6676 !! end
6677
6678 ## We don't support roundtripping of these attributes in Parsoid.
6679 ## Selective serialization takes care of preventing dirty diffs.
6680 ## But, on edits, we dirty-diff the invalid attribute text.
6681 !! test
6682 Invalid text in table attributes should be discarded
6683 !! options
6684 parsoid=wt2html
6685 !! wikitext
6686 {| <span>boo</span> style='border:1px solid black'
6687 | <span>boo</span> style='color:blue' | 1
6688 |<span>boo</span> style='color:blue'| 2
6689 |}
6690 !! html/php
6691 <table style="border:1px solid black">
6692 <tr>
6693 <td style="color:blue"> 1
6694 </td>
6695 <td style="color:blue"> 2
6696 </td></tr></table>
6697
6698 !! html/parsoid
6699 <table style="border:1px solid black">
6700 <tr>
6701 <td style="color:blue"> 1</td>
6702 <td style="color:blue"> 2</td>
6703 </tr>
6704 </table>
6705 !! end
6706
6707 !! test
6708 Invalid text in table attributes should be preserved by selective serializer
6709 !! options
6710 parsoid={
6711 "modes": ["selser"],
6712 "changes": [
6713 ["td:first-child", "text", "abc"],
6714 ["td + td", "text", "xyz"]
6715 ]
6716 }
6717 !! wikitext
6718 {| <span>boo</span> style='border:1px solid black'
6719 | <span>boo</span> style='color:blue' | 1
6720 |<span>boo</span> style='color:blue'| 2
6721 |}
6722 !! wikitext/edited
6723 {| <span>boo</span> style='border:1px solid black'
6724 | <span>boo</span> style='color:blue' |abc
6725 |<span>boo</span> style='color:blue'|xyz
6726 |}
6727 !! end
6728
6729 !! test
6730 1. Template-generated table cell attributes and cell content
6731 !! wikitext
6732 {|
6733 |{{table_attribs}}
6734 | {{table_attribs}}
6735 || {{table_attribs_5}}
6736 | <!--foo--> <!--bar--> <!--baz--> {{table_attribs}}
6737 |align=center {{table_attribs}}
6738 | <!--foo--> align=center <!--bar--> {{table_attribs}}
6739 |}
6740 !! html
6741 <table>
6742 <tr>
6743 <td style="color:red;">Foo
6744 </td>
6745 <td style="color:red;">Foo
6746 </td>
6747 <td> style="color:red;"</td>
6748 <td>Bar
6749 </td>
6750 <td style="color:red;">Foo
6751 </td>
6752 <td align="center" style="color:red;">Foo
6753 </td>
6754 <td align="center" style="color:red;">Foo
6755 </td></tr></table>
6756
6757 !! end
6758
6759 !! test
6760 2. Template-generated table cell attributes and cell content
6761 !! wikitext
6762 {|
6763 |{{table_attribs_2}}
6764 |}
6765 !! html/php
6766 <table>
6767 <tr>
6768 <td style="color:red;">Foo
6769 </td>
6770 <td>Bar</td>
6771 <td>Baz
6772 </td></tr></table>
6773
6774 !! html/parsoid
6775 <table>
6776 <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>
6777 <td about="#mwt1">Bar</td><td about="#mwt1">Baz</td></tr>
6778 </tbody></table>
6779 !! end
6780
6781 !! test
6782 3. Template-generated table cell attributes and cell content
6783 !! wikitext
6784 {|
6785 !align=center {{table_header_cells}}
6786 |-
6787 |align=center {{table_cells}}
6788 |}
6789 !! html/php
6790 <table>
6791 <tr>
6792 <th align="center" style="color:red;">Foo</th>
6793 <th style="color:red;"><i>Bar</i></th>
6794 <th style="color:brown;"><i>Foo</i> and Baz
6795 </th></tr>
6796 <tr>
6797 <td align="center" style="color:red;">Foo</td>
6798 <td style="color:red;"><i>Bar</i></td>
6799 <td style="color:brown;"><i>Foo</i> and Baz
6800 </td></tr></table>
6801
6802 !! html/parsoid
6803 <table>
6804 <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>
6805 <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>
6806 </tbody></table>
6807 !! end
6808
6809 !! test
6810 4. Template-generated table cell attributes and cell content inside a templated table
6811 !! wikitext
6812 {{tbl-start}}
6813 !align=center {{table_header_cells}}
6814 |-
6815 |align=center {{table_cells}}
6816 {{tbl-end}}
6817 !! html/php
6818 <table>
6819 <tr>
6820 <th align="center" style="color:red;">Foo</th>
6821 <th style="color:red;"><i>Bar</i></th>
6822 <th style="color:brown;"><i>Foo</i> and Baz
6823 </th></tr>
6824 <tr>
6825 <td align="center" style="color:red;">Foo</td>
6826 <td style="color:red;"><i>Bar</i></td>
6827 <td style="color:brown;"><i>Foo</i> and Baz
6828 </td></tr></table>
6829
6830 !! html/parsoid
6831 <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}}]}'>
6832 <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>
6833 <tr>
6834 <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>
6835 </tbody></table>
6836 !! end
6837
6838 ## Edge case fix to prevent future regressions
6839 !! test
6840 T107652: <ref>s in templates that also generate table cell attributes should be rendered properly
6841 !! wikitext
6842 {|
6843 |{{table_attribs_7}}
6844 |}
6845 <references />
6846 !! html/parsoid
6847 <table>
6848 <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>
6849 </tbody></table>
6850 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><a href="./Main_Page#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text" data-parsoid="{}">foo</span></li></ol>
6851 !! end
6852
6853 !! test
6854 Table with row followed by newlines and table heading
6855 !! options
6856 parsoid=wt2html,html2html
6857 !! wikitext
6858 {|
6859 |-
6860
6861 ! foo
6862 |}
6863 !! html/*
6864 <table>
6865
6866
6867 <tr>
6868 <th> foo
6869 </th></tr></table>
6870
6871 !! end
6872
6873 !! test
6874 Table with empty line following the start tag
6875 !! options
6876 parsoid=wt2html,html2html
6877 !! wikitext
6878 {|
6879
6880 |-
6881 | foo
6882 |}
6883 !! html/*
6884 <table>
6885
6886
6887 <tr>
6888 <td> foo
6889 </td></tr></table>
6890
6891 !! end
6892
6893 !! test
6894 Table attributes with empty value
6895 !! options
6896 parsoid=wt2html,html2html
6897 !! wikitext
6898 {|
6899 | style=| hello
6900 |}
6901 !! html/php
6902 <table>
6903 <tr>
6904 <td style=""> hello
6905 </td></tr></table>
6906
6907 !! html/parsoid
6908 <table>
6909 <tbody><tr><td style=""> hello</td></tr>
6910 </tbody></table>
6911 !! end
6912
6913 !! test
6914 Wikitext table with a lot of comments
6915 !! wikitext
6916 {|
6917 <!-- c0 -->
6918 | foo
6919 <!-- c1 -->
6920 |-<!-- c2 -->
6921 <!-- c3 -->
6922 |<!-- c4 -->
6923 <!-- c5 -->
6924 |}
6925 !! html
6926 <table>
6927 <tr>
6928 <td> foo
6929 </td></tr>
6930 <tr>
6931 <td>
6932 </td></tr></table>
6933
6934 !! end
6935
6936 !! test
6937 Wikitext table comments represented in parsoid dom
6938 !! wikitext
6939 {|<!--c1--><!--c2-->
6940 |-<!--c3-->
6941 | x
6942 |}
6943 !! html/php+tidy
6944 <table>
6945 <tr>
6946 <td>x</td>
6947 </tr>
6948 </table>
6949 !! html/parsoid
6950 <table><!--c1--><!--c2-->
6951 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'><!--c3-->
6952 <td data-parsoid='{"autoInsertedEnd":true}'> x</td></tr>
6953 </tbody></table>
6954 !! end
6955
6956 !! test
6957 Wikitext table with double-line table cell
6958 !! wikitext
6959 {|
6960 |a
6961 b
6962 |}
6963 !! html
6964 <table>
6965 <tr>
6966 <td>a
6967 <p>b
6968 </p>
6969 </td></tr></table>
6970
6971 !! end
6972
6973 !! test
6974 Table cell with a single comment
6975 !! wikitext
6976 {|
6977 | <!-- c1 -->
6978 | a
6979 |}
6980 !! html
6981 <table>
6982 <tr>
6983 <td>
6984 </td>
6985 <td> a
6986 </td></tr></table>
6987
6988 !! end
6989
6990 !! test
6991 Table-cell after a comment-only-empty-line
6992 !! wikitext
6993 {|
6994 |a
6995 <!--c1-->
6996 <!--c2-->| b
6997 |}
6998 !! html
6999 <table>
7000 <tr>
7001 <td>a
7002 </td>
7003 <td> b
7004 </td></tr></table>
7005
7006 !! html/parsoid
7007 <table>
7008 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>a</td>
7009 <!--c1-->
7010 <!--c2--><td data-parsoid='{"autoInsertedEnd":true}'> b</td></tr>
7011 </tbody></table>
7012
7013 !! end
7014
7015 !! test
7016 Build table with {{!}}
7017 !! wikitext
7018 {{{!}} class="wikitable"
7019 ! header
7020 ! second header
7021 {{!}}- style="color:red;"
7022 {{!}} data {{!}}{{!}} style="color:red;" {{!}} second data
7023 {{!}}}
7024 !! html
7025 <table class="wikitable">
7026 <tr>
7027 <th> header
7028 </th>
7029 <th> second header
7030 </th></tr>
7031 <tr style="color:red;">
7032 <td> data </td>
7033 <td style="color:red;"> second data
7034 </td></tr></table>
7035
7036 !! end
7037
7038 !! test
7039 Build table with pipe as data
7040 !! wikitext
7041 {| class="wikitable"
7042 ! header
7043 ! second header
7044 |- style="color:red;"
7045 | data || style="color:red;" | second data
7046 |-
7047 | style="color:red;" | data with | || style="color:red;" | second data with |
7048 |-
7049 || data with | ||| second data with |
7050 |}
7051 !! html
7052 <table class="wikitable">
7053 <tr>
7054 <th> header
7055 </th>
7056 <th> second header
7057 </th></tr>
7058 <tr style="color:red;">
7059 <td> data </td>
7060 <td style="color:red;"> second data
7061 </td></tr>
7062 <tr>
7063 <td style="color:red;"> data with | </td>
7064 <td style="color:red;"> second data with |
7065 </td></tr>
7066 <tr>
7067 <td> data with | </td>
7068 <td> second data with |
7069 </td></tr></table>
7070
7071 !! end
7072
7073 !! test
7074 Build table with wikilink
7075 !! wikitext
7076 {| class="wikitable"
7077 ! header || second header
7078 |- style="color:red;"
7079 | data [[Main Page|linktext]] || second data [[Main Page|linktext]]
7080 |-
7081 | data || second data [[Main Page|link|text with pipe]]
7082 |}
7083 !! html
7084 <table class="wikitable">
7085 <tr>
7086 <th> header </th>
7087 <th> second header
7088 </th></tr>
7089 <tr style="color:red;">
7090 <td> data <a href="/wiki/Main_Page" title="Main Page">linktext</a> </td>
7091 <td> second data <a href="/wiki/Main_Page" title="Main Page">linktext</a>
7092 </td></tr>
7093 <tr>
7094 <td> data </td>
7095 <td> second data <a href="/wiki/Main_Page" title="Main Page">link|text with pipe</a>
7096 </td></tr></table>
7097
7098 !! end
7099
7100 # The expected HTML structure in this test is debatable. The PHP parser does
7101 # not parse this kind of table at all. The main focus for Parsoid is on
7102 # round-tripping, so this output is ok for now. TODO: revisit!
7103 !! test
7104 Wikitext table with html-syntax row
7105 !! wikitext
7106 {|
7107 |-
7108 <td>foo</td>
7109 |}
7110 !! html/parsoid
7111 <table>
7112 <tbody>
7113 <tr>
7114 <td>foo</td></tr></tbody></table>
7115 !! end
7116
7117 !! test
7118 Implicit <td> after a |-
7119 !! options
7120 parsoid=wt2html,html2html
7121 !! wikitext
7122 {|
7123 |-
7124 a
7125 |}
7126 !! html/php
7127 <table>
7128
7129 a
7130 </table>
7131
7132 !! html/php+tidy
7133 <p>a</p>
7134 !! html/parsoid
7135 <p data-parsoid='{"fostered":true,"autoInsertedEnd":true}'>a</p><table>
7136 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
7137
7138 </tr></tbody></table>
7139 !! end
7140
7141 !! test
7142 Lists should be recognized in an implicit <td> context
7143 !! options
7144 parsoid=wt2html,html2html
7145 !! wikitext
7146 {|
7147 |-
7148 *a
7149 |}
7150 !! html/php
7151 <table>
7152
7153 <ul><li>a</li></ul>
7154 </table>
7155
7156 !! html/php+tidy
7157 <ul>
7158 <li>a</li>
7159 </ul>
7160 !! html/parsoid
7161 <ul data-parsoid='{"fostered":true,"autoInsertedEnd":true}'><li>a</li></ul><table>
7162 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
7163
7164 </tr></tbody></table>
7165 !! end
7166
7167 !! test
7168 Table cells not properly parsed in an implicit-td context
7169 !! wikitext
7170 {|
7171 |-
7172 {{table_attribs_4}} || a || b
7173 |}
7174 !! html/php+tidy
7175 <table>
7176 <tr>
7177 <td style="background-color:#DC241f;" width="10px"></td>
7178 <td>a</td>
7179 <td>b</td>
7180 </tr>
7181 </table>
7182 !! html/parsoid
7183 <table>
7184 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
7185 <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>
7186 !! end
7187
7188 !! test
7189 Parsoid: Round-trip tables directly followed by content (T53219)
7190 !! options
7191 parsoid=wt2html,wt2wt
7192 !! wikitext
7193 {|
7194 |foo
7195 |} bar
7196
7197 {|
7198 |baz
7199 |}<b>quux</b>
7200 !! html+tidy
7201 <table>
7202 <tr>
7203 <td>foo</td>
7204 </tr>
7205 </table>
7206 <p>bar</p>
7207 <table>
7208 <tr>
7209 <td>baz</td>
7210 </tr>
7211 </table>
7212 <p><b>quux</b></p>
7213 !! end
7214
7215 !! test
7216 Parsoid: Default to a newline after tables in new content (T53219)
7217 !! options
7218 parsoid=html2wt
7219 !! html/parsoid
7220 <table><tbody>
7221 <tr><td>foo</td></tr></tbody></table> bar
7222 <table><tbody>
7223 <tr><td>baz</td></tr></tbody></table><b>quux</b>
7224 !! wikitext
7225 {|
7226 |foo
7227 |}
7228 <nowiki> </nowiki>bar
7229 {|
7230 |baz
7231 |}
7232 '''quux'''
7233 !! end
7234
7235 !! test
7236 Parsoid: newline inducing block nodes don't suppress <nowiki>
7237 !! options
7238 parsoid=html2wt
7239 !! html/parsoid
7240 a<h1>foo</h1>
7241 !! wikitext
7242 <nowiki> </nowiki>a
7243
7244 = foo =
7245 !! end
7246
7247 !! test
7248 Parsoid: Row-syntax table headings followed by comment & table cells
7249 !! options
7250 parsoid=wt2html,wt2wt
7251 !! wikitext
7252 {|
7253 ! foo || bar
7254 <!-- foo --> || baz || quux
7255 |}
7256 !! html/php
7257 <table>
7258 <tr>
7259 <th> foo </th>
7260 <th> bar
7261 </th>
7262 <td> baz </td>
7263 <td> quux
7264 </td></tr></table>
7265
7266 !! html/parsoid
7267 <table>
7268 <tbody><tr><th> foo </th><th> bar
7269 <!-- foo --> </th><td> baz </td><td> quux</td></tr>
7270 </tbody></table>
7271 !! end
7272
7273 !!test
7274 Parsoid: Recover better from broken table attributes
7275 !!options
7276 parsoid=wt2html
7277 !!wikitext
7278 {| class="foo
7279 | class="bar" |
7280 foo
7281 |}
7282 !!html/php+tidy
7283 <table class="foo">
7284 <tr>
7285 <td class="bar">
7286 <p>foo</p>
7287 </td>
7288 </tr>
7289 </table>
7290 !!html/parsoid
7291 <table class="foo">
7292 <tr>
7293 <td class="bar">
7294 <p>foo</p></td></tr>
7295 </tbody></table>
7296 !!end
7297
7298 !! test
7299 Tables: Digest broken attributes on table and tr tag
7300 !! options
7301 parsoid=wt2html
7302 !! wikitext
7303 {| || |} ++
7304 |- || || ++ --
7305 |- > [
7306 |}
7307 !! html
7308 <table>
7309 <tbody>
7310 <tr></tr>
7311 <tr></tr>
7312 </tbody></table>
7313 !! end
7314
7315 # T137406: Whitespace in the HTML
7316 !! test
7317 1. Generate correct wikitext for tables with thead/tbody/tfoot
7318 !! options
7319 parsoid=html2wt
7320 !! html/parsoid
7321 <table>
7322 <caption>Test</caption>
7323 <thead>
7324 <tr>
7325 <th>Month</th>
7326 <th>Savings</th>
7327 </tr>
7328 </thead>
7329 <tbody>
7330 <tr>
7331 <td>January</td>
7332 <td>$100</td>
7333 </tr>
7334 <tr>
7335 <td>February</td>
7336 <td>$80</td>
7337 </tr>
7338 </tbody>
7339 <tfoot>
7340 <tr>
7341 <td>Sum</td>
7342 <td>$180</td>
7343 </tr>
7344 </tfoot>
7345 </table>
7346 !! wikitext
7347 {|
7348 |+Test
7349 !Month
7350 !Savings
7351 |-
7352 |January
7353 |$100
7354 |-
7355 |February
7356 |$80
7357 |-
7358 |Sum
7359 |$180
7360 |}
7361 !! html/php+tidy
7362 <table>
7363 <caption>Test</caption>
7364 <tr>
7365 <th>Month</th>
7366 <th>Savings</th>
7367 </tr>
7368 <tr>
7369 <td>January</td>
7370 <td>$100</td>
7371 </tr>
7372 <tr>
7373 <td>February</td>
7374 <td>$80</td>
7375 </tr>
7376 <tr>
7377 <td>Sum</td>
7378 <td>$180</td>
7379 </tr>
7380 </table>
7381 !! end
7382
7383 # T137406: No whitespace in the HTML
7384 !! test
7385 2. Generate correct wikitext for tables with thead/tbody/tfoot
7386 !! options
7387 parsoid=html2wt
7388 !! html/parsoid
7389 <table><thead><tr><th>heading</th></tr></thead><tbody><tr><td>foo</td></tr></tbody></table>
7390 !! wikitext
7391 {|
7392 !heading
7393 |-
7394 |foo
7395 |}
7396 !! end
7397
7398 !! test
7399 Testing serialization after deletion in references
7400 !! options
7401 parsoid={
7402 "modes": ["wt2wt"],
7403 "changes": [
7404 ["#x", "remove"]
7405 ]
7406 }
7407 !! wikitext
7408 hi <ref><div id="x">ho</div></ref>
7409
7410 <references />
7411 !! wikitext/edited
7412 hi <ref></ref>
7413
7414 <references />
7415 !! end
7416
7417 !!test
7418 Testing serialization after deletion of table cells
7419 !!options
7420 parsoid={
7421 "modes": ["wt2wt", "selser"],
7422 "changes": [
7423 ["#x", "remove"]
7424 ]
7425 }
7426 !!wikitext
7427 {|
7428 !h1 !!h2 !!h3
7429 | id="x" |c1 {{!}}{{!}}{{!}}c2 |||c3
7430 |}
7431 !! wikitext/edited
7432 {|
7433 !h1 !!h2 !!h3
7434 |c2 |||c3
7435 |}
7436 !!end
7437
7438 !! test
7439 Testing selser after addition of new row before first row (T125419)
7440 !! options
7441 parsoid={
7442 "modes": ["wt2wt", "selser"],
7443 "changes": [
7444 [ "tr", "before", "<tr><td>X</td></tr>" ]
7445 ]
7446 }
7447 !! wikitext
7448 {|
7449 |a
7450 |}
7451 !! wikitext/edited
7452 {|
7453 |X
7454 |-
7455 |a
7456 |}
7457 !! end
7458
7459 !! test
7460 Serialize new table rows in a HTML table using HTML tags
7461 !! options
7462 parsoid={
7463 "modes": ["wt2wt", "selser"],
7464 "changes": [
7465 [ "tr", "before", "<tr><td>X</td></tr>" ]
7466 ]
7467 }
7468 !! wikitext
7469 <table><tr><td>a</td></tr></table>
7470 !! wikitext/edited
7471 <table><tr><td>X</td></tr><tr><td>a</td></tr></table>
7472 !! end
7473
7474 !! test
7475 Serialize new table cells in a HTML row using HTML tags
7476 !! options
7477 parsoid={
7478 "modes": ["wt2wt", "selser"],
7479 "changes": [
7480 [ "td", "before", "<td>X</td>" ]
7481 ]
7482 }
7483 !! wikitext
7484 <table><tr><td>a</td></tr></table>
7485 !! wikitext/edited
7486 <table><tr><td>X</td><td>a</td></tr></table>
7487 !! end
7488
7489 !! test
7490 Wikitext tables can be nested inside HTML tables
7491 !! options
7492 parsoid=html2wt
7493 !! html
7494 <table data-parsoid='{"stx":"html"}'>
7495 <tr><td>
7496 <table>
7497 <tr><td>foo</td></tr>
7498 </table>
7499 </td></tr>
7500 </table>
7501 !! wikitext
7502 <table>
7503 <tr><td>
7504 {|
7505 |foo
7506 |}
7507 </td></tr>
7508 </table>
7509 !! end
7510
7511 !! test
7512 Serialize wikitext list items as HTML list items when embedded in a HTML list
7513 !! options
7514 parsoid=html2wt
7515 !! html
7516 <ul data-parsoid='{"stx": "html"}'>
7517 <li data-parsoid='{}'>a</li>
7518 <li>b</li>
7519 </ul>
7520 !! wikitext
7521 <ul>
7522 <li>a</li>
7523 <li>b</li>
7524 </ul>
7525 !! end
7526
7527 # SSS FIXME: Is this actually a good thing given the
7528 # odd nested list output that is generated by MW?
7529 # <ul><li>foo<ul>..</ul></li></ul> instead of
7530 # <ul><li>foo</li><ul>..</ul></ul>
7531 !! test
7532 Wikitext lists can be nested inside HTML lists
7533 !! options
7534 parsoid=html2wt
7535 !! html
7536 <ul data-parsoid='{"stx": "html"}'>
7537 <li data-parsoid='{"stx": "html"}'>a
7538 <ul><li>b</li></ul>
7539 </li>
7540 </ul>
7541
7542 <ul data-parsoid='{"stx": "html"}'>
7543 <li>x
7544 <ul><li>y</li></ul>
7545 </li>
7546 </ul>
7547 !! wikitext
7548 <ul>
7549 <li>a
7550 * b
7551 </li>
7552 </ul>
7553
7554 <ul>
7555 <li>x
7556 * y
7557 </li>
7558 </ul>
7559 !! end
7560
7561 ###
7562 ### Internal links
7563 ###
7564 !! test
7565 Plain link, capitalized
7566 !! wikitext
7567 [[Main Page]]
7568 !! html
7569 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
7570 </p>
7571 !! end
7572
7573 !! test
7574 Plain link, uncapitalized
7575 !! wikitext
7576 [[main Page]]
7577 !! html
7578 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
7579 </p>
7580 !! end
7581
7582 !! test
7583 Piped link
7584 !! wikitext
7585 [[Main Page|The Main Page]]
7586 !! html
7587 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
7588 </p>
7589 !! end
7590
7591 !! test
7592 Piped link with comment in link text
7593 !! wikitext
7594 [[Main Page|The Main<!--front--> Page]]
7595 !! html
7596 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
7597 </p>
7598 !! end
7599
7600 !! test
7601 Piped link with multiple pipe characters in link text
7602 !! wikitext
7603 [[Main Page||The|Main|Page|]]
7604 !! html/php
7605 <p><a href="/wiki/Main_Page" title="Main Page">|The|Main|Page|</a>
7606 </p>
7607 !! html/parsoid
7608 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">|The|Main|Page|</a></p>
7609 !! end
7610
7611 !! test
7612 Piped link with no link text
7613 !! wikitext
7614 [[Thomas Bek (bishop of St David's)|]]
7615 !! html/php
7616 <p>[[Thomas Bek (bishop of St David's)|]]
7617 </p>
7618 !! html/parsoid
7619 <p>[[Thomas Bek (bishop of St David's)|]]</p>
7620 !! end
7621
7622 !! test
7623 Piped link with empty link text
7624 !! wikitext
7625 [[Main Page|<nowiki/>]] - empty nowiki
7626 [[Main Page| ]] - empty space
7627 [[Main Page|&nbsp;]] - empty non breaking space
7628 !! html/php
7629 <p><a href="/wiki/Main_Page" title="Main Page"></a> - empty nowiki
7630 <a href="/wiki/Main_Page" title="Main Page"> </a> - empty space
7631 <a href="/wiki/Main_Page" title="Main Page">&#160;</a> - empty non breaking space
7632 </p>
7633 !! html/parsoid
7634 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page"><span typeof="mw:Nowiki"></span></a> - empty nowiki
7635 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page"> </a> - empty space
7636 <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>
7637 !! end
7638
7639 !! test
7640 Broken link
7641 !! wikitext
7642 [[Zigzagzogzagzig]]
7643 !! html
7644 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
7645 </p>
7646 !! end
7647
7648 !! test
7649 Broken link with fragment
7650 !! wikitext
7651 [[Zigzagzogzagzig#zug]]
7652 !! html
7653 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
7654 </p>
7655 !! end
7656
7657 !! test
7658 Special page link with fragment
7659 !! wikitext
7660 [[Special:Version#anchor]]
7661 !! html
7662 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
7663 </p>
7664 !! end
7665
7666 !! test
7667 Nonexistent special page link with fragment
7668 !! wikitext
7669 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
7670 !! html
7671 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
7672 </p>
7673 !! end
7674
7675 !! test
7676 Link with prefix
7677 !! wikitext
7678 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
7679 !! html
7680 <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>
7681 </p>
7682 !! end
7683
7684 !! test
7685 Link with suffix
7686 !! wikitext
7687 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
7688 !! html
7689 <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>!!!
7690 </p>
7691 !! end
7692
7693 !! article
7694 prefixed article
7695 !! text
7696 Some text
7697 !! endarticle
7698
7699 !! test
7700 T45661: Piped links with identical prefixes
7701 !! wikitext
7702 [[prefixed article|prefixed articles with spaces]]
7703
7704 [[prefixed article|prefixed articlesaoeu]]
7705
7706 [[Main Page|Main Page test]]
7707 !! html
7708 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
7709 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
7710 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
7711 </p>
7712 !! end
7713
7714
7715 !! test
7716 Link with HTML entity in suffix / tail
7717 !! wikitext
7718 [[Main Page]]&quot;, [[Main Page]]&#97;
7719 !! html/php
7720 <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;
7721 </p>
7722 !! html/parsoid
7723 <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>
7724 !! end
7725
7726 !! test
7727 Link with 3 brackets
7728 !! wikitext
7729 [[[Main Page]]]
7730 Foo [[[Main Page]]]
7731 !! html
7732 <p>[[[Main Page]]]
7733 Foo [[[Main Page]]]
7734 </p>
7735 !! end
7736
7737 !! test
7738 Link with 4 brackets
7739 !! wikitext
7740 [[[[Main Page]]]]
7741 !! html
7742 <p>[[<a href="/wiki/Main_Page" title="Main Page">Main Page</a>]]
7743 </p>
7744 !! end
7745
7746 !! test
7747 Piped link with 3 brackets
7748 !! wikitext
7749 [[[main page|the main page]]]
7750 !! html
7751 <p>[[[main page|the main page]]]
7752 </p>
7753 !! end
7754
7755 !! test
7756 Piped link with extlink-like text
7757 !! wikitext
7758 [[Main Page|[bar]]]
7759 [[Main Page|This is a [bar]]]
7760 [[Main Page|[bar]]
7761 !! html/php
7762 <p><a href="/wiki/Main_Page" title="Main Page">[bar]</a>
7763 <a href="/wiki/Main_Page" title="Main Page">This is a [bar]</a>
7764 <a href="/wiki/Main_Page" title="Main Page">[bar</a>
7765 </p>
7766 !! html/parsoid
7767 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>[bar]</a>
7768 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>This is a [bar]</a>
7769 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>[bar</a></p>
7770 !! end
7771
7772 !! test
7773 Link with multiple pipes
7774 !! wikitext
7775 [[Main Page|The|Main|Page]]
7776 !! html
7777 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
7778 </p>
7779 !! end
7780
7781 !! test
7782 Anchor containing a #. (T65430)
7783 !! wikitext
7784 [[Main Page#And#Link]]
7785 !! html/php
7786 <p><a href="/wiki/Main_Page#And.23Link" title="Main Page">Main Page#And#Link</a>
7787 </p>
7788 !! html/parsoid
7789 <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>
7790 !! end
7791
7792 !! test
7793 Link to namespaces
7794 !! wikitext
7795 [[Talk:Parser testing]], [[Meta:Disclaimers]]
7796 !! html
7797 <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>
7798 </p>
7799 !! end
7800
7801 !! test
7802 Link with space in namespace
7803 !! wikitext
7804 [[User talk:Foo bar]]
7805 !! html
7806 <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>
7807 </p>
7808 !! end
7809
7810 !! article
7811 MemoryAlpha:AlphaTest
7812 !! text
7813 This is an article in the MemoryAlpha namespace
7814 (which shadows the memoryalpha interwiki link).
7815 !! endarticle
7816
7817 !! test
7818 Namespace takes precedence over interwiki link (T53680)
7819 !! wikitext
7820 [[MemoryAlpha:AlphaTest]]
7821 !! html
7822 <p><a href="/wiki/MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
7823 </p>
7824 !! end
7825
7826 # The previous test doesn't work correctly in html2*, due to not recognizing the
7827 # link as an internal one. This one checks for the correct behavior.
7828 !! test
7829 Link to namespace preferred over interwiki with correct rel attribute
7830 !! options
7831 parsoid=html2wt,html2html
7832 !! html/parsoid
7833 <p><a rel="mw:WikiLink" href="./MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a></p>
7834 !! wikitext
7835 [[MemoryAlpha:AlphaTest]]
7836 !! end
7837
7838 !! test
7839 Piped link to namespace
7840 !! wikitext
7841 [[Meta:Disclaimers|The disclaimers]]
7842 !! html
7843 <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>
7844 </p>
7845 !! end
7846
7847 !! test
7848 Link containing }
7849 !! wikitext
7850 [[Usually caused by a typo (oops}]]
7851 !! html
7852 <p>[[Usually caused by a typo (oops}]]
7853 </p>
7854 !! end
7855
7856 !! article
7857 7% Solution
7858 !! text
7859 Just a test of an article title containing a percent.
7860 !! endarticle
7861
7862 !! test
7863 Link containing % (not as a hex sequence)
7864 !! wikitext
7865 [[7% Solution]]
7866 [[7% Solution|7%25 Solution]]
7867 !! html/php
7868 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
7869 <a href="/wiki/7%25_Solution" title="7% Solution">7%25 Solution</a>
7870 </p>
7871 !! html/parsoid
7872 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a>
7873 <a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7%25 Solution</a></p>
7874 !! end
7875
7876 # note that the parsoid HTML is identical to the previous test output,
7877 # so the previous test ensures that the html2wt mode will generate the
7878 # "not as a hex sequence" wikitext.
7879 !! test
7880 Link containing % as a single hex sequence interpreted to char
7881 !! options
7882 parsoid=wt2wt,wt2html,html2html
7883 !! wikitext
7884 [[7%25 Solution]]
7885 [[7%25 Solution|7%25 Solution]]
7886 !! html/php
7887 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
7888 <a href="/wiki/7%25_Solution" title="7% Solution">7%25 Solution</a>
7889 </p>
7890 !! html/parsoid
7891 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a>
7892 <a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7%25 Solution</a></p>
7893 !!end
7894
7895 !! test
7896 Link containing % as a double hex sequence interpreted to hex sequence
7897 !! wikitext
7898 [[7%2525 Solution]]
7899 !! html
7900 <p>[[7%2525 Solution]]
7901 </p>
7902 !!end
7903
7904 ## Example for such a section: == < ==
7905 !! test
7906 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
7907 !! wikitext
7908 [[%23%3c]][[%23%3e]]
7909 !! html/php
7910 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
7911 </p>
7912 !! html/parsoid
7913 <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>
7914 !! end
7915
7916 !! test
7917 Link containing "<#" and ">#" as a hex sequences
7918 !! wikitext
7919 [[%3c%23]][[%3e%23]]
7920 !! html
7921 <p>[[%3c%23]][[%3e%23]]
7922 </p>
7923 !! end
7924
7925 !! test
7926 Link containing an equals sign
7927 !! wikitext
7928 [[Special:BookSources/isbn=4-00-026157-6]]
7929 !! html/php
7930 <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>
7931 </p>
7932 !! html/parsoid
7933 <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>
7934 !! end
7935
7936 !! article
7937 Foo~bar
7938 !! text
7939 Just a test of an article title containing a tilde.
7940 !! endarticle
7941
7942 # note that links containing signatures, like [[Foo~~~~]], are
7943 # massaged by the pre-save transform (PST) and so the tildes are never
7944 # seen by the parser.
7945 !! test
7946 Link containing a tilde
7947 !! wikitext
7948 [[Foo~bar]]
7949 !! html/php
7950 <p><a href="/wiki/Foo~bar" title="Foo~bar">Foo~bar</a>
7951 </p>
7952 !! html/parsoid
7953 <p><a rel="mw:WikiLink" href="./Foo~bar" title="Foo~bar">Foo~bar</a></p>
7954 !! end
7955
7956 !! test
7957 Link containing double-single-quotes '' (T6598)
7958 !! wikitext
7959 [[Lista d''e paise d''o munno]]
7960 !! html/php
7961 <p><a href="/index.php?title=Lista_d%27%27e_paise_d%27%27o_munno&amp;action=edit&amp;redlink=1" class="new" title="Lista d''e paise d''o munno (page does not exist)">Lista d''e paise d''o munno</a>
7962 </p>
7963 !! html/parsoid
7964 <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>
7965 !! end
7966
7967 !! test
7968 Link containing double quotes and spaces
7969 !! wikitext
7970 [[Cool "Gator"]]
7971 !! html/php
7972 <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>
7973 </p>
7974 !! html/parsoid
7975 <p><a rel="mw:WikiLink" href="./Cool_%22Gator%22" title='Cool "Gator"'>Cool "Gator"</a></p>
7976 !! end
7977
7978 !! test
7979 File containing double quotes and spaces
7980 !! wikitext
7981 [[File:Cool "Gator".png]]
7982 !! html/parsoid
7983 <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>
7984 !! end
7985
7986 !! test
7987 Redirect containing double quotes and spaces
7988 !! wikitext
7989 #REDIRECT [[Cool "Gator"]]
7990 !! html/parsoid
7991 <link rel="mw:PageProp/redirect" href="./Cool_%22Gator%22" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Cool_%22Gator%22"},"sa":{"href":"Cool \"Gator\""}}'/>
7992 !! end
7993
7994 !! test
7995 Link containing double-single-quotes '' in text (T6598 sanity check)
7996 !! wikitext
7997 Some [[Link|pretty ''italics'' and stuff]]!
7998 !! html/php
7999 <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>!
8000 </p>
8001 !! html/parsoid
8002 <p>Some <a rel="mw:WikiLink" href="./Link" title="Link">pretty <i>italics</i> and stuff</a>!</p>
8003 !! end
8004
8005 !! test
8006 Link containing double-single-quotes '' in text embedded in italics (T6598 sanity check)
8007 !! wikitext
8008 ''Some [[Link|pretty ''italics'' and stuff]]!''
8009 !! html
8010 <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>
8011 </p>
8012 !! end
8013
8014 !! test
8015 Link with double quotes in title part (literal) and alternate part (interpreted)
8016 !! wikitext
8017 [[File:Denys_Savchenko_''Pentecoste''.jpg]]
8018
8019 [[''Pentecoste'']]
8020
8021 [[''Pentecoste''|Pentecoste]]
8022
8023 [[''Pentecoste''|''Pentecoste'']]
8024 !! html/php
8025 <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>
8026 </p><p><a href="/index.php?title=%27%27Pentecoste%27%27&amp;action=edit&amp;redlink=1" class="new" title="''Pentecoste'' (page does not exist)">''Pentecoste''</a>
8027 </p><p><a href="/index.php?title=%27%27Pentecoste%27%27&amp;action=edit&amp;redlink=1" class="new" title="''Pentecoste'' (page does not exist)">Pentecoste</a>
8028 </p><p><a href="/index.php?title=%27%27Pentecoste%27%27&amp;action=edit&amp;redlink=1" class="new" title="''Pentecoste'' (page does not exist)"><i>Pentecoste</i></a>
8029 </p>
8030 !! html/parsoid
8031 <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>
8032 <p><a rel="mw:WikiLink" href="./''Pentecoste''" title="''Pentecoste''">''Pentecoste''</a></p>
8033 <p><a rel="mw:WikiLink" href="./''Pentecoste''" title="''Pentecoste''">Pentecoste</a></p>
8034 <p><a rel="mw:WikiLink" href="./''Pentecoste''" title="''Pentecoste''"><i>Pentecoste</i></a></p>
8035 !! end
8036
8037 !! test
8038 Broken image links with HTML captions (T41700)
8039 !! wikitext
8040 [[File:Nonexistent|<script></script>]]
8041 [[File:Nonexistent|100x100px|<script></script>]]
8042 [[File:Nonexistent|&lt;]]
8043 [[File:Nonexistent|a<i>b</i>c]]
8044 !! html/php
8045 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
8046 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
8047 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
8048 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
8049 </p>
8050 !! html/parsoid
8051 <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>
8052 <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>
8053 <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>
8054 <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>
8055 !! end
8056
8057 !! test
8058 Plain link to URL
8059 !! wikitext
8060 [[http://www.example.com]]
8061 !! html/php
8062 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
8063 </p>
8064 !! html/parsoid
8065 <p>[<a rel="mw:ExtLink" href="http://www.example.com"></a>]</p>
8066 !! end
8067
8068 !! test
8069 Plain link to URL with link text
8070 !! wikitext
8071 [[http://www.example.com Link text]]
8072 !! html
8073 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
8074 </p>
8075 !! end
8076
8077 !! test
8078 Plain link to protocol-relative URL
8079 !! wikitext
8080 [[//www.example.com]]
8081 !! html/php
8082 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
8083 </p>
8084 !! html/parsoid
8085 <p>[<a rel="mw:ExtLink" href="//www.example.com"></a>]</p>
8086 !! end
8087
8088 !! test
8089 Plain link to protocol-relative URL with link text
8090 !! wikitext
8091 [[//www.example.com Link text]]
8092 !! html
8093 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
8094 </p>
8095 !! end
8096
8097 !! test
8098 Plain link to page with question mark in title
8099 !! wikitext
8100 [[A?b]]
8101
8102 [[A?b|Baz]]
8103 !! html
8104 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
8105 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
8106 </p>
8107 !! end
8108
8109 # I'm fairly sure the expected result here is wrong.
8110 # We want these to be URL links, not pseudo-pages with URLs for titles....
8111 # However the current output is also pretty screwy.
8112 #
8113 # ----
8114 # I'm changing it to match the current output--it arguably makes more
8115 # sense in the light of the test above. Old expected result was:
8116 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
8117 #</p>
8118 # But I think this test is bordering on "garbage in, garbage out" anyway.
8119 # -- wtm
8120 !! test
8121 Piped link to URL
8122 !! wikitext
8123 Piped link to URL: [[http://www.example.com|an example URL]]
8124 !! html/php
8125 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
8126 </p>
8127 !! html/parsoid
8128 <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>
8129 !! end
8130
8131 !! test
8132 Plain link in template argument
8133 !! options
8134 parsoid=wt2html
8135 !! wikitext
8136 {{echo|[http://www.example.com |123]}}
8137
8138 {{echo|[[http://www.example.com |123]]}}
8139
8140 {{echo|[[http://www.example.com |123]}}
8141
8142 {{echo|[http://www.example.com |123]]}}
8143 !! html/php
8144 <p>[<a rel="nofollow" class="external free" href="http://www.example.com">http://www.example.com</a>
8145 </p><p>[<a rel="nofollow" class="external text" href="http://www.example.com">|123</a>]
8146 </p><p>{{echo|[<a rel="nofollow" class="external text" href="http://www.example.com">|123</a>}}
8147 </p><p>[<a rel="nofollow" class="external free" href="http://www.example.com">http://www.example.com</a>
8148 </p>
8149 !! html/parsoid
8150 <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>
8151
8152 <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>
8153
8154 <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>
8155
8156 <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>
8157 !! end
8158
8159 !! test
8160 T2002: [[page|http://url/]] should link to page, not http://url/
8161 !! wikitext
8162 [[Main Page|http://url/]]
8163 !! html/php
8164 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
8165 </p>
8166 !! html/parsoid
8167 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">http://url/</a></p>
8168 !! end
8169
8170 # Parsoid does not mark self-links, by design.
8171 !! test
8172 T2337: Escaped self-links should be bold
8173 !! options
8174 title=[[Bug462]]
8175 !! wikitext
8176 [[Bu&#103;462]] [[Bug462]]
8177 !! html/php
8178 <p><a class="mw-selflink selflink">Bu&#103;462</a> <a class="mw-selflink selflink">Bug462</a>
8179 </p>
8180 !! html/php+tidy
8181 <p><a class="mw-selflink selflink">Bug462</a> <a class="mw-selflink selflink">Bug462</a></p>
8182 !! html/parsoid
8183 <p><a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a> <a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a></p>
8184 !! end
8185
8186 !! test
8187 Self-link to section should not be bold
8188 !! options
8189 title=[[Main Page]]
8190 !! wikitext
8191 [[Main Page#section]]
8192 !! html
8193 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
8194 </p>
8195 !! end
8196
8197 !! article
8198 00
8199 !! text
8200 This is 00.
8201 !! endarticle
8202
8203 !!test
8204 Self-link to numeric title
8205 !!options
8206 title=[[0]]
8207 !! wikitext
8208 [[0]]
8209 !! html
8210 <p><a class="mw-selflink selflink">0</a>
8211 </p>
8212 !!end
8213
8214 !!test
8215 Link to numeric-equivalent title
8216 !!options
8217 title=[[0]]
8218 !! wikitext
8219 [[00]]
8220 !! html
8221 <p><a href="/wiki/00" title="00">00</a>
8222 </p>
8223 !!end
8224
8225 !! test
8226 <nowiki> inside a link
8227 !! wikitext
8228 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
8229 !! html
8230 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
8231 </p>
8232 !! end
8233
8234 !! test
8235 Non-breaking spaces in title
8236 !! wikitext
8237 [[&nbsp; Main &nbsp; Page &nbsp;]]
8238 !! html
8239 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
8240 </p>
8241 !!end
8242
8243 # Add new article for the test below so that it doesn't red-link
8244 !! article
8245 Foo bar baz
8246 !! text
8247 boo
8248 !! endarticle
8249
8250 !! test
8251 Multiple spaces in titles should normalize to a single underscore
8252 !! options
8253 parsoid=wt2html,wt2wt
8254 !! wikitext
8255 [[Foo bar baz|x]]
8256 [[Foo bar baz|x]]
8257 [[Foo bar baz|x]]
8258 !! html/php
8259 <p><a href="/wiki/Foo_bar_baz" title="Foo bar baz">x</a>
8260 <a href="/wiki/Foo_bar_baz" title="Foo bar baz">x</a>
8261 <a href="/wiki/Foo_bar_baz" title="Foo bar baz">x</a>
8262 </p>
8263 !! html/parsoid
8264 <p><a rel="mw:WikiLink" href="./Foo_bar_baz" title="Foo bar baz">x</a>
8265 <a rel="mw:WikiLink" href="./Foo_bar_baz" title="Foo bar baz">x</a>
8266 <a rel="mw:WikiLink" href="./Foo_bar_baz" title="Foo bar baz">x</a>
8267 </p>
8268 !! end
8269
8270 !! test
8271 Internal link with ca linktrail, surrounded by bold apostrophes (T29473 primary issue)
8272 !! options
8273 language=ca
8274 !! wikitext
8275 '''[[Main Page]]'''
8276 !! html
8277 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
8278 </p>
8279 !! end
8280
8281 !! test
8282 Internal link with ca linktrail, surrounded by italic apostrophes (T29473 primary issue)
8283 !! options
8284 language=ca
8285 !! wikitext
8286 ''[[Main Page]]''
8287 !! html
8288 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
8289 </p>
8290 !! end
8291
8292 !! test
8293 Internal link with en linktrail: no apostrophes (T29473)
8294 !! options
8295 language=en
8296 !! wikitext
8297 [[Something]]'nice
8298 !! html
8299 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
8300 </p>
8301 !! end
8302
8303 !! test
8304 Internal link with ca linktrail with apostrophes (T29473)
8305 !! options
8306 language=ca
8307 !! wikitext
8308 [[Something]]'nice
8309 !! html
8310 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
8311 </p>
8312 !! end
8313
8314 !! test
8315 Internal link with kaa linktrail with apostrophes (T29473)
8316 !! options
8317 language=kaa
8318 !! wikitext
8319 [[Something]]'nice
8320 !! html
8321 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (bet ele jaratılmag'an)">Something'nice</a>
8322 </p>
8323 !! end
8324
8325 !! test
8326 Link with multiple ":" in a subpage-supporting namespace (T65636)
8327 !! wikitext
8328 [[User:Foo/Test/63636:Bar|Test]]
8329 !! html/php
8330 <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>
8331 </p>
8332 !! html/parsoid
8333 <p><a rel="mw:WikiLink" href="./User:Foo/Test/63636:Bar" title="User:Foo/Test/63636:Bar">Test</a></p>
8334 !! end
8335
8336 ## Mainly a sanity check for Parsoid
8337 !! test
8338 Handle title parsing for subpages
8339 !! options
8340 title=[[/123123]]
8341 subpage
8342 !! wikitext
8343 123
8344 !! html/php
8345 <p>123
8346 </p>
8347 !! html/parsoid
8348 <p>123</p>
8349 !! end
8350
8351 !! article
8352 User:Test/123
8353 !! text
8354 test 123
8355 !! endarticle
8356
8357 !! test
8358 Link to a subpage from a namespace other than main
8359 !! options
8360 title=[[User:Test]]
8361 subpage
8362 !! wikitext
8363 [[/123]]
8364 !! html/php
8365 <p><a href="/wiki/User:Test/123" title="User:Test/123">/123</a>
8366 </p>
8367 !! html/parsoid
8368 <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>
8369 !! end
8370
8371 !! test
8372 Ensure that transclusion titles are not url-decoded
8373 !! options
8374 subpage title=[[Test]]
8375 parsoid=wt2html
8376 !! wikitext
8377 {{Bar%C3%A9}} {{/Bar%C3%A9}}
8378 !! html/php
8379 <p>{{Bar%C3%A9}} {{/Bar%C3%A9}}
8380 </p>
8381 !! html/parsoid
8382 <p>{{Bar%C3%A9}} {{/Bar%C3%A9}}</p>
8383 !! end
8384
8385 !! test
8386 Purely hash wikilink
8387 !! options
8388 title=[[User:Test/123]]
8389 subpage
8390 !! wikitext
8391 [[#a|b]]
8392 !! html/php
8393 <p><a href="#a">b</a>
8394 </p>
8395 !! html/parsoid
8396 <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>
8397 !! end
8398
8399 !! test
8400 Serialization of purely hash wikilink
8401 !! options
8402 title=[[User:Test/123]]
8403 subpage
8404 parsoid=html2wt
8405 !! html/parsoid
8406 <p><a href="#a">[[</a></p>
8407 !! wikitext
8408 [[#a|<nowiki>[[</nowiki>]]
8409 !! html/php
8410 <p><a href="#a">[[</a>
8411 </p>
8412 !! end
8413
8414 !! test
8415 1. Interaction of linktrail and template encapsulation
8416 !! wikitext
8417 {{echo|[[Foo]]}}l
8418 !! html/parsoid
8419 <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>
8420 !! end
8421
8422 !! test
8423 2. Interaction of linktrail and template encapsulation
8424 !! options
8425 parsoid
8426 !! wikitext
8427 {{echo|Some [[Fool]]}}s
8428 !! html
8429 <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>
8430 !! end
8431
8432 !! test
8433 3. Interaction of linktrail and template encapsulation
8434 !! options
8435 parsoid
8436 !! wikitext
8437 {{echo|Some [[Fool]]s are '''bold and foolish'''}}
8438 !! html
8439 <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>
8440 !! end
8441
8442 !! article
8443 Söfnuður
8444 !! text
8445 Test.
8446 !! endarticle
8447
8448 !! test
8449 Internal link with is link prefix
8450 !! options
8451 language=is
8452 !! wikitext
8453 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
8454 !! html
8455 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
8456 </p>
8457 !! end
8458
8459 !! article
8460 Mótmælendatrú
8461 !! text
8462 Test.
8463 !! endarticle
8464
8465 !! test
8466 Internal link with is link trail and link prefix
8467 !! options
8468 language=is
8469 !! wikitext
8470 [[mótmælendatrú|xxx]]ar
8471 [[mótmælendatrú]]ar
8472 mótmælenda[[söfnuður]]
8473 mótmælenda[[söfnuður|söfnuðir]]
8474 mótmælenda[[söfnuður|söfnuðir]]xxx
8475 !! html
8476 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
8477 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
8478 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
8479 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
8480 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
8481 </p>
8482 !! end
8483
8484 !! test
8485 Parsoid link trail escaping
8486 !! options
8487 parsoid=html2wt,html2html
8488 !! html/parsoid
8489 <p><a rel="mw:WikiLink" href="./Apple" title="Apple">apple</a>s</p>
8490 !! wikitext
8491 [[apple]]<nowiki/>s
8492 !! end
8493
8494 !! test
8495 Parsoid link prefix escaping
8496 !! options
8497 language=is
8498 parsoid=html2wt,html2html
8499 !! html/parsoid
8500 <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="./Söfnuður" title="Söfnuður">söfnuður</a></p>
8501 !! wikitext
8502 Aðrir mótmælenda<nowiki/>[[söfnuður]]
8503 !! end
8504
8505 !! test
8506 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
8507 !! wikitext
8508 [[Foo| bar]]
8509
8510 [[Foo| ''bar'']]
8511
8512 [http://wp.org foo]
8513
8514 [http://wp.org ''foo'']
8515 !! html
8516 <p><a href="/wiki/Foo" title="Foo"> bar</a>
8517 </p><p><a href="/wiki/Foo" title="Foo"> <i>bar</i></a>
8518 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
8519 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
8520 </p>
8521 !! end
8522
8523 !! test
8524 Parsoid: Scoped parsing should handle mixed transclusions and plain text
8525 !! wikitext
8526 [[Foo|{{echo|a}} b {{echo|c}}]]
8527 !! html/parsoid
8528 <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>
8529 !! end
8530
8531 !! test
8532 Link with angle bracket after anchor
8533 !! wikitext
8534 [[Foo#<bar>]]
8535 !! html/php
8536 <p><a href="/wiki/Foo#.3Cbar.3E" title="Foo">Foo#&lt;bar&gt;</a>
8537 </p>
8538 !! html/parsoid
8539 <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>
8540 !! end
8541
8542 ###
8543 ### Interwiki links (see maintenance/interwiki.sql)
8544 ###
8545
8546 !! test
8547 Inline interwiki link
8548 !! options
8549 parsoid=wt2html,wt2wt,html2html
8550 !! wikitext
8551 [[MeatBall:SoftSecurity]]
8552 !! html/php
8553 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
8554 </p>
8555 !! html/parsoid
8556 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a></p>
8557 !! end
8558
8559 !! test
8560 Inline interwiki link with empty title (T4372)
8561 !! options
8562 parsoid=wt2html,wt2wt,html2html
8563 !! wikitext
8564 [[MeatBall:]]
8565 !! html/php
8566 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
8567 </p>
8568 !! html/parsoid
8569 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?" title="meatball:">MeatBall:</a></p>
8570 !! end
8571
8572 !! test
8573 Interwiki link encoding conversion (T3636)
8574 !! wikitext
8575 *[[Wikipedia:ro:Olteni&#0355;a]]
8576 *[[Wikipedia:ro:Olteni&#355;a]]
8577 !! html
8578 <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>
8579 <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>
8580
8581 !! html+tidy
8582 <ul>
8583 <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>
8584 <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>
8585 </ul>
8586 !! end
8587
8588 !! test
8589 Interwiki link with fragment (T4130)
8590 !! wikitext
8591 [[MeatBall:SoftSecurity#foo]]
8592 !! html
8593 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
8594 </p>
8595 !! end
8596
8597 !! test
8598 Link scenarios with escaped fragments
8599 !! wikitext
8600 [[#Is this great?]]
8601 [[Foo#Is this great?]]
8602 [[meatball:Foo#Is this great?]]
8603 !! html/php
8604 <p><a href="#Is_this_great.3F">#Is this great?</a>
8605 <a href="/wiki/Foo#Is_this_great.3F" title="Foo">Foo#Is this great?</a>
8606 <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>
8607 </p>
8608 !! html/parsoid
8609 <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>
8610 <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>
8611 <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>
8612 !! end
8613
8614 # Ideally the wikipedia: prefix here should be proto-relative too
8615 # [CSA]: this is kind of a bogus test, as the PHP parser test doesn't
8616 # define the 'en' prefix, and originally the test used 'wikipedia',
8617 # which isn't a localinterwiki prefix hence the links to the 'en:Foo'
8618 # article.
8619 !! test
8620 Different interwiki prefixes mapping to the same URL
8621 !! wikitext
8622 [[:en:Foo]]
8623
8624 [[:en:Foo|Foo]]
8625
8626 [[wikipedia:Foo]]
8627
8628 [[:wikipedia:Foo|Foo]]
8629
8630 [[wikipedia:en:Foo]]
8631
8632 [[:wikipedia:en:Foo]]
8633
8634 [[ wikiPEdia :Foo]]
8635 !! html/parsoid
8636 <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>
8637
8638 <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>
8639
8640 <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>
8641
8642 <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>
8643
8644 <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>
8645
8646 <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>
8647
8648 <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>
8649 !! end
8650
8651 !! test
8652 Interwiki links that cannot be represented in wiki syntax
8653 !! wikitext
8654 [[meatball:ok]]
8655 [[meatball:ok#foo|ok with fragment]]
8656 [[meatball:ok_as_well?|ok ending with ? mark]]
8657 [http://de.wikipedia.org/wiki/Foo?action=history has query]
8658 [http://de.wikipedia.org/wiki/#foo is just fragment]
8659
8660 !! html/php
8661 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?ok" class="extiw" title="meatball:ok">meatball:ok</a>
8662 <a href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" class="extiw" title="meatball:ok">ok with fragment</a>
8663 <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>
8664 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
8665 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a>
8666 </p>
8667 !! html/parsoid
8668 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok" title="meatball:ok">meatball:ok</a>
8669 <a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" title="meatball:ok">ok with fragment</a>
8670 <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>
8671 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
8672 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a></p>
8673 !! end
8674
8675 !! test
8676 Interwiki links: trail
8677 !! wikitext
8678 [[wikipedia:Foo|Ba]]r
8679 !! html/php
8680 <p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
8681 </p>
8682 !! html/parsoid
8683 <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>
8684 !! end
8685
8686 !! test
8687 Local interwiki link
8688 !! options
8689 parsoid=wt2html,wt2wt,html2html
8690 !! wikitext
8691 [[local:Template:Foo]]
8692 !! html/php
8693 <p><a href="/wiki/Template:Foo" title="Template:Foo">local:Template:Foo</a>
8694 </p>
8695 !! html/parsoid
8696 <p><a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">local:Template:Foo</a></p>
8697 !! end
8698
8699 # Parsoid does not mark self-links, by design.
8700 !! test
8701 Local interwiki link: self-link to current page
8702 !! options
8703 title=[[Main Page]]
8704 parsoid=wt2html,wt2wt,html2html
8705 !! wikitext
8706 [[local:Main Page]]
8707 !! html/php
8708 <p><a class="mw-selflink selflink">local:Main Page</a>
8709 </p>
8710 !! html/parsoid
8711 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:Main Page</a></p>
8712 !! end
8713
8714 !! test
8715 Local interwiki link: prefix only (T66167)
8716 !! options
8717 parsoid=wt2html,wt2wt,html2html
8718 !! wikitext
8719 [[local:]]
8720 !! html/php
8721 <p><a href="/wiki/Main_Page" title="Main Page">local:</a>
8722 </p>
8723 !! html/parsoid
8724 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:</a></p>
8725 !! end
8726
8727 !! test
8728 Local interwiki link: with additional interwiki prefix (T63357)
8729 !! options
8730 parsoid=wt2html,wt2wt,html2html
8731 !! wikitext
8732 [[local:meatball:Hello]]
8733 !! html/php
8734 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?Hello" class="extiw" title="meatball:Hello">local:meatball:Hello</a>
8735 </p>
8736 !! html/parsoid
8737 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?Hello" title="meatball:Hello">local:meatball:Hello</a></p>
8738 !! end
8739
8740 !! test
8741 Multiple local interwiki link prefixes
8742 !! wikitext
8743 [[local:local:local:local:mi:local:Foo]]
8744 !! options
8745 parsoid=wt2html,wt2wt,html2html
8746 !! html/php
8747 <p><a href="/wiki/Foo" title="Foo">local:local:local:local:mi:local:Foo</a>
8748 </p>
8749 !! html/parsoid
8750 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">local:local:local:local:mi:local:Foo</a></p>
8751 !! end
8752
8753 ###
8754 ### Interlanguage links
8755 ### Language links (so that searching for '### language' matches..)
8756 ###
8757
8758 !! test
8759 Interlanguage link
8760 !! wikitext
8761 Blah blah blah
8762 [[zh:Chinese]]
8763 !! html/php
8764 <p>Blah blah blah
8765 </p>
8766 !! html/parsoid
8767 <p>Blah blah blah</p>
8768 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8769 !! end
8770
8771 ## parsoid html2wt will lose the space variations
8772 !! test
8773 Interlanguage link with spacing
8774 !! options
8775 parsoid=wt2html,wt2wt,html2html
8776 !! wikitext
8777 Blah blah blah
8778 [[ zh : Chinese ]]
8779 !! html/php
8780 <p>Blah blah blah
8781 </p>
8782 !! html/parsoid
8783 <p>Blah blah blah</p>
8784 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8785 !! end
8786
8787 !! test
8788 Double interlanguage link
8789 !! wikitext
8790 Blah blah blah
8791 [[es:Spanish]]
8792 [[zh:Chinese]]
8793 !! html/php
8794 <p>Blah blah blah
8795 </p>
8796 !! html/parsoid
8797 <p>Blah blah blah</p>
8798 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
8799 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8800 !! end
8801
8802 ## parsoid html2wt will lose the space variations
8803 !! test
8804 Interlanguage link variations
8805 !! options
8806 parsoid=wt2html,wt2wt,html2html
8807 !! wikitext
8808 Blah blah blah
8809 [[ es :Spanish]]
8810 [[ ZH :Chinese]]
8811 [[es:Foo_bar]]
8812 !! html/php
8813 <p>Blah blah blah
8814 </p>
8815 !! html/parsoid
8816 <p>Blah blah blah</p>
8817 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish" />
8818 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese" />
8819 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar" />
8820 !! end
8821
8822 !! test
8823 Escaping of interlanguage links (T129218, T156308)
8824 !! wikitext
8825 Blah blah blah
8826 [[:es:Spanish]]
8827 [[ : zh : Chinese ]]
8828 !! html/php
8829 <p>Blah blah blah
8830 <a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">es:Spanish</a>
8831 <a href="http://zh.wikipedia.org/wiki/Chinese" class="extiw" title="zh:Chinese"> zh : Chinese </a>
8832 </p>
8833 !! html/parsoid
8834 <p>Blah blah blah
8835 <a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">es:Spanish</a>
8836 <a rel="mw:ExtLink" href="http://zh.wikipedia.org/wiki/Chinese" title="zh:Chinese"> zh : Chinese </a></p>
8837 !! end
8838
8839 !! test
8840 Multiple colons escaping interlanguage links
8841 !! options
8842 parsoid=wt2html
8843 !! wikitext
8844 [[:es:Spanish]]
8845 [[::es:Spanish]]
8846 [[:::es:Spanish]]
8847 !! html/php
8848 <p><a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">es:Spanish</a>
8849 [[::es:Spanish]]
8850 [[:::es:Spanish]]
8851 </p>
8852 !! html/parsoid
8853 <p><a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">es:Spanish</a>
8854 [[::es:Spanish]]
8855 [[:::es:Spanish]]</p>
8856 !! end
8857
8858 ## parsoid html2wt will normalize the space to _
8859 !! test
8860 Space and question mark encoding in interlanguage links (T95473)
8861 !! options
8862 parsoid=wt2html,wt2wt,html2html
8863 !! wikitext
8864 Blah blah blah
8865 [[es:Foo bar?]]
8866 !! html/php
8867 <p>Blah blah blah
8868 </p>
8869 !! html/parsoid
8870 <p>Blah blah blah</p>
8871 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar%3F" />
8872 !! end
8873
8874 !! test
8875 Interlanguage link, with prefix links
8876 !! options
8877 language=ln
8878 !! wikitext
8879 Blah blah blah
8880 [[zh:Chinese]]
8881 !! html/php
8882 <p>Blah blah blah
8883 </p>
8884 !! html/parsoid
8885 <p>Blah blah blah</p>
8886 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8887 !! end
8888
8889 !! test
8890 Double interlanguage link, with prefix links (T10897)
8891 !! options
8892 language=ln
8893 !! wikitext
8894 Blah blah blah
8895 [[es:Spanish]]
8896 [[zh:Chinese]]
8897 !! html/php
8898 <p>Blah blah blah
8899 </p>
8900 !! html/parsoid
8901 <p>Blah blah blah</p>
8902 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
8903 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8904 !! end
8905
8906 !! test
8907 "Extra" interlanguage links (T34189 / gerrit 111390)
8908 !! wikitext
8909 Blah blah blah
8910 [[mul:Article]]
8911 !! html/php
8912 <p>Blah blah blah
8913 </p>
8914 !! html/parsoid
8915 <p>Blah blah blah</p>
8916 <link rel="mw:PageProp/Language" title="Multilingual" href="http://wikisource.org/wiki/Article"/>
8917 !! end
8918
8919 ## PHP parser tests script needs an update
8920 ## Parsoid html2wt will normalize output to [[:zh:Chinese]]
8921 !! test
8922 Language links render as inline links if $wgInterwikiMagic=false
8923 !! options
8924 wgInterwikiMagic=false
8925 parsoid=wt2html,wt2wt,html2html
8926 !! wikitext
8927 Blah blah blah
8928 [[zh:Chinese]]
8929 !! html/parsoid
8930 <p>Blah blah blah <a rel="mw:ExtLink" href="http://zh.wikipedia.org/wiki/Chinese" title="zh:Chinese">zh:Chinese</a></p>
8931 !! end
8932
8933 ## PHP parser tests script needs an update
8934 ## Parsoid html2wt will normalize output to [[:zh:Chinese]]
8935 !! test
8936 Language links render as inline links in the Talk namespace
8937 !! options
8938 title=Talk:Foo
8939 parsoid=wt2html,wt2wt,html2html
8940 !! wikitext
8941 Blah blah blah
8942 [[zh:Chinese]]
8943 !! html/parsoid
8944 <p>Blah blah blah <a rel="mw:ExtLink" href="http://zh.wikipedia.org/wiki/Chinese" title="zh:Chinese">zh:Chinese</a></p>
8945 !! end
8946
8947 !! test
8948 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
8949 !! options
8950 language=ln
8951 !! wikitext
8952 [[WW&nbsp;II]]
8953 !! html
8954 <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>
8955 </p>
8956 !! end
8957
8958 !! test
8959 Parsoid T55221: Wikilinks should be properly entity-escaped
8960 !! options
8961 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
8962 !! html/parsoid
8963 <p>He&amp;nbsp;llo <a href="./Foo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
8964 <p>He&amp;nbsp;llo <a href="./He&amp;nbsp;llo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
8965 !! wikitext
8966 He&amp;nbsp;llo [[Foo|He&amp;nbsp;llo]]
8967
8968 He&amp;nbsp;llo He&amp;nbsp;llo
8969 !! html/php
8970 <p>He&amp;nbsp;llo <a href="/wiki/Foo" title="Foo">He&amp;nbsp;llo</a>
8971 </p><p>He&amp;nbsp;llo He&amp;nbsp;llo
8972 </p>
8973 !! end
8974
8975 # html2wt will fail because of title normalization without data-parsoid
8976 !! test
8977 Parsoid: handle constructor well
8978 !! options
8979 parsoid=wt2html,wt2wt
8980 !! wikitext
8981 [[constructor]]
8982
8983 [[constructor:foo]]
8984 !! html/php
8985 <p><a href="/index.php?title=Constructor&amp;action=edit&amp;redlink=1" class="new" title="Constructor (page does not exist)">constructor</a>
8986 </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>
8987 </p>
8988 !! html/parsoid
8989 <p><a rel="mw:WikiLink" href="./Constructor" title="Constructor" data-parsoid='{"stx":"simple","a":{"href":"./Constructor"},"sa":{"href":"constructor"}}'>constructor</a></p>
8990
8991 <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>
8992 !! end
8993
8994 !! article
8995 ko:
8996 !! text
8997 Test.
8998 !! endarticle
8999
9000 # Note that `ko` isn't a known interlanguage prefix
9001 !! test
9002 Parsoid: recognize interlanguage links without a target page
9003 !! options
9004 ill
9005 !! wikitext
9006 [[es:]]
9007
9008 [[ko:]]
9009 !! html/php
9010 es:
9011 !! html/parsoid
9012 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/"/>
9013
9014 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
9015 !! end
9016
9017 # Note that `ko` isn't a known interwiki prefix
9018 !! test
9019 Parsoid: recognize interwiki links without a target page
9020 !! options
9021 parsoid=wt2html,wt2wt,html2html
9022 !! wikitext
9023 [[:es:]]
9024
9025 [[:ko:]]
9026 !! html/php
9027 <p><a href="http://es.wikipedia.org/wiki/" class="extiw" title="es:">es:</a>
9028 </p><p><a href="/wiki/Ko:" title="Ko:">ko:</a>
9029 </p>
9030 !! html/parsoid
9031 <p><a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/" title="es:">es:</a></p>
9032 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
9033 !! end
9034
9035 !! test
9036 Handle interwiki links pointing to the current wiki as plain wiki links (T47209)
9037 !! wikitext
9038 [[mi:Foo]]
9039 !! html/php
9040 <p><a href="/wiki/Foo" title="Foo">mi:Foo</a>
9041 </p>
9042 !! html/parsoid
9043 <p><a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo"},"sa":{"href":"mi:Foo"}}'>mi:Foo</a></p>
9044 !! end
9045
9046 !! test
9047 Interlanguage link with preceding local interwiki link (T70085)
9048 !! options
9049 parsoid=wt2html,wt2wt,html2html
9050 !! wikitext
9051 Blah blah blah
9052 [[local:es:Spanish]]
9053 !! html/php
9054 <p>Blah blah blah
9055 <a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">local:es:Spanish</a>
9056 </p>
9057 !! html/parsoid
9058 <p>Blah blah blah
9059 <a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">local:es:Spanish</a></p>
9060 !! end
9061
9062 !! test
9063 Looks like an interlanguage link, but is actually a local interwiki
9064 !! options
9065 parsoid=wt2html,wt2wt,html2html
9066 !! wikitext
9067 Blah blah blah
9068 [[mi:Template:Foo]]
9069 !! html/php
9070 <p>Blah blah blah
9071 <a href="/wiki/Template:Foo" title="Template:Foo">mi:Template:Foo</a>
9072 </p>
9073 !! html/parsoid
9074 <p>Blah blah blah
9075 <a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">mi:Template:Foo</a></p>
9076 !! end
9077
9078 ###
9079 ### Redirects, Parsoid-only
9080 ###
9081
9082 !! test
9083 1. Simple redirect to page
9084 !! wikitext
9085 #REDIRECT [[Main Page]]
9086 !! html/parsoid
9087 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
9088 !! end
9089
9090 !! test
9091 2. Other redirect variants
9092 !! wikitext
9093 #REDIRECT [[Main_Page]]
9094 !! html/parsoid
9095 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Main_Page"},"sa":{"href":"Main_Page"}}'/>
9096 !! end
9097
9098 # Not a valid redirect in PHP (although perhaps it was, once upon a time)
9099 # This tests the Parsoid bail-out code.
9100 !! test
9101 3. Other redirect variants
9102 !! wikitext
9103 #REDIRECT [[<nowiki>[[Bar]]</nowiki>]]
9104 !! html/parsoid
9105 <ol><li data-parsoid>REDIRECT [[[[Bar]]]]</li></ol>
9106 !! end
9107
9108 !! test
9109 4. Redirect to a templated destination
9110 !! wikitext
9111 #REDIRECT [[{{echo|Foo}}bar]]
9112 !! html/parsoid
9113 <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"}]]}'/>
9114 !! end
9115
9116 !! test
9117 Empty redirect
9118 !! options
9119 parsoid=wt2html,wt2wt
9120 !! wikitext
9121 #REDIRECT [[]]
9122 !! html/parsoid
9123 <ol>
9124 <li>REDIRECT [[]]</li></ol>
9125 !! end
9126
9127 !! test
9128 Optional colon in #REDIRECT
9129 !! options
9130 # the colon is archaic syntax. we support it for wt2html, but we
9131 # don't care that it roundtrips back to the modern syntax.
9132 parsoid=wt2html,html2html
9133 !! wikitext
9134 #REDIRECT:[[Main Page]]
9135 !! html/parsoid
9136 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
9137 !! end
9138
9139 !! test
9140 Whitespace in #REDIRECT with optional colon
9141 !! options
9142 # the colon and gratuitous whitespace is archaic syntax. we support
9143 # it for wt2html, but we don't care that it roundtrips back to the
9144 # modern syntax (without extra whitespace)
9145 parsoid=wt2html,html2html
9146 !! wikitext
9147
9148 #REDIRECT
9149 :
9150 [[Main Page]]
9151 !! html/parsoid
9152 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
9153 !! end
9154
9155 !! test
9156 Piped link in #REDIRECT
9157 !! options
9158 # content after piped link is ignored. we support this syntax,
9159 # but don't care that the piped link is lost when we roundtrip this.
9160 parsoid=wt2html
9161 !! wikitext
9162 #REDIRECT [[Main Page|bar]]
9163 !! html/parsoid
9164 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
9165 !! end
9166
9167 !! test
9168 Redirect to category (T104502)
9169 !! options
9170 parsoid=wt2html,wt2wt
9171 !! wikitext
9172 #REDIRECT [[Category:Foo]]
9173 !! html/parsoid
9174 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
9175 !! end
9176
9177 !! test
9178 Redirect to category with URL encoding (T104502)
9179 !! options
9180 parsoid=wt2html
9181 !! wikitext
9182 #REDIRECT [[Category%3AFoo]]
9183 !! html/parsoid
9184 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
9185 !! end
9186
9187 !! test
9188 Redirect to category page
9189 !! wikitext
9190 #REDIRECT [[:Category:Foo]]
9191 !! html/parsoid
9192 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
9193 !! end
9194
9195 !! test
9196 Redirect to image page (1)
9197 !! wikitext
9198 #REDIRECT [[File:Wiki.png]]
9199 !! html/parsoid
9200 <link rel="mw:PageProp/redirect" href="./File:Wiki.png"/>
9201 !! end
9202
9203 !! test
9204 Redirect to image page (2)
9205 !! wikitext
9206 #REDIRECT [[Image:Wiki.png]]
9207 !! html/parsoid
9208 <link rel="mw:PageProp/redirect" href="./File:Wiki.png" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./File:Wiki.png"},"sa":{"href":"Image:Wiki.png"}}'/>
9209 !! end
9210
9211 # html2wt disabled because wts serializes as "#REDIRECT [[:en:File:Wiki.png]]"
9212 # Next test confirms this.
9213 !! test
9214 Redirect to language (1) (T104918)
9215 !! options
9216 parsoid=wt2html,wt2wt,html2html
9217 !! wikitext
9218 #REDIRECT [[en:File:Wiki.png]]
9219 !! html/parsoid
9220 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
9221 !! end
9222
9223 !! test
9224 Redirect to language (2) (T104918)
9225 !! wikitext
9226 #REDIRECT [[:en:File:Wiki.png]]
9227 !! html/parsoid
9228 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
9229 !! end
9230
9231 !! test
9232 Redirect to interwiki (T104918)
9233 !! wikitext
9234 #REDIRECT [[meatball:File:Wiki.png]]
9235 !! html/parsoid
9236 <link rel="mw:PageProp/redirect" href="http://www.usemod.com/cgi-bin/mb.pl?File:Wiki.png"/>
9237 !! end
9238
9239 !! test
9240 Non-English #REDIRECT
9241 !! options
9242 language=is
9243 !! wikitext
9244 #TILVÍSUN [[Main Page]]
9245 !! html/parsoid
9246 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#TILVÍSUN ","a":{"href":"./Main_Page"},"sa":{"href":"Main Page"}}'/>
9247 !! end
9248
9249 !! test
9250 Redirect syntax under text isn't considered a redirect
9251 !! wikitext
9252 some text
9253 #redirect [[Main Page]]
9254 !! html/parsoid
9255 <p>some text</p>
9256 <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>
9257 !! end
9258
9259 !! test
9260 New redirect
9261 !! options
9262 parsoid=html2wt
9263 !! html/parsoid
9264 <p>Foo<link rel="mw:PageProp/redirect" href="./Foo"/></p>
9265 !! wikitext
9266 #REDIRECT [[Foo]]
9267 Foo
9268 !! end
9269
9270 !! test
9271 Redirect followed by block on the same line
9272 !! options
9273 parsoid=wt2html
9274 !! wikitext
9275 #REDIRECT [[Main Page]]<!-- haha -->== hi ==
9276 !! html/parsoid
9277 <link rel="mw:PageProp/redirect" href="./Main_Page"/><!-- haha --><h2 id="hi"> hi </h2>
9278 !! end
9279
9280 !! test
9281 Redirect followed by a newline
9282 !! wikitext
9283 #REDIRECT [[Main Page]]
9284 A newline
9285 !! html/parsoid
9286 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
9287 <p>A newline</p>
9288 !! end
9289
9290 !! test
9291 Redirect followed by multiple newlines
9292 !! wikitext
9293 #REDIRECT [[Main Page]]
9294
9295
9296 A newline
9297 !! html/parsoid
9298 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
9299
9300 <p><br/>
9301 A newline</p>
9302 !! end
9303
9304 !! test
9305 Drop duplicate redirects
9306 !! options
9307 parsoid=html2wt
9308 !! html/parsoid
9309 <link rel="mw:PageProp/redirect" href="./Foo"/>
9310 <link rel="mw:PageProp/redirect" href="./Bar"/>
9311 <link rel="mw:PageProp/redirect" href="./Baz"/>
9312 !! wikitext
9313 #REDIRECT [[Foo]]
9314 !! end
9315
9316 ##
9317 ## XHTML tidiness
9318 ###
9319
9320 !! test
9321 <br> to <br />
9322 !! wikitext
9323 1<br>2<br />3
9324 !! html
9325 <p>1<br />2<br />3
9326 </p>
9327 !! end
9328
9329 !! test
9330 Broken br tag sanitization
9331 !! wikitext
9332 </br>
9333 !! html/php
9334 <p>&lt;/br&gt;
9335 </p>
9336 !! end
9337
9338 # TODO: Fix html2html mode (T53055)!
9339 !! test
9340 Parsoid: Broken br tag recognition
9341 !! options
9342 parsoid=wt2html
9343 !! wikitext
9344 </br>
9345
9346 <br/ >
9347 !! html+tidy
9348 <p><br /></p>
9349 <p><br /></p>
9350 !! end
9351
9352 !! test
9353 Incorrecly removing closing slashes from correctly formed XHTML
9354 !! wikitext
9355 <br style="clear:both;" />
9356 !! html
9357 <p><br style="clear:both;" />
9358 </p>
9359 !! end
9360
9361 !! test
9362 Failing to transform badly formed HTML into correct XHTML
9363 !! wikitext
9364 <br style="clear: left;">
9365 <br style="clear: right;">
9366 <br style="clear: both;">
9367 !! html
9368 <p><br style="clear: left;" />
9369 <br style="clear: right;" />
9370 <br style="clear: both;" />
9371 </p>
9372 !!end
9373
9374 ## FIXME: Is Parsoid's acceptance of self-closing html-tags
9375 ## a feature or a bug? See https://phabricator.wikimedia.org/T76962
9376 !! test
9377 Handling html with a div self-closing tag
9378 !! wikitext
9379 <div title />
9380 <div title/>
9381 <div title/ >
9382 <div title=bar />
9383 <div title=bar/>
9384 <div title=bar/ >
9385 !! html/php
9386 <p>&lt;div title /&gt;
9387 &lt;div title/&gt;
9388 </p>
9389 <div>
9390 <p>&lt;div title=bar /&gt;
9391 &lt;div title=bar/&gt;
9392 </p>
9393 <div title="bar/"></div>
9394 </div>
9395
9396 !! html/parsoid
9397 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
9398 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
9399 <div title="" data-parsoid='{"stx":"html","selfClose":true,"brokenHTMLTag":true}'></div>
9400 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
9401 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
9402 <div title="bar/" data-parsoid='{"stx":"html","autoInsertedEnd":true}'></div>
9403 !! end
9404
9405 !! test
9406 Handling html with a br self-closing tag
9407 !! wikitext
9408 <br title />
9409 <br title/>
9410 <br title/ >
9411 <br title=bar />
9412 <br title=bar/>
9413 <br title=bar/ >
9414 !! html/php
9415 <p><br title="" />
9416 <br title="" />
9417 <br />
9418 <br title="bar" />
9419 <br title="bar" />
9420 <br title="bar/" />
9421 </p>
9422 !! html/parsoid
9423 <p><br title="" />
9424 <br title="" />
9425 <br title="" />
9426 <br title="bar" />
9427 <br title="bar" />
9428 <br title="bar/" />
9429 </p>
9430 !! end
9431
9432 !! test
9433 Horizontal ruler (should it add that extra space?)
9434 !! wikitext
9435 <hr>
9436 <hr >
9437 foo <hr
9438 > bar
9439 !! html+tidy
9440 <hr />
9441 <hr />
9442 <p>foo</p>
9443 <hr />
9444 <p>bar</p>
9445 !! end
9446
9447 !! test
9448 Horizontal ruler -- 4+ dashes render hr
9449 !! wikitext
9450 ----
9451 !! html
9452 <hr />
9453
9454 !! end
9455
9456 !! test
9457 Horizontal ruler -- eats additional dashes on the same line
9458 !! wikitext
9459 ---------
9460 !! html
9461 <hr />
9462
9463 !! end
9464
9465 !! test
9466 Horizontal ruler -- does not collapse dashes on consecutive lines
9467 !! wikitext
9468 ----
9469 ----
9470 !! html
9471 <hr />
9472 <hr />
9473
9474 !! end
9475
9476 !! test
9477 Horizontal ruler -- <4 dashes render as plain text
9478 !! wikitext
9479 ---
9480 !! html
9481 <p>---
9482 </p>
9483 !! end
9484
9485 !! test
9486 Horizontal ruler -- Supports content following dashes on same line
9487 !! wikitext
9488 ---- Foo
9489 !! html
9490 <hr /> Foo
9491
9492 !! html+tidy
9493 <hr />
9494 <p>Foo</p>
9495 !! end
9496
9497 ###
9498 ### Block-level elements
9499 ###
9500 !! test
9501 Common list
9502 !! wikitext
9503 *Common list
9504 * item 2
9505 *item 3
9506 !! html
9507 <ul><li>Common list</li>
9508 <li> item 2</li>
9509 <li>item 3</li></ul>
9510
9511 !! end
9512
9513 !! test
9514 Numbered list
9515 !! wikitext
9516 #Numbered list
9517 #item 2
9518 # item 3
9519 !! html
9520 <ol><li>Numbered list</li>
9521 <li>item 2</li>
9522 <li> item 3</li></ol>
9523
9524 !! end
9525
9526 !! test
9527 Mixed list
9528 !! wikitext
9529 *Mixed list
9530 *# with numbers
9531 ** and bullets
9532 *# and numbers
9533 *bullets again
9534 **bullet level 2
9535 ***bullet level 3
9536 ***#Number on level 4
9537 **bullet level 2
9538 **#Number on level 3
9539 **#Number on level 3
9540 *#number level 2
9541 *Level 1
9542 *** Level 3
9543 #** Level 3, but ordered
9544 !! html
9545 <ul><li>Mixed list
9546 <ol><li> with numbers</li></ol>
9547 <ul><li> and bullets</li></ul>
9548 <ol><li> and numbers</li></ol></li>
9549 <li>bullets again
9550 <ul><li>bullet level 2
9551 <ul><li>bullet level 3
9552 <ol><li>Number on level 4</li></ol></li></ul></li>
9553 <li>bullet level 2
9554 <ol><li>Number on level 3</li>
9555 <li>Number on level 3</li></ol></li></ul>
9556 <ol><li>number level 2</li></ol></li>
9557 <li>Level 1
9558 <ul><li><ul><li> Level 3</li></ul></li></ul></li></ul>
9559 <ol><li><ul><li><ul><li> Level 3, but ordered</li></ul></li></ul></li></ol>
9560
9561 !! end
9562
9563 !! test
9564 1. Nested mixed wikitext and html list
9565 !! wikitext
9566 * hi
9567 * <ul><li>ho</li></ul>
9568 * hi
9569 ** ho
9570 !! html/php
9571 <ul><li> hi</li>
9572 <li> <ul><li>ho</li></ul></li>
9573 <li> hi
9574 <ul><li> ho</li></ul></li></ul>
9575
9576 !! html/parsoid
9577 <ul><li> hi</li>
9578 <li> <ul data-parsoid='{"stx":"html"}'><li data-parsoid='{"stx":"html"}'>ho</li></ul></li>
9579 <li> hi
9580 <ul><li> ho</li></ul></li></ul>
9581 !! end
9582
9583 !! test
9584 2. Nested mixed wikitext and html list (incompatible)
9585 !! wikitext
9586 ; hi
9587 : {{echo|<li>ho</li>}}
9588 !! html/php
9589 <dl><dt> hi</dt>
9590 <dd> <li>ho</li></dd></dl>
9591
9592 !! html/parsoid
9593 <dl><dt> hi</dt>
9594 <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>
9595 !! end
9596
9597 !! test
9598 Nested lists 1
9599 !! wikitext
9600 *foo
9601 **bar
9602 !! html
9603 <ul><li>foo
9604 <ul><li>bar</li></ul></li></ul>
9605
9606 !! end
9607
9608 !! test
9609 Nested lists 2
9610 !! wikitext
9611 **foo
9612 *bar
9613 !! html
9614 <ul><li><ul><li>foo</li></ul></li>
9615 <li>bar</li></ul>
9616
9617 !! end
9618
9619 !! test
9620 Nested lists 3 (first element empty)
9621 !! wikitext
9622 *
9623 **bar
9624 !! html
9625 <ul><li>
9626 <ul><li>bar</li></ul></li></ul>
9627
9628 !! end
9629
9630 !! test
9631 Nested lists 4 (first element empty)
9632 !! wikitext
9633 **
9634 *bar
9635 !! html
9636 <ul><li><ul><li></li></ul></li>
9637 <li>bar</li></ul>
9638
9639 !! end
9640
9641 !! test
9642 Nested lists 5 (both elements empty)
9643 !! wikitext
9644 **
9645 *
9646 !! html
9647 <ul><li><ul><li></li></ul></li>
9648 <li></li></ul>
9649
9650 !! end
9651
9652 !! test
9653 Nested lists 6 (both elements empty)
9654 !! wikitext
9655 *
9656 **
9657 !! html
9658 <ul><li>
9659 <ul><li></li></ul></li></ul>
9660
9661 !! end
9662
9663 !! test
9664 Nested lists 7 (skip initial nesting levels)
9665 !! wikitext
9666 *** foo
9667 !! html
9668 <ul><li><ul><li><ul><li> foo</li></ul></li></ul></li></ul>
9669
9670 !! end
9671
9672 !! test
9673 Nested lists 8 (multiple nesting transitions)
9674 !! wikitext
9675 * foo
9676 *** bar
9677 ** baz
9678 * boo
9679 !! html
9680 <ul><li> foo
9681 <ul><li><ul><li> bar</li></ul></li>
9682 <li> baz</li></ul></li>
9683 <li> boo</li></ul>
9684
9685 !! end
9686
9687 !! test
9688 Nested lists 9 (extension interaction)
9689 !! options
9690 parsoid
9691 !! wikitext
9692 *<references />
9693 !! html/parsoid
9694 <ul><li data-parsoid='{}'><ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-parsoid='{}' data-mw='{"name":"references","attrs":{}}'></ol></li></ul>
9695 !! end
9696
9697 !! test
9698 1. Lists with start-of-line-transparent tokens before bullets: Comments
9699 !! wikitext
9700 *foo
9701 *<!--cmt-->bar
9702 <!--cmt-->*baz
9703 !! html
9704 <ul><li>foo</li>
9705 <li>bar</li>
9706 <li>baz</li></ul>
9707
9708 !! end
9709
9710 !! test
9711 2. Lists with start-of-line-transparent tokens before bullets: Template close
9712 !! wikitext
9713 *foo {{echo|bar
9714 }}*baz
9715 !! html
9716 <ul><li>foo bar</li>
9717 <li>baz</li></ul>
9718
9719 !! end
9720
9721 !! test
9722 List items are not parsed correctly following a <pre> block (T2785)
9723 !! wikitext
9724 * <pre>foo</pre>
9725 * <pre>bar</pre>
9726 * zar
9727 !! html/php
9728 <ul><li> <pre>foo</pre></li>
9729 <li> <pre>bar</pre></li>
9730 <li> zar</li></ul>
9731
9732 !! html/parsoid
9733 <ul><li> <pre typeof="mw:Extension/pre" about="#mwt2" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"foo"}}'>foo</pre></li>
9734 <li> <pre typeof="mw:Extension/pre" about="#mwt4" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"bar"}}'>bar</pre></li>
9735 <li> zar</li></ul>
9736 !! end
9737
9738 !! test
9739 List items from template
9740 !! wikitext
9741
9742 {{inner list}}
9743 * item 2
9744
9745 * item 0
9746 {{inner list}}
9747 * item 2
9748
9749 * item 0
9750 * notSOL{{inner list}}
9751 * item 2
9752 !! html
9753 <ul><li> item 1</li>
9754 <li> item 2</li></ul>
9755 <ul><li> item 0</li>
9756 <li> item 1</li>
9757 <li> item 2</li></ul>
9758 <ul><li> item 0</li>
9759 <li> notSOL</li>
9760 <li> item 1</li>
9761 <li> item 2</li></ul>
9762
9763 !! end
9764
9765 !! test
9766 List interrupted by empty line or heading
9767 !! wikitext
9768 * foo
9769
9770 ** bar
9771 == A heading ==
9772 * Another list item
9773 !! html
9774 <ul><li> foo</li></ul>
9775 <ul><li><ul><li> bar</li></ul></li></ul>
9776 <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>
9777 <ul><li> Another list item</li></ul>
9778
9779 !!end
9780
9781 !!test
9782 Multiple list tags generated by templates
9783 !! wikitext
9784 {{echo|<li>}}a
9785 {{echo|<li>}}b
9786 {{echo|<li>}}c
9787 !! html
9788 <li>a
9789 <li>b
9790 <li>c</li>
9791 </li>
9792 </li>
9793
9794 !! html+tidy
9795 <ul>
9796 <li>a</li>
9797 <li>b</li>
9798 <li>c</li>
9799 </ul>
9800 !!end
9801
9802 !!test
9803 Single-comment whitespace lines dont break lists, and neither do multi-comment whitespace lines
9804 !! wikitext
9805 *a
9806 <!--This line will NOT split the list-->
9807 *b
9808 <!--This line will NOT split the list either-->
9809 *c
9810 <!--foo--> <!----> <!--This line NOT split the list either-->
9811 *d
9812 !! html
9813 <ul><li>a</li>
9814 <li>b</li>
9815 <li>c</li>
9816 <li>d</li></ul>
9817
9818 !!end
9819
9820 !!test
9821 Replacing whitespace with tabs still doesn't break the list (gerrit 78327)
9822 !! wikitext
9823 *a
9824 <!--This line will NOT split the list-->
9825 *b
9826 <!--This line will NOT split the list either-->
9827 *c
9828 <!--foo--> <!----> <!--This line NOT split the list
9829 either-->
9830 *d
9831 !! html
9832 <ul><li>a</li>
9833 <li>b</li>
9834 <li>c</li>
9835 <li>d</li></ul>
9836
9837 !!end
9838
9839 !!test
9840 Test the li-hack
9841 (The PHP parser relies on Tidy for the hack)
9842 !!options
9843 parsoid=wt2html,wt2wt
9844 !! wikitext
9845 * foo
9846 * <li>li-hack
9847 * {{echo|<li>templated li-hack}}
9848 * <!--foo--> <li> unsupported li-hack with preceding comments
9849
9850 <ul>
9851 <li><li>not a li-hack
9852 </li>
9853 </ul>
9854 !! html+tidy
9855 <ul>
9856 <li>foo</li>
9857 <li>li-hack</li>
9858 <li>templated li-hack</li>
9859 <li>unsupported li-hack with preceding comments</li>
9860 </ul>
9861 <ul>
9862 <li>not a li-hack</li>
9863 </ul>
9864 !!end
9865
9866 !! test
9867 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
9868 !! options
9869 parsoid
9870 !! wikitext
9871 # foo
9872 ## bar
9873 * foo
9874 ** bar
9875 : foo
9876 :: bar
9877 !! html
9878 <ol>
9879 <li> foo<ol>
9880 <li> bar</li>
9881 </ol></li>
9882 </ol><ul>
9883 <li> foo<ul>
9884 <li> bar</li>
9885 </ul></li>
9886 </ul><dl>
9887 <dd> foo<dl>
9888 <dd> bar</dd>
9889 </dl></dd>
9890 </dl>
9891 !! end
9892
9893 !! test
9894 Parsoid: Test of whitespace serialization with Templated bullets
9895 !! options
9896 parsoid
9897 !! wikitext
9898 * {{bullet}}
9899 !! html
9900 <ul>
9901 <li> </li><li about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"bullet","href":"./Template:Bullet"},"params":{},"i":0}}]}'> Bar</li>
9902 </ul>
9903 !! end
9904
9905 # ------------------------------------------------------------------------
9906 # The next set of tests are about Parsoid's ability to handle badly nested
9907 # tags (parse, minimize scope of fixup, and roundtrip back)
9908 # ------------------------------------------------------------------------
9909
9910 !! test
9911 Unbalanced closing block tags break a list
9912 (php parser relies on Tidy to fix up)
9913 !! wikitext
9914 <div>
9915 *a</div><div>
9916 *b</div>
9917 !! html+tidy
9918 <div>
9919 <ul>
9920 <li>a</li>
9921 </ul>
9922 </div>
9923 <div>
9924 <ul>
9925 <li>b</li>
9926 </ul>
9927 </div>
9928 !! end
9929
9930 # Parsoid fails this test, but it might be tricky to support properly.
9931 # See T70395.
9932 !! test
9933 Unbalanced closing non-block tags don't break a list
9934 (php parser relies on Tidy to fix up)
9935 !! wikitext
9936 <span>
9937 *a</span><span>
9938 *b</span>
9939 !! html/php+tidy
9940 <ul>
9941 <li><span>a</span></li>
9942 <li><span>b</span></li>
9943 </ul>
9944 !! html/parsoid
9945 <span>
9946 <ul>
9947 <li>a<span></span>
9948 </li>
9949 <li>b
9950 </li>
9951 </ul>
9952 </span>
9953 !! end
9954
9955 !! test
9956 Unclosed formatting tags that straddle lists are closed and reopened
9957 (php parser relies on Tidy to fix up)
9958 !! options
9959 parsoid=wt2html,wt2wt,html2html
9960 !! wikitext
9961 # <s> a
9962 # b </s>
9963 !! html/php+tidy
9964 <ol>
9965 <li><s>a</s></li>
9966 <li><s>b</s></li>
9967 </ol>
9968 !! html/parsoid
9969 <ol><li> <s> a</s></li>
9970 <li><s> b </s></li></ol>
9971 !! end
9972
9973 # See T70395.
9974 !!test
9975 1. List embedded in a formatting tag
9976 !! wikitext
9977 <small>
9978 * foo
9979 </small>
9980 !! html/php+tidy
9981 <ul>
9982 <li><small>foo</small></li>
9983 </ul>
9984 !! html/parsoid
9985 <small>
9986 <ul>
9987 <li> foo</li>
9988 </ul>
9989 </small>
9990 !!end
9991
9992 ## Ugly Parsoid output here
9993 ## Not sure what the right output is.
9994 !!test
9995 2. List embedded in a formatting tag
9996 !! wikitext
9997 <small>
9998 *a
9999 *b</small>
10000 !! html/php+tidy
10001 <ul>
10002 <li><small>a</small></li>
10003 <li><small>b</small></li>
10004 </ul>
10005 !! html/parsoid
10006 <small></small>
10007 <ul><small>
10008 <li>a</li>
10009 </small>
10010 <li><small>b</small></li>
10011 </ul>
10012 !!end
10013
10014 # Ugly Parsoid and PHP parser output here
10015 # Not sure if we want to make this a test!
10016 #
10017 ## !!test
10018 ## 3. Unclosed formatting tags in list elements
10019 ## !! wikitext
10020 ## *<small>a
10021 ## *<small>b
10022 ## !! html/php+tidy
10023 ## <ul>
10024 ## <li><small>a</small></li>
10025 ## <li><small><small>b</small></small></li>
10026 ## </ul>
10027 ## !! html/parsoid
10028 ## <ul>
10029 ## <li><small>a</small></li>
10030 ## <small>
10031 ## <li><small>b</small></li>
10032 ## </small></ul>
10033 ## !!end
10034
10035 # This is a bug in the PHP parser + tidy combination.
10036 # (The </tr> tag gets parsed as text and html-escaped by PHP,
10037 # and then fostered out of the table by tidy.)
10038 # We believe the Parsoid output to be correct.
10039 !! test
10040 Table with missing opening <tr> tag
10041 !! options
10042 parsoid=wt2html,wt2wt
10043 !! wikitext
10044 <table>
10045 <td>foo</td>
10046 </tr>
10047 </table>
10048 !! html+tidy
10049 <table>
10050 <tr>
10051 <td>foo</td>
10052 </tr>
10053 </table>
10054 !! end
10055
10056 ###
10057 ### Magic Words
10058 ###
10059
10060 # Note that the current date is hard-coded as
10061 # 1970-01-01T00:02:03Z (a Thursday)
10062 # when running parser tests. The timezone is also fixed to GMT, so
10063 # local date will be identical to current date.
10064
10065 !! test
10066 Magic Word: {{CURRENTDAY}}
10067 !! wikitext
10068 {{CURRENTDAY}}
10069 !! html
10070 <p>1
10071 </p>
10072 !! end
10073
10074 !! test
10075 Magic Word: {{CURRENTDAY2}}
10076 !! wikitext
10077 {{CURRENTDAY2}}
10078 !! html
10079 <p>01
10080 </p>
10081 !! end
10082
10083 !! test
10084 Magic Word: {{CURRENTDAYNAME}}
10085 !! wikitext
10086 {{CURRENTDAYNAME}}
10087 !! html
10088 <p>Thursday
10089 </p>
10090 !! end
10091
10092 !! test
10093 Magic Word: {{CURRENTDOW}}
10094 !! wikitext
10095 {{CURRENTDOW}}
10096 !! html
10097 <p>4
10098 </p>
10099 !! end
10100
10101 !! test
10102 Magic Word: {{CURRENTMONTH}}
10103 !! wikitext
10104 {{CURRENTMONTH}}
10105 !! html
10106 <p>01
10107 </p>
10108 !! end
10109
10110 !! test
10111 Magic Word: {{CURRENTMONTH1}}
10112 !! wikitext
10113 {{CURRENTMONTH1}}
10114 !! html
10115 <p>1
10116 </p>
10117 !! end
10118
10119 !! test
10120 Magic Word: {{CURRENTMONTHABBREV}}
10121 !! wikitext
10122 {{CURRENTMONTHABBREV}}
10123 !! html
10124 <p>Jan
10125 </p>
10126 !! end
10127
10128 !! test
10129 Magic Word: {{CURRENTMONTHNAME}}
10130 !! wikitext
10131 {{CURRENTMONTHNAME}}
10132 !! html
10133 <p>January
10134 </p>
10135 !! end
10136
10137 !! test
10138 Magic Word: {{CURRENTMONTHNAMEGEN}}
10139 !! wikitext
10140 {{CURRENTMONTHNAMEGEN}}
10141 !! html
10142 <p>January
10143 </p>
10144 !! end
10145
10146 !! test
10147 Magic Word: {{CURRENTTIME}}
10148 !! wikitext
10149 {{CURRENTTIME}}
10150 !! html
10151 <p>00:02
10152 </p>
10153 !! end
10154
10155 !! test
10156 Magic Word: {{CURRENTHOUR}}
10157 !! wikitext
10158 {{CURRENTHOUR}}
10159 !! html
10160 <p>00
10161 </p>
10162 !! end
10163
10164 !! test
10165 Magic Word: {{CURRENTWEEK}} (T6594)
10166 !! wikitext
10167 {{CURRENTWEEK}}
10168 !! html
10169 <p>1
10170 </p>
10171 !! end
10172
10173 !! test
10174 Magic Word: {{CURRENTYEAR}}
10175 !! wikitext
10176 {{CURRENTYEAR}}
10177 !! html
10178 <p>1970
10179 </p>
10180 !! end
10181
10182 !! test
10183 Magic Word: {{CURRENTTIMESTAMP}}
10184 !! wikitext
10185 {{CURRENTTIMESTAMP}}
10186 !! html
10187 <p>19700101000203
10188 </p>
10189 !! end
10190
10191 !! test
10192 Magic Words LOCAL (UTC)
10193 !! wikitext
10194 * {{LOCALMONTH}}
10195 * {{LOCALMONTH1}}
10196 * {{LOCALMONTHNAME}}
10197 * {{LOCALMONTHNAMEGEN}}
10198 * {{LOCALMONTHABBREV}}
10199 * {{LOCALDAY}}
10200 * {{LOCALDAY2}}
10201 * {{LOCALDAYNAME}}
10202 * {{LOCALYEAR}}
10203 * {{LOCALTIME}}
10204 * {{LOCALHOUR}}
10205 * {{LOCALWEEK}}
10206 * {{LOCALDOW}}
10207 * {{LOCALTIMESTAMP}}
10208 !! html
10209 <ul><li> 01</li>
10210 <li> 1</li>
10211 <li> January</li>
10212 <li> January</li>
10213 <li> Jan</li>
10214 <li> 1</li>
10215 <li> 01</li>
10216 <li> Thursday</li>
10217 <li> 1970</li>
10218 <li> 00:02</li>
10219 <li> 00</li>
10220 <li> 1</li>
10221 <li> 4</li>
10222 <li> 19700101000203</li></ul>
10223
10224 !! end
10225
10226 !! test
10227 Magic Word: {{FULLPAGENAME}}
10228 !! options
10229 title=[[User:Ævar Arnfjörð Bjarmason]]
10230 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10231 !! wikitext
10232 {{FULLPAGENAME}}
10233 !! html/*
10234 <p>User:Ævar Arnfjörð Bjarmason
10235 </p>
10236 !! end
10237
10238 !! test
10239 Magic Word: {{FULLPAGENAMEE}}
10240 !! options
10241 title=[[User:Ævar Arnfjörð Bjarmason]]
10242 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10243 !! wikitext
10244 {{FULLPAGENAMEE}}
10245 !! html/*
10246 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10247 </p>
10248 !! end
10249
10250 !! test
10251 Magic Word: {{TALKSPACE}}
10252 !! options
10253 title=[[User:Ævar Arnfjörð Bjarmason]]
10254 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10255 !! wikitext
10256 {{TALKSPACE}}
10257 !! html/*
10258 <p>User talk
10259 </p>
10260 !! end
10261
10262 !! test
10263 Magic Word: {{TALKSPACE}}, same namespace
10264 !! options
10265 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10266 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10267 !! wikitext
10268 {{TALKSPACE}}
10269 !! html/*
10270 <p>User talk
10271 </p>
10272 !! end
10273
10274 !! test
10275 Magic Word: {{TALKSPACE}}, main namespace
10276 !! options
10277 title=[[Parser Test]]
10278 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10279 !! wikitext
10280 {{TALKSPACE}}
10281 !! html/*
10282 <p>Talk
10283 </p>
10284 !! end
10285
10286 !! test
10287 Magic Word: {{TALKSPACEE}}
10288 !! options
10289 title=[[User:Ævar Arnfjörð Bjarmason]]
10290 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10291 !! wikitext
10292 {{TALKSPACEE}}
10293 !! html/*
10294 <p>User_talk
10295 </p>
10296 !! end
10297
10298 !! test
10299 Magic Word: {{SUBJECTSPACE}}
10300 !! options
10301 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10302 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10303 !! wikitext
10304 {{SUBJECTSPACE}}
10305 !! html/*
10306 <p>User
10307 </p>
10308 !! end
10309
10310 !! test
10311 Magic Word: {{SUBJECTSPACE}}, same namespace
10312 !! options
10313 title=[[User:Ævar Arnfjörð Bjarmason]]
10314 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10315 !! wikitext
10316 {{SUBJECTSPACE}}
10317 !! html/*
10318 <p>User
10319 </p>
10320 !! end
10321
10322 !! test
10323 Magic Word: {{SUBJECTSPACE}}, main namespace
10324 !! options
10325 title=[[Parser Test]]
10326 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10327 !! wikitext
10328 {{SUBJECTSPACE}}
10329 !! html/*
10330
10331 !! end
10332
10333 !! test
10334 Magic Word: {{SUBJECTSPACEE}}
10335 !! options
10336 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10337 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10338 !! wikitext
10339 {{SUBJECTSPACEE}}
10340 !! html/*
10341 <p>User
10342 </p>
10343 !! end
10344
10345 !! test
10346 Magic Word: {{NAMESPACE}}
10347 !! options
10348 title=[[User:Ævar Arnfjörð Bjarmason]]
10349 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10350 !! wikitext
10351 {{NAMESPACE}}
10352 !! html/*
10353 <p>User
10354 </p>
10355 !! end
10356
10357 !! test
10358 Magic Word: {{NAMESPACEE}}
10359 !! options
10360 title=[[User:Ævar Arnfjörð Bjarmason]]
10361 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10362 !! wikitext
10363 {{NAMESPACEE}}
10364 !! html/*
10365 <p>User
10366 </p>
10367 !! end
10368
10369 !! test
10370 Magic Word: {{NAMESPACENUMBER}}
10371 !! options
10372 title=[[User:Ævar Arnfjörð Bjarmason]]
10373 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10374 !! wikitext
10375 {{NAMESPACENUMBER}}
10376 !! html/*
10377 <p>2
10378 </p>
10379 !! end
10380
10381 !! test
10382 Magic Word: {{SUBPAGENAME}}
10383 !! options
10384 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
10385 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10386 !! wikitext
10387 {{SUBPAGENAME}}
10388 !! html/*
10389 <p>sub ö
10390 </p>
10391 !! end
10392
10393 !! test
10394 Magic Word: {{SUBPAGENAMEE}}
10395 !! options
10396 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
10397 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10398 !! wikitext
10399 {{SUBPAGENAMEE}}
10400 !! html/*
10401 <p>sub_%C3%B6
10402 </p>
10403 !! end
10404
10405 !! test
10406 Magic Word: {{ROOTPAGENAME}}
10407 !! options
10408 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
10409 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10410 !! wikitext
10411 {{ROOTPAGENAME}}
10412 !! html/*
10413 <p>Ævar Arnfjörð Bjarmason
10414 </p>
10415 !! end
10416
10417 !! test
10418 Magic Word: {{ROOTPAGENAMEE}}
10419 !! options
10420 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
10421 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10422 !! wikitext
10423 {{ROOTPAGENAMEE}}
10424 !! html/*
10425 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10426 </p>
10427 !! end
10428
10429 !! test
10430 Magic Word: {{BASEPAGENAME}}
10431 !! options
10432 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
10433 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10434 !! wikitext
10435 {{BASEPAGENAME}}
10436 !! html/*
10437 <p>Ævar Arnfjörð Bjarmason
10438 </p>
10439 !! end
10440
10441 !! test
10442 Magic Word: {{BASEPAGENAMEE}}
10443 !! options
10444 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
10445 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10446 !! wikitext
10447 {{BASEPAGENAMEE}}
10448 !! html/*
10449 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10450 </p>
10451 !! end
10452
10453 !! test
10454 Magic Word: {{TALKPAGENAME}}
10455 !! options
10456 title=[[User:Ævar Arnfjörð Bjarmason]]
10457 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10458 !! wikitext
10459 {{TALKPAGENAME}}
10460 !! html/*
10461 <p>User talk:Ævar Arnfjörð Bjarmason
10462 </p>
10463 !! end
10464
10465 !! test
10466 Magic Word: {{TALKPAGENAMEE}}
10467 !! options
10468 title=[[User:Ævar Arnfjörð Bjarmason]]
10469 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10470 !! wikitext
10471 {{TALKPAGENAMEE}}
10472 !! html/*
10473 <p>User_talk:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10474 </p>
10475 !! end
10476
10477 !! test
10478 Magic Word: {{SUBJECTPAGENAME}}
10479 !! options
10480 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10481 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10482 !! wikitext
10483 {{SUBJECTPAGENAME}}
10484 !! html/*
10485 <p>User:Ævar Arnfjörð Bjarmason
10486 </p>
10487 !! end
10488
10489 !! test
10490 Magic Word: {{SUBJECTPAGENAMEE}}
10491 !! options
10492 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10493 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10494 !! wikitext
10495 {{SUBJECTPAGENAMEE}}
10496 !! html/*
10497 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10498 </p>
10499 !! end
10500
10501 !! test
10502 Magic Word: {{NUMBEROFFILES}}
10503 !! options
10504 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10505 !! wikitext
10506 {{NUMBEROFFILES}}
10507 !! html/*
10508 <p>7
10509 </p>
10510 !! end
10511
10512 !! test
10513 Magic Word: {{PAGENAME}}
10514 !! options
10515 title=[[User:Ævar Arnfjörð Bjarmason]]
10516 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10517 !! wikitext
10518 {{PAGENAME}}
10519 !! html/*
10520 <p>Ævar Arnfjörð Bjarmason
10521 </p>
10522 !! end
10523
10524 !! test
10525 Magic Word: {{PAGENAME}} with metacharacters
10526 !! options
10527 title=[['foo & bar = baz']]
10528 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10529 !! wikitext
10530 ''{{PAGENAME}}''
10531 !! html/php
10532 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
10533 </p>
10534 !! html+tidy
10535 <p><i>'foo &amp; bar = baz'</i></p>
10536 !! end
10537
10538 !! test
10539 Magic Word: {{PAGENAME}} with metacharacters (T28781)
10540 !! options
10541 title=[[*RFC 1234 http://example.com/]]
10542 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10543 !! wikitext
10544 {{PAGENAME}}
10545 !! html/php
10546 <p>&#42;RFC&#32;1234 http&#58;//example.com/
10547 </p>
10548 !! html+tidy
10549 <p>*RFC 1234 http://example.com/</p>
10550 !! end
10551
10552 !! test
10553 Magic Word: {{PAGENAMEE}}
10554 !! options
10555 title=[[User:Ævar Arnfjörð Bjarmason]]
10556 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10557 !! wikitext
10558 {{PAGENAMEE}}
10559 !! html/*
10560 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10561 </p>
10562 !! end
10563
10564 !! test
10565 Magic Word: {{PAGENAMEE}} with metacharacters (T28781)
10566 !! options
10567 title=[[*RFC 1234 http://example.com/]]
10568 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10569 !! wikitext
10570 {{PAGENAMEE}}
10571 !! html/php
10572 <p>&#42;RFC_1234_http&#58;//example.com/
10573 </p>
10574 !! html+tidy
10575 <p>*RFC_1234_http://example.com/</p>
10576 !! end
10577
10578 !! test
10579 Magic Word: {{REVISIONID}}
10580 !! options
10581 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10582 showflags
10583 !! wikitext
10584 {{REVISIONID}}
10585 !! html/*
10586 <p>1337
10587 </p>
10588 flags=vary-revision-id
10589 !! end
10590
10591 !! test
10592 Magic Word: {{SCRIPTPATH}}
10593 !! options
10594 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10595 !! wikitext
10596 {{SCRIPTPATH}}
10597 !! html/*
10598
10599 !! end
10600
10601 !! test
10602 Magic Word: {{STYLEPATH}}
10603 !! options
10604 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10605 !! wikitext
10606 {{STYLEPATH}}
10607 !! html/*
10608 <p>/skins
10609 </p>
10610 !! end
10611
10612 !! test
10613 Magic Word: {{SERVER}}
10614 !! options
10615 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10616 !! wikitext
10617 {{SERVER}}
10618 !! html/*
10619 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
10620 </p>
10621 !! end
10622
10623 !! test
10624 Magic Word: {{SERVERNAME}}
10625 !! options
10626 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10627 !! wikitext
10628 {{SERVERNAME}}
10629 !! html/*
10630 <p>example.org
10631 </p>
10632 !! end
10633
10634 !! test
10635 Magic Word: {{SITENAME}}
10636 !! options
10637 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10638 !! wikitext
10639 {{SITENAME}}
10640 !! html/*
10641 <p>MediaWiki
10642 </p>
10643 !! end
10644
10645 !! test
10646 Magic Word: {{PAGELANGUAGE}}
10647 !! options
10648 language=fr
10649 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10650 !! wikitext
10651 {{PAGELANGUAGE}}
10652 !! html/*
10653 <p>fr
10654 </p>
10655 !! end
10656
10657 !! test
10658 Magic Word: {{PAGELANGUAGE}} on a page with no explicitly set language
10659 !! options
10660 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10661 !! wikitext
10662 {{PAGELANGUAGE}}
10663 !! html/*
10664 <p>en
10665 </p>
10666 !! end
10667
10668 !! test
10669 Case-sensitive magic words, when cased differently, should just be template transclusions
10670 !! wikitext
10671 {{CurrentMonth}}
10672 {{currentday}}
10673 {{cURreNTweEK}}
10674 {{currentHour}}
10675 !! html
10676 <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>
10677 <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>
10678 <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>
10679 <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>
10680 </p>
10681 !! end
10682
10683 !! test
10684 Case-insensitive magic words should still work with weird casing.
10685 !! wikitext
10686 {{sErVeRNaMe}}
10687 {{LCFirst:AOEU}}
10688 {{ucFIRST:aoeu}}
10689 {{SERver}}
10690 !! html
10691 <p>example.org
10692 aOEU
10693 Aoeu
10694 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
10695 </p>
10696 !! end
10697
10698 # From plwiki:PLOS_ONE
10699 !! test
10700 Parsoid: Page property magic word with magic word contents
10701 !! wikitext
10702 {{DISPLAYTITLE:''{{PAGENAME}}''}}
10703 !! html/parsoid
10704 <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>"}]]}'/>
10705 !! end
10706
10707 # NOTE: mw:ExpandedAttrs is not the best typeof here. mw:Transclusion is better.
10708 # But, this is a limitation of our representation and is documented in
10709 # TemplateHandler.js in processSpecialMagicWord
10710 !! test
10711 Parsoid: Template-generated DISPLAYTITLE
10712 !! wikitext
10713 {{{{echo|DISPLAYTITLE}}:Foo}}
10714 !! options
10715 showtitle
10716 !! config
10717 wgAllowDisplayTitle=true
10718 wgRestrictDisplayTitle=false
10719 !! html/php
10720 Foo
10721
10722 !! html/parsoid
10723 <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"}]]}'/>
10724 !! end
10725
10726 !! test
10727 Namespace 1 {{ns:1}}
10728 !! wikitext
10729 {{ns:1}}
10730 !! html
10731 <p>Talk
10732 </p>
10733 !! end
10734
10735 !! test
10736 Namespace 1 {{ns:01}}
10737 !! wikitext
10738 {{ns:01}}
10739 !! html
10740 <p>Talk
10741 </p>
10742 !! end
10743
10744 !! test
10745 Namespace 0 {{ns:0}} (T6783)
10746 !! wikitext
10747 {{ns:0}}
10748 !! html
10749
10750 !! end
10751
10752 !! test
10753 Namespace 0 {{ns:00}} (T6783)
10754 !! wikitext
10755 {{ns:00}}
10756 !! html
10757
10758 !! end
10759
10760 !! test
10761 Namespace -1 {{ns:-1}}
10762 !! wikitext
10763 {{ns:-1}}
10764 !! html
10765 <p>Special
10766 </p>
10767 !! end
10768
10769 !! test
10770 Namespace User {{ns:User}}
10771 !! wikitext
10772 {{ns:User}}
10773 !! html
10774 <p>User
10775 </p>
10776 !! end
10777
10778 !! test
10779 Namespace User talk {{ns:User_talk}}
10780 !! wikitext
10781 {{ns:User_talk}}
10782 !! html
10783 <p>User talk
10784 </p>
10785 !! end
10786
10787 !! test
10788 Namespace User talk {{ns:uSeR tAlK}}
10789 !! wikitext
10790 {{ns:uSeR tAlK}}
10791 !! html
10792 <p>User talk
10793 </p>
10794 !! end
10795
10796 !! test
10797 Namespace File {{ns:File}}
10798 !! wikitext
10799 {{ns:File}}
10800 !! html
10801 <p>File
10802 </p>
10803 !! end
10804
10805 !! test
10806 Namespace File {{ns:Image}}
10807 !! wikitext
10808 {{ns:Image}}
10809 !! html
10810 <p>File
10811 </p>
10812 !! end
10813
10814 !! test
10815 Namespace (lang=de) Benutzer {{ns:User}}
10816 !! options
10817 language=de
10818 !! wikitext
10819 {{ns:User}}
10820 !! html
10821 <p>Benutzer
10822 </p>
10823 !! end
10824
10825 !! test
10826 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
10827 !! options
10828 language=de
10829 !! wikitext
10830 {{ns:3}}
10831 !! html
10832 <p>Benutzer Diskussion
10833 </p>
10834 !! end
10835
10836 !! test
10837 Urlencode
10838 !! wikitext
10839 {{urlencode:hi world?!}}
10840 {{urlencode:hi world?!|WIKI}}
10841 {{urlencode:hi world?!|PATH}}
10842 {{urlencode:hi world?!|QUERY}}
10843 !! html/php
10844 <p>hi+world%3F%21
10845 hi_world%3F!
10846 hi%20world%3F%21
10847 hi+world%3F%21
10848 </p>
10849 !! end
10850
10851 !! test
10852 Magic Word: prioritize type info over data-parsoid
10853 !! options
10854 parsoid=html2wt
10855 !! html/parsoid
10856 <meta property="mw:PageProp/forcetoc" data-parsoid='{"magicSrc":"__NOTOC__"}'/>
10857 !! wikitext
10858 __FORCETOC__
10859 !! end
10860
10861 !! test
10862 Magic Word: serialize on separate line (parsoid)
10863 !! options
10864 parsoid=wt2wt,html2wt
10865 !! wikitext
10866 foo
10867 __NOTOC__
10868 bar
10869 !! html/parsoid
10870 foo<meta property="mw:PageProp/notoc"/>bar
10871 !! end
10872
10873 !! test
10874 Magic Word: rt non-english wikis
10875 !! options
10876 parsoid=wt2wt
10877 language=de
10878 !! wikitext
10879 __NOEDITSECTION__
10880 !! html/parsoid
10881 <meta property="mw:PageProp/noeditsection" data-parsoid='{"magicSrc":"__NOEDITSECTION__"}'/>
10882 !! end
10883
10884 !!test
10885 __proto__ is treated as normal wikitext (T105997)
10886 !!wikitext
10887 __proto__
10888 !!html
10889 <p>__proto__
10890 </p>
10891 !!end
10892
10893 ###
10894 ### Magic links
10895 ###
10896 !! test
10897 Magic links: internal link to RFC (T2479)
10898 !! wikitext
10899 [[RFC 123]]
10900 !! html/php
10901 <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>
10902 </p>
10903 !! html/parsoid
10904 <p><a rel="mw:WikiLink" href="./RFC_123" title="RFC 123">RFC 123</a></p>
10905 !! end
10906
10907 !! test
10908 Magic links: RFC (T2479)
10909 !! wikitext
10910 RFC 822
10911 !! html/php
10912 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
10913 </p>
10914 !! html/parsoid
10915 <p><a href="//tools.ietf.org/html/rfc822" rel="mw:ExtLink">RFC 822</a></p>
10916 !! end
10917
10918 !! test
10919 Magic links: RFC (T67278)
10920 !! wikitext
10921 This is RFC 822 but thisRFC 822 is not RFC 822linked.
10922 !! html/php
10923 <p>This is <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a> but thisRFC 822 is not RFC 822linked.
10924 </p>
10925 !! html/parsoid
10926 <p>This is <a href="//tools.ietf.org/html/rfc822" rel="mw:ExtLink">RFC 822</a> but thisRFC 822 is not RFC 822linked.</p>
10927 !! end
10928
10929 !! test
10930 Magic links: RFC (w/ non-newline whitespace, T30950/T31025)
10931 !! wikitext
10932 RFC &nbsp;&#160;&#0160;&#xA0;&#Xa0; 822
10933 RFC
10934 822
10935 !! html/php
10936 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
10937 RFC
10938 822
10939 </p>
10940 !! html/parsoid
10941 <p><a href="//tools.ietf.org/html/rfc822" rel="mw:ExtLink">RFC <span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#160;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#0160;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#xA0;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#Xa0;","srcContent":" "}'> </span> 822</a>
10942 RFC
10943 822</p>
10944 !! end
10945
10946 !! test
10947 Magic links: ISBN (T3937)
10948 !! wikitext
10949 ISBN 0-306-40615-2
10950 !! html/php
10951 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
10952 </p>
10953 !! html/parsoid
10954 <p><a href="./Special:BookSources/0306406152" rel="mw:WikiLink">ISBN 0-306-40615-2</a></p>
10955 !! end
10956
10957 !! test
10958 Magic links: ISBN (T67278)
10959 !! wikitext
10960 This is ISBN 978-0-316-09811-3 but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.
10961 !! html/php
10962 <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.
10963 </p>
10964 !! html/parsoid
10965 <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>
10966 !! end
10967
10968 !! test
10969 Magic links: ISBN (w/ non-newline whitespace, T30950/T31025)
10970 !! wikitext
10971 ISBN &nbsp;&#160;&#0160;&#xA0;&#Xa0; 978&nbsp;0&#160;316&#0160;09811&#xA0;3
10972 ISBN
10973 9780316098113
10974 ISBN 978
10975 0316098113
10976 !! html/php
10977 <p><a href="/wiki/Special:BookSources/9780316098113" class="internal mw-magiclink-isbn">ISBN 978 0 316 09811 3</a>
10978 ISBN
10979 9780316098113
10980 ISBN 978
10981 0316098113
10982 </p>
10983 !! html/parsoid
10984 <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>
10985 ISBN
10986 9780316098113
10987 ISBN 978
10988 0316098113</p>
10989 !! end
10990
10991 !! test
10992 Magic links: PMID incorrectly converts space to underscore
10993 !! wikitext
10994 PMID 1234
10995 !! html/php
10996 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
10997 </p>
10998 !! html/parsoid
10999 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract" rel="mw:ExtLink">PMID 1234</a></p>
11000 !! end
11001
11002 !! test
11003 Magic links: PMID (T67278)
11004 !! wikitext
11005 This is PMID 1234 but thisPMID 1234 is not PMID 1234linked.
11006 !! html/php
11007 <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.
11008 </p>
11009 !! html/parsoid
11010 <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>
11011 !! end
11012
11013 !! test
11014 Magic links: PMID (w/ non-newline whitespace, T30950/T31025)
11015 !! wikitext
11016 PMID &nbsp;&#160;&#0160;&#xA0;&#Xa0; 1234
11017 PMID
11018 1234
11019 !! html/php
11020 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
11021 PMID
11022 1234
11023 </p>
11024 !! html/parsoid
11025 <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>
11026 PMID
11027 1234</p>
11028 !! end
11029
11030 # <nowiki> nodes shouldn't be inserted during html2wt by Parsoid,
11031 # since these are ExtLinkText, not MagicLinkText
11032 !! test
11033 Magic links: use appropriate serialization for "almost" magic links.
11034 !! wikitext
11035 X[[Special:BookSources/0978739256|foo]]
11036
11037 X[//tools.ietf.org/html/rfc1234 foo]
11038 !! html/php
11039 <p>X<a href="/wiki/Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a>
11040 </p><p>X<a rel="nofollow" class="external text" href="//tools.ietf.org/html/rfc1234">foo</a>
11041 </p>
11042 !! html/parsoid
11043 <p>X<a rel="mw:WikiLink" href="./Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a></p>
11044 <p>X<a rel="mw:ExtLink" href="//tools.ietf.org/html/rfc1234">foo</a></p>
11045 !! end
11046
11047 !! test
11048 Magic links: All disabled (T47942)
11049 !! options
11050 wgEnableMagicLinks={"ISBN":false, "PMID":false, "RFC":false}
11051 !! wikitext
11052 ISBN 0-306-40615-2
11053 PMID 1234
11054 RFC 4321
11055 !! html/php
11056 <p>ISBN 0-306-40615-2
11057 PMID 1234
11058 RFC 4321
11059 </p>
11060 !! end
11061
11062 ###
11063 ### Templates
11064 ####
11065
11066 !! test
11067 Nonexistent template
11068 !! wikitext
11069 {{thistemplatedoesnotexist}}
11070 !! html
11071 <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>
11072 </p>
11073 !! end
11074
11075 !! test
11076 Template with invalid target containing tags
11077 !! wikitext
11078 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
11079 !! html
11080 <p>{{a<b>b</b>|foo|a=b|a = b}}
11081 </p>
11082 !! end
11083
11084 !! test
11085 Template with invalid target containing unclosed tag
11086 !! wikitext
11087 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
11088 !! html
11089 <p>{{a<b>|foo|a=b|a = b}}</b>
11090 </p>
11091 !! end
11092
11093 !! test
11094 Template with invalid target containing wikilink
11095 !! wikitext
11096 {{[[Main Page]]}}
11097 !! html/php
11098 <p>{{<a href="/wiki/Main_Page" title="Main Page">Main Page</a>}}
11099 </p>
11100 !! html/parsoid
11101 <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>
11102 !! end
11103
11104 !! test
11105 Template with just whitespace in it, T70421
11106 !! wikitext
11107 {{echo|{{ }}}}
11108 !! html/parsoid
11109 <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>
11110 !! end
11111
11112 !! article
11113 Template:test
11114 !! text
11115 This is a test template
11116 !! endarticle
11117
11118 !! test
11119 Simple template
11120 !! wikitext
11121 {{test}}
11122 !! html
11123 <p>This is a test template
11124 </p>
11125 !! end
11126
11127 !! test
11128 Template with explicit namespace
11129 !! wikitext
11130 {{Template:test}}
11131 !! html
11132 <p>This is a test template
11133 </p>
11134 !! end
11135
11136
11137 !! article
11138 Template:paramtest
11139 !! text
11140 This is a test template with parameter {{{param}}}
11141 !! endarticle
11142
11143 !! test
11144 Template parameter
11145 !! wikitext
11146 {{paramtest|param=foo}}
11147 !! html
11148 <p>This is a test template with parameter foo
11149 </p>
11150 !! end
11151
11152 !! article
11153 Template:paramtestnum
11154 !! text
11155 [[{{{1}}}|{{{2}}}]]
11156 !! endarticle
11157
11158 !! test
11159 Template unnamed parameter
11160 !! wikitext
11161 {{paramtestnum|Main Page|the main page}}
11162 !! html
11163 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
11164 </p>
11165 !! end
11166
11167 !! article
11168 Template:templatesimple
11169 !! text
11170 (test)
11171 !! endarticle
11172
11173 !! article
11174 Template:templateredirect
11175 !! text
11176 #redirect [[Template:templatesimple]]
11177 !! endarticle
11178
11179 !! article
11180 Template:templateasargtestnum
11181 !! text
11182 {{{{{1}}}}}
11183 !! endarticle
11184
11185 !! article
11186 Template:templateasargtest
11187 !! text
11188 {{template{{{templ}}}}}
11189 !! endarticle
11190
11191 !! article
11192 Template:templateasargtest2
11193 !! text
11194 {{{{{templ}}}}}
11195 !! endarticle
11196
11197 !! test
11198 Template with template name as unnamed argument
11199 !! wikitext
11200 {{templateasargtestnum|templatesimple}}
11201 !! html
11202 <p>(test)
11203 </p>
11204 !! end
11205
11206 !! test
11207 Template with template name as argument
11208 !! wikitext
11209 {{templateasargtest|templ=simple}}
11210 !! html
11211 <p>(test)
11212 </p>
11213 !! end
11214
11215 !! test
11216 Template with template name as argument (2)
11217 !! wikitext
11218 {{templateasargtest2|templ=templatesimple}}
11219 !! html
11220 <p>(test)
11221 </p>
11222 !! end
11223
11224 !! article
11225 Template:templateasargtestdefault
11226 !! text
11227 {{{{{templ|templatesimple}}}}}
11228 !! endarticle
11229
11230 !! article
11231 Template:templa
11232 !! text
11233 '''templ'''
11234 !! endarticle
11235
11236 !! test
11237 Template with default value
11238 !! wikitext
11239 {{templateasargtestdefault}}
11240 !! html
11241 <p>(test)
11242 </p>
11243 !! end
11244
11245 !! test
11246 Template with default value (value set)
11247 !! wikitext
11248 {{templateasargtestdefault|templ=templa}}
11249 !! html
11250 <p><b>templ</b>
11251 </p>
11252 !! end
11253
11254 !! test
11255 Template redirect
11256 !! wikitext
11257 {{templateredirect}}
11258 !! html/php
11259 <p>(test)
11260 </p>
11261 !! html/parsoid
11262 <link rel="mw:PageProp/redirect" href="./Template:Templatesimple" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"templateredirect","href":"./Template:Templateredirect"},"params":{},"i":0}}]}'/>
11263 !! end
11264
11265 !! test
11266 Template with argument in separate line
11267 !! wikitext
11268 {{ templateasargtest |
11269 templ = simple }}
11270 !! html
11271 <p>(test)
11272 </p>
11273 !! end
11274
11275 !! test
11276 Template with complex template as argument
11277 !! wikitext
11278 {{paramtest|
11279 param ={{ templateasargtest |
11280 templ = simple }}}}
11281 !! html
11282 <p>This is a test template with parameter (test)
11283 </p>
11284 !! end
11285
11286 !! test
11287 Templates with templated name
11288 !! wikitext
11289 {{{{echo|echo}}|foo}}
11290 {{{{echo|inner list}} }}
11291 !! html
11292 <p>foo
11293 </p>
11294 <ul><li> item 1</li></ul>
11295
11296 !! html/parsoid
11297 <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>
11298 <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>
11299 !! end
11300
11301 # Parsoid markup is deliberate "broken". This is an edge case.
11302 # See long comment in TemplateHandler.js:convertAttribsToString.
11303 !! test
11304 Templates with invalid templated targets
11305 !! wikitext
11306 {{echo
11307 {{echo|foo}}
11308 }}
11309 !! html/php
11310 <p>{{echo
11311 foo
11312 }}
11313 </p>
11314 !! html/parsoid
11315 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo\n{{echo|foo}}\n"},"params":{},"i":0}}]}'>{{echo
11316 foo }}</p>
11317 !! end
11318
11319 !! test
11320 Template with thumb image (with link in description)
11321 !! wikitext
11322 {{paramtest|param=[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
11323 !! html/php
11324 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>
11325
11326 !! html+tidy
11327 <p>This is a test template with parameter</p>
11328 <div class="thumb tright">
11329 <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>
11330 <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>
11331 </div>
11332 </div>
11333 !! html/parsoid
11334 <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>
11335 !! end
11336
11337 !! article
11338 Template:complextemplate
11339 !! text
11340 {{{1}}} {{paramtest|
11341 param ={{{param}}}}}
11342 !! endarticle
11343
11344 !! test
11345 Template with complex arguments
11346 !! wikitext
11347 {{complextemplate|
11348 param ={{ templateasargtest |
11349 templ = simple }}|[[Template:complextemplate|link]]}}
11350 !! html
11351 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
11352 </p>
11353 !! end
11354
11355 !! test
11356 T2553: link with two variables in a piped link
11357 !! wikitext
11358 {|
11359 |[[{{{1}}}|{{{2}}}]]
11360 |}
11361 !! html/php
11362 <table>
11363 <tr>
11364 <td>[[{{{1}}}|{{{2}}}]]
11365 </td></tr></table>
11366
11367 !! html/parsoid
11368 <table>
11369 <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>
11370 </tbody></table>
11371 !! end
11372
11373 # See: T2553
11374 !! test
11375 Abort table cell attribute parsing on wikilink
11376 !! wikitext
11377 {|
11378 | testing [[one|two]] | three || four
11379 | testing one two | three || four
11380 | testing="[[one|two]]" | three || four
11381 |}
11382 !! html/php
11383 <table>
11384 <tr>
11385 <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>
11386 <td> four
11387 </td>
11388 <td> three </td>
11389 <td> four
11390 </td>
11391 <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>
11392 <td> four
11393 </td></tr></table>
11394
11395 !! html/parsoid
11396 <table>
11397 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'> testing <a rel="mw:WikiLink" href="./One" title="One" data-parsoid='{"stx":"piped","a":{"href":"./One"},"sa":{"href":"one"}}'>two</a> | three </td><td data-parsoid='{"stx_v":"row","autoInsertedEnd":true}'> four</td>
11398 <td data-parsoid='{"a":{"testing":null,"one":null,"two":null},"sa":{"testing":"","one":"","two":""},"autoInsertedEnd":true}'> three </td><td data-parsoid='{"stx_v":"row","autoInsertedEnd":true}'> four</td>
11399 <td> testing="<a rel="mw:WikiLink" href="./One" title="One" data-parsoid='{"stx":"piped","a":{"href":"./One"},"sa":{"href":"one"}}'>two</a>" | three </td><td data-parsoid='{"stx_v":"row","autoInsertedEnd":true}'> four</td></tr>
11400 </tbody></table>
11401 !! end
11402
11403 !! test
11404 Don't abort table cell attribute parsing if wikilink is found in template arg
11405 !! wikitext
11406 {|
11407 | Test {{#tag:ref|One two "[[three]]" four}}
11408 |}
11409 !! html/parsoid
11410 <table>
11411 <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>
11412 </tbody></table>
11413 !! end
11414
11415 !! test
11416 Magic variable as template parameter
11417 !! wikitext
11418 {{paramtest|param={{SITENAME}}}}
11419 !! html
11420 <p>This is a test template with parameter MediaWiki
11421 </p>
11422 !! end
11423
11424 !! article
11425 Template:linktest
11426 !! text
11427 [[{{{param}}}|link]]
11428 !! endarticle
11429
11430 !! test
11431 Template parameter as link source
11432 !! wikitext
11433 {{linktest|param=Main Page}}
11434 !! html
11435 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
11436 </p>
11437 !! end
11438
11439 !!article
11440 Template:paramtest2
11441 !! text
11442 including another template, {{paramtest|param={{{arg}}}}}
11443 !! endarticle
11444
11445 !! test
11446 Template passing argument to another template
11447 !! wikitext
11448 {{paramtest2|arg='hmm'}}
11449 !! html
11450 <p>including another template, This is a test template with parameter 'hmm'
11451 </p>
11452 !! end
11453
11454 !! article
11455 Template:Linktest2
11456 !! text
11457 Main Page
11458 !! endarticle
11459
11460 !! test
11461 Template as link source
11462 !! wikitext
11463 [[{{linktest2}}]]
11464
11465 [[{{linktest2}}|Main Page]]
11466
11467 [[{{linktest2}}]]Page
11468 !! html
11469 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
11470 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
11471 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
11472 </p>
11473 !! end
11474
11475
11476 !! article
11477 Template:loop1
11478 !! text
11479 {{loop2}}
11480 !! endarticle
11481
11482 !! article
11483 Template:loop2
11484 !! text
11485 {{loop1}}
11486 !! endarticle
11487
11488 !! test
11489 Template infinite loop
11490 !! wikitext
11491 {{loop1}}
11492 !! html
11493 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
11494 </p>
11495 !! end
11496
11497 !! test
11498 Template from main namespace
11499 !! wikitext
11500 {{:Main Page}}
11501 !! html
11502 <p>blah blah
11503 </p>
11504 !! end
11505
11506 !! article
11507 Template:table
11508 !! text
11509 {|
11510 | 1 || 2
11511 |-
11512 | 3 || 4
11513 |}
11514 !! endarticle
11515
11516 !! test
11517 T2529: Template with table, not included at beginning of line
11518 !! wikitext
11519 foo {{table}}
11520 !! html
11521 <p>foo
11522 </p>
11523 <table>
11524 <tr>
11525 <td> 1 </td>
11526 <td> 2
11527 </td></tr>
11528 <tr>
11529 <td> 3 </td>
11530 <td> 4
11531 </td></tr></table>
11532
11533 !! end
11534
11535 !! test
11536 T2523: Template shouldn't eat newline (or add an extra one before table)
11537 !! wikitext
11538 foo
11539 {{table}}
11540 !! html
11541 <p>foo
11542 </p>
11543 <table>
11544 <tr>
11545 <td> 1 </td>
11546 <td> 2
11547 </td></tr>
11548 <tr>
11549 <td> 3 </td>
11550 <td> 4
11551 </td></tr></table>
11552
11553 !! end
11554
11555 !! test
11556 T2041: Template parameters shown as broken links
11557 !! wikitext
11558 {{{parameter}}}
11559 !! html
11560 <p>{{{parameter}}}
11561 </p>
11562 !! end
11563
11564 !! test
11565 Template with targets containing wikilinks
11566 !! options
11567 parsoid=wt2html
11568 !! wikitext
11569 {{[[foo]]}}
11570
11571 {{[[{{echo|foo}}]]}}
11572
11573 {{{{echo|[[foo}}]]}}
11574 !! html/php
11575 <p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
11576 </p><p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
11577 </p><p>{{[[foo}}]]
11578 </p>
11579 !! html/parsoid
11580 <p>{{<a rel="mw:WikiLink" href="./Foo" title="Foo">foo</a>}}</p>
11581 <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>
11582 <p>{{<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[foo}}]]"}},"i":0}}]}'>[[foo}}]]</span></p>
11583 !! end
11584
11585 !! article
11586 Template:''
11587 !! text
11588 bar
11589 !! endarticle
11590
11591 !! test
11592 Templates: Double quotes as template target
11593 !! wikitext
11594 foo {{''}} baz
11595 !! html/php
11596 <p>foo bar baz
11597 </p>
11598 !! html/parsoid
11599 <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
11600 </p>
11601 !! end
11602
11603 ## This test is about making sure Parsoid's data-mw is well formed in the
11604 ## face of multiple templates with intersecting and overlapping ranges. The
11605 ## wikitext itself is wretched.
11606 !! test
11607 Templates with intersecting and overlapping ranges
11608 !! wikitext
11609 {|{{echo|
11610 <p>ha</p>}}
11611 {|{{echo|
11612 <p>ho</p>}}
11613 {{echo|{{!}}hi}}
11614 |}
11615 !! html/php+tidy
11616 <p>ha</p>
11617 <p>ho</p>
11618 <table>
11619 <tr>
11620 <td></td>
11621 </tr>
11622 <tr>
11623 <td>hi</td>
11624 </tr>
11625 </table>
11626 <table>
11627 <tr>
11628 <td></td>
11629 </tr>
11630 </table>
11631 !! html/parsoid
11632 <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":""}]]}'>
11633
11634 </table><p about="#mwt1">ho</p><table about="#mwt1" typeof="mw:ExpandedAttrs" data-mw='{"attribs":[[{"txt":"","html":""},{"html":""}]]}'>
11635
11636 <tbody><tr><td>hi</td></tr>
11637 </tbody></table>
11638 !! end
11639
11640 !! article
11641 Template:MSGNW test
11642 !! text
11643 ''None'' of '''this''' should be
11644 * interpreted
11645 but rather passed unmodified
11646 {{test}}
11647 <gallery>
11648 File:Foobar.jpg
11649 </gallery>
11650 <!-- comment -->
11651 !! endarticle
11652
11653 # hmm, fix this or just deprecate msgnw and document its behavior?
11654 !! test
11655 msgnw keyword
11656 !! wikitext
11657 {{msgnw:MSGNW test}}
11658 !! html/php
11659 <p>&#39;&#39;None&#39;&#39; of &#39;&#39;&#39;this&#39;&#39;&#39; should be
11660 &#42; interpreted
11661 &#32;but rather passed unmodified
11662 &#123;&#123;test&#125;&#125;
11663 &#60;gallery&#62;
11664 File:Foobar.jpg
11665 &#60;/gallery&#62;
11666 &#60;!-- comment --&#62;
11667 </p>
11668 !! end
11669
11670 !! test
11671 int keyword
11672 !! wikitext
11673 {{int:youhavenewmessages|lots of money|not!}}
11674 !! html
11675 <p>You have lots of money (not!).
11676 </p>
11677 !! end
11678
11679 !! test
11680 int keyword - non-existing message
11681 !! wikitext
11682 {{int:var}}
11683 !! html
11684 <p>⧼var⧽
11685 </p>
11686 !! end
11687
11688 !! article
11689 Template:Includes
11690 !! text
11691 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
11692 !! endarticle
11693
11694 !! test
11695 <includeonly> and <noinclude> being included
11696 !! wikitext
11697 {{Includes}}
11698 !! html
11699 <p>Foobar
11700 </p>
11701 !! end
11702
11703 !! article
11704 Template:Includes2
11705 !! text
11706 <onlyinclude>Foo</onlyinclude>bar
11707 !! endarticle
11708
11709 !! test
11710 <onlyinclude> being included
11711 !! wikitext
11712 {{Includes2}}
11713 !! html
11714 <p>Foo
11715 </p>
11716 !! end
11717
11718
11719 !! article
11720 Template:Includes3
11721 !! text
11722 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
11723 !! endarticle
11724
11725 !! test
11726 <onlyinclude> and <includeonly> being included
11727 !! wikitext
11728 {{Includes3}}
11729 !! html
11730 <p>Foo
11731 </p>
11732 !! end
11733
11734 !! test
11735 <includeonly> and <noinclude> on a page
11736 !! wikitext
11737 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
11738 !! html
11739 <p>Foozar
11740 </p>
11741 !! end
11742
11743 !! test
11744 Un-closed <noinclude>
11745 !! wikitext
11746 <noinclude>
11747 !! html
11748 !! end
11749
11750 !! test
11751 <onlyinclude> on a page
11752 !! wikitext
11753 <onlyinclude>Foo</onlyinclude>bar
11754 !! html
11755 <p>Foobar
11756 </p>
11757 !! end
11758
11759 !! test
11760 Un-closed <onlyinclude>
11761 !! wikitext
11762 <onlyinclude>
11763 !! html
11764 !! end
11765
11766 !!test
11767 Self-closed noinclude, includeonly, onlyinclude tags
11768 !! wikitext
11769 <noinclude />
11770 <includeonly />
11771 <onlyinclude />
11772 !! html
11773 <p><br />
11774 </p>
11775 !!end
11776
11777 !!test
11778 Unbalanced includeonly and noinclude tags
11779 !! wikitext
11780 {|
11781 |a</noinclude>
11782 |b</noinclude></noinclude>
11783 |c</noinclude></includeonly>
11784 |d</includeonly></includeonly>
11785 |}
11786 !! html
11787 <table>
11788 <tr>
11789 <td>a
11790 </td>
11791 <td>b
11792 </td>
11793 <td>c&lt;/includeonly&gt;
11794 </td>
11795 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
11796 </td></tr></table>
11797
11798 !!end
11799
11800 !! article
11801 Template:Includeonly section
11802 !! text
11803 <includeonly>
11804 ==Includeonly section==
11805 </includeonly>
11806 ==Section T-1==
11807 !!endarticle
11808
11809 !! test
11810 T8563: Edit link generation for section shown by <includeonly>
11811 !! wikitext
11812 {{includeonly section}}
11813 !! html
11814 <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>
11815 <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>
11816
11817 !! end
11818
11819 # Uses same input as the contents of [[Template:Includeonly section]]
11820 !! test
11821 T8563: Section extraction for section shown by <includeonly>
11822 !! options
11823 section=T-2
11824 !! wikitext
11825 <includeonly>
11826 ==Includeonly section==
11827 </includeonly>
11828 ==Section T-2==
11829 !! html
11830 ==Section T-2==
11831 !! end
11832
11833 !! test
11834 T8563: Edit link generation for section suppressed by <includeonly>
11835 !! wikitext
11836 <includeonly>
11837 ==Includeonly section==
11838 </includeonly>
11839 ==Section 1==
11840 !! html
11841 <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>
11842
11843 !! end
11844
11845 !! test
11846 T8563: Section extraction for section suppressed by <includeonly>
11847 !! options
11848 section=1
11849 !! wikitext
11850 <includeonly>
11851 ==Includeonly section==
11852 </includeonly>
11853 ==Section 1==
11854 !! html
11855 ==Section 1==
11856 !! end
11857
11858 !! test
11859 Un-closed <includeonly>
11860 !! wikitext
11861 <includeonly>
11862 !! html/php
11863 !! html/parsoid
11864 <meta typeof="mw:Includes/IncludeOnly" data-parsoid='{"src":"&lt;includeonly>"}'/>
11865 !! end
11866
11867 ## We used to, but no longer wt2wt this test since the default serializer
11868 ## will normalize the include directives to serialize on their own line.
11869 ## Selser will take care of preserving formatting in scenarios where they
11870 ## intermingled with other wikitext.
11871 !! test
11872 Includes and comments at SOL
11873 !! options
11874 parsoid=wt2html,html2html
11875 !! wikitext
11876 <!-- comment --><noinclude><!-- comment --></noinclude><!-- comment -->== hu ==
11877
11878 <noinclude>
11879 some
11880 </noinclude>* stuff
11881 * here
11882
11883 <includeonly>can have stuff</includeonly>=== here ===
11884
11885 !! html/php
11886 <h2><span class="mw-headline" id="hu">hu</span></h2>
11887 <p>some
11888 </p>
11889 <ul><li> stuff</li>
11890 <li> here</li></ul>
11891 <h3><span class="mw-headline" id="here">here</span></h3>
11892
11893 !! html/parsoid
11894 <!-- 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>
11895
11896 <meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/>
11897 <p>some</p>
11898 <meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"&lt;/noinclude>"}'/><ul><li> stuff</li>
11899 <li> here</li></ul>
11900
11901 <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>
11902
11903 !! end
11904
11905 # TODO: test with DOM fragment reuse!
11906 !! test
11907 Parsoid: DOM fragment reuse
11908 !! options
11909 parsoid=wt2wt,wt2html
11910 !! wikitext
11911 a{{echo|b<table></table>c}}d
11912
11913 a{{echo|b
11914 <table></table>
11915 c}}d
11916
11917 {{echo|a
11918
11919 <table></table>
11920
11921 b}}
11922 !! html
11923 <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>
11924
11925 <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">
11926 </span><table about="#mwt2" data-parsoid='{"stx":"html"}'></table><span about="#mwt2">
11927 </span><p about="#mwt2">cd</p>
11928
11929 <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">
11930
11931 </span><table about="#mwt3" data-parsoid='{"stx":"html"}'></table><span about="#mwt3">
11932
11933 </span><p about="#mwt3">b</p>
11934 !! end
11935
11936 !! test
11937 Parsoid: Merge double tds (T52603)
11938 !! options
11939 parsoid
11940 !! wikitext
11941 {|
11942 |{{echo|{{!}} foo}}
11943 |}
11944 !! html
11945 <table><tbody>
11946 <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>
11947 </tbody></table>
11948 !! end
11949
11950 !! test
11951 Parsoid: Merge double tds in nested transclusion content (T52603)
11952 !! options
11953 parsoid
11954 !! wikitext
11955 {{echo|<div>}}
11956 {|
11957 |{{echo|{{!}} foo}}
11958 |}
11959 {{echo|</div>}}
11960 !! html
11961 <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}}]}'>
11962 <table><tbody>
11963 <tr><td data-mw='{"parts":["|"]}'> foo</td></tr>
11964 </tbody></table>
11965 </div>
11966 !! end
11967
11968 ###
11969 ### <includeonly> and <noinclude> in attributes
11970 ###
11971 !!test
11972 0. includeonly around the entire attribute
11973 !! wikitext
11974 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
11975 !! html
11976 <p><span id="v2">bar</span>
11977 </p>
11978 !!end
11979
11980 !!test
11981 1. includeonly in html attr key
11982 !! wikitext
11983 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
11984 !! html
11985 <p><span id="foo">bar</span>
11986 </p>
11987 !!end
11988
11989 !!test
11990 2. includeonly in html attr value
11991 !! wikitext
11992 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
11993 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
11994 !! html
11995 <p><span id="v1">bar</span>
11996 <span id="v1">bar</span>
11997 </p>
11998 !!end
11999
12000 !!test
12001 3. includeonly in part of an attr value
12002 !! wikitext
12003 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
12004 !! html
12005 <p><span style="color:red;">bar</span>
12006 </p>
12007 !!end
12008
12009 !!test
12010 4. includeonly in table attributes
12011 !! wikitext
12012 {|
12013 |- <noinclude>
12014 |-
12015 |a
12016 </noinclude>
12017 |- <includeonly>
12018 |-
12019 |b
12020 </includeonly>
12021 |}
12022 !! html
12023 <table>
12024
12025
12026 <tr>
12027 <td>a
12028 </td></tr>
12029 </table>
12030
12031 !!end
12032
12033 ###
12034 ### Preprocessor precedence tests
12035 ### See: https://www.mediawiki.org/wiki/Preprocessor_ABNF
12036 ###
12037 ##{{[[-{{{{{{[[Foo|bar}}]]}-}}}}}]]
12038 !! test
12039 Preprocessor precedence 1: link is rightmost opening
12040 !! options
12041 parsoid=wt2html
12042 !! wikitext
12043 {{[[Foo|bar}}]]
12044
12045 But close-brace is not a valid character in a link title:
12046 {{[[Foo}}|bar]]
12047
12048 However, we can still tell this was handled as a link in the preprocessor:
12049 {{echo|[[Foo}}|bar]]|bat}}
12050 !! html/php
12051 <p>{{<a href="/wiki/Foo" title="Foo">bar}}</a>
12052 </p><p>But close-brace is not a valid character in a link title:
12053 {{[[Foo}}|bar]]
12054 </p><p>However, we can still tell this was handled as a link in the preprocessor:
12055 [[Foo}}|bar]]
12056 </p>
12057 !! html/parsoid
12058 <p>{{<a rel="mw:WikiLink" href="./Foo" title="Foo">bar}}</a></p>
12059 <p>But close-brace is not a valid character in a link title: {{[[Foo}}|bar]]</p>
12060 <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>
12061 !! end
12062
12063 !! test
12064 Preprocessor precedence 2: template is rightmost opening
12065 !! options
12066 language=zh
12067 !! wikitext
12068 -{{echo|foo}-}}-
12069 !! html/php
12070 <p>-foo}--
12071 </p>
12072 !! html/parsoid
12073 <p>-<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo}-"}},"i":0}}]}'>foo}-</span>-</p>
12074 !! end
12075
12076 !! test
12077 Preprocessor precedence 3: language converter is rightmost opening
12078 !! options
12079 language=zh
12080 parsoid=wt2html
12081 !! wikitext
12082 {{echo|hi}}
12083
12084 {{-{R|echo|hi}}}-
12085
12086 [[-{R|raw]]}-
12087 !! html/php
12088 <p>hi
12089 </p><p>{{echo|hi}}
12090 </p><p>[[raw]]
12091 </p>
12092 !! html/parsoid
12093 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"hi"}},"i":0}}]}'>hi</p>
12094 <p>{{<span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"echo|hi}}"}}'></span></p>
12095 <p>[[<span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"raw]]"}}'></span></p>
12096 !! end
12097
12098 !! test
12099 Preprocessor precedence 4: left-most angle bracket
12100 !! options
12101 language=zh
12102 !! wikitext
12103 <!--{raw}-->
12104 !! html/php
12105 !! html/parsoid
12106 <!--{raw}-->
12107 !! end
12108
12109 !! article
12110 Template:Precedence5
12111 !! text
12112 {{{{{1}}}}}
12113 !! endarticle
12114
12115 !! test
12116 Preprocessor precedence 5: tplarg takes precedence over template
12117 !! wikitext
12118 {{Precedence5|Bullet}}
12119 !! html/php
12120 <ul><li> Bar</li></ul>
12121
12122 !! html/parsoid
12123 <ul typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"Precedence5","href":"./Template:Precedence5"},"params":{"1":{"wt":"Bullet"}},"i":0}}]}'><li> Bar</li></ul>
12124 !! end
12125
12126 !! test
12127 Preprocessor precedence 6: broken link is rightmost opening
12128 !! options
12129 parsoid=wt2html
12130 !! wikitext
12131 {{echo|[[Foo}}
12132
12133 {{echo|[[Foo|bar|bat=baz}}
12134 !! html/php
12135 <p>{{echo|[[Foo}}
12136 </p><p>{{echo|[[Foo|bar|bat=baz}}
12137 </p>
12138 !! html/parsoid
12139 <p>{{echo|[[Foo}}</p>
12140 <p>{{echo|[[Foo|bar|bat=baz}}</p>
12141 !! end
12142
12143 # This next test exposes a difference between PHP and Parsoid:
12144 # Given [[Foo|{{echo|Bar]]x}}y]]z:
12145 # 1) Both PHP and Parsoid ignore the `]]` inside the `echo` in the
12146 # "preprocessor" stage. The `{{echo` extends until the `x}}`, and the
12147 # outer `[[Foo` extends until the `y]]`
12148 # 2a) But then the PHP preprocessor emits `[[Foo|Bar]]xy]]z` as an
12149 # intermediate result (after template expansion), and link processing
12150 # happens on this intermediate result, which moves the wikilink
12151 # boundary leftward to `[[Foo|Bar]]`
12152 # 2b) Parsoid works in a single step, so it's going to keep the
12153 # wikilink as extending to the `y]]`
12154 # 3a) Then PHP does linktrail processing which slurps up the trailing
12155 # `xy` inside the link.
12156 # 3b) Parsoid will do linktrail processing to slurp up the trailing
12157 # `z` inside the link.
12158 # This is "correct" behavior. Parsoid's basic worldview is that the
12159 # `]]` inside the template shouldn't be allowed to leak out to affect
12160 # the surrounding wikilink. PHP may match Parsoid (in the future)
12161 # if you use {{#balance}} (T114445).
12162
12163 !! test
12164 Preprocessor precedence 7: broken template is rightmost opening
12165 !! options
12166 parsoid=wt2html
12167 !! wikitext
12168 [[Foo|{{echo|Bar]]
12169
12170 [[Foo|{{echo|Bar]]-x}}-y]]-z
12171
12172 Careful: linktrails can move the end of the wikilink:
12173 [[Foo|{{echo|y']]a}}l]]l
12174 !! html/php
12175 <p><a href="/wiki/Foo" title="Foo">{{echo|Bar</a>
12176 </p><p><a href="/wiki/Foo" title="Foo">Bar</a>-x-y]]-z
12177 </p><p>Careful: linktrails can move the end of the wikilink:
12178 <a href="/wiki/Foo" title="Foo">y'al</a>]]l
12179 </p>
12180 !! html/parsoid
12181 <p>[[Foo|{{echo|Bar]]</p>
12182 <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>
12183 <p>Careful: linktrails can move the end of the wikilink:
12184 <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>
12185 !! end
12186
12187 !! test
12188 Preprocessor precedence 8: broken language converter is rightmost opening
12189 !! options
12190 language=zh
12191 !! wikitext
12192 [[Foo-{R|raw]]
12193 !! html
12194 <p>[[Foo-{R|raw]]
12195 </p>
12196 !! end
12197
12198 !! article
12199 Template:Preprocessor_precedence_9
12200 !! text
12201 ;4: {{{{1}}}}
12202 ;5: {{{{{2}}}}}
12203 ;6: {{{{{{3}}}}}}
12204 ;7: {{{{{{{4}}}}}}}
12205 !! endarticle
12206
12207 !! test
12208 Preprocessor precedence 9: groups of braces
12209 !! wikitext
12210 {{Preprocessor precedence 9|Four|Bullet|1|2}}
12211 !! html/php
12212 <dl><dt>4</dt>
12213 <dd> {Four}</dd>
12214 <dt>5</dt>
12215 <dd> </dd></dl>
12216 <ul><li> Bar</li></ul>
12217 <dl><dt>6</dt>
12218 <dd> Four</dd>
12219 <dt>7</dt>
12220 <dd> {Bullet}</dd></dl>
12221
12222 !! html/parsoid
12223 <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}}]}'>
12224 <dt>4</dt>
12225 <dd>{Four}</dd>
12226 <dt>5</dt>
12227 <dd></dd>
12228 </dl><ul about="#mwt1">
12229 <li>Bar</li>
12230 </ul><span about="#mwt1"> </span><dl about="#mwt1">
12231 <dt>6</dt>
12232 <dd>Four</dd>
12233 <dt>7</dt>
12234 <dd>{Bullet}</dd>
12235 </dl>
12236 !! end
12237
12238 !! article
12239 Template:Preprocessor_precedence_10
12240 !! text
12241 ;1: -{R|raw}-
12242 ;2: -{{Bullet}}-
12243 ;3: -{{{1}}}-
12244 ;4: -{{{{2}}}}-
12245 ;5: -{{{{{3}}}}}-
12246 ;6: -{{{{{{4}}}}}}-
12247 ;7: -{{{{{{{5}}}}}}}-
12248 !! endarticle
12249
12250 !! test
12251 Preprocessor precedence 10: groups of braces with leading dash
12252 !! options
12253 language=zh
12254 !! wikitext
12255 {{Preprocessor precedence 10|Three|raw2|Bullet|1|2}}
12256 !! html/php
12257 <dl><dt>1</dt>
12258 <dd> raw</dd>
12259 <dt>2</dt>
12260 <dd> -</dd></dl>
12261 <ul><li> Bar-</li></ul>
12262 <dl><dt>3</dt>
12263 <dd> -Three-</dd>
12264 <dt>4</dt>
12265 <dd> raw2</dd>
12266 <dt>5</dt>
12267 <dd> -</dd></dl>
12268 <ul><li> Bar-</li></ul>
12269 <dl><dt>6</dt>
12270 <dd> -Three-</dd>
12271 <dt>7</dt>
12272 <dd> raw2</dd></dl>
12273
12274 !! html/parsoid
12275 <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}}]}'>
12276 <dt>1</dt>
12277 <dd><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"raw"}}'></span></dd>
12278 <dt>2</dt>
12279 <dd>-</dd>
12280 </dl><ul about="#mwt1">
12281 <li>Bar-</li>
12282 </ul><span about="#mwt1"> </span><dl about="#mwt1">
12283 <dt>3</dt>
12284 <dd>-Three-</dd>
12285 <dt>4</dt>
12286 <dd><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"raw2"}}'></span></dd>
12287 <dt>5</dt>
12288 <dd>-</dd>
12289 </dl><ul about="#mwt1">
12290 <li>Bar-</li>
12291 </ul><span about="#mwt1"> </span><dl about="#mwt1">
12292 <dt>6</dt>
12293 <dd>-Three-</dd>
12294 <dt>7</dt>
12295 <dd><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"raw2"}}'></span></dd>
12296 </dl>
12297 !! end
12298
12299 !! test
12300 Preprocessor precedence 11: found during visual diff testing
12301 !! wikitext
12302 {{#tag:span|-{{#tag:span|-{{echo|x}}}}}}
12303
12304 {{echo|-{{echo|-{{echo|x}}}}}}
12305
12306 {{echo|-{{echo|x}}}}
12307 !! html/php
12308 <p><span>-<span>-x</span></span>
12309 </p><p>--x
12310 </p><p>-x
12311 </p>
12312 !! html/parsoid
12313 <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>
12314
12315 <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>
12316
12317 <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>
12318 !! end
12319
12320 !! test
12321 Preprocessor precedence 12: broken language converter closed by brace.
12322 !! options
12323 parsoid=wt2html
12324 !! wikitext
12325 This form breaks the template, which is unfortunate:
12326 * {{echo|foo-{bar}bat}}
12327
12328 But if the broken language converter markup is inside an extension
12329 tag, nothing bad happens:
12330 * <nowiki>foo-{bar}bat</nowiki>
12331 * {{echo|<nowiki>foo-{bar}bat</nowiki>}}
12332 * <pre>foo-{bar}bat</pre>
12333 * {{echo|<pre>foo-{bar}bat</pre>}}
12334
12335 <tag>foo-{bar}bat</tag>
12336 {{echo|<tag>foo-{bar}bat</tag>}}
12337
12338 !! html/php+tidy
12339 <p>This form breaks the template, which is unfortunate:</p>
12340 <ul>
12341 <li>{{echo|foo-{bar}bat}}</li>
12342 </ul>
12343 <p>But if the broken language converter markup is inside an extension tag, nothing bad happens:</p>
12344 <ul>
12345 <li>foo-{bar}bat</li>
12346 <li>foo-{bar}bat</li>
12347 <li>
12348 <pre>
12349 foo-{bar}bat
12350 </pre></li>
12351 <li>
12352 <pre>
12353 foo-{bar}bat
12354 </pre></li>
12355 </ul>
12356 <pre>
12357 'foo-{bar}bat'
12358 array (
12359 )
12360 </pre>
12361 <pre>
12362 'foo-{bar}bat'
12363 array (
12364 )
12365 </pre>
12366 !! html/parsoid
12367 <p>This form breaks the template, which is unfortunate:</p>
12368 <ul>
12369 <li>{{echo|foo-{bar}bat}}</li>
12370 </ul>
12371 <p>But if the broken language converter markup is inside an extension tag, nothing bad happens:</p>
12372 <ul>
12373 <li><span typeof="mw:Nowiki">foo-{bar}bat</span></li>
12374 <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>
12375 <li><pre typeof="mw:Extension/pre" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"foo-{bar}bat"}}'>foo-{bar}bat</pre></li>
12376 <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>
12377 </ul>
12378 <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>
12379 !! end
12380
12381 !! test
12382 Preprocessor precedence 13: broken language converter in external link
12383 !! options
12384 parsoid=wt2html
12385 !! wikitext
12386 * [http://example.com/-{foo Example in URL]
12387 * [http://example.com Example in -{link} description]
12388 * {{echo|[http://example.com/-{foo Breaks template, however]}}
12389 !! html/php+tidy
12390 <ul>
12391 <li><a rel="nofollow" class="external text" href="http://example.com/-{foo">Example in URL</a></li>
12392 <li><a rel="nofollow" class="external text" href="http://example.com">Example in -{link} description</a></li>
12393 <li>{{echo|<a rel="nofollow" class="external text" href="http://example.com/-{foo">Breaks template, however</a>}}</li>
12394 </ul>
12395 !! html/parsoid
12396 <ul>
12397 <li><a rel="mw:ExtLink" href="http://example.com/-{foo">Example in URL</a></li>
12398 <li><a rel="mw:ExtLink" href="http://example.com">Example in -{link} description</a></li>
12399 <li>{{echo|<a rel="mw:ExtLink" href="http://example.com/-{foo">Breaks template, however</a>}}</li>
12400 </ul>
12401 !! end
12402
12403 !! test
12404 Preprocessor precedence 14: broken language converter in comment
12405 !! wikitext
12406 * <!--{{foo}}--> ...should be ok
12407 * <!---{{foo}}--> ...extra dashes
12408 * {{echo|foo<!-- -{bar} -->bat}} ...should be ok
12409 !! html/php+tidy
12410 <ul>
12411 <li>...should be ok</li>
12412 <li>...extra dashes</li>
12413 <li>foobat ...should be ok</li>
12414 </ul>
12415 !! html/parsoid
12416 <ul>
12417 <li><!--{{foo}}--> ...should be ok</li>
12418 <li><!--&#x2D;{{foo}}--> ...extra dashes</li>
12419 <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>
12420 </ul>
12421 !! end
12422
12423 !! test
12424 Preprocessor precedence 15: broken brace markup in headings
12425 !! options
12426 parsoid=wt2html
12427 !! wikitext
12428 __NOTOC__ __NOEDITSECTION__
12429 ===1 foo[bar 1===
12430 1
12431 ===2 foo[[bar 2===
12432 2
12433 ===3 foo{bar 3===
12434 3
12435 ===4 foo{{bar 4===
12436 4
12437 ===5 foo{{{bar 5===
12438 5
12439 ===6 foo-{bar 6===
12440 6
12441 !! html/php+tidy
12442 <h3><span class="mw-headline" id="1_foo.5Bbar_1">1 foo[bar 1</span></h3>
12443 <p>1</p>
12444 <h3><span class="mw-headline" id="2_foo.5B.5Bbar_2">2 foo[[bar 2</span></h3>
12445 <p>2</p>
12446 <h3><span class="mw-headline" id="3_foo.7Bbar_3">3 foo{bar 3</span></h3>
12447 <p>3</p>
12448 <h3><span class="mw-headline" id="4_foo.7B.7Bbar_4">4 foo{{bar 4</span></h3>
12449 <p>4</p>
12450 <h3><span class="mw-headline" id="5_foo.7B.7B.7Bbar_5">5 foo{{{bar 5</span></h3>
12451 <p>5</p>
12452 <h3><span class="mw-headline" id="6_foo-.7Bbar_6">6 foo-{bar 6</span></h3>
12453 <p>6</p>
12454 !! html/parsoid
12455 <meta property="mw:PageProp/notoc"/> <meta property="mw:PageProp/noeditsection"/
12456 >
12457 <h3>1 foo[bar 1</h3>
12458 <p>1</p>
12459 <h3>2 foo[[bar 2</h3>
12460 <p>2</p>
12461 <h3>3 foo{bar 3</h3>
12462 <p>3</p>
12463 <h3>4 foo{{bar 4</h3>
12464 <p>4</p>
12465 <h3>5 foo{{{bar 5</h3>
12466 <p>5</p>
12467 <h3>6 foo-{bar 6</h3>
12468 <p>6</p>
12469 !! end
12470
12471 !! test
12472 Preprocessor precedence 16: matching closing braces to opening braces
12473 !! options
12474 language=zh
12475 parsoid=wt2html
12476 !! wikitext
12477 -{{{echo|foo}}bar}-
12478 !! html/php
12479 <p>foobar
12480 </p>
12481 !! html/parsoid
12482 <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>
12483 !! end
12484
12485 ###
12486 ### Token Stream Patcher tests
12487 ###
12488 ### These tests won't always pass wt2wt and other modes because
12489 ### on serialization, the table will be output on a new line.
12490 ### For now, we are blacklisting them, and using this to test selser.
12491 ###
12492
12493 !!test
12494 1. Table tag in SOL posn. should get reparsed correctly with valid TSR
12495 !!options
12496 parsoid=wt2html,wt2wt
12497 !!wikitext
12498 {{echo|}}{| width = '100%'
12499 |foo
12500 |}
12501 !!html/parsoid
12502 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":""}},"i":0}}]}'></span><table width="100%">
12503 <tbody><tr><td>foo</td></tr>
12504 </tbody></table>
12505 !!end
12506
12507 ## We used to, but no longer wt2wt this test since the default serializer
12508 ## will normalize the include directives to serialize on their own line.
12509 ## Selser will take care of preserving formatting in scenarios where they
12510 ## intermingled with other wikitext.
12511 !!test
12512 2. Table tag in SOL posn. should get reparsed correctly with valid TSR
12513 !!options
12514 parsoid=wt2html
12515 !!wikitext
12516 <includeonly>a</includeonly>{| {{{b}}}
12517 |c
12518 |}
12519 !!html/parsoid
12520 <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":""}]]}'>
12521 <tbody><tr><td>c</td></tr>
12522 </tbody></table>
12523 !!end
12524
12525 !! test
12526 Table wikitext syntax outside wiki-tables
12527 !! wikitext
12528 a
12529 |+ not a caption
12530 ! not a table heading
12531 |- not a table row
12532 | not a table cell
12533 | class="foo bar" | baz
12534 b
12535 |}
12536 |-
12537 c
12538 !! html
12539 <p>a
12540 |+ not a caption
12541 ! not a table heading
12542 |- not a table row
12543 | not a table cell
12544 | class="foo bar" | baz
12545 b
12546 |}
12547 |-
12548 c
12549 </p>
12550 !! end
12551
12552 ###
12553 ### Testing parsing of templates where a template arg
12554 ### has the same name as the template itself.
12555 ###
12556
12557 !! article
12558 Template:quote
12559 !! text
12560 {{{quote|{{{1}}}}}}
12561 !! endarticle
12562
12563 !!test
12564 Templates: Template Name/Arg clash: 1. Use of positional param
12565 !! wikitext
12566 {{quote|foo}}
12567 !! html
12568 <p>foo
12569 </p>
12570 !!end
12571
12572 !!test
12573 Templates: Template Name/Arg clash: 2. Use of named param
12574 !! wikitext
12575 {{quote|quote=foo}}
12576 !! html
12577 <p>foo
12578 </p>
12579 !!end
12580
12581 !!test
12582 Templates: Template Name/Arg clash: 3. Use of named param with empty input
12583 !! wikitext
12584 {{quote|quote}}
12585 !! html
12586 <p>quote
12587 </p>
12588 !!end
12589
12590 ###
12591 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
12592 ###
12593
12594 !!test
12595 Templates: 1. Simple use
12596 !! wikitext
12597 {{echo|Foo}}
12598 !! html
12599 <p>Foo
12600 </p>
12601 !!end
12602
12603 !!test
12604 Templates: 2. Inside a block tag
12605 !! wikitext
12606 <div>{{echo|Foo}}</div>
12607 <blockquote>{{echo|Foo}}</blockquote>
12608 !! html
12609 <div>Foo</div>
12610 <blockquote>Foo</blockquote>
12611
12612 !! html+tidy
12613 <div>Foo</div>
12614 <blockquote>
12615 <p>Foo</p>
12616 </blockquote>
12617 !!end
12618
12619 !!test
12620 Templates: P-wrapping: 1a. Templates on consecutive lines
12621 !! wikitext
12622 {{echo|Foo}}
12623 {{echo|bar}}
12624 !! html
12625 <p>Foo
12626 bar
12627 </p>
12628 !!end
12629
12630 !!test
12631 Templates: P-wrapping: 1b. Templates on consecutive lines
12632 !! wikitext
12633 Foo
12634
12635 {{echo|bar}}
12636 {{echo|baz}}
12637 !! html
12638 <p>Foo
12639 </p><p>bar
12640 baz
12641 </p>
12642 !!end
12643
12644 !!test
12645 Templates: P-wrapping: 1c. Templates on consecutive lines
12646 !! wikitext
12647 {{echo|Foo}}
12648 {{echo|bar}} <div>baz</div>
12649 !! html
12650 <p>Foo
12651 </p>
12652 bar <div>baz</div>
12653
12654 !! html+tidy
12655 <p>Foo</p>
12656 <p>bar</p>
12657 <div>baz</div>
12658 !! end
12659
12660 !!test
12661 Templates: P-wrapping: 1d. Template preceded by comment-only line
12662 !!options
12663 parsoid
12664 !! wikitext
12665 <!-- foo -->
12666 {{echo|Bar}}
12667 !! html
12668 <!-- foo -->
12669
12670 <p about="#mwt223" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Bar"}},"i":0}}]}'>Bar</p>
12671 !!end
12672
12673 !!test
12674 Templates: Inline Text: 1. Multiple template uses
12675 !! wikitext
12676 {{echo|Foo}}bar{{echo|baz}}
12677 !! html
12678 <p>Foobarbaz
12679 </p>
12680 !!end
12681
12682 !!test
12683 Templates: Inline Text: 2. Back-to-back template uses
12684 !! wikitext
12685 {{echo|Foo}}{{echo|bar}}
12686 !! html
12687 <p>Foobar
12688 </p>
12689 !!end
12690
12691 !!test
12692 Templates: Block Tags: 1. Multiple template uses
12693 !! wikitext
12694 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
12695 !! html
12696 <div>Foo</div><div>bar</div><div>baz</div>
12697
12698 !!end
12699
12700 !!test
12701 Templates: Block Tags: 2. Back-to-back template uses
12702 !! wikitext
12703 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
12704 !! html
12705 <div>Foo</div><div>bar</div>
12706
12707 !!end
12708
12709 # This is an edge case relating to paragraph wrapping.
12710 !!test
12711 Templates: Correctly encapsulate templates producing </p> tag without a corresponding <p> tag
12712 !! wikitext
12713 {{echo|a
12714 b</p>}}
12715 !! html/parsoid
12716 <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
12717 b</p>
12718 !!end
12719
12720 !!test
12721 Templates: Links: 1. Simple example
12722 !! wikitext
12723 {{echo|[[Foo|bar]]}}
12724 !! html
12725 <p><a href="/wiki/Foo" title="Foo">bar</a>
12726 </p>
12727 !!end
12728
12729 !!test
12730 Templates: Links: 2. Generation of link href
12731 !! wikitext
12732 [[{{echo|Foo}}|bar]]
12733 !! html
12734 <p><a href="/wiki/Foo" title="Foo">bar</a>
12735 </p>
12736 !!end
12737
12738 !!test
12739 Templates: Links: 3. Generation of part of a link href
12740 !! wikitext
12741 [[Fo{{echo|o}}|bar]]
12742
12743 [[Foo{{echo|bar}}]]
12744
12745 [[Foo{{echo|bar}}baz]]
12746
12747 [[Foo{{echo|bar}}|bar]]
12748
12749 [[:Foo{{echo|bar}}]]
12750
12751 [[:Foo{{echo|bar}}|bar]]
12752 !! html
12753 <p><a href="/wiki/Foo" title="Foo">bar</a>
12754 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
12755 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
12756 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
12757 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
12758 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
12759 </p>
12760 !!end
12761
12762 !!test
12763 Templates: Links: 4. Multiple templates generating link href
12764 !! wikitext
12765 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
12766 !! html
12767 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
12768 </p>
12769 !!end
12770
12771 !!test
12772 Templates: Links: 5. Generation of link text
12773 !! wikitext
12774 [[Foo|{{echo|bar}}]]
12775 !! html
12776 <p><a href="/wiki/Foo" title="Foo">bar</a>
12777 </p>
12778 !!end
12779
12780 !!test
12781 Templates: Links: 5. Nested templates (only outermost template should be marked)
12782 !! wikitext
12783 {{echo|[[{{echo|Foo}}|bar]]}}
12784 !! html
12785 <p><a href="/wiki/Foo" title="Foo">bar</a>
12786 </p>
12787 !!end
12788
12789 !!test
12790 Templates: HTML Tag: 1. Generation of HTML attr. key
12791 !! wikitext
12792 <div {{echo|style}}="color:red;">foo</div>
12793 !! html
12794 <div style="color:red;">foo</div>
12795
12796 !!end
12797
12798 !!test
12799 Templates: HTML Tag: 2. Generation of HTML attr. value
12800 !! wikitext
12801 <div style={{echo|'color:red;'}}>foo</div>
12802 !! html
12803 <div style="color:red;">foo</div>
12804
12805 !!end
12806
12807 !!test
12808 Templates: HTML Tag: 3. Generation of HTML attr key and value
12809 !! wikitext
12810 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
12811 !! html
12812 <div style="color:red;">foo</div>
12813
12814 !!end
12815
12816 !!test
12817 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
12818 !! wikitext
12819 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
12820 !! html
12821 <div title="This is a long title with just one piece templated">foo</div>
12822
12823 !!end
12824
12825 !!test
12826 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
12827 !! wikitext
12828 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
12829 !! html
12830 <div title="This is a long title with just one piece templated">foo</div>
12831
12832 !!end
12833
12834 !!test
12835 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
12836 !! wikitext
12837 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
12838 !! html
12839 <div title="This is a long title with just one piece templated">foo</div>
12840
12841 !!end
12842
12843 # SSS FIXME: While it is great we added support for all this,
12844 # do we want to make this part of the spec? Maybe we want to
12845 # deprecate this kind of usage in the future?
12846 !!test
12847 Templates: HTML Tag: 7. Generation of partial attribute key string
12848 !! wikitext
12849 <div st{{echo|yle}}="color:red;">foo</div>
12850 !! html
12851 <div style="color:red;">foo</div>
12852
12853 !!end
12854
12855 !! test
12856 Templates: HTML Tag: 8. Template-generated attribute (k=v)
12857 !! wikitext
12858 <div {{echo|1=id="v1"}}>bar</div>
12859 !! html
12860 <div id="v1">bar</div>
12861
12862 !!end
12863
12864 !! test
12865 Templates: HTML Tag: 9. Multiple template-generated attributes
12866 !! wikitext
12867 <div {{echo|1=id="v1" title="foo"}}>bar</div>
12868 !! html
12869 <div id="v1" title="foo">bar</div>
12870
12871 !!end
12872
12873 !! test
12874 Templates: Support for templates generating attributes and content
12875 !! wikitext
12876 {| {{mixed_attr_content_template}}
12877 |-
12878 |bar
12879 |}
12880 !! html/php
12881 <table style="color:red;" title="T48811">
12882
12883 <tr>
12884 <td>foo
12885 </td></tr>
12886 <tr>
12887 <td>bar
12888 </td></tr></table>
12889
12890 !! html/parsoid
12891 <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|}"]}'>
12892 <tbody><tr>
12893 <td>foo</td></tr>
12894 <tr>
12895 <td>bar</td></tr>
12896 </tbody></table>
12897 !!end
12898
12899 !! test
12900 1. Entities and nowikis inside templated attributes should be handled correctly
12901 !! wikitext
12902 <div {{echo|style{{=}}"background:&#35;f9f9f9;"}}>foo</div>
12903 !! html/php
12904 <div style="background:#f9f9f9;">foo</div>
12905
12906 !! html/parsoid
12907 <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>
12908 !! end
12909
12910 !! test
12911 2. Entities and nowikis inside templated attributes should be handled correctly
12912 !! wikitext
12913 {|
12914 |{{table_attribs_3}}
12915 |}
12916 !! html/php
12917 <table>
12918 <tr>
12919 <td style="background:#f9f9f9;">Foo
12920 </td></tr></table>
12921
12922 !! html/parsoid
12923 <table>
12924 <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>
12925 </tbody></table>
12926 !! end
12927
12928 !! test
12929 3. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
12930 !! wikitext
12931 {{tbl-start}}
12932 |{{table_attribs_3}}
12933 {{tbl-end}}
12934 !! html/php
12935 <table>
12936 <tr>
12937 <td style="background:#f9f9f9;">Foo
12938 </td></tr></table>
12939
12940 !! html/parsoid
12941 <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}}]}'>
12942 <tbody><tr><td style="background:#f9f9f9;">Foo</td></tr>
12943 </tbody></table>
12944 !! end
12945
12946 # T107622
12947 !! test
12948 4. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
12949 !! wikitext
12950 {|
12951 | {{table_attribs_6}} hi
12952 |}
12953 !! html/php
12954 <table>
12955 <tr>
12956 <td style="background: red;"> hi
12957 </td></tr></table>
12958
12959 !! html/parsoid
12960 <table>
12961 <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>
12962 </tbody></table>
12963 !! end
12964
12965 !!test
12966 Templates: HTML Tables: 1. Generating start of a HTML table
12967 !! wikitext
12968 {{echo|<table><tr><td>foo</td>}}</tr></table>
12969 !! html
12970 <table><tr><td>foo</td></tr></table>
12971
12972 !!end
12973
12974 !!test
12975 Templates: HTML Tables: 2a. Generating middle of a HTML table
12976 !! wikitext
12977 <table><tr>{{echo|<td>foo</td>}}</tr></table>
12978 !! html
12979 <table><tr><td>foo</td></tr></table>
12980
12981 !!end
12982
12983 !!test
12984 Templates: HTML Tables: 2b. Generating middle of a HTML table
12985 !! wikitext
12986 <table>{{echo|<tr><td>foo</td></tr>}}</table>
12987 !! html
12988 <table><tr><td>foo</td></tr></table>
12989
12990 !!end
12991
12992 !!test
12993 Templates: HTML Tables: 3. Generating end of a HTML table
12994 !! wikitext
12995 <table><tr>{{echo|<td>foo</td></tr></table>}}
12996 !! html
12997 <table><tr><td>foo</td></tr></table>
12998
12999 !!end
13000
13001 !!test
13002 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
13003 !! wikitext
13004 {{echo|<table>}}<tr><td>foo</td></tr></table>
13005 !! html
13006 <table><tr><td>foo</td></tr></table>
13007
13008 !!end
13009
13010 !!test
13011 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
13012 !! wikitext
13013 <table>{{echo|<tr>}}<td>foo</td></tr></table>
13014 !! html
13015 <table><tr><td>foo</td></tr></table>
13016
13017 !!end
13018
13019 !!test
13020 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
13021 !! wikitext
13022 <table><tr>{{echo|<td>}}foo</td></tr></table>
13023 !! html
13024 <table><tr><td>foo</td></tr></table>
13025
13026 !!end
13027
13028 !!test
13029 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
13030 !! wikitext
13031 <table><tr><td>foo{{echo|</td>}}</tr></table>
13032 !! html
13033 <table><tr><td>foo</td></tr></table>
13034
13035 !!end
13036
13037 !!test
13038 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
13039 !! wikitext
13040 <table><tr><td>foo</td>{{echo|</tr>}}</table>
13041 !! html
13042 <table><tr><td>foo</td></tr></table>
13043
13044 !!end
13045
13046 !!test
13047 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
13048 !! wikitext
13049 <table><tr><td>foo</td></tr>{{echo|</table>}}
13050 !! html
13051 <table><tr><td>foo</td></tr></table>
13052
13053 !!end
13054
13055 !!test
13056 Templates: HTML Tables: 5. Proper fostering of categories from inside
13057 !!options
13058 parsoid=wt2html,wt2wt
13059 !! wikitext
13060 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
13061 <!--Two categories (T52330)-->
13062 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
13063 !! html
13064 <link rel="mw:PageProp/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
13065 <!--Two categories (T52330)-->
13066 <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>
13067 !!end
13068
13069 !!test
13070 Templates: Wiki Tables: 1a. Fostering of entire template content
13071 !! wikitext
13072 {|
13073 {{echo|a}}
13074 |}
13075 !! html
13076 <table>
13077 a
13078 <tr><td></td></tr></table>
13079
13080 !! html+tidy
13081 <p>a</p>
13082 <table>
13083 <tr>
13084 <td></td>
13085 </tr>
13086 </table>
13087 !! end
13088
13089 !!test
13090 Templates: Wiki Tables: 1b. Fostering of entire template content
13091 !! wikitext
13092 {|
13093 {{echo|<div>}}
13094 foo
13095 {{echo|</div>}}
13096 |}
13097 !! html
13098 <table>
13099 <div>
13100 <p>foo
13101 </p>
13102 </div>
13103 <tr><td></td></tr></table>
13104
13105 !! html+tidy
13106 <div>
13107 <p>foo</p>
13108 </div>
13109 <table>
13110 <tr>
13111 <td></td>
13112 </tr>
13113 </table>
13114 !! end
13115
13116 !!test
13117 Templates: Wiki Tables: 2. Fostering of partial template content
13118 !! wikitext
13119 {|
13120 {{echo|a
13121 <div>b</div>}}
13122 |}
13123 !! html
13124 <table>
13125 a
13126 <div>b</div>
13127 <tr><td></td></tr></table>
13128
13129 !! html+tidy
13130 <p>a</p>
13131 <div>b</div>
13132 <table>
13133 <tr>
13134 <td></td>
13135 </tr>
13136 </table>
13137 !! end
13138
13139 !!test
13140 Templates: Wiki Tables: 3. td-content via multiple templates
13141 !! wikitext
13142 {|
13143 {{echo|{{pipe}}a}}{{echo|b}}
13144 |}
13145 !! html
13146 <table>
13147 <tr>
13148 <td>ab
13149 </td></tr></table>
13150
13151 !!end
13152
13153 !!test
13154 Templates: Wiki Tables: 4. Templated tags, no content
13155 !! wikitext
13156 {{tbl-start}}
13157 {{tbl-end}}
13158 !! html
13159 <table>
13160 <tr><td></td></tr></table>
13161
13162 !!end
13163
13164 !!test
13165 Templates: Wiki Tables: 5. Templated tags, regular td-tags
13166 !! wikitext
13167 {{tbl-start}}
13168 |foo
13169 {{tbl-end}}
13170 !! html
13171 <table>
13172 <tr>
13173 <td>foo
13174 </td></tr></table>
13175
13176 !!end
13177
13178 !!test
13179 Templates: Wiki Tables: 6. Templated tags, templated td-tags
13180 !! wikitext
13181 {{tbl-start}}
13182 {{!}}foo
13183 {{tbl-end}}
13184 !! html
13185 <table>
13186 <tr>
13187 <td>foo
13188 </td></tr></table>
13189
13190 !!end
13191
13192 ## This test case is very specific to Parsoid's internals
13193 ## and is hence only tested for Parsoid's code. Parsoid uses
13194 ## a <meta> marker tag for <ref> tags and they are expanded
13195 ## much later. We are verifying that this <meta> tag usage
13196 ## doesn't prevent foster parenting.
13197 !!test
13198 Templates: Wiki Tables: 7. Fosterable <ref>s should get fostered
13199 !!wikitext
13200 {{PartialTable}}<ref>foo</ref>
13201 |}
13202
13203 <references />
13204 !!html/parsoid
13205 <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">
13206 <tbody>
13207 </tbody></table>
13208
13209 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><a href="./Main_Page#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo</span></li></ol>
13210 !!end
13211
13212 !! test
13213 Templates: Wiki Tables: 8. Fosterable meta-tags should get fostered
13214 !! wikitext
13215 {{echo|
13216 {{{!}}
13217 {{!}}-}}
13218 <onlyinclude>
13219 |foo
13220 </onlyinclude>
13221 {{!}}}
13222 !! html/parsoid
13223 <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{{!}}}"]}'>
13224 </span><meta typeof="mw:Includes/OnlyInclude" about="#mwt1"/><table about="#mwt1">
13225 <tbody><tr>
13226
13227 <td>foo
13228 <meta typeof="mw:Includes/OnlyInclude/End"/></td></tr>
13229 </tbody></table>
13230 !! end
13231
13232 !!test
13233 Templates: Lists: Multi-line list-items via templates
13234 !! wikitext
13235 *{{echo|a {{nonexistent|
13236 unused}}}}
13237 *{{echo|b {{nonexistent|
13238 unused}}}}
13239 !! html
13240 <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>
13241 <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>
13242
13243 !!end
13244
13245 !!test
13246 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
13247 !! wikitext
13248 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
13249 !! html
13250 <p><i>ab</i>c<i>d</i>e
13251 </p>
13252 !!end
13253
13254 !!test
13255 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
13256 (PHP parser generates misnested html)
13257 !! wikitext
13258 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
13259 !! html/parsoid
13260 <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>
13261 !!end
13262
13263 !!test
13264 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
13265 (PHP parser generates misnested html; Parsoid html2wt mode adds newlines between {{echo}}s)
13266 !! options
13267 parsoid=wt2html,wt2wt
13268 !! wikitext
13269 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
13270 !! html
13271 <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>
13272 <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>
13273 <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>
13274 !!end
13275
13276 !!test
13277 Templates: Ugly nesting: 4. Divs opened/closed across templates
13278 !! wikitext
13279 a<div>b{{echo|c</div>d}}e
13280 !! html
13281 a<div>bc</div>de
13282
13283 !! html+tidy
13284 <p>a</p>
13285 <div>bc</div>
13286 <p>de</p>
13287 !! end
13288
13289 !!test
13290 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
13291 (Parsoid-centric)
13292 !! options
13293 parsoid
13294 !! wikitext
13295 {|
13296 |{{echo|foo</table>}}
13297 |bar
13298 |}
13299 !! html
13300 <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|}"]}'>
13301
13302 <tbody>
13303 <tr>
13304 <td>foo</td></tr></tbody></table><span about="#mwt1">
13305 </span><span about="#mwt1">|bar</span><span about="#mwt1">
13306 |}</span>
13307 !!end
13308
13309 !!test
13310 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
13311 (Parsoid-centric)
13312 !! options
13313 parsoid
13314 !! wikitext
13315 <table>
13316 <tr>
13317 <td>
13318 <table>
13319 <tr>
13320 <td>1. {{echo|foo </table>}}</td>
13321 <td> bar </td>
13322 <td>2. {{echo|baz </table>}}</td>
13323 </tr>
13324 <tr>
13325 <td>abc</td>
13326 </tr>
13327 </table>
13328 </td>
13329 </tr>
13330 <tr>
13331 <td>xyz</td>
13332 </tr>
13333 </table>
13334 !! html
13335 <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>"]}'>
13336 <tbody><tr>
13337 <td>
13338 <table>
13339 <tbody><tr>
13340 <td>1. foo </td></tr></tbody></table></td>
13341 <td> bar </td>
13342 <td>2. baz </td></tr></tbody></table><span about="#mwt2">
13343 </span><span about="#mwt2">
13344 </span><span about="#mwt2">
13345 </span><span about="#mwt2">abc</span><span about="#mwt2">
13346 </span><span about="#mwt2">
13347 </span><span about="#mwt2">
13348 </span><span about="#mwt2">
13349 </span><span about="#mwt2">
13350 </span><span about="#mwt2">
13351 </span><span about="#mwt2">xyz</span><span about="#mwt2">
13352 </span><span about="#mwt2">
13353 </span>
13354 !!end
13355
13356 !! test
13357 Templates: Ugly templates: 3. newline-only template parameter
13358 !! wikitext
13359 foo {{echo|
13360 }}
13361 !! html
13362 <p>foo
13363 </p>
13364 !! end
13365
13366 # This looks like a bug: a single newline triggers p/br for some reason.
13367 !! test
13368 Templates: Ugly templates: 4. newline-only template parameter inconsistency
13369 !! wikitext
13370 {{echo|
13371 }}
13372 !! html
13373 <p><br />
13374 </p>
13375 !! end
13376
13377 # T66017 -- ugly wikitext with fostered content generates two template ranges that
13378 # have a true overlap (T1-start - T2-start - T1-end - T2-end).
13379 !! test
13380 Templates: Ugly templates: 5. Template encapsulation test: Non-trivial overlap of template ranges is properly handled
13381 !! wikitext
13382 {{echo|<table>}}
13383 {{echo|<div>foo}}
13384 {{echo|</table>}}
13385 !! html/parsoid
13386 <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
13387 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
13388 </table>
13389 !! end
13390
13391 # T66017 -- ugly wikitext with fostered content generates two template ranges
13392 # that are "identical" and generate nesting cycles in the algorithm
13393 !! test
13394 Templates: Ugly templates: 6. Template encapsulation test: Cyclical nesting of template ranges is properly handled
13395 !! wikitext
13396 {{echo|<table><tr><td><table>}}
13397 {{echo|<div>}}
13398 {{echo|</div>}}
13399 !! html/parsoid
13400 <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"}'>
13401 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
13402 </table></td></tr></tbody></table>
13403 !! end
13404
13405 !! test
13406 Templates: Parameters substituted at the top-level
13407 !! wikitext
13408 {{{foo|''who'' {{echo|me}}? '''never!'''}}}
13409
13410 {{{foo|bar|baz}}}
13411 !! html/php
13412 <p><i>who</i> me? <b>never!</b>
13413 </p><p>bar
13414 </p>
13415 !! html/parsoid
13416 <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>
13417
13418 <p about="#mwt3" typeof="mw:Param" data-mw='{"parts":[{"templatearg":{"target":{"wt":"foo"},"params":{"1":{"wt":"bar"},"2":{"wt":"baz"}},"i":0}}]}'>bar</p>
13419 !! end
13420
13421 !! test
13422 Templates: Param with empty arg in the final position
13423 !! wikitext
13424 {{{hi|}}}
13425 !! html/parsoid
13426 <span about="#mwt1" typeof="mw:Param" data-mw='{"parts":[{"templatearg":{"target":{"wt":"hi"},"params":{"1":{"wt":""}},"i":0}}]}'></span>
13427 !! end
13428
13429 !!test
13430 Parser Functions: 1. Simple example
13431 !! wikitext
13432 {{uc:foo}}
13433 !! html
13434 <p>FOO
13435 </p>
13436 !!end
13437
13438 !!test
13439 Parser Functions: 2. Nested use (only outermost should be marked up)
13440 !! wikitext
13441 {{uc:{{lc:FOO}}}}
13442 !! html
13443 <p>FOO
13444 </p>
13445 !!end
13446
13447 ###
13448 ### Pre-save transform tests
13449 ###
13450 !! test
13451 pre-save transform: subst:
13452 !! options
13453 pst
13454 !! wikitext
13455 {{subst:test}}
13456 !! html/php
13457 This is a test template
13458 !! end
13459
13460 !! test
13461 pre-save transform: normal template
13462 !! options
13463 pst
13464 !! wikitext
13465 {{test}}
13466 !! html/php
13467 {{test}}
13468 !! end
13469
13470 !! test
13471 pre-save transform: nonexistent template
13472 !! options
13473 pst
13474 !! wikitext
13475 {{thistemplatedoesnotexist}}
13476 !! html/php
13477 {{thistemplatedoesnotexist}}
13478 !! end
13479
13480 !! test
13481 pre-save transform: subst magic variables
13482 !! options
13483 pst
13484 !! wikitext
13485 {{subst:SITENAME}}
13486 !! html/php
13487 MediaWiki
13488 !! end
13489
13490 # This is T2089, which I fixed. -- wtm
13491 !! test
13492 pre-save transform: subst: templates with parameters
13493 !! options
13494 pst
13495 !! wikitext
13496 {{subst:paramtest|param="something else"}}
13497 !! html/php
13498 This is a test template with parameter "something else"
13499 !! end
13500
13501 !! article
13502 Template:nowikitest
13503 !! text
13504 <nowiki>'''not wiki'''</nowiki>
13505 !! endarticle
13506
13507 !! test
13508 pre-save transform: nowiki in subst (T3188)
13509 !! options
13510 pst
13511 !! wikitext
13512 {{subst:nowikitest}}
13513 !! html/php
13514 <nowiki>'''not wiki'''</nowiki>
13515 !! end
13516
13517 !! article
13518 Template:commenttest
13519 !! text
13520 This template has <!-- a comment --> in it.
13521 !! endarticle
13522
13523 !! test
13524 pre-save transform: comment in subst (T3936)
13525 !! options
13526 pst
13527 !! wikitext
13528 {{subst:commenttest}}
13529 !! html/php
13530 This template has <!-- a comment --> in it.
13531 !! end
13532
13533 !! test
13534 pre-save transform: unclosed tag
13535 !! options
13536 pst
13537 !! wikitext
13538 <nowiki>'''not wiki'''
13539 !! html/php
13540 <nowiki>'''not wiki'''
13541 !! end
13542
13543 !! test
13544 pre-save transform: mixed tag case
13545 !! options
13546 pst
13547 !! wikitext
13548 <NOwiki>'''not wiki'''</noWIKI>
13549 !! html/php
13550 <NOwiki>'''not wiki'''</noWIKI>
13551 !! end
13552
13553 !! test
13554 pre-save transform: unclosed comment in <nowiki>
13555 !! options
13556 pst
13557 !! wikitext
13558 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
13559 !! html/php
13560 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
13561 !!end
13562
13563 # Leading @ in this template definition works around a limitation
13564 # in parsoid's parserTests which otherwise strips the <span> from the
13565 # result (confusing it for a template wrapper)
13566 !! article
13567 Template:dangerous
13568 !!text
13569 @<span onmouseover="alert('crap')">Oh no</span>
13570 !!endarticle
13571
13572 !!test
13573 (confirming safety of fix for subst T3936)
13574 !! wikitext
13575 {{Template:dangerous}}
13576 !! html
13577 <p>@<span>Oh no</span>
13578 </p>
13579 !! end
13580
13581 !! test
13582 pre-save transform: comment containing gallery (T7024)
13583 !! options
13584 pst
13585 !! wikitext
13586 <!-- <gallery>data</gallery> -->
13587 !! html/php
13588 <!-- <gallery>data</gallery> -->
13589 !!end
13590
13591 !! test
13592 pre-save transform: comment containing extension
13593 !! options
13594 pst
13595 !! wikitext
13596 <!-- <tag>data</tag> -->
13597 !! html/php
13598 <!-- <tag>data</tag> -->
13599 !!end
13600
13601 !! test
13602 pre-save transform: comment containing nowiki
13603 !! options
13604 pst
13605 !! wikitext
13606 <!-- <nowiki>data</nowiki> -->
13607 !! html/php
13608 <!-- <nowiki>data</nowiki> -->
13609 !!end
13610
13611 !! test
13612 pre-save transform: <noinclude> in subst (T5298)
13613 !! options
13614 pst
13615 !! wikitext
13616 {{subst:Includes}}
13617 !! html/php
13618 Foobar
13619 !! end
13620
13621 !! test
13622 pre-save transform: <onlyinclude> in subst (T5298)
13623 !! options
13624 pst
13625 !! wikitext
13626 {{subst:Includes2}}
13627 !! html/php
13628 Foo
13629 !! end
13630
13631 !! article
13632 Template:SubstTest
13633 !!text
13634 {{<includeonly>subst:</includeonly>Includes}}
13635 !! endarticle
13636
13637 !! article
13638 Template:SafeSubstTest
13639 !! text
13640 {{<includeonly>safesubst:</includeonly>Includes}}
13641 !! endarticle
13642
13643 !! test
13644 T24297: safesubst: works during PST
13645 !! options
13646 pst
13647 !! wikitext
13648 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
13649 !! html/php
13650 FoobarFoobar
13651 !! end
13652
13653 !! test
13654 T24297: safesubst: works during normal parse
13655 !! wikitext
13656 {{SafeSubstTest}}
13657 !! html
13658 <p>Foobar
13659 </p>
13660 !! end
13661
13662 !! test
13663 subst: does not work during normal parse
13664 !! wikitext
13665 {{SubstTest}}
13666 !! html
13667 <p>{{subst:Includes}}
13668 </p>
13669 !! end
13670
13671 !! test
13672 pre-save transform: context links ("pipe trick")
13673 !! options
13674 pst
13675 !! wikitext
13676 [[Article (context)|]]
13677 [[Bar:Article|]]
13678 [[:Bar:Article|]]
13679 [[Bar:Article (context)|]]
13680 [[:Bar:Article (context)|]]
13681 [[|Article]]
13682 [[|Article (context)]]
13683 [[Bar:X (Y) Z|]]
13684 [[:Bar:X (Y) Z|]]
13685 !! html/php
13686 [[Article (context)|Article]]
13687 [[Bar:Article|Article]]
13688 [[:Bar:Article|Article]]
13689 [[Bar:Article (context)|Article]]
13690 [[:Bar:Article (context)|Article]]
13691 [[Article]]
13692 [[Article (context)]]
13693 [[Bar:X (Y) Z|X (Y) Z]]
13694 [[:Bar:X (Y) Z|X (Y) Z]]
13695 !! end
13696
13697 !! test
13698 pre-save transform: context links ("pipe trick") with interwiki prefix
13699 !! options
13700 pst
13701 !! wikitext
13702 [[interwiki:Article|]]
13703 [[:interwiki:Article|]]
13704 [[interwiki:Bar:Article|]]
13705 [[:interwiki:Bar:Article|]]
13706 !! html/php
13707 [[interwiki:Article|Article]]
13708 [[:interwiki:Article|Article]]
13709 [[interwiki:Bar:Article|Bar:Article]]
13710 [[:interwiki:Bar:Article|Bar:Article]]
13711 !! end
13712
13713 !! test
13714 pre-save transform: context links ("pipe trick") with parens in title
13715 !! options
13716 pst title=[[Somearticle (context)]]
13717 !! wikitext
13718 [[|Article]]
13719 !! html/php
13720 [[Article (context)|Article]]
13721 !! end
13722
13723 !! test
13724 pre-save transform: context links ("pipe trick") with comma in title
13725 !! options
13726 pst title=[[Someplace, Somewhere]]
13727 !! wikitext
13728 [[|Otherplace]]
13729 [[Otherplace, Elsewhere|]]
13730 [[Otherplace, Elsewhere, Anywhere|]]
13731 !! html/php
13732 [[Otherplace, Somewhere|Otherplace]]
13733 [[Otherplace, Elsewhere|Otherplace]]
13734 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
13735 !! end
13736
13737 !! test
13738 pre-save transform: context links ("pipe trick") with parens and comma
13739 !! options
13740 pst title=[[Someplace (IGNORED), Somewhere]]
13741 !! wikitext
13742 [[|Otherplace]]
13743 [[Otherplace (place), Elsewhere|]]
13744 !! html/php
13745 [[Otherplace, Somewhere|Otherplace]]
13746 [[Otherplace (place), Elsewhere|Otherplace]]
13747 !! end
13748
13749 !! test
13750 pre-save transform: context links ("pipe trick") with comma and parens
13751 !! options
13752 pst title=[[Who, me? (context)]]
13753 !! wikitext
13754 [[|Yes, you.]]
13755 [[Me, Myself, and I (1937 song)|]]
13756 !! html/php
13757 [[Yes, you. (context)|Yes, you.]]
13758 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
13759 !! end
13760
13761 !! test
13762 pre-save transform: context links ("pipe trick") with namespace
13763 !! options
13764 pst title=[[Ns:Somearticle]]
13765 !! wikitext
13766 [[|Article]]
13767 !! html/php
13768 [[Ns:Article|Article]]
13769 !! end
13770
13771 !! test
13772 pre-save transform: context links ("pipe trick") with namespace and parens
13773 !! options
13774 pst title=[[Ns:Somearticle (context)]]
13775 !! wikitext
13776 [[|Article]]
13777 !! html/php
13778 [[Ns:Article (context)|Article]]
13779 !! end
13780
13781 !! test
13782 pre-save transform: context links ("pipe trick") with namespace and comma
13783 !! options
13784 pst title=[[Ns:Somearticle, Context, Whatever]]
13785 !! wikitext
13786 [[|Article]]
13787 !! html/php
13788 [[Ns:Article, Context, Whatever|Article]]
13789 !! end
13790
13791 !! test
13792 pre-save transform: context links ("pipe trick") with namespace, comma and parens
13793 !! options
13794 pst title=[[Ns:Somearticle, Context (context)]]
13795 !! wikitext
13796 [[|Article]]
13797 !! html/php
13798 [[Ns:Article (context)|Article]]
13799 !! end
13800
13801 !! test
13802 pre-save transform: context links ("pipe trick") with namespace, parens and comma
13803 !! options
13804 pst title=[[Ns:Somearticle (IGNORED), Context]]
13805 !! wikitext
13806 [[|Article]]
13807 !! html/php
13808 [[Ns:Article, Context|Article]]
13809 !! end
13810
13811 !! test
13812 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, T32149)
13813 !! options
13814 pst
13815 !! wikitext
13816 [[Article(context)|]]
13817 [[Bar:Article(context)|]]
13818 [[:Bar:Article(context)|]]
13819 [[|Article(context)]]
13820 [[Bar:X(Y)Z|]]
13821 [[:Bar:X(Y)Z|]]
13822 !! html/php
13823 [[Article(context)|Article]]
13824 [[Bar:Article(context)|Article]]
13825 [[:Bar:Article(context)|Article]]
13826 [[Article(context)]]
13827 [[Bar:X(Y)Z|X(Y)Z]]
13828 [[:Bar:X(Y)Z|X(Y)Z]]
13829 !! end
13830
13831 !! test
13832 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, T32149)
13833 !! options
13834 pst
13835 !! wikitext
13836 [[Article (context)|]]
13837 [[Bar:Article (context)|]]
13838 [[:Bar:Article (context)|]]
13839 [[|Article (context)]]
13840 [[Bar:X (Y) Z|]]
13841 [[:Bar:X (Y) Z|]]
13842 !! html/php
13843 [[Article (context)|Article]]
13844 [[Bar:Article (context)|Article]]
13845 [[:Bar:Article (context)|Article]]
13846 [[Article (context)]]
13847 [[Bar:X (Y) Z|X (Y) Z]]
13848 [[:Bar:X (Y) Z|X (Y) Z]]
13849 !! end
13850
13851 !! test
13852 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, T32149)
13853 !! options
13854 pst
13855 !! wikitext
13856 [[Article(context)|]]
13857 [[Bar:Article(context)|]]
13858 [[:Bar:Article(context)|]]
13859 [[|Article(context)]]
13860 [[Bar:X(Y)Z|]]
13861 [[:Bar:X(Y)Z|]]
13862 !! html/php
13863 [[Article(context)|Article]]
13864 [[Bar:Article(context)|Article]]
13865 [[:Bar:Article(context)|Article]]
13866 [[Article(context)]]
13867 [[Bar:X(Y)Z|X(Y)Z]]
13868 [[:Bar:X(Y)Z|X(Y)Z]]
13869 !! end
13870
13871 !! test
13872 pre-save transform: context links ("pipe trick") with commas (T23660)
13873 !! options
13874 pst
13875 !! wikitext
13876 [[Article (context), context|]]
13877 [[Article (context),context|]]
13878 [[Bar:Article (context), context|]]
13879 [[Bar:Article (context),context|]]
13880 [[:Bar:Article (context), context|]]
13881 [[:Bar:Article (context),context|]]
13882 !! html/php
13883 [[Article (context), context|Article]]
13884 [[Article (context),context|Article]]
13885 [[Bar:Article (context), context|Article]]
13886 [[Bar:Article (context),context|Article]]
13887 [[:Bar:Article (context), context|Article]]
13888 [[:Bar:Article (context),context|Article]]
13889 !! end
13890
13891 !! test
13892 Parsoid: backwards pipe trick
13893 !! wikitext
13894 [[|'''bar''']]
13895 !! html/php
13896 <p>[[|<b>bar</b>]]
13897 </p>
13898 !! html/parsoid
13899 <p>[[|<b>bar</b>]]</p>
13900 !! end
13901
13902 !! test
13903 pre-save transform: trim trailing empty lines
13904 !! options
13905 pst
13906 !! wikitext
13907 Empty lines are trimmed
13908
13909
13910
13911
13912 !! html/php
13913 Empty lines are trimmed
13914 !! end
13915
13916 !! test
13917 pre-save transform: Signature expansion
13918 !! options
13919 pst
13920 !! wikitext
13921 * ~~~
13922 * ~~~~
13923 * ~~~~~
13924 * <noinclude>~~~</noinclude>
13925 * <includeonly>~~~</includeonly>
13926 * <onlyinclude>~~~</onlyinclude>
13927 !! html/php
13928 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
13929 * [[Special:Contributions/127.0.0.1|127.0.0.1]] 00:02, 1 January 1970 (UTC)
13930 * 00:02, 1 January 1970 (UTC)
13931 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
13932 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
13933 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
13934 !! end
13935
13936
13937 !! test
13938 ParserOutput flags from signature expansion (T84843)
13939 !! options
13940 pst
13941 showflags
13942 !! wikitext
13943 ~~~~
13944 !! html/php
13945 [[Special:Contributions/127.0.0.1|127.0.0.1]] 00:02, 1 January 1970 (UTC)
13946 flags=user-signature
13947 !! end
13948
13949
13950 !! test
13951 pre-save transform: Signature expansion in nowiki tags (T2093)
13952 !! options
13953 pst disabled
13954 !! wikitext
13955 Shall not expand:
13956
13957 <nowiki>~~~~</nowiki>
13958
13959 <includeonly><nowiki>~~~~</nowiki></includeonly>
13960
13961 <noinclude><nowiki>~~~~</nowiki></noinclude>
13962
13963 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
13964
13965 {{subst:Foo}} shall be converted to FOO
13966
13967 As well as inside noinclude/onlyinclude
13968 <noinclude>{{subst:Foo}}</noinclude>
13969 <onlyinclude>{{subst:Foo}}</onlyinclude>
13970
13971 But not inside includeonly
13972 <includeonly>{{subst:Foo}}</includeonly>
13973 !! html/php
13974 Shall not expand:
13975
13976 <nowiki>~~~~</nowiki>
13977
13978 <includeonly><nowiki>~~~~</nowiki></includeonly>
13979
13980 <noinclude><nowiki>~~~~</nowiki></noinclude>
13981
13982 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
13983
13984 FOO shall be converted to FOO
13985
13986 As well as inside noinclude/onlyinclude
13987 <noinclude>FOO</noinclude>
13988 <onlyinclude>FOO</onlyinclude>
13989
13990 But not inside includeonly
13991 <includeonly>{{subst:Foo}}</includeonly>
13992 !! end
13993
13994 !! test
13995 Parsoid: Recognize nowiki with trailing space in tags
13996 !! options
13997 parsoid=wt2html
13998 !! wikitext
13999 <nowiki ><div>[[foo]]</nowiki >
14000
14001 a<nowiki / >b
14002
14003 c<nowiki />d
14004
14005 e<nowiki/ >f
14006 !! html
14007 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
14008 <p>ab</p>
14009 <p>cd</p>
14010 <p>ef</p>
14011 !! end
14012
14013 !! test
14014 Parsoid: Recognize nowiki with odd capitalization
14015 !! options
14016 parsoid=wt2html
14017 !! wikitext
14018 <noWikI ><div>[[foo]]</Nowiki >
14019 !! html
14020 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
14021 !! end
14022
14023
14024 !! test
14025 Parsoid: Escape nowiki with trailing space in tags
14026 !! options
14027 parsoid=html2wt
14028 !! html/parsoid
14029 <p>&lt;nowiki &gt; foo &lt/nowiki ></p>
14030 <p>a&lt;nowiki /&gt;b</p>
14031 <p>c&lt;nowiki/ &gt;d</p>
14032 !! wikitext
14033 &lt;nowiki &gt; foo &lt;/nowiki &gt;
14034
14035 a&lt;nowiki /&gt;b
14036
14037 c&lt;nowiki/ &gt;d
14038 !! end
14039
14040 !! test
14041 Parsoid: Escape weird noWikI capitalizations
14042 !! options
14043 parsoid=html2wt
14044 !! html/parsoid
14045 <p>&lt;noWikI &gt; foo &lt/NoWikI ></p>
14046 !! wikitext
14047 &lt;noWikI &gt; foo &lt;/NoWikI &gt;
14048 !! end
14049
14050 ###
14051 ### Message transform tests
14052 ###
14053 !! test
14054 message transform: magic variables
14055 !! options
14056 msg
14057 !! wikitext
14058 {{SITENAME}}
14059 !! html
14060 MediaWiki
14061 !! end
14062
14063 !! test
14064 message transform: should not transform wiki markup
14065 !! options
14066 msg
14067 !! wikitext
14068 ''test''
14069 !! html
14070 ''test''
14071 !! end
14072
14073 !! test
14074 message transform: <noinclude> in transcluded template (T6926)
14075 !! options
14076 msg
14077 !! wikitext
14078 {{Includes}}
14079 !! html
14080 Foobar
14081 !! end
14082
14083 !! test
14084 message transform: <onlyinclude> in transcluded template (T6926)
14085 !! options
14086 msg
14087 !! wikitext
14088 {{Includes2}}
14089 !! html
14090 Foo
14091 !! end
14092
14093 !! test
14094 {{#special:}} page name, known
14095 !! options
14096 msg
14097 !! wikitext
14098 {{#special:Recentchanges}}
14099 !! html
14100 Special:RecentChanges
14101 !! end
14102
14103 !! test
14104 {{#special:}} page name with subpage, known
14105 !! options
14106 msg
14107 !! wikitext
14108 {{#special:Recentchanges/param}}
14109 !! html
14110 Special:RecentChanges/param
14111 !! end
14112
14113 !! test
14114 {{#special:}} page name, unknown
14115 !! options
14116 msg
14117 !! wikitext
14118 {{#special:foobar nonexistent}}
14119 !! html
14120 Special:Foobar nonexistent
14121 !! end
14122
14123 !! test
14124 {{#speciale:}} page name, known
14125 !! options
14126 msg
14127 !! wikitext
14128 {{#speciale:Recentchanges}}
14129 !! html
14130 Special:RecentChanges
14131 !! end
14132
14133 !! test
14134 {{#speciale:}} page name with subpage, known
14135 !! options
14136 msg
14137 !! wikitext
14138 {{#speciale:Recentchanges/param}}
14139 !! html
14140 Special:RecentChanges/param
14141 !! end
14142
14143 !! test
14144 {{#speciale:}} page name, unknown
14145 !! options
14146 msg
14147 !! wikitext
14148 {{#speciale:foobar nonexistent}}
14149 !! html
14150 Special:Foobar_nonexistent
14151 !! end
14152
14153 ###
14154 ### Images
14155 ###
14156 ### For Parsoid-specific tests, see
14157 #### https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
14158
14159 !! test
14160 Simple image
14161 !! options
14162 parsoid=wt2html,wt2wt,html2html
14163 !! wikitext
14164 [[Image:foobar.jpg]]
14165 !! html/php
14166 <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>
14167 </p>
14168 !! html/parsoid
14169 <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>
14170 !! end
14171
14172 !! test
14173 Serialize simple image with figure-inline wrapper
14174 !! options
14175 parsoid=html2wt
14176 !! html/parsoid
14177 <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>
14178 !! wikitext
14179 [[File:Foobar.jpg]]
14180 !! end
14181
14182 !! test
14183 Simple image (using File: namespace, now canonical)
14184 !! wikitext
14185 [[File:Foobar.jpg]]
14186 !! html/php
14187 <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>
14188 </p>
14189 !! html/parsoid
14190 <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>
14191 !! end
14192
14193 !! test
14194 Right-aligned image
14195 !! wikitext
14196 [[File:Foobar.jpg|right]]
14197 !! html/php
14198 <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>
14199
14200 !! html/parsoid
14201 <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>
14202 !! end
14203
14204 !! test
14205 Image with caption
14206 !! wikitext
14207 [[File:Foobar.jpg|right|Caption text]]
14208 !! html/php
14209 <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>
14210
14211 !! html/parsoid
14212 <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>
14213 !! end
14214
14215 !! test
14216 Image with caption, T55312 #1
14217 !! wikitext
14218 [[File:Foobar.jpg|right|Caption page stuff]]
14219 !! html/php
14220 <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>
14221
14222 !! html/parsoid
14223 <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>
14224 !! end
14225
14226 !! test
14227 Image with caption, T55312 #2
14228 !! wikitext
14229 [[File:Foobar.jpg|right|Caption page=]]
14230 !! html/php
14231 <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>
14232
14233 !! html/parsoid
14234 <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>
14235 !! end
14236
14237 !! test
14238 Image with caption, T55312 #3
14239 !! wikitext
14240 [[File:Foobar.jpg|right|Caption page=stuff]]
14241 !! html/php
14242 <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>
14243
14244 !! html/parsoid
14245 <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>
14246 !! end
14247
14248 !! test
14249 Allow empty links in image captions (T62753)
14250 !! options
14251 thumbsize=220
14252 !! wikitext
14253 [[File:Foobar.jpg|thumb|Caption [[Link1]]
14254 [[]]
14255 [[Link2]]
14256 ]]
14257 !! html/php
14258 <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>
14259
14260 !! html/parsoid
14261 <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>
14262 [[]]
14263 <a rel="mw:WikiLink" href="./Link2" title="Link2" data-parsoid='{"stx":"simple","a":{"href":"./Link2"},"sa":{"href":"Link2"}}'>Link2</a>
14264 </figcaption></figure>
14265 !! end
14266
14267 !! test
14268 Titles in unlinked images (T23454)
14269 !! wikitext
14270 [[File:Foobar.jpg|link=|stuff]]
14271 !! html/php
14272 <p><img alt="stuff" src="http://example.com/images/3/3a/Foobar.jpg" title="stuff" width="1941" height="220" />
14273 </p>
14274 !! end
14275
14276 !! test
14277 Link with empty target
14278 !! wikitext
14279 [[]]
14280 !! html
14281 <p>[[]]
14282 </p>
14283 !! end
14284
14285 !! test
14286 Image with link trail
14287 !! wikitext
14288 Linktrails should not work for images: [[File:Foobar.jpg]]s
14289 !! html/php
14290 <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
14291 </p>
14292 !! html/parsoid
14293 <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>
14294 !! end
14295
14296 !! test
14297 Image with empty attribute
14298 !! options
14299 parsoid=wt2html,wt2wt,html2html
14300 !! wikitext
14301 [[File:Foobar.jpg|right||Caption text]]
14302 !! html/php
14303 <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>
14304
14305 !! html/parsoid
14306 <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>
14307 !! end
14308
14309 !! test
14310 1. Block image with individual attributes from templates
14311 !! wikitext
14312 [[File:Foobar.jpg|thumb|{{echo|137px}}|This is a caption]]
14313 !! html/php
14314 <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>
14315
14316 !! html/parsoid
14317 <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>
14318 !! end
14319
14320 !! test
14321 2. Block Image with individual attributes from templates
14322 !! wikitext
14323 [[File:Foobar.jpg|{{echo|thumb}}|{{echo|137px}}|This is a caption]]
14324 !! html/php
14325 <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>
14326
14327 !! html/parsoid
14328 <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>
14329 !! end
14330
14331 !! test
14332 3. Inline image with individual attributes from templates
14333 !! wikitext
14334 [[File:Foobar.jpg|{{echo|50px}}]]
14335 !! html/php
14336 <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>
14337 </p>
14338 !! html/parsoid
14339 <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>
14340 !! end
14341
14342 ## Parsoid does not provide editing support for images where templates produce multiple image attributes.
14343 ## To signal this, we add a 'mw:Placeholder' type to such images. This could change in the future.
14344 !! test
14345 Image with multiple attributes from the same template
14346 !! wikitext
14347 [[File:Foobar.jpg|{{image_attribs}}]]
14348 !! html/php
14349 <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>
14350
14351 !! html/parsoid
14352 <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>
14353 !! end
14354
14355 !! test
14356 Image with link tails
14357 !! options
14358 thumbsize=220
14359 !! wikitext
14360 123[[File:Foobar.jpg]]456
14361 123[[File:Foobar.jpg|right]]456
14362 123[[File:Foobar.jpg|thumb]]456
14363 !! html/php
14364 <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
14365 </p>
14366 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
14367 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
14368
14369 !! html/php+tidy
14370 <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>
14371 <p>123</p>
14372 <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>
14373 <p>456 123</p>
14374 <div class="thumb tright">
14375 <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>
14376 <div class="thumbcaption">
14377 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
14378 </div>
14379 </div>
14380 </div>
14381 <p>456</p>
14382 !! html/parsoid
14383 <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>
14384 <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>
14385 <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>
14386 !! end
14387
14388 !! test
14389 Image with multiple captions -- only last one is accepted
14390 !! wikitext
14391 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
14392 !! html/php
14393 <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>
14394
14395 !! html/parsoid
14396 <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>
14397 !! end
14398
14399 !! test
14400 Image with multiple widths -- use last
14401 !! wikitext
14402 [[File:Foobar.jpg|200px|300px|caption]]
14403 !! html/php
14404 <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>
14405 </p>
14406 !! html/parsoid
14407 <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>
14408 !! end
14409
14410 !! test
14411 Image with multiple alignments -- use first (T50664)
14412 !! options
14413 thumbsize=220
14414 !! wikitext
14415 [[File:Foobar.jpg|thumb|left|right|center|caption]]
14416
14417 [[File:Foobar.jpg|middle|text-top|caption]]
14418 !! html/php
14419 <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>
14420 <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>
14421 </p>
14422 !! html/parsoid
14423 <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>
14424 <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>
14425 !! end
14426
14427 !! test
14428 Image with width attribute at different positions
14429 !! wikitext
14430 [[File:Foobar.jpg|200px|right|Caption]]
14431 [[File:Foobar.jpg|right|200px|Caption]]
14432 [[File:Foobar.jpg|right|Caption|200px]]
14433 !! html/php
14434 <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>
14435 <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>
14436 <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>
14437
14438 !! html/parsoid
14439 <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>
14440 <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>
14441 <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>
14442 !! end
14443
14444 # a sad bit of backward-compatibility
14445 !! test
14446 Image with size specified with pxpx (T15500, T53628)
14447 !! options
14448 parsoid=wt2html,wt2wt,html2html
14449 !! wikitext
14450 [[File:Foobar.jpg|20pxpx]]
14451 [[File:Foobar.jpg|200x20pxpx]]
14452 !! html/php
14453 <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>
14454 <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>
14455 </p>
14456 !! html/parsoid
14457 <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>
14458 !! end
14459
14460 !! test
14461 Image with link parameter, wiki target
14462 !! wikitext
14463 [[File:Foobar.jpg|link=Main Page]]
14464 !! html/php
14465 <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>
14466 </p>
14467 !! html/parsoid
14468 <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>
14469 !! end
14470
14471 # parsoid T51293 (part 1)
14472 !! test
14473 Image with link parameter, URL target
14474 !! wikitext
14475 [[File:Foobar.jpg|link=http://example.com/]]
14476 !! html/php
14477 <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>
14478 </p>
14479 !! html/parsoid
14480 <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>
14481 !! end
14482
14483 # parsoid T51293 (part 2)
14484 !! test
14485 Image with link parameter, protocol-less URL target
14486 !! wikitext
14487 [[File:Foobar.jpg|link=//example.com/]]
14488 !! html/php
14489 <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>
14490 </p>
14491 !! html/parsoid
14492 <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>
14493 !! end
14494
14495 !! test
14496 Escaping non-block captions (T107435)
14497 !! options
14498 parsoid={
14499 "modes": ["wt2wt"],
14500 "changes": [
14501 ["[typeof~='mw:Image']", "attr", "data-mw", "{\"caption\": \"|\"}"]
14502 ]
14503 }
14504 !! wikitext
14505 [[Image:Foobar.jpg|caption]]
14506 !! wikitext/edited
14507 [[Image:Foobar.jpg|<nowiki>|</nowiki>]]
14508 !! end
14509
14510 # wgExternalLinkTarget not supported by Parsoid
14511 !! test
14512 Image with link parameter, wgExternalLinkTarget
14513 !! wikitext
14514 [[Image:foobar.jpg|link=http://example.com/]]
14515 !! config
14516 wgExternalLinkTarget='foobar'
14517 !! html/php
14518 <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>
14519 </p>
14520 !! end
14521
14522 !! test
14523 Image with link parameter, wgNoFollowLinks set to false
14524 !! wikitext
14525 [[Image:foobar.jpg|link=http://example.com/]]
14526 !! config
14527 wgNoFollowLinks=false
14528 !! html
14529 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
14530 </p>
14531 !! end
14532
14533 !! test
14534 Image with link parameter, wgNoFollowDomainExceptions
14535 !! wikitext
14536 [[Image:foobar.jpg|link=http://example.com/]]
14537 !! config
14538 wgNoFollowDomainExceptions='example.com'
14539 !! html
14540 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
14541 </p>
14542 !! end
14543
14544 # wgExternalLinkTarget not supported by Parsoid
14545 !! test
14546 Image with link parameter, wgExternalLinkTarget, unnamed parameter
14547 !! wikitext
14548 [[Image:foobar.jpg|link=http://example.com/|Title]]
14549 !! config
14550 wgExternalLinkTarget='foobar'
14551 !! html/php
14552 <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>
14553 </p>
14554 !! end
14555
14556 !! test
14557 Image with empty link parameter
14558 !! wikitext
14559 [[File:Foobar.jpg|link=]]
14560 !! html/php
14561 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
14562 </p>
14563 !! html/parsoid
14564 <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>
14565 !! end
14566
14567 !! test
14568 Image with link parameter (wiki target) and unnamed parameter
14569 !! wikitext
14570 [[File:Foobar.jpg|link=Main_Page|Title]]
14571 !! html/php
14572 <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>
14573 </p>
14574 !! html/parsoid
14575 <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>
14576 !! end
14577
14578 !! test
14579 Image with link parameter (URL target) and unnamed parameter
14580 !! wikitext
14581 [[File:Foobar.jpg|link=http://example.com/|Title]]
14582 !! html/php
14583 <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>
14584 </p>
14585 !! html/parsoid
14586 <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>
14587 !! end
14588
14589 !! test
14590 Thumbnail image with link parameter
14591 !! options
14592 thumbsize=220
14593 parsoid=wt2html,wt2wt,html2html
14594 !! wikitext
14595 [[File:Foobar.jpg|thumb|link=http://example.com/|Title]]
14596 !! html/php
14597 <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>
14598
14599 !! html/parsoid
14600 <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>
14601 !! end
14602
14603 !! test
14604 Manually-specified thumbnail image
14605 !! options
14606 thumbsize=220
14607 !! wikitext
14608 [[File:Foobar.jpg|thumbnail=Thumb.png|Title]]
14609 !! html/php
14610 <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>
14611
14612 !! html/parsoid
14613 <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>
14614 !! end
14615
14616 !! test
14617 Manually-specified thumbnail image with explicit link to wiki page
14618 !! options
14619 thumbsize=220
14620 parsoid=wt2html,wt2wt,html2html
14621 !! wikitext
14622 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|Title]]
14623 !! html/php
14624 <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>
14625
14626 !! html/parsoid
14627 <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>
14628 !! end
14629
14630 !! test
14631 Manually-specified thumbnail image with explicit link to url
14632 !! options
14633 thumbsize=220
14634 parsoid=wt2html,wt2wt,html2html
14635 !! wikitext
14636 [[File:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
14637 !! html/php
14638 <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>
14639
14640 !! html/parsoid
14641 <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>
14642 !! end
14643
14644 !! test
14645 Manually-specified thumbnail image with explicit no link
14646 !! options
14647 thumbsize=220
14648 parsoid=wt2html,wt2wt,html2html
14649 !! wikitext
14650 [[File:Foobar.jpg|thumb=Thumb.png|link=|Title]]
14651 !! html/php
14652 <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>
14653
14654 !! html/parsoid
14655 <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>
14656 !! end
14657
14658 !! test
14659 Manually-specified thumbnail image with explicit link and alt text
14660 !! options
14661 thumbsize=220
14662 parsoid=wt2html,wt2wt,html2html
14663 !! wikitext
14664 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|alt=alttext|Title]]
14665 !! html/php
14666 <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>
14667
14668 !! html/parsoid
14669 <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>
14670 !! end
14671
14672 !! test
14673 Image with frame and link
14674 !! options
14675 parsoid=wt2html,wt2wt,html2html
14676 !! wikitext
14677 [[File:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
14678 !! html/php
14679 <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>
14680
14681 !! html/parsoid
14682 <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>
14683 !! end
14684
14685 !! test
14686 Image with frame and link and explicit alt
14687 !! options
14688 parsoid=wt2html,wt2wt,html2html
14689 !! wikitext
14690 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
14691 !! html/php
14692 <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>
14693
14694 !! html/parsoid
14695 <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>
14696 !! end
14697
14698 !! test
14699 Image with wiki markup in implicit alt
14700 !! wikitext
14701 [[Image:Foobar.jpg|testing '''bold''' in alt]]
14702
14703 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
14704 !! html/php
14705 <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>
14706 </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>
14707 </p>
14708 !! html/parsoid
14709 <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>
14710
14711 <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>
14712 !! end
14713
14714 !! test
14715 Alt image option should handle most kinds of wikitext without barfing
14716 !! wikitext
14717 [[Image:Foobar.jpg|thumb|This is the image caption|alt=This is a [[link]] and a {{echo|''bold template''}}.]]
14718 !! html/php
14719 <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>
14720
14721 !! html/parsoid
14722 <figure class="mw-default-size" typeof="mw:Image/Thumb mw:ExpandedAttrs" about="#mwt2" data-parsoid='{"optList":[{"ck":"thumbnail","ak":"thumb"},{"ck":"caption","ak":"This is the image caption"},{"ck":"alt","ak":"alt=This is a [[link]] and a {{echo|&#39;&#39;bold template&#39;&#39;}}."}]}' data-mw='{"attribs":[["thumbnail",{"html":"thumb"}],["alt",{"html":"alt=This is a &lt;a rel=\"mw:WikiLink\" href=\"./Link\" title=\"Link\" data-parsoid=&#39;{\"stx\":\"simple\",\"a\":{\"href\":\"./Link\"},\"sa\":{\"href\":\"link\"},\"dsr\":[65,73,2,2]}&#39;>link&lt;/a> and a &lt;i about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"dsr\":[80,106,null,null],\"pi\":[[{\"k\":\"1\"}]]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"&amp;#39;&amp;#39;bold template&amp;#39;&amp;#39;\"}},\"i\":0}}]}&#39;>bold template&lt;/i>."}]]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img alt="This is a link and a bold template." resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220" data-parsoid='{"a":{"alt":"This is a link and a bold template.","resource":"./File:Foobar.jpg","height":"25","width":"220"},"sa":{"alt":"alt=This is a [[link]] and a {{echo|&#39;&#39;bold template&#39;&#39;}}.","resource":"Image:Foobar.jpg"}}'/></a><figcaption>This is the image caption</figcaption></figure>
14723 !! end
14724
14725 ###################
14726 # Conflicting image format options.
14727 # First option specified should 'win'.
14728 # All three cases in each test should be identical.
14729
14730 !! test
14731 Image with 'frameless' first.
14732 !! options
14733 parsoid=wt2html,wt2wt,html2html
14734 !! wikitext
14735 [[File:Foobar.jpg|frameless|caption]]
14736
14737 [[File:Foobar.jpg|frameless|frame|caption]]
14738
14739 [[File:Foobar.jpg|frameless|thumb|caption]]
14740 !! html/php
14741 <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>
14742 </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>
14743 </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>
14744 </p>
14745 !! html/parsoid
14746 <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>
14747 <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>
14748 <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>
14749 !! end
14750
14751 !! test
14752 Image with 'frame' first.
14753 !! options
14754 parsoid=wt2html,wt2wt,html2html
14755 !! wikitext
14756 [[File:Foobar.jpg|frame|caption]]
14757 [[File:Foobar.jpg|frame|frameless|caption]]
14758 [[File:Foobar.jpg|frame|thumb|caption]]
14759 !! html/php
14760 <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>
14761 <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>
14762 <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>
14763
14764 !! html/parsoid
14765 <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>
14766 <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>
14767 <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>
14768 !! end
14769
14770 !! test
14771 Image with 'thumb' first.
14772 !! options
14773 parsoid=wt2html,wt2wt,html2html
14774 !! wikitext
14775 [[File:Foobar.jpg|thumb|caption]]
14776 [[File:Foobar.jpg|thumb|frameless|caption]]
14777 [[File:Foobar.jpg|thumb|frame|caption]]
14778 !! html/php
14779 <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>
14780 <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>
14781 <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>
14782
14783 !! html/parsoid
14784 <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>
14785 <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>
14786 <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>
14787 !! end
14788
14789 ###################
14790 # Image sizing.
14791 # See https://www.mediawiki.org/wiki/Help:Images#Size_and_frame
14792 # and https://phabricator.wikimedia.org/T64258
14793 # Foobar has actual size of 1941x220
14794 # 1. Thumbs & frameless always reduce, can't be enlarged unless it's
14795 # a scalable format.
14796 # 2. Framed images always ignore size options; always render at default size.
14797 # 3. "Unspecified format" and border are the only types which can be
14798 # enlarged.
14799
14800 !! test
14801 Image: unspecified format and border enlarge
14802 !! options
14803 parsoid=wt2html,wt2wt,html2html
14804 !! wikitext
14805 [[File:Foobar.jpg|2000px]]
14806
14807 [[File:Foobar.jpg|border|2000px]]
14808 !! html/php
14809 <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>
14810 </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>
14811 </p>
14812 !! html/parsoid
14813 <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>
14814 <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>
14815 !! end
14816
14817 !! test
14818 Image: "unspecified format" and border reduce
14819 !! options
14820 parsoid=wt2html,wt2wt,html2html
14821 !! wikitext
14822 [[File:Foobar.jpg|1000px]]
14823
14824 [[File:Foobar.jpg|border|1000px]]
14825 !! html/php
14826 <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>
14827 </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>
14828 </p>
14829 !! html/parsoid
14830 <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>
14831 <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>
14832 !! end
14833
14834 !! test
14835 Image: thumbs reduce
14836 !! options
14837 parsoid=wt2html,wt2wt,html2html
14838 !! wikitext
14839 [[File:Foobar.jpg|thumb|50px]]
14840 !! html/php
14841 <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>
14842
14843 !! html/parsoid
14844 <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>
14845 !! end
14846
14847 !! test
14848 Image: bitmap thumbs can't be enlarged past original size, but vector can.
14849 !! options
14850 parsoid=wt2html,wt2wt,html2html
14851 !! wikitext
14852 [[File:Foobar.jpg|thumb|2000px]]
14853
14854 [[File:Foobar.svg|thumb|2000px]]
14855 !! html/php
14856 <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>
14857 <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>
14858
14859 !! html/parsoid
14860 <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>
14861 <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>
14862 !! end
14863
14864 !! test
14865 Image: frameless can reduce in size
14866 !! options
14867 parsoid=wt2html,wt2wt,html2html
14868 !! wikitext
14869 [[File:Foobar.jpg|frameless|50px]]
14870 !! html/php
14871 <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>
14872 </p>
14873 !! html/parsoid
14874 <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>
14875 !! end
14876
14877 !! test
14878 Image: bitmap frameless can't be enlarged past original size, but vector can
14879 !! options
14880 parsoid=wt2html,wt2wt,html2html
14881 !! wikitext
14882 [[File:Foobar.jpg|frameless|2000px]]
14883
14884 [[File:Foobar.svg|frameless|2000px]]
14885 !! html/php
14886 <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>
14887 </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>
14888 </p>
14889 !! html/parsoid
14890 <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>
14891 <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>
14892 !! end
14893
14894 !! test
14895 Image: framed images are always unscaled.
14896 !! options
14897 parsoid=wt2html,wt2wt,html2html
14898 !! wikitext
14899 [[File:Foobar.jpg|frame]]
14900
14901 [[File:Foobar.jpg|frame|50px]]
14902
14903 [[File:Foobar.jpg|frame|50x50px]]
14904
14905 [[File:Foobar.jpg|frame|2000px]]
14906 !! html/php
14907 <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>
14908 <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>
14909 <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>
14910 <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>
14911
14912 !! html/parsoid
14913 <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>
14914 <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>
14915 <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>
14916 <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>
14917 !! end
14918
14919 ###################
14920
14921 !! test
14922 Link to image page- image page normally doesn't exists, hence edit link
14923 Add test with existing image page
14924 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
14925 !! wikitext
14926 [[:Image:test]]
14927 !! html
14928 <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>
14929 </p>
14930 !! end
14931
14932 !! test
14933 T20784 Link to non-existent image page with caption should use caption as link text
14934 !! wikitext
14935 [[:Image:test|caption]]
14936 !! html
14937 <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>
14938 </p>
14939 !! end
14940
14941 !! test
14942 Frameless image caption with a free URL
14943 !! wikitext
14944 [[File:Foobar.jpg|http://example.com]]
14945 !! html/php
14946 <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>
14947 </p>
14948 !! html/parsoid
14949 <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>
14950 !! end
14951
14952 !! test
14953 Thumbnail image caption with a free URL
14954 !! options
14955 thumbsize=220
14956 !! wikitext
14957 [[File:Foobar.jpg|thumb|http://example.com]]
14958 !! html/php
14959 <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>
14960
14961 !! html/parsoid
14962 <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>
14963 !! end
14964
14965 !! test
14966 Thumbnail image caption with a free URL and explicit alt
14967 !! options
14968 thumbsize=220
14969 parsoid=wt2html,wt2wt,html2html
14970 !! wikitext
14971 [[File:Foobar.jpg|thumb|http://example.com|alt=Alteration]]
14972 !! html/php
14973 <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>
14974
14975 !! html/parsoid
14976 <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>
14977 !! end
14978
14979 !! test
14980 SVG thumbnails with no language set
14981 !! options
14982 !! wikitext
14983 [[File:Foobar.svg|thumb|caption]]
14984 !! html/php
14985 <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>
14986
14987 !! html/parsoid
14988 <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>
14989 !! end
14990
14991 !! test
14992 SVG thumbnails with language de
14993 !! options
14994 parsoid=wt2html,wt2wt,html2html
14995 !! wikitext
14996 [[File:Foobar.svg|thumb|caption|lang=de]]
14997 !! html/php
14998 <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>
14999
15000 !! html/parsoid
15001 <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>
15002 !! end
15003
15004 !! test
15005 SVG thumbnails with invalid language code
15006 !! options
15007 parsoid=wt2html,wt2wt,html2html
15008 !! wikitext
15009 [[File:Foobar.svg|thumb|caption|lang=invalid.language.code]]
15010 !! html/php
15011 <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>
15012
15013 !! html/parsoid
15014 <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>
15015 !! end
15016
15017 !! test
15018 T3887: A ISBN with a thumbnail
15019 !! wikitext
15020 [[File:Foobar.jpg|thumb|ISBN 1235467890]]
15021 !! html/php
15022 <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>
15023
15024 !! html/parsoid
15025 <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>
15026 !! end
15027
15028 !! test
15029 T3887: A RFC with a thumbnail
15030 !! wikitext
15031 [[File:Foobar.jpg|thumb|This is RFC 12354]]
15032 !! html/php
15033 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>This is <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc12354">RFC 12354</a></div></div></div>
15034
15035 !! html/parsoid
15036 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>This is <a href="//tools.ietf.org/html/rfc12354" rel="mw:ExtLink">RFC 12354</a></figcaption></figure>
15037 !! end
15038
15039 !! test
15040 T3887: A mailto link with a thumbnail
15041 !! wikitext
15042 [[File:Foobar.jpg|thumb|Please mailto:nobody@example.com]]
15043 !! html/php
15044 <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>
15045
15046 !! html/parsoid
15047 <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>
15048 !! end
15049
15050 # Pending resolution to T2368
15051 !! test
15052 T2648: Frameless image caption with a link
15053 !! wikitext
15054 [[File:Foobar.jpg|text with a [[link]] in it]]
15055 !! html/php
15056 <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>
15057 </p>
15058 !! html/parsoid
15059 <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>
15060 !! end
15061
15062 !! test
15063 T2648: Frameless image caption with a link (suffix)
15064 !! wikitext
15065 [[File:Foobar.jpg|text with a [[link]]foo in it]]
15066 !! html/php
15067 <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>
15068 </p>
15069 !! html/parsoid
15070 <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>
15071 !! end
15072
15073 !! test
15074 T2648: Frameless image caption with an interwiki link
15075 !! wikitext
15076 [[File:Foobar.jpg|text with a [[MeatBall:Link]] in it]]
15077 !! html/php
15078 <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>
15079 </p>
15080 !! html/parsoid
15081 <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>
15082 !! end
15083
15084 !! test
15085 T2648: Frameless image caption with a piped interwiki link
15086 !! wikitext
15087 [[File:Foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
15088 !! html/php
15089 <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>
15090 </p>
15091 !! html/parsoid
15092 <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>
15093 !! end
15094
15095 !! test
15096 T107474: Frameless image caption with <nowiki>
15097 !! wikitext
15098 [[File:Foobar.jpg|<nowiki>text with a [[MeatBall:Link|link]] in it</nowiki>]]
15099 !! html/parsoid
15100 <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>
15101 !! end
15102
15103 !! test
15104 Escape HTML special chars in image alt text
15105 !! wikitext
15106 [[File:Foobar.jpg|& < > "]]
15107 !! html/php
15108 <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>
15109 </p>
15110 !! html/parsoid
15111 <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>
15112 !! end
15113
15114 !! test
15115 Escape HTML special chars in image alt text with LanguageConverter
15116 !! options
15117 language=zh
15118 !! wikitext
15119 [[File:Foobar.jpg|& < > "]]
15120 !! html/php
15121 <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>
15122 </p>
15123 !! html/parsoid
15124 <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>
15125 !! end
15126
15127 !! test
15128 Entities in file name and attributes
15129 !! wikitext
15130 [[File:7%25 solution.gif|manualthumb=7%25 solution.gif|link=7%25 solution|[[7%25 solution]]]]
15131 !! html/php
15132 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=7%25_solution.gif" class="new" title="File:7% solution.gif">7% solution</a>
15133 </p>
15134 !! html/parsoid
15135 <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>
15136 !! end
15137
15138 !! test
15139 T2499: Alt text should have &#1234;, not &amp;1234;
15140 !! wikitext
15141 [[File:Foobar.jpg|&#9792;]]
15142 !! html/php
15143 <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>
15144 </p>
15145 !! html/parsoid
15146 <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>
15147 !! end
15148
15149 !! test
15150 Broken image caption with link
15151 !! options
15152 parsoid=wt2html,wt2wt,html2html
15153 !! wikitext
15154 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
15155 !! html/php
15156 <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.
15157 </p>
15158 !! html/parsoid
15159 <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>
15160 !! end
15161
15162 !! test
15163 Image caption containing another image
15164 !! wikitext
15165 [[File:Foobar.jpg|thumb|This is a caption with another [[File:Thumb.png|image]] inside it!]]
15166 !! html/php
15167 <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>
15168
15169 !! html/parsoid
15170 <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>
15171 !! end
15172
15173 !! test
15174 Image: caption containing a newline
15175 !! wikitext
15176 [[File:Foobar.jpg|This
15177 *is some text]]
15178 !! html/php
15179 <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>
15180 </p>
15181 !! html/parsoid
15182 <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>
15183 !!end
15184
15185 !!test
15186 Image: caption containing leading space
15187 (The leading space should not trigger nowiki escaping in wt2wt mode)
15188 !! wikitext
15189 [[File:Foobar.jpg|thumb| bar]]
15190 !! html/php
15191 <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>
15192
15193 !! html/parsoid
15194 <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>
15195 !!end
15196
15197 !! test
15198 Image: caption containing a table
15199 !! options
15200 parsoid=wt2html,wt2wt,html2html
15201 !! wikitext
15202 [[Image:Foobar.jpg|thumb|200px|This is an example image thumbnail caption with a table
15203 {|
15204 ! Foo !! Bar
15205 |-
15206 | Foo1 || Bar1
15207 |}
15208 and some more text.]]
15209 !! html/php
15210 <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>
15211
15212 !! html/parsoid
15213 <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
15214 <table>
15215 <tbody>
15216 <tr><th>Foo </th><th>Bar</th></tr>
15217 <tr>
15218 <td>Foo1 </td>
15219 <td>Bar1</td></tr></tbody></table>and some more text.</figcaption></figure>
15220 !! end
15221
15222 !! test
15223 T5090: External links other than http: in image captions
15224 !! wikitext
15225 [[File:Foobar.jpg|thumb|200x200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
15226 !! html/php
15227 <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>
15228
15229 !! html/parsoid
15230 <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>
15231 !! end
15232
15233 !! test
15234 Custom class
15235 !! options
15236 parsoid=wt2html,wt2wt,html2html
15237 !! wikitext
15238 [[Image:foobar.jpg|a|class=b]]
15239 !! html/php
15240 <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>
15241 </p>
15242 !! html/parsoid
15243 <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>
15244 !! end
15245
15246 !! test
15247 Localized image handling (1).
15248 !! options
15249 parsoid=wt2html,wt2wt,html2html
15250 language=es
15251 !! wikitext
15252 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
15253 !! html/php
15254 <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>
15255
15256 !! html/parsoid
15257 <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>
15258 !! end
15259
15260 !! test
15261 Localized image handling (2).
15262 !! options
15263 thumbsize=220
15264 parsoid=wt2html,wt2wt,html2html
15265 language=es
15266 !! wikitext
15267 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
15268 !! html/php
15269 <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>
15270
15271 !! html/parsoid
15272 <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>
15273 !! end
15274
15275 !! test
15276 Localized image handling (3).
15277 !! options
15278 language=fa
15279 parsoid=html2wt
15280 !! html/parsoid
15281 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a></figure>
15282 !! wikitext
15283 [[File:Foobar.jpg|بندانگشتی]]
15284 !! end
15285
15286 !! test
15287 "border", "frameless" and "class" attributes on an image.
15288 !! options
15289 thumbsize=220
15290 parsoid=wt2html,wt2wt,html2html
15291 !! wikitext
15292 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
15293 !! html/php
15294 <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>
15295 </p>
15296 !! html/parsoid
15297 <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>
15298 !! end
15299
15300 # Note that 'right' is the default alignment, despite the misspelled 'righ' below
15301 !! test
15302 Invalid image attributes (T64500)
15303 !! options
15304 thumbsize=220
15305 parsoid=wt2html,wt2wt,html2html
15306 !! wikitext
15307 [[File:Foobar.jpg|thumb|float|left|caption]]
15308
15309 [[File:Foobar.jpg|thumb|righ|caption]]
15310
15311 [[File:Foobar.jpg|bogus1|thumb|bogus2|left|bogus3|caption]]
15312 !! html/php
15313 <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>
15314 <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>
15315 <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>
15316
15317 !! html/parsoid
15318 <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>
15319 <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>
15320 <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>
15321 !! end
15322
15323 !! article
15324 File:Barfoo.jpg
15325 !! text
15326 #REDIRECT [[File:Barfoo.jpg]]
15327 !! endarticle
15328
15329 # FIXME: Parsoid should run this test -- but we'd need to teach the
15330 # mockAPI about the redirected Barfoo.jpg image.
15331 !! test
15332 Redirected image
15333 !! wikitext
15334 [[Image:Barfoo.jpg]]
15335 !! html/php
15336 <p><a href="/wiki/File:Barfoo.jpg" class="mw-redirect" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
15337 </p>
15338 !! end
15339
15340 !! test
15341 Missing image with uploads disabled
15342 !! options
15343 wgEnableUploads=0
15344 !! wikitext
15345 [[File:Foobaz.jpg]]
15346 !! html/php
15347 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
15348 </p>
15349 !! html/parsoid
15350 <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>
15351 !! end
15352
15353 # Parsoid-specific testing for images
15354 # https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
15355 # Currently imperfect due to a flaw in the Parsoid testrunner
15356 # Work in progress
15357 # THESE TESTS SHOULD BE MOVED UP and merged with the php-specific
15358 # image tests.
15359
15360 !! test
15361 Parsoid-specific image handling - simple image with size and middle alignment
15362 !! wikitext
15363 [[File:Foobar.jpg|middle|50px]]
15364 !! html/parsoid
15365 <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>
15366 !! end
15367
15368 !! test
15369 Parsoid-specific image handling - simple image with size, middle alignment,
15370 non-standard namespace alias
15371 !! options
15372 parsoid=wt2wt,wt2html,html2html
15373 !! wikitext
15374 [[Image:Foobar.jpg|middle|50px]]
15375 !! html/parsoid
15376 <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>
15377 !! end
15378
15379 !! test
15380 Parsoid-specific image handling - simple image with size and middle alignment
15381 (existing content)
15382 !! wikitext
15383 [[File:Foobar.jpg|50px|middle]]
15384 !! html/parsoid
15385 <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>
15386 !! end
15387
15388 !! test
15389 Parsoid-specific image handling - simple image with size and middle alignment
15390 and non-standard namespace name
15391 !! options
15392 parsoid=wt2html,wt2wt,html2html
15393 !! wikitext
15394 [[Image:Foobar.jpg|50px|middle]]
15395 !! html/parsoid
15396 <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>
15397 !! end
15398
15399 !! test
15400 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
15401 !! wikitext
15402 [[File:Foobar.jpg|500x10px|baseline|caption]]
15403 !! html/parsoid
15404 <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>
15405 !! end
15406
15407 !! test
15408 Parsoid-specific image handling - simple image with border and size spec
15409 !! wikitext
15410 [[File:Foobar.jpg|50px|border|caption]]
15411 !! html/parsoid
15412 <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>
15413 !! end
15414
15415 !! test
15416 Parsoid-specific image handling - thumbnail with halign, valign, and caption
15417 !! wikitext
15418 [[File:Foobar.jpg|left|baseline|thumb|caption content]]
15419 !! html/parsoid
15420 <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>
15421 !! end
15422
15423 !! test
15424 Parsoid-specific image handling - thumbnail with halign, valign, and caption
15425 (existing content)
15426 !! wikitext
15427 [[File:Foobar.jpg|thumb|left|baseline|caption content]]
15428 !! html/parsoid
15429 <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>
15430 !! end
15431
15432 !! test
15433 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
15434 !! wikitext
15435 [[Image:Foobar.jpg|right|middle|thumb|50x50px|caption]]
15436 !! html/parsoid
15437 <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>
15438 !! end
15439
15440 !! test
15441 Parsoid-specific image handling - thumbnail with specific size, halign,
15442 valign, and caption (existing content)
15443 !! wikitext
15444 [[File:Foobar.jpg|thumb|50x50px|right|middle|caption]]
15445 !! html/parsoid
15446 <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>
15447 !! end
15448
15449 !! test
15450 Parsoid-specific image handling - framed image with specific size and caption
15451 (size is ignored)
15452 !! options
15453 parsoid=wt2html,wt2wt,html2html
15454 !! wikitext
15455 [[File:Foobar.jpg|frame|500x50px|caption]]
15456 !! html/parsoid
15457 <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>
15458 !! end
15459
15460 !! test
15461 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption
15462 (size is ignored)
15463 !! options
15464 parsoid=wt2html,wt2wt,html2html
15465 !! wikitext
15466 [[File:Foobar.jpg|left|baseline|frame|500x50px|caption]]
15467 !! html/parsoid
15468 <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>
15469 !! end
15470
15471 !! test
15472 Parsoid-specific image handling - frameless image with specific size, border, and caption
15473 !! wikitext
15474 [[File:Foobar.jpg|frameless|442x50px|border|caption]]
15475 !! html/parsoid
15476 <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>
15477 !! end
15478
15479 !! test
15480 Parsoid-specific image handling - simple image with a formatted caption
15481 !! wikitext
15482 [[File:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
15483 !! html/parsoid
15484 <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>
15485 !! end
15486
15487 !! test
15488 Parsoid-specific image handling - caption with a template in it
15489 !! wikitext
15490 [[File:Foobar.jpg|thumb|200x23px|This caption has a {{echo|transclusion}} in it.]]
15491 !! html/parsoid
15492 <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>
15493 !! end
15494
15495 !! test
15496 Parsoid-specific image handling - caption with unbalanced tags in it
15497 !! options
15498 parsoid=wt2html,wt2wt,html2html
15499 !! wikitext
15500 foo
15501 [[File:Foobar.jpg|thumb|200x200px|This caption has a <center>unbalanced tag in it.]]
15502 bar
15503 !! html/parsoid
15504 <p>foo</p>
15505 <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>
15506 <p>bar</p>
15507 !! end
15508
15509 !! test
15510 Parsoid-specific image handling - empty caption (1)
15511 !! options
15512 parsoid=wt2html,wt2wt
15513 !! wikitext
15514 [[File:Foobar.jpg|thumb|]]
15515 !! html/parsoid
15516 <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>
15517 !! end
15518
15519 # empty captions don't get serialized unless we're in the "round trip" case
15520 !! test
15521 Parsoid-specific image handling - empty caption (2)
15522 !! options
15523 parsoid=html2wt
15524 !! html/parsoid
15525 <figure class="mw-default-size" typeof="mw:Image/Thumb">
15526 <a href="./File:Foobar.jpg">
15527 <img resource="./File:Foobar.jpg"
15528 src="//example.com/images/3/3a/Foobar.jpg"
15529 data-file-width="1941" data-file-height="220" data-file-type="bitmap"
15530 height="25" width="220"/>
15531 </a>
15532 <figcaption></figcaption>
15533 </figure>
15534 !! wikitext
15535 [[File:Foobar.jpg|thumb]]
15536 !! end
15537
15538 !! test
15539 Parsoid-specific image handling - whitespace caption
15540 !! wikitext
15541 [[File:Foobar.jpg|thumb| ]]
15542 !! html/parsoid
15543 <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>
15544 !! end
15545
15546 !! test
15547 Parsoid-specific image handling - lang option
15548 !! wikitext
15549 foo
15550 [[File:Foobar.svg|lang=de|caption]]
15551 bar
15552 !! html/parsoid
15553 <p>foo
15554 <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>
15555 bar</p>
15556 !! end
15557
15558 ## Edge case bugs in Parsoid from T93580
15559 !! test
15560 T93580: 1. Templated <ref> inside block images
15561 !! wikitext
15562 [[File:Foobar.jpg|thumb|Caption with templated ref: {{echo|<ref>foo</ref>}}]]
15563
15564 <references />
15565 !! html/parsoid
15566 <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>
15567
15568 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><a href="./Main_Page#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text" data-parsoid="{}">foo</span></li></ol>
15569 !! end
15570
15571 !! test
15572 T93580: 2. <ref> inside inline images
15573 !! wikitext
15574 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: <ref>foo</ref>]]
15575
15576 <references />
15577 !! html/parsoid
15578 <p><span class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"Undisplayed caption in inline image with ref: &lt;ref>foo&lt;/ref>"}]}' data-mw='{"caption":"Undisplayed caption in inline image with ref: &lt;span about=\"#mwt2\" class=\"mw-ref\" id=\"cite_ref-1\" rel=\"dc:references\" typeof=\"mw:Extension/ref\" data-parsoid=&#39;{\"dsr\":[64,78,5,6]}&#39; data-mw=&#39;{\"name\":\"ref\",\"body\":{\"id\":\"mw-reference-text-cite_note-1\"},\"attrs\":{}}&#39;>&lt;a href=\"./Main_Page#cite_note-1\" style=\"counter-reset: mw-Ref 1;\" data-parsoid=\"{}\">&lt;span class=\"mw-reflink-text\" data-parsoid=\"{}\">[1]&lt;/span>&lt;/a>&lt;/span>&lt;meta typeof=\"mw:Extension/ref/Marker\" about=\"#mwt2\" data-parsoid=&#39;{\"group\":\"\",\"name\":\"\",\"content\":\"foo\",\"hasRefInRef\":false,\"dsr\":[64,78,5,6]}&#39;/>"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
15579
15580 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><a href="./Main_Page#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text" data-parsoid="{}">foo</span></li></ol>
15581 !! end
15582
15583 !! test
15584 T93580: 3. Templated <ref> inside inline images
15585 !! wikitext
15586 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: {{echo|<ref>{{echo|foo}}</ref>}}]]
15587
15588 <references />
15589 !! html/parsoid
15590 <p><span class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"Undisplayed caption in inline image with ref: {{echo|&lt;ref>{{echo|foo}}&lt;/ref>}}"}]}' data-mw='{"caption":"Undisplayed caption in inline image with ref: &lt;span about=\"#mwt2\" class=\"mw-ref\" id=\"cite_ref-1\" rel=\"dc:references\" typeof=\"mw:Transclusion mw:Extension/ref\" data-parsoid=&#39;{\"dsr\":[64,96,null,null],\"pi\":[[{\"k\":\"1\"}]]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"&amp;lt;ref>{{echo|foo}}&amp;lt;/ref>\"}},\"i\":0}}]}&#39;>&lt;a href=\"./Main_Page#cite_note-1\" style=\"counter-reset: mw-Ref 1;\" data-parsoid=\"{}\">&lt;span class=\"mw-reflink-text\" data-parsoid=\"{}\">[1]&lt;/span>&lt;/a>&lt;/span>&lt;meta typeof=\"mw:Transclusion mw:Extension/ref/Marker\" about=\"#mwt2\" data-parsoid=&#39;{\"group\":\"\",\"name\":\"\",\"content\":\"foo\",\"hasRefInRef\":false,\"dsr\":[64,96,null,null],\"pi\":[[{\"k\":\"1\"}]]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"&amp;lt;ref>{{echo|foo}}&amp;lt;/ref>\"}},\"i\":0}}]}&#39;/>"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
15591
15592 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><a href="./Main_Page#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text" data-parsoid="{}">foo</span></li></ol>
15593 !! end
15594
15595 ###
15596 ### Subpages
15597 ###
15598 !! article
15599 Subpage test/subpage
15600 !! text
15601 foo
15602 !! endarticle
15603
15604 !! test
15605 Subpage link
15606 !! options
15607 subpage title=[[Subpage test]]
15608 !! wikitext
15609 [[/subpage]]
15610 !! html
15611 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
15612 </p>
15613 !! end
15614
15615 !! test
15616 Subpage noslash link
15617 !! options
15618 subpage title=[[Subpage test]]
15619 !! wikitext
15620 [[/subpage/]]
15621 !! html
15622 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
15623 </p>
15624 !! end
15625
15626 !! article
15627 Subpage test/1/2/subpage
15628 !! text
15629 blah
15630 !! endarticle
15631
15632 !! test
15633 Relative subpage noslash link
15634 !! options
15635 parsoid=wt2wt,wt2html,html2html
15636 subpage title=[[Subpage test/1/2/3/4]]
15637 !! wikitext
15638 [[../../subpage/]]
15639
15640 [[../../subpage]]
15641 !! html/php
15642 <p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a>
15643 </p><p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage test/1/2/subpage</a>
15644 </p>
15645 !! html/parsoid
15646 <p><a rel="mw:WikiLink" href="./Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a></p>
15647 <p><a rel="mw:WikiLink" href="./Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
15648 !! end
15649
15650 !! test
15651 Parsoid: dot-slash prefixed wikilinks
15652 !! wikitext
15653 [[./foo]]
15654
15655 [[././bar]]
15656
15657 [[././baz/]]
15658 !! html/php
15659 <p>[[./foo]]
15660 </p><p>[[././bar]]
15661 </p><p>[[././baz/]]
15662 </p>
15663 !! html/parsoid
15664 <p>[[./foo]]
15665 </p><p>[[././bar]]
15666 </p><p>[[././baz/]]
15667 </p>
15668 !! end
15669
15670 !! test
15671 Render invalid page names as plain text (T53090)
15672 !! wikitext
15673 [[./../foo|bar]]
15674 [[foo�|bar]]
15675 [[foo/.|bar]]
15676 [[foo/..|bar]]
15677 [[foo~~~bar]]
15678 [[foo>bar]]
15679 [[foo[bar]]
15680 [[.]]
15681 [[..]]
15682 [[foo././bar]]
15683 [[foo[http://example.com]xyz]]
15684
15685 [[{{echo|./../foo}}|bar]]
15686 [[{{echo|foo/.}}|bar]]
15687 [[{{echo|foo/..}}|bar]]
15688 [[{{echo|foo~~~~bar}}]]
15689 [[{{echo|foo>bar}}]]
15690 [[{{echo|foo././bar}}]]
15691 [[{{echo|foo{bar}}]]
15692 [[{{echo|foo}bar}}]]
15693 [[{{echo|foo[bar}}]]
15694 [[{{echo|foo]bar}}]]
15695 [[{{echo|foo<bar}}]]
15696 !!html/php
15697 <p>[[./../foo|bar]]
15698 [[foo�|bar]]
15699 [[foo/.|bar]]
15700 [[foo/..|bar]]
15701 [[foo~~~bar]]
15702 [[foo&gt;bar]]
15703 [[foo[bar]]
15704 [[.]]
15705 [[..]]
15706 [[foo././bar]]
15707 [[foo<a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>xyz]]
15708 </p><p>[[./../foo|bar]]
15709 [[foo/.|bar]]
15710 [[foo/..|bar]]
15711 [[foo~~~~bar]]
15712 [[foo&gt;bar]]
15713 [[foo././bar]]
15714 [[foo{bar]]
15715 [[foo}bar]]
15716 [[foo[bar]]
15717 [[foo]bar]]
15718 [[foo&lt;bar]]
15719 </p>
15720 !!html/parsoid
15721 <p>[[./../foo|bar]]
15722 [[foo�|bar]]
15723 [[foo/.|bar]]
15724 [[foo/..|bar]]
15725 [[foo~~~bar]]
15726 [[foo>bar]]
15727 [[foo[bar]]
15728 [[.]]
15729 [[..]]
15730 [[foo././bar]]
15731 [[foo<a rel="mw:ExtLink" href="http://example.com"></a>xyz]]</p>
15732
15733 <p>[[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"./../foo"}},"i":0}}]}'>./../foo</span>|bar]]
15734 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/."}},"i":0}}]}'>foo/.</span>|bar]]
15735 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/.."}},"i":0}}]}'>foo/..</span>|bar]]
15736 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo~~~~bar"}},"i":0}}]}'>foo~~~~bar</span>]]
15737 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo>bar"}},"i":0}}]}'>foo>bar</span>]]
15738 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo././bar"}},"i":0}}]}'>foo././bar</span>]]
15739 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo{bar"}},"i":0}}]}'>foo{bar</span>]]
15740 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo}bar"}},"i":0}}]}'>foo}bar</span>]]
15741 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo[bar"}},"i":0}}]}'>foo[bar</span>]]
15742 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo]bar"}},"i":0}}]}'>foo]bar</span>]]
15743 [[<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>
15744 !!end
15745
15746 !! test
15747 Disabled subpages
15748 !! wikitext
15749 [[/subpage]]
15750 !! html
15751 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
15752 </p>
15753 !! end
15754
15755 !! test
15756 T2561: {{/Subpage}}
15757 !! options
15758 subpage title=[[Page]]
15759 !! wikitext
15760 {{/Subpage}}
15761 !! html
15762 <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>
15763 </p>
15764 !! end
15765
15766 ###
15767 ### Categories
15768 ###
15769 !! article
15770 Category:MediaWiki User's Guide
15771 !! text
15772 blah
15773 !! endarticle
15774
15775 !! test
15776 Link to category
15777 !! wikitext
15778 [[:Category:MediaWiki User's Guide]]
15779 !! html
15780 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
15781 </p>
15782 !! end
15783
15784 !! test
15785 Simple category
15786 !! options
15787 cat
15788 !! wikitext
15789 [[Category:MediaWiki User's Guide]]
15790 !! html/php
15791 cat=MediaWiki_User's_Guide sort=
15792 !! html/parsoid
15793 <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"}}'/>
15794 !! end
15795
15796 !! test
15797 PAGESINCATEGORY invalid title fatal (r33546 fix)
15798 !! wikitext
15799 {{PAGESINCATEGORY:<bogus>}}
15800 !! html
15801 <p>0
15802 </p>
15803 !! end
15804
15805 !! test
15806 Category with different sort key
15807 !! options
15808 cat
15809 !! wikitext
15810 [[Category:MediaWiki User's Guide|Foo]]
15811 !! html/php
15812 cat=MediaWiki_User's_Guide sort=Foo
15813 !! html/parsoid
15814 <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"}}'/>
15815 !! end
15816
15817 !! test
15818 Category with identical sort key
15819 !! options
15820 cat
15821 !! wikitext
15822 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
15823 !! html/php
15824 cat=MediaWiki_User's_Guide sort=MediaWiki User's Guide
15825 !! html/parsoid
15826 <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"}}'/>
15827 !! end
15828
15829 !! test
15830 Category with empty sort key
15831 !! options
15832 cat
15833 pst
15834 !! wikitext
15835 [[Category:MediaWiki User's Guide|]]
15836 !! html/php
15837 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
15838 !! end
15839
15840 !! test
15841 Category with empty sort key and parentheses
15842 !! options
15843 cat
15844 pst
15845 !! wikitext
15846 [[Category:Foo (bar)|]]
15847 !! html/php
15848 [[Category:Foo (bar)|Foo]]
15849 !! end
15850
15851 !! test
15852 Category with link tail
15853 !! options
15854 cat
15855 pst
15856 !! wikitext
15857 123[[Category:Foo]]456
15858 !! html/php
15859 123[[Category:Foo]]456
15860 !! end
15861
15862 !! test
15863 Category with template
15864 !! options
15865 cat
15866 pst
15867 !! wikitext
15868 [[Category:{{echo|Foo}}]]
15869 !! html/php
15870 [[Category:{{echo|Foo}}]]
15871 !! end
15872
15873 !! test
15874 Category with template in sort key
15875 !! options
15876 cat
15877 pst
15878 !! wikitext
15879 [[Category:Foo|{{echo|Bar}}]]
15880 !! html/php
15881 [[Category:Foo|{{echo|Bar}}]]
15882 !! end
15883
15884 !! test
15885 Category with template in sort key and title
15886 !! options
15887 cat
15888 pst
15889 !! wikitext
15890 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
15891 !! html/php
15892 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
15893 !! end
15894
15895 ## We used to, but no longer wt2wt this test since the default serializer
15896 ## will normalize all categories to serialize on their own line.
15897 ## This wikitext usage is going to be fairly uncommon in production and
15898 ## selser will take care of preserving formatting in those scenarios.
15899 !! test
15900 Category / paragraph interactions
15901 !! options
15902 parsoid=wt2html
15903 !! wikitext
15904 Foo [[Category:Baz]] Bar
15905
15906 Foo [[Category:Baz]]
15907 Bar
15908
15909 Foo
15910 [[Category:Baz]]
15911 Bar
15912
15913 Foo
15914 [[Category:Baz]] Bar
15915
15916 Foo
15917 [[Category:Baz]]
15918 [[Category:Baz]]
15919 [[Category:Baz]]
15920 Bar
15921
15922 [[Category:Baz]]
15923 [[Category:Baz]]
15924 [[Category:Baz]]
15925
15926 [[Category:Baz]]
15927 {{echo|[[Category:Baz]]}}
15928 [[Category:Baz]]
15929 !! html/php
15930 <p>Foo Bar
15931 </p><p>Foo
15932 Bar
15933 </p><p>Foo
15934 Bar
15935 </p><p>Foo Bar
15936 </p><p>Foo
15937 Bar
15938 </p>
15939 !! html/parsoid
15940 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
15941 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
15942 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
15943 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
15944 <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>
15945 <link rel="mw:PageProp/Category" href="./Category:Baz"/>
15946 !! end
15947
15948 ## We used to, but no longer wt2wt this test since the default serializer
15949 ## will normalize all categories to serialize on their own line.
15950 ## This wikitext usage is going to be fairly uncommon in production and
15951 ## selser will take care of preserving formatting in those scenarios.
15952 ##
15953 ## The whitespace on the empty line is part of the test. Please do not delete
15954 !! test
15955 1. Categories and newlines: All preceding newlines should be suppressed (courtesy T2087)
15956 !! options
15957 parsoid=wt2html
15958 !! wikitext
15959 This
15960
15961 [[Category:Foo]] and this should be part of same paragraph (not an indent-pre)
15962
15963 {{echo|[[Category:Foo]] and so should this!}}
15964 !! html/php
15965 <p>This and this should be part of same paragraph (not an indent-pre) and so should this!
15966 </p>
15967 !! html/parsoid
15968 <p>This
15969
15970 <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of same paragraph (not an indent-pre)
15971
15972 <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>
15973 !! end
15974
15975 ## Parsoid will not try to wt2wt this while preserving newlines because
15976 ## it suppresses excess newlines within list items -- and we don't want to
15977 ## introduce a special case just for categories, which is, in reality somewhat
15978 ## odd behavior -- categories are unlikely to be used in list items like this
15979 ## in top-level pages and are only likely to show up in template-generated
15980 ## list items where this RT-ing is a non-issue.
15981 ##
15982 ## The whitespace on the empty line is part of the test. Please do not delete
15983 !! test
15984 2. Categories and newlines: All preceding newlines should be suppressed (courtesy T2087)
15985 !! options
15986 parsoid=wt2html
15987 !! wikitext
15988 * This
15989
15990 [[Category:Foo]] and this should be part of the same list item
15991 * So should this
15992
15993 {{echo|[[Category:Foo]] and this should be part of the same list item}}
15994 !! html
15995 <ul><li>This and this should be part of the same list item</li>
15996 <li>So should this and this should be part of the same list item</li></ul>
15997 !! html/parsoid
15998 <ul>
15999 <li>This <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of the same list item</li>
16000 <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>
16001 </ul>
16002 !! end
16003
16004 ## Newlines and categories that follow the last item of a list
16005 ## are treated differently because this (list followed by categories)
16006 ## is an extremely common pattern on wikis.
16007 !! test
16008 3. Categories and newlines: newline suppression for last list item should RT properly
16009 !! wikitext
16010 * a
16011 * b
16012
16013 [[Category:Foo]]
16014
16015 [[Category:Bar]]
16016 [[Category:Baz]]
16017 !! html/parsoid
16018 <ul><li> a</li>
16019 <li> b</li></ul>
16020
16021 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
16022
16023 <link rel="mw:PageProp/Category" href="./Category:Bar" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
16024 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
16025 !! end
16026
16027 !! test
16028 4. Categories and newlines: newline suppression for last list item should RT properly
16029 !! wikitext
16030 * a
16031 **** b
16032
16033 [[Category:Foo]]
16034 !! html/parsoid
16035 <ul><li> a
16036 <ul><li><ul><li><ul><li> b</li></ul></li></ul></li></ul></li></ul>
16037
16038 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
16039 !! end
16040
16041 ## only wt2html for this to make sure the algo only applies to the rightmost path
16042 !! test
16043 5. Categories and newlines: migrateTrailingCategories dom pass should only run on the rightmost path of nested lists
16044 !! options
16045 parsoid=wt2html
16046 !! wikitext
16047 * a
16048 ** b
16049 [[Category:Foo]]
16050 * c
16051 ** d
16052 [[Category:Foo]]
16053 !! html/parsoid
16054 <ul><li> a
16055 <ul><li> b
16056 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/></li></ul></li>
16057 <li> c
16058 <ul><li> d</li></ul></li></ul>
16059 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
16060 !! end
16061
16062 ## We used to, but no longer wt2wt this test since the default serializer
16063 ## will normalize all categories to serialize on their own line.
16064 ## This wikitext usage is going to be fairly uncommon in production and
16065 ## selser will take care of preserving formatting in those scenarios.
16066 !! test
16067 6. Categories and newlines: migrateTrailingCategories dom pass should not migrate categories not preceded by newlines
16068 !! options
16069 parsoid=wt2html
16070 !! wikitext
16071 * a [[Category:Foo]]
16072 !! html/parsoid
16073 <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>
16074 !! end
16075
16076 # This test also demonstrates because of newline+category tunneling
16077 # through the list hander, template wrapping doesn't expand to the
16078 # containing list when the list item swallows the category.
16079 !! test
16080 7. Categories and newlines: migrateTrailingCategories dom pass should leave template content alone
16081 !! wikitext
16082 * {{echo|a
16083 [[Category:Foo]]}}
16084 !! html/parsoid
16085 <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
16086 </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>
16087 !! end
16088
16089 !! test
16090 8. Categories and newlines: migrateTrailingCategories dom pass should not get tripped by intervening templates
16091 !! wikitext
16092 * a
16093
16094 {{echo|[[Category:Foo]]
16095 [[Category:Bar]]}}
16096 [[Category:Baz]]
16097 !! html/parsoid
16098 <ul><li> a</li></ul>
16099
16100 <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">
16101 </span><link rel="mw:PageProp/Category" href="./Category:Bar" about="#mwt1" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
16102 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
16103 !! end
16104
16105 !! test
16106 Category links with multiple namespaces
16107 !! wikitext
16108 [[Category:Project:Foo]]
16109 !! html/parsoid
16110 <link rel="mw:PageProp/Category" href="./Category:Project:Foo" />
16111 !! end
16112
16113 !! test
16114 Parsoid: Serialize link to category page with colon escape
16115 !! options
16116 parsoid
16117 !! wikitext
16118
16119 [[:Category:Foo]]
16120 [[:Category:Foo|Bar]]
16121 !! html
16122 <p>
16123 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Category:Foo</a>
16124 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Bar</a>
16125 </p>
16126 !! end
16127
16128 # We used to, but no longer wt2wt this test since the default serializer
16129 # will normalize all categories to serialize on their own line.
16130 # This wikitext usage is going to be fairly uncommon in production and
16131 # selser will take care of preventing whitespace insertion if this
16132 # occurs in an article.
16133 #
16134 # html2html disabled for the same reason (whitespace insertion between
16135 # x and y).
16136 #
16137 # html2wt disabled because it localizes the "Category" namespace.
16138 !! test
16139 Link prefix/suffixes aren't applied to category links
16140 !! options
16141 parsoid=wt2html
16142 language=is
16143 !! wikitext
16144 x[[Category:Foo]]y
16145 !! html/php
16146 <p>xy
16147 </p>
16148 !! html/parsoid
16149 <p>x<link rel="mw:PageProp/Category" href="./Flokkur:Foo" data-parsoid=""/>y</p>
16150 !! end
16151
16152 !! test
16153 Parsoid: Serialize link to file page with colon escape
16154 !! options
16155 parsoid
16156 !! wikitext
16157
16158 [[:File:Foo.png]]
16159 [[:File:Foo.png|Bar]]
16160 !! html
16161 <p>
16162 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">File:Foo.png</a>
16163 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">Bar</a>
16164 </p>
16165 !! end
16166
16167 !! test
16168 Parsoid: Serialize a genuine category link without colon escape
16169 !! options
16170 parsoid
16171 !! wikitext
16172 [[Category:Foo]]
16173 [[Category:Foo|Bar]]
16174 !! html
16175 <link rel="mw:PageProp/Category" href="./Category:Foo">
16176 <link rel="mw:PageProp/Category" href="./Category:Foo#Bar">
16177 !! end
16178
16179 !! test
16180 Normalize hrefs properly before testing for invalid link targets (T72894)
16181 !! options
16182 parsoid=html2wt
16183 !! html/parsoid
16184 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne"/>
16185 !! wikitext
16186 [[Category:Toxine bactérienne]]
16187 !! end
16188
16189 !! test
16190 Parsoid: Defaultsort
16191 !! wikitext
16192 {{DEFAULTSORT:Foo}}
16193 !! html/parsoid
16194 <meta property="mw:PageProp/categorydefaultsort" content="Foo"/>
16195 !! end
16196
16197 # NOTE: mw:ExpandedAttrs is not the best typeof here. mw:Transclusion is better.
16198 # But, this is a limitation of our representation and is documented in
16199 # TemplateHandler.js in processSpecialMagicWord
16200 !! test
16201 Parsoid: Defaultsort (template-generated)
16202 !! wikitext
16203 {{{{echo|DEFAULTSORT}}:Foo}}
16204 !! html/parsoid
16205 <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"}]]}'/>
16206 !! end
16207
16208 ###
16209 ### Inter-language links
16210 ###
16211 !! test
16212 Interlanguage links
16213 !! options
16214 ill
16215 !! wikitext
16216 [[es:Alimento]]
16217 [[fr:Nourriture]]
16218 [[zh:食品]]
16219 !! html/php
16220 es:Alimento fr:Nourriture zh:食品
16221 !! html/parsoid
16222 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Alimento"/>
16223 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/Nourriture"/>
16224 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/食品"/>
16225 !! end
16226
16227 !! test
16228 Duplicate interlanguage links (T26502)
16229 !! options
16230 ill
16231 !! wikitext
16232 [[es:1]]
16233 [[es:2]]
16234 [[fr:1]]
16235 [[fr:2]]
16236 !! html/php
16237 es:1 fr:1
16238 !! html/parsoid
16239 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/1"/>
16240 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/2"/>
16241 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/1"/>
16242 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/2"/>
16243 !! end
16244
16245 ###
16246 ### Sections
16247 ###
16248 !! test
16249 Basic section headings
16250 !! wikitext
16251 == Headline 1 ==
16252 Some text
16253
16254 ==Headline 2==
16255 More
16256 ===Smaller headline===
16257 Blah blah
16258 !! html
16259 <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>
16260 <p>Some text
16261 </p>
16262 <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>
16263 <p>More
16264 </p>
16265 <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>
16266 <p>Blah blah
16267 </p>
16268 !! end
16269
16270 !! test
16271 Section headings with TOC
16272 !! wikitext
16273 == Headline 1 ==
16274 === Subheadline 1 ===
16275 ===== Skipping a level =====
16276 ====== Skipping a level ======
16277
16278 == Headline 2 ==
16279 Some text
16280 ===Another headline===
16281 !! html
16282 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
16283 <ul>
16284 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
16285 <ul>
16286 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
16287 <ul>
16288 <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>
16289 <ul>
16290 <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>
16291 </ul>
16292 </li>
16293 </ul>
16294 </li>
16295 </ul>
16296 </li>
16297 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
16298 <ul>
16299 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
16300 </ul>
16301 </li>
16302 </ul>
16303 </div>
16304
16305 <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>
16306 <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>
16307 <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>
16308 <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>
16309 <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>
16310 <p>Some text
16311 </p>
16312 <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>
16313
16314 !! end
16315
16316 !! test
16317 TOC anchors don't collide
16318 !! wikitext
16319 __FORCETOC__
16320 == Headline 2 ==
16321 == Headline ==
16322 == Headline 2 ==
16323 == Headline ==
16324 !! html/php
16325 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
16326 <ul>
16327 <li class="toclevel-1 tocsection-1"><a href="#Headline_2"><span class="tocnumber">1</span> <span class="toctext">Headline 2</span></a></li>
16328 <li class="toclevel-1 tocsection-2"><a href="#Headline"><span class="tocnumber">2</span> <span class="toctext">Headline</span></a></li>
16329 <li class="toclevel-1 tocsection-3"><a href="#Headline_2_2"><span class="tocnumber">3</span> <span class="toctext">Headline 2</span></a></li>
16330 <li class="toclevel-1 tocsection-4"><a href="#Headline_3"><span class="tocnumber">4</span> <span class="toctext">Headline</span></a></li>
16331 </ul>
16332 </div>
16333
16334 <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>
16335 <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>
16336 <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>
16337 <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>
16338
16339 !! end
16340
16341 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
16342 !! test
16343 Handling of sections up to level 6 and beyond
16344 !! wikitext
16345 = Level 1 Heading=
16346 == Level 2 Heading==
16347 === Level 3 Heading===
16348 ==== Level 4 Heading====
16349 ===== Level 5 Heading=====
16350 ====== Level 6 Heading======
16351 ======= Level 7 Heading=======
16352 ======== Level 8 Heading========
16353 ========= Level 9 Heading=========
16354 ========== Level 10 Heading==========
16355 !! html
16356 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
16357 <ul>
16358 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
16359 <ul>
16360 <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>
16361 <ul>
16362 <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>
16363 <ul>
16364 <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>
16365 <ul>
16366 <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>
16367 <ul>
16368 <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>
16369 <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>
16370 <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>
16371 <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>
16372 <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>
16373 </ul>
16374 </li>
16375 </ul>
16376 </li>
16377 </ul>
16378 </li>
16379 </ul>
16380 </li>
16381 </ul>
16382 </li>
16383 </ul>
16384 </div>
16385
16386 <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>
16387 <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>
16388 <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>
16389 <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>
16390 <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>
16391 <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>
16392 <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>
16393 <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>
16394 <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>
16395 <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>
16396
16397 !! end
16398
16399 !! test
16400 TOC regression (T11764)
16401 !! wikitext
16402 == title 1 ==
16403 === title 1.1 ===
16404 ==== title 1.1.1 ====
16405 === title 1.2 ===
16406 == title 2 ==
16407 === title 2.1 ===
16408 !! html
16409 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
16410 <ul>
16411 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
16412 <ul>
16413 <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>
16414 <ul>
16415 <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>
16416 </ul>
16417 </li>
16418 <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>
16419 </ul>
16420 </li>
16421 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
16422 <ul>
16423 <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>
16424 </ul>
16425 </li>
16426 </ul>
16427 </div>
16428
16429 <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>
16430 <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>
16431 <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>
16432 <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>
16433 <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>
16434 <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>
16435
16436 !! end
16437
16438 !! test
16439 TOC for heading containing <span id="..."></span> (T96153)
16440 !! wikitext
16441 __FORCETOC__
16442 ==<span id="old-anchor"></span>New title==
16443 !! html/php
16444 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
16445 <ul>
16446 <li class="toclevel-1 tocsection-1"><a href="#New_title"><span class="tocnumber">1</span> <span class="toctext">New title</span></a></li>
16447 </ul>
16448 </div>
16449
16450 <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>
16451
16452 !! end
16453
16454 !! test
16455 TOC with wgMaxTocLevel=3 (T8204)
16456 !! options
16457 wgMaxTocLevel=3
16458 !! wikitext
16459 == title 1 ==
16460 === title 1.1 ===
16461 ==== title 1.1.1 ====
16462 === title 1.2 ===
16463 == title 2 ==
16464 === title 2.1 ===
16465 !! html
16466 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
16467 <ul>
16468 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
16469 <ul>
16470 <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>
16471 <li class="toclevel-2 tocsection-4"><a href="#title_1.2"><span class="tocnumber">1.2</span> <span class="toctext">title 1.2</span></a></li>
16472 </ul>
16473 </li>
16474 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
16475 <ul>
16476 <li class="toclevel-2 tocsection-6"><a href="#title_2.1"><span class="tocnumber">2.1</span> <span class="toctext">title 2.1</span></a></li>
16477 </ul>
16478 </li>
16479 </ul>
16480 </div>
16481
16482 <h2><span class="mw-headline" id="title_1">title 1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: title 1">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
16483 <h3><span class="mw-headline" id="title_1.1">title 1.1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: title 1.1">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
16484 <h4><span class="mw-headline" id="title_1.1.1">title 1.1.1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: title 1.1.1">edit</a><span class="mw-editsection-bracket">]</span></span></h4>
16485 <h3><span class="mw-headline" id="title_1.2">title 1.2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: title 1.2">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
16486 <h2><span class="mw-headline" id="title_2">title 2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: title 2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
16487 <h3><span class="mw-headline" id="title_2.1">title 2.1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: title 2.1">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
16488
16489 !! end
16490
16491 !! test
16492 TOC with wgMaxTocLevel=3 and two level four headings (T8204)
16493 !! options
16494 wgMaxTocLevel=3
16495 !! wikitext
16496 ==Section 1==
16497 ===Section 1.1===
16498 ====Section 1.1.1====
16499 ====Section 1.1.1.1====
16500 ==Section 2==
16501 !! html
16502 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
16503 <ul>
16504 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
16505 <ul>
16506 <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>
16507 </ul>
16508 </li>
16509 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
16510 </ul>
16511 </div>
16512
16513 <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>
16514 <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>
16515 <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>
16516 <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>
16517 <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>
16518
16519 !! end
16520
16521
16522 !! test
16523 Resolving duplicate section names
16524 !! wikitext
16525 == Foo bar ==
16526 == Foo bar ==
16527 !! html
16528 <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>
16529 <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>
16530
16531 !! end
16532
16533 !! test
16534 Resolving duplicate section names with differing case (T12721)
16535 !! wikitext
16536 == Foo bar ==
16537 == Foo Bar ==
16538 !! html
16539 <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>
16540 <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>
16541
16542 !! end
16543
16544 !! article
16545 Template:sections
16546 !! text
16547 ===Section 1===
16548 ==Section 2==
16549 !! endarticle
16550
16551 !! test
16552 Template with sections, __NOTOC__
16553 !! wikitext
16554 __NOTOC__
16555 ==Section 0==
16556 {{sections}}
16557 ==Section 4==
16558 !! html
16559 <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>
16560 <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>
16561 <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>
16562 <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>
16563
16564 !! end
16565
16566 !! test
16567 __NOEDITSECTION__ keyword
16568 !! wikitext
16569 __NOEDITSECTION__
16570 ==Section 1==
16571 ==Section 2==
16572 !! html
16573 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
16574 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
16575
16576 !! end
16577
16578 !! test
16579 Link inside a section heading
16580 !! wikitext
16581 ==Section with a [[Main Page|link]] in it==
16582 !! html
16583 <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>
16584
16585 !! end
16586
16587 !! test
16588 TOC regression (T14077)
16589 !! wikitext
16590 __TOC__
16591 == title 1 ==
16592 === title 1.1 ===
16593 == title 2 ==
16594 !! html
16595 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
16596 <ul>
16597 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
16598 <ul>
16599 <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>
16600 </ul>
16601 </li>
16602 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
16603 </ul>
16604 </div>
16605
16606 <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>
16607 <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>
16608 <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>
16609
16610 !! end
16611
16612 !! test
16613 T3219 URL next to image (good)
16614 !! wikitext
16615 http://example.com [[File:Foobar.jpg]]
16616 !! html/php
16617 <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>
16618 </p>
16619 !! html/parsoid
16620 <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>
16621 !!end
16622
16623 !! test
16624 Short headings with trailing space should match behavior of Parser::doHeadings (T21910)
16625 !! wikitext
16626 ===
16627 The line above must have a trailing space!
16628 === <!--
16629 --> <!-- -->
16630 But just in case it doesn't...
16631 !! html
16632 <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>
16633 <p>The line above must have a trailing space!
16634 </p>
16635 <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>
16636 <p>But just in case it doesn't...
16637 </p>
16638 !! end
16639
16640 !! test
16641 Header with special characters (T27462)
16642 !! wikitext
16643 The tooltips shall not show entities to the user (ie. be double escaped)
16644
16645 == text > text ==
16646 section 1
16647
16648 == text < text ==
16649 section 2
16650
16651 == text & text ==
16652 section 3
16653
16654 == text ' text ==
16655 section 4
16656
16657 == text " text ==
16658 section 5
16659 !! html
16660 <p>The tooltips shall not show entities to the user (ie. be double escaped)
16661 </p>
16662 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
16663 <ul>
16664 <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>
16665 <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>
16666 <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>
16667 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
16668 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
16669 </ul>
16670 </div>
16671
16672 <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>
16673 <p>section 1
16674 </p>
16675 <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>
16676 <p>section 2
16677 </p>
16678 <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>
16679 <p>section 3
16680 </p>
16681 <h2><span class="mw-headline" id="text_.27_text">text ' text</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: text ' text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
16682 <p>section 4
16683 </p>
16684 <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>
16685 <p>section 5
16686 </p>
16687 !! end
16688
16689 !! test
16690 Header with space, plus and underscore as entity
16691 !! wikitext
16692 Id should not contain + for spaces
16693
16694 == Space between Text ==
16695 section 1
16696
16697 == Space-Entity&#32;between&#32;Text ==
16698 section 2
16699
16700 == Plus+between+Text ==
16701 section 3
16702
16703 == Plus-Entity&#43;between&#43;Text ==
16704 section 4
16705
16706 == Underscore_between_Text ==
16707 section 5
16708
16709 == Underscore-Entity&#95;between&#95;Text ==
16710 section 6
16711
16712 [[#Space between Text]]
16713 [[#Space-Entity&#32;between&#32;Text]]
16714 [[#Plus+between+Text]]
16715 [[#Plus-Entity&#43;between&#43;Text]]
16716 [[#Underscore_between_Text]]
16717 [[#Underscore-Entity&#95;between&#95;Text]]
16718 !! html
16719 <p>Id should not contain + for spaces
16720 </p>
16721 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
16722 <ul>
16723 <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>
16724 <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>
16725 <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>
16726 <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>
16727 <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>
16728 <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>
16729 </ul>
16730 </div>
16731
16732 <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>
16733 <p>section 1
16734 </p>
16735 <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>
16736 <p>section 2
16737 </p>
16738 <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>
16739 <p>section 3
16740 </p>
16741 <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>
16742 <p>section 4
16743 </p>
16744 <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>
16745 <p>section 5
16746 </p>
16747 <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>
16748 <p>section 6
16749 </p><p><a href="#Space_between_Text">#Space between Text</a>
16750 <a href="#Space-Entity_between_Text">#Space-Entity&#32;between&#32;Text</a>
16751 <a href="#Plus.2Bbetween.2BText">#Plus+between+Text</a>
16752 <a href="#Plus-Entity.2Bbetween.2BText">#Plus-Entity&#43;between&#43;Text</a>
16753 <a href="#Underscore_between_Text">#Underscore_between_Text</a>
16754 <a href="#Underscore-Entity_between_Text">#Underscore-Entity&#95;between&#95;Text</a>
16755 </p>
16756 !! end
16757
16758 !! test
16759 Headers with excess '=' characters
16760 (Are similar tests necessary beyond the 1st level?)
16761 !! wikitext
16762 =foo==
16763 ==foo=
16764 =''italic'' heading==
16765 ==''italic'' heading=
16766 !! html
16767 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
16768 <ul>
16769 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
16770 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
16771 <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>
16772 <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>
16773 </ul>
16774 </div>
16775
16776 <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>
16777 <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>
16778 <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>
16779 <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>
16780
16781 !! end
16782
16783 !! test
16784 HTML headers vs TOC (T25393)
16785 (__NOEDITSECTION__ for clearer output, doesn't matter here)
16786 !! wikitext
16787 <h1>Header 1</h1>
16788 == Header 1.1 ==
16789 == Header 1.2 ==
16790
16791 <h1>Header 2
16792 </h1>
16793 == Header 2.1 ==
16794 == Header 2.2 ==
16795 __NOEDITSECTION__
16796 !! html
16797 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
16798 <ul>
16799 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
16800 <ul>
16801 <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>
16802 <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>
16803 </ul>
16804 </li>
16805 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
16806 <ul>
16807 <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>
16808 <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>
16809 </ul>
16810 </li>
16811 </ul>
16812 </div>
16813
16814 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
16815 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
16816 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
16817 <h1><span class="mw-headline" id="Header_2">Header 2</span></h1>
16818 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
16819 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
16820
16821 !! end
16822
16823 !! test
16824 Single-line or multiline-comments can follow headings
16825 !! options
16826 parsoid=wt2html,wt2wt
16827 !! wikitext
16828 ==foo==<!---->
16829 ==bar==<!--c1-->
16830 ==baz==<!--
16831 c2
16832 c3-->
16833 !! html
16834 <h2><span class="mw-headline" id="foo">foo</span></h2>
16835 <h2><span class="mw-headline" id="bar">bar</span></h2>
16836 <h2><span class="mw-headline" id="baz">baz</span></h2>
16837
16838 !! end
16839
16840 !! test
16841 T3219 URL next to image (broken)
16842 !! wikitext
16843 http://example.com[[File:Foobar.jpg]]
16844 !! html/php
16845 <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>
16846 </p>
16847 !! html/parsoid
16848 <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>
16849 !!end
16850
16851 !! test
16852 T3186 news: in the middle of text
16853 !! wikitext
16854 http://en.wikinews.org/wiki/Wikinews:Workplace
16855 !! html
16856 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
16857 </p>
16858 !!end
16859
16860
16861 !! test
16862 Namespaced link must have a title
16863 !! wikitext
16864 [[Project:]]
16865 !! html
16866 <p>[[Project:]]
16867 </p>
16868 !!end
16869
16870 !! test
16871 Namespaced link must have a title (bad fragment version)
16872 !! wikitext
16873 [[Project:#fragment]]
16874 !! html
16875 <p>[[Project:#fragment]]
16876 </p>
16877 !!end
16878
16879
16880 ###
16881 ### HTML tags and HTML attributes
16882 ###
16883
16884 !! test
16885 div with no attributes
16886 !! wikitext
16887 <div>HTML rocks</div>
16888 !! html
16889 <div>HTML rocks</div>
16890
16891 !! end
16892
16893 !! test
16894 div with double-quoted attribute
16895 !! wikitext
16896 <div id="rock">HTML rocks</div>
16897 !! html
16898 <div id="rock">HTML rocks</div>
16899
16900 !! end
16901
16902 !! test
16903 div with single-quoted attribute
16904 !! wikitext
16905 <div id='rock'>HTML rocks</div>
16906 !! html
16907 <div id="rock">HTML rocks</div>
16908
16909 !! end
16910
16911 !! test
16912 div with unquoted attribute
16913 !! wikitext
16914 <div id=rock>HTML rocks</div>
16915 !! html
16916 <div id="rock">HTML rocks</div>
16917
16918 !! end
16919
16920 !! test
16921 div with illegal double attributes
16922 !! wikitext
16923 <div id="a" id="b">HTML rocks</div>
16924 !! html
16925 <div id="b">HTML rocks</div>
16926
16927 !!end
16928
16929 !! test
16930 div with empty attribute value, space before equals
16931 !! options
16932 parsoid=wt2html,html2html
16933 !! wikitext
16934 <div class =>HTML rocks</div>
16935 !! html/php
16936 <div class="">HTML rocks</div>
16937
16938 !! html/parsoid
16939 <div class="" data-parsoid='{"stx":"html"}'>HTML rocks</div>
16940 !! end
16941
16942 !! test
16943 div with multiple empty attribute values
16944 !! options
16945 parsoid=wt2html,html2html
16946 !! wikitext
16947 <div id= title=>HTML rocks</div>
16948 !! html/php
16949 <div id="title.3D">HTML rocks</div>
16950
16951 !! html/parsoid
16952 <div id="title.3D" data-parsoid='{"stx":"html"}'>HTML rocks</div>
16953 !! end
16954
16955 !! test
16956 table with multiple empty attribute values
16957 !! options
16958 parsoid=wt2html,html2html
16959 !! wikitext
16960 {| title= id=
16961 | hi
16962 |}
16963 !! html/php
16964 <table title="id=">
16965 <tr>
16966 <td> hi
16967 </td></tr></table>
16968
16969 !! html/parsoid
16970 <table title="id=">
16971 <tbody><tr><td> hi</td></tr>
16972 </tbody></table>
16973 !! end
16974
16975 !! test
16976 div with braces in attribute value
16977 !! wikitext
16978 <div title="{}">Foo</div>
16979 !! html/php
16980 <div title="&#123;&#125;">Foo</div>
16981
16982 !! html/parsoid
16983 <div title="{}">Foo</div>
16984 !! end
16985
16986 !! test
16987 div with empty attribute value, no space before equals
16988 !! options
16989 parsoid=wt2html,html2html
16990 !! wikitext
16991 <div class=>HTML rocks</div>
16992 !! html/php
16993 <div class="">HTML rocks</div>
16994
16995 !! html/parsoid
16996 <div class="">HTML rocks</div>
16997 !! end
16998
16999 !! test
17000 HTML multiple attributes correction
17001 !! wikitext
17002 <p class="error" class="awesome">Awesome!</p>
17003 !! html
17004 <p class="awesome">Awesome!</p>
17005
17006 !!end
17007
17008 !! test
17009 Table multiple attributes correction
17010 !! wikitext
17011 {|
17012 !+ class="error" class="awesome"| status
17013 |}
17014 !! html
17015 <table>
17016 <tr>
17017 <th class="awesome"> status
17018 </th></tr></table>
17019
17020 !!end
17021
17022 !! test
17023 DIV IN UPPERCASE
17024 !! wikitext
17025 <DIV ID="x">HTML ROCKS</DIV>
17026 !! html
17027 <div id="x">HTML ROCKS</div>
17028
17029 !!end
17030
17031 !! test
17032 Non-ASCII pseudo-tags are rendered as text
17033 !! wikitext
17034 <khyô>
17035 !! html
17036 <p>&lt;khyô&gt;
17037 </p>
17038 !! end
17039
17040 !! test
17041 Pseudo-tag with URL 'name' renders as url link
17042 !! wikitext
17043 <http://example.com/>
17044 !! html
17045 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
17046 </p>
17047 !! end
17048
17049 !! test
17050 text with amp in the middle of nowhere
17051 !! wikitext
17052 Remember AT&T?
17053 !! html
17054 <p>Remember AT&amp;T?
17055 </p>
17056 !! end
17057
17058 !! test
17059 text with character entity: eacute
17060 !! wikitext
17061 I always thought &eacute; was a cute letter.
17062 !! html
17063 <p>I always thought &#233; was a cute letter.
17064 </p>
17065 !! html+tidy
17066 <p>I always thought é was a cute letter.</p>
17067 !! end
17068
17069 !! test
17070 text with entity-escaped character entity-like string: eacute
17071 !! wikitext
17072 I always thought &amp;eacute; was a cute letter.
17073 !! html
17074 <p>I always thought &amp;eacute; was a cute letter.
17075 </p>
17076 !! end
17077
17078 !! test
17079 text with undefined character entity: xacute
17080 !! wikitext
17081 I always thought &xacute; was a cute letter.
17082 !! html
17083 <p>I always thought &amp;xacute; was a cute letter.
17084 </p>
17085 !! end
17086
17087 !! test
17088 HTML5 tags
17089 !! wikitext
17090 <data value="5">five</data>
17091 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
17092 <mark>This highlighted text</mark>
17093 !! html
17094 <p><data value="5">five</data>
17095 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
17096 <mark>This highlighted text</mark>
17097 </p>
17098 !! end
17099
17100 !! test
17101 HTML tag with leading space is parsed as text
17102 !! wikitext
17103 < div>foo< /div>
17104 !! html
17105 <p>&lt; div&gt;foo&lt; /div&gt;
17106 </p>
17107 !! end
17108
17109 ## Don't expect Parsoid and PHP to match, since PHP isn't exactly following
17110 ## the HTML5 parsing spec.
17111 !! test
17112 Element with broken attribute syntax
17113 !! options
17114 parsoid=wt2html
17115 !! wikitext
17116 <div style=" style="123">hi</div>
17117 <div =>ho</div>
17118 !! html/php
17119 <div style="123">hi</div>
17120 <div>ho</div>
17121
17122 !! html/parsoid
17123 <div style=" style=" data-parsoid='{"stx":"html","a":{"123\"":null},"sa":{"123\"":""}}'>hi</div>
17124 <div data-parsoid='{"stx":"html","a":{"=":null},"sa":{"=":""}}'>ho</div>
17125 !! end
17126
17127 ###
17128 ### Nesting tests (see T43545, T52604, T53081)
17129 ###
17130
17131 # This test case is fixed in Parsoid by domino 1.0.12. (T52604)
17132 # Note that html2wt is considerably more difficult if we use <b> in
17133 # the test case, instead of <small>
17134 !! test
17135 Ensure that HTML adoption agency algorithm is properly implemented.
17136 !! wikitext
17137 <small>X<small>Y</small>Z</small>
17138 !! html
17139 <p><small>X<small>Y</small>Z</small>
17140 </p>
17141 !! end
17142
17143 # This was T43545 in the PHP parser.
17144 # Note that tidy doesn't handle this correctly.
17145 !! test
17146 Nesting of <kbd>
17147 !! wikitext
17148 <kbd>X<kbd>Y</kbd>Z</kbd>
17149 !! html
17150 <p><kbd>X<kbd>Y</kbd>Z</kbd>
17151 </p>
17152 !! end
17153
17154 # The following cases were T53081 in the PHP parser.
17155 # Note that there are some other nestable tags (b, i, etc) which are
17156 # not covered; see T53081 for discussion.
17157
17158 # Note that tidy doesn't handle this correctly.
17159 !! test
17160 Nesting of <em>
17161 !! wikitext
17162 <em>X<em>Y</em>Z</em>
17163 !! html
17164 <p><em>X<em>Y</em>Z</em>
17165 </p>
17166 !! end
17167
17168 # Note that tidy doesn't handle this correctly.
17169 !! test
17170 Nesting of <strong>
17171 !! wikitext
17172 <strong>X<strong>Y</strong>Z</strong>
17173 !! html
17174 <p><strong>X<strong>Y</strong>Z</strong>
17175 </p>
17176 !! end
17177
17178 !! test
17179 Nesting of <q>
17180 !! wikitext
17181 <q>X<q>Y</q>Z</q>
17182 !! html+tidy
17183 <p><q>X<q>Y</q>Z</q></p>
17184 !! end
17185
17186 # Note that tidy doesn't handle this correctly.
17187 !! test
17188 Nesting of <ruby>
17189 !! wikitext
17190 <ruby>X<ruby>Y</ruby>Z</ruby>
17191 !! html
17192 <p><ruby>X<ruby>Y</ruby>Z</ruby>
17193 </p>
17194 !! end
17195
17196 # Note that tidy doesn't handle this correctly.
17197 !! test
17198 Nesting of <bdo>
17199 !! wikitext
17200 <bdo>X<bdo>Y</bdo>Z</bdo>
17201 !! html
17202 <p><bdo>X<bdo>Y</bdo>Z</bdo>
17203 </p>
17204 !! end
17205
17206
17207 ###
17208 ### Media links
17209 ###
17210
17211 !! test
17212 Media link
17213 !! wikitext
17214 [[Media:Foobar.jpg]]
17215 [[Media:Video.ogv]]
17216 [[:Media:Video.ogv]]
17217 !! html/php
17218 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
17219 <a href="http://example.com/images/0/00/Video.ogv" class="internal" title="Video.ogv">Media:Video.ogv</a>
17220 <a href="http://example.com/images/0/00/Video.ogv" class="internal" title="Video.ogv">Media:Video.ogv</a>
17221 </p>
17222 !! html/parsoid
17223 <p><a rel="mw:MediaLink" href="//example.com/images/3/3a/Foobar.jpg" title="Foobar.jpg">Media:Foobar.jpg</a>
17224 <a rel="mw:MediaLink" href="//example.com/images/0/00/Video.ogv" title="Video.ogv">Media:Video.ogv</a>
17225 <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>
17226 !! end
17227
17228 !! test
17229 Media link with text
17230 !! wikitext
17231 [[Media:Foobar.jpg|A neat file to look at]]
17232 !! html/php
17233 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
17234 </p>
17235 !! html/parsoid
17236 <p><a rel="mw:MediaLink" href="//example.com/images/3/3a/Foobar.jpg" title="Foobar.jpg">A neat file to look at</a></p>
17237 !! end
17238
17239 # FIXME: this is still bad HTML tag nesting
17240 # FIXME: doBlockLevels won't wrap this in a paragraph because it contains a div
17241 !! test
17242 Media link with nasty text
17243 !! wikitext
17244 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
17245 !! html/php
17246 <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>
17247
17248 !! html+php/tidy
17249 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Safe Link</a></p>
17250 <div style="display:none">" onmouseover="alert(document.cookie)" onfoo="</div>
17251 !! html/parsoid
17252 <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>
17253
17254 !! end
17255
17256 !! test
17257 Media link to nonexistent file (T3702)
17258 !! wikitext
17259 [[Media:No such.jpg]]
17260 [[Media:No_such file.jpg]]
17261 !! html/php
17262 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
17263 <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>
17264 </p>
17265 !! html/parsoid
17266 <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>
17267 <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>
17268 !! end
17269
17270 !! test
17271 Image link to nonexistent file (T3850 - good)
17272 !! wikitext
17273 [[File:No_such.jpg]]
17274 !! html/php
17275 <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>
17276 </p>
17277 !! html/parsoid
17278 <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>
17279 !! end
17280
17281 !! test
17282 :Image link to nonexistent file (T3850 - bad)
17283 !! wikitext
17284 [[:Image:No such.jpg]]
17285 !! html/php
17286 <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>
17287 </p>
17288 !! html/parsoid
17289 <p><a rel="mw:WikiLink" href="./File:No_such.jpg" title="File:No such.jpg">Image:No such.jpg</a></p>
17290 !! end
17291
17292 !! test
17293 Character reference normalization in link text (T3938)
17294 !! wikitext
17295 [[Main Page|this&that]]
17296 !! html
17297 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
17298 </p>
17299 !!end
17300
17301 !! article
17302 אַ
17303 !! text
17304 Test for unicode normalization
17305
17306 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
17307 !! endarticle
17308
17309 !! test
17310 (T21451) Links should refer to the normalized form.
17311 !! wikitext
17312 [[&#xFB2E;]]
17313 [[&#x5d0;&#x5b7;]]
17314 [[&#x5d0;ַ]]
17315 [[א&#x5b7;]]
17316 [[אַ]]
17317 !! html
17318 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
17319 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
17320 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
17321 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
17322 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
17323 </p>
17324 !! end
17325
17326 !! test
17327 Empty attribute crash test (T4067)
17328 !! wikitext
17329 <font color="">foo</font>
17330 !! html
17331 <p><font color="">foo</font>
17332 </p>
17333 !! end
17334
17335 !! test
17336 Empty attribute crash test single-quotes (T4067)
17337 !! wikitext
17338 <font color=''>foo</font>
17339 !! html
17340 <p><font color="">foo</font>
17341 </p>
17342 !! end
17343
17344 !! test
17345 Attribute test: equals, then nothing
17346 !! options
17347 parsoid=wt2html,html2html
17348 !! wikitext
17349 <font color=>foo</font>
17350 !! html/php
17351 <p><font color="">foo</font>
17352 </p>
17353 !! html/parsoid
17354 <p><font color="" data-parsoid='{"stx":"html"}'>foo</font></p>
17355 !! end
17356
17357 !! test
17358 Attribute test: unquoted value
17359 !! options
17360 parsoid=wt2html,html2html
17361 !! wikitext
17362 <font color=x>foo</font>
17363 !! html/php
17364 <p><font color="x">foo</font>
17365 </p>
17366 !! html/parsoid
17367 <p><font color="x" data-parsoid='{"stx":"html"}'>foo</font></p>
17368 !! end
17369
17370 !! test
17371 Attribute test: unquoted but illegal value (hash)
17372 !! wikitext
17373 <font color=#x>foo</font>
17374 !! html
17375 <p><font color="#x">foo</font>
17376 </p>
17377 !! end
17378
17379 # Parsoid does not serialize to empty attribute syntax,
17380 # so wt2wt and html2wt cases are skipped
17381 !! test
17382 Attribute test: no value (T54330)
17383 !! options
17384 parsoid=wt2html,html2html
17385 !! wikitext
17386 <font color>foo</font>
17387 !! html/php
17388 <p><font color="">foo</font>
17389 </p>
17390 !! html/parsoid
17391 <p><font color="">foo</font></p>
17392 !! end
17393
17394 !! test
17395 T4095: link with three closing brackets
17396 !! wikitext
17397 [[Main Page]]]
17398 !! html/php
17399 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
17400 </p>
17401 !! html/parsoid
17402 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a>]</p>
17403 !! end
17404
17405 !! test
17406 T4095: link with pipe and three closing brackets
17407 !! wikitext
17408 [[Main Page|link]]]
17409 !! html/php
17410 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
17411 </p>
17412 !! html/parsoid
17413 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">link</a>]</p>
17414 !! end
17415
17416 !! test
17417 T4095: link with pipe and three closing brackets, version 2
17418 !! wikitext
17419 [[Main Page|[http://example.com/]]]
17420 !! html/php
17421 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
17422 </p>
17423 !! html/parsoid
17424 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">[http://example.com/]</a></p>
17425 !! end
17426
17427
17428 ###
17429 ### Safety
17430 ###
17431
17432 !! article
17433 Template:Dangerous attribute
17434 !! text
17435 " onmouseover="alert(document.cookie)
17436 !! endarticle
17437
17438 !! article
17439 Template:Dangerous style attribute
17440 !! text
17441 border-size: expression(alert(document.cookie))
17442 !! endarticle
17443
17444 !! article
17445 Template:Div style
17446 !! text
17447 <div style="float: right; {{{1}}}">Magic div</div>
17448 !! endarticle
17449
17450 !! test
17451 T4304: HTML attribute safety (safe template; regression T4309)
17452 !! wikitext
17453 <div title="{{test}}"></div>
17454 !! html/php
17455 <div title="This is a test template"></div>
17456
17457 !! html/parsoid
17458 <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>
17459 !! end
17460
17461 # Parsoid has enough context to handle this case
17462 !! test
17463 T4304: HTML attribute safety (dangerous template; 2309)
17464 !! wikitext
17465 <div title="{{dangerous attribute}}"></div>
17466 !! html/php
17467 <div title=""></div>
17468
17469 !! html/parsoid
17470 <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>
17471 !! end
17472
17473 !! test
17474 T4304: HTML attribute safety (dangerous style template; 2309)
17475 !! wikitext
17476 <div style="{{dangerous style attribute}}"></div>
17477 !! html/php
17478 <div style="/* insecure input */"></div>
17479
17480 !! html/parsoid
17481 <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>
17482 !! end
17483
17484 !! test
17485 T4304: HTML attribute safety (safe parameter; 2309)
17486 !! wikitext
17487 {{div style|width: 200px}}
17488 !! html/php
17489 <div style="float: right; width: 200px">Magic div</div>
17490
17491 !! html/parsoid
17492 <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>
17493 !! end
17494
17495 !! test
17496 T4304: HTML attribute safety (unsafe parameter; 2309)
17497 !! wikitext
17498 {{div style|width: expression(alert(document.cookie))}}
17499 !! html/php
17500 <div style="/* insecure input */">Magic div</div>
17501
17502 !! html/parsoid
17503 <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>
17504 !! end
17505
17506 ## Parsoid output here differs; needs investigation.
17507 !! test
17508 T4304: HTML attribute safety (unsafe breakout parameter; 2309)
17509 !! wikitext
17510 {{div style|"><script>alert(document.cookie)</script>}}
17511 !! html
17512 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
17513
17514 !! end
17515
17516 ## Parsoid output here differs; needs investigation.
17517 !! test
17518 T4304: HTML attribute safety (unsafe breakout parameter 2; 2309)
17519 !! wikitext
17520 {{div style|" ><script>alert(document.cookie)</script>}}
17521 !! html
17522 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
17523
17524 !! end
17525
17526 !! test
17527 T4304: HTML attribute safety (link)
17528 !! wikitext
17529 <div title="[[Main Page]]"></div>
17530 !! html
17531 <div title="&#91;&#91;Main Page]]"></div>
17532
17533 !! end
17534
17535 !! test
17536 T4304: HTML attribute safety (italics)
17537 !! wikitext
17538 <div title="''foobar''"></div>
17539 !! html
17540 <div title="&#39;&#39;foobar&#39;&#39;"></div>
17541
17542 !! end
17543
17544 !! test
17545 T4304: HTML attribute safety (bold)
17546 !! wikitext
17547 <div title="'''foobar'''"></div>
17548 !! html
17549 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
17550
17551 !! end
17552
17553 !! test
17554 T4304: HTML attribute safety (ISBN)
17555 !! wikitext
17556 <div title="ISBN 1234567890"></div>
17557 !! html
17558 <div title="&#73;SBN 1234567890"></div>
17559
17560 !! end
17561
17562 !! test
17563 T4304: HTML attribute safety (RFC)
17564 !! wikitext
17565 <div title="RFC 1234"></div>
17566 !! html
17567 <div title="&#82;FC 1234"></div>
17568
17569 !! end
17570
17571 !! test
17572 T4304: HTML attribute safety (PMID)
17573 !! wikitext
17574 <div title="PMID 1234567890"></div>
17575 !! html
17576 <div title="&#80;MID 1234567890"></div>
17577
17578 !! end
17579
17580 !! test
17581 T4304: HTML attribute safety (web link)
17582 !! wikitext
17583 <div title="http://example.com/"></div>
17584 !! html
17585 <div title="http&#58;//example.com/"></div>
17586
17587 !! end
17588
17589 !! test
17590 T4304: HTML attribute safety (named web link)
17591 !! wikitext
17592 <div title="[http://example.com/ link]"></div>
17593 !! html
17594 <div title="&#91;http&#58;//example.com/ link]"></div>
17595
17596 !! end
17597
17598 !! test
17599 T5244: HTML attribute safety (extension; safe)
17600 !! wikitext
17601 <div style="<nowiki>background:blue</nowiki>"></div>
17602 !! html/php
17603 <div style="background:blue"></div>
17604
17605 !! html/parsoid
17606 <div style="background:blue" data-parsoid='{"stx":"html","a":{"style":"background:blue"},"sa":{"style":"&lt;nowiki>background:blue&lt;/nowiki>"}}'></div>
17607 !! end
17608
17609 !! test
17610 T5244: HTML attribute safety (extension; unsafe)
17611 !! wikitext
17612 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
17613 !! html/php
17614 <div style="/* insecure input */"></div>
17615
17616 !! html/parsoid
17617 <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>
17618 !! end
17619
17620 # More MSIE fun discovered by Tom Gilder
17621
17622 !! test
17623 MSIE CSS safety test: spurious slash
17624 !! wikitext
17625 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
17626 !! html/php
17627 <div style="/* insecure input */">evil</div>
17628
17629 !! html/parsoid
17630 <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>
17631 !! end
17632
17633 !! test
17634 MSIE CSS safety test: hex code
17635 !! wikitext
17636 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
17637 !! html/php
17638 <div style="/* insecure input */">evil</div>
17639
17640 !! html/parsoid
17641 <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>
17642 !! end
17643
17644 !! test
17645 MSIE CSS safety test: comment in url
17646 !! wikitext
17647 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
17648 !! html/php
17649 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
17650
17651 !! html/parsoid
17652 <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>
17653 !! end
17654
17655 !! test
17656 MSIE CSS safety test: comment in expression
17657 !! wikitext
17658 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
17659 !! html/php
17660 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
17661
17662 !! html/parsoid
17663 <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>
17664 !! end
17665
17666 !! test
17667 CSS safety test (all browsers): vertical tab (T57332 / CVE-2013-4567)
17668 !! wikitext
17669 <p style="font-size: 100px; background-image:url\b(https://www.google.com/images/srpr/logo6w.png)">A</p>
17670 !! html/php
17671 <p style="/* invalid control char */">A</p>
17672
17673 !! html/parsoid
17674 <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>
17675 !! end
17676
17677 !! test
17678 MSIE 6 CSS safety test: Fullwidth (T57332)
17679 !! wikitext
17680 <p style="font-size: 100px; color: expression((title='XSSed'),'red')">A</p>
17681 <div style="top:EXPRESSION(alert())">B</div>
17682 !! html/php
17683 <p style="/* insecure input */">A</p>
17684 <div style="/* insecure input */">B</div>
17685
17686 !! html/parsoid
17687 <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>
17688 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"top:EXPRESSION(alert())"}}'>B</div>
17689 !! end
17690
17691 !! test
17692 MSIE 6 CSS safety test: IPA extensions (T57332)
17693 !! wikitext
17694 <div style="background-image:uʀʟ(javascript:alert())">A</div>
17695 <p style="font-size: 100px; color: expʀessɪoɴ((title='XSSed'),'red')">B</p>
17696 !! html/php
17697 <div style="/* insecure input */">A</div>
17698 <p style="/* insecure input */">B</p>
17699
17700 !! html/parsoid
17701 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"background-image:uʀʟ(javascript:alert())"}}'>A</div>
17702 <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>
17703 !! end
17704
17705 !! test
17706 MSIE 6 CSS safety test: sup/sub script (T57332)
17707 !! wikitext
17708 <div style="background-image:url⁽javascript:alert())">A</div>
17709 <div style="background-image:url₍javascript:alert())">B</div>
17710 <p style="font-size: 100px; color: expressioⁿ((title='XSSed'),'red')">C</p>
17711 !! html/php
17712 <div style="/* insecure input */">A</div>
17713 <div style="/* insecure input */">B</div>
17714 <p style="/* insecure input */">C</p>
17715
17716 !! html/parsoid
17717 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"background-image:url⁽javascript:alert())"}}'>A</div>
17718 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"background-image:url₍javascript:alert())"}}'>B</div>
17719 <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>
17720 !! end
17721
17722 !! test
17723 Opera -o-link CSS
17724 !! options
17725 parsoid=wt2html,html2html
17726 !! wikitext
17727 <div
17728 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;"
17729 style="-o-link:attr(title);-o-link-source:current">X</div>
17730 !! html/php
17731 <div title="data:text/html,&lt;img src=1 onerror=alert(1)&gt;" style="/* insecure input */">X</div>
17732
17733 !! html/parsoid
17734 <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>
17735 !! end
17736
17737 !! test
17738 MSIE 6 CSS safety test: Repetition markers (T57332)
17739 !! wikitext
17740 <p style="font-size: 100px; color: expres〱ion((title='XSSed'),'red')">A</p>
17741 <p style="font-size: 100px; color: expresゝion((title='XSSed'),'red')">B</p>
17742 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">C</p>
17743 <p style="font-size: 100px; color: expresヽion((title='XSSed'),'red')">D</p>
17744 <p style="font-size: 100px; color: expresﹽion((title='XSSed'),'red')">E</p>
17745 <p style="font-size: 100px; color: expresﹼion((title='XSSed'),'red')">F</p>
17746 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">G</p>
17747 !! html/php
17748 <p style="/* insecure input */">A</p>
17749 <p style="/* insecure input */">B</p>
17750 <p style="/* insecure input */">C</p>
17751 <p style="/* insecure input */">D</p>
17752 <p style="/* insecure input */">E</p>
17753 <p style="/* insecure input */">F</p>
17754 <p style="/* insecure input */">G</p>
17755
17756 !! html/parsoid
17757 <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>
17758 <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>
17759 <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>
17760 <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>
17761 <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>
17762 <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>
17763 <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>
17764 !! end
17765
17766 !! test
17767 Table attribute legitimate extension
17768 !! wikitext
17769 {|
17770 !+ style="<nowiki>color:blue</nowiki>"| status
17771 |}
17772 !! html
17773 <table>
17774 <tr>
17775 <th style="color:blue"> status
17776 </th></tr></table>
17777
17778 !!end
17779
17780 !! test
17781 Table attribute safety
17782 !! wikitext
17783 {|
17784 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
17785 |}
17786 !! html
17787 <table>
17788 <tr>
17789 <th style="/* insecure input */"> status
17790 </th></tr></table>
17791
17792 !! end
17793
17794 !! test
17795 CSS line continuation 1
17796 !! wikitext
17797 <div style="background-image: u\&#10;rl(test.jpg);"></div>
17798 !! html
17799 <div style="/* insecure input */"></div>
17800
17801 !! end
17802
17803 !! test
17804 CSS line continuation 2
17805 !! wikitext
17806 <div style="background-image: u\&#13;rl(test.jpg); "></div>
17807 !! html
17808 <div style="/* invalid control char */"></div>
17809
17810 !! end
17811
17812 !! article
17813 Template:Identity
17814 !! text
17815 {{{1}}}
17816 !! endarticle
17817
17818 !! test
17819 Expansion of multi-line templates in attribute values (T8255)
17820 !! wikitext
17821 <div style="background: {{identity|#00FF00}}">-</div>
17822 !! html
17823 <div style="background: #00FF00">-</div>
17824
17825 !! end
17826
17827 !! test
17828 Expansion of multi-line templates in attribute values (T8255 sanity check)
17829 !! wikitext
17830 <div style="background:
17831 #00FF00">-</div>
17832 !! html/php
17833 <div style="background: #00FF00">-</div>
17834
17835 !! html/parsoid
17836 <div style="background:
17837 #00FF00">-</div>
17838 !! end
17839
17840 !! test
17841 Expansion of multi-line templates in attribute values (T8255 sanity check 2)
17842 !! wikitext
17843 <div style="background: &#10;#00FF00">-</div>
17844 !! html
17845 <div style="background: &#10;#00FF00">-</div>
17846
17847 !! end
17848
17849 !! test
17850 Tags which are hidden from Tidy cannot pass through the Sanitizer
17851 !! wikitext
17852 <mw:toc><script>alert();</script></mw:toc>
17853 !! html+tidy
17854 <p>&lt;mw:toc&gt;&lt;script&gt;alert();&lt;/script&gt;&lt;/mw:toc&gt;</p>
17855 !! end
17856
17857 ###
17858 ### Parser hooks (see tests/parser/parserTestsParserHook.php for the <tag> extension)
17859 ###
17860
17861 !! test
17862 Parser hook: empty input
17863 !! wikitext
17864 <tag></tag>
17865 !! html/php
17866 <pre>
17867 ''
17868 array (
17869 )
17870 </pre>
17871
17872 !! html/parsoid
17873 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
17874 !! end
17875
17876 ## Don't expect parsoid to rt this form.
17877 !! test
17878 Parser hook: empty input using terminated empty elements
17879 !! options
17880 parsoid=wt2html,html2html
17881 !! wikitext
17882 <tag/>
17883 !! html/php
17884 <pre>
17885 NULL
17886 array (
17887 )
17888 </pre>
17889
17890 !! html/parsoid
17891 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":null}' data-parsoid='{}' about="#mwt2"></pre>
17892 !! end
17893
17894 !! test
17895 Parser hook: empty input using terminated empty elements (space before)
17896 !! wikitext
17897 <tag />
17898 !! html/php
17899 <pre>
17900 NULL
17901 array (
17902 )
17903 </pre>
17904
17905 !! html/parsoid
17906 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":null}' data-parsoid='{}' about="#mwt2"></pre>
17907 !! end
17908
17909 !! test
17910 Parser hook: basic input
17911 !! wikitext
17912 <tag>input</tag>
17913 !! html/php
17914 <pre>
17915 'input'
17916 array (
17917 )
17918 </pre>
17919
17920 !! html/parsoid
17921 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
17922 !! end
17923
17924 ## Don't expect parsoid to rt this form.
17925 !! test
17926 Parser hook: case insensitive
17927 !! options
17928 parsoid=wt2html,html2html
17929 !! wikitext
17930 <TAG>input</TAG>
17931 !! html/php
17932 <pre>
17933 'input'
17934 array (
17935 )
17936 </pre>
17937
17938 !! html/parsoid
17939 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
17940 !! end
17941
17942 ## Don't expect parsoid to rt this form.
17943 !! test
17944 Parser hook: case insensitive, redux
17945 !! options
17946 parsoid=wt2html,html2html
17947 !! wikitext
17948 <TaG>input</TAg>
17949 !! html/php
17950 <pre>
17951 'input'
17952 array (
17953 )
17954 </pre>
17955
17956 !! html/parsoid
17957 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
17958 !! end
17959
17960 !! test
17961 Parser hook: nested tags
17962 !! wikitext
17963 <tag><tag></tag></tag>
17964 !! html/php
17965 <pre>
17966 '<tag>'
17967 array (
17968 )
17969 </pre>&lt;/tag&gt;
17970
17971 !! html/parsoid
17972 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"&lt;tag>"}}' data-parsoid='{}' about="#mwt2"></pre>&lt;/tag>
17973 !! end
17974
17975 !! test
17976 Parser hook: basic arguments
17977 !! wikitext
17978 <tag width="200" height="100" depth="50" square=""></tag>
17979 !! html/php
17980 <pre>
17981 ''
17982 array (
17983 'width' => '200',
17984 'height' => '100',
17985 'depth' => '50',
17986 'square' => '',
17987 )
17988 </pre>
17989
17990 !! html/parsoid
17991 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
17992 !! end
17993
17994 ## Don't expect parsoid to rt this form.
17995 !! test
17996 Parser hook: basic arguments, variations
17997 !! options
17998 parsoid=wt2html,html2html
17999 !! wikitext
18000 <tag width=200 height = "100" depth = '50' square></tag>
18001 !! html/php
18002 <pre>
18003 ''
18004 array (
18005 'width' => '200',
18006 'height' => '100',
18007 'depth' => '50',
18008 'square' => '',
18009 )
18010 </pre>
18011
18012 !! html/parsoid
18013 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
18014 !! end
18015
18016 !! test
18017 Parser hook: argument containing a forward slash (T7344)
18018 !! wikitext
18019 <tag filename="/tmp/bla"></tag>
18020 !! html/php
18021 <pre>
18022 ''
18023 array (
18024 'filename' => '/tmp/bla',
18025 )
18026 </pre>
18027
18028 !! html/parsoid
18029 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"filename":"/tmp/bla"},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
18030 !! end
18031
18032 ## Don't expect parsoid to rt this form.
18033 !! test
18034 Parser hook: empty input using terminated empty elements (T4374)
18035 !! options
18036 parsoid=wt2html,html2html
18037 !! wikitext
18038 <tag foo=bar/>text
18039 !! html/php
18040 <pre>
18041 NULL
18042 array (
18043 'foo' => 'bar',
18044 )
18045 </pre>text
18046
18047 !! html/parsoid
18048 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"foo":"bar"},"body":null}' data-parsoid='{}' about="#mwt2"></pre>text
18049 !! end
18050
18051 ## </tag> should be output literally since there is no matching tag that begins it
18052 ## Don't expect parsoid to rt this form.
18053 !! test
18054 Parser hook: basic arguments using terminated empty elements (T4374)
18055 !! options
18056 parsoid=wt2html
18057 !! wikitext
18058 <tag width=200 height = "100" depth = '50' square/>
18059 other stuff
18060 </tag>
18061 !! html/php
18062 <pre>
18063 NULL
18064 array (
18065 'width' => '200',
18066 'height' => '100',
18067 'depth' => '50',
18068 'square' => '',
18069 )
18070 </pre>
18071 <p>other stuff
18072 &lt;/tag&gt;
18073 </p>
18074 !! html/parsoid
18075 <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
18076 &lt;/tag></p>
18077 !! end
18078
18079 ## Don't expect parsoid to rt this form.
18080 !! test
18081 Parser hook: Don't allow unclosed extension tags
18082 !! options
18083 parsoid=wt2html
18084 !! wikitext
18085 test <tag>123
18086
18087 this is a '''test'''
18088 !! html/php
18089 <p>test &lt;tag&gt;123
18090 </p><p>this is a <b>test</b>
18091 </p>
18092 !! html/parsoid
18093 <p>test &lt;tag>123</p>
18094
18095 <p>this is a <b>test</b></p>
18096 !! end
18097
18098 ###
18099 ### (see tests/parser/parserTestsParserHook.php for the <statictag> extension)
18100 ###
18101
18102 !! test
18103 Parser hook: static parser hook not inside a comment
18104 !! wikitext
18105 <statictag>hello, world</statictag>
18106
18107 <statictag action="flush" />
18108 !! html/php
18109 <p><br />
18110 hello, world
18111 </p>
18112 !! html/parsoid
18113 <p><span typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{},"body":{"extsrc":"hello, world"}}' data-parsoid='{}' about="#mwt2"></span></p>
18114 <p typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{"action":"flush"},"body":null}' data-parsoid='{}' about="#mwt4">hello, world</p>
18115 !! end
18116
18117 !! test
18118 Parser hook: static parser hook inside a comment
18119 !! wikitext
18120 <!-- <statictag>hello, world</statictag> -->
18121 <statictag action="flush" />
18122 !! html/php
18123 <p><br />
18124 </p>
18125 !! html/parsoid
18126 <!-- <statictag&#x3E;hello, world</statictag&#x3E; -->
18127 <p typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{"action":"flush"},"body":null}' data-parsoid='{}' about="#mwt2"></p>
18128 !! end
18129
18130 # Nested template calls; this case was broken by Parser.php rev 1.506,
18131 # since reverted.
18132
18133 !! article
18134 Template:One-parameter
18135 !! text
18136 (My parameter is: {{{1}}})
18137 !! endarticle
18138
18139 !! article
18140 Template:Map-one-parameter
18141 !! text
18142 {{{{{1}}}|{{{2}}}}}
18143 !! endarticle
18144
18145 !! test
18146 Nested template calls
18147 !! wikitext
18148 {{Map-one-parameter|One-parameter|param}}
18149 !! html
18150 <p>(My parameter is: param)
18151 </p>
18152 !! end
18153
18154
18155 ###
18156 ### Sanitizer
18157 ###
18158
18159 # HTML+Tidy effectively strips out the empty tags completely
18160 # But since Parsoid doesn't it wraps the <s></s> tags in p-tags
18161 # which Tidy would have done for the PHP parser had there been content inside it.
18162 !! test
18163 Sanitizer: Closing of open tags
18164 !! wikitext
18165 <s></s><table></table>
18166 !! html
18167 <s></s><table></table>
18168
18169 !! html/parsoid
18170 <p><s></s></p><table></table>
18171 !! end
18172
18173 !! test
18174 Sanitizer: Closing of open but not closed tags
18175 !! wikitext
18176 <s>foo
18177 !! html
18178 <p><s>foo</s>
18179 </p>
18180 !! end
18181
18182 !! test
18183 Sanitizer: Closing of closed but not open tags
18184 !! options
18185 parsoid=wt2html
18186 !! wikitext
18187 </s>
18188 !! html/php+tidy
18189 !! html/parsoid
18190 !! end
18191
18192 !! test
18193 Sanitizer: Closing of closed but not open table tags
18194 !! options
18195 parsoid=wt2html
18196 !! wikitext
18197 Table not started</td></tr></table>
18198 !! html/php+tidy
18199 <p>Table not started</p>
18200 !! html/parsoid
18201 <p>Table not started</p>
18202 !! end
18203
18204 !! test
18205 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
18206 !! wikitext
18207 <span id="æ: v">byte</span>[[#æ: v|backlink]]
18208 !! html/php
18209 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
18210 </p>
18211 !! html/parsoid
18212 <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>
18213 !! end
18214
18215 # In HTML5, the restrictions are that id must contain at least one character,
18216 # and must not contain any space characters.
18217 !! test
18218 Sanitizer: Validating the contents of the id attribute (T6515)
18219 !! options
18220 disabled
18221 !! wikitext
18222 <br id="" /><br id="a space" />
18223 !! html
18224 Something ...
18225 !! end
18226
18227 # In HTML5, id must be unique amongst all the ids in the element's home subtree.
18228 !! test
18229 Sanitizer: Validating id attribute uniqueness (T6515, T8301)
18230 !! options
18231 disabled
18232 !! wikitext
18233 <br id="foo" /><br id="foo" />
18234 !! html
18235 Something need to be done. foo-2 ?
18236 !! end
18237
18238 !! test
18239 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
18240 !! wikitext
18241 <div itemscope>
18242 <meta itemprop="hello" content="world">
18243 <meta http-equiv="refresh" content="5">
18244 <meta itemprop="hello" http-equiv="refresh" content="5">
18245 <link itemprop="hello" href="{{SERVER}}">
18246 <link rel="stylesheet" href="{{SERVER}}">
18247 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
18248 </div>
18249 !! html
18250 <div itemscope="">
18251 <p> <meta itemprop="hello" content="world" />
18252 &lt;meta http-equiv="refresh" content="5"&gt;
18253 <meta itemprop="hello" content="5" />
18254 <link itemprop="hello" href="http&#58;//example.org" />
18255 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
18256 <link itemprop="hello" href="http&#58;//example.org" />
18257 </p>
18258 </div>
18259
18260 !! end
18261
18262 !! test
18263 Sanitizer: Strip comments from CSS attributes
18264 !! options
18265 parsoid=wt2html,wt2wt
18266 !! wikitext
18267 <span style="margin:/*negate mbox-text padding */-0.125em -0.45em; /*rainbow*/rgba(255, 0, 0, 0.3)">2013</span>
18268 !! html/php
18269 <p><span style="margin: -0.125em -0.45em; rgba(255, 0, 0, 0.3)">2013</span>
18270 </p>
18271 !! html/parsoid
18272 <p><span style="margin: -0.125em -0.45em; rgba(255, 0, 0, 0.3)">2013</span></p>
18273 !! end
18274
18275 !! test
18276 Language converter: output gets cut off unexpectedly (T7757)
18277 !! options
18278 language=zh
18279 !! wikitext
18280 this bit is safe: }-
18281
18282 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
18283
18284 then we get cut off here: }-
18285
18286 all additional text is vanished
18287 !! html/php
18288 <p>this bit is safe: }-
18289 </p><p>but if we add a conversion instance: xxx
18290 </p><p>then we get cut off here: }-
18291 </p><p>all additional text is vanished
18292 </p>
18293 !! html/parsoid
18294 <p>this bit is safe: }-</p>
18295 <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>
18296 <p>then we get cut off here: }-</p>
18297 <p>all additional text is vanished</p>
18298 !! end
18299
18300 !! test
18301 Self closed html pairs (T7487)
18302 !! wikitext
18303 <center><font id="bug" />Centered text</center>
18304 <div><font id="bug2" />In div text</div>
18305 !! html+tidy
18306 <center><font id="bug"></font>Centered text</center>
18307 <div><font id="bug2"></font>In div text</div>
18308 !! end
18309
18310 #
18311 #
18312 #
18313
18314 !! test
18315 Punctuation: nbsp before exclamation
18316 !! wikitext
18317 C'est grave !
18318 !! html
18319 <p>C'est grave&#160;!
18320 </p>
18321 !! end
18322
18323 !! test
18324 Punctuation: CSS !important (T13874)
18325 !! wikitext
18326 <div style="width:50% !important">important</div>
18327 !! html
18328 <div style="width:50% !important">important</div>
18329
18330 !!end
18331
18332 !! test
18333 Punctuation: CSS ! important (T13874; with space after)
18334 !! wikitext
18335 <div style="width:50% ! important">important</div>
18336 !! html
18337 <div style="width:50% ! important">important</div>
18338
18339 !!end
18340
18341 !! test
18342 HTML bullet list, closed tags (T7497)
18343 !! wikitext
18344 <ul>
18345 <li>One</li>
18346 <li>Two</li>
18347 </ul>
18348 !! html/php
18349 <ul>
18350 <li>One</li>
18351 <li>Two</li>
18352 </ul>
18353
18354 !! html/parsoid
18355 <ul data-parsoid='{"stx":"html"}'>
18356 <li data-parsoid='{"stx":"html"}'>One</li>
18357 <li data-parsoid='{"stx":"html"}'>Two</li>
18358 </ul>
18359
18360 !! end
18361
18362 !! test
18363 HTML bullet list, unclosed tags (T7497)
18364 !! wikitext
18365 <ul>
18366 <li>One
18367 <li>Two
18368 </ul>
18369 !! html/php+tidy
18370 <ul>
18371 <li>One</li>
18372 <li>Two</li>
18373 </ul>
18374 !! html/parsoid
18375 <ul data-parsoid='{"stx":"html"}'>
18376 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
18377 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
18378 </ul>
18379
18380 !! end
18381
18382 !! test
18383 HTML ordered list, closed tags (T7497)
18384 !! wikitext
18385 <ol>
18386 <li>One</li>
18387 <li>Two</li>
18388 </ol>
18389 !! html/php
18390 <ol>
18391 <li>One</li>
18392 <li>Two</li>
18393 </ol>
18394
18395 !! html/parsoid
18396 <ol data-parsoid='{"stx":"html"}'>
18397 <li data-parsoid='{"stx":"html"}'>One</li>
18398 <li data-parsoid='{"stx":"html"}'>Two</li>
18399 </ol>
18400
18401 !! end
18402
18403 !! test
18404 HTML ordered list, unclosed tags (T7497)
18405 !! options
18406 !! wikitext
18407 <ol>
18408 <li>One
18409 <li>Two
18410 </ol>
18411 !! html/php+tidy
18412 <ol>
18413 <li>One</li>
18414 <li>Two</li>
18415 </ol>
18416 !! html/parsoid
18417 <ol data-parsoid='{"stx":"html"}'>
18418 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
18419 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
18420 </ol>
18421
18422 !! end
18423
18424 !! test
18425 HTML nested bullet list, closed tags (T7497)
18426 !! wikitext
18427 <ul>
18428 <li>One</li>
18429 <li>Two:
18430 <ul>
18431 <li>Sub-one</li>
18432 <li>Sub-two</li>
18433 </ul>
18434 </li>
18435 </ul>
18436 !! html/php
18437 <ul>
18438 <li>One</li>
18439 <li>Two:
18440 <ul>
18441 <li>Sub-one</li>
18442 <li>Sub-two</li>
18443 </ul>
18444 </li>
18445 </ul>
18446
18447 !! html/parsoid
18448 <ul data-parsoid='{"stx":"html"}'>
18449 <li data-parsoid='{"stx":"html"}'>One</li>
18450 <li data-parsoid='{"stx":"html"}'>Two:
18451 <ul data-parsoid='{"stx":"html"}'>
18452 <li data-parsoid='{"stx":"html"}'>Sub-one</li>
18453 <li data-parsoid='{"stx":"html"}'>Sub-two</li>
18454 </ul>
18455 </li>
18456 </ul>
18457 !! end
18458
18459 !! test
18460 HTML nested bullet list, open tags (T7497)
18461 !! wikitext
18462 <ul>
18463 <li>One
18464 <li>Two:
18465 <ul>
18466 <li>Sub-one
18467 <li>Sub-two
18468 </ul>
18469 </ul>
18470 !! html/php+tidy
18471 <ul>
18472 <li>One</li>
18473 <li>Two:
18474 <ul>
18475 <li>Sub-one</li>
18476 <li>Sub-two</li>
18477 </ul>
18478 </li>
18479 </ul>
18480 !! html/parsoid
18481 <ul>
18482 <li>One
18483 </li>
18484 <li>Two:
18485 <ul>
18486 <li>Sub-one
18487 </li>
18488 <li>Sub-two
18489 </li>
18490 </ul>
18491 </li>
18492 </ul>
18493
18494 !! end
18495
18496 !! test
18497 HTML nested ordered list, closed tags (T7497)
18498 !! wikitext
18499 <ol>
18500 <li>One</li>
18501 <li>Two:
18502 <ol>
18503 <li>Sub-one</li>
18504 <li>Sub-two</li>
18505 </ol>
18506 </li>
18507 </ol>
18508 !! html
18509 <ol>
18510 <li>One</li>
18511 <li>Two:
18512 <ol>
18513 <li>Sub-one</li>
18514 <li>Sub-two</li>
18515 </ol>
18516 </li>
18517 </ol>
18518
18519 !! end
18520
18521 !! test
18522 HTML nested ordered list, open tags (T7497)
18523 !! wikitext
18524 <ol>
18525 <li>One
18526 <li>Two:
18527 <ol>
18528 <li>Sub-one
18529 <li>Sub-two
18530 </ol>
18531 </ol>
18532 !! html/php
18533 <ol>
18534 <li>One
18535 <li>Two:
18536 <ol>
18537 <li>Sub-one
18538 <li>Sub-two
18539 </ol>
18540 </ol>
18541
18542 !! html/parsoid
18543 <ol>
18544 <li>One
18545 </li>
18546 <li>Two:
18547 <ol>
18548 <li>Sub-one
18549 </li>
18550 <li>Sub-two
18551 </li>
18552 </ol>
18553 </li>
18554 </ol>
18555
18556 !! end
18557
18558 !! test
18559 HTML ordered list item with parameters oddity
18560 !! wikitext
18561 <ol><li id="fragment">One</li>
18562 </ol>
18563 !! html
18564 <ol><li id="fragment">One</li>
18565 </ol>
18566
18567 !! end
18568
18569 # parsoid doesn't explicitly mark autonumbered links, see T55505
18570 !!test
18571 T7918: autonumbering
18572 !! wikitext
18573 [http://first/] [http://second] [ftp://ftp]
18574
18575 ftp://inlineftp
18576
18577 [mailto:enclosed@mail.tld With target]
18578
18579 [mailto:enclosed@mail.tld]
18580
18581 mailto:inline@mail.tld
18582 !! html/php
18583 <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>
18584 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
18585 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
18586 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
18587 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
18588 </p>
18589 !! html/parsoid
18590 <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>
18591 <p><a rel="mw:ExtLink" href="ftp://inlineftp">ftp://inlineftp</a></p>
18592 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld">With target</a></p>
18593 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld"></a></p>
18594 <p><a rel="mw:ExtLink" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a></p>
18595 !! end
18596
18597
18598 #
18599 # Security and HTML correctness
18600 # From Nick Jenkins' fuzz testing
18601 #
18602
18603 !! test
18604 Fuzz testing: Parser13
18605 !! wikitext
18606 {|
18607 | http://a|
18608 !! html
18609 <table>
18610 <tr>
18611 <td>
18612 </td>
18613 </tr>
18614 </table>
18615
18616 !! end
18617
18618 !! test
18619 Fuzz testing: Parser14
18620 !! wikitext
18621 == onmouseover= ==
18622 http://__TOC__
18623 !! html
18624 <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>
18625 http://<div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
18626 <ul>
18627 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
18628 </ul>
18629 </div>
18630
18631
18632 !! html+tidy
18633 <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>
18634 <p>http://</p>
18635 <div id="toc" class="toc">
18636 <div class="toctitle">
18637 <h2>Contents</h2>
18638 </div>
18639 <ul>
18640 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
18641 </ul>
18642 </div>
18643 <p></p>
18644 !! end
18645
18646 !! test
18647 Fuzz testing: Parser14-table
18648 !! options
18649 parsoid=wt2html,html2html
18650 !! wikitext
18651 ==a==
18652 {| STYLE=__TOC__
18653 !! html
18654 <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>
18655 <table style="&#95;_TOC&#95;_">
18656 <tr><td></td></tr>
18657 </table>
18658
18659 !! html+tidy
18660 <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>
18661 <table style="__TOC__">
18662 <tr>
18663 <td></td>
18664 </tr>
18665 </table>
18666 !! html/parsoid
18667 <h2>a</h2>
18668 <table style="__TOC__"></table>
18669 !! end
18670
18671 # Known to produce bogus xml (extra </td>)
18672 !! test
18673 Fuzz testing: Parser16
18674 !! wikitext
18675 {|
18676 !https://||||||
18677 !! html
18678 <table>
18679 <tr>
18680 <th>https://</th>
18681 <th></th>
18682 <th></th>
18683 <th>
18684 </td>
18685 </tr>
18686 </table>
18687
18688 !! html+tidy
18689 <table>
18690 <tr>
18691 <th>https://</th>
18692 <th></th>
18693 <th></th>
18694 <th></th>
18695 </tr>
18696 </table>
18697 !! end
18698
18699 !! test
18700 Fuzz testing: Parser21
18701 !! wikitext
18702 {|
18703 ! irc://{{ftp://a" onmouseover="alert('hello world');"
18704 |
18705 !! html
18706 <table>
18707 <tr>
18708 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
18709 </th>
18710 <td>
18711 </td>
18712 </tr>
18713 </table>
18714
18715 !! end
18716
18717 !! test
18718 Fuzz testing: Parser22
18719 !! wikitext
18720 http://===r:::https://b
18721
18722 {|
18723 !! html
18724 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
18725 </p>
18726 <table>
18727 <tr><td></td></tr>
18728 </table>
18729
18730 !! end
18731
18732 # Known to produce bad XML for now
18733 !! test
18734 Fuzz testing: Parser24
18735 !! options
18736 parsoid=wt2html
18737 !! wikitext
18738 {|
18739 {{{|
18740 <u CLASS=
18741 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
18742 <br style="onmouseover='alert(document.cookie);' " />
18743
18744 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
18745 |
18746 !! html/php
18747 <table>
18748 {{{|
18749 <u class="&#124;">}}}} &gt;
18750 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
18751
18752 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
18753 <tr>
18754 <td></u>
18755 </td>
18756 </tr>
18757 </table>
18758
18759 !! html/parsoid
18760 <p data-parsoid='{"fostered":true,"autoInsertedEnd":true}'>{{{|
18761 <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>"}'/>}}}} >
18762 <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}'>
18763
18764
18765
18766 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'></td></tr></tbody></table>
18767 !! end
18768
18769 # Note: the current result listed for this is not what the original one was,
18770 # but the original bug was JavaScript injection, which is fixed in any case.
18771 # It's not clear that the original result listed was any more correct than the
18772 # current one. Original result:
18773 # <p>{{{|
18774 # </p>
18775 # <li class="&#124;&#124;">
18776 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
18777 !!test
18778 Fuzz testing: Parser25 (T8055)
18779 !! wikitext
18780 {{{
18781 |
18782 <LI CLASS=||
18783 >
18784 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
18785 !! html/php
18786 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
18787 </p>
18788 !! html/parsoid
18789 <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"]}'>
18790 </span><p about="#mwt1">&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b></p>
18791 !! end
18792
18793 !!test
18794 Fuzz testing: URL adjacent extension (with space, clean)
18795 !! wikitext
18796 http://example.com <nowiki>junk</nowiki>
18797 !! html/php
18798 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
18799 </p>
18800 !! html/parsoid
18801 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a> <span typeof="mw:Nowiki">junk</span></p>
18802 !! end
18803
18804 !!test
18805 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
18806 !! wikitext
18807 http://example.com<nowiki>junk</nowiki>
18808 !! html/php
18809 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
18810 </p>
18811 !! html/parsoid
18812 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a><span typeof="mw:Nowiki">junk</span></p>
18813 !! end
18814
18815 !! test
18816 Fuzz testing: URL adjacent extension (no space, dirty; pre)
18817 !! wikitext
18818 http://example.com<pre>junk</pre>
18819 !! html/php
18820 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
18821
18822 !! html/php+tidy
18823 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></p>
18824 <pre>
18825 junk
18826 </pre>
18827 !! html/parsoid
18828 <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>
18829 !! end
18830
18831 !! test
18832 Fuzz testing: image with bogus manual thumbnail
18833 !! wikitext
18834 [[Image:foobar.jpg|thumbnail= ]]
18835 !! html/php
18836 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
18837
18838 !! html/parsoid
18839 <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>
18840 !! end
18841
18842 !! test
18843 Fuzz testing: encoded newline in generated HTML replacements (T8577)
18844 !! wikitext
18845 <pre dir="&#10;"></pre>
18846 !! html/php
18847 <pre dir="&#10;"></pre>
18848
18849 !! html/parsoid
18850 <pre typeof="mw:Extension/pre" about="#mwt2" dir="&amp;#10;" data-mw='{"name":"pre","attrs":{"dir":"&amp;#10;"},"body":{"extsrc":""}}'></pre>
18851 !! end
18852
18853 !! test
18854 Parsing optional HTML elements (T8171)
18855 !! options
18856 !! wikitext
18857 <table>
18858 <tr>
18859 <td> Some tabular data</td>
18860 <td> More tabular data ...
18861 <td> And yet som tabular data</td>
18862 </tr>
18863 </table>
18864 !! html
18865 <table>
18866 <tr>
18867 <td> Some tabular data</td>
18868 <td> More tabular data ...
18869 </td><td> And yet som tabular data</td>
18870 </tr>
18871 </table>
18872
18873 !! end
18874
18875 !! test
18876 Correct handling of <td>, <tr> (T8171)
18877 !! options
18878 !! wikitext
18879 <table>
18880 <tr>
18881 <td> Some tabular data</td>
18882 <td> More tabular data ...</td>
18883 <td> And yet som tabular data</td>
18884 </tr>
18885 </table>
18886 !! html
18887 <table>
18888 <tr>
18889 <td> Some tabular data</td>
18890 <td> More tabular data ...</td>
18891 <td> And yet som tabular data</td>
18892 </tr>
18893 </table>
18894
18895 !! end
18896
18897
18898 !! test
18899 Parsing crashing regression (fr:JavaScript)
18900 !! wikitext
18901 </body></x>
18902 !! html
18903 <p>&lt;/body&gt;&lt;/x&gt;
18904 </p>
18905 !! end
18906
18907 !! test
18908 Inline wiki vs wiki block nesting
18909 !! wikitext
18910 '''Bold paragraph
18911
18912 New wiki paragraph
18913 !! html
18914 <p><b>Bold paragraph</b>
18915 </p><p>New wiki paragraph
18916 </p>
18917 !! end
18918
18919 # FIXME: The current php output is documented
18920 # and desired output is the parsoid target.
18921 !! test
18922 Inline HTML vs wiki block nesting
18923 !! wikitext
18924 <b>Bold paragraph
18925
18926 New wiki paragraph
18927 !! html/php
18928 <p><b>Bold paragraph
18929 </p><p>New wiki paragraph</b>
18930 </p>
18931 !! html/parsoid
18932 <p><b>Bold paragraph</b>
18933 </p><p>New wiki paragraph
18934 </p>
18935 !! end
18936
18937 # Original result was this:
18938 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
18939 # </p>
18940 # While that might be marginally more intuitive, maybe, the six-apostrophe
18941 # construct is clearly pathological and the result stated here (which is what
18942 # the parser actually does) is about as reasonable as anything.
18943 !!test
18944 Mixing markup for italics and bold
18945 !! options
18946 !! wikitext
18947 '''bold''''''bold''bolditalics'''''
18948 !! html
18949 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
18950 </p>
18951 !! end
18952
18953
18954 !! article
18955 Xyzzyx
18956 !! text
18957 Article for special page transclusion test
18958 !! endarticle
18959
18960 !! test
18961 Special page transclusion
18962 !! options
18963 !! wikitext
18964 {{Special:Prefixindex/Xyzzyx}}
18965 !! html
18966 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
18967 </ul>
18968
18969 !! end
18970
18971 !! test
18972 Special page transclusion twice (T7021)
18973 !! options
18974 !! wikitext
18975 {{Special:Prefixindex/Xyzzyx}}
18976 {{Special:Prefixindex/Xyzzyx}}
18977 !! html
18978 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
18979 </ul>
18980 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
18981 </ul>
18982
18983 !! end
18984
18985 !! test
18986 Transclusion of default MediaWiki message
18987 !! wikitext
18988 {{MediaWiki:Mainpage}}
18989 !! html
18990 <p>Main Page
18991 </p>
18992 !! end
18993
18994 !! test
18995 Transclusion of nonexistent MediaWiki message
18996 !! wikitext
18997 {{MediaWiki:Mainpagexxx}}
18998 !! html
18999 <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>
19000 </p>
19001 !! end
19002
19003 !! test
19004 Transclusion of MediaWiki message with underscore
19005 !! wikitext
19006 {{MediaWiki:history_short}}
19007 !! html
19008 <p>History
19009 </p>
19010 !! end
19011
19012 !! test
19013 Transclusion of MediaWiki message with space
19014 !! wikitext
19015 {{MediaWiki:history short}}
19016 !! html
19017 <p>History
19018 </p>
19019 !! end
19020
19021 !! test
19022 Invalid header with following text
19023 !! wikitext
19024 = x = y
19025 !! html
19026 <p>= x = y
19027 </p>
19028 !! end
19029
19030
19031 !! test
19032 Section extraction test (section 0)
19033 !! options
19034 section=0
19035 !! wikitext
19036 start
19037 ==a==
19038 ===aa===
19039 ====aaa====
19040 ==b==
19041 ===ba===
19042 ===bb===
19043 ====bba====
19044 ===bc===
19045 ==c==
19046 ===ca===
19047 !! html/php
19048 start
19049 !! end
19050
19051 !! test
19052 Section extraction test (section 1)
19053 !! options
19054 section=1
19055 !! wikitext
19056 start
19057 ==a==
19058 ===aa===
19059 ====aaa====
19060 ==b==
19061 ===ba===
19062 ===bb===
19063 ====bba====
19064 ===bc===
19065 ==c==
19066 ===ca===
19067 !! html/php
19068 ==a==
19069 ===aa===
19070 ====aaa====
19071 !! end
19072
19073 !! test
19074 Section extraction test (section 2)
19075 !! options
19076 section=2
19077 !! wikitext
19078 start
19079 ==a==
19080 ===aa===
19081 ====aaa====
19082 ==b==
19083 ===ba===
19084 ===bb===
19085 ====bba====
19086 ===bc===
19087 ==c==
19088 ===ca===
19089 !! html/php
19090 ===aa===
19091 ====aaa====
19092 !! end
19093
19094 !! test
19095 Section extraction test (section 3)
19096 !! options
19097 section=3
19098 !! wikitext
19099 start
19100 ==a==
19101 ===aa===
19102 ====aaa====
19103 ==b==
19104 ===ba===
19105 ===bb===
19106 ====bba====
19107 ===bc===
19108 ==c==
19109 ===ca===
19110 !! html/php
19111 ====aaa====
19112 !! end
19113
19114 !! test
19115 Section extraction test (section 4)
19116 !! options
19117 section=4
19118 !! wikitext
19119 start
19120 ==a==
19121 ===aa===
19122 ====aaa====
19123 ==b==
19124 ===ba===
19125 ===bb===
19126 ====bba====
19127 ===bc===
19128 ==c==
19129 ===ca===
19130 !! html/php
19131 ==b==
19132 ===ba===
19133 ===bb===
19134 ====bba====
19135 ===bc===
19136 !! end
19137
19138 !! test
19139 Section extraction test (section 5)
19140 !! options
19141 section=5
19142 !! wikitext
19143 start
19144 ==a==
19145 ===aa===
19146 ====aaa====
19147 ==b==
19148 ===ba===
19149 ===bb===
19150 ====bba====
19151 ===bc===
19152 ==c==
19153 ===ca===
19154 !! html/php
19155 ===ba===
19156 !! end
19157
19158 !! test
19159 Section extraction test (section 6)
19160 !! options
19161 section=6
19162 !! wikitext
19163 start
19164 ==a==
19165 ===aa===
19166 ====aaa====
19167 ==b==
19168 ===ba===
19169 ===bb===
19170 ====bba====
19171 ===bc===
19172 ==c==
19173 ===ca===
19174 !! html/php
19175 ===bb===
19176 ====bba====
19177 !! end
19178
19179 !! test
19180 Section extraction test (section 7)
19181 !! options
19182 section=7
19183 !! wikitext
19184 start
19185 ==a==
19186 ===aa===
19187 ====aaa====
19188 ==b==
19189 ===ba===
19190 ===bb===
19191 ====bba====
19192 ===bc===
19193 ==c==
19194 ===ca===
19195 !! html/php
19196 ====bba====
19197 !! end
19198
19199 !! test
19200 Section extraction test (section 8)
19201 !! options
19202 section=8
19203 !! wikitext
19204 start
19205 ==a==
19206 ===aa===
19207 ====aaa====
19208 ==b==
19209 ===ba===
19210 ===bb===
19211 ====bba====
19212 ===bc===
19213 ==c==
19214 ===ca===
19215 !! html/php
19216 ===bc===
19217 !! end
19218
19219 !! test
19220 Section extraction test (section 9)
19221 !! options
19222 section=9
19223 !! wikitext
19224 start
19225 ==a==
19226 ===aa===
19227 ====aaa====
19228 ==b==
19229 ===ba===
19230 ===bb===
19231 ====bba====
19232 ===bc===
19233 ==c==
19234 ===ca===
19235 !! html/php
19236 ==c==
19237 ===ca===
19238 !! end
19239
19240 !! test
19241 Section extraction test (section 10)
19242 !! options
19243 section=10
19244 !! wikitext
19245 start
19246 ==a==
19247 ===aa===
19248 ====aaa====
19249 ==b==
19250 ===ba===
19251 ===bb===
19252 ====bba====
19253 ===bc===
19254 ==c==
19255 ===ca===
19256 !! html/php
19257 ===ca===
19258 !! end
19259
19260 !! test
19261 Section extraction test (nonexistent section 11)
19262 !! options
19263 section=11
19264 !! wikitext
19265 start
19266 ==a==
19267 ===aa===
19268 ====aaa====
19269 ==b==
19270 ===ba===
19271 ===bb===
19272 ====bba====
19273 ===bc===
19274 ==c==
19275 ===ca===
19276 !! html/php
19277 !! end
19278
19279 !! test
19280 Section extraction test with bogus heading (section 1)
19281 !! options
19282 section=1
19283 !! wikitext
19284 ==a==
19285 ==bogus== not a legal section
19286 ==b==
19287 !! html/php
19288 ==a==
19289 ==bogus== not a legal section
19290 !! end
19291
19292 !! test
19293 Section extraction test with bogus heading (section 2)
19294 !! options
19295 section=2
19296 !! wikitext
19297 ==a==
19298 ==bogus== not a legal section
19299 ==b==
19300 !! html/php
19301 ==b==
19302 !! end
19303
19304 !! test
19305 Section extraction test with comment after heading (section 1)
19306 !! options
19307 section=1
19308 !! wikitext
19309 ==a==
19310 ==b== <!-- -->
19311 ==c==
19312 !! html/php
19313 ==a==
19314 !! end
19315
19316 !! test
19317 Section extraction test with comment after heading (section 2)
19318 !! options
19319 section=2
19320 !! wikitext
19321 ==a==
19322 ==b== <!-- -->
19323 ==c==
19324 !! html/php
19325 ==b== <!-- -->
19326 !! end
19327
19328 !! test
19329 Section extraction test with bogus <nowiki> heading (section 1)
19330 !! options
19331 section=1
19332 !! wikitext
19333 ==a==
19334 ==bogus== <nowiki>not a legal section</nowiki>
19335 ==b==
19336 !! html/php
19337 ==a==
19338 ==bogus== <nowiki>not a legal section</nowiki>
19339 !! end
19340
19341 !! test
19342 Section extraction test with bogus <nowiki> heading (section 2)
19343 !! options
19344 section=2
19345 !! wikitext
19346 ==a==
19347 ==bogus== <nowiki>not a legal section</nowiki>
19348 ==b==
19349 !! html/php
19350 ==b==
19351 !! end
19352
19353 # Formerly testing for T4587, now resolved by the use of unmarked sections
19354 # instead of respecting commented sections
19355 !! test
19356 Section extraction prefixed by comment (section 1)
19357 !! options
19358 section=1
19359 !! wikitext
19360 <!-- -->==sec1==
19361 ==sec2==
19362 !! html/php
19363 ==sec2==
19364 !!end
19365
19366 !! test
19367 Section extraction prefixed by comment (section 2)
19368 !! options
19369 section=2
19370 !! wikitext
19371 <!-- -->==sec1==
19372 ==sec2==
19373 !! html/php
19374
19375 !!end
19376
19377 # Formerly testing for T4607, now resolved by the use of unmarked sections
19378 # instead of respecting HTML-style headings
19379 !! test
19380 Section extraction, mixed wiki and html (section 1)
19381 !! options
19382 section=1
19383 !! wikitext
19384 <h2>unmarked</h2>
19385 unmarked
19386 ==1==
19387 one
19388 ==2==
19389 two
19390 !! html/php
19391 ==1==
19392 one
19393 !! end
19394
19395 !! test
19396 Section extraction, mixed wiki and html (section 2)
19397 !! options
19398 section=2
19399 !! wikitext
19400 <h2>unmarked</h2>
19401 unmarked
19402 ==1==
19403 one
19404 ==2==
19405 two
19406 !! html/php
19407 ==2==
19408 two
19409 !! end
19410
19411
19412 # Formerly testing for T5342
19413 !! test
19414 Section extraction, heading surrounded by <noinclude>
19415 !! options
19416 section=1
19417 !! wikitext
19418 <noinclude>==unmarked==</noinclude>
19419 ==marked==
19420 !! html/php
19421 ==marked==
19422 !!end
19423
19424 # Test behavior of T21910
19425 !! test
19426 Sectiion with all-equals
19427 !! options
19428 section=2
19429 !! wikitext
19430 ===
19431 The line above must have a trailing space
19432 === <!--
19433 --> <!-- -->
19434 But just in case it doesn't...
19435 !! html/php
19436 === <!--
19437 --> <!-- -->
19438 But just in case it doesn't...
19439 !! end
19440
19441 !! test
19442 Section replacement test (section 0)
19443 !! options
19444 replace=0,"xxx"
19445 !! wikitext
19446 start
19447 ==a==
19448 ===aa===
19449 ====aaa====
19450 ==b==
19451 ===ba===
19452 ===bb===
19453 ====bba====
19454 ===bc===
19455 ==c==
19456 ===ca===
19457 !! html/php
19458 xxx
19459
19460 ==a==
19461 ===aa===
19462 ====aaa====
19463 ==b==
19464 ===ba===
19465 ===bb===
19466 ====bba====
19467 ===bc===
19468 ==c==
19469 ===ca===
19470 !! end
19471
19472 !! test
19473 Section replacement test (section 1)
19474 !! options
19475 replace=1,"xxx"
19476 !! wikitext
19477 start
19478 ==a==
19479 ===aa===
19480 ====aaa====
19481 ==b==
19482 ===ba===
19483 ===bb===
19484 ====bba====
19485 ===bc===
19486 ==c==
19487 ===ca===
19488 !! html/php
19489 start
19490 xxx
19491
19492 ==b==
19493 ===ba===
19494 ===bb===
19495 ====bba====
19496 ===bc===
19497 ==c==
19498 ===ca===
19499 !! end
19500
19501 !! test
19502 Section replacement test (section 2)
19503 !! options
19504 replace=2,"xxx"
19505 !! wikitext
19506 start
19507 ==a==
19508 ===aa===
19509 ====aaa====
19510 ==b==
19511 ===ba===
19512 ===bb===
19513 ====bba====
19514 ===bc===
19515 ==c==
19516 ===ca===
19517 !! html/php
19518 start
19519 ==a==
19520 xxx
19521
19522 ==b==
19523 ===ba===
19524 ===bb===
19525 ====bba====
19526 ===bc===
19527 ==c==
19528 ===ca===
19529 !! end
19530
19531 !! test
19532 Section replacement test (section 3)
19533 !! options
19534 replace=3,"xxx"
19535 !! wikitext
19536 start
19537 ==a==
19538 ===aa===
19539 ====aaa====
19540 ==b==
19541 ===ba===
19542 ===bb===
19543 ====bba====
19544 ===bc===
19545 ==c==
19546 ===ca===
19547 !! html/php
19548 start
19549 ==a==
19550 ===aa===
19551 xxx
19552
19553 ==b==
19554 ===ba===
19555 ===bb===
19556 ====bba====
19557 ===bc===
19558 ==c==
19559 ===ca===
19560 !! end
19561
19562 !! test
19563 Section replacement test (section 4)
19564 !! options
19565 replace=4,"xxx"
19566 !! wikitext
19567 start
19568 ==a==
19569 ===aa===
19570 ====aaa====
19571 ==b==
19572 ===ba===
19573 ===bb===
19574 ====bba====
19575 ===bc===
19576 ==c==
19577 ===ca===
19578 !! html/php
19579 start
19580 ==a==
19581 ===aa===
19582 ====aaa====
19583 xxx
19584
19585 ==c==
19586 ===ca===
19587 !! end
19588
19589 !! test
19590 Section replacement test (section 5)
19591 !! options
19592 replace=5,"xxx"
19593 !! wikitext
19594 start
19595 ==a==
19596 ===aa===
19597 ====aaa====
19598 ==b==
19599 ===ba===
19600 ===bb===
19601 ====bba====
19602 ===bc===
19603 ==c==
19604 ===ca===
19605 !! html/php
19606 start
19607 ==a==
19608 ===aa===
19609 ====aaa====
19610 ==b==
19611 xxx
19612
19613 ===bb===
19614 ====bba====
19615 ===bc===
19616 ==c==
19617 ===ca===
19618 !! end
19619
19620 !! test
19621 Section replacement test (section 6)
19622 !! options
19623 replace=6,"xxx"
19624 !! wikitext
19625 start
19626 ==a==
19627 ===aa===
19628 ====aaa====
19629 ==b==
19630 ===ba===
19631 ===bb===
19632 ====bba====
19633 ===bc===
19634 ==c==
19635 ===ca===
19636 !! html/php
19637 start
19638 ==a==
19639 ===aa===
19640 ====aaa====
19641 ==b==
19642 ===ba===
19643 xxx
19644
19645 ===bc===
19646 ==c==
19647 ===ca===
19648 !! end
19649
19650 !! test
19651 Section replacement test (section 7)
19652 !! options
19653 replace=7,"xxx"
19654 !! wikitext
19655 start
19656 ==a==
19657 ===aa===
19658 ====aaa====
19659 ==b==
19660 ===ba===
19661 ===bb===
19662 ====bba====
19663 ===bc===
19664 ==c==
19665 ===ca===
19666 !! html/php
19667 start
19668 ==a==
19669 ===aa===
19670 ====aaa====
19671 ==b==
19672 ===ba===
19673 ===bb===
19674 xxx
19675
19676 ===bc===
19677 ==c==
19678 ===ca===
19679 !! end
19680
19681 !! test
19682 Section replacement test (section 8)
19683 !! options
19684 replace=8,"xxx"
19685 !! wikitext
19686 start
19687 ==a==
19688 ===aa===
19689 ====aaa====
19690 ==b==
19691 ===ba===
19692 ===bb===
19693 ====bba====
19694 ===bc===
19695 ==c==
19696 ===ca===
19697 !! html/php
19698 start
19699 ==a==
19700 ===aa===
19701 ====aaa====
19702 ==b==
19703 ===ba===
19704 ===bb===
19705 ====bba====
19706 xxx
19707
19708 ==c==
19709 ===ca===
19710 !!end
19711
19712 !! test
19713 Section replacement test (section 9)
19714 !! options
19715 replace=9,"xxx"
19716 !! wikitext
19717 start
19718 ==a==
19719 ===aa===
19720 ====aaa====
19721 ==b==
19722 ===ba===
19723 ===bb===
19724 ====bba====
19725 ===bc===
19726 ==c==
19727 ===ca===
19728 !! html/php
19729 start
19730 ==a==
19731 ===aa===
19732 ====aaa====
19733 ==b==
19734 ===ba===
19735 ===bb===
19736 ====bba====
19737 ===bc===
19738 xxx
19739 !! end
19740
19741 !! test
19742 Section replacement test (section 10)
19743 !! options
19744 replace=10,"xxx"
19745 !! wikitext
19746 start
19747 ==a==
19748 ===aa===
19749 ====aaa====
19750 ==b==
19751 ===ba===
19752 ===bb===
19753 ====bba====
19754 ===bc===
19755 ==c==
19756 ===ca===
19757 !! html/php
19758 start
19759 ==a==
19760 ===aa===
19761 ====aaa====
19762 ==b==
19763 ===ba===
19764 ===bb===
19765 ====bba====
19766 ===bc===
19767 ==c==
19768 xxx
19769 !! end
19770
19771 !! test
19772 Section replacement test with initial whitespace (T15728)
19773 !! options
19774 replace=2,"xxx"
19775 !! wikitext
19776 Preformatted initial line
19777 ==a==
19778 ===a===
19779 !! html/php
19780 Preformatted initial line
19781 ==a==
19782 xxx
19783 !! end
19784
19785
19786 !! test
19787 Section extraction, heading followed by pre with 20 spaces (T8398)
19788 !! options
19789 section=1
19790 !! wikitext
19791 ==a==
19792 a
19793 !! html/php
19794 ==a==
19795 a
19796 !! end
19797
19798 !! test
19799 Section extraction, heading followed by pre with 19 spaces (T8398 sanity check)
19800 !! options
19801 section=1
19802 !! wikitext
19803 ==a==
19804 a
19805 !! html/php
19806 ==a==
19807 a
19808 !! end
19809
19810
19811 !! test
19812 Section extraction, <pre> around bogus header (T12309)
19813 !! options
19814 section=2
19815 !! wikitext
19816 == Section One ==
19817 <pre>
19818 =======
19819 </pre>
19820
19821 == Section Two ==
19822 stuff
19823 !! html/php
19824 == Section Two ==
19825 stuff
19826 !! end
19827
19828 !! test
19829 Section replacement, <pre> around bogus header (T12309)
19830 !! options
19831 replace=2,"xxx"
19832 !! wikitext
19833 == Section One ==
19834 <pre>
19835 =======
19836 </pre>
19837
19838 == Section Two ==
19839 stuff
19840 !! html/php
19841 == Section One ==
19842 <pre>
19843 =======
19844 </pre>
19845
19846 xxx
19847 !! end
19848
19849 !! test
19850 Handling of &#x0A; in URLs
19851 !! wikitext
19852 ** irc://&#x0A;a
19853 !! html/php
19854 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
19855
19856 !! html/parsoid
19857 <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>
19858 !! end
19859
19860 !! test
19861 Handling of %0A in URLs
19862 !! wikitext
19863 ** irc://%0Aa
19864 !! html/php
19865 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
19866
19867 !! html/parsoid
19868 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
19869 !! end
19870
19871 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
19872 !! test
19873 5 quotes, code coverage +1 line
19874 !! options
19875 parsoid=wt2html
19876 !! wikitext
19877 '''''
19878 !! html/php
19879 !! html/parsoid
19880 <p><b><i></i></b></p>
19881 !! end
19882
19883 # same html as previous, but wikitext adjusted to match parsoid html2wt
19884 # note that wt2html and html2html will put the <i> before the <b>
19885 !! test
19886 5 quotes, code coverage +1 line w/ nowiki (1)
19887 !! options
19888 parsoid=wt2wt,html2wt
19889 !! wikitext
19890 '''''<nowiki/>'''''
19891 !! html/php
19892 <p><i></i>
19893 </p>
19894 !! html/parsoid
19895 <p><b><i></i></b></p>
19896 !! end
19897
19898 # same as previous, just swapping the <i> and <b>
19899 !! test
19900 5 quotes, code coverage +1 line w/ nowiki (2)
19901 !! wikitext
19902 '''''<nowiki/>'''''
19903 !! html/php
19904 <p><i></i>
19905 </p>
19906 !! html/parsoid
19907 <p><i><b></b></i></p>
19908 !! end
19909
19910 !! test
19911 Special:Search page linking.
19912 !! wikitext
19913 {{Special:search}}
19914 !! html
19915 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
19916 </p>
19917 !! end
19918
19919 !! test
19920 {{!}} is a magic word
19921 !! wikitext
19922 {{!}} is a magic word there and {{!}} is still a magic word here
19923 | is not a magic word here but {{!}} is still a magic word here
19924 !! html/php
19925 <p>| is a magic word there and | is still a magic word here
19926 | is not a magic word here but | is still a magic word here
19927 </p>
19928 !! html/parsoid
19929 <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
19930 | 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>
19931 !! end
19932
19933 !! test
19934 Say the magic word
19935 !! options
19936 title=[[Parser test]]
19937 !! wikitext
19938 * {{PAGENAME}}
19939 * {{PAGENAMEE}}
19940 * {{FULLPAGENAME}}
19941 * {{FULLPAGENAMEE}}
19942 * {{BASEPAGENAME}}
19943 * {{BASEPAGENAMEE}}
19944 * {{SUBPAGENAME}}
19945 * {{SUBPAGENAMEE}}
19946 * {{ROOTPAGENAME}}
19947 * {{ROOTPAGENAMEE}}
19948 * {{TALKPAGENAME}}
19949 * {{TALKPAGENAMEE}}
19950 * {{SUBJECTPAGENAME}}
19951 * {{SUBJECTPAGENAMEE}}
19952 * {{NAMESPACEE}}
19953 * {{NAMESPACE}}
19954 * {{NAMESPACENUMBER}}
19955 * {{TALKSPACE}}
19956 * {{TALKSPACEE}}
19957 * {{SUBJECTSPACE}}
19958 * {{SUBJECTSPACEE}}
19959 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
19960 !! html
19961 <ul><li> Parser test</li>
19962 <li> Parser_test</li>
19963 <li> Parser test</li>
19964 <li> Parser_test</li>
19965 <li> Parser test</li>
19966 <li> Parser_test</li>
19967 <li> Parser test</li>
19968 <li> Parser_test</li>
19969 <li> Parser test</li>
19970 <li> Parser_test</li>
19971 <li> Talk:Parser test</li>
19972 <li> Talk:Parser_test</li>
19973 <li> Parser test</li>
19974 <li> Parser_test</li>
19975 <li> </li>
19976 <li> </li>
19977 <li> 0</li>
19978 <li> Talk</li>
19979 <li> Talk</li>
19980 <li> </li>
19981 <li> </li>
19982 <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>
19983
19984 !! end
19985 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
19986
19987 !! test
19988 Gallery with valid attributes
19989 !! wikitext
19990 <gallery type="123" summary="345">
19991 File:File:Foobar.jpg
19992 </gallery>
19993 !! html/php
19994 <ul class="gallery mw-gallery-traditional" type="123">
19995 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19996 <div class="thumb" style="height: 150px;">File:Foobar.jpg</div>
19997 <div class="gallerytext">
19998 </div>
19999 </div></li>
20000 </ul>
20001
20002 !! html/parsoid
20003 <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"}}'>
20004 <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>
20005 </ul>
20006 !! end
20007
20008 ## Parsoid thinks the "centre" here is a property, not a caption.
20009 !! test
20010 Gallery
20011 !! options
20012 parsoid={
20013 "modes": ["wt2html"],
20014 "nativeGallery": true
20015 }
20016 !! wikitext
20017 <gallery>
20018 image1.png |
20019 image2.gif|||||
20020
20021 image3|
20022 image4 |300px| centre
20023 image5.svg| http://///////
20024 [[x|xx]]]]
20025 * image6
20026 </gallery>
20027 !! html/php
20028 <ul class="gallery mw-gallery-traditional">
20029 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20030 <div class="thumb" style="height: 150px;">Image1.png</div>
20031 <div class="gallerytext">
20032 </div>
20033 </div></li>
20034 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20035 <div class="thumb" style="height: 150px;">Image2.gif</div>
20036 <div class="gallerytext">
20037 </div>
20038 </div></li>
20039 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20040 <div class="thumb" style="height: 150px;">Image3</div>
20041 <div class="gallerytext">
20042 </div>
20043 </div></li>
20044 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20045 <div class="thumb" style="height: 150px;">Image4</div>
20046 <div class="gallerytext">
20047 <pre>centre
20048 </pre>
20049 </div>
20050 </div></li>
20051 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20052 <div class="thumb" style="height: 150px;">Image5.svg</div>
20053 <div class="gallerytext">
20054 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
20055 </p>
20056 </div>
20057 </div></li>
20058 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20059 <div class="thumb" style="height: 150px;">* image6</div>
20060 <div class="gallerytext">
20061 </div>
20062 </div></li>
20063 </ul>
20064
20065 !! html/parsoid
20066 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt3" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20067 <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>
20068 <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>
20069 <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>
20070 <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>
20071 <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>
20072 <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>
20073 </ul>
20074 !! end
20075
20076 !! test
20077 Gallery (with options, html)
20078 !! options
20079 parsoid={
20080 "modes": ["wt2html", "html2html"],
20081 "nativeGallery": true
20082 }
20083 !! wikitext
20084 <gallery widths="70px" heights="40px" perrow="2" caption="Foo [[Main Page]]">
20085 File:Nonexistent.jpg|caption
20086 File:Nonexistent.jpg
20087 image:foobar.jpg|some '''caption''' [[Main Page]]
20088 image:foobar.jpg
20089 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
20090 </gallery>
20091 !! html/php
20092 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
20093 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
20094 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20095 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
20096 <div class="gallerytext">
20097 <p>caption
20098 </p>
20099 </div>
20100 </div></li>
20101 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20102 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
20103 <div class="gallerytext">
20104 </div>
20105 </div></li>
20106 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20107 <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>
20108 <div class="gallerytext">
20109 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
20110 </p>
20111 </div>
20112 </div></li>
20113 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20114 <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>
20115 <div class="gallerytext">
20116 </div>
20117 </div></li>
20118 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20119 <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>
20120 <div class="gallerytext">
20121 <p>blabla.
20122 </p>
20123 </div>
20124 </div></li>
20125 </ul>
20126
20127 !! html/parsoid
20128 <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":{}}'>
20129 <li class="gallerycaption">Foo <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a></li>
20130 <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>
20131 <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>
20132 <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>
20133 <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>
20134 <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>
20135 </ul>
20136 !! end
20137
20138 !! test
20139 Gallery (with options, extsrc)
20140 !! options
20141 parsoid={
20142 "nativeGallery": false
20143 }
20144 !! wikitext
20145 <gallery widths="70px" heights="40px" perrow="2" caption="Foo [[Main Page]]">
20146 File:Nonexistent.jpg|caption
20147 File:Nonexistent.jpg
20148 image:foobar.jpg|some '''caption''' [[Main Page]]
20149 image:foobar.jpg
20150 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
20151 </gallery>
20152 !! html/php
20153 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
20154 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
20155 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20156 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
20157 <div class="gallerytext">
20158 <p>caption
20159 </p>
20160 </div>
20161 </div></li>
20162 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20163 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
20164 <div class="gallerytext">
20165 </div>
20166 </div></li>
20167 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20168 <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>
20169 <div class="gallerytext">
20170 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
20171 </p>
20172 </div>
20173 </div></li>
20174 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20175 <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>
20176 <div class="gallerytext">
20177 </div>
20178 </div></li>
20179 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20180 <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>
20181 <div class="gallerytext">
20182 <p>blabla.
20183 </p>
20184 </div>
20185 </div></li>
20186 </ul>
20187
20188 !! html/parsoid
20189 <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"}}'>
20190 <li class="gallerycaption">Foo <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a></li>
20191 <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>
20192 <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>
20193 <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>
20194 <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>
20195 <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>
20196 </ul>
20197 !! end
20198
20199 !! test
20200 Gallery with link that has fragment
20201 !! options
20202 parsoid={
20203 "modes": ["wt2html", "html2html"],
20204 "nativeGallery": true
20205 }
20206 !! wikitext
20207 <gallery>
20208 image:foobar.jpg|link=Main_Page
20209 image:foobar.jpg|link=Main_Page#section
20210 image:foobar.jpg|link=Main Page#section|caption
20211 </gallery>
20212 !! html/php
20213 <ul class="gallery mw-gallery-traditional">
20214 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20215 <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>
20216 <div class="gallerytext">
20217 </div>
20218 </div></li>
20219 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20220 <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>
20221 <div class="gallerytext">
20222 </div>
20223 </div></li>
20224 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20225 <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>
20226 <div class="gallerytext">
20227 <p>caption
20228 </p>
20229 </div>
20230 </div></li>
20231 </ul>
20232
20233 !! html/parsoid
20234 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20235 <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>
20236 <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>
20237 <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>
20238 </ul>
20239 !! end
20240
20241 ## Whoops, Parsoid shouldn't be parsing templates in the attribute caption!
20242 !! test
20243 Gallery with template inside caption
20244 !! options
20245 parsoid={
20246 "nativeGallery": true
20247 }
20248 !! wikitext
20249 <gallery caption="{{echo|hi}}">
20250 File:Foobar.jpg|{{echo|ho}}
20251 </gallery>
20252 !! html/php
20253 <ul class="gallery mw-gallery-traditional">
20254 <li class='gallerycaption'>{{echo|hi}}</li>
20255 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20256 <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>
20257 <div class="gallerytext">
20258 <p>ho
20259 </p>
20260 </div>
20261 </div></li>
20262 </ul>
20263
20264 !! html/parsoid
20265 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt6" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20266 <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>
20267 <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>
20268 </ul>
20269 !! end
20270
20271 !! test
20272 Gallery with wikitext inside caption
20273 !! options
20274 parsoid={
20275 "nativeGallery": true
20276 }
20277 !! wikitext
20278 <gallery>
20279 File:Foobar.jpg|alt=galleryalt|[[File:Foobar.jpg|alt=inneralt|20x20px|desc]]
20280 File:Foobar.jpg|alt=galleryalt|{{Test|unamedParam|alt=param}}
20281 </gallery>
20282 !! html/php
20283 <ul class="gallery mw-gallery-traditional">
20284 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20285 <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>
20286 <div class="gallerytext">
20287 <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>
20288 </p>
20289 </div>
20290 </div></li>
20291 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20292 <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>
20293 <div class="gallerytext">
20294 <p>This is a test template
20295 </p>
20296 </div>
20297 </div></li>
20298 </ul>
20299
20300 !! html/parsoid
20301 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt6" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20302 <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>
20303 <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>
20304 </ul>
20305 !! end
20306
20307 !! test
20308 Gallery (with showfilename option)
20309 !! options
20310 parsoid={
20311 "nativeGallery": true
20312 }
20313 !! wikitext
20314 <gallery showfilename="">
20315 File:Nonexistent.jpg|caption
20316 File:Nonexistent.jpg
20317 File:Foobar.jpg|some '''caption''' [[Main Page]]
20318 File:Foobar.jpg
20319 </gallery>
20320 !! html/php
20321 <ul class="gallery mw-gallery-traditional">
20322 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20323 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
20324 <div class="gallerytext">
20325 <p><a href="/wiki/File:Nonexistent.jpg" class="galleryfilename galleryfilename-truncate" title="File:Nonexistent.jpg">Nonexistent.jpg</a>
20326 caption
20327 </p>
20328 </div>
20329 </div></li>
20330 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20331 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
20332 <div class="gallerytext">
20333 <p><a href="/wiki/File:Nonexistent.jpg" class="galleryfilename galleryfilename-truncate" title="File:Nonexistent.jpg">Nonexistent.jpg</a>
20334 </p>
20335 </div>
20336 </div></li>
20337 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20338 <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>
20339 <div class="gallerytext">
20340 <p><a href="/wiki/File:Foobar.jpg" class="galleryfilename galleryfilename-truncate" title="File:Foobar.jpg">Foobar.jpg</a>
20341 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
20342 </p>
20343 </div>
20344 </div></li>
20345 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20346 <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>
20347 <div class="gallerytext">
20348 <p><a href="/wiki/File:Foobar.jpg" class="galleryfilename galleryfilename-truncate" title="File:Foobar.jpg">Foobar.jpg</a>
20349 </p>
20350 </div>
20351 </div></li>
20352 </ul>
20353
20354 !! html/parsoid
20355 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt3" data-mw='{"name":"gallery","attrs":{"showfilename":""},"body":{}}'>
20356 <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>
20357 <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>
20358 <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>
20359 <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>
20360 </ul>
20361 !! end
20362
20363 ## Should Parsoid be preserving these variations? See T151367
20364 !! test
20365 Gallery (with namespace-less filenames)
20366 !! options
20367 parsoid={
20368 "modes": ["wt2html", "html2html"],
20369 "nativeGallery": true
20370 }
20371 !! wikitext
20372 <gallery>
20373 File:Nonexistent.jpg
20374 Nonexistent.jpg
20375 image:foobar.jpg
20376 foobar.jpg
20377 </gallery>
20378 !! html/php
20379 <ul class="gallery mw-gallery-traditional">
20380 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20381 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
20382 <div class="gallerytext">
20383 </div>
20384 </div></li>
20385 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20386 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
20387 <div class="gallerytext">
20388 </div>
20389 </div></li>
20390 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20391 <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>
20392 <div class="gallerytext">
20393 </div>
20394 </div></li>
20395 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20396 <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>
20397 <div class="gallerytext">
20398 </div>
20399 </div></li>
20400 </ul>
20401
20402 !! html/parsoid
20403 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20404 <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>
20405 <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>
20406 <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>
20407 <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>
20408 </ul>
20409 !! end
20410
20411 !! test
20412 Gallery override link with WikiLink (T36852)
20413 !! options
20414 parsoid={
20415 "nativeGallery": true
20416 }
20417 !! wikitext
20418 <gallery>
20419 File:Foobar.jpg|alt=galleryalt|link=InterWikiLink
20420 </gallery>
20421 !! html/php
20422 <ul class="gallery mw-gallery-traditional">
20423 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20424 <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>
20425 <div class="gallerytext">
20426 </div>
20427 </div></li>
20428 </ul>
20429
20430 !! html/parsoid
20431 <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":{}}'>
20432 <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>
20433 </ul>
20434 !! end
20435
20436 !! test
20437 Gallery override link with absolute external link (T36852)
20438 !! options
20439 parsoid={
20440 "nativeGallery": true
20441 }
20442 !! wikitext
20443 <gallery>
20444 File:Foobar.jpg|alt=galleryalt|link=http://www.example.org
20445 </gallery>
20446 !! html/php
20447 <ul class="gallery mw-gallery-traditional">
20448 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20449 <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>
20450 <div class="gallerytext">
20451 </div>
20452 </div></li>
20453 </ul>
20454
20455 !! html/parsoid
20456 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20457 <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>
20458 </ul>
20459 !! end
20460
20461 !! test
20462 Gallery override link with absolute external link with LanguageConverter
20463 !! options
20464 language=zh
20465 !! input
20466 <gallery>
20467 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
20468 </gallery>
20469 !! result
20470 <ul class="gallery mw-gallery-traditional">
20471 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20472 <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>
20473 <div class="gallerytext">
20474 <p>caption
20475 </p>
20476 </div>
20477 </div></li>
20478 </ul>
20479
20480 !! end
20481
20482 !! test
20483 Gallery override link with malicious javascript (T36852)
20484 !! options
20485 parsoid={
20486 "modes": ["wt2html", "html2html"],
20487 "nativeGallery": true
20488 }
20489 !! wikitext
20490 <gallery>
20491 File:Foobar.jpg|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
20492 </gallery>
20493 !! html/php
20494 <ul class="gallery mw-gallery-traditional">
20495 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20496 <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>
20497 <div class="gallerytext">
20498 </div>
20499 </div></li>
20500 </ul>
20501
20502 !! html/parsoid
20503 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20504 <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>
20505 </ul>
20506 !! end
20507
20508 # Note that parsoid uses the invalid link as a caption, PHP does not.
20509 !! test
20510 Gallery with invalid title as link (T45964)
20511 !! options
20512 parsoid={
20513 "modes": ["wt2html", "html2html"],
20514 "nativeGallery": true
20515 }
20516 !! wikitext
20517 <gallery>
20518 File:Foobar.jpg|link=<
20519 </gallery>
20520 !! html/php
20521 <ul class="gallery mw-gallery-traditional">
20522 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20523 <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>
20524 <div class="gallerytext">
20525 </div>
20526 </div></li>
20527 </ul>
20528
20529 !! html/parsoid
20530 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20531 <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>
20532 </ul>
20533 !! end
20534
20535 !! test
20536 Serialize gallery without attrs in data-mw
20537 !! options
20538 parsoid={
20539 "modes": ["html2wt"],
20540 "nativeGallery": true
20541 }
20542 !! html/parsoid
20543 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","body":{}}'>
20544 <li class="gallerycaption">123</li>
20545 <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>
20546 </ul>
20547 !! wikitext
20548 <gallery caption="123">
20549 File:Test.png
20550 </gallery>
20551 !! end
20552
20553 !! test
20554 Gallery with class and style attributes
20555 !! options
20556 parsoid={
20557 "nativeGallery": true
20558 }
20559 !! wikitext
20560 <gallery class="center" style="text-align: center;">
20561 File:Foobar.jpg
20562 </gallery>
20563 !! html/php
20564 <ul class="gallery mw-gallery-traditional center" style="text-align: center;">
20565 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20566 <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>
20567 <div class="gallerytext">
20568 </div>
20569 </div></li>
20570 </ul>
20571
20572 !! html/parsoid
20573 <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":{}}'>
20574 <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>
20575 </ul>
20576 !! end
20577
20578 !! test
20579 Gallery in slideshow mode
20580 !! options
20581 parsoid={
20582 "nativeGallery": true
20583 }
20584 !! wikitext
20585 <gallery mode="slideshow" showthumbnails="">
20586 File:Foobar.jpg
20587 </gallery>
20588 !! html/php
20589 <ul class="gallery mw-gallery-slideshow" data-showthumbnails="1">
20590 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20591 <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>
20592 <div class="gallerytext">
20593 </div>
20594 </div></li>
20595 </ul>
20596
20597 !! html/parsoid
20598 <ul class="gallery mw-gallery-slideshow" data-showthumbnails="1" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{"mode":"slideshow","showthumbnails":""},"body":{}}'>
20599 <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>
20600 </ul>
20601 !! end
20602
20603 !! test
20604 HTML Hex character encoding (spells the word "JavaScript")
20605 !! options
20606 parsoid=wt2html,wt2wt,html2html
20607 !! wikitext
20608 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
20609 !! html/php
20610 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
20611 </p>
20612 !! html/php+tidy
20613 <p>JavaScript</p>
20614 !! html/parsoid
20615 <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>
20616 !! end
20617
20618 !! test
20619 HTML Hex character encoding bogus encoding (T28437 regression check)
20620 !! wikitext
20621 &#xsee;&#XSEE;
20622 !! html/php
20623 <p>&amp;#xsee;&amp;#XSEE;
20624 </p>
20625 !! html/parsoid
20626 <p>&amp;#xsee;&amp;#XSEE;</p>
20627 !! end
20628
20629 !! test
20630 HTML Hex character encoding mixed case
20631 !! options
20632 parsoid=wt2html,wt2wt,html2html
20633 !! wikitext
20634 &#xEE;&#Xee;
20635 !! html/php
20636 <p>&#xee;&#xee;
20637 </p>
20638 !! html/php+tidy
20639 <p>îî</p>
20640 !! html/parsoid
20641 <p><span typeof="mw:Entity">î</span><span typeof="mw:Entity">î</span></p>
20642 !! end
20643
20644 # See: https://www.w3.org/TR/html5/syntax.html#character-references
20645 # Note that U+000C (form feed) is not a valid XML character, so
20646 # it is banned even though allowed in HTML5.
20647 !! test
20648 Illegal character references (T106578)
20649 !! wikitext
20650 ; Null: &#00;
20651 ; FF: &#xC;
20652 ; CR: &#xD;
20653 ; Control (low): &#8;
20654 ; Control (high): &#x7F; &#x9F;
20655 ; Surrogate: &#xD83D;&#xDCA9;
20656 ; This is an okay astral character: &#x1F4A9;
20657 !! html+tidy
20658 <dl>
20659 <dt>Null</dt>
20660 <dd>&amp;#00;</dd>
20661 <dt>FF</dt>
20662 <dd>&amp;#xC;</dd>
20663 <dt>CR</dt>
20664 <dd>&amp;#xD;</dd>
20665 <dt>Control (low)</dt>
20666 <dd>&amp;#8;</dd>
20667 <dt>Control (high)</dt>
20668 <dd>&amp;#x7F; &amp;#x9F;</dd>
20669 <dt>Surrogate</dt>
20670 <dd>&amp;#xD83D;&amp;#xDCA9;</dd>
20671 <dt>This is an okay astral character</dt>
20672 <dd>💩</dd>
20673 </dl>
20674 !! end
20675
20676 !! test
20677 __FORCETOC__ override
20678 !! wikitext
20679 __NEWSECTIONLINK__
20680 __FORCETOC__
20681 !! html/php
20682 <p><br />
20683 </p>
20684 !! end
20685
20686 !! test
20687 ISBN code coverage
20688 !! wikitext
20689 ISBN 978-0-1234-56&#x20;789
20690 !! html
20691 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
20692 </p>
20693 !! html+tidy
20694 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a> 789</p>
20695 !! html/parsoid
20696 <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>
20697 !! end
20698
20699 !! test
20700 ISBN followed by 5 spaces
20701 !! wikitext
20702 ISBN
20703 !! html
20704 <p>ISBN
20705 </p>
20706 !! end
20707
20708 !! test
20709 Double ISBN
20710 !! wikitext
20711 ISBN ISBN 1234567890
20712 !! html/php
20713 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
20714 </p>
20715 !! html/parsoid
20716 <p>ISBN <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a></p>
20717 !! end
20718
20719 # Uppercase X and lowercase x as well
20720 !! test
20721 ISBN with an X
20722 !! wikitext
20723 ISBN 3-462-04561-X
20724 ISBN 3-462-04561-x
20725 ISBN 080442957X
20726 ISBN 080442957x
20727 ISBN 978080442957X
20728 ISBN 978080442957x
20729 !! html/php
20730 <p><a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-X</a>
20731 <a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-x</a>
20732 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957X</a>
20733 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957x</a>
20734 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957X</a>
20735 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957x</a>
20736 </p>
20737 !! html/parsoid
20738 <p><a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-X</a>
20739 <a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-x</a>
20740 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957X</a>
20741 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957x</a>
20742 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957X</a>
20743 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957x</a></p>
20744 !! end
20745
20746 !! test
20747 ISBN with empty prefix (parsoid test)
20748 !! wikitext
20749 ISBN 1234567890
20750 !! html/php
20751 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
20752 </p>
20753 !! html/parsoid
20754 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink">ISBN 1234567890</a></p>
20755 !! end
20756
20757 !! test
20758 T24905: <abbr> followed by ISBN followed by </a>
20759 !! wikitext
20760 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
20761 !! html/php
20762 <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>
20763 </p>
20764 !! html/parsoid
20765 <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>
20766 !! end
20767
20768 !! test
20769 Double RFC
20770 !! wikitext
20771 RFC RFC 1234
20772 !! html
20773 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
20774 </p>
20775 !! end
20776
20777 !! test
20778 Double RFC with a wiki link
20779 !! wikitext
20780 RFC [[RFC 1234]]
20781 !! html
20782 <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>
20783 </p>
20784 !! end
20785
20786 !! test
20787 RFC code coverage
20788 !! wikitext
20789 RFC 983&#x20;987
20790 !! html
20791 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
20792 </p>
20793 !! html+tidy
20794 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a> 987</p>
20795 !! end
20796
20797 !! test
20798 Centre-aligned image
20799 !! wikitext
20800 [[Image:foobar.jpg|centre]]
20801 !! html
20802 <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>
20803
20804 !!end
20805
20806 !! test
20807 None-aligned image
20808 !! wikitext
20809 [[Image:foobar.jpg|none]]
20810 !! html
20811 <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>
20812
20813 !!end
20814
20815 !! test
20816 Width + Height sized image (using px) (height is ignored)
20817 !! wikitext
20818 [[Image:foobar.jpg|640x480px]]
20819 !! html
20820 <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>
20821 </p>
20822 !!end
20823
20824 !! test
20825 Width-sized image (using px, no following whitespace)
20826 !! wikitext
20827 [[Image:foobar.jpg|640px]]
20828 !! html
20829 <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>
20830 </p>
20831 !!end
20832
20833 !! test
20834 Width-sized image (using px, with following whitespace - test regression from r39467)
20835 !! wikitext
20836 [[Image:foobar.jpg|640px ]]
20837 !! html
20838 <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>
20839 </p>
20840 !!end
20841
20842 !! test
20843 Width-sized image (using px, with preceding whitespace - test regression from r39467)
20844 !! wikitext
20845 [[Image:foobar.jpg| 640px]]
20846 !! html
20847 <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>
20848 </p>
20849 !!end
20850
20851 !! test
20852 Image with page parameter
20853 !! options
20854 djvu
20855 !! wikitext
20856 [[File:LoremIpsum.djvu|page=2]]
20857 !! html/php
20858 <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>
20859 </p>
20860 !! html/parsoid
20861 <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>
20862 !! end
20863
20864 !! test
20865 Another italics / bold test
20866 !! wikitext
20867 ''' ''x'
20868 !! html
20869 <pre>'<i> </i>x'
20870 </pre>
20871 !!end
20872
20873 # FIXME: The php output seems broken. It's interleaving some open/close tags.
20874 !! test
20875 dt/dd/dl test
20876 !! wikitext
20877 :;;;::
20878 !! html/php
20879 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dt></dl></dd></dl></dd></dl></dd></dl></dd></dl></dd></dl>
20880
20881 !! html/parsoid
20882 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dd></dl></dd></dl></dt></dl></dt></dl></dt></dl></dd></dl>
20883
20884 !!end
20885
20886 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
20887 !! test
20888 Images with the "|" character in the comment
20889 !! wikitext
20890 [[File:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
20891 !! html/php
20892 <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>
20893
20894 !! html/parsoid
20895 <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>
20896 !! end
20897
20898 !! test
20899 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
20900 !! wikitext
20901 <html><script>alert(1);</script></html>
20902 !! html
20903 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
20904 </p>
20905 !! end
20906
20907 !! test
20908 HTML with raw HTML ($wgRawHtml==true)
20909 !! options
20910 wgRawHtml=1
20911 !! wikitext
20912 <html><script>alert(1);</script></html>
20913 !! html
20914 <p><script>alert(1);</script>
20915 </p>
20916 !! end
20917
20918 !! test
20919 Parents of subpages, one level up
20920 !! options
20921 subpage title=[[Subpage test/L1/L2/L3]]
20922 !! wikitext
20923 [[../|L2]]
20924 !! html
20925 <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>
20926 </p>
20927 !! end
20928
20929
20930 !! test
20931 Parents of subpages, one level up, not named
20932 !! options
20933 subpage title=[[Subpage test/L1/L2/L3]]
20934 !! wikitext
20935 [[../]]
20936 !! html
20937 <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>
20938 </p>
20939 !! end
20940
20941
20942
20943 !! test
20944 Parents of subpages, two levels up
20945 !! options
20946 subpage title=[[Subpage test/L1/L2/L3]]
20947 !! wikitext
20948 [[../../|L1]]2
20949
20950 [[../../|L1]]l
20951 !! html
20952 <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
20953 </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>
20954 </p>
20955 !! end
20956
20957 !! test
20958 Parents of subpages, two levels up, without trailing slash or name.
20959 !! options
20960 subpage title=[[Subpage test/L1/L2/L3]]
20961 !! wikitext
20962 [[../..]]
20963 !! html
20964 <p>[[../..]]
20965 </p>
20966 !! end
20967
20968 !! test
20969 Parents of subpages, two levels up, with lots of extra trailing slashes.
20970 !! options
20971 subpage title=[[Subpage test/L1/L2/L3]]
20972 !! wikitext
20973 [[../../////]]
20974 !! html
20975 <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>
20976 </p>
20977 !! end
20978
20979 !! article
20980 Subpage test/L1/L2/L3Sibling
20981 !! text
20982 Sibling article
20983 !! endarticle
20984
20985 !! test
20986 Transclusion of a sibling page (one level up)
20987 !! options
20988 subpage title=[[Subpage test/L1/L2/L3]]
20989 !! wikitext
20990 {{../L3Sibling}}
20991 !! html
20992 <p>Sibling article
20993 </p>
20994 !! end
20995
20996 !! test
20997 Transclusion of a child page
20998 !! options
20999 subpage title=[[Subpage test/L1/L2]]
21000 !! wikitext
21001 {{/L3Sibling}}
21002 !! html
21003 <p>Sibling article
21004 </p>
21005 !! end
21006
21007 # This is wt2html only in Parsoid because we add <nowiki>
21008 # because of {{..}} and we don't expect to fix that to
21009 # eliminate the nowikis selective for {{..}} markup.
21010 !! test
21011 Non-transclusion because of too many up levels
21012 !! options
21013 subpage title=[[Subpage test/L1/L2/L3]]
21014 parsoid=wt2html
21015 !! wikitext
21016 {{../../../../More than parent}}
21017 !! html/php
21018 <p>{{../../../../More than parent}}
21019 </p>
21020 !! html/parsoid
21021 <p>{{../../../../More than parent}}</p>
21022 !! end
21023
21024 !! test
21025 Definition list code coverage
21026 !! wikitext
21027 ; title : def
21028 ; title : def
21029 ;title: def
21030 !! html/php
21031 <dl><dt> title &#160;</dt>
21032 <dd> def</dd>
21033 <dt> title&#160;</dt>
21034 <dd> def</dd>
21035 <dt>title</dt>
21036 <dd> def</dd></dl>
21037
21038 !! html/parsoid
21039 <dl><dt> title <span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
21040 <dt> title<span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
21041 <dt>title</dt><dd> def</dd></dl>
21042 !! end
21043
21044 !! test
21045 Don't fall for the self-closing div
21046 !! wikitext
21047 <div>hello world</div/>
21048 !! html
21049 <div>hello world</div>
21050
21051 !! end
21052
21053 !! test
21054 MSGNW magic word
21055 !! wikitext
21056 {{MSGNW:msg}}
21057 !! html/php
21058 <p>&#91;&#91;:Template:Msg&#93;&#93;
21059 </p>
21060 !! end
21061
21062 !! test
21063 RAW magic word
21064 !! wikitext
21065 {{RAW:QUERTY}}
21066 !! html
21067 <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>
21068 </p>
21069 !! end
21070
21071 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
21072 !! test
21073 Always escape literal '>' in output, not just after '<'
21074 !! wikitext
21075 ><>
21076 !! html
21077 <p>&gt;&lt;&gt;
21078 </p>
21079 !! end
21080
21081 !! test
21082 Template caching
21083 !! wikitext
21084 {{Test}}
21085 {{Test}}
21086 !! html
21087 <p>This is a test template
21088 This is a test template
21089 </p>
21090 !! end
21091
21092
21093 !! article
21094 MediaWiki:Fake
21095 !! text
21096 ==header==
21097 !! endarticle
21098
21099 !! test
21100 Inclusion of !userCanEdit() content
21101 !! wikitext
21102 {{MediaWiki:Fake}}
21103 !! html
21104 <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>
21105
21106 !! end
21107
21108
21109 !! test
21110 Out-of-order TOC heading levels
21111 !! wikitext
21112 ==2==
21113 ======6======
21114 ===3===
21115 =1=
21116 =====5=====
21117 ==2==
21118 !! html
21119 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
21120 <ul>
21121 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
21122 <ul>
21123 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
21124 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
21125 </ul>
21126 </li>
21127 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
21128 <ul>
21129 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
21130 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
21131 </ul>
21132 </li>
21133 </ul>
21134 </div>
21135
21136 <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>
21137 <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>
21138 <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>
21139 <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>
21140 <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>
21141 <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>
21142
21143 !! end
21144
21145
21146 !! test
21147 ISBN with a dummy number
21148 !! wikitext
21149 ISBN ---
21150 !! html
21151 <p>ISBN ---
21152 </p>
21153 !! end
21154
21155
21156 !! test
21157 ISBN with space-delimited number
21158 !! wikitext
21159 ISBN 92 9017 032 8
21160 !! html/php
21161 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
21162 </p>
21163 !! html/parsoid
21164 <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>
21165 !! end
21166
21167
21168 !! test
21169 ISBN with multiple spaces, no number
21170 !! wikitext
21171 ISBN foo
21172 !! html
21173 <p>ISBN foo
21174 </p>
21175 !! end
21176
21177
21178 !! test
21179 ISBN length
21180 !! wikitext
21181 ISBN 123456789
21182
21183 ISBN 1234567890
21184
21185 ISBN 12345678901
21186 !! html/php
21187 <p>ISBN 123456789
21188 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
21189 </p><p>ISBN 12345678901
21190 </p>
21191 !! html/parsoid
21192 <p>ISBN 123456789</p>
21193
21194 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a></p>
21195
21196 <p>ISBN 12345678901</p>
21197 !! end
21198
21199
21200 !! test
21201 ISBN with trailing year (T9110)
21202 !! wikitext
21203 ISBN 1-234-56789-0 - 2006
21204
21205 ISBN 1 234 56789 0 - 2006
21206 !! html/php
21207 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
21208 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
21209 </p>
21210 !! html/parsoid
21211 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1-234-56789-0</a> - 2006</p>
21212
21213 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1 234 56789 0</a> - 2006</p>
21214 !! end
21215
21216
21217 !! test
21218 anchorencode
21219 !! wikitext
21220 {{anchorencode:foo bar©#%n}}
21221 !! html
21222 <p>foo_bar.C2.A9.23.25n
21223 </p>
21224 !! end
21225
21226 !! test
21227 anchorencode trims spaces
21228 !! wikitext
21229 {{anchorencode: __pretty__please__}}
21230 !! html
21231 <p>pretty_please
21232 </p>
21233 !! end
21234
21235 !! test
21236 anchorencode deals with links
21237 !! wikitext
21238 {{anchorencode: [[hello|world]] [[hi]]}}
21239 !! html
21240 <p>world_hi
21241 </p>
21242 !! end
21243
21244 !! test
21245 anchorencode deals with templates
21246 !! wikitext
21247 {{anchorencode: {{Foo}} }}
21248 !! html
21249 <p>FOO
21250 </p>
21251 !! end
21252
21253 !! test
21254 anchorencode encodes like the TOC generator: (T20431)
21255 !! wikitext
21256 === _ +:.3A%3A&&amp;]] ===
21257 {{anchorencode: _ +:.3A%3A&&amp;]] }}
21258 __NOEDITSECTION__
21259 !! html
21260 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
21261 <p>.2B:.3A.253A.26.26.5D.5D
21262 </p>
21263 !! end
21264
21265 !! test
21266 T8200: blockquotes and paragraph formatting
21267 !! wikitext
21268 <blockquote>
21269 foo
21270 </blockquote>
21271
21272 bar
21273
21274 baz
21275 !! html
21276 <blockquote>
21277 <p>foo
21278 </p>
21279 </blockquote>
21280 <p>bar
21281 </p>
21282 <pre>baz
21283 </pre>
21284 !! end
21285
21286 !! test
21287 T10293: Use of center tag ruins paragraph formatting
21288 !! wikitext
21289 <center>
21290 foo
21291 </center>
21292
21293 bar
21294
21295 baz
21296 !! html
21297 <center>
21298 <p>foo
21299 </p>
21300 </center>
21301 <p>bar
21302 </p>
21303 <pre>baz
21304 </pre>
21305 !! end
21306
21307 !!test
21308 Parsing of overlapping (improperly nested) inline html tags
21309 !! wikitext
21310 <span><s>x</span></s>
21311 !! html/php
21312 <p><span><s>x&lt;/span&gt;</s></span>
21313 </p>
21314 !! html/parsoid
21315 <p><span><s>x</s></span>
21316 </p>
21317 !!end
21318
21319 ###
21320 ### Language variants related tests
21321 ###
21322
21323 # Parsoid does not mark self-links.
21324 # Parsoid does not convert links; PHP will do any necessary redirects.
21325
21326 !! test
21327 Self-link in language variants
21328 !! options
21329 title=[[Dunav]] language=sr
21330 !! wikitext
21331 Both [[Dunav]] and [[Дунав]] are names for this river.
21332 !! html/php
21333 <p>Both <a class="mw-selflink selflink">Dunav</a> and <a class="mw-selflink selflink">Дунав</a> are names for this river.
21334 </p>
21335 !! html/parsoid
21336 <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>
21337 !! end
21338
21339 !! article
21340 Дуна
21341 !! text
21342 content
21343 !! endarticle
21344
21345 !! test
21346 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
21347 !! options
21348 title=[[Duna]] language=sr
21349 !! wikitext
21350 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
21351 !! html/php
21352 <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.
21353 </p>
21354 !! html/parsoid
21355 <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>
21356 !! end
21357
21358 !! test
21359 Link to a section of a variant of this title shouldn't be parsed as self-link
21360 !! options
21361 title=[[Duna]] language=sr
21362 !! wikitext
21363 [[Dуна]] is a self-link while [[Dunа#Foo]] and [[Dуна#Foo]] are not self-links.
21364 !! html/php
21365 <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.
21366 </p>
21367 !! html/parsoid
21368 <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>
21369 !! end
21370
21371 !! test
21372 Link to pages in language variants
21373 !! options
21374 language=sr
21375 !! wikitext
21376 Main Page can be written as [[Маин Паге]]
21377 !! html/php
21378 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
21379 </p>
21380 !! html/parsoid
21381 <p>Main Page can be written as <a rel="mw:WikiLink" href="./Маин_Паге" title="Маин Паге">Маин Паге</a></p>
21382 !! end
21383
21384
21385 !! test
21386 Multiple links to pages in language variants
21387 !! options
21388 language=sr
21389 !! wikitext
21390 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
21391 !! html/php
21392 <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>.
21393 </p>
21394 !! html/parsoid
21395 <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>
21396 !! end
21397
21398
21399 !! test
21400 Simple template in language variants
21401 !! options
21402 language=sr
21403 !! wikitext
21404 {{тест}}
21405 !! html/php
21406 <p>This is a test template
21407 </p>
21408 !! end
21409
21410
21411 !! test
21412 Template with explicit namespace in language variants
21413 !! options
21414 language=sr
21415 !! wikitext
21416 {{Template:тест}}
21417 !! html/php
21418 <p>This is a test template
21419 </p>
21420 !! end
21421
21422
21423 !! test
21424 Basic test for template parameter in language variants
21425 !! options
21426 language=sr
21427 !! wikitext
21428 {{парамтест|param=foo}}
21429 !! html/php
21430 <p>This is a test template with parameter foo
21431 </p>
21432 !! end
21433
21434 !! test
21435 Simple category in language variants
21436 !! options
21437 language=sr cat
21438 !! wikitext
21439 [[Category:МедиаWики Усер'с Гуиде]]
21440 !! html/php
21441 cat=МедиаWики_Усер'с_Гуиде sort=
21442 !! html/parsoid
21443 <link rel="mw:PageProp/Category" href="./Категорија:МедиаWики_Усер'с_Гуиде" data-parsoid='{"stx":"simple","a":{"href":"./Категорија:МедиаWики_Усер&#39;с_Гуиде"},"sa":{"href":"Category:МедиаWики Усер&#39;с Гуиде"}}'/>
21444 !! end
21445
21446 !! article
21447 Category:分类
21448 !! text
21449 blah
21450 !! endarticle
21451
21452 !! article
21453 Category:分類
21454 !! text
21455 blah
21456 !! endarticle
21457
21458 ## We used to, but no longer wt2wt this test since the default serializer
21459 ## will normalize all categories to serialize on their own line.
21460 ## This wikitext usage is going to be fairly uncommon in production and
21461 ## selser will take care of preserving formatting in those scenarios.
21462 !! test
21463 Don't convert blue categorylinks to another variant (T35210)
21464 !! options
21465 cat
21466 language=zh
21467 parsoid=wt2html
21468 !! wikitext
21469 [[A]][[Category:分类]]
21470 !! html/php
21471 cat=分类 sort=
21472 !! html/parsoid
21473 <p><a rel="mw:WikiLink" href="./A" title="A">A</a></p>
21474 <link rel="mw:PageProp/Category" href="./Category:分类"/>
21475 !! end
21476
21477 !! test
21478 Stripping -{}- tags (language variants)
21479 !! options
21480 language=sr
21481 !! wikitext
21482 Latin proverb: -{Ne nuntium necare}-
21483 !! html/php
21484 <p>Latin proverb: Ne nuntium necare
21485 </p>
21486 !! html/parsoid
21487 <p>Latin proverb: <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Ne nuntium necare"}}'></span></p>
21488 !! end
21489
21490
21491 !! test
21492 Prevent conversion with -{}- tags (language variants)
21493 !! options
21494 language=sr variant=sr-ec
21495 !! wikitext
21496 Latinski: -{Ne nuntium necare}-
21497 !! html/php
21498 <p>Латински: Ne nuntium necare
21499 </p>
21500 !! html/parsoid
21501 <p>Latinski: <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Ne nuntium necare"}}'></span></p>
21502 !! end
21503
21504
21505 !! test
21506 Prevent conversion of text with -{}- tags (language variants)
21507 !! options
21508 language=sr variant=sr-ec
21509 !! wikitext
21510 Latinski: -{Ne nuntium necare}-
21511 !! html/php
21512 <p>Латински: Ne nuntium necare
21513 </p>
21514 !! html/parsoid
21515 <p>Latinski: <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Ne nuntium necare"}}'></span></p>
21516 !! end
21517
21518
21519 !! test
21520 Prevent conversion of links with -{}- tags (language variants)
21521 !! options
21522 language=sr variant=sr-ec
21523 !! wikitext
21524 -{[[Main Page]]}-
21525 !! html/php
21526 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
21527 </p>
21528 !! html/parsoid
21529 <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>
21530 !! end
21531
21532
21533 !! test
21534 -{}- tags within headlines (within html for parserConvert())
21535 !! options
21536 language=sr variant=sr-ec
21537 !! wikitext
21538 == -{Naslov}- ==
21539
21540 Note that even an unprotected headline ID is not affected by language
21541 conversion:
21542
21543 == Latinski ==
21544 !! html/php
21545 <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>
21546 <p>Ноте тхат евен ан унпротецтед хеадлине ИД ис нот аффецтед бy лангуаге
21547 цонверсион:
21548 </p>
21549 <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>
21550
21551 !! html/parsoid
21552 <h2 id="-.7BNaslov.7D-"><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Naslov"}}'></span></h2>
21553
21554 <p>Note that even an unprotected headline ID is not affected by language
21555 conversion:</p>
21556
21557 <h2 id="Latinski">Latinski</h2>
21558 !! end
21559
21560 !! test
21561 Explicit definition of language variant alternatives
21562 !! options
21563 language=zh variant=zh-tw
21564 !! wikitext
21565 -{zh:China;zh-tw:Taiwan}-, not China
21566 !! html/php
21567 <p>Taiwan, not China
21568 </p>
21569 !! html/parsoid
21570 <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>
21571 !! end
21572
21573 !! test
21574 Filter syntax for language variants
21575 !! options
21576 language=zh variant=zh-tw
21577 !! wikitext
21578 foo-{zh;zh-hans;zh-hant|blog, WEBJOURNAL, WEBLOG}-quux
21579 !! html/php
21580 <p>fooblog, WEBJOURNAL, WEBLOGquux
21581 </p>
21582 !! html/parsoid
21583 <p>foo<span typeof="mw:LanguageVariant" data-mw-variant='{"filter":{"l":["zh","zh-hans","zh-hant"],"t":"blog, WEBJOURNAL, WEBLOG"}}'></span>quux</p>
21584 !! end
21585
21586 # Note that Parsoid post-processing for language variants needs to
21587 # update the `title` attribute here, based on the mw:ExpandedAttrs property
21588 !! test
21589 Conversion around HTML tags
21590 !! options
21591 language=sr variant=sr-ec
21592 !! wikitext
21593 -{H|span=>sr-ec:script;title=>sr-ec:src}-
21594 <span title="La-{sr-el:L;sr-ec:C}-tin">ski</span>
21595 !! html/php
21596 <p>
21597 <span title="ЛаCтин">ски</span>
21598 </p>
21599 !! html/parsoid
21600 <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"}]}'/>
21601 <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>
21602 !! end
21603
21604 !! test
21605 Explicit session-wise two-way language variant mapping (A flag and - flag)
21606 !! options
21607 language=zh variant=zh-tw
21608 !! wikitext
21609 This is -{zh:China; zh-tw:Taiwan}-, but we'll forget that now.
21610
21611 Taiwan is not China.
21612
21613 But -{A|zh:China; zh-tw:Taiwan}- is China,
21614
21615 (This-{-|zh:China; zh-tw:Taiwan}- should be stripped!)
21616
21617 and -{China}- is China.
21618 !! html/php
21619 <p>This is Taiwan, but we'll forget that now.
21620 </p><p>Taiwan is not China.
21621 </p><p>But Taiwan is Taiwan,
21622 </p><p>(This should be stripped!)
21623 </p><p>and China is China.
21624 </p>
21625 !! html/parsoid
21626 <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>
21627 <p>Taiwan is not China.</p>
21628 <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>
21629 <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>
21630 <p>and <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"China"}}'></span> is China.</p>
21631 !! end
21632
21633 !! test
21634 Explicit session-wise one-way language variant mapping (A flag and - flag)
21635 !! options
21636 language=zh variant=zh-tw
21637 !! wikitext
21638 This is -{COUNTRY=>zh:China;COUNTRY=>zh-tw:Taiwan}-, but we'll forget that now.
21639
21640 COUNTRY is China or Taiwan.
21641
21642 But -{A|COUNTRY=>zh:China;COUNTRY=>zh-tw:Taiwan}- is COUNTRY,
21643
21644 (This-{-|COUNTRY=>zh:China;COUNTRY=>zh-tw:Taiwan}- should be stripped!)
21645
21646 and -{COUNTRY}- is COUNTRY.
21647 !! html/php
21648 <p>This is Taiwan, but we'll forget that now.
21649 </p><p>COUNTRY is China or Taiwan.
21650 </p><p>But Taiwan is Taiwan,
21651 </p><p>(This should be stripped!)
21652 </p><p>and COUNTRY is COUNTRY.
21653 </p>
21654 !! html/parsoid
21655 <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>
21656 <p>COUNTRY is China or Taiwan.</p>
21657 <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>
21658 <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>
21659 <p>and <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"COUNTRY"}}'></span> is COUNTRY.</p>
21660 !! end
21661
21662 !! test
21663 Explicit session-wise two-way language variant mapping (H flag for hide)
21664 !! options
21665 language=zh variant=zh-tw
21666 !! wikitext
21667 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
21668
21669 Taiwan is China.
21670 !! html/php
21671 <p>(This should be stripped!)
21672 </p><p>Taiwan is Taiwan.
21673 </p>
21674 !! html/parsoid
21675 <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>
21676 <p>Taiwan is China.</p>
21677 !! end
21678
21679 !! test
21680 Explicit session-wise one-way language variant mapping (H flag for hide)
21681 !! options
21682 language=zh variant=zh-tw
21683 !! wikitext
21684 (This-{H|COUNTRY=>zh:China;COUNTRY=>zh-tw:Taiwan}- should be stripped!)
21685
21686 COUNTRY is Taiwan or China.
21687 !! html/php
21688 <p>(This should be stripped!)
21689 </p><p>Taiwan is Taiwan or China.
21690 </p>
21691 !! html/parsoid
21692 <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>
21693 <p>COUNTRY is Taiwan or China.</p>
21694 !! end
21695
21696 ## Note that parsoid test runner does not support 'showtitle' option.
21697 !! test
21698 Adding explicit conversion rule for title (T flag)
21699 !! options
21700 language=zh variant=zh-tw showtitle
21701 !! wikitext
21702 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
21703
21704 Taiwan is China.
21705 !! html/php
21706 Taiwan
21707 <p>Should be stripped!
21708 </p><p>Taiwan is China.
21709 </p>
21710 !! html/parsoid
21711 <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>
21712 <p>Taiwan is China.</p>
21713 !! end
21714
21715 !! test
21716 Code coverage: T combined with H flag
21717 !! options
21718 language=zh variant=zh-tw showtitle
21719 !! wikitext
21720 Should be stripped-{T;H|zh:China; zh-tw:Taiwan}-!
21721
21722 Taiwan is China.
21723 !! html/php
21724 Taiwan
21725 <p>Should be stripped!
21726 </p><p>Taiwan is Taiwan.
21727 </p>
21728 !! html/parsoid
21729 <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>
21730 <p>Taiwan is China.</p>
21731 !! end
21732
21733 !! test
21734 Code coverage: T with no variants
21735 !! options
21736 language=zh variant=zh-tw showtitle
21737 !! wikitext
21738 -{H|zh:China; zh-tw:Taiwan}-
21739 Taiwan is China.-{T|Taiwan is China}-
21740 !! html/php
21741 Taiwan is China
21742 <p>
21743 Taiwan is Taiwan.
21744 </p>
21745 !! html/parsoid
21746 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"zh","t":"China"},{"l":"zh-tw","t":"Taiwan"}]}'/>
21747 Taiwan is China.<meta typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Taiwan is China"},"title":true}'/></p>
21748 !! end
21749
21750 !! test
21751 Code coverage: rules with no variants
21752 !! options
21753 language=zh variant=zh-tw
21754 !! wikitext
21755 -{H|zh:China; zh-tw:Taiwan}-
21756 Taiwan is China.
21757 -{H|China}-
21758 Taiwan is China.
21759 !! html/php
21760 <p>
21761 Taiwan is Taiwan.
21762
21763 Taiwan is China.
21764 </p>
21765 !! html/parsoid
21766 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"zh","t":"China"},{"l":"zh-tw","t":"Taiwan"}]}'/>
21767 Taiwan is China.
21768 <meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"*","t":"China"}]}'/>
21769 Taiwan is China.</p>
21770 !! end
21771
21772
21773 !! test
21774 Code coverage: D flag for conversion rule
21775 !! options
21776 language=zh variant=zh-tw
21777 !! wikitext
21778 -{D|zh-cn:XA; zh-tw:YA}-
21779 -{A;D|zh-cn:XB; zh-tw:YB}-
21780 -{D;H|zh-cn:XC; zh-tw:YC}-
21781
21782 -{D;H|FOO=>zh-tw:BAR;FOO=>zh-cn:BAT}-
21783
21784 -{D|0=>zh-tw:1}-
21785 -{A;D|2=>zh-tw:3}-
21786 -{D;H|4=>zh-tw:5}-
21787
21788 XA XB XC YA YB YC FOO BAR BAT 012345
21789 !! html/php
21790 <p>大陆:XA;台灣:YA;
21791
21792 大陆:XC;台灣:YC;
21793 </p><p>FOO⇒台灣:BAR;FOO⇒大陆:BAT;
21794 </p><p>0⇒台灣:1;
21795
21796 4⇒台灣:5;
21797 </p><p>XA YB YC YA YB YC BAR BAR BAT 013355
21798 </p>
21799 !! html/parsoid
21800 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"describe":true,"twoway":[{"l":"zh-cn","t":"XA"},{"l":"zh-tw","t":"YA"}]}'></span>
21801 <meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"describe":true,"twoway":[{"l":"zh-cn","t":"XB"},{"l":"zh-tw","t":"YB"}]}'/>
21802 <span typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"describe":true,"twoway":[{"l":"zh-cn","t":"XC"},{"l":"zh-tw","t":"YC"}]}'></span></p>
21803 <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>
21804 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"describe":true,"oneway":[{"f":"0","l":"zh-tw","t":"1"}]}'></span>
21805 <meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"describe":true,"oneway":[{"f":"2","l":"zh-tw","t":"3"}]}'/>
21806 <span typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"describe":true,"oneway":[{"f":"4","l":"zh-tw","t":"5"}]}'></span></p>
21807 <p>XA XB XC YA YB YC FOO BAR BAT 012345</p>
21808 !! end
21809
21810 !! test
21811 Code coverage: N flag for conversion rule
21812 !! options
21813 language=zh variant=zh-cn
21814 !! wikitext
21815 -{N|zh-cn}-
21816
21817 -{N|zh-tw}-
21818
21819 -{N|sr-ec}-
21820 !! html/php
21821 <p>大陆
21822 </p><p>台灣
21823 </p><p>српски (ћирилица)‎
21824 </p>
21825 !! html/parsoid
21826 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"name":{"t":"zh-cn"}}'></span></p>
21827 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"name":{"t":"zh-tw"}}'></span></p>
21828 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"name":{"t":"sr-ec"}}'></span></p>
21829 !! end
21830
21831 # html2wt suppresses the bogus 'D' flag, so this is wt2html only
21832 !! test
21833 Code coverage: N flag for conversion rule (wt2html only)
21834 !! options
21835 language=zh variant=zh-cn
21836 parsoid=wt2html,html2html
21837 !! wikitext
21838 -{D;N|en}-
21839 !! html/php
21840 <p>English
21841 </p>
21842 !! html/parsoid
21843 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"name":{"t":"en"}}' data-parsoid='{"fl":["D","N"]}'></span></p>
21844 !! end
21845
21846 !! test
21847 Testing that changing the language variant here in the tests actually works
21848 !! options
21849 language=zh variant=zh showtitle
21850 !! wikitext
21851 Should be stripped-{T|zh:China; zh-tw:Taiwan}-!
21852 !! html/php
21853 China
21854 <p>Should be stripped!
21855 </p>
21856 !! html/parsoid
21857 <p>Should be stripped<meta typeof="mw:LanguageVariant" data-mw-variant='{"title":true,"twoway":[{"l":"zh","t":"China"},{"l":"zh-tw","t":"Taiwan"}]}'/>!</p>
21858 !! end
21859
21860 !! test
21861 Recursive conversion of alt and title attrs shouldn't clear converter state
21862 !! options
21863 language=zh variant=zh-cn
21864 showtitle
21865 !! wikitext
21866 -{H|zh-cn:Exclamation; zh-tw:exclamation}-
21867 Should be stripped-{T|zh-cn:China; zh-tw:Taiwan}-<span title="exclamation">!</span>
21868 !! html/php
21869 China
21870 <p>
21871 Should be stripped<span title="Exclamation">!</span>
21872 </p>
21873 !! html/parsoid
21874 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"zh-cn","t":"Exclamation"},{"l":"zh-tw","t":"exclamation"}]}'/>
21875 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>
21876 !! end
21877
21878 !! test
21879 T26072: more test on conversion rule for title
21880 !! options
21881 language=zh variant=zh-tw showtitle
21882 !! wikitext
21883 This should be stripped-{T|zh:China; zh-tw:Taiwan}-!
21884
21885 This won't take interferes with the title rule-{H|zh:Beijing; zh-tw:Taipei}-.
21886 !! html/php
21887 Taiwan
21888 <p>This should be stripped!
21889 </p><p>This won't take interferes with the title rule.
21890 </p>
21891 !! html/parsoid
21892 <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>
21893 <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>
21894 !! end
21895
21896 !! test
21897 Partly disable title conversion if variant == main language code
21898 !! options
21899 language=zh variant=zh title=[[ZH]] showtitle
21900 !! wikitext
21901 -{T|zh-cn:CN;zh-tw:TW}-
21902 !! html/php
21903 ZH
21904 <p>
21905 </p>
21906 !! html/parsoid
21907 <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>
21908 !! end
21909
21910 !! test
21911 Partly disable title conversion if variant == main language code, more
21912 !! options
21913 language=zh variant=zh title=[[ZH]] showtitle
21914 !! wikitext
21915 -{T|TW}-
21916 !! html/php
21917 ZH
21918 <p>
21919 </p>
21920 !! html/parsoid
21921 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"TW"},"title":true}'/></p>
21922 !! end
21923
21924 !! test
21925 Raw output of variant escape tags (R flag)
21926 !! options
21927 language=zh variant=zh-tw
21928 !! wikitext
21929 Raw: -{R|zh:China;zh-tw:Taiwan}-
21930 !! html/php
21931 <p>Raw: zh:China;zh-tw:Taiwan
21932 </p>
21933 !! html/parsoid
21934 <p>Raw: <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"zh:China;zh-tw:Taiwan"}}'></span></p>
21935 !! end
21936
21937 # html2wt suppresses the bogus 'D' flags, so this is wt2html only
21938 !! test
21939 Raw output of variant escape tags (R flag) (wt2html only)
21940 !! options
21941 language=zh variant=zh-tw
21942 parsoid=wt2html,html2html
21943 !! wikitext
21944 -{Variant}- -{D|syntax}- -{D;R|options}-
21945 !! html/php
21946 <p>Variant syntax options
21947 </p>
21948 !! html/parsoid
21949 <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>
21950 !! end
21951
21952 !! test
21953 Nested markup inside raw output of variant escape tags (R flag)
21954 !! options
21955 language=zh variant=zh-tw
21956 !! wikitext
21957 Nested raw: -{R|nested -{zh:China;zh-tw:Taiwan}- nested}-
21958 !! html/php
21959 <p>Nested raw: nested Taiwan nested
21960 </p>
21961 !! html/parsoid
21962 <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>
21963 !! end
21964
21965 !! test
21966 Nested markup and spaces inside raw output of variant escape tags (R flag)
21967 !! options
21968 language=zh variant=zh-tw
21969 !! wikitext
21970 X-{ outer -{ inner }- outer }-X
21971 !! html/php
21972 <p>X outer inner outer X
21973 </p>
21974 !! html/parsoid
21975 <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>
21976 !! end
21977
21978 !! test
21979 Templates inside raw output of variant escape tags (R flag)
21980 !! options
21981 language=zh variant=zh-tw
21982 !! wikitext
21983 Nested raw: -{R|nested {{echo|hi}} templates}-
21984 !! html/php
21985 <p>Nested raw: nested hi templates
21986 </p>
21987 !! html/parsoid
21988 <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>
21989 !! end
21990
21991 !! test
21992 Strings evaluating false shouldn't be ignored by Language converter (T51072)
21993 !! options
21994 language=zh variant=zh-cn
21995 !! input
21996 -{zh-cn:0;zh-sg:1;zh-tw:2;zh-hk:3}-
21997 !! html/php
21998 <p>0
21999 </p>
22000 !! html/parsoid
22001 <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>
22002 !! end
22003
22004 !! test
22005 Conversion rules from [numeric-only string] to [something else] (T48634)
22006 !! options
22007 language=zh variant=zh-cn
22008 !! input
22009 -{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
22010 !! html/php
22011 <p>D12345EE12345
22012 </p>
22013 !! html/parsoid
22014 <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>
22015 !! end
22016
22017 !! test
22018 Two-way converter rule entries with an empty value should be ignored (T53551)
22019 !! options
22020 language=zh variant=zh-cn
22021 !! input
22022 -{H|zh-cn:foo;zh-tw:;}-foobar
22023 !! html/php
22024 <p>foobar
22025 </p>
22026 !! html/parsoid
22027 <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>
22028 !! end
22029
22030 !! test
22031 One-way converter rule entries with an empty "from" string should be ignored (T53551)
22032 !! options
22033 language=zh variant=zh-cn
22034 !! input
22035 -{H|=>zh-cn:foo;}-foobar
22036 !! html/php
22037 <p>foobar
22038 </p>
22039 !! html/parsoid
22040 <p><meta typeof="mw:LanguageVariant" data-parsoid='{"tSp":[5]}' data-mw-variant='{"add":true,"oneway":[{"f":"","l":"zh-cn","t":"foo"}]}'/>foobar</p>
22041 !! end
22042
22043 !! test
22044 Empty converter rule entries shouldn't be inserted into the conversion table (T53551)
22045 !! options
22046 language=zh variant=zh-cn
22047 !! input
22048 -{H|}-foobar
22049 !! html/php
22050 <p>foobar
22051 </p>
22052 !! html/parsoid
22053 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"*","t":""}]}'/>foobar</p>
22054 !! end
22055
22056 !! test
22057 Nested using of manual convert syntax
22058 !! options
22059 language=zh variant=zh-hk
22060 !! wikitext
22061 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
22062 !! html/php
22063 <p>Nested: Hello Hong Kong!
22064 </p>
22065 !! html/parsoid
22066 <p>Nested: <span typeof="mw:LanguageVariant" data-parsoid='{"tSp":[7]}' data-mw-variant='{"twoway":[{"l":"zh-hans","t":"Hi &lt;span typeof=\"mw:LanguageVariant\" data-mw-variant=&#39;{\"twoway\":[{\"l\":\"zh-cn\",\"t\":\"China\"},{\"l\":\"zh-sg\",\"t\":\"Singapore\"}]}&#39; data-parsoid=&#39;{\"fl\":[],\"tSp\":[7],\"dsr\":[21,53,null,2]}&#39;>&lt;/span>"},{"l":"zh-hant","t":"Hello &lt;span typeof=\"mw:LanguageVariant\" data-mw-variant=&#39;{\"twoway\":[{\"l\":\"zh-tw\",\"t\":\"Taiwan\"},{\"l\":\"zh-hk\",\"t\":\"H&amp;lt;span typeof=\\\"mw:LanguageVariant\\\" data-mw-variant=&amp;#39;{\\\"disabled\\\":{\\\"t\\\":\\\"ong\\\"}}&amp;#39; data-parsoid=&amp;#39;{\\\"fl\\\":[],\\\"dsr\\\":[90,97,null,2]}&amp;#39;>&amp;lt;/span> K&amp;lt;span typeof=\\\"mw:LanguageVariant\\\" data-mw-variant=&amp;#39;{\\\"disabled\\\":{\\\"t\\\":\\\"\\\"}}&amp;#39; data-parsoid=&amp;#39;{\\\"fl\\\":[],\\\"dsr\\\":[99,103,null,2]}&amp;#39;>&amp;lt;/span>ong\"}]}&#39; data-parsoid=&#39;{\"fl\":[],\"tSp\":[7],\"dsr\":[68,109,null,2]}&#39;>&lt;/span>"}]}'></span>!</p>
22067 !! end
22068
22069 !! test
22070 HTML markups with conversion syntax in attribs, nested in other conversion blocks
22071 !! options
22072 language=zh variant=zh-cn
22073 !! wikitext
22074 -{zh;zh-hans;zh-hant|<span title="-{X}-">A</span>}-
22075 !! html/php
22076 <p><span title="X">A</span>
22077 </p>
22078 !! html/parsoid
22079 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"filter":{"l":["zh","zh-hans","zh-hant"],"t":"&lt;span title=\"\" about=\"#mwt1\" typeof=\"mw:ExpandedAttrs\" data-parsoid=&#39;{\"stx\":\"html\",\"a\":{\"title\":\"\"},\"sa\":{\"title\":\"-{X}-\"},\"dsr\":[21,49,20,7]}&#39; data-mw=&#39;{\"attribs\":[[{\"txt\":\"title\"},{\"html\":\"&amp;lt;span typeof=\\\"mw:LanguageVariant\\\" data-mw-variant=&amp;#39;{\\\"disabled\\\":{\\\"t\\\":\\\"X\\\"}}&amp;#39; data-parsoid=&amp;#39;{\\\"fl\\\":[],\\\"dsr\\\":[34,39,null,2]}&amp;#39;>&amp;lt;/span>\"}]]}&#39;>A&lt;/span>"}}'></span></p>
22080 !! end
22081
22082 !! test
22083 HTML markups with conversion syntax in attribs, nested in other conversion blocks (not working yet in PHP parser)
22084 !! options
22085 language=zh variant=zh-cn
22086 !! wikitext
22087 -{<span title="-{X}-">A</span>}-
22088 !! html/php+disabled
22089 <p><span title="X">A</span>
22090 </p>
22091 !! html/parsoid
22092 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"&lt;span title=\"\" about=\"#mwt1\" typeof=\"mw:ExpandedAttrs\" data-parsoid=&#39;{\"stx\":\"html\",\"a\":{\"title\":\"\"},\"sa\":{\"title\":\"-{X}-\"},\"dsr\":[2,30,20,7]}&#39; data-mw=&#39;{\"attribs\":[[{\"txt\":\"title\"},{\"html\":\"&amp;lt;span typeof=\\\"mw:LanguageVariant\\\" data-mw-variant=&amp;#39;{\\\"disabled\\\":{\\\"t\\\":\\\"X\\\"}}&amp;#39; data-parsoid=&amp;#39;{\\\"fl\\\":[],\\\"dsr\\\":[15,20,null,2]}&amp;#39;>&amp;lt;/span>\"}]]}&#39;>A&lt;/span>"}}'></span></p>
22093 !! end
22094
22095 # Parsoid and PHP disagree on how to parse this example: Parsoid
22096 # insists that the content of a language converter element be a valid
22097 # DOM fragment or attribute string
22098 !! test
22099 Language converter markup with block content
22100 !! options
22101 language=zh variant=zh-cn
22102 !! wikitext
22103 <span>a-{b<div>c}-d
22104
22105 <span>a-{zh;zh-hans;zh-hant|b<div>c}-d
22106
22107 <span>a-{H|0=>zh-cn:x<span>y;0=>zh-tw:b<div>c}-d
22108 !! html/php+tidy
22109 <p><span>ab</span></p>
22110 <div><span>cd <span>ab</span></span>
22111 <div><span>cd <span>ad</span></span></div>
22112 </div>
22113 !! html/parsoid
22114 <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>
22115
22116 <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>
22117
22118 <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>
22119 !! end
22120
22121 !! test
22122 LanguageConverter selser (1)
22123 !! options
22124 language=zh variant=zh-cn
22125 parsoid={
22126 "modes": ["wt2wt", "selser"],
22127 "changes": [
22128 ["span[typeof]", "attr", "data-mw-variant", "{\"disabled\":{\"t\":\"edited\"}}"]
22129 ]
22130 }
22131 !! wikitext
22132 -{raw}-
22133 !! wikitext/edited
22134 -{edited}-
22135 !! end
22136
22137 !! test
22138 LanguageConverter selser (2)
22139 !! options
22140 language=zh variant=zh-cn
22141 parsoid={
22142 "modes": ["wt2wt", "selser"],
22143 "changes": [
22144 ["span[class='x']", "contents", "text", "-{foo}-"],
22145 ["a", "contents", "text", "-{"],
22146 ["span[typeof]", "attr", "data-mw", "{\"parts\":[{\"template\":{\"target\":{\"wt\":\"1x\",\"href\":\"./Template:1x\"},\"params\":{\"1\":{\"wt\":\"-{\"}},\"i\":0}}]}"]
22147 ]
22148 }
22149 !! wikitext
22150 <span class="x">TEXT1</span>
22151 [http://example.com TEXT2]
22152 [[Foo|TEXT3]]
22153 {{echo|TEXT4}}
22154 !! wikitext/edited
22155 <span class="x"><nowiki>-{foo}-</nowiki></span>
22156 [http://example.com -{]
22157 [[Foo|<nowiki>-{</nowiki>]]
22158 {{1x|<nowiki>-{</nowiki>}}
22159 !! end
22160
22161 # Tests LanguageVariantText in ConstrainedText
22162 !! test
22163 LanguageConverter selser (3)
22164 !! options
22165 language=zh variant=zh-cn
22166 parsoid={
22167 "modes": ["wt2wt", "selser"],
22168 "changes": [
22169 ["td > span", "attr", "typeof", "mw:LanguageVariant"],
22170 ["td > span", "attr", "data-mw-variant", "{\"disabled\":{\"t\":\"edited\"}}"]
22171 ]
22172 }
22173 !! wikitext
22174 {|
22175 |-
22176 |<span>Foo</span>
22177 |}
22178 !! wikitext/edited
22179 {|
22180 |-
22181 |<nowiki/>-{edited}-
22182 |}
22183 !! end
22184
22185 # Tests LanguageVariantText._fromSelser
22186 !! test
22187 LanguageConverter selser (4)
22188 !! options
22189 language=zh variant=zh-cn
22190 parsoid={
22191 "modes": ["wt2wt", "selser"],
22192 "changes": [
22193 ["td > span.x", "remove"]
22194 ]
22195 }
22196 !! wikitext
22197 {|
22198 |-
22199 |<span class="x">Foo</span>-{Bar}-
22200 ||<span class="x">Foo</span>-{Bar}-
22201 |}
22202 !! wikitext/edited
22203 {|
22204 |-
22205 |<nowiki/>-{Bar}-
22206 ||-{Bar}-
22207 |}
22208 !! end
22209
22210 # Since Parsoid is starting to emit canonical wikitext for links,
22211 # [http://example.com http://example.com] will not RT back to that
22212 # form anymore.
22213 # Parsoid does not language-convert links (it is done in a
22214 # post-processing step)
22215 !! test
22216 Proper conversion of text in external links
22217 !! options
22218 language=sr variant=sr-ec
22219 parsoid=wt2html
22220 !! wikitext
22221 http://www.google.com
22222 gopher://www.google.com
22223 [http://www.google.com http://www.google.com]
22224 [gopher://www.google.com gopher://www.google.com]
22225 [https://www.google.com irc://www.google.com]
22226 [ftp://www.google.com www.google.com/ftp://dir]
22227 [//www.google.com www.google.com]
22228 !! html/php
22229 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
22230 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
22231 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
22232 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
22233 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
22234 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
22235 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
22236 </p>
22237 !! html/parsoid
22238 <p><a rel="mw:ExtLink" href="http://www.google.com">http://www.google.com</a>
22239 <a rel="mw:ExtLink" href="gopher://www.google.com">gopher://www.google.com</a>
22240 <a rel="mw:ExtLink" href="http://www.google.com">http://www.google.com</a>
22241 <a rel="mw:ExtLink" href="gopher://www.google.com">gopher://www.google.com</a>
22242 <a rel="mw:ExtLink" href="https://www.google.com">irc://www.google.com</a>
22243 <a rel="mw:ExtLink" href="ftp://www.google.com">www.google.com/ftp://dir</a>
22244 <a rel="mw:ExtLink" href="//www.google.com">www.google.com</a></p>
22245 !! end
22246
22247 !! test
22248 Do not convert roman numbers to language variants
22249 !! options
22250 language=sr variant=sr-ec
22251 !! wikitext
22252 Fridrih IV je car.
22253 !! html/php
22254 <p>Фридрих IV је цар.
22255 </p>
22256 !! html/parsoid
22257 <p>Fridrih IV je car.</p>
22258 !! end
22259
22260 !! test
22261 Unclosed language converter markup "-{"
22262 !! options
22263 language=sr
22264 !! wikitext
22265 -{T|hello
22266 !! html
22267 <p>-{T|hello
22268 </p>
22269 !! end
22270
22271 !! test
22272 Don't convert raw rule "-{R|=&gt;}-" to "=>"
22273 !! options
22274 language=sr
22275 !! wikitext
22276 -{R|=&gt;}-
22277 !! html/php
22278 <p>=&gt;
22279 </p>
22280 !! html/parsoid
22281 <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>
22282 !!end
22283
22284 !! test
22285 Don't break link parsing if language converter markup is in the caption.
22286 !! options
22287 language=sr variant=sr-ec
22288 !! wikitext
22289 [[Main Page|-{R|main page}-]]
22290 !! html/php
22291 <p><a href="/wiki/Main_Page" title="Маин Паге">main page</a>
22292 </p>
22293 !! html/parsoid
22294 <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>
22295 !! end
22296
22297 !! test
22298 T146304: Don't break template parsing if language converter markup is in the parameter.
22299 !! options
22300 language=sr variant=sr-ec
22301 !! wikitext
22302 {{echo|-{R|foo}-}}
22303 !! html/php
22304 <p>foo
22305 </p>
22306 !! html/parsoid
22307 <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>
22308 !! end
22309
22310 !! test
22311 T146305: Don't break image parsing if language converter markup is in the caption.
22312 !! options
22313 language=sr
22314 !! wikitext
22315 [[Датотека:Foobar.jpg|thumb|-{R|caption:}-]]
22316 !! html/php
22317 <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>
22318
22319 !! html/parsoid
22320 <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>
22321 !! end
22322
22323 !! test
22324 T146305: Don't break image parsing if nested language converter markup is in the caption.
22325 !! options
22326 language=zh variant=zh-cn
22327 !! wikitext
22328 [[File:Foobar.jpg|thumb|-{|zh-cn:blog (hk: -{zh-hans|WEBJOURNAL}-, tw: -{zh-hans|WEBLOG}-)}-]]
22329 !! html/php
22330 <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>
22331
22332 !! html/parsoid
22333 <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>
22334 !! end
22335
22336 # XXX html2wt disabled because rich markup in alt is not preserved.
22337 !! test
22338 Don't break gallery if language converter markup is inside.
22339 !! options
22340 language=zh
22341 !! wikitext
22342 <gallery>
22343 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=-{R|foo}-|-{R|bar}-]]|alt=-{R|bat}-
22344 File:foobar.jpg|{{Test|unamedParam|alt=-{R|param}-}}|alt=galleryalt
22345 </gallery>
22346 !! html/php
22347 <ul class="gallery mw-gallery-traditional">
22348 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
22349 <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>
22350 <div class="gallerytext">
22351 <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>
22352 </p>
22353 </div>
22354 </div></li>
22355 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
22356 <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>
22357 <div class="gallerytext">
22358 <p>This is a test template
22359 </p>
22360 </div>
22361 </div></li>
22362 </ul>
22363
22364 !! html/parsoid
22365 <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"}}'>
22366 <li class="gallerybox">
22367 <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>
22368 <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>
22369 </li>
22370 <li class="gallerybox">
22371 <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>
22372 <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>
22373 </li>
22374 </ul>
22375 !! end
22376
22377 !! test
22378 T153135: Don't break list handling if language converter markup is in the item.
22379 !! options
22380 language=zh variant=zh-cn
22381 !! wikitext
22382 ;-{zh-cn:AAA;zh-tw:BBB}-
22383 ;-{R|foo:bar}-
22384 !! html/php
22385 <dl><dt>AAA</dt>
22386 <dt>foo:bar</dt></dl>
22387
22388 !! html/parsoid
22389 <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>
22390 <dt data-parsoid='{"dsr":[25,39,1,0]}'><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"foo:bar"}}'></span></dt>
22391 </dl>
22392 !! end
22393
22394 // Note that parsoid does not protect colons unless language converter
22395 // markup is properly nested, because it is a backtracking parser.
22396 !! test
22397 T153135: Unclosed markup in definition list (code coverage)
22398 !! options
22399 language=zh variant=zh-cn
22400 !! wikitext
22401 ;<b>foo:bar
22402 ;-{zh-cn:AAA
22403 !! html/php+tidy
22404 <dl>
22405 <dt><b>foo:bar</b></dt>
22406 <dt><b>-{zh-cn:AAA</b></dt>
22407 </dl>
22408 !! html/parsoid
22409 <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}'>
22410 <dt data-parsoid='{"dsr":[12,20,1,0]}'>-{zh-cn</dt>
22411 <dd data-parsoid='{"stx":"row","dsr":[20,24,1,0]}'>AAA</dd>
22412 </b></dl>
22413 !! end
22414
22415 !! test
22416 T153135: Nested language converter markup in definition list (code coverage)
22417 !! options
22418 language=zh variant=zh-cn
22419 !! wikitext
22420 ;-{|zh-cn:AAA -{zh-hans|foo:bar}- -{R|bat:baz}-}-:def
22421 !! html/php
22422 <dl><dt>AAA foo:bar bat:baz</dt>
22423 <dd>def</dd></dl>
22424
22425 !! html/parsoid
22426 <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>
22427 <dd data-parsoid='{"stx":"row","dsr":[49,53,1,0]}'>def</dd>
22428 </dl>
22429 !! end
22430
22431 # html2wt mode disabled due to <nowiki> insertion.
22432 !! test
22433 T153140: Don't break table handling if language converter markup is in the cell.
22434 !! options
22435 language=sr variant=sr-ec
22436 parsoid=wt2html,wt2wt,html2html
22437 !! wikitext
22438 {|
22439 |-
22440 | -{R|B}-
22441 |}
22442 !! html/php
22443 <table>
22444
22445 <tr>
22446 <td> B
22447 </td></tr></table>
22448
22449 !! html/parsoid
22450 <table>
22451 <tbody>
22452 <tr>
22453 <td><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"B"}}'></span></td>
22454 </tr>
22455 </tbody>
22456 </table>
22457 !! end
22458
22459 !! test
22460 Language converter tricky html2wt cases (1)
22461 !! options
22462 language=sr
22463 parsoid=html2wt,wt2wt
22464 !! html/parsoid
22465 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"}-"}}'></span></p>
22466 !! wikitext
22467 -{<nowiki>}-</nowiki>}-
22468 !! html/php
22469 <p>&#125;-
22470 </p>
22471 !! end
22472
22473 !! test
22474 Language converter tricky html2wt cases (2)
22475 !! options
22476 language=sr
22477 parsoid=html2wt,wt2wt
22478 !! html/parsoid
22479 <p>-{foo}-</p>
22480 !! wikitext
22481 <nowiki>-{foo}-</nowiki>
22482 !! html/php
22483 <p>-&#123;foo&#125;-
22484 </p>
22485 !! end
22486
22487 !! test
22488 Language converter tricky html2wt cases (3)
22489 !! options
22490 language=sr
22491 parsoid=html2wt,wt2wt
22492 !! html/parsoid
22493 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"|"}}'></span></p>
22494 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"R|raw"}}'></span></p>
22495 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"-{foo}-"}}'></span></p>
22496 !! wikitext
22497 -{R||}-
22498
22499 -{R|R|raw}-
22500
22501 -{<nowiki>-{foo}-</nowiki>}-
22502 !! html/php
22503 <p>|
22504 </p><p>R|raw
22505 </p><p>-&#123;foo&#125;-
22506 </p>
22507 !! end
22508
22509 !! test
22510 Language converter tricky html2wt cases (4)
22511 !! options
22512 language=sr
22513 parsoid=html2wt,wt2wt
22514 !! html/parsoid
22515 <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>
22516 !! wikitext
22517 -{R|{{echo|hey}}}-
22518 !! html/php
22519 <p>hey
22520 </p>
22521 !! end
22522
22523 # Note that the <nowiki> escaping added by parsoid for source text,
22524 # destination text, and language names only works on the PHP side
22525 # for *destination text*. (HTML entity escaping wouldn't work
22526 # any better.) This is probably a bug, at least for source texts.
22527 # (For language names PHP uses a precise regexp based on the languages
22528 # it currently knows have variants, which is fragile since this set
22529 # can grow/shrink over time.)
22530 !! test
22531 Language converter tricky html2wt cases (5)
22532 !! options
22533 language=zh variant=zh-cn
22534 !! html/parsoid
22535 <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>
22536 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"oneway":[{"f":"A","l":"bo:g;us","t":"B"}]}'/></p>
22537 <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>
22538 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"twoway":[{"l":"bo:g;us","t":"xyz"},{"l":"zh-cn","t":"abc"}]}'></span></p>
22539 <p>a:b=>c xyz</p>
22540 !! wikitext
22541 -{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
22542
22543 -{H|A=><nowiki>bo:g;us</nowiki>:B}-
22544
22545 -{A|zh-tw:xyz; zh-cn:<nowiki>0;zh-tw:bar</nowiki>}-
22546
22547 -{<nowiki>bo:g;us</nowiki>:xyz; zh-cn:abc}-
22548
22549 a:b=>c xyz
22550 !! html/php+disabled
22551 <p>foobat;xyz=&gt;zh-cn:abc
22552 </p><p>A
22553 </p><p>0;zh-tw:bar
22554 </p><p>abc
22555 </p><p>a:b=&gt;c 0;zh-tw:bar
22556 </p>
22557 !! end
22558
22559 !! test
22560 T2529: Uncovered bullet
22561 !! wikitext
22562 * Foo {{bullet}}
22563 !! html
22564 <ul><li> Foo </li>
22565 <li> Bar</li></ul>
22566
22567 !! end
22568
22569 # Plain MediaWiki does not remove empty lists, but tidy actually does.
22570 # Templates in Wikipedia rely on this behavior, as tidy has always been
22571 # enabled there. These tests are normally run *without* tidy, so specify the
22572 # full output here.
22573 # To test realistic parsing behavior, apply a tidy-like transformation to both
22574 # the expected output and your parser's output.
22575 !! test
22576 T2529: Uncovered bullet leaving empty list, normally removed by tidy
22577 !! wikitext
22578 ******* Foo {{bullet}}
22579 !! html
22580 <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>
22581 <li> Bar</li></ul>
22582
22583 !! end
22584
22585 !! test
22586 T2529: Uncovered table already at line-start
22587 !! wikitext
22588 x
22589
22590 {{table}}
22591 y
22592 !! html
22593 <p>x
22594 </p>
22595 <table>
22596 <tr>
22597 <td> 1 </td>
22598 <td> 2
22599 </td></tr>
22600 <tr>
22601 <td> 3 </td>
22602 <td> 4
22603 </td></tr></table>
22604 <p>y
22605 </p>
22606 !! end
22607
22608 !! test
22609 T2529: Uncovered bullet in parser function result
22610 !! wikitext
22611 * Foo {{lc:{{bullet}} }}
22612 !! html
22613 <ul><li> Foo </li>
22614 <li> bar</li></ul>
22615
22616 !! end
22617
22618 !! test
22619 T7678: Double-parsed template argument
22620 !! wikitext
22621 {{lc:{{{1}}}|hello}}
22622 !! html
22623 <p>{{{1}}}
22624 </p>
22625 !! end
22626
22627 !! test
22628 T7678: Double-parsed template invocation
22629 !! wikitext
22630 {{lc:{{paramtest {{!}} param = hello }} }}
22631 !! html
22632 <p>{{paramtest | param = hello }}
22633 </p>
22634 !! end
22635
22636 !! test
22637 Case insensitivity of parser functions for non-ASCII characters (T10143)
22638 !! options
22639 language=cs
22640 title=[[Main Page]]
22641 !! wikitext
22642 {{PRVNÍVELKÉ:ěščř}}
22643 {{prvnívelké:ěščř}}
22644 {{PRVNÍMALÉ:ěščř}}
22645 {{prvnímalé:ěščř}}
22646 {{MALÁ:ěščř}}
22647 {{malá:ěščř}}
22648 {{VELKÁ:ěščř}}
22649 {{velká:ěščř}}
22650 !! html
22651 <p>Ěščř
22652 Ěščř
22653 ěščř
22654 ěščř
22655 ěščř
22656 ěščř
22657 ĚŠČŘ
22658 ĚŠČŘ
22659 </p>
22660 !! end
22661
22662 !! test
22663 Morwen/13: Unclosed link followed by heading
22664 !! wikitext
22665 [[link
22666 ==heading==
22667 !! html
22668 <p>[[link
22669 </p>
22670 <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>
22671
22672 !! end
22673
22674 !! test
22675 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
22676 !! wikitext
22677 {{foo|
22678 =heading=
22679 !! html
22680 <p>{{foo|
22681 </p>
22682 <h1><span class="mw-headline" id="heading">heading</span></h1>
22683
22684 !! end
22685
22686 !! test
22687 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
22688 !! wikitext
22689 {{foo|
22690 ==heading==
22691 !! html
22692 <p>{{foo|
22693 </p>
22694 <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>
22695
22696 !! end
22697
22698 !! test
22699 Tildes in comments
22700 !! options
22701 pst
22702 !! wikitext
22703 <!-- ~~~~ -->
22704 !! html/php
22705 <!-- ~~~~ -->
22706 !! end
22707
22708 !! test
22709 Paragraphs inside divs (no extra line breaks)
22710 !! wikitext
22711 <div>Line one
22712
22713 Line two</div>
22714 !! html
22715 <div>Line one
22716 Line two</div>
22717
22718 !! end
22719
22720 !! test
22721 Paragraphs inside divs (extra line break on open)
22722 !! wikitext
22723 <div>
22724 Line one
22725
22726 Line two</div>
22727 !! html
22728 <div>
22729 <p>Line one
22730 </p>
22731 Line two</div>
22732
22733 !! end
22734
22735 !! test
22736 Paragraphs inside divs (extra line break on close)
22737 !! wikitext
22738 <div>Line one
22739
22740 Line two
22741 </div>
22742 !! html
22743 <div>Line one
22744 <p>Line two
22745 </p>
22746 </div>
22747
22748 !! end
22749
22750 !! test
22751 Paragraphs inside divs (extra line break on open and close)
22752 !! wikitext
22753 <div>
22754 Line one
22755
22756 Line two
22757 </div>
22758 !! html
22759 <div>
22760 <p>Line one
22761 </p><p>Line two
22762 </p>
22763 </div>
22764
22765 !! end
22766
22767 !! test
22768 Nesting tags, paragraphs on lines which begin with <div>
22769 !! wikitext
22770 <div></div><strong>A
22771 B</strong>
22772 !! html/php+tidy
22773 <p><strong>A</strong></p>
22774 <p><strong>B</strong></p>
22775 !! html/parsoid
22776 <div></div>
22777 <p><strong>A
22778 B</strong>
22779 </p>
22780 !! end
22781
22782 # T8200: <blockquote> should behave like <div> with respect to line breaks
22783 !! test
22784 T8200: paragraphs inside blockquotes (no extra line breaks)
22785 !! wikitext
22786 <blockquote>Line one
22787
22788 Line two</blockquote>
22789 !! html
22790 <blockquote>Line one
22791 Line two</blockquote>
22792
22793 !! html+tidy
22794 <blockquote>
22795 <p>Line one Line two</p>
22796 </blockquote>
22797 !! end
22798
22799 !! test
22800 T8200: paragraphs inside blockquotes (extra line break on open)
22801 !! wikitext
22802 <blockquote>
22803 Line one
22804
22805 Line two</blockquote>
22806 !! html
22807 <blockquote>
22808 <p>Line one
22809 </p>
22810 Line two</blockquote>
22811
22812 !! html+tidy
22813 <blockquote>
22814 <p>Line one</p>
22815 Line two</blockquote>
22816 !! end
22817
22818 !! test
22819 T8200: paragraphs inside blockquotes (extra line break on close)
22820 !! wikitext
22821 <blockquote>Line one
22822
22823 Line two
22824 </blockquote>
22825 !! html
22826 <blockquote>Line one
22827 <p>Line two
22828 </p>
22829 </blockquote>
22830
22831 !! html+tidy
22832 <blockquote>
22833 <p>Line one</p>
22834 <p>Line two</p>
22835 </blockquote>
22836 !! end
22837
22838 !! test
22839 T8200: paragraphs inside blockquotes (extra line break on open and close)
22840 !! wikitext
22841 <blockquote>
22842 Line one
22843
22844 Line two
22845 </blockquote>
22846 !! html
22847 <blockquote>
22848 <p>Line one
22849 </p><p>Line two
22850 </p>
22851 </blockquote>
22852
22853 !! html+tidy
22854 <blockquote>
22855 <p>Line one</p>
22856 <p>Line two</p>
22857 </blockquote>
22858 !! end
22859
22860 !! test
22861 Paragraphs inside blockquotes/divs (no extra line breaks)
22862 !! wikitext
22863 <blockquote><div>Line one
22864
22865 Line two</div></blockquote>
22866 !! html
22867 <blockquote><div>Line one
22868 Line two</div></blockquote>
22869
22870 !! end
22871
22872 !! test
22873 Paragraphs inside blockquotes/divs (extra line break on open)
22874 !! wikitext
22875 <blockquote><div>
22876 Line one
22877
22878 Line two</div></blockquote>
22879 !! html
22880 <blockquote><div>
22881 <p>Line one
22882 </p>
22883 Line two</div></blockquote>
22884
22885 !! end
22886
22887 !! test
22888 Paragraphs inside blockquotes/divs (extra line break on close)
22889 !! wikitext
22890 <blockquote><div>Line one
22891
22892 Line two
22893 </div></blockquote>
22894 !! html
22895 <blockquote><div>Line one
22896 <p>Line two
22897 </p>
22898 </div></blockquote>
22899
22900 !! end
22901
22902 !! test
22903 Paragraphs inside blockquotes/divs (extra line break on open and close)
22904 !! wikitext
22905 <blockquote><div>
22906 Line one
22907
22908 Line two
22909 </div></blockquote>
22910 !! html
22911 <blockquote><div>
22912 <p>Line one
22913 </p><p>Line two
22914 </p>
22915 </div></blockquote>
22916
22917 !! end
22918
22919 !! test
22920 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
22921 !! options
22922 wgLinkHolderBatchSize=0
22923 !! wikitext
22924 [[meatball:1]]
22925 [[meatball:2]]
22926 [[meatball:3]]
22927 !! html
22928 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
22929 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
22930 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
22931 </p>
22932 !! end
22933
22934 !! test
22935 Free external link invading image caption
22936 !! wikitext
22937 [[Image:Foobar.jpg|thumb|http://x|hello]]
22938 !! html
22939 <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>
22940
22941 !! end
22942
22943 !! test
22944 T17196: localised external link numbers
22945 !! options
22946 language=fa
22947 !! wikitext
22948 [http://en.wikipedia.org/]
22949 !! html/php
22950 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
22951 </p>
22952 !! html/parsoid
22953 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/"></a></p>
22954 !! end
22955
22956 !! test
22957 Multibyte character in padleft
22958 !! wikitext
22959 {{padleft:-Hello|7|Æ}}
22960 !! html
22961 <p>Æ-Hello
22962 </p>
22963 !! end
22964
22965 !! test
22966 Multibyte character in padright
22967 !! wikitext
22968 {{padright:Hello-|7|Æ}}
22969 !! html
22970 <p>Hello-Æ
22971 </p>
22972 !! end
22973
22974 !!test
22975 formatdate parser function
22976 !! wikitext
22977 {{#formatdate:2009-03-24}}
22978 !! html
22979 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
22980 </p>
22981 !! end
22982
22983 !!test
22984 formatdate parser function, with default format
22985 !! wikitext
22986 {{#formatdate:2009-03-24|mdy}}
22987 !! html
22988 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
22989 </p>
22990 !! end
22991
22992 !! test
22993 Spacing of numbers in formatted dates
22994 !! wikitext
22995 {{#formatdate:January 15}}
22996 !! html
22997 <p><span class="mw-formatted-date" title="01-15">January 15</span>
22998 </p>
22999 !! end
23000
23001 !! test
23002 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
23003 !! options
23004 language=nl title=[[MediaWiki:Common.css]]
23005 !! wikitext
23006 {{#formatdate:2009-03-24|dmy}}
23007 !! html
23008 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
23009 </p>
23010 !! end
23011
23012 #
23013 #
23014 #
23015
23016 #
23017 # Edit comments
23018 #
23019
23020 !! test
23021 Edit comment with link
23022 !! options
23023 comment
23024 !! wikitext
23025 I like the [[Main Page]] a lot
23026 !! html/php
23027 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
23028 !!end
23029
23030 !! test
23031 Edit comment with link and link text
23032 !! options
23033 comment
23034 !! wikitext
23035 I like the [[Main Page|best pages]] a lot
23036 !! html/php
23037 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
23038 !!end
23039
23040 !! test
23041 Edit comment with link and link text with suffix
23042 !! options
23043 comment
23044 !! wikitext
23045 I like the [[Main Page|best page]]s a lot
23046 !! html/php
23047 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
23048 !!end
23049
23050 !! test
23051 Edit comment with section link (non-local, eg in history list)
23052 !! options
23053 comment title=[[Main Page]]
23054 !! wikitext
23055 /* External links */ removed bogus entries
23056 !! html/php
23057 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
23058 !!end
23059
23060 !! test
23061 Edit comment with section link and text before it (non-local, eg in history list)
23062 !! options
23063 comment title=[[Main Page]]
23064 !! wikitext
23065 pre-comment text /* External links */ removed bogus entries
23066 !! html/php
23067 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>
23068 !!end
23069
23070 !! test
23071 Edit comment with section link (local, eg in diff view)
23072 !! options
23073 comment local title=[[Main Page]]
23074 !! wikitext
23075 /* External links */ removed bogus entries
23076 !! html/php
23077 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
23078 !!end
23079
23080 !! test
23081 Edit comment with subpage link (T16080)
23082 !! options
23083 comment
23084 subpage
23085 title=[[Subpage test]]
23086 !! wikitext
23087 Poked at a [[/subpage]] here...
23088 !! html/php
23089 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
23090 !!end
23091
23092 !! test
23093 Edit comment with subpage link and link text (T16080)
23094 !! options
23095 comment
23096 subpage
23097 title=[[Subpage test]]
23098 !! wikitext
23099 Poked at a [[/subpage|neat little page]] here...
23100 !! html/php
23101 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
23102 !!end
23103
23104 !! test
23105 Edit comment with bogus subpage link in non-subpage NS (T16080)
23106 !! options
23107 comment
23108 title=[[Subpage test]]
23109 !! wikitext
23110 Poked at a [[/subpage]] here...
23111 !! html/php
23112 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...
23113 !!end
23114
23115 !! test
23116 Edit comment with bare anchor link (local, as on diff)
23117 !! options
23118 comment
23119 local
23120 title=[[Main Page]]
23121 !! wikitext
23122 [[#section]]
23123 !! html/php
23124 <a href="#section">#section</a>
23125 !! end
23126
23127 !! test
23128 Edit comment with bare anchor link (non-local, as on history)
23129 !! options
23130 comment
23131 title=[[Main Page]]
23132 !! wikitext
23133 [[#section]]
23134 !! html/php
23135 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
23136 !! end
23137
23138 !! test
23139 Anchor starting with underscore
23140 !! options
23141 title=[[Foo]]
23142 !! wikitext
23143 [[#_ref|One]]
23144 !! html/php
23145 <p><a href="#_ref">One</a>
23146 </p>
23147 !! html/parsoid
23148 <p><a rel="mw:WikiLink" href="./Foo#_ref" data-parsoid='{"stx":"piped","a":{"href":"./Foo#_ref"},"sa":{"href":"#_ref"}}'>One</a></p>
23149 !! end
23150
23151 !! test
23152 Id starting with underscore
23153 !! wikitext
23154 <div id="_ref"></div>
23155 !! html/*
23156 <div id="_ref"></div>
23157
23158 !! end
23159
23160 !! test
23161 Edit comment with link with more than one pipe (T99346)
23162 !! options
23163 comment
23164 !! wikitext
23165 [[Main Page|Many|pipes]]
23166 !! html/php
23167 <a href="/wiki/Main_Page" title="Main Page">Many|pipes</a>
23168 !! end
23169
23170 !! test
23171 Complex edit comment with link with more than one pipe (T99346)
23172 !! options
23173 comment
23174 !! wikitext
23175 Created page with "<noinclude>[[Category:Requests for permissions/Bot|{{subst:#titleparts:{{subst:PAGENAME}}|1|3}}]]</noinclude> === [[User:MineoBot|]] 8=== {{Request for permissions/links|Mineo..."
23176 !! html/php
23177 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;
23178 !! end
23179
23180 !! test
23181 Space normalisation on autocomment (T24784)
23182 !! options
23183 comment
23184 title=[[Main Page]]
23185 !! wikitext
23186 /* __hello__world__ */
23187 !! html/php
23188 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
23189 !! end
23190
23191 !! test
23192 percent-encoding and + signs in comments (T28410)
23193 !! options
23194 comment
23195 !! wikitext
23196 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
23197 !! html/php
23198 <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>
23199 !! end
23200
23201 # Parsoid doesn't support this yet: see T75581
23202 # but it *should* omit the 'src' attribute if the image is bad.
23203 # PHP side of tests was disabled in
23204 # mediawiki/core:6bd31e7d95161a6e88fa86df60871051da997c3c
23205 # because of issues in the PHP parserTests infrastructure
23206 # (but the output below is indeed what the PHP side emits)
23207 !! test
23208 Bad images - basic functionality
23209 !! wikitext
23210 [[File:Bad.jpg]]
23211 !! DISABLED/html/php
23212 !! html/parsoid
23213 <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>
23214 !! end
23215
23216 !! test
23217 Bad images - T18039: text after bad image disappears
23218 !! wikitext
23219 Foo bar
23220 [[File:Bad.jpg]]
23221 Bar foo
23222 !! DISABLED/html/php
23223 <p>Foo bar
23224 </p><p>Bar foo
23225 </p>
23226 !! html/parsoid
23227 <p>Foo bar
23228 <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>
23229 Bar foo</p>
23230 !! end
23231
23232 !! test
23233 Verify that displaytitle works (T24501) no displaytitle
23234 !! options
23235 showtitle
23236 !! config
23237 wgAllowDisplayTitle=true
23238 wgRestrictDisplayTitle=false
23239 !! wikitext
23240 this is not the the title
23241 !! html/php
23242 Parser test
23243 <p>this is not the the title
23244 </p>
23245 !! end
23246
23247 !! test
23248 Verify that displaytitle works (T24501) RestrictDisplayTitle=false
23249 !! options
23250 showtitle
23251 title=[[Screen]]
23252 !! config
23253 wgAllowDisplayTitle=true
23254 wgRestrictDisplayTitle=false
23255 !! wikitext
23256 this is not the the title
23257 {{DISPLAYTITLE:whatever}}
23258 !! html/php
23259 whatever
23260 <p>this is not the the title
23261 </p>
23262 !! end
23263
23264 !! test
23265 Verify that displaytitle works (T24501) RestrictDisplayTitle=true mismatch
23266 !! options
23267 showtitle
23268 title=[[Screen]]
23269 !! config
23270 wgAllowDisplayTitle=true
23271 wgRestrictDisplayTitle=true
23272 !! wikitext
23273 this is not the the title
23274 {{DISPLAYTITLE:whatever}}
23275 !! html/php
23276 Screen
23277 <p>this is not the the title
23278 </p>
23279 !! end
23280
23281 !! test
23282 Verify that displaytitle works (T24501) RestrictDisplayTitle=true matching
23283 !! options
23284 showtitle
23285 title=[[Screen]]
23286 !! config
23287 wgAllowDisplayTitle=true
23288 wgRestrictDisplayTitle=true
23289 !! wikitext
23290 this is not the the title
23291 {{DISPLAYTITLE:screen}}
23292 !! html/php
23293 screen
23294 <p>this is not the the title
23295 </p>
23296 !! end
23297
23298 !! test
23299 Verify that displaytitle works (T24501) AllowDisplayTitle=false
23300 !! options
23301 showtitle
23302 title=[[Screen]]
23303 !! config
23304 wgAllowDisplayTitle=false
23305 !! wikitext
23306 this is not the the title
23307 {{DISPLAYTITLE:screen}}
23308 !! html/php
23309 Screen
23310 <p>this is not the the title
23311 <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>
23312 </p>
23313 !! end
23314
23315 !! test
23316 Verify that displaytitle works (T24501) AllowDisplayTitle=false no DISPLAYTITLE
23317 !! options
23318 showtitle
23319 title=[[Screen]]
23320 !! config
23321 wgAllowDisplayTitle=false
23322 !! wikitext
23323 this is not the the title
23324 !! html/php
23325 Screen
23326 <p>this is not the the title
23327 </p>
23328 !! end
23329
23330 !! test
23331 Verify that displaytitle handles inline CSS styles (T28547) - rejected value
23332 !! options
23333 showtitle
23334 title=[[Screen]]
23335 !! config
23336 wgAllowDisplayTitle=true
23337 wgRestrictDisplayTitle=true
23338 !! wikitext
23339 this is not the the title
23340 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
23341 !! html/php
23342 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
23343 <p>this is not the the title
23344 </p>
23345 !! end
23346
23347 !! test
23348 Verify that displaytitle handles inline CSS styles (T28547) - accepted value
23349 !! options
23350 showtitle
23351 title=[[Screen]]
23352 !! config
23353 wgAllowDisplayTitle=true
23354 wgRestrictDisplayTitle=true
23355 !! wikitext
23356 this is not the the title
23357 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
23358 !! html/php
23359 <span style="color: red;">s</span>creen
23360 <p>this is not the the title
23361 </p>
23362 !! end
23363
23364 !! test
23365 Page status indicators: Empty name is invalid
23366 !! options
23367 showindicators
23368 !! wikitext
23369 <indicator name=" "></indicator>
23370 <indicator></indicator>
23371 !! html/php
23372 <p><span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
23373 <span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
23374 </p>
23375 !! end
23376
23377 !! test
23378 Page status indicators: Weird syntaxes that are okay
23379 !! options
23380 showindicators
23381 !! wikitext
23382 <indicator name="empty" />
23383 <indicator name="name"></indicator>
23384 !! html/php
23385 empty=
23386 name=
23387 <p><br />
23388 </p>
23389 !! end
23390
23391 !! test
23392 Page status indicators: Torture test
23393 !! options
23394 showindicators
23395 !! wikitext
23396 <indicator name="01">hello world</indicator>
23397 <indicator name="02">[[Main Page]]</indicator>
23398 <indicator name="03">[[File:Foobar.jpg|25px|link=]]</indicator>
23399 <indicator name="04">[[File:Foobar.jpg|25px]]</indicator>
23400 <indicator name="05">* foo
23401 * bar</indicator>
23402 <indicator name="06"><nowiki>foo</nowiki></indicator>
23403 <indicator name="07"> Preformatted</indicator>
23404 <indicator name="08"><div>Broken tag</indicator>
23405 <indicator name="09">{| class=wikitable
23406 | cell
23407 |}</indicator>
23408 <indicator name="10">Two
23409
23410 paragraphs</indicator>
23411 !! html/php
23412 01=hello world
23413 02=<a href="/wiki/Main_Page" title="Main Page">Main Page</a>
23414 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" />
23415 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>
23416 05=<ul><li> foo</li>
23417 <li> bar</li></ul>
23418
23419 06=foo
23420 07=<pre>Preformatted
23421 </pre>
23422 08=<div>Broken tag</div>
23423
23424 09=<table class="wikitable">
23425 <tr>
23426 <td> cell
23427 </td></tr></table>
23428
23429 10=<p>Two
23430 </p><p>paragraphs
23431 </p>
23432 <p><br />
23433 </p><p><br />
23434 </p><p><br />
23435 </p><p><br />
23436 </p><p><br />
23437 </p>
23438 !! end
23439
23440 !! test
23441 preload: check <noinclude> and <includeonly>
23442 !! options
23443 preload
23444 !! wikitext
23445 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
23446 !! html/php
23447 Hello kind world.
23448 !! end
23449
23450 !! test
23451 preload: check <onlyinclude>
23452 !! options
23453 preload
23454 !! wikitext
23455 Goodbye <onlyinclude>Hello world</onlyinclude>
23456 !! html/php
23457 Hello world
23458 !! end
23459
23460 !! test
23461 preload: can pass tags through if we want to
23462 !! options
23463 preload
23464 !! wikitext
23465 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
23466 !! html/php
23467 <includeonly>Hello world</includeonly>
23468 !! end
23469
23470 !! test
23471 preload: check that it doesn't try to do tricks
23472 !! options
23473 preload
23474 !! wikitext
23475 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
23476 !! html/php
23477 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
23478 !! end
23479
23480 !! test
23481 Play a bit with r67090 and T5158
23482 !! wikitext
23483 <div style="width:50% !important">&nbsp;</div>
23484 <div style="width:50%&nbsp;!important">&nbsp;</div>
23485 <div style="width:50%&#160;!important">&nbsp;</div>
23486 <div style="border : solid;">&nbsp;</div>
23487 !! html/php
23488 <div style="width:50% !important">&#160;</div>
23489 <div style="width:50% !important">&#160;</div>
23490 <div style="width:50% !important">&#160;</div>
23491 <div style="border&#160;: solid;">&#160;</div>
23492
23493 !! html/parsoid
23494 <div style="width:50% !important" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
23495 <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>
23496 <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>
23497 <div style="border : solid;" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
23498
23499 !! end
23500
23501 !! test
23502 HTML5 data attributes
23503 !! wikitext
23504 <span data-foo="bar">Baz</span>
23505 <p data-abc-def_hij="">Quuz</p>
23506 !! html/php
23507 <p><span data-foo="bar">Baz</span>
23508 </p>
23509 <p data-abc-def_hij="">Quuz</p>
23510
23511 !! html/parsoid
23512 <p><span data-foo="bar" data-parsoid='{"stx":"html"}'>Baz</span></p>
23513 <p data-abc-def_hij="" data-parsoid='{"stx":"html"}'>Quuz</p>
23514 !! end
23515
23516 !! test
23517 Strip reserved data attributes
23518 !! wikitext
23519 <div data-mw="foo" data-parsoid="bar" data-mw-someext="baz" data-ok="fred" data-ooui="xyzzy" data-bad:ns="ns">d</div>
23520 !! html/php
23521 <div data-ok="fred">d</div>
23522
23523 !! html/parsoid
23524 <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>
23525 !! end
23526
23527 !! test
23528 percent-encoding and + signs in internal links (T28410)
23529 !! wikitext
23530 [[User:+%]] [[Page+title%]]
23531 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
23532 [[%]] [[+]] [[File:%+abc%39|foo|[[bar]]]]
23533 [[%33%45]] [[%33%45+]]
23534 !! html/php
23535 <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>
23536 <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>
23537 <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>
23538 <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>
23539 </p>
23540 !! html/parsoid
23541 <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>
23542 <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>
23543 <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>
23544 <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>
23545 !! end
23546
23547 !! test
23548 Special characters in embedded file links (T29679)
23549 !! wikitext
23550 [[File:Contains & ampersand.jpg]]
23551 [[File:Does not exist.jpg|Title with & ampersand]]
23552 !! html/php
23553 <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>
23554 <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>
23555 </p>
23556 !! html/parsoid
23557 <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>
23558 <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>
23559 !! end
23560
23561 !! test
23562 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
23563 !! wikitext
23564 Text&apos;s been normalized?
23565 !! html
23566 <p>Text&#39;s been normalized?
23567 </p>
23568 !! end
23569
23570 !! test
23571 T21052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
23572 !! wikitext
23573 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
23574 !! html
23575 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
23576 </p>
23577 !! end
23578
23579 !! test
23580 T21052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
23581 !! wikitext
23582 [http://www.example.org/ ideograms]
23583 !! html
23584 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
23585 </p>
23586 !! end
23587
23588 !! test
23589 T21052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
23590 !! wikitext
23591 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
23592 !! html
23593 <p><img src="http://www.example.org/pic.png" alt="pic.png"/> &lt;-- U+3000 (vim: ^Vu3000)
23594 </p>
23595 !! end
23596
23597 !! article
23598 Mediawiki:loop1
23599 !! text
23600 {{Identical|A}}
23601 !! endarticle
23602
23603 !! article
23604 Mediawiki:loop2
23605 !! text
23606 {{Identical|B}}
23607 !! endarticle
23608
23609 !! article
23610 Template:Identical
23611 !! text
23612 {{int:loop1}}
23613 {{int:loop2}}
23614 !! endarticle
23615
23616 !! test
23617 T33098 Template which includes system messages which includes the template
23618 !! wikitext
23619 {{Identical}}
23620 !! html
23621 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
23622 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
23623 </p>
23624 !! end
23625
23626 !! test
23627 T33490 Turkish: ucfirst 'blah'
23628 !! options
23629 language=tr
23630 !! wikitext
23631 {{ucfirst:blah}}
23632 !! html
23633 <p>Blah
23634 </p>
23635 !! end
23636
23637 !! test
23638 T33490 Turkish: ucfirst 'ix'
23639 !! options
23640 language=tr
23641 !! wikitext
23642 {{ucfirst:ix}}
23643 !! html
23644 <p>İx
23645 </p>
23646 !! end
23647
23648 !! test
23649 T33490 Turkish: lcfirst 'BLAH'
23650 !! options
23651 language=tr
23652 !! wikitext
23653 {{lcfirst:BLAH}}
23654 !! html
23655 <p>bLAH
23656 </p>
23657 !! end
23658
23659 !! test
23660 T33490 Turkish: ucfırst (with a dotless i)
23661 !! options
23662 language=tr
23663 !! wikitext
23664 {{ucfırst:blah}}
23665 !! html
23666 <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>
23667 </p>
23668 !! end
23669
23670 !! test
23671 T33490 ucfırst (with a dotless i) with English language
23672 !! options
23673 language=en
23674 !! wikitext
23675 {{ucfırst:blah}}
23676 !! html
23677 <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>
23678 </p>
23679 !! end
23680
23681 # Note that Parsoid doesn't emit an explicit TOC.
23682 # Note also that the html2wt direction tends to emit an extra newline
23683 # between the __TOC__ magicword and the first heading unless *both*
23684 # the <meta> and the <h2> have a data-parsoid attribute set (even if
23685 # it's "{}").
23686
23687 !! test
23688 T28375: TOC with italics
23689 !! options
23690 title=[[Main Page]]
23691 !! wikitext
23692 __TOC__
23693 == ''Lost'' episodes ==
23694 !! html/php
23695 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
23696 <ul>
23697 <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>
23698 </ul>
23699 </div>
23700
23701 <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>
23702
23703 !! html/parsoid
23704 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
23705 <h2 data-parsoid='{}'> <i>Lost</i> episodes </h2>
23706 !! end
23707
23708 !! test
23709 T28375: TOC with bold
23710 !! options
23711 title=[[Main Page]]
23712 !! wikitext
23713 __TOC__
23714 == '''should be bold''' then normal text ==
23715 !! html/php
23716 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
23717 <ul>
23718 <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>
23719 </ul>
23720 </div>
23721
23722 <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>
23723
23724 !! html/parsoid
23725 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
23726 <h2 data-parsoid='{}'> <b>should be bold</b> then normal text </h2>
23727 !! end
23728
23729 !! test
23730 T35845: Headings become cursive in TOC when they contain an image
23731 !! options
23732 title=[[Main Page]]
23733 !! wikitext
23734 __TOC__
23735 == Image [[Image:foobar.jpg]] ==
23736 !! html/php
23737 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
23738 <ul>
23739 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
23740 </ul>
23741 </div>
23742
23743 <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>
23744
23745 !! html/parsoid
23746 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
23747 <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>
23748 !! end
23749
23750 !! test
23751 T35845 (2): Headings become bold in TOC when they contain a blockquote
23752 !! options
23753 title=[[Main Page]]
23754 !! wikitext
23755 __TOC__
23756 == <blockquote>Quote</blockquote> ==
23757 !! html/php
23758 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
23759 <ul>
23760 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
23761 </ul>
23762 </div>
23763
23764 <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>
23765
23766 !! html/php+tidy
23767 <p></p>
23768 <div id="toc" class="toc">
23769 <div class="toctitle">
23770 <h2>Contents</h2>
23771 </div>
23772 <ul>
23773 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
23774 </ul>
23775 </div>
23776 <p></p>
23777 <h2><span class="mw-headline" id="Quote"></span></h2>
23778 <blockquote>
23779 <p><span class="mw-headline" id="Quote">Quote</span></p>
23780 </blockquote>
23781 <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>
23782 !! html/parsoid
23783 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
23784 <h2 data-parsoid='{}'> <blockquote>Quote</blockquote> </h2>
23785 !! end
23786
23787 !! test
23788 Unclosed tags in TOC
23789 !! options
23790 title=[[Main Page]]
23791 !! wikitext
23792 __TOC__
23793 == Proof: 2 < 3 ==
23794 <small>Hanc marginis exiguitas non caperet.</small>
23795 QED
23796 !! html/php
23797 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
23798 <ul>
23799 <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>
23800 </ul>
23801 </div>
23802
23803 <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>
23804 <p><small>Hanc marginis exiguitas non caperet.</small>
23805 QED
23806 </p>
23807 !! html/parsoid
23808 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
23809 <h2 data-parsoid='{}'> Proof: 2 &lt; 3 </h2>
23810 <p><small>Hanc marginis exiguitas non caperet.</small>
23811 QED</p>
23812 !! end
23813
23814 !! test
23815 Multiple tags in TOC
23816 !! wikitext
23817 __TOC__
23818 == <i>Foo</i> <b>Bar</b> ==
23819
23820 == <i>Foo</i> <blockquote>Bar</blockquote> ==
23821 !! html/php
23822 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
23823 <ul>
23824 <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>
23825 <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>
23826 </ul>
23827 </div>
23828
23829 <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>
23830 <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>
23831
23832 !! html/php+tidy
23833 <p></p>
23834 <div id="toc" class="toc">
23835 <div class="toctitle">
23836 <h2>Contents</h2>
23837 </div>
23838 <ul>
23839 <li class="toclevel-1 tocsection-1"><a href="#Foo_Bar"><span class="tocnumber">1</span> <span class="toctext"><i>Foo</i> <b>Bar</b></span></a></li>
23840 <li class="toclevel-1 tocsection-2"><a href="#Foo_Bar_2"><span class="tocnumber">2</span> <span class="toctext"><i>Foo</i> Bar</span></a></li>
23841 </ul>
23842 </div>
23843 <p></p>
23844 <h2><span class="mw-headline" id="Foo_Bar"><i>Foo</i> <b>Bar</b></span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Foo Bar">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
23845 <h2><span class="mw-headline" id="Foo_Bar_2"><i>Foo</i></span></h2>
23846 <blockquote>
23847 <p><span class="mw-headline" id="Foo_Bar_2">Bar</span></p>
23848 </blockquote>
23849 <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>
23850 !! html/parsoid
23851 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
23852 <h2 data-parsoid='{}'> <i data-parsoid='{"stx":"html"}'>Foo</i> <b data-parsoid='{"stx":"html"}'>Bar</b> </h2>
23853 <h2> <i data-parsoid='{"stx":"html"}'>Foo</i> <blockquote>Bar</blockquote> </h2>
23854 !! end
23855
23856 # Don't expect Parsoid to roundtrip this until the php parser comes closer to
23857 # html5 tag parsing.
23858 !! test
23859 Tags with parameters in TOC
23860 !! options
23861 parsoid=wt2html
23862 !! wikitext
23863 __TOC__
23864 == <sup class="in-h2">Hello</sup> ==
23865
23866 == <sup class="a > b">Evilbye</sup> ==
23867 !! html/php
23868 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
23869 <ul>
23870 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
23871 <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>
23872 </ul>
23873 </div>
23874
23875 <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>
23876 <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>
23877
23878 !! html/parsoid
23879 <meta property="mw:PageProp/toc" />
23880 <h2> <sup class="in-h2" data-parsoid='{"stx":"html"}'>Hello</sup> </h2>
23881
23882 <h2> <sup class="a " data-parsoid='{"stx":"html"}'> b">Evilbye</sup> </h2>
23883 !! end
23884
23885 !! test
23886 span tags with directionality in TOC
23887 !! wikitext
23888 __TOC__
23889 == <span dir="ltr">C++</span> ==
23890
23891 == <span dir="rtl">זבנג!</span> ==
23892
23893 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
23894
23895 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
23896
23897 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
23898 !! html/php
23899 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
23900 <ul>
23901 <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>
23902 <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>
23903 <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>
23904 <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>
23905 <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>
23906 </ul>
23907 </div>
23908
23909 <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>
23910 <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>
23911 <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>
23912 <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>
23913 <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>
23914
23915 !! html/parsoid
23916 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
23917 <h2 data-parsoid='{}'> <span dir="ltr">C++</span> </h2>
23918 <h2> <span dir="rtl">זבנג!</span> </h2>
23919 <h2> <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> </h2>
23920 <h2> <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> </h2>
23921 <h2> <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> </h2>
23922 !! end
23923
23924 !! test
23925 T74884: bdi element in ToC
23926 !! wikitext
23927 __TOC__
23928 == <bdi>test</bdi> ==
23929 !! html/php
23930 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
23931 <ul>
23932 <li class="toclevel-1 tocsection-1"><a href="#test"><span class="tocnumber">1</span> <span class="toctext"><bdi>test</bdi></span></a></li>
23933 </ul>
23934 </div>
23935
23936 <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>
23937
23938 !! html/parsoid
23939 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
23940 <h2 data-parsoid='{}'> <bdi>test</bdi> </h2>
23941 !! end
23942
23943 !! test
23944 T35715: s/strike element in ToC
23945 !! wikitext
23946 __TOC__
23947 == <s>test</s> test <strike>test</strike> ==
23948 !! html/php
23949 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
23950 <ul>
23951 <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>
23952 </ul>
23953 </div>
23954
23955 <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>
23956
23957 !! html/parsoid
23958 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
23959 <h2 data-parsoid='{}'> <s>test</s> test <strike>test</strike> </h2>
23960 !! end
23961
23962 # Note that the html output does not have the <p></p>, but the
23963 # html+tidy output *does*. This is because the empty <p></p> is
23964 # removed by the sanitizer, but only when tidy is *not* enabled (!).
23965 !! test
23966 Empty <p> tag in TOC, removed by Sanitizer (T92892)
23967 !! wikitext
23968 __TOC__
23969 == x ==
23970 !! html/php
23971 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
23972 <ul>
23973 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
23974 </ul>
23975 </div>
23976
23977 <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>
23978
23979 !! html/php+tidy
23980 <p></p>
23981 <div id="toc" class="toc">
23982 <div class="toctitle">
23983 <h2>Contents</h2>
23984 </div>
23985 <ul>
23986 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
23987 </ul>
23988 </div>
23989 <p></p>
23990 <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>
23991 !! html/parsoid
23992 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
23993 <h2 data-parsoid='{}'> x </h2>
23994 !! end
23995
23996 !! article
23997 MediaWiki:T34057
23998 !! text
23999 == {{int:headline_sample}} ==
24000 !! endarticle
24001
24002 !! test
24003 T34057: Title needed when expanding <h> nodes.
24004 !! options
24005 title=[[Main Page]]
24006 !! wikitext
24007 {{int:T34057}}
24008 !! html
24009 <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>
24010
24011 !! end
24012
24013 !! test
24014 Strip marker in urlencode
24015 !! wikitext
24016 {{urlencode:x<nowiki/>y}}
24017 {{urlencode:x<nowiki/>y|wiki}}
24018 {{urlencode:x<nowiki/>y|path}}
24019 {{urlencode:x<pre id="one">two</pre>y}}
24020 !! html/php
24021 <p>xy
24022 xy
24023 xy
24024 xy
24025 </p>
24026 !! end
24027
24028 !! test
24029 Strip marker in lc
24030 !! wikitext
24031 {{lc:x<nowiki/>y}}
24032 !! html
24033 <p>xy
24034 </p>
24035 !! end
24036
24037 !! test
24038 Strip marker in uc
24039 !! wikitext
24040 {{uc:x<nowiki/>y}}
24041 !! html
24042 <p>XY
24043 </p>
24044 !! end
24045
24046 !! test
24047 Strip marker in formatNum
24048 !! wikitext
24049 {{formatnum:1<nowiki/>2}}
24050 {{formatnum:1<nowiki/>2|R}}
24051 !! html
24052 <p>12
24053 12
24054 </p>
24055 !! end
24056
24057 !! test
24058 Check noCommafy in formatNum
24059 !! options
24060 language=be-tarask
24061 !! wikitext
24062 {{formatnum:123456.78}}
24063 {{formatnum:123456.78|NOSEP}}
24064 !! html
24065 <p>123 456,78
24066 123456.78
24067 </p>
24068 !! end
24069
24070 !! test
24071 Wrong option for formatNum (T58199)
24072 !! wikitext
24073 {{formatnum:1,234.56|Random}}
24074 {{formatnum:1,234.56|EVERYTHING}}
24075 {{formatnum:1234.56|any argument that has the string 'NOSEP'}}
24076 !! html
24077 <p>1,234.56
24078 1,234.56
24079 1,234.56
24080 </p>
24081 !! end
24082
24083 !! test
24084 Strip marker in grammar
24085 !! options
24086 language=fi
24087 !! wikitext
24088 {{grammar:elative|foo<nowiki/>bar}}
24089 !! html
24090 <p>foobarista
24091 </p>
24092 !! end
24093
24094 !! test
24095 Strip marker in padleft
24096 !! wikitext
24097 {{padleft:|2|x<nowiki/>y}}
24098 !! html
24099 <p>xy
24100 </p>
24101 !! end
24102
24103 !! test
24104 Strip marker in padright
24105 !! wikitext
24106 {{padright:|2|x<nowiki/>y}}
24107 !! html
24108 <p>xy
24109 </p>
24110 !! end
24111
24112 !! test
24113 Strip marker in anchorencode
24114 !! wikitext
24115 {{anchorencode:x<nowiki/>y}}
24116 !! html
24117 <p>xy
24118 </p>
24119 !! end
24120
24121 !! test
24122 nowiki inside link inside heading (T20295)
24123 !! wikitext
24124 ==[[foo|x<nowiki>y</nowiki>z]]==
24125 !! html
24126 <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>
24127
24128 !! end
24129
24130 !! test
24131 new support for bdi element (T33817)
24132 !! wikitext
24133 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
24134 !! html
24135 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
24136
24137 !!end
24138
24139 !! test
24140 Ignore pipe between table row attributes
24141 !! wikitext
24142 {|
24143 | quux
24144 |- id=foo | style='color: red'
24145 | bar
24146 |}
24147 !! html
24148 <table>
24149 <tr>
24150 <td> quux
24151 </td></tr>
24152 <tr id="foo" style="color: red">
24153 <td> bar
24154 </td></tr></table>
24155
24156 !! end
24157
24158 !!test
24159 Language parser function
24160 !! wikitext
24161 {{#language:ar}}
24162 !! html
24163 <p>العربية
24164 </p>
24165 !! end
24166
24167 !!test
24168 Padleft and padright as substr
24169 !! wikitext
24170 {{padleft:|3|abcde}}
24171 {{padright:|3|abcde}}
24172 !! html
24173 <p>abc
24174 abc
24175 </p>
24176 !! end
24177
24178 !!test
24179 Special parser function
24180 !! wikitext
24181 {{#special:RandomPage}}
24182 {{#special:BaDtItLe}}
24183 {{#special:Foobar}}
24184 !! html
24185 <p>Special:Random
24186 Special:Badtitle
24187 Special:Foobar
24188 </p>
24189 !! end
24190
24191 !!test
24192 T36939 - Case insensitive link parsing ([HttP://])
24193 !! wikitext
24194 [HttP://MediaWiki.Org/]
24195 !! html/php
24196 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
24197 </p>
24198 !! html/parsoid
24199 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/"></a></p>
24200 !! end
24201
24202 !!test
24203 T36939 - Case insensitive link parsing ([HttP:// title])
24204 !! wikitext
24205 [HttP://MediaWiki.Org/ MediaWiki]
24206 !! html
24207 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
24208 </p>
24209 !! end
24210
24211 !!test
24212 T36939 - Case insensitive link parsing (HttP://)
24213 !! wikitext
24214 HttP://MediaWiki.Org/
24215 !! html/php
24216 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
24217 </p>
24218 !! html/parsoid
24219 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a></p>
24220 !! end
24221
24222 !!test
24223 Disable TOC
24224 !! options
24225 notoc
24226 !! wikitext
24227 Lead
24228 == Section 1 ==
24229 == Section 2 ==
24230 == Section 3 ==
24231 == Section 4 ==
24232 == Section 5 ==
24233 !! html
24234 <p>Lead
24235 </p>
24236
24237 <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>
24238 <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>
24239 <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>
24240 <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>
24241 <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>
24242
24243 !! end
24244
24245
24246 ###
24247 ### Parsoid-specific tests
24248 ### Parsoid-PHP parser incompatibilities
24249 ###
24250 !!test
24251 1. SOL-sensitive wikitext tokens as template-args
24252 !!options
24253 parsoid=wt2html,wt2wt
24254 !! wikitext
24255 {{echo|*a}}
24256 {{echo|#a}}
24257 {{echo|:a}}
24258 !! html
24259 <span about="#mwt1" typeof="mw:Transclusion">
24260 </span><ul about="#mwt1"><li>a</li>
24261 </ul>
24262 <span about="#mwt2" typeof="mw:Transclusion">
24263 </span><ol about="#mwt2"><li>a</li>
24264 </ol>
24265 <span about="#mwt3" typeof="mw:Transclusion">
24266 </span><dl about="#mwt3"><dd>a</dd>
24267 </dl>
24268 !!end
24269
24270 #### -----------------------------------------------------------------
24271 #### Parsoid-specific functionality tests
24272 #### -----------------------------------------------------------------
24273
24274 # T65642/T68749: Formatting elt fixup around images is cleaned up.
24275 # We know wt2wt will fail, but we expect selser to pass.
24276 # Due to the nature of our testing, wt2wt and selser tests will enter the
24277 # blacklist and we'll catch selser regressions based on changes to the
24278 # blacklist entries for selser tests.
24279 !! test
24280 1. Bad treebuilder fixup of formatting elt is cleaned up
24281 !! options
24282 parsoid=wt2html,wt2wt
24283 !! wikitext
24284 {|
24285 |
24286 <small>
24287 [[Image:Foobar.jpg|right|Test]]
24288 </small>
24289 |}
24290 !! html/parsoid
24291 <table>
24292 <tbody><tr><td>
24293 <small>
24294 <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>
24295 </small>
24296 </td></tr>
24297 </tbody></table>
24298 !! end
24299
24300 !! test
24301 2. Bad treebuilder fixup of formatting elt is cleaned up
24302 !! options
24303 parsoid=wt2html,wt2wt
24304 !! wikitext
24305 '''foo[[File:Foobar.jpg|thumb|caption]]bar'''
24306
24307 <small>[[Image:Foobar.jpg|right|300px]]</small>
24308 !! html/parsoid
24309
24310 <p><b>foo</b></p>
24311 <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>
24312 <p><b>bar</b></p>
24313 <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>
24314 !! end
24315
24316 !! test
24317 3. Bad treebuilder fixup of formatting elt is cleaned up
24318 !! options
24319 parsoid=wt2html,wt2wt
24320 !! wikitext
24321 <small>'''foo[[File:Foobar.jpg|thumb|caption]]bar'''</small>
24322 !! html/parsoid
24323 <p><small><b>foo</b></small></p>
24324 <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>
24325 <p><small><b>bar</b></small></p>
24326 !! end
24327
24328 !! test
24329 4. Bad treebuilder fixup of formatting elt is cleaned up: formatting tags around captionless images are ignored
24330 !! options
24331 parsoid=wt2html,wt2wt
24332 !! wikitext
24333 '''<small>[[Image:Foobar.jpg|right|300px]]</small>'''
24334 !! html/parsoid
24335 <p><b><small></small></b></p>
24336 <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>
24337 <p></p>
24338 !! end
24339
24340 #### ----------------------------------------------------------------
24341 #### Parsoid-only testing of Parsoid's impl of LST
24342 #### Not implemented yet, see
24343 #### https://www.mediawiki.org/wiki/Parsoid/HTML_based_LST
24344 #### ----------------------------------------------------------------
24345
24346 ## We still need to support serializing the older format while content is stored.
24347 !! test
24348 LST Sections: Backwards compatibility
24349 !! options
24350 parsoid={
24351 "suppressErrors": true,
24352 "modes": ["html2wt"]
24353 }
24354 !! wikitext
24355 <section begin="2011-05-16" />
24356 <section end="2014-04-10 (MW 1.23wmf22)" />
24357 !! html/parsoid
24358 <p><meta typeof="mw:Extension/LabeledSectionTransclusion/begin" content="2011-05-16"/>
24359 <meta typeof="mw:Extension/LabeledSectionTransclusion/end" content="2014-04-10 (MW 1.23wmf22)"/></p>
24360 !! end
24361
24362 !! test
24363 LST Sections: Newfangled approach
24364 !! wikitext
24365 <section begin="2011-05-16" />
24366 <section end="2014-04-10 (MW 1.23wmf22)" />
24367 !! html/parsoid
24368 <p><span typeof="mw:Extension/section" about="#mwt4" data-mw='{"name":"section","attrs":{"begin":"2011-05-16"},"body":null}'>
24369 </span>
24370 <span typeof="mw:Extension/section" about="#mwt6" data-mw='{"name":"section","attrs":{"end":"2014-04-10 (MW 1.23wmf22)"},"body":null}'>
24371 </span></p>
24372 !! end
24373
24374 #--------- Test stripping of empty nodes in template content ----------
24375
24376 !! test
24377 Empty LI and TR nodes should be stripped from template content
24378 !! wikitext
24379 {{EmptyLITest}}
24380 {{EmptyTRTest}}
24381 !! html/parsoid
24382 <ul about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyLITest","href":"./Template:EmptyLITest"},"params":{},"i":0}}]}'>
24383 <li>a</li>
24384 <li>b</li>
24385 </ul>
24386 <table about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRTest","href":"./Template:EmptyTRTest"},"params":{},"i":0}}]}'>
24387 <tbody>
24388 <tr>
24389 <td>foo</td>
24390 </tr>
24391 <tr>
24392 <td>bar</td>
24393 </tr>
24394 </tbody>
24395 </table>
24396 !! end
24397
24398 !! test
24399 Empty LI and TR nodes should not be stripped from top-level content
24400 !! wikitext
24401 * a
24402 *
24403 * b
24404 {|
24405 |-
24406 |-
24407 |foo
24408 |}
24409 !! html/parsoid
24410 <ul>
24411 <li> a</li>
24412 <li></li>
24413 <li> b</li>
24414 </ul>
24415 <table>
24416 <tbody>
24417 <tr></tr>
24418 <tr>
24419 <td>foo</td>
24420 </tr>
24421 </tbody>
24422 </table>
24423 !! end
24424
24425 !! test
24426 Empty TR nodes should not be stripped if they have any attributes set
24427 !! wikitext
24428 {{EmptyTRWithHTMLAttrTest}}
24429 !! html/parsoid
24430 <table about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRWithHTMLAttrTest","href":"./Template:EmptyTRWithHTMLAttrTest"},"params":{},"i":0}}]}'>
24431 <tr align="center"></tr>
24432 <tr><td>foo</td></tr>
24433 <tr align="center"></tr>
24434 <tr><td>bar</td></tr>
24435 </table>
24436 !! end
24437
24438 #### ----------------------------------------------------------------
24439 #### The following section of tests are primarily to test
24440 #### wikitext escaping capabilities of Parsoid. Given that
24441 #### escaping can be done any number of ways, the wikitext (input)
24442 #### is always adjusted to reflect how Parsoid adds nowiki
24443 #### escape tags.
24444 ####
24445 #### We are marking several tests as parsoid-only since the
24446 #### HTML in the result section is different from what the
24447 #### PHP parser generates for it.
24448 #### ----------------------------------------------------------------
24449
24450
24451 #### --------------- Headings ---------------
24452 #### 0. Unnested
24453 #### 1. Nested inside html <h1>=foo=</h1>
24454 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
24455 #### 3. Nested inside html with wikitext split by html tags
24456 #### 4. No escape needed
24457 #### 5. Empty headings <h1></h1>
24458 #### 6. Heading chars in SOL context
24459 #### ----------------------------------------
24460 !! test
24461 Headings: 0. Unnested
24462 !! options
24463 parsoid=html2wt
24464 !! html/parsoid
24465 <p>=foo=</p>
24466
24467 <p> =foo=
24468 <!--cmt-->
24469 =foo=</p>
24470
24471 <p>=foo<i>a</i>=</p>
24472 !! wikitext
24473 <nowiki>=foo=</nowiki>
24474
24475 <nowiki> </nowiki>=foo=
24476 <!--cmt-->
24477 <nowiki>=foo=</nowiki>
24478
24479 =foo''a''<nowiki>=</nowiki>
24480 !!end
24481
24482 # New headings and existing headings are handled differently
24483 !! test
24484 Headings: 1. Nested inside html
24485 !! options
24486 parsoid=html2wt
24487 !! html/parsoid
24488 <h1>=foo=</h1>
24489 <h2>=foo=</h2>
24490 <h3>=foo=</h3>
24491
24492 <h1 data-parsoid=''>=foo=</h1>
24493 <h2 data-parsoid=''>=foo=</h2>
24494 <h3 data-parsoid=''>=foo=</h3>
24495 <h4 data-parsoid=''>=foo=</h4>
24496 <h5 data-parsoid=''>=foo=</h5>
24497 <h6 data-parsoid=''>=foo=</h6>
24498 !! wikitext
24499 = =foo= =
24500
24501 == =foo= ==
24502
24503 === =foo= ===
24504
24505 =<nowiki>=foo=</nowiki>=
24506 ==<nowiki>=foo=</nowiki>==
24507 ===<nowiki>=foo=</nowiki>===
24508 ====<nowiki>=foo=</nowiki>====
24509 =====<nowiki>=foo=</nowiki>=====
24510 ======<nowiki>=foo=</nowiki>======
24511
24512 !!end
24513
24514 !! test
24515 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
24516 !! options
24517 parsoid=html2wt
24518 !! html/parsoid
24519 <h1>foo</h1>*bar
24520 <h1>foo</h1>=bar
24521 <h1>foo</h1>=bar=
24522 !! wikitext
24523 = foo =
24524 <nowiki>*</nowiki>bar
24525
24526 = foo =
24527 =bar
24528
24529 = foo =
24530 <nowiki>=bar=</nowiki>
24531 !!end
24532
24533 !! test
24534 Headings: 3. Nested inside html with wikitext split by html tags
24535 !! options
24536 parsoid=html2wt
24537 !! html/parsoid
24538 <h1>=<b>bold</b>foo=</h1>
24539 !! wikitext
24540 = ='''bold'''foo= =
24541 !!end
24542
24543 !! test
24544 Headings: 4a. No escaping needed (testing just h1 and h2)
24545 !! options
24546 parsoid=html2wt
24547 !! html/parsoid
24548 <h1>=foo</h1>
24549 <h1>foo=</h1>
24550 <h1> =foo= </h1>
24551 <h1>=foo= bar</h1>
24552 <h2>=foo</h2>
24553 <h2>foo=</h2>
24554 <h1>=</h1>
24555 <h1><i>=</i>foo=</h1>
24556 !! wikitext
24557 = =foo =
24558
24559 = foo= =
24560
24561 = =foo= =
24562
24563 = =foo= bar =
24564
24565 == =foo ==
24566
24567 == foo= ==
24568
24569 = = =
24570
24571 = ''=''foo= =
24572 !!end
24573
24574 !! test
24575 Headings: 4b. No escaping needed (inside p-tags)
24576 !! options
24577 parsoid=html2wt
24578 !! html/parsoid
24579 <p>===
24580 =foo= x
24581 =foo= <s></s>
24582 </p>
24583 !! wikitext
24584 ===
24585 =foo= x
24586 =foo= <s></s>
24587 !!end
24588
24589 !! test
24590 Headings: 5. Empty headings
24591 !! options
24592 parsoid=html2wt
24593 !! html/parsoid
24594 <h1 data-parsoid='{}'></h1>
24595
24596 <h2 data-parsoid='{}'></h2>
24597
24598 <h3 data-parsoid='{}'></h3>
24599
24600 <h4 data-parsoid='{}'></h4>
24601
24602 <h5 data-parsoid='{}'></h5>
24603
24604 <h6 data-parsoid='{}'></h6>
24605 !! wikitext
24606 =<nowiki/>=
24607
24608 ==<nowiki/>==
24609
24610 ===<nowiki/>===
24611
24612 ====<nowiki/>====
24613
24614 =====<nowiki/>=====
24615
24616 ======<nowiki/>======
24617 !!end
24618
24619 !! test
24620 Headings: 6a. Heading chars in SOL context (with trailing spaces)
24621 !! options
24622 parsoid=html2wt
24623 !! html/parsoid
24624 <p>=a=</p>
24625
24626 <p>=a=</p>
24627
24628 <p>=a=</p>
24629 !! wikitext
24630 <nowiki>=a=</nowiki>
24631
24632 <nowiki>=a=</nowiki>
24633
24634 <nowiki>=a=</nowiki>
24635 !!end
24636
24637 !! test
24638 Headings: 6b. Heading chars in SOL context (with trailing newlines)
24639 !! options
24640 parsoid=html2wt
24641 !! html/parsoid
24642 <p>=a=
24643 b</p>
24644
24645 <p>=a=
24646 b</p>
24647
24648 <p>=a=
24649 b</p>
24650 !! wikitext
24651 <nowiki>=a=</nowiki>
24652 b
24653
24654 <nowiki>=a=</nowiki>
24655 b
24656
24657 <nowiki>=a=</nowiki>
24658 b
24659 !!end
24660
24661 !! test
24662 Headings: 6c. Heading chars in SOL context (leading newline break)
24663 !! options
24664 parsoid=html2wt
24665 !! html/parsoid
24666 <p>a
24667 =b=</p>
24668 !! wikitext
24669 a
24670 <nowiki>=b=</nowiki>
24671 !!end
24672
24673 !! test
24674 Headings: 6d. Heading chars in SOL context (with interspersed comments)
24675 !! options
24676 parsoid=html2wt
24677 !! html/parsoid
24678 <!--c0--><p>=a=</p>
24679
24680 <!--c1--><p>=a=</p> <!--c2--> <!--c3-->
24681 !! wikitext
24682 <!--c0--><nowiki>=a=</nowiki>
24683
24684 <!--c1--><nowiki>=a=</nowiki> <!--c2--> <!--c3-->
24685 !!end
24686
24687 !! test
24688 Headings: 6d. Heading chars in SOL context (No escaping needed)
24689 !! options
24690 parsoid=html2wt
24691 !! html/parsoid
24692 =a=<div>b</div>
24693 !! wikitext
24694 =a=<div>b</div>
24695 !!end
24696
24697 !! test
24698 Headings: 7. Insert a newline between new content and headings
24699 !! options
24700 parsoid=html2wt
24701 !! html/parsoid
24702 <h2>NEW</h2>
24703 <p>new</p>
24704 <h2 data-parsoid='{}'>A</h2>
24705 <p data-parsoid='{}'>a</p>
24706 !! wikitext
24707 == NEW ==
24708 new
24709
24710 ==A==
24711 a
24712
24713 !! end
24714
24715 #### --------------- Lists ---------------
24716 #### 0. Outside nests (*foo, etc.)
24717 #### 1. Nested inside html <ul><li>*foo</li></ul>
24718 #### 2. Inside definition lists
24719 #### 3. Only bullets at start should be escaped
24720 #### 4. No escapes needed
24721 #### 5. No unnecessary escapes
24722 #### 6. Escape bullets in SOL position
24723 #### 7. Escape bullets in a multi-line context
24724 #### ----------------------------------------
24725
24726 !! test
24727 Lists: 0. Outside nests
24728 !! options
24729 parsoid=html2wt
24730 !! html/parsoid
24731 <p>*foo</p>
24732
24733 <p>#foo</p>
24734
24735 <p>;Foo:bar</p>
24736 !! wikitext
24737 <nowiki>*</nowiki>foo
24738
24739 <nowiki>#</nowiki>foo
24740
24741 <nowiki>;</nowiki>Foo<nowiki>:</nowiki>bar
24742 !!end
24743
24744 ## Making these next 3 tests Parsoid-only since they are html2wt tests
24745 ## to test wikitext escaping, and insignificant whitespace diffs
24746 ## cause PHP parser tests to barf
24747 !! test
24748 Lists: 1. Nested inside html (No unnecessary escapes)
24749 !! options
24750 parsoid=html2wt
24751 !! html/parsoid
24752 <ul>
24753 <li>*foo</li>
24754 <li>#foo</li>
24755 <li>:foo</li>
24756 <li>;foo</li>
24757 <li data-parsoid='{}'>*foo</li>
24758 <li data-parsoid='{}'>#foo</li>
24759 <li data-parsoid='{}'>:foo</li>
24760 <li data-parsoid='{}'>;foo</li>
24761 </ul>
24762
24763 <ol>
24764 <li>*foo</li>
24765 <li>#foo</li>
24766 <li>:foo</li>
24767 <li>;foo</li>
24768 <li data-parsoid='{}'>*foo</li>
24769 <li data-parsoid='{}'>#foo</li>
24770 <li data-parsoid='{}'>:foo</li>
24771 <li data-parsoid='{}'>;foo</li>
24772 </ol>
24773 !! wikitext
24774 * *foo
24775 * #foo
24776 * :foo
24777 * ;foo
24778 *<nowiki>*foo</nowiki>
24779 *<nowiki>#foo</nowiki>
24780 *<nowiki>:foo</nowiki>
24781 *<nowiki>;foo</nowiki>
24782
24783 # *foo
24784 # #foo
24785 # :foo
24786 # ;foo
24787 #<nowiki>*foo</nowiki>
24788 #<nowiki>#foo</nowiki>
24789 #<nowiki>:foo</nowiki>
24790 #<nowiki>;foo</nowiki>
24791 !!end
24792
24793 !! test
24794 Lists: 2. Inside definition lists
24795 !! options
24796 parsoid=html2wt
24797 !! html/parsoid
24798 <dl><dt>;foo</dt></dl>
24799 <dl><dt>:foo</dt></dl>
24800 <dl><dt>:foo</dt>
24801 <dd>bar</dd></dl>
24802 <dl><dd>:foo</dd></dl>
24803 !! wikitext
24804 ; ;foo
24805
24806 ; <nowiki>:foo</nowiki>
24807
24808 ; <nowiki>:foo</nowiki>
24809 : bar
24810
24811 : :foo
24812 !!end
24813
24814 !! test
24815 Lists: 3. Only bullets at start of text in wikitext-generated HTML should be escaped
24816 !! options
24817 parsoid=html2wt
24818 !! html/parsoid
24819 <ul>
24820 <li>*foo*bar</li>
24821 <li data-parsoid='{}'>*foo<i>it</i>*bar</li>
24822 </ul>
24823 !! wikitext
24824 * *foo*bar
24825 *<nowiki>*foo</nowiki>''it''*bar
24826 !!end
24827
24828 !! test
24829 Lists: 4. No escapes needed
24830 !! options
24831 parsoid=html2wt
24832 !! html/parsoid
24833 <ul>
24834 <li>foo*bar
24835 </li>
24836 </ul>
24837 <ul>
24838 <li><i>foo</i>*bar
24839 </li>
24840 </ul>
24841 <ul>
24842 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>: bar
24843 </li>
24844 </ul>
24845 <ul>
24846 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>*bar
24847 </li>
24848 </ul>
24849 !! wikitext
24850 *foo*bar
24851
24852 *''foo''*bar
24853
24854 *[[Foo]]: bar
24855
24856 *[[Foo]]*bar
24857 !!end
24858
24859 !! test
24860 Lists: 5. No unnecessary escapes
24861 !! options
24862 parsoid=html2wt
24863 !! html/parsoid
24864 <ul><li> bar <span>[[foo]]</span></li></ul>
24865 <ul><li> =bar <span>[[foo]]</span></li></ul>
24866 <ul><li> [[bar <span>[[foo]]</span></li></ul>
24867 <ul><li> ]]bar <span>[[foo]]</span></li></ul>
24868 <ul><li> =bar <span>foo]]</span>=</li></ul>
24869 <ul><li> <s></s>: a</li></ul>
24870 <ul><li> <i>* foo</i></li></ul>
24871
24872 !! wikitext
24873 * bar <span><nowiki>[[foo]]</nowiki></span>
24874
24875 * =bar <span><nowiki>[[foo]]</nowiki></span>
24876
24877 * [[bar <span><nowiki>[[foo]]</nowiki></span>
24878
24879 * ]]bar <span><nowiki>[[foo]]</nowiki></span>
24880
24881 * =bar <span>foo]]</span>=
24882
24883 * <s></s>: a
24884
24885 * ''* foo''
24886 !!end
24887
24888 !! test
24889 Lists: 6. Escape bullets in SOL position
24890 !! options
24891 parsoid=html2wt
24892 !! html/parsoid
24893 <p><!--cmt-->*foo</p>
24894 !! wikitext
24895 <!--cmt--><nowiki>*</nowiki>foo
24896 !!end
24897
24898 !! test
24899 Lists: 7. Escape bullets in a multi-line context
24900 !! options
24901 parsoid=html2wt
24902 !! html/parsoid
24903 <p>a
24904 *b
24905 </p>
24906 !! wikitext
24907 a
24908 <nowiki>*</nowiki>b
24909 !!end
24910
24911 !! test
24912 Lists: 8. Escape colons only if not present in tags
24913 !! options
24914 parsoid=html2wt
24915 !! html/parsoid
24916 <dl><dt>a:b<i>c:d</i></dt></dl>
24917 !! wikitext
24918 ; <nowiki>a:b</nowiki>''c:d''
24919 !! end
24920
24921 #### --------------- HRs ---------------
24922 #### 1. Single line
24923 #### -----------------------------------
24924
24925 !! test
24926 HRs: 1. Single line
24927 !! options
24928 parsoid=html2wt
24929 !! html/parsoid
24930 <hr />----
24931 <hr />=foo=
24932 <hr />*foo
24933 !! wikitext
24934 ----<nowiki>----</nowiki>
24935 ----=foo=
24936 ----*foo
24937 !! end
24938
24939 #### --------------- Tables ---------------
24940 #### 1a. Simple example
24941 #### 1b. No escaping needed (!foo)
24942 #### 1c. No escaping needed (|foo)
24943 #### 1d. No escaping needed (|}foo)
24944 ####
24945 #### 2a. Nested in td (<td>foo|bar</td>)
24946 #### 2b. Nested in td (<td>foo||bar</td>)
24947 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
24948 ####
24949 #### 3a. Nested in th (<th>foo!bar</th>)
24950 #### 3b. Nested in th (<th>foo!!bar</th>)
24951 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
24952 ####
24953 #### 4a. Escape -
24954 #### 4b. Escape +
24955 #### 4c. No escaping needed
24956 #### --------------------------------------
24957
24958 !! test
24959 Tables: 1a. Simple example
24960 !! options
24961 parsoid=html2wt
24962 !! html/parsoid
24963 <p>{|
24964 |}
24965 </p>
24966 !! wikitext
24967 <nowiki>{|</nowiki>
24968 |}
24969 !! end
24970
24971 !! test
24972 Tables: 1b. No escaping needed
24973 !! options
24974 parsoid=html2wt
24975 !! html/parsoid
24976 <p>!foo
24977 </p>
24978 !! wikitext
24979 !foo
24980 !! end
24981
24982 !! test
24983 Tables: 1c. No escaping needed
24984 !! options
24985 parsoid=html2wt
24986 !! html/parsoid
24987 <p>|foo
24988 </p>
24989 !! wikitext
24990 |foo
24991 !! end
24992
24993 !! test
24994 Tables: 1d. No escaping needed
24995 !! options
24996 parsoid=html2wt
24997 !! html/parsoid
24998 <p>|}foo
24999 </p>
25000 !! wikitext
25001 |}foo
25002 !! end
25003
25004 !! test
25005 Tables: 2a. Nested in td
25006 !! options
25007 parsoid=html2wt
25008 !! html/parsoid
25009 <table><tbody><tr>
25010 <td>foo|bar</td></tr>
25011 <tr><td>x<div>a|b</div></td>
25012 </tbody></table>
25013 !! wikitext
25014 {|
25015 |<nowiki>foo|bar</nowiki>
25016 |-
25017 |x<div><nowiki>a|b</nowiki></div>
25018 |}
25019 !! html/php+tidy
25020 <table>
25021 <tr>
25022 <td>foo|bar</td>
25023 </tr>
25024 <tr>
25025 <td>x
25026 <div>a|b</div>
25027 </td>
25028 </tr>
25029 </table>
25030 !! end
25031
25032 !! test
25033 Tables: 2b. Nested in td
25034 !! options
25035 parsoid=html2wt
25036 !! html/parsoid
25037 <table><tbody><tr>
25038 <td>foo||bar</td>
25039 <td>a<i>b||c</i></td>
25040 <td>a<i><div>b||c</div></i></td>
25041 </tr></tbody></table>
25042 !! wikitext
25043 {|
25044 |<nowiki>foo||bar</nowiki>
25045 |a''<nowiki>b||c</nowiki>''
25046 |a''<div><nowiki>b||c</nowiki></div>''
25047 |}
25048 !! html/php
25049 <table>
25050 <tr>
25051 <td>foo||bar
25052 </td>
25053 <td>a<i>b||c</i>
25054 </td>
25055 <td>a<i><div>b||c</div></i>
25056 </td></tr></table>
25057
25058 !! end
25059
25060 !! test
25061 Tables: 2c. Nested in td -- no escaping needed
25062 !! options
25063 parsoid=html2wt
25064 !! html/*
25065 <table>
25066 <tr>
25067 <td>foo!!bar
25068 </td></tr></table>
25069
25070 !! wikitext
25071 {|
25072 |foo!!bar
25073 |}
25074 !! end
25075
25076 !! test
25077 Tables: 3a. Nested in th
25078 !! options
25079 parsoid=html2wt
25080 !! html/*
25081 <table>
25082 <tr>
25083 <th>foo!bar
25084 </th></tr></table>
25085
25086 !! wikitext
25087 {|
25088 !foo!bar
25089 |}
25090 !! end
25091
25092 !! test
25093 Tables: 3b. Nested in th
25094 !! options
25095 parsoid=html2wt
25096 !! html/parsoid
25097 <table><tbody>
25098 <tr><th>foo!!bar</th>
25099 <th><i>foo|bar</i></th>
25100 <th><i>foo!!bar</i></th>
25101 <th><i><span>foo!!bar</span></i></th>
25102 </tr></tbody></table>
25103 !! wikitext
25104 {|
25105 !<nowiki>foo!!bar</nowiki>
25106 !''<nowiki>foo|bar</nowiki>''
25107 !''<nowiki>foo!!bar</nowiki>''
25108 !''<span><nowiki>foo!!bar</nowiki></span>''
25109 |}
25110 !! html/php
25111 <table>
25112 <tr>
25113 <th>foo!!bar
25114 </th>
25115 <th><i>foo|bar</i>
25116 </th>
25117 <th><i>foo!!bar</i>
25118 </th>
25119 <th><i><span>foo!!bar</span></i>
25120 </th></tr></table>
25121
25122 !! end
25123
25124 !! test
25125 Tables: 3c. Nested in th
25126 !! options
25127 parsoid=html2wt
25128 !! html/parsoid
25129 <table><tbody>
25130 <tr><th>foo||bar</th>
25131 <th><span typeof="mw:Nowiki">foo||bar</span></th>
25132 </tr></tbody></table>
25133 !! wikitext
25134 {|
25135 !<nowiki>foo||bar</nowiki>
25136 !<nowiki>foo||bar</nowiki>
25137 |}
25138 !! html/php
25139 <table>
25140 <tr>
25141 <th>foo||bar
25142 </th>
25143 <th>foo||bar
25144 </th></tr></table>
25145
25146 !! end
25147
25148 !! test
25149 Tables: 4a. Escape -
25150 !! options
25151 parsoid=html2wt
25152 !! html/*
25153 <table>
25154 <tr>
25155 <th>-bar
25156 </th></tr>
25157 <tr>
25158 <td>-bar
25159 </td></tr></table>
25160
25161 !! wikitext
25162 {|
25163 !-bar
25164 |-
25165 |<nowiki>-bar</nowiki>
25166 |}
25167 !! end
25168
25169 !! test
25170 Tables: 4b. Escape +
25171 !! options
25172 parsoid=html2wt
25173 !! html/*
25174 <table>
25175 <tr>
25176 <th>+bar
25177 </th></tr>
25178 <tr>
25179 <td>+bar
25180 </td></tr></table>
25181
25182 !! wikitext
25183 {|
25184 !+bar
25185 |-
25186 |<nowiki>+bar</nowiki>
25187 |}
25188 !! end
25189
25190 !! test
25191 Tables: 4c. No escaping needed
25192 !! options
25193 parsoid=html2wt
25194 !! html/parsoid
25195 <table><tbody>
25196 <tr><td>foo-bar</td><td>foo+bar</td></tr>
25197 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
25198 <tr><td>foo
25199 <p>bar|baz
25200 +bar
25201 -bar</p></td></tr>
25202 <tr><td>x
25203 <div>a|b</div></td>
25204 </tbody></table>
25205 !! wikitext
25206 {|
25207 |foo-bar
25208 |foo+bar
25209 |-
25210 |''foo''-bar
25211 |''foo''+bar
25212 |-
25213 |foo
25214 bar|baz
25215 +bar
25216 -bar
25217 |-
25218 |x
25219 <div>a|b</div>
25220 |}
25221 !! html/php
25222 <table>
25223 <tr>
25224 <td>foo-bar
25225 </td>
25226 <td>foo+bar
25227 </td></tr>
25228 <tr>
25229 <td><i>foo</i>-bar
25230 </td>
25231 <td><i>foo</i>+bar
25232 </td></tr>
25233 <tr>
25234 <td>foo
25235 <p>bar|baz
25236 +bar
25237 -bar
25238 </p>
25239 </td></tr>
25240 <tr>
25241 <td>x
25242 <div>a|b</div>
25243 </td></tr></table>
25244
25245 !! end
25246
25247 !! test
25248 Tables: 4d. No escaping needed
25249 !! options
25250 parsoid=html2wt
25251 !! html/parsoid
25252 <table>
25253 <tbody><tr><td><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>-bar</td>
25254 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>+1</td>
25255 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>-2</td></tr>
25256 </tbody></table>
25257 !! wikitext
25258 {|
25259 |[[Foo]]-bar
25260 ||+1
25261 ||-2
25262 |}
25263 !! html/php
25264 <table>
25265 <tr>
25266 <td><a href="/wiki/Foo" title="Foo">Foo</a>-bar
25267 </td>
25268 <td>+1
25269 </td>
25270 <td>-2
25271 </td></tr></table>
25272
25273 !! end
25274
25275 !! test
25276 T97430: Don't emit empty nowiki pairs around marker meta tags
25277 !! options
25278 parsoid=html2wt
25279 !! html/parsoid
25280 <p>*This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
25281 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.</p>
25282 !! wikitext
25283 <nowiki>*</nowiki>This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
25284 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.
25285 !! end
25286
25287 !! test
25288 Unclosed xmlish element in table line shouldn't eat end delimiters
25289 !! options
25290 parsoid=html2wt
25291 !! html/parsoid
25292 <table>
25293 <tbody><tr><td> &lt;foo</td>
25294 <td> bar></td></tr>
25295 </tbody></table>
25296 !! wikitext
25297 {|
25298 | <foo
25299 | bar>
25300 |}
25301 !! html/php
25302 <table>
25303 <tr>
25304 <td> &lt;foo
25305 </td>
25306 <td> bar&gt;
25307 </td></tr></table>
25308
25309 !! end
25310
25311 #### --------------- Links ----------------
25312 #### 1. Quote marks in link text
25313 #### 2. Wikilinks: Escapes needed
25314 #### 3. Wikilinks: No escapes needed
25315 #### 4. Extlinks: Escapes needed
25316 #### 5. Extlinks: No escapes needed
25317 #### --------------------------------------
25318 !! test
25319 Links 1. WikiLinks: No escapes needed
25320 !! options
25321 parsoid=html2wt
25322 !! html/parsoid
25323 <p><a rel="mw:WikiLink" href="Foo" title="Foo">Foo<i>boo</i></a>
25324 <a rel="mw:WikiLink" href="Foo" title="Foo">[Foobar]</a>
25325 <a rel="mw:WikiLink" href="Foo" title="Foo">x [Foobar] x</a></p>
25326 !! wikitext
25327 [[Foo|Foo''boo'']]
25328 [[Foo|[Foobar]]]
25329 [[Foo|x [Foobar] x]]
25330 !! html/php
25331 <p><a href="/wiki/Foo" title="Foo">Foo<i>boo</i></a>
25332 <a href="/wiki/Foo" title="Foo">[Foobar]</a>
25333 <a href="/wiki/Foo" title="Foo">x [Foobar] x</a>
25334 </p>
25335 !! end
25336
25337 !! test
25338 Links 2. WikiLinks: Escapes needed
25339 !! options
25340 parsoid=html2wt
25341 !! html/parsoid
25342 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
25343 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
25344 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
25345 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
25346 <a href="Foo" rel="mw:WikiLink">|Bar</a>
25347 <a href="Foo" rel="mw:WikiLink">]]bar</a>
25348 <a href="Foo" rel="mw:WikiLink">[[bar</a>
25349 <a href="Foo" rel="mw:WikiLink">x [[ y</a>
25350 <a href="Foo" rel="mw:WikiLink">x ]] y</a>
25351 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
25352 !! wikitext
25353 [[Foo|<nowiki>Foobar]</nowiki>]]
25354 [[Foo|x <nowiki>[http://google.com g]</nowiki> x]]
25355 [[Foo|<nowiki>[[Bar]]</nowiki>]]
25356 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
25357 [[Foo|<nowiki>|Bar</nowiki>]]
25358 [[Foo|<nowiki>]]bar</nowiki>]]
25359 [[Foo|<nowiki>[[bar</nowiki>]]
25360 [[Foo|<nowiki>x [[ y</nowiki>]]
25361 [[Foo|<nowiki>x ]] y</nowiki>]]
25362 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
25363 !! html/php
25364 <p><a href="/wiki/Foo" title="Foo">Foobar]</a>
25365 <a href="/wiki/Foo" title="Foo">x [http://google.com g] x</a>
25366 <a href="/wiki/Foo" title="Foo">[[Bar]]</a>
25367 <a href="/wiki/Foo" title="Foo">x [[Bar]] x</a>
25368 <a href="/wiki/Foo" title="Foo">|Bar</a>
25369 <a href="/wiki/Foo" title="Foo">]]bar</a>
25370 <a href="/wiki/Foo" title="Foo">[[bar</a>
25371 <a href="/wiki/Foo" title="Foo">x [[ y</a>
25372 <a href="/wiki/Foo" title="Foo">x ]] y</a>
25373 <a href="/wiki/Foo" title="Foo">x ]] y [[ z</a>
25374 </p>
25375 !! end
25376
25377 !! test
25378 Links 3. WikiLinks: No escapes needed
25379 !! options
25380 parsoid=html2wt
25381 !! html/parsoid
25382 <p><a rel="mw:WikiLink" href="Foo">[Foobar</a>
25383 <a rel="mw:WikiLink" href="Foo" title="Foo">foo|bar</a></p>
25384 !! wikitext
25385 [[Foo|[Foobar]]
25386 [[Foo|foo|bar]]
25387 !! html/php
25388 <p><a href="/wiki/Foo" title="Foo">[Foobar</a>
25389 <a href="/wiki/Foo" title="Foo">foo|bar</a>
25390 </p>
25391 !! end
25392
25393 !! test
25394 Links 4. ExtLinks: Escapes needed
25395 !! options
25396 parsoid=html2wt
25397 !! html/parsoid
25398 <p><a rel="mw:ExtLink" href="http://google.com">[google]</a>
25399 <a rel="mw:ExtLink" href="http://google.com">google]</a>
25400 <a rel="mw:ExtLink" href="http://google.com">goog] le</a></p>
25401 <p>[http://google.com]</p>
25402 <p>[http://google.com google]</p>
25403 <p>[<a rel="mw:ExtLink" href="http://google.com">http://google.com</a>]</p>
25404 <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>
25405 !! wikitext
25406 [http://google.com <nowiki>[google]</nowiki>]
25407 [http://google.com <nowiki>google]</nowiki>]
25408 [http://google.com <nowiki>goog] le</nowiki>]
25409
25410 <nowiki>[http://google.com]</nowiki>
25411
25412 <nowiki>[http://google.com google]</nowiki>
25413
25414 [http://google.com<nowiki>]</nowiki>
25415
25416 [{{echo|http://google.com}}<nowiki>]</nowiki>
25417 !! html/php
25418 <p><a rel="nofollow" class="external text" href="http://google.com">[google]</a>
25419 <a rel="nofollow" class="external text" href="http://google.com">google]</a>
25420 <a rel="nofollow" class="external text" href="http://google.com">goog] le</a>
25421 </p><p>[http://google.com]
25422 </p><p>[http://google.com google]
25423 </p><p>[<a rel="nofollow" class="external free" href="http://google.com">http://google.com</a>]
25424 </p><p>[<a rel="nofollow" class="external free" href="http://google.com">http://google.com</a>]
25425 </p>
25426 !! end
25427
25428 !! test
25429 Links 5. ExtLinks: No escapes needed
25430 !! options
25431 parsoid=html2wt
25432 !! html/parsoid
25433 <p><a rel="mw:ExtLink" href="http://google.com">[google</a></p>
25434 <p>[<a ref="mw:ExtLink" href="http://google.com"></a>]</p>
25435 !! wikitext
25436 [http://google.com [google]
25437
25438 [[http://google.com]]
25439 !! html/php
25440 <p><a rel="nofollow" class="external text" href="http://google.com">[google</a>
25441 </p><p>[<a rel="nofollow" class="external autonumber" href="http://google.com">[1]</a>]
25442 </p>
25443 !! end
25444
25445 !! test
25446 Links 6. Add <nowiki/>s between text-nodes and url-links when required (T66300)
25447 !! options
25448 parsoid=html2wt
25449 !! html/parsoid
25450 <p>x<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>y
25451 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>?x
25452 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>&amp;x
25453 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>'x
25454 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,x
25455 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.x
25456 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
25457 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>:x
25458 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
25459 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>!x
25460 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>=x
25461 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>(x)
25462 <a rel="mw:ExtLink" href="http://example.com(x" data-parsoid='{"stx":"url"}'>http://example.com(x</a>)
25463 </p>
25464 !! wikitext
25465 x<nowiki/>http://example.com<nowiki/>y
25466 http://example.com<nowiki/>?x
25467 http://example.com<nowiki/>&x
25468 http://example.com<nowiki/>'x
25469 http://example.com<nowiki/>,x
25470 http://example.com<nowiki/>.x
25471 http://example.com<nowiki/>;x
25472 http://example.com<nowiki/>:x
25473 http://example.com<nowiki/>;x
25474 http://example.com<nowiki/>!x
25475 http://example.com<nowiki/>=x
25476 http://example.com<nowiki/>(x)
25477 http://example.com(x<nowiki/>)
25478 !! end
25479
25480 !! test
25481 Links 7a. Don't add spurious <nowiki/>s between text-nodes and url-links (T66300)
25482 !! options
25483 parsoid=html2wt
25484 !! html/parsoid
25485 <p>x
25486 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>
25487 y
25488 "<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>"
25489 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>)
25490 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>) foo
25491 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,
25492 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>, foo
25493 </p>
25494 !! wikitext
25495 x
25496 http://example.com
25497 y
25498 "http://example.com"
25499 (http://example.com)
25500 (http://example.com) foo
25501 http://example.com,
25502 http://example.com, foo
25503 !! html/php
25504 <p>x
25505 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
25506 y
25507 "<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>"
25508 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
25509 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>) foo
25510 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
25511 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>, foo
25512 </p>
25513 !! end
25514
25515 !! test
25516 Links 7b. Don't add spurious <nowiki/>s between text-nodes and url-links (T66300)
25517 !! options
25518 parsoid=html2wt
25519 !! html/parsoid
25520 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.,;:!?\
25521 -<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:</p>
25522 !! wikitext
25523 http://example.com.,;:!?\
25524 -http://example.com:
25525 !! html/php
25526 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.,;:!?\
25527 -<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
25528 </p>
25529 !! end
25530
25531 !! test
25532 Links 8. Add <nowiki/>s between text-nodes and RFC-links when required (T66300)
25533 !! options
25534 parsoid=html2wt
25535 !! html/parsoid
25536 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>4
25537 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
25538 X<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y</p>
25539 !! wikitext
25540 RFC 123<nowiki/>4
25541 RFC 123<nowiki/>y
25542 X<nowiki/>RFC 123<nowiki/>y
25543 !! end
25544
25545 !! test
25546 Links 9. Don't add spurious <nowiki/>s between text-nodes and RFC-links (T66300)
25547 !! options
25548 parsoid=html2wt
25549 !! html/parsoid
25550 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>?foo
25551 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>&amp;foo
25552 -<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>-
25553 </p>
25554 !! wikitext
25555 RFC 123?foo
25556 RFC 123&foo
25557 -RFC 123-
25558 !! html/php
25559 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>?foo
25560 <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>&amp;foo
25561 -<a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>-
25562 </p>
25563 !! end
25564
25565 !! test
25566 Links 10. Add <nowiki/>s between text-nodes and PMID-links when required (T66300)
25567 !! options
25568 parsoid=html2wt
25569 !! html/parsoid
25570 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>4
25571 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
25572 X<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
25573 !! wikitext
25574 PMID 123<nowiki/>4
25575 PMID 123<nowiki/>y
25576 X<nowiki/>PMID 123<nowiki/>y
25577 !! end
25578
25579 !! test
25580 Links 11. Don't add spurious <nowiki/>s between text-nodes and PMID-links (T66300)
25581 !! options
25582 parsoid=html2wt
25583 !! html/parsoid
25584 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>?foo
25585 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>&foo
25586 -<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>-
25587 </p>
25588 !! wikitext
25589 PMID 123?foo
25590 PMID 123&foo
25591 -PMID 123-
25592 !! html/php
25593 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>?foo
25594 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>&amp;foo
25595 -<a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>-
25596 </p>
25597 !! end
25598
25599 !! test
25600 Links 12. Add <nowiki/>s between text-nodes and ISBN-links when required (T66300)
25601 !! options
25602 parsoid=html2wt
25603 !! html/parsoid
25604 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>1
25605 <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>x
25606 a<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>b
25607 </p>
25608 !! wikitext
25609 ISBN 1234567890<nowiki/>1
25610 ISBN 1234567890<nowiki/>x
25611 a<nowiki/>ISBN 1234567890<nowiki/>b
25612 !! end
25613
25614 !! test
25615 Links 13. Don't add spurious <nowiki/>s between text-nodes and ISBN-links (T66300)
25616 !! options
25617 parsoid=html2wt
25618 !! html/parsoid
25619 <p>-<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>'s
25620 !! wikitext
25621 -ISBN 1234567890's
25622 !! html/php
25623 <p>-<a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>'s
25624 </p>
25625 !! end
25626
25627 !! test
25628 Links 14. Protect link-like plain text. (Parsoid bug T78425)
25629 !! options
25630 parsoid=html2wt
25631 !! html/*
25632 <p>this is not a link: http://example.com
25633 </p>
25634 !! wikitext
25635 this is not a link: <nowiki>http://example.com</nowiki>
25636 !! end
25637
25638 !! test
25639 Links 15. Link trails can't become link prefixes.
25640 !! options
25641 language=is
25642 parsoid=html2wt
25643 !! html/parsoid
25644 <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>
25645 !! wikitext
25646 [[Söfnuður]]-[[00]]
25647 !! html/php
25648 <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>
25649 </p>
25650 !! end
25651
25652 #### --------------- Quotes ---------------
25653 #### 1. Quotes inside <b> and <i>
25654 #### 2. Link fragments separated by <i> and <b> tags
25655 #### 3. Link fragments inside <i> and <b>
25656 #### 4. No escaping needed
25657 #### --------------------------------------
25658 !! test
25659 1a. Quotes inside <b> and <i>
25660 !! options
25661 parsoid=html2wt
25662 !! html/*
25663 <p><i>'foo'</i>
25664 <i>''foo''</i>
25665 <i>'''foo'''</i>
25666 <i>foo</i>'s
25667 <b>'foo'</b>
25668 <b>''foo''</b>
25669 <b>'''foo'''</b>
25670 <b>foo'<i>bar'</i>baz</b>
25671 <b>foo</b>'s
25672 '<i>foo</i>
25673 <i>foo</i>'
25674 <i>foo'</i>'
25675 '<i>foo</i>'
25676 '<b>foo</b>
25677 <b>foo</b>'
25678 '<b>foo</b>'
25679 <i>fools'<span> errand</span></i>
25680 <i><span>fool</span>'s errand</i>
25681 '<i>foo</i> bar '<i>baz</i>
25682 a|!*#-:;+-~[]{}b'<i>x</i>
25683 </p>
25684 !! wikitext
25685 ''<nowiki/>'foo'''
25686 ''<nowiki>''foo''</nowiki>''
25687 ''<nowiki>'''foo'''</nowiki>''
25688 ''foo''<nowiki/>'s
25689 '''<nowiki/>'foo''''
25690 '''<nowiki>''foo''</nowiki>'''
25691 '''<nowiki>'''foo'''</nowiki>'''
25692 '''foo'<nowiki/>''bar'<nowiki/>''baz'''
25693 '''foo'''<nowiki/>'s
25694 '''foo''
25695 ''foo''<nowiki/>'
25696 ''foo'''<nowiki/>'
25697 '''foo''<nowiki/>'
25698 ''''foo'''
25699 '''foo'''<nowiki/>'
25700 ''''foo'''<nowiki/>'
25701 ''fools'<span> errand</span>''
25702 ''<span>fool</span>'s errand''
25703 '<nowiki/>''foo'' bar '''baz''
25704 a|!*#-:;+-~[]{}b'''x''
25705 !! end
25706
25707 !! test
25708 1b. Quotes inside <b> and <i> with other tags on same line
25709 !! options
25710 parsoid=html2wt
25711 !! html/parsoid
25712 '<i>a</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
25713 <i>a'</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
25714 <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>
25715 <a rel="mw:WikiLink" href="Foo" title="Foo">foo</a> x'<i><a href="Bar" rel="mw:WikiLink" title="Bar">bar</a></i>
25716 '<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>
25717 '<i>foo</i> <div title="name">test</div>
25718 '<i>foo</i> and <br data-parsoid='{"stx":"html","noClose":true}'/> bar
25719 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
25720 <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>
25721 </ol>
25722 !! wikitext
25723 '''a'' foo ''[[bar]]''
25724 ''a''' foo ''[[bar]]''
25725 ''a''' foo '''{{echo|[[bar]]}}'''
25726 [[foo]] x'''[[bar]]''
25727 '''foo'' <ref>test</ref>
25728 '''foo'' <div title="name">test</div>
25729 '''foo'' and <br> bar
25730 <references />
25731 !! end
25732
25733 !! test
25734 2. Link fragments separated by <i> and <b> tags
25735 !! options
25736 parsoid=html2wt
25737 !! html/parsoid
25738 <p>[[<i>foo</i>hello]]</p>
25739 <p>[[<b>foo</b>hello]]</p>
25740 !! wikitext
25741 [[''foo''<nowiki>hello]]</nowiki>
25742
25743 [['''foo'''<nowiki>hello]]</nowiki>
25744 !! end
25745
25746 # FIXME: Escaping one or both of [[ and ]] is also acceptable --
25747 # this is one of the shortcomings of this format
25748 !! test
25749 3. Link fragments inside <i> and <b>
25750 !! options
25751 parsoid=html2wt
25752 !! html/parsoid
25753 <p><i>[[foo</i>]]</p>
25754 <p><b>[[foo</b>]]</p>
25755 !! wikitext
25756 ''[[foo''<nowiki>]]</nowiki>
25757
25758 '''[[foo'''<nowiki>]]</nowiki>
25759 !! end
25760
25761 !! test
25762 4. No escaping needed
25763 !! options
25764 parsoid=html2wt
25765 !! html/parsoid
25766 <p>'<span><i>bar</i></span>'
25767 '<span><b>bar</b></span>'
25768 'a:b'foo
25769 </p>
25770 !! wikitext
25771 '<span>''bar''</span>'
25772 '<span>'''bar'''</span>'
25773 'a:b'foo
25774 !! end
25775
25776 #### ----------- Paragraphs ---------------
25777 #### 1. No unnecessary escapes
25778 #### --------------------------------------
25779
25780 !! test
25781 1. No unnecessary escapes
25782 !! options
25783 parsoid=html2wt
25784 !! html/parsoid
25785 <p>bar <span>[[foo]]</span>
25786 </p><p>=bar <span>[[foo]]</span>
25787 </p><p>[[bar <span>[[foo]]</span>
25788 </p><p>]]bar <span>[[foo]]</span>
25789 </p><p>=bar <span>foo]]</span>=
25790 </p>
25791 !! wikitext
25792 bar <span><nowiki>[[foo]]</nowiki></span>
25793
25794 =bar <span><nowiki>[[foo]]</nowiki></span>
25795
25796 [[bar <span><nowiki>[[foo]]</nowiki></span>
25797
25798 ]]bar <span><nowiki>[[foo]]</nowiki></span>
25799
25800 =bar <span>foo]]</span><nowiki>=</nowiki>
25801 !!end
25802
25803 #### ----------------------- PRE --------------------------
25804 #### 1. Leading whitespace in SOL context should be escaped
25805 #### ------------------------------------------------------
25806 !! test
25807 1. Leading whitespace in SOL context should be escaped
25808 !! options
25809 parsoid=html2wt
25810 !! html/parsoid
25811 <p> a</p>
25812
25813 <p> a</p>
25814
25815 <p> a(tab)</p>
25816
25817 <p> a
25818 <!--cmt-->
25819 a</p>
25820
25821 <p>a
25822 b</p>
25823
25824 <p>a
25825 b</p>
25826
25827 <p>a
25828 b</p>
25829 !! wikitext
25830 <nowiki> </nowiki>a
25831
25832 <nowiki> </nowiki> a
25833
25834 a(tab)
25835
25836 <nowiki> </nowiki> a
25837 <!--cmt-->
25838 <nowiki> </nowiki>a
25839
25840 a
25841 <nowiki> </nowiki>b
25842
25843 a
25844 b
25845
25846 a
25847 b
25848 !! html/php
25849 <p> a
25850 </p><p> a
25851 </p><p> a(tab)
25852 </p><p> a
25853 a
25854 </p><p>a
25855 b
25856 </p><p>a
25857 b
25858 </p><p>a
25859 b
25860 </p>
25861 !! end
25862
25863 !! test
25864 2. Leading whitespace in non-indent-pre contexts should not be escaped
25865 !! options
25866 parsoid=html2wt
25867 !! html/parsoid
25868 <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>
25869 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
25870 <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>
25871 b</span></li>
25872 </ol>
25873 !! wikitext
25874 foo <ref>''a''
25875 b</ref>
25876 <references />
25877 !! end
25878
25879 !! test
25880 3. Leading whitespace in indent-pre suppressing contexts should not be escaped
25881 !! options
25882 parsoid=html2wt
25883 !! html/parsoid
25884 <blockquote>
25885 <p>
25886 a
25887 <span>b</span>
25888 c</p>
25889 </blockquote>
25890 !! wikitext
25891 <blockquote>
25892 a
25893 <span>b</span>
25894 c
25895 </blockquote>
25896 !! end
25897
25898 !! test
25899 4. Leading whitespace in indent-pre suppressing contexts should not be escaped
25900 !! options
25901 parsoid=html2wt
25902 !! html/parsoid
25903 <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>
25904 !! wikitext
25905 [[File:Foobar.jpg|thumb|caption]]
25906 !! end
25907
25908 !! test
25909 5. Nowiki escaping should account for indent-pres
25910 !! options
25911 parsoid=html2wt
25912 !! html/parsoid
25913 <pre>==foo==</pre>
25914 !! wikitext
25915 ==foo==
25916 !! end
25917
25918 !!test
25919 T95794: nowiki escaping should account for leading space at start-of-line in an indent-pre block
25920 !! options
25921 parsoid=html2wt
25922 !! html/parsoid
25923 <pre>
25924 * foo
25925 * bar
25926 </pre>
25927 !! wikitext
25928 * foo
25929 * bar
25930 !! end
25931
25932 #### --------------- Behavior Switches --------------------
25933
25934 !! test
25935 1. Valid behavior switches should be escaped
25936 !! options
25937 parsoid=html2wt
25938 !! html/parsoid
25939 __TOC__
25940 <i>__TOC__</i>
25941 !! wikitext
25942 <nowiki>__TOC__</nowiki>
25943 ''<nowiki>__TOC__</nowiki>''
25944 !! end
25945
25946 !! test
25947 2. Invalid behavior switches should not be escaped
25948 !! options
25949 parsoid=html2wt
25950 !! html/parsoid
25951 __TOO__
25952 __|__
25953 !! wikitext
25954 __TOO__
25955 __|__
25956 !! end
25957
25958 # We use indent-pre as an indirect way to test for sol-transparent behavior.
25959 !! test
25960 Behavior switches should be SOL-transparent
25961 !! options
25962 parsoid=html2wt
25963 !! html/parsoid
25964 <meta property="mw:PageProp/toc" />
25965
25966 <!-- this one's bogus -->
25967 <pre>__TOO__</pre>
25968
25969 <pre data-parsoid='{}'><meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/> foo</pre>
25970
25971 <meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/><pre data-parsoid='{}'>bar</pre>
25972 !! wikitext
25973 __TOC__
25974
25975 <!-- this one's bogus -->
25976 __TOO__
25977
25978 __TOC__ foo
25979
25980 __TOC__
25981 bar
25982 !! end
25983
25984 #### --------------- HTML tags ---------------
25985 #### 1. a tags
25986 #### 2. other tags
25987 #### 3. multi-line html tag
25988 #### 4. extension tags
25989 #### -----------------------------------------
25990 !! test
25991 1. a tags
25992 !! options
25993 parsoid=html2wt
25994 !! html/parsoid
25995 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
25996 !! wikitext
25997 <a href="http://google.com">google</a>
25998 !! end
25999
26000 !! test
26001 2. other tags
26002 !! options
26003 parsoid=html2wt
26004 !! html/parsoid
26005 <ul><li> &lt;div&gt;foo&lt;/div&gt;</li>
26006 <li> &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;</li>
26007 <li> &lt;td&gt;</li></ul>
26008
26009 !! wikitext
26010 * <nowiki><div>foo</div></nowiki>
26011 * <nowiki><div style="color:red">foo</div></nowiki>
26012 * <nowiki><td></nowiki>
26013 !! end
26014
26015 !! test
26016 3. multi-line html tag
26017 !! options
26018 parsoid=html2wt
26019 !! html/parsoid
26020 <p>&lt;div
26021 &gt;foo&lt;/div
26022 &gt;
26023 </p>
26024 !! wikitext
26025 <nowiki><div
26026 >foo</div
26027 ></nowiki>
26028 !! end
26029
26030 !! test
26031 4. extension tags
26032 !! options
26033 parsoid=html2wt
26034 !! html/parsoid
26035 <p>&lt;ref&gt;foo&lt;/ref&gt;
26036 </p><p>&lt;ref&gt;bar
26037 </p><p>baz&lt;/ref&gt;
26038 </p>
26039 !! wikitext
26040 <nowiki><ref>foo</ref></nowiki>
26041
26042 <nowiki><ref>bar</nowiki>
26043
26044 baz<nowiki></ref></nowiki>
26045 !! end
26046
26047 #### --------------- Others ---------------
26048 !! test
26049 Escaping nowikis
26050 !! options
26051 parsoid=html2wt
26052 !! html/parsoid
26053 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
26054 </p>
26055 !! wikitext
26056 &lt;nowiki&gt;foo&lt;/nowiki&gt;
26057 !! end
26058
26059 ## The quote-char in the input is necessary for triggering the bug
26060 !! test
26061 (T54035) Nowiki-escaping should not get tripped by " :" in text
26062 !! options
26063 parsoid=html2wt
26064 !! html/parsoid
26065 <p>foo's bar :</p>
26066 !! wikitext
26067 foo's bar :
26068 !! end
26069
26070 #----------- End of wikitext escaping tests --------------
26071
26072 !! test
26073
26074 Tag-like HTML structures are passed through as text
26075 !! wikitext
26076 <x y>
26077
26078 <x.y>
26079
26080 <x-y>
26081
26082 1>2
26083
26084 x<y
26085
26086 a>b
26087
26088 1<d e>f
26089 !! html
26090 <p>&lt;x y&gt;
26091 </p><p>&lt;x.y&gt;
26092 </p><p>&lt;x-y&gt;
26093 </p><p>1&gt;2
26094 </p><p>x&lt;y
26095 </p><p>a&gt;b
26096 </p><p>1&lt;d e&gt;f
26097 </p>
26098 !! end
26099
26100 !! test
26101 HTML tag with necessary entities in attributes
26102 !! wikitext
26103 <span title="&amp;amp;">foo</span>
26104 !! html
26105 <p><span title="&amp;amp;">foo</span>
26106 </p>
26107 !! end
26108
26109 !! test
26110 HTML tag with 'unnecessary' entity encoding in attributes
26111 !! wikitext
26112 <span title="&amp;">foo</span>
26113 !! html
26114 <p><span title="&amp;">foo</span>
26115 </p>
26116 !! end
26117
26118 !! test
26119 HTML tag with broken attribute value quoting
26120 !! options
26121 parsoid=wt2html,html2html
26122 !! wikitext
26123 <span title="Hello world>Foo</span>
26124 !! html/php
26125 <p><span title="Hello world">Foo</span>
26126 </p>
26127 !! html/parsoid
26128 <p><span title="Hello world">Foo</span></p>
26129 !! end
26130
26131 !! test
26132 Self-closed tag with broken attribute value quoting
26133 !! options
26134 parsoid=wt2html,html2html
26135 !! wikitext
26136 <div title="Hello world />Foo
26137 !! html/php+tidy
26138 <div title="Hello world"></div>
26139 <p>Foo</p>
26140 !! html/parsoid
26141 <div title="Hello world " data-parsoid='{"stx":"html","selfClose":true}'></div><p>Foo</p>
26142 !! end
26143
26144 !! test
26145 Table with broken attribute value quoting
26146 !! options
26147 parsoid=wt2html,html2html
26148 !! wikitext
26149 {|
26150 | title="Hello world|Foo
26151 |}
26152 !! html/php
26153 <table>
26154 <tr>
26155 <td title="Hello world">Foo
26156 </td></tr></table>
26157
26158 !! html/parsoid
26159 <table>
26160 <tr>
26161 <td title="Hello world">Foo
26162 </td></tr></table>
26163
26164 !! end
26165
26166 !! test
26167 Table with broken attribute value quoting on consecutive lines
26168 !! options
26169 parsoid=wt2html,html2html
26170 !! wikitext
26171 {|
26172 | title="Hello world|Foo
26173 | style="color:red|Bar
26174 |}
26175 !! html/php
26176 <table>
26177 <tr>
26178 <td title="Hello world">Foo
26179 </td>
26180 <td style="color:red">Bar
26181 </td></tr></table>
26182
26183 !! html/parsoid
26184 <table><tbody>
26185 <tr>
26186 <td title="Hello world">Foo
26187 </td><td style="color: red">Bar
26188 </td></tr></tbody></table>
26189
26190 !! end
26191
26192 !!test
26193 Accept empty td cell attribute
26194 !! wikitext
26195 {|
26196 | align="center" | foo || |
26197 |}
26198 !! html
26199 <table>
26200 <tr>
26201 <td align="center"> foo </td>
26202 <td>
26203 </td></tr></table>
26204
26205 !!end
26206
26207 !!test
26208 Non-empty attributes in th-cells
26209 !! wikitext
26210 {|
26211 ! Foo !! style="color: red" | Bar
26212 |}
26213 !! html
26214 <table>
26215 <tr>
26216 <th> Foo </th>
26217 <th style="color: red"> Bar
26218 </th></tr></table>
26219
26220 !!end
26221
26222 !!test
26223 Accept empty attributes in th-cells
26224 !! wikitext
26225 {|
26226 !| foo !!| bar
26227 |}
26228 !! html
26229 <table>
26230 <tr>
26231 <th> foo </th>
26232 <th> bar
26233 </th></tr></table>
26234
26235 !!end
26236
26237 !!test
26238 Empty table rows go away
26239 !! wikitext
26240 {|
26241 | Hello
26242 | there
26243 |- class="foo"
26244 |-
26245 |}
26246 !! html
26247 <table>
26248 <tr>
26249 <td> Hello
26250 </td>
26251 <td> there
26252 </td></tr>
26253
26254 </table>
26255
26256 !! end
26257
26258 ###
26259 ### Parsoid-centric tests for testing RTing of inter-element separators
26260 ### Edge cases not tested by existing parser tests and specific to
26261 ### Parsoid-specific serialization strategies.
26262 ###
26263
26264 !!test
26265 RT-ed inter-element separators should be valid separators
26266 !! wikitext
26267 {|
26268 |- [[foo]]
26269 |}
26270 !! html/php
26271 <table>
26272
26273 </table>
26274
26275 !! html/parsoid
26276 <table>
26277 <tbody><tr data-parsoid='{"startTagSrc":"|-","a":{"[[foo]]":null},"sa":{"[[foo]]":""},"autoInsertedEnd":true}'></tr>
26278 </tbody></table>
26279 !!end
26280
26281 # Parsoid-only since PHP parser relies on Tidy for correct output
26282 !!test
26283 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
26284 !!options
26285 parsoid
26286 !! wikitext
26287 {|
26288 |<small>foo
26289 bar
26290 |}
26291
26292 {|
26293 |<small>foo<small>
26294 |}
26295 !! html
26296 <table>
26297 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'>foo
26298 <p>bar</p></small></td></tr>
26299 </tbody></table>
26300
26301 <table>
26302 <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>
26303 </tbody></table>
26304 !!end
26305
26306 # Note that the "style" attribute is really a template parameter here.
26307 # The = would have to be {{=}} if you wanted the literal.
26308 !!test
26309 Empty TD followed by TD with tpl-generated attribute
26310 !! wikitext
26311 {|
26312 |-
26313 |
26314 |{{echo|style='color:red'}}|foo
26315 |}
26316 !! html
26317 <table>
26318
26319 <tr>
26320 <td>
26321 </td>
26322 <td>foo
26323 </td></tr></table>
26324
26325 !!end
26326
26327 !!test
26328 Indented table with an empty td
26329 !! wikitext
26330 {|
26331 |-
26332 |
26333 |foo
26334 |}
26335 !! html
26336 <table>
26337
26338 <tr>
26339 <td>
26340 </td>
26341 <td>foo
26342 </td></tr></table>
26343
26344 !!end
26345
26346 ## We have some newline diffs RT-ing this edge case
26347 ## and it is not important enough -- we seem to be emitting
26348 ## at most 2 newlines after a </tr> and this is unrelated to
26349 ## the issue from T85627 that this is testing.
26350 !!test
26351 Indented table with blank lines in between (T85627)
26352 !! options
26353 parsoid=wt2html
26354 !! wikitext
26355 {|
26356 |foo
26357
26358
26359 |}
26360 !! html
26361 <table>
26362
26363 <tr>
26364 <td>foo
26365 </td></tr></table>
26366
26367 !!end
26368
26369 !!test
26370 Indented block & table
26371 !! wikitext
26372 <div>foo</div>
26373 {|
26374 |foo
26375 |}
26376 !! html/php
26377 <div>foo</div>
26378 <table>
26379 <tr>
26380 <td>foo
26381 </td></tr></table>
26382
26383 !! html/parsoid
26384 <div data-parsoid='{"stx":"html"}'>foo</div>
26385 <table><tbody>
26386 <tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>foo</td></tr>
26387 </tbody></table>
26388 !!end
26389
26390 !! test
26391 Indent and comment before table row
26392 !! wikitext
26393 {|
26394 <!--hi-->|-
26395 | there
26396 |}
26397 !! html/php
26398 <table>
26399
26400 <tr>
26401 <td> there
26402 </td></tr></table>
26403
26404 !! html/parsoid
26405 <table>
26406 <!--hi--><tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
26407 <td data-parsoid='{"autoInsertedEnd":true}'> there</td></tr>
26408 </tbody></table>
26409 !! end
26410
26411 # Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext
26412 !!test
26413 Empty TR followed by a template-generated TR
26414 !!options
26415 parsoid
26416 !! wikitext
26417 {|
26418 |-
26419 {{echo|<tr><td>foo</td></tr>}}
26420 |}
26421 !! html
26422 <table>
26423 <tbody>
26424 <tr></tr>
26425 <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}}]}'>
26426 <td>foo</td></tr>
26427 </tbody></table>
26428 !!end
26429
26430 ## PHP and parsoid output differ for this, and since this is primarily
26431 ## for testing Parsoid's serializer, marking this Parsoid only
26432 !!test
26433 Empty TR followed by mixed-ws-comment line should RT correctly
26434 !!options
26435 parsoid
26436 !! wikitext
26437 {|
26438 |-
26439 <!--c-->
26440 |-
26441 <!--c--> <!--d-->
26442 |}
26443 !! html
26444 <table>
26445 <tbody>
26446 <tr></tr>
26447 <!--c-->
26448 <tr>
26449 <!--c--> </tr><!--d-->
26450 </tbody></table>
26451
26452 !!end
26453
26454 !!test
26455 Multi-line image caption generated by templates with/without trailing newlines
26456 !! wikitext
26457 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
26458 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
26459 !! html/parsoid
26460 <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>
26461 <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>
26462 !!end
26463
26464 !! test
26465 New element inserted (without intervening newlines) after an old sol-transparent node should serialize correctly
26466 !! options
26467 parsoid=html2wt
26468 !! html/parsoid
26469 <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>
26470
26471 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{}'/><h1>new heading</h1>
26472 !! wikitext
26473 <includeonly>foo</includeonly>
26474 new para
26475
26476 [[Category:Foo]]
26477
26478 = new heading =
26479 !! end
26480
26481 ## PHP emits broken html for this, and since this is primarily
26482 ## a Parsoid serializer test, marking this Parsoid only
26483 !!test
26484 Improperly nested inline or quotes tags with whitespace in between
26485 !! wikitext
26486 <span> <s>x</span> </s>
26487 ''' ''x''' ''
26488 !! html/parsoid
26489 <p><span> <s>x</s></span><s> </s>
26490 <b> <i>x</i></b><i> </i>
26491 </p>
26492 !!end
26493
26494 !!test
26495 Encapsulate protected attributes from wt
26496 !! wikitext
26497 <div typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
26498
26499 {| typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true"
26500 | ok
26501 |}
26502 !! html/parsoid
26503 <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>
26504
26505 <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">
26506 <tbody><tr><td data-parsoid='{"autoInsertedEnd":true}'> ok</td></tr>
26507 </tbody></table>
26508 !!end
26509
26510 ## Currently the p-wrapper is fragile in how it adds / removes transformations.
26511 ## Having nested or stray pre tags results in the attempt to add duplicates,
26512 ## causing an assertion fail. This test tries to prevent that situation.
26513 !!test
26514 Ensure ParagraphWrapper can deal with stray closing pre tags
26515 !!options
26516 parsoid=wt2html
26517 !! wikitext
26518 plain text</pre>
26519 !! html/parsoid
26520 plain text
26521 !!end
26522
26523 !!test
26524 1. Ensure fostered text content is wrapped in element nodes
26525 !!options
26526 parsoid=wt2html
26527 !! wikitext
26528 <table>hi</table><table>ho</table>
26529 !! html/parsoid
26530 <p>hi</p>
26531 <table></table>
26532 <p>ho</p>
26533 <table></table>
26534 !!end
26535
26536 !!test
26537 2. Ensure fostered text content is wrapped in element nodes (traps regressions around fostered marker on the element getting lost)
26538 !!options
26539 parsoid=wt2html,wt2wt
26540 !! wikitext
26541 <table>
26542 <tr> || ||
26543 <td> a
26544 </table>
26545 !! html/parsoid
26546 <p> || ||
26547 </p><table>
26548 <tbody><tr><td> a</td></tr>
26549 </tbody></table>
26550 !!end
26551
26552 !!test
26553 Encapsulation properly handles null DSR information from foster box
26554 !!options
26555 parsoid=wt2html,wt2wt
26556 !! wikitext
26557 {{echo|<table>foo<tr><td>bar</td></tr></table>}}
26558 !! html/parsoid
26559 <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>
26560 !!end
26561
26562 !!test
26563 1. Encapsulate foster-parented transclusion content
26564 !!options
26565 parsoid=wt2wt,wt2html
26566 !! wikitext
26567 <table>{{echo|foo<tr><td>bar</td></tr>}}</table>
26568 !! html/parsoid
26569 <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>
26570 <tbody>
26571 <tr>
26572 <td>bar</td>
26573 </tr>
26574 </tbody>
26575 </table>
26576 !!end
26577
26578 !!test
26579 2. Encapsulate foster-parented transclusion content
26580 !!options
26581 parsoid=wt2wt,wt2html
26582 !! wikitext
26583 <table><div>{{echo|foo}}</div><tr><td>bar</td></tr></table>
26584 !! html/parsoid
26585 <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>
26586 <table>
26587 <tbody>
26588 <tr>
26589 <td>bar</td>
26590 </tr>
26591 </tbody>
26592 </table>
26593 !!end
26594
26595 !!test
26596 3. Encapsulate foster-parented transclusion content
26597 !!options
26598 parsoid=wt2wt,wt2html
26599 !! wikitext
26600 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
26601 !! html/parsoid
26602 <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;]}">
26603 <p>foo</p>
26604 </div>
26605 <table>
26606 <tbody>
26607 <tr>
26608 <td>bar</td>
26609 </tr>
26610 </tbody>
26611 </table>
26612 !!end
26613
26614 !!test
26615 4. Encapsulate foster-parented transclusion content
26616 !!options
26617 parsoid=wt2wt,wt2html
26618 !! wikitext
26619 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
26620 !! html/parsoid
26621 <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;]}">
26622 <p>foo</p>
26623 </div>
26624 <table>
26625 <tbody>
26626 <tr>
26627 <td>bar</td>
26628 </tr>
26629 </tbody>
26630 </table>
26631 !!end
26632
26633 !!test
26634 5. Encapsulate foster-parented transclusion content
26635 !!options
26636 parsoid=wt2wt,wt2html
26637 !! wikitext
26638 <table><tr><td><div><p>{{echo|foo</p></div></td>foo}}</tr></table>
26639 !! html/parsoid
26640 <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>
26641 <table>
26642 <tbody>
26643 <tr>
26644 <td>
26645 <div>
26646 <p>foo</p>
26647 </div>
26648 </td>
26649 </tr>
26650 </tbody>
26651 </table>
26652 !!end
26653
26654 !!test
26655 6. Encapsulate foster-parented transclusion content
26656 !!options
26657 parsoid=wt2wt,wt2html
26658 !! wikitext
26659 <table><tr><td><div><p>{{echo|foo</p></div></td>foo</tr></table>}}<p>ok</p>
26660 !! html/parsoid
26661 <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>
26662 <table>
26663 <tbody>
26664 <tr>
26665 <td>
26666 <div>
26667 <p>foo</p>
26668 </div>
26669 </td>
26670 </tr>
26671 </tbody>
26672 </table>
26673 <p>ok</p>
26674 !!end
26675
26676 !!test
26677 7. Encapsulate foster-parented transclusion content
26678 !!options
26679 parsoid=wt2wt,wt2html
26680 !! wikitext
26681 <table>{{echo|<p>foo</p>}}<td>bar</td></table>
26682 !! html/parsoid
26683 <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>
26684 <table>
26685 <tbody>
26686 <tr>
26687 <td>bar</td>
26688 </tr>
26689 </tbody>
26690 </table>
26691 !!end
26692
26693 # Note that the wt is broken on purpose: the = should be {{=}} if you
26694 # don't want it to be a template parameter key.
26695 !!test
26696 8. Encapsulate foster-parented transclusion content
26697 !!options
26698 parsoid=wt2wt,wt2html
26699 !! wikitext
26700 {{echo|a
26701 }}{|{{echo|style='color:red'}}
26702 |-
26703 |b
26704 |}
26705 !! html/parsoid
26706 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\n"}},"i":0}}]}'>a</p>
26707 <span> </span>
26708 <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>
26709 <table>
26710 <tbody>
26711 <tr>
26712 <td>b</td>
26713 </tr>
26714 </tbody>
26715 </table>
26716 !!end
26717
26718 !!test
26719 9. Encapsulate foster-parented transclusion content
26720 !!options
26721 parsoid=wt2wt,wt2html
26722 !! wikitext
26723 <table>{{echo|hi</table>hello}}
26724 !! html/parsoid
26725 <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>
26726 !!end
26727
26728 !!test
26729 Table in fosterable position
26730 !!options
26731 parsoid=wt2html
26732 !! wikitext
26733 {{OpenTable}}
26734 <div>
26735 {|
26736 |}
26737 </div>
26738 |}
26739 !! html/parsoid
26740 <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">
26741 </span>
26742 <table about="#mwt1" data-parsoid='{"autoInsertedEnd":true}'></table>
26743
26744 <table>
26745 </table>
26746 !!end
26747
26748 # Parsoid only for T66747
26749 !! test
26750 Properly encapsulate empty-content transclusions in fosterable positions
26751 !! wikitext
26752 <table>
26753 {{#if:|
26754 <td>foo</td>
26755 }}
26756 </table>
26757 !! html/parsoid
26758 <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"}]]}'>
26759
26760 </table>
26761 !! end
26762
26763 !! test
26764 Always encapsulate foster box when template range is expanded to table
26765 !! options
26766 parsoid=wt2wt
26767 !! wikitext
26768 {|
26769 hello
26770 {{OpenTable}}
26771 |}
26772 !! html/parsoid
26773
26774 !! end
26775
26776 !! test
26777 T115289: Unclosed table
26778 !! wikitext
26779 {{echo|<table>}}<!--c-->[[Category:Two]]
26780 !! html/parsoid
26781 <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>
26782 !! end
26783
26784 !! test
26785 T115289: Don't migrate newlines out of tables with fostered content
26786 !! wikitext
26787 <table><td></td>{{echo|<tr>[[Category:One]]}}<!--c-->[[Category:Two]]
26788 !! html/parsoid
26789 <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>
26790 !! end
26791
26792 !! test
26793 T73074: More fostering fun
26794 !! wikitext
26795 <table><td></td>{{echo|<tr>}}<!--c-->[[Category:Two]]
26796 !! html/parsoid
26797 <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>
26798 !! end
26799
26800 !!test
26801 Support <object> element with .data attribute
26802 !!options
26803 parsoid=html2wt
26804 !! html/parsoid
26805 <object data="test.swf"></object>
26806 !! wikitext
26807 <object data="test.swf"></object>
26808 !!end
26809
26810 !! test
26811 Don't block XML namespace declaration
26812 !! wikitext
26813 <span xmlns:dct="http://purl.org/dc/terms/" property="dct:title">MediaWiki</span>
26814 !! html/php
26815 <p><span xmlns:dct="http&#58;//purl.org/dc/terms/" property="dct:title">MediaWiki</span>
26816 </p>
26817 !! html/parsoid
26818 <p><span xmlns:dct="http://purl.org/dc/terms/" data-x-property="dct:title" data-parsoid='{"stx":"html"}'>MediaWiki</span></p>
26819 !! end
26820
26821 # -----------------------------------------------------------------
26822 # The following section of tests are primarily to spec requirements
26823 # around Parsoid's serialization (old, new, edited content)
26824 #
26825 # All these tests are marked Parsoid html2wt and html2html only
26826 # ----------------------------------------------------------------
26827
26828 !! test
26829 Ignore rel attribute in a-tags during serialization to url-links
26830 !! options
26831 parsoid=html2wt
26832 !! html/parsoid
26833 <a href='http://en.wikipedia.org/wiki/Foobar'>http://en.wikipedia.org/wiki/Foobar</a>
26834 <a href='http://en.wikipedia.org/wiki/Foobar' rel='mw:ExtLink'>http://en.wikipedia.org/wiki/Foobar</a>
26835 <a href='http://en.wikipedia.org/wiki/Foobar' rel='mw:WikiLink'>http://en.wikipedia.org/wiki/Foobar</a>
26836 !! wikitext
26837 http://en.wikipedia.org/wiki/Foobar
26838 http://en.wikipedia.org/wiki/Foobar
26839 http://en.wikipedia.org/wiki/Foobar
26840 !! end
26841
26842 # 'mi' is a localinterwiki prefix as well as a language
26843 !! test
26844 Serialize interwiki links pointing to the current wiki as plain wiki links (T67869)
26845 !! options
26846 parsoid=html2wt
26847 !! html/parsoid
26848 <p><a rel="mw:ExtLink" href="http://mi.wikipedia.org/wiki/Foo">Foo</a></p>
26849 !! wikitext
26850 [[Foo]]
26851 !! end
26852
26853 !! test
26854 Parsoid should accept interwiki shortcuts
26855 !! options
26856 parsoid=html2wt
26857 !! html/parsoid
26858 <p><a rel='mw:WikiLink' href='./fr:Foo'>Foo</a>
26859 <a rel='mw:ExtLink' href='./fr:Foo'>Foo</a>
26860 <a href='./fr:Foo'>Foo</a></p>
26861 <p><a rel='mw:WikiLink' href='fr%3AFoo'>Foo</a>
26862 <a rel='mw:ExtLink' href='fr%3AFoo'>Foo</a>
26863 <a href='fr%3AFoo'>Foo</a></p>
26864 <p><a href='FR%3AFoo'>Foo</a>
26865 <a href='./FR:Foo'>Foo</a></p>
26866 !! wikitext
26867 [[:fr:Foo|Foo]]
26868 [[:fr:Foo|Foo]]
26869 [[:fr:Foo|Foo]]
26870
26871 [[:fr:Foo|Foo]]
26872 [[:fr:Foo|Foo]]
26873 [[:fr:Foo|Foo]]
26874
26875 [[:fr:Foo|Foo]]
26876 [[:fr:Foo|Foo]]
26877 !! end
26878
26879 !! test
26880 Parsoid should not accept invalid interwiki shortcuts
26881 !! options
26882 parsoid=html2wt
26883 !! html/parsoid
26884 <p><a rel='mw:WikiLink' href='news:Foo'>Foo</a>
26885 <a rel='mw:ExtLink' href='news:Foo'>Foo</a>
26886 <a href='news:Foo'>Foo</a></p>
26887 !! wikitext
26888 [news:Foo Foo]
26889 [news:Foo Foo]
26890 [news:Foo Foo]
26891 !! end
26892
26893 # See T93839
26894 !! test
26895 New wikilinks should be serialized properly
26896 !! options
26897 parsoid=html2wt
26898 !! html/parsoid
26899 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{}'>Foo</a>
26900 <a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>
26901 <a href="//en.wikipedia.org/wiki/Foo">//en.wikipedia.org/wiki/Foo</a>
26902 <a href="http://en.wikipedia.org/wiki/Foo">http://en.wikipedia.org/wiki/Foo</a>
26903 <a href="//en.wikipedia.org/wiki/Foo_bar">//en.wikipedia.org/wiki/Foo bar</a>
26904 !! wikitext
26905 [[Foo]]
26906 [[Foo]]
26907 [[:en:Foo|//en.wikipedia.org/wiki/Foo]]
26908 http://en.wikipedia.org/wiki/Foo
26909 [[:en:Foo_bar|//en.wikipedia.org/wiki/Foo bar]]
26910 !! end
26911
26912 !! test
26913 New wiki links (href variations)
26914 !! options
26915 parsoid=html2wt
26916 !! html/parsoid
26917 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
26918 <a rel="mw:WikiLink" href="Foo_bar">Foo_bar</a>
26919 <a rel="mw:WikiLink" href="Foo bar">Foo_bar</a>
26920 <a rel="mw:WikiLink" href="./Toxine_bact%C3%A9rienne">Toxine bactérienne</a>
26921 !! wikitext
26922 [[Foo_bar]]
26923 [[Foo_bar]]
26924 [[Foo_bar]]
26925 [[Toxine bactérienne]]
26926 !! end
26927
26928 !! test
26929 New wiki links (content string variations)
26930 !! options
26931 parsoid=html2wt
26932 !! html/parsoid
26933 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
26934 <a rel="mw:WikiLink" href="./Foo_bar">Foo bar</a>
26935 <a rel="mw:WikiLink" href="./Foo_bar">./Foo_bar</a>
26936 !! wikitext
26937 [[Foo_bar]]
26938 [[Foo bar]]
26939 [[Foo_bar|./Foo_bar]]
26940 !! end
26941
26942 !! test
26943 New category links (href variations)
26944 !! options
26945 parsoid=html2wt
26946 !! html/parsoid
26947 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne" />
26948 <link rel="mw:PageProp/Category" href="./Category:Toxine_bact%C3%A9rienne" />
26949 <link rel="mw:PageProp/Category" href="Category:Toxine_bact%C3%A9rienne" />
26950 !! wikitext
26951 [[Category:Toxine bactérienne]]
26952 [[Category:Toxine bactérienne]]
26953 [[Category:Toxine bactérienne]]
26954 !! end
26955
26956 !! test
26957 New sol transparent links don't need indent-pre nowiki protection
26958 !! options
26959 parsoid=html2wt
26960 language=de
26961 !! html/parsoid
26962 <link rel="mw:PageProp/redirect" href="./Main_Page">
26963 <!-- this is good --> <link rel="mw:PageProp/Category" href="./Category:Good" />
26964 <!-- this is great --> <link rel="mw:PageProp/Category" href="./Kategorie:Great" />
26965 !! wikitext
26966 #WEITERLEITUNG [[Main Page]]
26967 <!-- this is good --> [[Category:Good]]
26968 <!-- this is great --> [[Kategorie:Great]]
26969 !! end
26970
26971 !! test
26972 New interlanguage links (href variations)
26973 !! options
26974 parsoid=html2wt
26975 !! html/parsoid
26976 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine bactérienne" />
26977 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bactérienne" />
26978 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bact%C3%A9rienne" />
26979 !! wikitext
26980 [[es:Toxine bactérienne]]
26981 [[es:Toxine_bactérienne]]
26982 [[es:Toxine_bactérienne]]
26983 !! end
26984
26985 !! test
26986 Image: Modifying size of an image (1)
26987 !! options
26988 parsoid={
26989 "modes": ["wt2wt"],
26990 "changes": [
26991 ["img[height]", "attr", "height", "22"],
26992 ["img[width]", "attr", "width", "200"]
26993 ]
26994 }
26995 !! wikitext
26996 [[Image:Foobar.jpg|230x230px]]
26997 !! wikitext/edited
26998 [[Image:Foobar.jpg|200x200px]]
26999 !!end
27000
27001 !! test
27002 Image: Modifying size of an image (2)
27003 !! options
27004 parsoid={
27005 "modes": ["wt2wt"],
27006 "changes": [
27007 ["img[height]", "attr", "height", "100"],
27008 ["img[width]", "attr", "width", "500"]
27009 ]
27010 }
27011 !! wikitext
27012 [[Image:Foobar.jpg|230x230px]]
27013 !! wikitext/edited
27014 [[Image:Foobar.jpg|500x500px]]
27015 !!end
27016
27017 # Change in size is ignored so long as class='mw-default-size'
27018 !! test
27019 Image: Modifying size of an image (3)
27020 !! options
27021 parsoid={
27022 "modes": ["wt2wt"],
27023 "changes": [
27024 ["figure[class]", "removeClass", "mw-default-size"],
27025 ["figure img", "attr", "height", "19"],
27026 ["figure img", "attr", "width", "170"]
27027 ]
27028 }
27029 !! wikitext
27030 [[Image:Foobar.jpg|thumb]]
27031 !! wikitext/edited
27032 [[Image:Foobar.jpg|thumb|170x170px]]
27033 !!end
27034
27035 !! test
27036 Image: Modifying alignment of an image (T50665)
27037 !! options
27038 parsoid={
27039 "modes": ["wt2wt"],
27040 "changes": [
27041 ["figure[class]", "removeClass", "mw-halign-right"],
27042 ["figure[class]", "addClass", "mw-halign-left"]
27043 ]
27044 }
27045 !! wikitext
27046 [[Image:Foobar.jpg|thumb|caption|right]]
27047 !! wikitext/edited
27048 [[Image:Foobar.jpg|thumb|caption|left]]
27049 !! end
27050
27051 !! test
27052 Image: Modifying mw-default-size of an frameless image (T64805)
27053 !! options
27054 parsoid={
27055 "modes": ["wt2wt"],
27056 "changes": [
27057 ["figure.mw-default-size", "removeClass", "mw-default-size"]
27058 ]
27059 }
27060 !! wikitext
27061 [[Image:Foobar.jpg|frameless|right]]
27062 !! wikitext/edited
27063 [[Image:Foobar.jpg|frameless|right|220x220px]]
27064 !! end
27065
27066 !! test
27067 Image: Modifying valign of an image (T51221)
27068 !! options
27069 parsoid={
27070 "modes": ["wt2wt"],
27071 "changes": [
27072 ["*[typeof=\"mw:Image\"]", "removeClass", "mw-valign-middle"],
27073 ["*[typeof=\"mw:Image\"]", "addClass", "mw-valign-text-top"]
27074 ]
27075 }
27076 !! wikitext
27077 [[File:Foobar.jpg|20px|middle]]
27078 !! wikitext/edited
27079 [[File:Foobar.jpg|20px|text-top]]
27080 !! end
27081
27082 !! test
27083 Image: Modifying alt attribute of an image (T58400)
27084 !! options
27085 parsoid={
27086 "modes": ["wt2wt"],
27087 "changes": [
27088 ["img[alt]", "attr", "alt", "some alternate edited text"]
27089 ]
27090 }
27091 !! wikitext
27092 [[File:Foobar.jpg|thumb|some caption|alt=some alternate text]]
27093 !! wikitext/edited
27094 [[File:Foobar.jpg|thumb|some caption|alt=some alternate edited text]]
27095 !!end
27096
27097 !! test
27098 Image: Modifying caption of an image
27099 !! options
27100 parsoid={
27101 "modes": ["wt2wt"],
27102 "changes": [
27103 ["figcaption", "text", "new caption"]
27104 ]
27105 }
27106 !! wikitext
27107 [[Image:Foobar.jpg|thumb|original caption]]
27108 !! wikitext/edited
27109 [[Image:Foobar.jpg|thumb|new caption]]
27110 !!end
27111
27112 !! test
27113 Image: empty alt attribute (T50924)
27114 !! options
27115 parsoid
27116 !! wikitext
27117 [[File:Foobar.jpg|thumb|alt=|bar]]
27118 !! html
27119 <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>
27120 !! end
27121
27122 !! test
27123 Image: new attributes should be serialized in wiki's language for RTL languages (T53852)
27124 !! options
27125 parsoid=html2wt
27126 language=ar
27127 disabled
27128 !! html/parsoid
27129 <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>
27130 !! wikitext
27131 [[Imagen:Foobar.jpg|derecha|miniaturadeimagen]]
27132 !! end
27133
27134 !! test
27135 Image: Block level image should have \n before and after
27136 !! wikitext
27137 123
27138 [[File:Foobar.jpg|right|thumb|150x150px]]
27139 456
27140 !! html/parsoid
27141 <p>123</p>
27142 <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>
27143 <p>456</p>
27144 !! end
27145
27146 !! test
27147 Image: New block level image should have \n before and after (existing content)
27148 !! wikitext
27149 123
27150 [[File:Foobar.jpg|right|thumb|150x150px]]
27151 456
27152 !! html/parsoid
27153 <p>123</p>
27154 <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>
27155 <p>456</p>
27156 !! end
27157
27158 !! test
27159 Image: upright option (parsoid)
27160 !! wikitext
27161 [[File:Foobar.jpg|thumb|upright|caption]]
27162 [[File:Foobar.jpg|thumb|upright=0.5|caption]]
27163 [[File:Foobar.jpg|thumb|500x500px|upright=0.5|caption]]
27164 !! html/parsoid
27165 <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>
27166 <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>
27167 <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>
27168 !! end
27169
27170 !! test
27171 Image: upright option is ignored on inline and frame images (parsoid)
27172 !! wikitext
27173 [[File:Foobar.jpg|500x500px|upright=0.5|caption]]
27174 !! html/parsoid
27175 <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>
27176 !! end
27177
27178 !! test
27179 Image: in template parameter with empty parameter
27180 !! wikitext
27181 {{echo|[[File:Foobar.jpg|link=]]}}
27182 !! html/parsoid
27183 <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>
27184 !! end
27185
27186 !! test
27187 Image: from basic HTML (1)
27188 !! options
27189 parsoid=html2wt
27190 !! html/parsoid
27191 <span typeof="mw:Image">
27192 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
27193 </span>
27194 !! wikitext
27195 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
27196 !! end
27197
27198 !! test
27199 Image: from basic HTML (2)
27200 !! options
27201 parsoid=html2wt
27202 !! html/parsoid
27203 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
27204 !! wikitext
27205 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
27206 !! end
27207
27208 !! test
27209 Image: from basic HTML (3)
27210 !! options
27211 parsoid=html2wt
27212 !! html/parsoid
27213 <a href="Main"><img src="./File:Foobar.jpg" width=100 height=100 alt="Alt"></a>
27214 !! wikitext
27215 [[File:Foobar.jpg|link=Main|alt=Alt|100x100px]]
27216 !! end
27217
27218 !! test
27219 Image: from basic HTML (4)
27220 !! options
27221 parsoid=html2wt
27222 !! html/parsoid
27223 <img src="./File:Foobar.jpg">
27224 !! wikitext
27225 [[File:Foobar.jpg|link=]]
27226 !! end
27227
27228 !! test
27229 Image: Invalid title as link
27230 !! wikitext
27231 [[File:Foobar.jpg|link=<]]
27232 !! html/php
27233 <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>
27234 </p>
27235 !! html/parsoid
27236 <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>
27237 !! end
27238
27239 !! test
27240 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
27241 !! options
27242 parsoid=html2wt
27243 !! html/parsoid
27244 <ul>
27245 <li><p>foo</p></li>
27246 </ul>
27247 !! wikitext
27248 * foo
27249 !! end
27250
27251 !! test
27252 Lists: Serialize correctly even when list tags has unneeded whitespace between tags
27253 !! options
27254 parsoid=html2wt
27255 !! html/parsoid
27256 <ul> <li>foo</li></ul>
27257 !! wikitext
27258 * foo
27259 !! end
27260
27261 !! test
27262 Don't strip leading whitespace when handling indent-pre suppressing tags
27263 !! options
27264 parsoid=html2wt
27265 !! html/parsoid
27266 <table>
27267 <tr><td> indented row</td></tr>
27268 </table>
27269 <blockquote><p>
27270 <b>This is very bold of you!</b>
27271 </p>
27272 <table><tr><td>
27273 indented cell (no pre-wrapping!)
27274 </td></tr></table>
27275 </blockquote>
27276 <p>foo</p>
27277 <div>bar</div>
27278 !! wikitext
27279 {|
27280 | indented row
27281 |}
27282 <blockquote>
27283 '''This is very bold of you!'''
27284
27285 {|
27286 |
27287 indented cell (no pre-wrapping!)
27288 |}
27289 </blockquote>
27290 foo
27291 <div>bar</div>
27292 !! end
27293
27294 !! test
27295 Nowiki-wrap leading whitespace when handling indent-pre inducing tags
27296 !! options
27297 parsoid=html2wt
27298 !! html/parsoid
27299 <p>foo</p>
27300 <span>bar</span>
27301
27302 <span>foo2
27303 </span>bar2
27304
27305 <div>foo</div>
27306 <span>bar</span>
27307
27308 <div>
27309 <span>foo</span>
27310 </div>
27311 !! wikitext
27312 foo
27313
27314 <span>bar</span>
27315
27316 <span>foo2
27317 <nowiki> </nowiki></span>bar2
27318
27319 <div>foo</div>
27320 <nowiki> </nowiki><span>bar</span>
27321
27322 <div>
27323 <nowiki> </nowiki><span>foo</span>
27324 </div>
27325 !! end
27326
27327 !! test
27328 Lists: Dont insert newlines in a serialized list item.
27329 !! options
27330 parsoid=html2wt
27331 !! html/parsoid
27332 <ul><li>a<br>b</li><li>c</li></ul>
27333 !! wikitext
27334 * a<br>b
27335 * c
27336 !! end
27337
27338 !! test
27339 1. Headings: Force sol-transparent links and behavior switches to serialize before/after
27340 !! options
27341 parsoid={
27342 "modes": ["html2wt"],
27343 "scrubWikitext": false
27344 }
27345 !! html/parsoid
27346 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
27347 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
27348
27349 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
27350 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
27351
27352 <h2 data-parsoid='{}'>howdy<link href="./Category:A5" rel="mw:PageProp/Category" /></h2>
27353
27354 <h2><meta property="mw:PageProp/toc" /> ok</h2>
27355 !! wikitext
27356 == hello there [[Category:A1]] ==
27357
27358 == [[Category:A2]] hi pal ==
27359
27360 == <!--foo--> [[Category:A3]] how goes it ==
27361
27362 == it goes well [[Category:A4]] <!--bar--> ==
27363
27364 ==howdy [[Category:A5]]==
27365
27366 == __TOC__ ok ==
27367 !! end
27368
27369 !! test
27370 2. Headings: Force sol-transparent links and behavior switches to serialize before/after
27371 !! options
27372 parsoid={
27373 "modes": ["html2wt"],
27374 "scrubWikitext": true
27375 }
27376 !! html/parsoid
27377 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
27378 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
27379
27380 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
27381 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
27382
27383 <h2><meta property="mw:PageProp/toc" /> ok</h2>
27384 !! wikitext
27385 == hello there ==
27386 [[Category:A1]]
27387 [[Category:A2]]
27388
27389 == hi pal ==
27390
27391 <!--foo--> [[Category:A3]]
27392
27393 == how goes it ==
27394
27395 == it goes well ==
27396 [[Category:A4]] <!--bar-->
27397
27398 __TOC__
27399
27400 == ok ==
27401 !! end
27402
27403 !! test
27404 Headings: Don't hoist metas that come from templates
27405 !! options
27406 parsoid={
27407 "modes": ["html2wt"],
27408 "scrubWikitext": true
27409 }
27410 !! html/parsoid
27411 <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>
27412 !! wikitext
27413 == {{echo|foo [[Category:Foo]]}} ==
27414 !! end
27415
27416 !! test
27417 Headings: Category in ref isn't hoisted
27418 !! options
27419 parsoid={
27420 "modes": ["html2wt"],
27421 "scrubWikitext": true
27422 }
27423 !! html/parsoid
27424 <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>
27425
27426 <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>
27427 !! wikitext
27428 == foo <ref>bar
27429 [[Category:Baz]] </ref> ==
27430
27431 <references />
27432 !! end
27433
27434 !! test
27435 Parsoid: Serialize positional parameters with = in them as named parameter
27436 !! options
27437 parsoid=html2wt
27438 !! html/parsoid
27439 <p about="#mwt1" typeof="mw:Transclusion"
27440 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
27441
27442 <p about="#mwt1" typeof="mw:Transclusion"
27443 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}, "2":{"wt":"bar"}},"i":0}}]}'>foo</p>
27444
27445 <!--Orig params with data-parsoid has heuristics for handling = chars-->
27446 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
27447 <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>
27448 !! wikitext
27449 {{echo|1=f=oo}}
27450
27451 {{echo|1=f=oo|2=bar}}
27452
27453 <!--Orig params with data-parsoid has heuristics for handling = chars-->
27454 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
27455 {{echo|<nowiki>f=oo</nowiki>|bar}}
27456 !! end
27457
27458 !! test
27459 Parsoid: Serialize positional parameters with = in extlink as named parameter
27460 !! options
27461 parsoid=html2wt
27462 !! html/parsoid
27463 <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>
27464 !! wikitext
27465 {{echo|1=http://stuff?is=ok}}
27466 !! end
27467
27468 !! test
27469 Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
27470 !! options
27471 parsoid=html2wt
27472 !! html/parsoid
27473 <div>a<p>b</p></div>
27474 <div>a
27475 <p>b</p></div>
27476 <div>
27477 a
27478 <p>b</p></div>
27479 !! wikitext
27480 <div>a
27481 b
27482 </div>
27483 <div>a
27484 b
27485 </div>
27486 <div>
27487 a
27488
27489 b
27490 </div>
27491 !! end
27492
27493 !! test
27494 Substrings resembling wikitext in hrefs should not get nowiki escapes
27495 !! options
27496 parsoid=html2wt
27497 !! html/parsoid
27498 <a rel="mw:WikiLink" href="./Foo''bar''baz">Foo''bar''baz</a>
27499 !! wikitext
27500 [[Foo''bar''baz]]
27501 !! end
27502
27503 !! test
27504 Enforce single-line context in the serializer
27505 !! options
27506 parsoid=html2wt
27507 !! html/parsoid
27508 <h2>testing
27509 123</h2>
27510
27511 <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">
27512 </span><span about="#mwt1">you</span> </h2>
27513
27514 <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>
27515
27516 <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
27517 there</span></li></ol>
27518
27519 <ul><li>asd
27520 sdf</li></ul>
27521
27522 <ul><li>foo
27523 bar
27524 baz</li>
27525 <li>foo <b>bar</b>
27526 baz</li></ul>
27527
27528 <dl><dt>hi
27529 ho </dt><dd data-parsoid='{"stx":"row"}'> hi
27530 ho</dd></dl>
27531
27532 <dl><dd> <table>
27533 <tbody><tr><td> ha
27534 ha
27535 ha</td></tr>
27536 </tbody></table></dd></dl>
27537 !! wikitext
27538 == testing 123 ==
27539
27540 == hi {{bogus|there
27541 you}} ==
27542
27543 == foo <ref>hello
27544 there</ref> ==
27545
27546 <references />
27547
27548 * asd sdf
27549
27550 * foo bar baz
27551 * foo '''bar''' baz
27552
27553 ; hi ho : hi ho
27554
27555 : {|
27556 | ha
27557 ha
27558 ha
27559 |}
27560 !! end
27561
27562 !! test
27563 Serialize new placeholder space without spans
27564 !! options
27565 parsoid=html2wt
27566 !! html/parsoid
27567 <p>foo<span typeof="mw:Placeholder"> </span>: bar</p>
27568
27569 <p>foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span>: bar</p>
27570
27571 <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>
27572 !! wikitext
27573 foo : bar
27574
27575 foo : bar
27576
27577 <ref>foo : bar</ref>ok
27578 !! end
27579
27580
27581 #-----------------------
27582 # Tag minimization tests
27583 #-----------------------
27584
27585 !! test
27586 1. I/B quote minimization: wikitext-only tags should be combined
27587 !! options
27588 parsoid=html2wt
27589 !! html/parsoid
27590 <p><i>A</i><i>B</i></p>
27591 <p><b>A</b><b>B</b></p>
27592 <p><i>A</i><b><i>B</i></b></p>
27593 <p><b>A</b><i><b>B</b></i></p>
27594 <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
27595 <p><i><b>A</b></i><i><b>B</b></i></p>
27596 <p><i><b>A</b></i><b><i>B</i></b></p>
27597 <p><b><i>A</i></b><i><b>B</b></i></p>
27598 !! wikitext
27599 ''AB''
27600
27601 '''AB'''
27602
27603 ''A'''B'''''
27604
27605 '''A''B'''''
27606
27607 '''A''BC''D'''
27608
27609 '''''AB'''''
27610
27611 '''''AB'''''
27612
27613 '''''AB'''''
27614 !! end
27615
27616 !! test
27617 2. I/B quote minimization: wikitext and html tags should not be combined
27618 !! options
27619 parsoid=html2wt
27620 !! html/parsoid
27621 <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
27622 <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
27623 !! wikitext
27624 ''A''<i>B</i>
27625
27626 ''A''<nowiki/>'''<i>B</i>'''
27627 !! end
27628
27629 !! test
27630 3. I/B quote minimization: templated content stops minimization
27631 !! options
27632 parsoid=html2wt
27633 !! html/parsoid
27634 <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>
27635 <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>
27636 !! wikitext
27637 ''A''{{echo|''B''}}
27638
27639 ''A''{{echo|'''''B'''''}}
27640 !! end
27641
27642 !! test
27643 4. I/B quote minimization: new content should be mimimized with adjacent old content
27644 !! options
27645 parsoid=html2wt
27646 !! html/parsoid
27647 <p><i>A</i><i>B</i></p>
27648 <p><b>A</b><b>B</b></p>
27649 <p><i>A</i><b><i>B</i></b></p>
27650 !! wikitext
27651 ''AB''
27652
27653 '''AB'''
27654
27655 ''A'''B'''''
27656 !! end
27657
27658 !! test
27659 5a. Merge adjacent quote nodes if they've been edited
27660 !! options
27661 parsoid={
27662 "modes": ["wt2wt", "selser"],
27663 "changes": [
27664 ["p", "contents", "remove", ":contains('b')"]
27665 ]
27666 }
27667 !! wikitext
27668 ''a''b''c''
27669 !! wikitext/edited
27670 ''ac''
27671 !! end
27672
27673 !! test
27674 5b. Merge adjacent quote nodes if they've been edited
27675 !! options
27676 parsoid={
27677 "modes": ["wt2wt", "selser"],
27678 "changes": [
27679 ["#x", "remove"]
27680 ]
27681 }
27682 !! wikitext
27683 ''a''<span id="x">b</span>''c''
27684 !! wikitext/edited
27685 ''ac''
27686 !! end
27687
27688 !! test
27689 1. Merge adjacent link nodes as long as at least one element is new
27690 !! options
27691 parsoid={
27692 "modes": ["html2wt"],
27693 "scrubWikitext": true
27694 }
27695 !! html/parsoid
27696 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
27697 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
27698 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a data-parsoid="{}" rel="mw:WikiLink" href="./Football">ball</a>
27699 !! wikitext
27700 [[Football]]
27701 [[Football]]
27702 [[Football|Foot]][[Football|ball]]
27703 !! end
27704
27705 !! test
27706 2. Merge adjacent link nodes and enable additional normalizations
27707 !! options
27708 parsoid={
27709 "modes": ["html2wt"],
27710 "scrubWikitext": true
27711 }
27712 !! html/parsoid
27713 <a rel="mw:WikiLink" href="./Football"><i>Foot</i></a><a rel="mw:WikiLink" href="./Football"><i>ball</i></a>
27714 !! wikitext
27715 [[Football|''Football'']]
27716 !! end
27717
27718 !! test
27719 3. Don't merge adjacent link nodes if scrubWikitext is false
27720 !! options
27721 parsoid={
27722 "modes": ["html2wt"],
27723 "scrubWikitext": false
27724 }
27725 !! html/parsoid
27726 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
27727 !! wikitext
27728 [[Football|Foot]][[Football|ball]]
27729 !! end
27730
27731 #------------------------------
27732 # End of tag minimization tests
27733 #------------------------------
27734
27735 !!test
27736 T56262: New entities
27737 !! options
27738 parsoid=html2wt
27739 !! html/parsoid
27740 <span typeof="mw:Entity">&nbsp;</span>
27741 !! wikitext
27742 &nbsp;
27743 !! end
27744
27745 ## Note that there is no wikitext output for 'unknownproperty' ##
27746 ## Unknown magic words are silently dropped ##
27747
27748 !! test
27749 Magic words
27750 !! options
27751 parsoid=html2wt
27752 !! html/parsoid
27753 <meta property='mw:PageProp/toc' />
27754 <meta property='mw:PageProp/notoc' />
27755 <meta property='mw:PageProp/forcetoc' />
27756 <meta property='mw:PageProp/index' />
27757 <meta property='mw:PageProp/noindex' />
27758 <meta property='mw:PageProp/nogallery' />
27759 <meta property='mw:PageProp/noeditsection' />
27760 <meta property='mw:PageProp/notitleconvert' />
27761 <meta property='mw:PageProp/nocontentconvert' />
27762 <meta property='mw:PageProp/unknownproperty' />
27763 !! wikitext
27764 __TOC__
27765 __NOTOC__
27766 __FORCETOC__
27767 __INDEX__
27768 __NOINDEX__
27769 __NOGALLERY__
27770 __NOEDITSECTION__
27771 __NOTITLECONVERT__
27772 __NOCONTENTCONVERT__
27773 !! end
27774
27775 !! test
27776 Consecutive <pre>s should not get merged
27777 !! options
27778 parsoid=html2wt,html2html
27779 !! html/parsoid
27780 <pre>a</pre><pre>b</pre>
27781
27782 <pre>c
27783 </pre><pre>
27784 d</pre>
27785
27786 <pre>e
27787
27788 </pre><pre>
27789
27790 f</pre>
27791 !! wikitext
27792 a
27793
27794 b
27795
27796 c
27797
27798 d
27799
27800 e
27801
27802
27803
27804 f
27805 !! end
27806
27807 !! test
27808 Edited ISBN links not serializable as ISBN links should serialize as wikilinks
27809 !! options
27810 parsoid=html2wt
27811 !! html/parsoid
27812 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink">ISBN 1234567895</a>
27813 !! wikitext
27814 [[Special:BookSources/1234567890|ISBN 1234567895]]
27815 !! end
27816
27817 !! test
27818 Edited RFC links not serializable as RFC links should serialize as extlinks
27819 !! options
27820 parsoid=html2wt
27821 !! html/parsoid
27822 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink">New RFC</a>
27823 !! wikitext
27824 [//tools.ietf.org/html/rfc123 New RFC]
27825 !! end
27826
27827 !! test
27828 Edited PMID links not serializable as PMID links should serialize as extlinks
27829 !! options
27830 parsoid=html2wt
27831 !! html/parsoid
27832 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink">New PMID</a>
27833 !! wikitext
27834 [//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract New PMID]
27835 !! end
27836
27837 !! test
27838 WTS of autolinks with trailing/surrounding context
27839 !! options
27840 parsoid=html2wt
27841 !! html/parsoid
27842 <p><a href="http://cscott.net">http://cscott.net</a><b>foo</b></p>
27843 <p><a href="http://cscott.net">http://cscott.net</a><b data-parsoid='{"stx":"html"}'>foo</b></p>
27844 <p><b><a href="http://cscott.net">http://cscott.net</a></b></p>
27845 <p><b><a href="http://cscott.net">http://cscott.net</a> </b></p>
27846 <p><b><a href="http://cscott.net">http://cscott.net</a>x</b></p>
27847 <p><a href="http://cscott.net">http://cscott.net</a>x</p>
27848 !! wikitext
27849 http://cscott.net'''foo'''
27850
27851 http://cscott.net<b>foo</b>
27852
27853 '''http://cscott.net'''
27854
27855 '''http://cscott.net '''
27856
27857 '''http://cscott.net<nowiki/>x'''
27858
27859 http://cscott.net<nowiki/>x
27860 !! end
27861
27862 !! test
27863 WTS of autolinks with nowikis (round-trip)
27864 !! wikitext
27865 x<nowiki/>http://cscott.net<nowiki/>x
27866 !! html/parsoid
27867 <p>x<a rel="mw:ExtLink" href="http://cscott.net">http://cscott.net</a>x</p>
27868 !! end
27869
27870 # this is the "easy" test because it leaves in place all the
27871 # data-parsoid information indicating this is an autolink
27872 !! test
27873 WTS of autolinks with escapes (editing)
27874 !! options
27875 parsoid={
27876 "modes": ["wt2wt"],
27877 "changes": [
27878 [ "span", "remove" ]
27879 ]
27880 }
27881 !! wikitext
27882 x<nowiki/>http://cscott.net<nowiki/>x
27883 !! wikitext/edited
27884 x<nowiki/>http://cscott.net<nowiki/>x
27885 !! end
27886
27887 !! test
27888 WTS of edited autolink-like text (T103364)
27889 !! options
27890 parsoid={
27891 "modes": ["wt2wt"],
27892 "changes": [
27893 [ "span[typeof]", "removeAttr", "typeof" ]
27894 ]
27895 }
27896 !! wikitext
27897 Not a link: <nowiki>http://example.com</nowiki>.
27898 !! wikitext/edited
27899 Not a link: <span><nowiki>http://example.com</nowiki></span>.
27900 !! end
27901
27902 !! test
27903 WTS of newly-authored autolink-like text (T103364)
27904 !! options
27905 parsoid=html2wt
27906 !! html/parsoid
27907 <p>http://example.com is not a link.</p>
27908 !! wikitext
27909 <nowiki>http://example.com</nowiki> is not a link.
27910 !! end
27911
27912 !! test
27913 WTS of autolink-like text after an autolink (T108563)
27914 !! options
27915 parsoid=html2wt
27916 !! html/parsoid
27917 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a> http://example.com is not a link.</p>
27918 !! wikitext
27919 http://example.com <nowiki>http://example.com</nowiki> is not a link.
27920 !! end
27921
27922 !! test
27923 Magic links inside links (not autolinked)
27924 !! wikitext
27925 [[Foo|http://example.com]]
27926 [[Foo|RFC 1234]]
27927 [[Foo|PMID 1234]]
27928 [[Foo|ISBN 123456789x]]
27929
27930 [http://foo.com http://example.com]
27931 [http://foo.com RFC 1234]
27932 [http://foo.com PMID 1234]
27933 [http://foo.com ISBN 123456789x]
27934 !! html+tidy
27935 <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>
27936 <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>
27937 !! html/parsoid
27938 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">http://example.com</a>
27939 <a rel="mw:WikiLink" href="./Foo" title="Foo">RFC 1234</a>
27940 <a rel="mw:WikiLink" href="./Foo" title="Foo">PMID 1234</a>
27941 <a rel="mw:WikiLink" href="./Foo" title="Foo">ISBN 123456789x</a></p>
27942
27943 <p><a rel="mw:ExtLink" href="http://foo.com">http://example.com</a>
27944 <a rel="mw:ExtLink" href="http://foo.com">RFC 1234</a>
27945 <a rel="mw:ExtLink" href="http://foo.com">PMID 1234</a>
27946 <a rel="mw:ExtLink" href="http://foo.com">ISBN 123456789x</a></p>
27947 !! end
27948
27949 !! test
27950 Magic links inside image captions (autolinked)
27951 !! wikitext
27952 [[File:Foobar.jpg|thumb|http://example.com]]
27953 [[File:Foobar.jpg|thumb|RFC 1234]]
27954 [[File:Foobar.jpg|thumb|PMID 1234]]
27955 [[File:Foobar.jpg|thumb|ISBN 123456789x]]
27956 !! html+tidy
27957 <div class="thumb tright">
27958 <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>
27959 <div class="thumbcaption">
27960 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
27961 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></div>
27962 </div>
27963 </div>
27964 <div class="thumb tright">
27965 <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>
27966 <div class="thumbcaption">
27967 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
27968 <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a></div>
27969 </div>
27970 </div>
27971 <div class="thumb tright">
27972 <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>
27973 <div class="thumbcaption">
27974 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
27975 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a></div>
27976 </div>
27977 </div>
27978 <div class="thumb tright">
27979 <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>
27980 <div class="thumbcaption">
27981 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
27982 <a href="/wiki/Special:BookSources/123456789X" class="internal mw-magiclink-isbn">ISBN 123456789x</a></div>
27983 </div>
27984 </div>
27985 !! html/parsoid
27986 <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>
27987 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption><a href="//tools.ietf.org/html/rfc1234" rel="mw:ExtLink">RFC 1234</a></figcaption></figure>
27988 <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>
27989 <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>
27990 !! end
27991
27992 !! test
27993 WTS of magic word text (T109371)
27994 !! options
27995 parsoid=html2wt
27996 !! html/parsoid
27997 <p>RFC 1234</p>
27998 <p><a href="http://foo.com" rel="mw:ExtLink">RFC 1234</a></p>
27999 <p><a href="./Foo" rel="mw:WikiLink">RFC 1234</a></p>
28000 !! wikitext
28001 <nowiki>RFC 1234</nowiki>
28002
28003 [http://foo.com RFC 1234]
28004
28005 [[Foo|RFC 1234]]
28006 !! end
28007
28008 !! test
28009 Edited Redirect link should emit a non-piped wikitext link
28010 !! options
28011 parsoid=html2wt
28012 !! html/parsoid
28013 <link rel="mw:PageProp/redirect" href="Bar" data-parsoid='{"a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>
28014 !! wikitext
28015 #REDIRECT [[Bar]]
28016 !! end
28017
28018 !! test
28019 T75121: Infer extension name from typeOf if data-mw is not present
28020 !! options
28021 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
28022 !! html/parsoid
28023 <div typeOf="mw:Extension/foo"></div>
28024 !! wikitext
28025 <foo />
28026 !! end
28027
28028 # Note that the <p> wrapping isn't present in PHP parser output
28029 # The important thing for this test is that P-wrapping doesn't
28030 # interfere with the <nowiki> protection for leading - in <td>
28031 # (which isn't necessary for <th>).
28032 !! test
28033 T88318: p-wrapped dash in table.
28034 !! options
28035 parsoid=html2wt,wt2wt
28036 !! html/parsoid
28037 <table><tbody>
28038 <tr><th><p>-</p></th><th><p>- </p></th></tr>
28039 <tr><td><p>-</p></td><td><p>- </p></td></tr>
28040 <tr><td><small>-</small></td><td><br/><p>-</p></td><td><br/>-</td></tr>
28041 </tbody></table>
28042 !! wikitext
28043 {|
28044 !-
28045 !-
28046 |-
28047 |<nowiki>-</nowiki>
28048 |<nowiki>- </nowiki>
28049 |-
28050 |<small>-</small>
28051 |<br>
28052 -
28053 |<br>
28054 -
28055 |}
28056 !! html/php+tidy
28057 <table>
28058 <tr>
28059 <th>-</th>
28060 <th>-</th>
28061 </tr>
28062 <tr>
28063 <td>-</td>
28064 <td>-</td>
28065 </tr>
28066 <tr>
28067 <td><small>-</small></td>
28068 <td><br />
28069 <p>-</p>
28070 </td>
28071 <td><br />
28072 <p>-</p>
28073 </td>
28074 </tr>
28075 </table>
28076 !! end
28077
28078 !! test
28079 T149209: WTS: Handle newlines in table cells properly
28080 !! options
28081 parsoid=html2wt
28082 !! html/parsoid
28083 <table>
28084 <tbody>
28085 <tr><td>a
28086 b
28087 </td><td data-parsoid='{"stx_v":"row"}'>c</td></tr>
28088 <tr><td><p>x</p>
28089 </td><td data-parsoid='{"stx_v":"row", "startTagSrc": "{{!}}{{!}}"}'>y</td></tr>
28090 </tbody></table>
28091 <table>
28092 <tbody>
28093 <tr><th>a
28094 b
28095 </th><th data-parsoid='{"stx_v":"row"}'>c</th></tr>
28096 <tr><th><p>x</h>
28097 </th><th data-parsoid='{"stx_v":"row"}'>y</th></tr>
28098 </tbody></table>
28099 !! wikitext
28100 {|
28101 |a
28102 b
28103 |c
28104 |-
28105 |x
28106 {{!}}y
28107 |}
28108 {|
28109 !a
28110 b
28111 !c
28112 |-
28113 !x
28114 !y
28115 |}
28116 !! end
28117
28118 !! test
28119 T149209: Selser: Handle newlines in table cells properly
28120 !! options
28121 parsoid={
28122 "modes": ["selser"],
28123 "changes": [
28124 [ "#h1", "html", "a\nb\n" ],
28125 [ "#h2", "html", "a\nb\n" ],
28126 [ "#c1", "html", "a\nb\n" ],
28127 [ "#c2", "html", "<p>a</p>" ],
28128 [ "#c3", "html", "<p>a</p>" ],
28129 [ "#c4", "html", "edit-me<p>a</p>" ]
28130 ]
28131 }
28132 !! wikitext
28133 {|
28134 ! id="h1" |edit-me!!1
28135 |-
28136 ! id="h2" |edit-me||2
28137 |-
28138 | id="c1" |edit-me||3
28139 |-
28140 | id="c2" |edit-me||4
28141 |-
28142 | id="c3" |edit-me||p||q||r
28143 |-
28144 | id="c4" |edit-me||p||q||r
28145 |}
28146 !! wikitext/edited
28147 {|
28148 ! id="h1" |a
28149 b
28150 !1
28151 |-
28152 ! id="h2" |a
28153 b
28154 !2
28155 |-
28156 | id="c1" |a
28157 b
28158 |3
28159 |-
28160 | id="c2" |a
28161 |4
28162 |-
28163 | id="c3" |a
28164 |p||q||r
28165 |-
28166 | id="c4" |edit-me
28167 a
28168 |p||q||r
28169 |}
28170 !! end
28171
28172 !! test
28173 HTML id attribute with Parsoid-like element ids should not be serialized to wikitext
28174 !! options
28175 parsoid=html2wt
28176 !! html/parsoid
28177 <table id='mwAb'>
28178 <td id='mwAc'>foo</td>
28179 <td id='serialize-this'>bar</td>
28180 </table>
28181 !! wikitext
28182 {|
28183 |foo
28184 | id="serialize-this" |bar
28185 |}
28186 !! end
28187
28188 !! test
28189 Parsoid-like element ids should not be serialized to wikitext unless shadowed
28190 !! options
28191 parsoid=html2wt
28192 !! html/parsoid
28193 <div id="mwAQ" data-parsoid='{"stx":"html","a":{"id":"mwAQ"},"sa":{"id":"hello"}}'>ok</div>
28194 !! wikitext
28195 <div id="hello">ok</div>
28196 !! end
28197
28198 !! test
28199 WTS change modes
28200 !! options
28201 parsoid={
28202 "modes": ["wt2wt"],
28203 "changes": [
28204 [ "#xyz", "before", "<b>before</b> stuff " ],
28205 [ "#xyz", "after", " stuff <i>after</i>" ],
28206 [ "#xyz", "html", "x <b>y</b> z" ]
28207 ]
28208 }
28209 !! wikitext
28210 <span id="xyz">hello</span>
28211 !! wikitext/edited
28212 '''before''' stuff <span id="xyz">x '''y''' z</span> stuff ''after''
28213 !! end
28214
28215 !! test
28216 Never serialize a-tag as html, regardless of what data-parsoid has to say
28217 !! options
28218 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
28219 !! html/parsoid
28220 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"html"}'>Foo</a>
28221 !! wikitext
28222 [[Foo]]
28223 !! end
28224
28225 ## SSS FIXME: This is broken output nevertheless.
28226 ## What might be a reasonable non-broken output for this?
28227 ## This is an edge case unlikely to be seen in production
28228 ## that I am not wasting more time on this right now.
28229 !! test
28230 Never serialize a-tag as html, no matter what attributes it has
28231 !! options
28232 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
28233 !! html/parsoid
28234 <a bad='true' href='http://boo.org'><img src='http://boohoo.org' /></a>
28235 !! wikitext
28236 [http://boo.org http://boohoo.org]
28237 !! end
28238
28239 # Misnested is an indication that selser can reuse the source but these have
28240 # shown to sneak through on occasion. See T101768.
28241 # The original wikitext here is: [http://test.com [[one]] two three]
28242 !! test
28243 Strip span tags added to mark misnested links
28244 !! options
28245 parsoid=html2wt
28246 !! html/parsoid
28247 <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>
28248 !! wikitext
28249 [http://test.com][[one]] two three
28250 !! end
28251
28252 !! test
28253 Catch regression when unpacking misnested links
28254 !! options
28255 parsoid=wt2html
28256 !! wikitext
28257 {{echo|hi}}[http://example.com [[ho]]]
28258 !! html/parsoid
28259 <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>
28260 !! end
28261
28262 !! test
28263 Use data-parsoid.firstWikitextNode to compute newline constraints for template content
28264 !! options
28265 parsoid=html2wt
28266 !! html/parsoid
28267 <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|}"]}'>
28268 <tbody><tr><td>d
28269 </td></tr>
28270 </tbody></table>
28271 !! wikitext
28272 {{echo|a}}
28273 {|{{echo|c
28274 {{!}}d
28275 }}
28276 |}
28277 !! end
28278
28279 ## This test verifies the presence and computation of this attribute indirectly
28280 ## by making an edit and ensuring that the serialization is correct (which it would be
28281 ## only if firstWikitextNode is properly set).
28282 !! test
28283 data-parsoid.firstWikitextNode should be computed properly in the presence of fostered content
28284 !! options
28285 parsoid= {
28286 "modes": ["wt2wt"],
28287 "changes": [
28288 [ "div#x", "remove" ],
28289 [ "div", "before", "<div>new</div>" ]
28290 ]
28291 }
28292 !! wikitext
28293 <div id="x">foo</div>
28294 {|
28295 {{echo|<div>boo</div>
28296 {{!}}b}}
28297 |c
28298 |}
28299 !! wikitext/edited
28300
28301 <div>new</div>
28302 {|
28303 {{echo|<div>boo</div>
28304 {{!}}b}}
28305 |c
28306 |}
28307 !! end
28308
28309 # --------------------------------------------
28310 # Tests spec'ing wikitext serialization norms |
28311 # --------------------------------------------
28312
28313 !! test
28314 Serialize multi-line indent-pre starting with wikitext syntax
28315 !! options
28316 parsoid=html2wt
28317 !! html/parsoid
28318 <pre>* 1
28319 ** 2
28320 * 3</pre>
28321 !! wikitext
28322 * 1
28323 ** 2
28324 * 3
28325 !! end
28326
28327 !! test
28328 1. Categories should always be serialized on their own line
28329 !! options
28330 parsoid=html2wt
28331 !! html/parsoid
28332 foo<link rel="mw:PageProp/Category" href="./Category:Foo">bar
28333 !! wikitext
28334 foo
28335 [[Category:Foo]]
28336 bar
28337 !! end
28338
28339 !! test
28340 2. Categories that are part of templates should not introduce a line break
28341 !! wikitext
28342 foo {{echo|<span>bar</span> [[Category:baz]]}} bar
28343 !! html/parsoid
28344 <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>
28345 !! end
28346
28347 # Careful while editing these next 2 tests. There are \u200f characters
28348 # before and after the <link> tags in the HTML and following some
28349 # of the categories in wikitext
28350 # Do not remove these characters in edits.
28351 #
28352 # As part of the serialization, these bidi characters will get stripped.
28353 !! test
28354 RTL (\u200f) and LTR (\u200e) markers around category tags should be stripped
28355 !! options
28356 parsoid={
28357 "modes": ["html2wt"],
28358 "scrubWikitext": true
28359 }
28360 !! html/parsoid
28361 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏
28362 ‏<link rel="mw:PageProp/Category" href="./קטגוריה:_שיטות_משפט" />‏</p>
28363 !! wikitext
28364 [[קטגוריה:טקסים]]
28365 [[קטגוריה: שיטות משפט]]
28366 !! end
28367
28368 !! test
28369 RTL (\u200f) and LTR (\u200e) markers should not be stripped if followed by a text node
28370 !! options
28371 parsoid={
28372 "modes": ["html2wt"],
28373 "scrubWikitext": true
28374 }
28375 !! html/parsoid
28376 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏y</p>
28377 !! wikitext
28378 [[קטגוריה:טקסים]]
28379 ‏y
28380 !! end
28381
28382 !! test
28383 Lists: Add space after bullets
28384 !! options
28385 parsoid=html2wt
28386 !! html/parsoid
28387 <ul>
28388 <li>foo</li>
28389 <li> bar</li>
28390 <li><span> baz</span></li>
28391 </ul>
28392 !! wikitext
28393 * foo
28394 * bar
28395 * <span> baz</span>
28396 !! end
28397
28398 !! test
28399 1. Headings: Add space before/after == (T53744)
28400 !! options
28401 parsoid=html2wt
28402 !! html/parsoid
28403 <h2>foo</h2>
28404 <h2> bar</h2>
28405 <h2>baz </h2>
28406 <h2><span> baz</span></h2>
28407 !! wikitext
28408 == foo ==
28409
28410 == bar ==
28411
28412 == baz ==
28413
28414 == <span> baz</span> ==
28415 !! end
28416
28417 !! test
28418 2. Headings: Add space before/after == even after hoisted content
28419 !! options
28420 parsoid={
28421 "modes": ["html2wt"],
28422 "scrubWikitext": true
28423 }
28424 !! html/parsoid
28425 <h2> <link href="./Category:A2" rel="mw:PageProp/Category" />ok</h2>
28426 !! wikitext
28427 [[Category:A2]]
28428
28429 == ok ==
28430 !! end
28431
28432 !! test
28433 1. Headings: suppress newly created empty headings
28434 !! options
28435 parsoid={
28436 "modes": ["html2wt"],
28437 "scrubWikitext": true
28438 }
28439 !! html/parsoid
28440 <h2></h2>
28441 !! wikitext
28442 !! end
28443
28444 !! test
28445 2. Headings: don't suppress empty headings if scrubWikitext is false
28446 !! options
28447 parsoid=html2wt
28448 !! html/parsoid
28449 <h2></h2>
28450 !! wikitext
28451 ==<nowiki/>==
28452 !! end
28453
28454 !! test
28455 3. Headings: suppress empty headings on edits
28456 !! options
28457 parsoid={
28458 "modes": ["selser"],
28459 "scrubWikitext": true,
28460 "changes": [
28461 [ "#x", "remove"]
28462 ]
28463 }
28464 !! wikitext
28465 ==<span id="x">foo</span>==
28466 !! wikitext/edited
28467 !! end
28468
28469 !! test
28470 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = true)
28471 !! options
28472 parsoid={
28473 "modes": ["html2wt"],
28474 "scrubWikitext": true
28475 }
28476 !! html/parsoid
28477 <h2>foo<br/>bar</h2>
28478 <h2>foo <span><br/>bar</span> baz</h2>
28479 !! wikitext
28480 == foo bar ==
28481
28482 == foo <span> bar</span> baz ==
28483 !! end
28484
28485 !! test
28486 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = false)
28487 !! options
28488 parsoid={
28489 "modes": ["html2wt"],
28490 "scrubWikitext": false
28491 }
28492 !! html/parsoid
28493 <h2>foo<br/>bar</h2>
28494 !! wikitext
28495 == foo<br> bar ==
28496 !! end
28497
28498 !! test
28499 1. WT Quote Tags: suppress newly created empty style tags
28500 !! options
28501 parsoid={
28502 "modes": ["html2wt"],
28503 "scrubWikitext": true
28504 }
28505 !! html/parsoid
28506 <i></i><b></b>
28507 !! wikitext
28508 !! end
28509
28510 !! test
28511 2. WT Quote Tags: don't suppress empty style tags if scrubWikitext is false
28512 !! options
28513 parsoid=html2wt
28514 !! html/parsoid
28515 <i></i><b></b>
28516 !! wikitext
28517 ''<nowiki/>'''''<nowiki/>'''
28518 !! end
28519
28520 !! test
28521 3. WT Quote Tags: suppress empty style tags on edits
28522 !! options
28523 parsoid={
28524 "modes": ["selser"],
28525 "scrubWikitext": true,
28526 "changes": [
28527 [ "#x", "remove"]
28528 ]
28529 }
28530 !! wikitext
28531 '''<span id="x">foo</span>'''
28532 !! wikitext/edited
28533 !! end
28534
28535 !! test
28536 1. Anchors: suppress newly created empty anchors
28537 !! options
28538 parsoid={
28539 "modes": ["html2wt"],
28540 "scrubWikitext": true
28541 }
28542 !! html/parsoid
28543 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
28544 !! wikitext
28545 !! end
28546
28547 !! test
28548 2. Anchors: don't suppress empty anchors if scrubWikitext is false
28549 !! options
28550 parsoid={
28551 "modes": ["html2wt"],
28552 "scrubWikitext": false
28553 }
28554 !! html/parsoid
28555 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
28556 !! wikitext
28557 [[Test|<nowiki/>]]
28558 !! end
28559
28560 !! test
28561 3. Anchors: suppress empty anchors on edits
28562 !! options
28563 parsoid={
28564 "modes": ["selser"],
28565 "scrubWikitext": true,
28566 "changes": [
28567 [ "#x", "remove"]
28568 ]
28569 }
28570 !! wikitext
28571 [[Test|<span id="x">foo</span>]]
28572 !! wikitext/edited
28573 !! end
28574
28575 !! test
28576 3a. Anchors: do not suppress numbered extlinks
28577 !! options
28578 parsoid={
28579 "modes": ["wt2wt"],
28580 "scrubWikitext": true
28581 }
28582 !! wikitext
28583 [http://foo.com]
28584 !! html/parsoid
28585 <a rel="mw:ExtLink" href="http://foo.com"></a>
28586 !! end
28587
28588 !! test
28589 3b. Anchors: do not suppress numbered extlinks
28590 !! options
28591 parsoid={
28592 "modes": ["wt2wt"],
28593 "scrubWikitext": true,
28594 "changes": [
28595 [ "#x", "remove"]
28596 ]
28597 }
28598 !! wikitext
28599 [http://foo.com <span id="x">foo</span>]
28600 !! wikitext/edited
28601 [http://foo.com]
28602 !! end
28603
28604 !!test
28605 Normalizations should be restricted to edited content
28606 !!options
28607 parsoid={
28608 "modes": ["selser"],
28609 "scrubWikitext": true,
28610 "changes": [
28611 [ "h1", "before", "<i></i>"]
28612 ]
28613 }
28614 !!wikitext
28615 a
28616 = =
28617 b
28618 !!wikitext/edited
28619 a
28620 = =
28621 b
28622 !!end
28623
28624 !! test
28625 1. Multiple normalizations (html2wt)
28626 !! options
28627 parsoid={
28628 "modes": ["html2wt"],
28629 "scrubWikitext": true
28630 }
28631 !! html
28632 <h2><i></i></h2>
28633 <p><a href='Foo' rel='mw:WikiLink'>foo<i></i>
28634 </a><b><i></i></b>x</p>
28635 !! wikitext
28636
28637 [[foo]]
28638 x
28639
28640 !! end
28641
28642 !! test
28643 2. Multiple normalizations (selser)
28644 !! options
28645 parsoid={
28646 "modes": ["selser"],
28647 "scrubWikitext": true,
28648 "changes": [
28649 [ "#x", "after", "<h1><i></i></h1>\n<p> x<b></b></p>"]
28650 ]
28651 }
28652 !! wikitext
28653 <span id="x">foo</span>
28654 !! wikitext/edited
28655 <span id="x">foo</span>
28656
28657 x
28658 !! end
28659
28660 !! test
28661 1. Indent Pre Nowiki: suppress whitespace at the start of new paragraph
28662 !! options
28663 parsoid={
28664 "modes": ["html2wt"],
28665 "scrubWikitext": true
28666 }
28667 !! html/parsoid
28668 <p> hi</p>
28669 <p> hello</p>
28670 !! wikitext
28671 hi
28672
28673 hello
28674 !! end
28675
28676 !! test
28677 2. Indent Pre Nowiki: don't suppress whitespace at the start of new paragraph if scrubWikitext is false
28678 !! options
28679 parsoid=html2wt
28680 !! html/parsoid
28681 <p> hi</p>
28682 <p> hello</p>
28683 !! wikitext
28684 <nowiki> </nowiki>hi
28685
28686 <nowiki> </nowiki> hello
28687 !! end
28688
28689 !! test
28690 3. Indent Pre Nowiki: suppress whitespace after newlines in new paragraph or table cell
28691 !! options
28692 parsoid={
28693 "modes": ["html2wt"],
28694 "scrubWikitext": true
28695 }
28696 !! html/parsoid
28697 <p>Foo
28698 bar
28699 baz</p>
28700
28701 <table><tr><td>Foo
28702 bar
28703 baz bang</td></tr></table>
28704
28705 <p><!--boo--> foo
28706 bar</p>
28707
28708 <p> foo
28709 bar<span>boo</span></p>
28710 !! wikitext
28711 Foo
28712 bar
28713 baz
28714
28715 {|
28716 |Foo
28717 bar
28718 baz bang
28719 |}
28720
28721 <!--boo-->foo
28722 bar
28723
28724 foo
28725 bar<span>boo</span>
28726 !! end
28727
28728 !! test
28729 4. Indent Pre Nowiki: suppress leading whitespace in edited paragraphs
28730 !! options
28731 parsoid={
28732 "modes": ["selser"],
28733 "scrubWikitext": true,
28734 "changes": [
28735 [ "p", "html", " a\n b" ]
28736 ]
28737 }
28738 !! wikitext
28739 xyz
28740 !! wikitext/edited
28741 a
28742 b
28743 !! end
28744
28745 !! test
28746 1. New links that end in spaces
28747 !! options
28748 parsoid={
28749 "modes": ["html2wt"],
28750 "scrubWikitext": false
28751 }
28752 !! html/parsoid
28753 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
28754 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
28755 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
28756 !! wikitext
28757 [[Berlin ]]<nowiki/>is the capital of Germany.
28758
28759 [[Foo ]]'''bar'''
28760
28761 [[Boston ]] is a city.
28762 !! end
28763
28764 !! test
28765 2. New links that end in spaces
28766 !! options
28767 parsoid={
28768 "modes": ["html2wt"],
28769 "scrubWikitext": true
28770 }
28771 !! html/parsoid
28772 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
28773 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
28774 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
28775 !! wikitext
28776 [[Berlin]] is the capital of Germany.
28777
28778 [[Foo]] '''bar'''
28779
28780 [[Boston]] is a city.
28781 !! end
28782
28783 !! test
28784 1. Table cells with escapable prefixes
28785 !! options
28786 parsoid={
28787 "modes": ["html2wt"],
28788 "scrubWikitext": false
28789 }
28790 !! html
28791 <table>
28792 <tr><td>a</td></tr>
28793 <tr><td>-</td></tr>
28794 <tr><td>+</td></tr>
28795 </table>
28796 !! wikitext
28797 {|
28798 |a
28799 |-
28800 |<nowiki>-</nowiki>
28801 |-
28802 |<nowiki>+</nowiki>
28803 |}
28804 !! end
28805
28806 !! test
28807 2. Table cells with escapable prefixes
28808 !! options
28809 parsoid={
28810 "modes": ["html2wt"],
28811 "scrubWikitext": true
28812 }
28813 !! html
28814 <table>
28815 <tr><td>a</td></tr>
28816 <tr><td>-</td></tr>
28817 <tr><td>+</td></tr>
28818 </table>
28819 !! wikitext
28820 {|
28821 |a
28822 |-
28823 | -
28824 |-
28825 | +
28826 |}
28827 !! end
28828
28829 !! test
28830 3a. Table cells with escapable prefixes after edits
28831 !! options
28832 parsoid={
28833 "modes": ["selser"],
28834 "scrubWikitext": true,
28835 "changes": [
28836 [ "table tbody tr:first-child td:first-child", "remove"]
28837 ]
28838 }
28839 !! wikitext
28840 {|
28841 |a||-
28842 |}
28843 !! wikitext/edited
28844 {|
28845 | -
28846 |}
28847 !! end
28848
28849 !! test
28850 3b. Table cells with escapable prefixes after edits
28851 !! options
28852 parsoid={
28853 "modes": ["selser"],
28854 "scrubWikitext": true,
28855 "changes": [
28856 [ "table tbody tr:first-child td:first-child", "html", "-" ],
28857 [ "#x", "remove" ]
28858 ]
28859 }
28860 !! wikitext
28861 {|
28862 |pqr
28863 |<span id="x">foo</span>+
28864 |}
28865 !! wikitext/edited
28866 {|
28867 | -
28868 | +
28869 |}
28870 !! end
28871
28872 # FIXME: This test will fail because
28873 # normalization doesn't realize that the id attribute
28874 # will eliminate the escapable scenario
28875 !! test
28876 4a. Table cells without escapable prefixes after edits
28877 !! options
28878 parsoid={
28879 "modes": ["selser"],
28880 "scrubWikitext": true,
28881 "changes": [
28882 [ "#x", "html", "-" ]
28883 ]
28884 }
28885 !! wikitext
28886 {|
28887 | id="x" |abcd
28888 |}
28889 !! wikitext/edited
28890 {|
28891 | id="x" |-
28892 |}
28893 !! end
28894
28895 ## This tests normalizer's ability to discriminate between
28896 ## cells having identical content.
28897 !! test
28898 4b. Table cells without escapable prefixes after edits
28899 !! options
28900 parsoid={
28901 "modes": ["selser"],
28902 "scrubWikitext": true,
28903 "changes": [
28904 [ "td", "html", "-" ]
28905 ]
28906 }
28907 !! wikitext
28908 {|
28909 |a||b
28910 |}
28911 !! wikitext/edited
28912 {|
28913 | -||-
28914 |}
28915 !! end
28916
28917 ## This tests normalizer's ability to not be tripped by
28918 ## comments (and whitespace)
28919 !! test
28920 4c. Table cells without escapable prefixes after edits
28921 !! options
28922 parsoid={
28923 "modes": ["selser"],
28924 "scrubWikitext": true,
28925 "changes": [
28926 [ "table tbody tr td:first-child", "remove" ]
28927 ]
28928 }
28929 !! wikitext
28930 {|
28931 |-
28932 <!--foo--> |a||-
28933 |}
28934 !! wikitext/edited
28935 {|
28936 |-
28937 <!--foo--> | -
28938 |}
28939 !! end
28940
28941 ## This tests normalizer's ability to handle HTML cells
28942 !! test
28943 4d. Table cells without escapable prefixes after edits
28944 !! options
28945 parsoid={
28946 "modes": ["selser"],
28947 "scrubWikitext": true,
28948 "changes": [
28949 [ "td", "html", "-" ]
28950 ]
28951 }
28952 !! wikitext
28953 <table>
28954 <tr><td>a</td></tr>
28955 </table>
28956 !! wikitext/edited
28957 <table>
28958 <tr><td>-</td></tr>
28959 </table>
28960 !! end
28961
28962 ## T111151 Remove font elements without attributes
28963 !! test
28964 5a. font tags without attributes should be dropped in scrubWikitext mode
28965 !! options
28966 parsoid={
28967 "modes": ["html2wt"],
28968 "scrubWikitext": true
28969 }
28970 !! html
28971 <font>foo</font>
28972 <font><font>bar</font></font>
28973 <font class="x">boo</font>
28974 !! wikitext
28975 foo
28976 bar
28977 <font class="x">boo</font>
28978 !! end
28979
28980 !! test
28981 5b. font tags should not be dropped without scrubWikitext being enabled
28982 !! options
28983 parsoid={
28984 "modes": ["html2wt"],
28985 "scrubWikitext": false
28986 }
28987 !! html
28988 <font>foo</font>
28989 !! wikitext
28990 <font>foo</font>
28991 !! end
28992
28993 !! test
28994 Escape nowiki DOM elements
28995 !! options
28996 parsoid=html2wt
28997 !! html/parsoid
28998 <nowiki><i>foo</i></nowiki>
28999 !! wikitext
29000 &lt;nowiki&gt;''foo''&lt;/nowiki&gt;
29001 !! end
29002
29003 # This is meant to be an interim fix while we go about figuring out
29004 # how to not introduce these trailing <nowiki/>s in the first place.
29005 !! test
29006 T115717: Strip trailing <nowiki/>s (without affecting valid uses)
29007 !! options
29008 parsoid=html2wt
29009 !! html/parsoid
29010 <p>x<meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/>
29011 y</p>
29012 <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>
29013 <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>
29014 !! wikitext
29015 x
29016 y
29017
29018 {{echo|
29019 1 = <nowiki/>}}
29020
29021 {{echo|
29022 1 = <nowiki/>
29023 }}
29024 !! end
29025
29026 # ---------------------------------------------------
29027 # End of tests spec'ing wikitext serialization norms |
29028 # ---------------------------------------------------
29029
29030 # T104032
29031 !! test
29032 Bare inline nodes not wrapped inside p-tags should be treated as p-wrapped
29033 !! options
29034 parsoid=html2wt
29035 !! html/parsoid
29036 a<p>b</p>
29037 <b>c</b><p>d</p>
29038 <table><tr>
29039 <td>a<p>b</p></td>
29040 <td><b>c</b><p>d</p></td>
29041 </tr></table>
29042 !! wikitext
29043 a
29044
29045 b
29046
29047 '''c'''
29048
29049 d
29050 {|
29051 |a
29052 b
29053 |'''c'''
29054 d
29055 |}
29056 !! end
29057
29058 !! test
29059 Anchor without href scenarios
29060 !! options
29061 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
29062 !! html/parsoid
29063 <a class="bc"></a>
29064 <a class="no">dice</a>
29065 <a name="foo"></a>
29066 !! wikitext
29067
29068 dice
29069 <span name="foo"></span>
29070 !! end
29071
29072 !! test
29073 New transclusion added after a list should be serialized after the list
29074 !! options
29075 parsoid=html2wt
29076 !! html/parsoid
29077 <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>
29078 !! wikitext
29079 * a
29080 {{echo|foo}}
29081 !! end
29082
29083 # -----------------------------------------------------------------
29084 # End of section for Parsoid-only html2wt tests for serialization
29085 # of new content
29086 # -----------------------------------------------------------------
29087
29088 # -----------------------------------------------------------------
29089 # The following section of tests are primarily to spec behavior of
29090 # the selective serializer. All these tests have manual selser
29091 # changes. The automated selser changes for all tests handle the
29092 # wide variation of changes, but these tests here capture specs
29093 # deterministically.
29094 # ----------------------------------------------------------------
29095
29096 ## T90517
29097 !! test
29098 Selser: New comments should not be lost
29099 !! options
29100 parsoid={
29101 "modes": ["selser"],
29102 "changes": [
29103 [ "#a", "after", "<!--c1-->" ],
29104 [ "#b", "before", "<!--c2-->" ]
29105 ]
29106 }
29107 !! wikitext
29108 <span id="a">a</span>
29109
29110 <span id="b">b</span>
29111 !! wikitext/edited
29112 <span id="a">a</span><!--c1-->
29113
29114 <!--c2--><span id="b">b</span>
29115 !! end
29116
29117 ## T89383
29118 !! test
29119 Selser: Check for validity of DSR before using it
29120 !! options
29121 parsoid={
29122 "modes": ["selser"],
29123 "changes": [
29124 [ "#a", "before", "<meta property='mw:PageProp/displaytitle' content='foo'>" ]
29125 ]
29126 }
29127 !! wikitext
29128 <span id="a">a</span>
29129 !! wikitext/edited
29130 {{DISPLAYTITLE:foo}}
29131 <span id="a">a</span>
29132 !! end
29133
29134 !! test
29135 1. DOMDiff: Changes to <ref> content should be looked up using id
29136 !! options
29137 parsoid={
29138 "modes": ["selser"],
29139 "changes": [
29140 ["#X", "after", "bar"],
29141 ["#Y", "after", "baz"]
29142 ]
29143 }
29144 !! wikitext
29145 X <ref><span id="X">foo</span></ref>
29146 Y <ref name="a" />
29147 <references>
29148 <ref name="a"><span id="Y">foo</span></ref>
29149 </references>
29150 !! wikitext/edited
29151 X <ref><span id="X">foo</span>bar</ref>
29152 Y <ref name="a" />
29153 <references>
29154 <ref name="a"><span id="Y">foo</span>baz</ref>
29155 </references>
29156 !! end
29157
29158 !! test
29159 2. DOMDiff: Changes to <ref> content should be looked up using id
29160 !! options
29161 parsoid={
29162 "modes": ["selser"],
29163 "changes": [
29164 ["#Z", "after", "bar"]
29165 ]
29166 }
29167 !! wikitext
29168 A <ref>foo bar for a</ref>
29169 B <ref group="X" name="b" />
29170
29171 <references />
29172
29173 <references group="X">
29174 <ref name="b"><span id="Z">foo</span></ref>
29175 </references>
29176 !! wikitext/edited
29177 A <ref>foo bar for a</ref>
29178 B <ref group="X" name="b" />
29179
29180 <references />
29181
29182 <references group="X">
29183 <ref name="b"><span id="Z">foo</span>bar</ref>
29184 </references>
29185 !! end
29186
29187 !! test
29188 DOMDiff: Edits to content nested in elements with templated attributes should not be lost (T139388)
29189 !! options
29190 parsoid={
29191 "modes": ["selser"],
29192 "changes": [
29193 [ "div:first-child", "text", "bar" ]
29194 ]
29195 }
29196 !! wikitext
29197 <div style="{{1x|color:red;}}%">foo</div>
29198 !! wikitext/edited
29199 <div style="{{1x|color:red;}}%">bar</div>
29200 !! end
29201
29202 !! test
29203 Empty LI (T49673)
29204 !! wikitext
29205 * a
29206 *
29207 *
29208 * b
29209 !! html/php+tidy
29210 <ul>
29211 <li>a</li>
29212 <li class="mw-empty-elt"></li>
29213 <li class="mw-empty-elt"></li>
29214 <li>b</li>
29215 </ul>
29216 !! end
29217
29218 !! test
29219 Thumbnail output
29220 !! wikitext
29221 [[File:Thumb.png|thumb]]
29222 !! html/php+tidy
29223 <div class="thumb tright">
29224 <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>
29225 <div class="thumbcaption">
29226 <div class="magnify"><a href="/wiki/File:Thumb.png" class="internal" title="Enlarge"></a></div>
29227 </div>
29228 </div>
29229 </div>
29230 !! end
29231
29232 !! test
29233 unclosed internal link XSS (T137264)
29234 !! wikitext
29235 [[#%3Cscript%3Ealert(1)%3C/script%3E|
29236 !! html/php
29237 <p>[[#&lt;script&gt;alert(1)&lt;/script&gt;|
29238 </p>
29239 !! html/parsoid
29240 <p>[[#%3Cscript%3Ealert(1)%3C/script%3E|</p>
29241 !! end
29242
29243 !! test
29244 Validating that <style> isn't eaten by tidy (T167349)
29245 !! options
29246 # Use $wgRawHtml to inject a <style> tag, since you normally can't in wikitext
29247 wgRawHtml=1
29248 !! wikitext
29249 <div class="foo">
29250 <html><style>.foo::before { content: "<foo>"; }</style></html>
29251 <html><style data-mw-foobar="baz">.foo::after { content: "<bar>"; }</style></html>
29252 </div>
29253 !! html+tidy
29254 <div class="foo">
29255 <style>.foo::before { content: "<foo>"; }</style>
29256 <style data-mw-foobar="baz">.foo::after { content: "<bar>"; }</style>
29257 </div>
29258 !! end
29259
29260 !! test
29261 Decoding of HTML entities in headings and links for IDs and link fragments (T103714)
29262 !! wikitext
29263 == A&B&amp;C&amp;amp;D&amp;amp;amp;E ==
29264 [[#A&B&amp;C&amp;amp;D&amp;amp;amp;E]]
29265 !! html/php
29266 <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>
29267 <p><a href="#A.26B.26C.26D.26amp.3BE">#A&amp;B&amp;C&amp;amp;D&amp;amp;amp;E</a>
29268 </p>
29269 !! end
29270
29271 !! test
29272 Decoding of HTML entities in indicator names for IDs (T104196)
29273 !! options
29274 showindicators
29275 !! wikitext
29276 <indicator name="1&2&amp;3&amp;amp;4&amp;amp;amp;5">Indicator</indicator>
29277 !! html/php
29278 1&2&3&amp;4&amp;amp;5=Indicator
29279
29280 !! end
29281
29282 !! test
29283 HTML5 ids: fallback to legacy
29284 !! config
29285 wgFragmentMode=[ 'html5', 'legacy' ]
29286 !! wikitext
29287 == Foo bar ==
29288
29289 == foo Bar ==
29290
29291 == Тест ==
29292
29293 == Тест ==
29294
29295 == тест ==
29296
29297 == Hey < # " > % : ' ==
29298 [[#Foo bar]] [[#foo Bar]] [[#Тест]] [[#тест]] [[#Hey < # " > % : ']]
29299
29300 {{anchorencode:💩}} <span id="{{anchorencode:💩}}"></span>
29301
29302 <!-- These two links should produce identical HTML -->
29303 [[#啤酒]] [[#%E5%95%A4%E9%85%92]]
29304
29305 !! html/php
29306 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
29307 <ul>
29308 <li class="toclevel-1 tocsection-1"><a href="#Foo_bar"><span class="tocnumber">1</span> <span class="toctext">Foo bar</span></a></li>
29309 <li class="toclevel-1 tocsection-2"><a href="#foo_Bar_2"><span class="tocnumber">2</span> <span class="toctext">foo Bar</span></a></li>
29310 <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>
29311 <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>
29312 <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>
29313 <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>
29314 </ul>
29315 </div>
29316
29317 <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>
29318 <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>
29319 <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>
29320 <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>
29321 <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>
29322 <h2><span id="Hey_.3C_.23_.22_.3E_.25_:_.27"></span><span class="mw-headline" id="Hey_&lt;_#_&quot;_&gt;_%_:_'">Hey &lt; # " &gt;&#160;%&#160;: '</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: Hey &lt; # &quot; &gt; % : '">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
29323 <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>
29324 </p><p>%F0%9F%92%A9 <span id="%F0%9F%92%A9"></span>
29325 </p><p><a href="#%E5%95%A4%E9%85%92">#啤酒</a> <a href="#%E5%95%A4%E9%85%92">#啤酒</a>
29326 </p>
29327 !! end
29328
29329 !! test
29330 HTML5 ids: legacy with a fallback to modern
29331 !! config
29332 wgFragmentMode=[ 'legacy', 'html5' ]
29333 !! wikitext
29334 == Foo bar ==
29335
29336 == foo Bar ==
29337
29338 == Тест ==
29339
29340 == Тест ==
29341
29342 == тест ==
29343
29344 == Hey < # " > % : ' ==
29345 [[#Foo bar]] [[#foo Bar]] [[#Тест]] [[#тест]] [[#Hey < # " > % : ']]
29346
29347 {{anchorencode:💩}} <span id="{{anchorencode:💩}}"></span>
29348
29349 <!-- These two links should produce identical HTML -->
29350 [[#啤酒]] [[#%E5%95%A4%E9%85%92]]
29351
29352 !! html/php
29353 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
29354 <ul>
29355 <li class="toclevel-1 tocsection-1"><a href="#Foo_bar"><span class="tocnumber">1</span> <span class="toctext">Foo bar</span></a></li>
29356 <li class="toclevel-1 tocsection-2"><a href="#foo_Bar_2"><span class="tocnumber">2</span> <span class="toctext">foo Bar</span></a></li>
29357 <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>
29358 <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>
29359 <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>
29360 <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>
29361 </ul>
29362 </div>
29363
29364 <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>
29365 <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>
29366 <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>
29367 <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>
29368 <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>
29369 <h2><span id="Hey_&lt;_#_&quot;_&gt;_%_:_'"></span><span class="mw-headline" id="Hey_.3C_.23_.22_.3E_.25_:_.27">Hey &lt; # " &gt;&#160;%&#160;: '</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: Hey &lt; # &quot; &gt; % : '">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
29370 <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>
29371 </p><p>.F0.9F.92.A9 <span id=".F0.9F.92.A9"></span>
29372 </p><p><a href="#.E5.95.A4.E9.85.92">#啤酒</a> <a href="#.E5.95.A4.E9.85.92">#啤酒</a>
29373 </p>
29374 !! end
29375
29376 !! test
29377 HTML5 ids: no legacy
29378 !! config
29379 wgFragmentMode=[ 'html5' ]
29380 !! wikitext
29381 == Foo bar ==
29382
29383 == foo Bar ==
29384
29385 == Тест ==
29386
29387 == Тест ==
29388
29389 == тест ==
29390
29391 == Hey < # " > % : ' ==
29392 [[#Foo bar]] [[#foo Bar]] [[#Тест]] [[#тест]] [[#Hey < # " > % : ']]
29393
29394 {{anchorencode:💩}} <span id="{{anchorencode:💩}}"></span>
29395
29396 <!-- These two links should produce identical HTML -->
29397 [[#啤酒]] [[#%E5%95%A4%E9%85%92]]
29398
29399 !! html/php
29400 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
29401 <ul>
29402 <li class="toclevel-1 tocsection-1"><a href="#Foo_bar"><span class="tocnumber">1</span> <span class="toctext">Foo bar</span></a></li>
29403 <li class="toclevel-1 tocsection-2"><a href="#foo_Bar_2"><span class="tocnumber">2</span> <span class="toctext">foo Bar</span></a></li>
29404 <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>
29405 <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>
29406 <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>
29407 <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>
29408 </ul>
29409 </div>
29410
29411 <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>
29412 <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>
29413 <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>
29414 <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>
29415 <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>
29416 <h2><span class="mw-headline" id="Hey_&lt;_#_&quot;_&gt;_%_:_'">Hey &lt; # " &gt;&#160;%&#160;: '</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: Hey &lt; # &quot; &gt; % : '">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
29417 <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>
29418 </p><p>%F0%9F%92%A9 <span id="%F0%9F%92%A9"></span>
29419 </p><p><a href="#%E5%95%A4%E9%85%92">#啤酒</a> <a href="#%E5%95%A4%E9%85%92">#啤酒</a>
29420 </p>
29421 !! end