Merge "build: Updating mediawiki/mediawiki-codesniffer to 13.0.0"
[lhc/web/wiklou.git] / tests / parser / parserTests.txt
1 # MediaWiki Parser test cases
2 # Some taken from https://meta.wikimedia.org/wiki/Parser_testing
3 # All (C) their respective authors and released under the GPL
4 #
5 # The syntax should be fairly self-explanatory.
6 #
7 # Currently supported test options:
8 # One of the following three:
9 #
10 # (default) generate HTML output
11 # pst apply pre-save transform
12 # msg apply message transform
13 #
14 # Plus any combination of these:
15 #
16 # cat add category links
17 # (ignored by Parsoid, since it emits <link>s)
18 # ill add inter-language links
19 # (ignored by Parsoid, since it emits <link>s)
20 # subpage enable subpages (disabled by default)
21 # title=[[XXX]] run test using article title XXX
22 # language=XXX set content language to XXX for this test
23 # variant=XXX set the variant of language for this test (eg zh-tw)
24 # disabled do not run test
25 # parsoid parsoid-specific options (not run by PHP parser unless
26 # the test includes an html/php section)
27 # php php-only test (not run by the parsoid parser unless
28 # the test includes an html/parsoid section)
29 # showtitle make the first line the title
30 # showindicators make the first lines the page status indicators
31 # comment run through Linker::formatComment() instead of main parser
32 # local format section links in edit comment text as local links
33 # notoc disable table of contents
34 # thumbsize=NNN set the default thumb size to NNNpx for this test
35 # wrap include the normal wrapper <div class="mw-parser-output"> (since 1.30)
36 #
37 # You can also set the following parser properties via test options:
38 # wgEnableUploads, wgAllowExternalImages, wgMaxTocLevel,
39 # wgLinkHolderBatchSize, wgRawHtml, wgInterwikiMagic,
40 # wgEnableMagicLinks
41 #
42 # For testing purposes, temporary articles can created:
43 # !!article / NAMESPACE:TITLE / !!text / ARTICLE TEXT / !!endarticle
44 # where '/' denotes a newline.
45
46 # This is the standard article assumed to exist.
47 !! article
48 Main Page
49 !! text
50 blah blah
51 !! endarticle
52
53 !!article
54 Foo
55 !!text
56 FOO
57 !!endarticle
58
59 !!article
60 Template:Foo
61 !!text
62 FOO
63 !!endarticle
64
65 !! article
66 Template:Blank
67 !! text
68 !! endarticle
69
70 !! article
71 Template:pipe
72 !! text
73 |
74 !! endarticle
75
76 !! article
77 Template:=
78 !! text
79 <nowiki>=</nowiki>
80 !! endarticle
81
82 !!article
83 MediaWiki:bad image list
84 !!text
85 * [[File:Bad.jpg]] except [[Nasty page]]
86 !!endarticle
87
88 !! article
89 Template:inner list
90 !! text
91 * item 1
92 !! endarticle
93
94 !! article
95 Template:tbl-start
96 !! text
97 {|
98 !! endarticle
99
100 !! article
101 Template:tbl-end
102 !! text
103 |}
104 !! endarticle
105
106 !! article
107 Template:echo
108 !! text
109 {{{1}}}
110 !! endarticle
111
112 // For Serbian; localize Template namespace
113 !! article
114 Шаблон:Echo
115 !! text
116 {{{1}}}
117 !! endarticle
118
119 !! article
120 Template:echo_with_span
121 !! text
122 <span>{{{1}}}</span>
123 !! endarticle
124
125 !! article
126 Template:echo_with_div
127 !! text
128 <div>{{{1}}}</div>
129 !! endarticle
130
131 !! article
132 Template:blank_param
133 !! text
134 {{{1}}}
135 {{{}}}
136 !! endarticle
137
138 !! article
139 Template:table_attribs
140 !! text
141 <noinclude>
142 |</noinclude>style="color:red;"|Foo
143 !! endarticle
144
145 !! article
146 Template:table_attribs_2
147 !! text
148 <noinclude>
149 |</noinclude>style="color:red;"|Foo
150 |Bar||Baz
151 !! endarticle
152
153 !! article
154 Template:table_attribs_3
155 !! text
156 <noinclude>
157 |</noinclude>style{{=}}"background:&#35;f9f9f9;"|Foo
158 !! endarticle
159
160 !! article
161 Template:table_attribs_4
162 !! text
163 | style="background-color:#DC241f;" width="10px" |
164 !! endarticle
165
166 !! article
167 Template:table_attribs_5
168 !! text
169 <noinclude>
170 |</noinclude>style="color:red;"||Bar
171 !! endarticle
172
173 !! article
174 Template:table_attribs_6
175 !! text
176 style="background: <nowiki>
177
178
179 red;</nowiki>" |
180 !! endarticle
181
182 !! article
183 Template:table_attribs_7
184 !! text
185 <noinclude>
186 |</noinclude>style{{=}}"background:&#35;f9f9f9;"|Foo<ref>foo</ref>
187 !! endarticle
188
189 !! article
190 Template:table_header_cells
191 !! text
192 {{table_attribs}}!!style='color:red;'|''Bar''||style='color:brown;'|''Foo'' and Baz
193 !! endarticle
194
195 !! article
196 Template:table_cells
197 !! text
198 {{table_attribs}}||style='color:red;'|''Bar''||style='color:brown;'|''Foo'' and Baz
199 !! endarticle
200
201 !! article
202 Template:PartialTable
203 !! text
204 {|
205 |-
206 !! endarticle
207
208 !! article
209 Template:image_attribs
210 !! text
211 <noinclude>
212 [[File:foobar.jpg|</noinclude>right|Caption text<noinclude>]]</noinclude>
213 !! endarticle
214
215 ## See T48811 for details
216 !! article
217 Template:mixed_attr_content_template
218 !! text
219 style="color:red;" title="T48811"
220 |-
221 |foo
222 !! endarticle
223
224 !! article
225 Template:definition_list
226 !! text
227 one
228 ::two
229 !! endarticle
230
231 !! article
232 A?b
233 !! text
234 Weirdo titles!
235 !! endarticle
236
237 !!article
238 Template:Bullet
239 !!text
240 * Bar
241 !!endarticle
242
243 !!article
244 Template:OpenTable
245 !!text
246 {|
247 !!endarticle
248
249 !!article
250 Template:EmptyLITest
251 !!text
252 *a
253 *
254 *
255 *b
256 !!endarticle
257
258 !!article
259 Template:EmptyTRTest
260 !!text
261 {|
262 |-
263 |-
264 |foo
265 |-
266 |-
267 |bar
268 |}
269 !!endarticle
270
271 !!article
272 Template:EmptyTRWithHTMLAttrTest
273 !!text
274 <table>
275 <tr align="center"></tr>
276 <tr><td>foo</td></tr>
277 <tr align="center"></tr>
278 <tr><td>bar</td></tr>
279 </table>
280 !!endarticle
281
282 !! article
283 Template:CircularRef
284 !! text
285 <ref>{{CircularRef}}</ref>
286 !! endarticle
287
288 !! article
289 Template:With: Colon
290 !! text
291 Template with colon
292 !! endarticle
293
294 ###
295 ### Basic tests
296 ###
297 !! test
298 Blank input
299 !! wikitext
300 !! html
301 !! end
302
303 !! test
304 CircularRef
305 !! wikitext
306 {{CircularRef}}
307 <references />
308 !! html/parsoid
309 <p><span about="#mwt1" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Transclusion mw:Extension/ref" data-parsoid='{"pi":[[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"CircularRef","href":"./Template:CircularRef"},"params":{},"i":0}}]}'><a href="./Main_Page#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></span></p>
310 <ol class="mw-references references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><a href="./Main_Page#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text" data-parsoid="{}">Error: Expansion loop detected at <a data-parsoid='{"a":{"href":null},"sa":{"href":"Template:CircularRef"}}'>Template:CircularRef</a></span></li></ol>
311 !! end
312
313 !! test
314 Simple paragraph
315 !! wikitext
316 This is a simple paragraph.
317 !! html
318 <p>This is a simple paragraph.
319 </p>
320 !! end
321
322 !! test
323 Paragraphs with extra newline spacing
324 !! wikitext
325 foo
326
327 bar
328
329
330 baz
331
332
333
334 booz
335 !! html
336 <p>foo
337 </p><p>bar
338 </p><p><br />
339 baz
340 </p><p><br />
341 </p><p>booz
342 </p>
343 !! end
344
345 !! test
346 Paragraphs with newline spacing with comment lines in between
347 !! wikitext
348 ----
349 a
350 <!--foo-->
351 b
352 ----
353 a
354 <!--foo--><!--More than 1 comment, still stripped-->
355 b
356 ----
357 a
358 <!--foo--> <!----> <!-- bar -->
359 b
360 ----
361 a
362 <!--foo-->
363
364 b
365 ----
366 a
367
368 <!--foo-->
369 b
370 ----
371 a
372 <!--foo-->
373
374
375 b
376 ----
377 a
378
379
380 <!--foo-->
381 b
382 ----
383 !! html
384 <hr />
385 <p>a
386 b
387 </p>
388 <hr />
389 <p>a
390 b
391 </p>
392 <hr />
393 <p>a
394 b
395 </p>
396 <hr />
397 <p>a
398 </p><p>b
399 </p>
400 <hr />
401 <p>a
402 </p><p>b
403 </p>
404 <hr />
405 <p>a
406 </p><p><br />
407 b
408 </p>
409 <hr />
410 <p>a
411 </p><p><br />
412 b
413 </p>
414 <hr />
415
416 !! end
417
418 !! test
419 Paragraphs with newline spacing with non-empty white-space lines in between
420 !! wikitext
421 ----
422 a
423
424 b
425 ----
426 a
427
428
429 b
430 ----
431 !! html
432 <hr />
433 <p>a
434 </p><p>b
435 </p>
436 <hr />
437 <p>a
438 </p><p><br />
439 b
440 </p>
441 <hr />
442
443 !! end
444
445 !! test
446 Paragraphs with newline spacing with non-empty mixed comment and white-space lines in between
447 !! wikitext
448 ----
449 a
450 <!--foo-->
451 b
452 ----
453 a
454 <!--foo--><!--More than 1 comment doesn't disable stripping of this line!-->
455 b
456 ----
457 a
458
459 <!--foo-->
460 <!--bar-->
461 b
462 ----
463 a
464
465 <!--foo-->
466 <!--bar-->
467
468 b
469 ----
470 !! html
471 <hr />
472 <p>a
473 b
474 </p>
475 <hr />
476 <p>a
477 b
478 </p>
479 <hr />
480 <p>a
481 </p><p>b
482 </p>
483 <hr />
484 <p>a
485 </p><p><br />
486 b
487 </p>
488 <hr />
489
490 !! end
491
492 !! test
493 Extra newlines: More paragraphs with indented comment
494 !! wikitext
495 a
496
497 <!--boo-->
498
499 b
500 !! html
501 <p>a
502 </p><p><br />
503 b
504 </p>
505 !!end
506
507 !! test
508 Extra newlines followed by heading
509 !! wikitext
510 a
511
512
513
514 =b=
515 [[a]]
516
517
518 =b=
519 !! html
520 <p>a
521 </p><p><br />
522 </p>
523 <h1><span class="mw-headline" id="b">b</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: b">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
524 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
525 </p><p><br />
526 </p>
527 <h1><span class="mw-headline" id="b_2">b</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: b">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
528
529 !! end
530
531 !! test
532 Extra newlines between heading and content are swallowed
533 !! wikitext
534 =b=
535
536
537
538 [[a]]
539 !! html
540 <h1><span class="mw-headline" id="b">b</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: b">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
541 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
542 </p>
543 !! end
544
545 !! test
546 Heading with line break in nowiki
547 !! options
548 parsoid=wt2html
549 !! wikitext
550 == A <nowiki>B
551 C</nowiki> ==
552 !! html
553 <h2><span class="mw-headline" id="A_B.0AC">A B
554 C</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: A B&#10;C">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
555
556 !! html/parsoid
557 <h2 id="A_B.0AC">A <span typeof="mw:Nowiki">B
558 C</span> </h2>
559 !! end
560
561 !! test
562 Parsing an URL
563 !! wikitext
564 http://fr.wikipedia.org/wiki/🍺
565 <!-- EasterEgg we love beer, better be able be able to link to it -->
566 !! html
567 <p><a rel="nofollow" class="external free" href="http://fr.wikipedia.org/wiki/🍺">http://fr.wikipedia.org/wiki/🍺</a>
568 </p>
569 !! end
570
571 # Note that the html+tidy output removes the spaces after the <li>,
572 # which is a bug (https://sourceforge.net/p/tidy/bugs/945/, etc).
573 # This is an issue for all tests with lists. We intentionally do
574 # *not* add html+tidy clauses for these, as we don't want to
575 # document/test the broken behavior. (Parsoid matches the non-tidy
576 # output in these cases.)
577
578 !! test
579 Simple list
580 !! wikitext
581 * Item 1
582 * Item 2
583 !! html
584 <ul><li> Item 1</li>
585 <li> Item 2</li></ul>
586
587 !! end
588
589 !! test
590 Italics and bold
591 !! wikitext
592 * plain
593 * plain''italic''plain
594 * plain''italic''plain''italic''plain
595 * plain'''bold'''plain
596 * plain'''bold'''plain'''bold'''plain
597 * plain''italic''plain'''bold'''plain
598 * plain'''bold'''plain''italic''plain
599 * plain''italic'''bold-italic'''italic''plain
600 * plain'''bold''bold-italic''bold'''plain
601 * plain'''''bold-italic'''italic''plain
602 * plain'''''bold-italic''bold'''plain
603 * plain''italic'''bold-italic'''''plain
604 * plain'''bold''bold-italic'''''plain
605 * plain l'''italic''plain
606 * plain l''''bold''' plain
607 !! html
608 <ul><li> plain</li>
609 <li> plain<i>italic</i>plain</li>
610 <li> plain<i>italic</i>plain<i>italic</i>plain</li>
611 <li> plain<b>bold</b>plain</li>
612 <li> plain<b>bold</b>plain<b>bold</b>plain</li>
613 <li> plain<i>italic</i>plain<b>bold</b>plain</li>
614 <li> plain<b>bold</b>plain<i>italic</i>plain</li>
615 <li> plain<i>italic<b>bold-italic</b>italic</i>plain</li>
616 <li> plain<b>bold<i>bold-italic</i>bold</b>plain</li>
617 <li> plain<i><b>bold-italic</b>italic</i>plain</li>
618 <li> plain<b><i>bold-italic</i>bold</b>plain</li>
619 <li> plain<i>italic<b>bold-italic</b></i>plain</li>
620 <li> plain<b>bold<i>bold-italic</i></b>plain</li>
621 <li> plain l'<i>italic</i>plain</li>
622 <li> plain l'<b>bold</b> plain</li></ul>
623
624 !! end
625
626 # this example taken from the [[simple:Moon]] article (T49326)
627 !! test
628 Italics and possessives (1)
629 !! wikitext
630 obtained by ''[[Lunar Prospector]]'''s gamma-ray spectrometer
631 !! html
632 <p>obtained by <i><a href="/index.php?title=Lunar_Prospector&amp;action=edit&amp;redlink=1" class="new" title="Lunar Prospector (page does not exist)">Lunar Prospector</a>'</i>s gamma-ray spectrometer
633 </p>
634 !! end
635
636 # this example taken from [[en:Flaming Pie]] (T51926)
637 !! test
638 Italics and possessives (2)
639 !! wikitext
640 '''''Flaming Pie''''' is ... released in 1997. In ''Flaming Pie'''s liner notes
641 !! html
642 <p><i><b>Flaming Pie</b></i> is ... released in 1997. In <i>Flaming Pie'</i>s liner notes
643 </p>
644 !! end
645
646 # this example taken from [[en:Dictionary]] (T51926)
647 !! test
648 Italics and possessives (3)
649 !! wikitext
650 The first monolingual dictionary written in a Romance language was ''Sebastián Covarrubias''' ''Tesoro de la lengua castellana o española'', published in 1611 in Madrid. In 1612 the first edition of the ''Vocabolario dell'[[Accademia della Crusca]]'', for Italian, was published. In 1690 in Rotterdam was published, posthumously, the ''Dictionnaire Universel''.
651 !! html
652 <p>The first monolingual dictionary written in a Romance language was <i>Sebastián Covarrubias'</i> <i>Tesoro de la lengua castellana o española</i>, published in 1611 in Madrid. In 1612 the first edition of the <i>Vocabolario dell'<a href="/index.php?title=Accademia_della_Crusca&amp;action=edit&amp;redlink=1" class="new" title="Accademia della Crusca (page does not exist)">Accademia della Crusca</a></i>, for Italian, was published. In 1690 in Rotterdam was published, posthumously, the <i>Dictionnaire Universel</i>.
653 </p>
654 !! end
655
656
657 ###
658 ### 2-quote opening sequence tests
659 ###
660 !! test
661 Italics and bold: 2-quote opening sequence: (2,2)
662 !! wikitext
663 ''foo''
664 !! html
665 <p><i>foo</i>
666 </p>
667 !!end
668
669 !! test
670 Italics and bold: 2-quote opening sequence: (2,3)
671 !! wikitext
672 ''foo'''
673 !! html/*
674 <p><i>foo'</i>
675 </p>
676 !!end
677
678 !! test
679 Italics and bold: 2-quote opening sequence: (2,4)
680 !! options
681 parsoid=wt2html
682 !! wikitext
683 ''foo''''
684 !! html/*
685 <p><i>foo''</i>
686 </p>
687 !!end
688
689 # same html as previous, but wikitext adjusted to match parsoid html2wt
690 !! test
691 Italics and bold: 2-quote opening sequence: (2,4) w/ nowiki
692 !! wikitext
693 ''foo<nowiki>''</nowiki>''
694 !! html
695 <p><i>foo''</i>
696 </p>
697 !! end
698
699 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
700 !! test
701 Italics and bold: 2-quote opening sequence: (2,5)
702 !! options
703 parsoid=wt2html
704 !! wikitext
705 ''foo'''''
706 !! html/php
707 <p><i>foo</i>
708 </p>
709 !! html/parsoid
710 <p><i>foo</i><b></b>
711 </p>
712 !!end
713
714 # same html as previous, but wikitext adjusted to match parsoid html2wt
715 !! test
716 Italics and bold: 2-quote opening sequence: (2,5+3) w/ nowiki
717 !! wikitext
718 ''foo'''''<nowiki/>'''
719 !! html/php
720 <p><i>foo</i>
721 </p>
722 !! html/parsoid
723 <p><i>foo</i><b></b>
724 </p>
725 !! end
726
727
728 ###
729 ### 3-quote opening sequence tests
730 ###
731
732 !! test
733 Italics and bold: 3-quote opening sequence: (3,2)
734 !! wikitext
735 '''foo''
736 !! html/*
737 <p>'<i>foo</i>
738 </p>
739 !!end
740
741 !! test
742 Italics and bold: 3-quote opening sequence: (3,3)
743 !! wikitext
744 '''foo'''
745 !! html
746 <p><b>foo</b>
747 </p>
748 !!end
749
750 !! test
751 Italics and bold: 3-quote opening sequence: (3,4)
752 !! wikitext
753 '''foo''''
754 !! html/*
755 <p><b>foo'</b>
756 </p>
757 !!end
758
759 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
760 !! test
761 Italics and bold: 3-quote opening sequence: (3,5)
762 !! options
763 parsoid=wt2html
764 !! wikitext
765 '''foo'''''
766 !! html/php
767 <p><b>foo</b>
768 </p>
769 !! html/parsoid
770 <p><b>foo</b><i></i>
771 </p>
772 !!end
773
774 # same html as previous, but wikitext adjusted to match parsoid html2wt
775 !! test
776 Italics and bold: 3-quote opening sequence: (3,5+2) w/ nowiki
777 !! wikitext
778 '''foo'''''<nowiki/>''
779 !! html/php
780 <p><b>foo</b>
781 </p>
782 !! html/parsoid
783 <p><b>foo</b><i></i>
784 </p>
785 !! end
786
787
788 ###
789 ### 4-quote opening sequence tests
790 ###
791
792 !! test
793 Italics and bold: 4-quote opening sequence: (4,2)
794 !! options
795 parsoid=wt2html
796 !! wikitext
797 ''''foo''
798 !! html/*
799 <p>''<i>foo</i>
800 </p>
801 !!end
802
803 # same html as previous, but wikitext adjusted to match parsoid html2wt
804 !! test
805 Italics and bold: 4-quote opening sequence: (4,2) w/ nowiki
806 !! wikitext
807 <nowiki>''</nowiki>''foo''
808 !! html
809 <p>''<i>foo</i>
810 </p>
811 !! end
812
813 !! test
814 Italics and bold: 4-quote opening sequence: (4,3)
815 !! wikitext
816 ''''foo'''
817 !! html/*
818 <p>'<b>foo</b>
819 </p>
820 !!end
821
822 !! test
823 Italics and bold: 4-quote opening sequence: (4,4)
824 !! options
825 parsoid=wt2html
826 !! wikitext
827 ''''foo''''
828 !! html/*
829 <p>'<b>foo'</b>
830 </p>
831 !!end
832
833 # same html as previous, but wikitext adjusted to match parsoid html2wt
834 !! test
835 Italics and bold: 4-quote opening sequence: (4,4) w/ nowiki
836 !! wikitext
837 '<nowiki/>'''foo''''
838 !! html
839 <p>'<b>foo'</b>
840 </p>
841 !! end
842
843 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
844 !! test
845 Italics and bold: 4-quote opening sequence: (4,5)
846 !! options
847 parsoid=wt2html
848 !! wikitext
849 ''''foo'''''
850 !! html/php
851 <p>'<b>foo</b>
852 </p>
853 !! html/parsoid
854 <p>'<b>foo</b><i></i>
855 </p>
856 !!end
857
858 # same html as previous, but wikitext adjusted to match parsoid html2wt
859 !! test
860 Italics and bold: 4-quote opening sequence: (4,5+2) w/ nowiki
861 !! wikitext
862 '<nowiki/>'''foo'''''<nowiki/>''
863 !! html/php
864 <p>'<b>foo</b>
865 </p>
866 !! html/parsoid
867 <p>'<b>foo</b><i></i>
868 </p>
869 !! end
870
871
872 ###
873 ### 5-quote opening sequence tests
874 ###
875
876 !! test
877 Italics and bold: 5-quote opening sequence: (5,2)
878 !! options
879 parsoid=wt2html
880 !! wikitext
881 '''''foo''
882 !! html/*
883 <p><b><i>foo</i></b>
884 </p>
885 !!end
886
887 # same html as previous, but wikitext adjusted to match parsoid html2wt
888 !! test
889 Italics and bold: 5-quote opening sequence: (5,2+3)
890 !! wikitext
891 '''''foo'''''
892 !! html/*
893 <p><i><b>foo</b></i>
894 </p>
895 !! end
896
897 !! test
898 Italics and bold: 5-quote opening sequence: (5,3)
899 !! options
900 parsoid=wt2html
901 !! wikitext
902 '''''foo'''
903 !! html/*
904 <p><i><b>foo</b></i>
905 </p>
906 !!end
907
908 # same html as previous, but wikitext adjusted to match parsoid html2wt
909 !! test
910 Italics and bold: 5-quote opening sequence: (5,3+2)
911 !! wikitext
912 '''''foo'''''
913 !! html
914 <p><i><b>foo</b></i>
915 </p>
916 !! end
917
918 !! test
919 Italics and bold: 5-quote opening sequence: (5,4)
920 !! options
921 parsoid=wt2html
922 !! wikitext
923 '''''foo''''
924 !! html/*
925 <p><i><b>foo'</b></i>
926 </p>
927 !!end
928
929 !! test
930 Italics and bold: 5-quote opening sequence: (5,5)
931 !! wikitext
932 '''''foo'''''
933 !! html
934 <p><i><b>foo</b></i>
935 </p>
936 !!end
937
938 !! test
939 Italics and bold: 5-quote opening sequence: (5,6)
940 !! wikitext
941 '''''foo''''''
942 !! html/*
943 <p><i><b>foo'</b></i>
944 </p>
945 !! end
946
947 ###
948 ### multiple quote sequences in a line
949 ###
950
951 !! test
952 Italics and bold: multiple quote sequences: (2,4,2)
953 !! options
954 parsoid=wt2html
955 !! wikitext
956 ''foo''''bar''
957 !! html/*
958 <p><i>foo'<b>bar</b></i>
959 </p>
960 !! end
961
962 # same html as previous, but wikitext adjusted to match parsoid html2wt
963 !! test
964 Italics and bold: multiple quote sequences: (2,4,2+3) w/ nowiki
965 !! wikitext
966 ''foo'<nowiki/>'''bar'''''
967 !! html
968 <p><i>foo'<b>bar</b></i>
969 </p>
970 !! end
971
972 !! test
973 Italics and bold: multiple quote sequences: (2,4,3)
974 !! options
975 parsoid=wt2html
976 !! wikitext
977 ''foo''''bar'''
978 !! html/*
979 <p><i>foo'<b>bar</b></i>
980 </p>
981 !! end
982
983 # same html as previous, but wikitext adjusted to match parsoid html2wt
984 !! test
985 Italics and bold: multiple quote sequences: (2,4,3+2) w/ nowiki
986 !! wikitext
987 ''foo'<nowiki/>'''bar'''''
988 !! html
989 <p><i>foo'<b>bar</b></i>
990 </p>
991 !! end
992
993 !! test
994 Italics and bold: multiple quote sequences: (2,4,4)
995 !! options
996 parsoid=wt2html
997 !! wikitext
998 ''foo''''bar''''
999 !! html/*
1000 <p><i>foo'<b>bar'</b></i>
1001 </p>
1002 !! end
1003
1004 # same html as previous, but wikitext adjusted to match parsoid html2wt
1005 !! test
1006 Italics and bold: multiple quote sequences: (2,4,4+2) w/ nowiki
1007 !! wikitext
1008 ''foo'<nowiki/>'''bar'<nowiki/>'''''
1009 !! html
1010 <p><i>foo'<b>bar'</b></i>
1011 </p>
1012 !! end
1013
1014 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
1015 !! test
1016 Italics and bold: multiple quote sequences: (3,4,2)
1017 !! options
1018 parsoid=wt2html
1019 !! wikitext
1020 '''foo''''bar''
1021 !! html/php
1022 <p><b>foo'</b>bar
1023 </p>
1024 !! html/parsoid
1025 <p><b>foo'</b>bar<i></i>
1026 </p>
1027 !! end
1028
1029 # same html as previous, but wikitext adjusted to match parsoid html2wt
1030 !! test
1031 Italics and bold: multiple quote sequences: (3,4,2+2) w/ nowiki
1032 !! wikitext
1033 '''foo''''bar''<nowiki/>''
1034 !! html/php
1035 <p><b>foo'</b>bar
1036 </p>
1037 !! html/parsoid
1038 <p><b>foo'</b>bar<i></i>
1039 </p>
1040 !! end
1041
1042 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
1043 !! test
1044 Italics and bold: multiple quote sequences: (3,4,3)
1045 !! options
1046 parsoid=wt2html
1047 !! wikitext
1048 '''foo''''bar'''
1049 !! html/php
1050 <p><b>foo'</b>bar
1051 </p>
1052 !! html/parsoid
1053 <p><b>foo'</b>bar<b></b>
1054 </p>
1055 !! end
1056
1057 # same html as previous, but wikitext adjusted to match parsoid html2wt
1058 !! test
1059 Italics and bold: multiple quote sequences: (3,4,3+3) w/ nowiki
1060 !! wikitext
1061 '''foo''''bar'''<nowiki/>'''
1062 !! html/php
1063 <p><b>foo'</b>bar
1064 </p>
1065 !! html/parsoid
1066 <p><b>foo'</b>bar<b></b>
1067 </p>
1068 !! end
1069
1070 ###
1071 ### other quote tests
1072 ###
1073 !! test
1074 Italics and bold: other quote tests: (2,3,5)
1075 !! wikitext
1076 ''this is about '''foo's family'''''
1077 !! html
1078 <p><i>this is about <b>foo's family</b></i>
1079 </p>
1080 !!end
1081
1082
1083 !! test
1084 Italics and bold: other quote tests: (2,(3,3),2)
1085 !! wikitext
1086 ''this is about '''foo's''' family''
1087 !! html
1088 <p><i>this is about <b>foo's</b> family</i>
1089 </p>
1090 !!end
1091
1092
1093 !! test
1094 Italics and bold: other quote tests: (3,2,3,2)
1095 !! options
1096 parsoid=wt2html
1097 !! wikitext
1098 '''this is about ''foo'''s family''
1099 !! html/*
1100 <p><b>this is about <i>foo</i></b><i>s family</i>
1101 </p>
1102 !!end
1103
1104
1105 # same html as previous, but wikitext adjusted to match parsoid html2wt
1106 !! test
1107 Italics and bold: other quote tests: (3,2,3+2+2,2)
1108 !! wikitext
1109 '''this is about ''foo'''''<nowiki/>''s family''
1110 !! html
1111 <p><b>this is about <i>foo</i></b><i>s family</i>
1112 </p>
1113 !! end
1114
1115
1116 !! test
1117 Italics and bold: other quote tests: (3,2,3,3)
1118 !! wikitext
1119 '''this is about ''foo'''s family'''
1120 !! html/*
1121 <p>'<i>this is about </i>foo<b>s family</b>
1122 </p>
1123 !!end
1124
1125
1126 !! test
1127 Italics and bold: other quote tests: (3,(2,2),3)
1128 !! wikitext
1129 '''this is about ''foo's'' family'''
1130 !! html
1131 <p><b>this is about <i>foo's</i> family</b>
1132 </p>
1133 !!end
1134
1135
1136 !! test
1137 Italicized possessive
1138 !! wikitext
1139 The ''[[Main Page]]'''s talk page.
1140 !! html/php
1141 <p>The <i><a href="/wiki/Main_Page" title="Main Page">Main Page</a>'</i>s talk page.
1142 </p>
1143 !! html/parsoid
1144 <p>The <i><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a>'</i>s talk page.</p>
1145 !! end
1146
1147 !! test
1148 Parsoid only: Quote balancing context should be restricted to td/th cells on the same wikitext line
1149 (Requires tidy for PHP parser output to be fixed up)
1150 !! options
1151 parsoid=wt2html,wt2wt
1152 !! wikitext
1153 {|
1154 !''a!!''b
1155 |''a||''b
1156 |}
1157 !! html/php+tidy
1158 <table>
1159 <tr>
1160 <th><i>a</i></th>
1161 <th><i>b</i></th>
1162 <td><i>a</i></td>
1163 <td><i>b</i></td>
1164 </tr>
1165 </table>
1166 !! html/parsoid
1167 <table>
1168 <tbody><tr><th><i>a</i></th><th><i>b</i></th>
1169 <td><i>a</i></td><td><i>b</i></td></tr>
1170 </tbody></table>
1171 !! end
1172
1173 ###
1174 ### Non-html5 tags
1175 ###
1176
1177 !! test
1178 Non-html5 tags should be accepted
1179 !! wikitext
1180 <center>''foo''</center>
1181 <big>''foo''</big>
1182 <font>''foo''</font>
1183 <strike>''foo''</strike>
1184 <tt>''foo''</tt>
1185 !! html
1186 <center><i>foo</i></center>
1187 <p><big><i>foo</i></big>
1188 <font><i>foo</i></font>
1189 <strike><i>foo</i></strike>
1190 <tt><i>foo</i></tt>
1191 </p>
1192 !! end
1193
1194 !! test
1195 <wbr> is valid wikitext (T54468)
1196 !! wikitext
1197 <wbr>
1198 !! html
1199 <p><wbr />
1200 </p>
1201 !! end
1202
1203 # <strike> is HTML4, <s> is HTML4/5.
1204 !! test
1205 <s> or <strike> for strikethrough
1206 !! wikitext
1207 <strike>strike</strike>
1208
1209 <s>s</s>
1210 !! html
1211 <p><strike>strike</strike>
1212 </p><p><s>s</s>
1213 </p>
1214 !! end
1215
1216 ## a not permitted
1217 ## i,b,br omitted
1218 !! test
1219 Text-level semantic html elements in wikitext
1220 !! wikitext
1221 <em>text</em>
1222 <strong>text</strong>
1223 <small>text</small>
1224 <s>text</s>
1225 <cite>text</cite>
1226 <q>text</q>
1227 <dfn>text</dfn>
1228 <abbr>text</abbr>
1229 <data>text</data>
1230 <time>text</time>
1231 <code>text</code>
1232 <var>text</var>
1233 <samp>text</samp>
1234 <kbd>text</kbd>
1235 <sub>text</sub>
1236 <u>text</u>
1237 <mark>text</mark>
1238 <ruby><rb>明日</rb><rp>(</rp><rt>Ashita</rt><rp> </rp><rtc>あした</rtc><rp>)</rp></ruby>
1239 <bdi>text</bdi>
1240 <bdo>text</bdo>
1241 <span>text</span>
1242 <wbr />
1243 !! html
1244 <p><em>text</em>
1245 <strong>text</strong>
1246 <small>text</small>
1247 <s>text</s>
1248 <cite>text</cite>
1249 <q>text</q>
1250 <dfn>text</dfn>
1251 <abbr>text</abbr>
1252 <data>text</data>
1253 <time>text</time>
1254 <code>text</code>
1255 <var>text</var>
1256 <samp>text</samp>
1257 <kbd>text</kbd>
1258 <sub>text</sub>
1259 <u>text</u>
1260 <mark>text</mark>
1261 <ruby><rb>明日</rb><rp>(</rp><rt>Ashita</rt><rp> </rp><rtc>あした</rtc><rp>)</rp></ruby>
1262 <bdi>text</bdi>
1263 <bdo>text</bdo>
1264 <span>text</span>
1265 <wbr />
1266 </p>
1267 !! end
1268
1269 # test cases taken from
1270 # https://www.w3.org/TR/html5/text-level-semantics.html#the-ruby-element
1271 !! test
1272 Ruby markup (W3C-style)
1273 !! wikitext
1274 ; Mono-ruby for individual base characters
1275 : <ruby>日<rt>に</rt>本<rt>ほん</rt>語<rt>ご</rt></ruby>
1276 ; Group ruby
1277 : <ruby>今日<rt>きょう</rt></ruby>
1278 ; Jukugo ruby
1279 : <ruby>法<rb>華</rb><rb>経</rb><rt>ほ</rt><rt>け</rt><rt>きょう</rt></ruby>
1280 ; Inline ruby
1281 : <ruby>東<rb>京</rb><rp>(</rp><rt>とう</rt><rt>きょう</rt><rp>)</rp></ruby>
1282 ; Double-sided ruby
1283 : <ruby><rb>旧</rb><rb>金</rb><rb>山</rb><rt>jiù</rt><rt>jīn</rt><rt>shān</rt><rtc>San Francisco</rtc></ruby>
1284 <ruby>
1285 <rb>♥</rb><rtc><rt>Heart</rt></rtc><rtc lang="fr"><rt>Cœur</rt></rtc>
1286 <rb>☘</rb><rtc><rt>Shamrock</rt></rtc><rtc lang="fr"><rt>Trèfle</rt></rtc>
1287 <rb>✶</rb><rtc><rt>Star</rt></rtc><rtc lang="fr"><rt>Étoile</rt></rtc>
1288 </ruby>
1289 !! html
1290 <dl><dt> Mono-ruby for individual base characters</dt>
1291 <dd> <ruby>日<rt>に</rt>本<rt>ほん</rt>語<rt>ご</rt></ruby></dd>
1292 <dt> Group ruby</dt>
1293 <dd> <ruby>今日<rt>きょう</rt></ruby></dd>
1294 <dt> Jukugo ruby</dt>
1295 <dd> <ruby>法<rb>華</rb><rb>経</rb><rt>ほ</rt><rt>け</rt><rt>きょう</rt></ruby></dd>
1296 <dt> Inline ruby</dt>
1297 <dd> <ruby>東<rb>京</rb><rp>(</rp><rt>とう</rt><rt>きょう</rt><rp>)</rp></ruby></dd>
1298 <dt> Double-sided ruby</dt>
1299 <dd> <ruby><rb>旧</rb><rb>金</rb><rb>山</rb><rt>jiù</rt><rt>jīn</rt><rt>shān</rt><rtc>San Francisco</rtc></ruby></dd></dl>
1300 <p><ruby>
1301 <rb>♥</rb><rtc><rt>Heart</rt></rtc><rtc lang="fr"><rt>Cœur</rt></rtc>
1302 <rb>☘</rb><rtc><rt>Shamrock</rt></rtc><rtc lang="fr"><rt>Trèfle</rt></rtc>
1303 <rb>✶</rb><rtc><rt>Star</rt></rtc><rtc lang="fr"><rt>Étoile</rt></rtc>
1304 </ruby>
1305 </p>
1306 !! end
1307
1308 # The next two test different paths in the sanitizer.
1309 !! test
1310 Non-word characters don't terminate tag names (T19663, T42670, T54022)
1311 !! wikitext
1312 <blockquote|>a</blockquote>
1313
1314 <b→> doesn't terminate </b→>
1315
1316 <bä> doesn't terminate </bä>
1317
1318 <boo> doesn't terminate </boo>
1319
1320 <s.foo> doesn't terminate </s.foo>
1321
1322 <sub-ID#1>
1323 !! html
1324 <p>&lt;blockquote|&gt;a&lt;/blockquote&gt;
1325 </p><p>&lt;b→&gt; doesn't terminate &lt;/b→&gt;
1326 </p><p>&lt;bä&gt; doesn't terminate &lt;/bä&gt;
1327 </p><p>&lt;boo&gt; doesn't terminate &lt;/boo&gt;
1328 </p><p>&lt;s.foo&gt; doesn't terminate &lt;/s.foo&gt;
1329 </p><p>&lt;sub-ID#1&gt;
1330 </p>
1331 !! end
1332
1333 # There is a tidy bug here: https://sourceforge.net/p/tidy/bugs/946/
1334 # If the non-word-character tag made it through the sanitizer, tidy
1335 # would munge it up.
1336 !! test
1337 Non-word characters don't terminate tag names + tidy
1338 !! wikitext
1339 <blockquote|>a</blockquote>
1340
1341 <b→> doesn't terminate </b→>
1342
1343 <bä> doesn't terminate </bä>
1344
1345 <boo> doesn't terminate </boo>
1346
1347 <s.foo> doesn't terminate </s.foo>
1348
1349 <sub-ID#1>
1350 !! html+tidy
1351 <p>&lt;blockquote|&gt;a</p>
1352 <p>&lt;b→&gt; doesn't terminate &lt;/b→&gt;</p>
1353 <p>&lt;bä&gt; doesn't terminate &lt;/bä&gt;</p>
1354 <p>&lt;boo&gt; doesn't terminate &lt;/boo&gt;</p>
1355 <p>&lt;s.foo&gt; doesn't terminate &lt;/s.foo&gt;</p>
1356 <p>&lt;sub-ID#1&gt;</p>
1357 !! end
1358
1359 ###
1360 ### See tests/parser/parserTestsParserHook.php for the <tåg> extension)
1361 ### This checks that HTML5 tags (with non-word characters in the tag
1362 ### name) make it safely through the parser -- the Sanitizer will
1363 ### munge them later, as it should.
1364 ###
1365 !! test
1366 Non-word characters are valid in extension tags (T19663)
1367 !! wikitext
1368 <tåg>tåg</tåg>
1369 !! html/php
1370 <pre>
1371 'tåg'
1372 array (
1373 )
1374 </pre>
1375
1376 !! html/parsoid
1377 <pre typeof="mw:Extension/tåg" data-mw='{"name":"tåg","attrs":{},"body":{"extsrc":"tåg"}}' data-parsoid='{}' about="#mwt2"></pre>
1378 !! end
1379
1380 !! test
1381 Isolated close tags should be treated as literal text (T54760)
1382 !! options
1383 parsoid=wt2html
1384 !! wikitext
1385 </b>
1386
1387 <s.foo>s</s>
1388 !! html/php+tidy
1389 <p>&lt;s.foo&gt;s</p>
1390 !! html/parsoid
1391 <p>&lt;s.foo&gt;s</p>
1392 !! end
1393
1394 ###
1395 ### Special characters
1396 ###
1397
1398 !! test
1399 Bare pipe character (T54363)
1400 !! wikitext
1401 |
1402 !! html
1403 <p>|
1404 </p>
1405 !! end
1406
1407 !! test
1408 Bare pipe character from a template (T54363)
1409 !! wikitext
1410 {{pipe}}
1411 !! html
1412 <p>|
1413 </p>
1414 !! end
1415
1416 ###
1417 ### <nowiki> test cases
1418 ###
1419
1420 !! test
1421 <nowiki> unordered list
1422 !! wikitext
1423 <nowiki>* This is not an unordered list item.</nowiki>
1424 !! html/php
1425 <p>* This is not an unordered list item.
1426 </p>
1427 !! html/parsoid
1428 <p><span typeof="mw:Nowiki">* This is not an unordered list item.</span></p>
1429 !! end
1430
1431 !! test
1432 <nowiki> spacing
1433 !! wikitext
1434 <nowiki>Lorem ipsum dolor
1435
1436 sed abit.
1437 sed nullum.
1438
1439 :and a colon
1440 </nowiki>
1441 !! html/php
1442 <p>Lorem ipsum dolor
1443
1444 sed abit.
1445 sed nullum.
1446
1447 :and a colon
1448
1449 </p>
1450 !! html/parsoid
1451 <p><span typeof="mw:Nowiki">Lorem ipsum dolor
1452
1453 sed abit.
1454 sed nullum.
1455
1456 :and a colon
1457 </span></p>
1458 !! end
1459
1460 !! test
1461 Don't parse <nowiki><span class="error"></nowiki> (T149622)
1462 !! wikitext
1463 <nowiki><span class="error"></nowiki>
1464 !! html/php
1465 <p>&lt;span class="error"&gt;
1466 </p>
1467 !! html/parsoid
1468 <p><span typeof="mw:Nowiki">&lt;span class="error"></span></p>
1469 !! end
1470
1471 !! test
1472 nowiki 3
1473 !! wikitext
1474 :There is not nowiki.
1475 :There is <nowiki>nowiki</nowiki>.
1476
1477 #There is not nowiki.
1478 #There is <nowiki>nowiki</nowiki>.
1479
1480 *There is not nowiki.
1481 *There is <nowiki>nowiki</nowiki>.
1482 !! html/php
1483 <dl><dd>There is not nowiki.</dd>
1484 <dd>There is nowiki.</dd></dl>
1485 <ol><li>There is not nowiki.</li>
1486 <li>There is nowiki.</li></ol>
1487 <ul><li>There is not nowiki.</li>
1488 <li>There is nowiki.</li></ul>
1489
1490 !! html/parsoid
1491 <dl><dd data-parsoid='{}'>There is not nowiki.</dd>
1492 <dd data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</dd></dl>
1493
1494 <ol><li data-parsoid='{}'>There is not nowiki.</li>
1495 <li data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</li></ol>
1496
1497 <ul><li data-parsoid='{}'>There is not nowiki.</li>
1498 <li data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</li></ul>
1499 !! end
1500
1501 !! test
1502 Entities inside <nowiki>
1503 !! wikitext
1504 <nowiki>&lt;</nowiki>
1505 !! html/php
1506 <p>&lt;
1507 </p>
1508 !! html/parsoid
1509 <p><span typeof="mw:Nowiki"><span typeof="mw:Entity" data-parsoid='{"src":"&amp;lt;","srcContent":"&lt;"}'>&lt;</span></span></p>
1510 !! end
1511
1512 !! test
1513 Entities inside template parameters
1514 !! wikitext
1515 {{echo|&ndash;}}
1516 !! html/php+tidy
1517 <p>–</p>
1518 !! html/parsoid
1519 <p><span typeof="mw:Transclusion mw:Entity" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&amp;ndash;"}},"i":0}}]}'>&ndash;</span></p>
1520 !! end
1521
1522 !! test
1523 Properly escape nowiki when combined with other wiki markup
1524 !! options
1525 parsoid=html2wt
1526 !! html/parsoid
1527 <p>* &lt;/nowiki&gt; tag</p>
1528 !! wikitext
1529 <nowiki>*</nowiki> <nowiki>&lt;/nowiki&gt;</nowiki> tag
1530 !! end
1531
1532 !! test
1533 T93824: Put escaped HTML tags inside nowiki
1534 !! options
1535 parsoid=html2wt
1536 !! html/parsoid
1537 <p>&lt;h2&gt;foo&lt;/h2&gt;</p>
1538 !! wikitext
1539 <nowiki><h2>foo</h2></nowiki>
1540 !! end
1541
1542 !! test
1543 T71950: 1. Put nowiki as close to cause as possible, even with non-quote escapable chars
1544 !! options
1545 parsoid=html2wt
1546 !! html/parsoid
1547 <p>This text: L'<a rel="mw:WikiLink" href="./Foo">Foo</a>
1548 This text: L''<a rel="mw:WikiLink" href="./Foo">Foo</a>
1549 This text: L'''<a rel="mw:WikiLink" href="./Foo">Foo</a>''</p>
1550 !! wikitext
1551 This text: L'[[Foo]]
1552 This text: L<nowiki>''</nowiki>[[Foo]]
1553 This text: L<nowiki>'''</nowiki>[[Foo]]<nowiki>''</nowiki>
1554 !! end
1555
1556 # This test fails because wikitext whitespace is not normalized before comparing.
1557 !! test
1558 T71950: 2. Put nowiki as close to cause as possible, after ' :'
1559 !! options
1560 parsoid=html2wt
1561 !! html/parsoid
1562 <p>This text : L''<a rel="mw:WikiLink" href="./Foo">Foo</a>
1563 </p>
1564 !! wikitext
1565 This text : L<nowiki>''</nowiki>[[Foo]]
1566 !! end
1567
1568 # This test and the next one are html2wt only as they test that incorrect wikitext
1569 # passed in template arguments gets escaped or wrapped in nowikis where required.
1570 !! test
1571 T71482: Use {{!}} instead of nowiki for single pipe in template argument
1572 !! options
1573 parsoid=html2wt
1574 !! html/parsoid
1575 <p><span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;foo|bar&quot;}},&quot;i&quot;:0}}]}" about="#mwt1"></span>
1576 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;foo|bar |[[&quot;}},&quot;i&quot;:0}}]}" about="#mwt2"></p>
1577 !! wikitext
1578 {{echo|foo{{!}}bar}}
1579 {{echo|<nowiki>foo|bar |[[</nowiki>}}
1580 !! end
1581
1582 !! test
1583 T53961: Output correct nowikis in template arguments
1584 !! options
1585 parsoid=html2wt
1586 !! html/parsoid
1587 <p><span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;a [ b&quot;}},&quot;i&quot;:0}}]}" about="#mwt1"></span>
1588 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;a }} b&quot;}},&quot;i&quot;:0}}]}" about="#mwt2"></span>
1589 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;a [[ b&quot;}},&quot;i&quot;:0}}]}" about="#mwt3"></span>
1590 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;a | {{ ]]&quot;}},&quot;i&quot;:0}}]}" about="#mwt4"></span>
1591 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;a }&quot;}},&quot;i&quot;:0}}]}" about="#mwt5"></span></p>
1592 !! wikitext
1593 {{echo|a [ b}}
1594 {{echo|<nowiki>a }} b</nowiki>}}
1595 {{echo|<nowiki>a [[ b</nowiki>}}
1596 {{echo|<nowiki>a | {{ ]]</nowiki>}}
1597 {{echo|a <nowiki>}</nowiki>}}
1598 !! end
1599
1600 !! test
1601 Cases where "!!" needs nowiki protection
1602 !! options
1603 parsoid=html2wt
1604 !! html/parsoid
1605 <table>
1606 <tr><th>this needs protection !! here</th></tr>
1607 </table>
1608
1609 <table>
1610 <tr><th>this does not need
1611 protection !! here</th></tr>
1612 </table>
1613 !! wikitext
1614 {|
1615 !<nowiki>this needs protection !! here</nowiki>
1616 |}
1617
1618 {|
1619 !this does not need
1620 protection !! here
1621 |}
1622 !! end
1623
1624 ###
1625 ### Comments
1626 ###
1627 !! test
1628 Comments and Indent-Pre
1629 !! wikitext
1630 <!-- comment 1 --> asdf
1631
1632 <!-- comment 1 --> asdf
1633 <!-- comment 2 -->
1634
1635 <!-- comment 1 --> asdf
1636 <!-- comment 2 -->xyz
1637
1638 <!-- comment 1 --> asdf
1639 <!-- comment 2 --> xyz
1640 !! html
1641 <pre>asdf
1642 </pre>
1643 <pre>asdf
1644 </pre>
1645 <pre>asdf
1646 </pre>
1647 <p>xyz
1648 </p>
1649 <pre>asdf
1650 xyz
1651 </pre>
1652 !! end
1653
1654 !! test
1655 Comment test 2a
1656 !! wikitext
1657 asdf
1658 <!-- comment 1 -->
1659 jkl
1660 !! html
1661 <p>asdf
1662 jkl
1663 </p>
1664 !! end
1665
1666 !! test
1667 Comment test 2b
1668 !! wikitext
1669 asdf
1670 <!-- comment 1 -->
1671
1672 jkl
1673 !! html
1674 <p>asdf
1675 </p><p>jkl
1676 </p>
1677 !! end
1678
1679 !! test
1680 Comment test 3
1681 !! wikitext
1682 asdf
1683 <!-- comment 1 -->
1684 <!-- comment 2 -->
1685 jkl
1686 !! html
1687 <p>asdf
1688 jkl
1689 </p>
1690 !! end
1691
1692 !! test
1693 Comment test 4
1694 !! wikitext
1695 asdf<!-- comment 1 -->jkl
1696 !! html
1697 <p>asdfjkl
1698 </p>
1699 !! end
1700
1701 !! test
1702 Comment spacing
1703 !! wikitext
1704 a
1705 <!-- foo --> b <!-- bar -->
1706 c
1707 !! html
1708 <p>a
1709 </p>
1710 <pre> b
1711 </pre>
1712 <p>c
1713 </p>
1714 !! end
1715
1716 !! test
1717 Comment whitespace
1718 !! wikitext
1719 <!-- returns a single newline, not nothing, since the newline after > is not stripped -->
1720 !! html
1721
1722 !! end
1723
1724 !! test
1725 Comment semantics and delimiters
1726 !! wikitext
1727 <!-- --><!----><!-----><!------>
1728 !! html/php
1729
1730 !! html/parsoid
1731 <!-- --><!----><!--&#x2D;--><!--&#x2D;&#x2D;-->
1732 !! end
1733
1734 !! test
1735 Comment semantics and delimiters, redux
1736 !! wikitext
1737 <!-- In SGML every "foo" here would actually show up in the text -- foo -- bar
1738 -- foo -- funky huh? ... -->
1739 !! html/php
1740
1741 !! html/parsoid
1742 <!-- In SGML every "foo" here would actually show up in the text &#x2D;&#x2D; foo &#x2D;&#x2D; bar
1743 &#x2D;&#x2D; foo &#x2D;&#x2D; funky huh? ... -->
1744 !! end
1745
1746 !! test
1747 Comment semantics and delimiters: directors cut
1748 !! wikitext
1749 <!-- ... However we like to keep things simple and somewhat XML-ish so we eat
1750 everything starting with < followed by !-- until the first -- and > we see,
1751 that wouldn't be valid XML however, since in XML -- has to terminate a comment
1752 -->-->
1753 !! html/php
1754 <p>--&gt;
1755 </p>
1756 !! html/parsoid
1757 <!-- ... However we like to keep things simple and somewhat XML&#x2D;ish so we eat
1758 everything starting with < followed by !&#x2D;&#x2D; until the first &#x2D;&#x2D; and &#x3E; we see,
1759 that wouldn't be valid XML however, since in XML &#x2D;&#x2D; has to terminate a comment
1760 --><p>--></p>
1761 !! end
1762
1763 !! test
1764 Comment semantics: nesting
1765 !! wikitext
1766 <!--<!-- no, we're not going to do anything fancy here -->-->
1767 !! html/php
1768 <p>--&gt;
1769 </p>
1770 !! html/parsoid
1771 <!--<!&#x2D;&#x2D; no, we're not going to do anything fancy here --><p>--></p>
1772 !! end
1773
1774 # Parsoid closes the unclosed comment, even if it means a slight
1775 # round-trip diff.
1776 !! test
1777 Comment semantics: unclosed comment at end
1778 !! options
1779 parsoid=wt2html,html2html
1780 !! wikitext
1781 <!--This comment will run out to the end of the document
1782 !! html/php
1783
1784 !! html/parsoid
1785 <!--This comment will run out to the end of the document-->
1786 !! end
1787
1788 !! test
1789 Comment semantics: normalize comments to play nice with XML and browsers
1790 !! wikitext
1791 <!-- Browsers --!> think this is closed -->
1792 <!--> This would normally be text -->
1793 <!---> As would this -->
1794 <!-- XML doesn't like trailing dashes -------->
1795 <!-- Nor doubled hyphens -- anywhere in the data -->
1796 But this is not a comment.
1797 !! html/php
1798 <p>But this is not a comment.
1799 </p>
1800 !! html/parsoid
1801 <!-- Browsers &#x2D;&#x2D;!&#x3E; think this is closed -->
1802 <!--&#x3E; This would normally be text -->
1803 <!--&#x2D;&#x3E; As would this -->
1804 <!-- XML doesn't like trailing dashes &#x2D;&#x2D;&#x2D;&#x2D;&#x2D;&#x2D;-->
1805 <!-- Nor doubled hyphens &#x2D;&#x2D; anywhere in the data -->
1806 <p>But this is not a comment.</p>
1807 !! end
1808
1809 !! test
1810 Comment semantics: round-trip even text which contains encoded -->
1811 !! wikitext
1812 <!-- hello & goodbye - > --&gt; --&amp;gt; --&xx -->
1813 !! html/parsoid
1814 <!-- hello &#x26; goodbye &#x2D; &#x3E; &#x2D;&#x2D;&#x3E; &#x2D;&#x2D;&#x26;gt; &#x2D;&#x2D;&#x26;xx -->
1815 !! end
1816
1817 !! test
1818 Comment in template title
1819 !! wikitext
1820 {{f<!---->oo}}
1821 !! html
1822 <p>FOO
1823 </p>
1824 !! end
1825
1826 !! test
1827 Comment on its own line post-expand
1828 !! wikitext
1829 a
1830 {{blank}}<!---->
1831 b
1832 !! html
1833 <p>a
1834 </p><p>b
1835 </p>
1836 !! end
1837
1838 !! test
1839 Comment on its own line post-expand with non-significant whitespace
1840 !! wikitext
1841 a
1842 {{blank}} <!---->
1843 b
1844 !! html
1845 <p>a
1846 </p><p>b
1847 </p>
1848 !! end
1849
1850 !! test
1851 Multiple comments should still parse as SOL-transparent
1852 !! options
1853 parsoid=wt2html,wt2wt
1854 !! wikitext
1855 <!--c1-->*a
1856 <!--c2--><!--c3--><!--c4-->*b
1857 !! html/php
1858 <ul><li>a</li>
1859 <li>b</li></ul>
1860
1861 !! html/parsoid
1862 <!--c1--><ul>
1863 <li>a
1864 </li>
1865 <!--c2--><!--c3--><!--c4-->
1866 <li>b
1867 </li>
1868 </ul>
1869 !! end
1870
1871 ## Make sure ">" gets escaped in comments to avoid XSS
1872 !! test
1873 IE conditional comments
1874 !! wikitext
1875 <!--[if lt IE 9]>
1876 <script>alert('hi');</script>
1877 <![endif]-->
1878 !! html/parsoid
1879 <!--[if lt IE 9]&#x3E;
1880 <script&#x3E;alert('hi');</script&#x3E;
1881 <![endif]-->
1882 !! end
1883
1884 ###
1885 ### paragraph wrapping tests
1886 ###
1887 !! test
1888 No block tags
1889 !! wikitext
1890 a
1891
1892 b
1893 !! html
1894 <p>a
1895 </p><p>b
1896 </p>
1897 !! end
1898
1899 !! test
1900 Block tag on one line (<div>)
1901 !! wikitext
1902 a <div>foo</div>
1903
1904 b
1905 !! html
1906 a <div>foo</div>
1907 <p>b
1908 </p>
1909 !! html+tidy
1910 <p>a</p>
1911 <div>foo</div>
1912 <p>b</p>
1913 !! end
1914
1915 !! test
1916 Block tag on one line (<blockquote>)
1917 !! wikitext
1918 a <blockquote>foo</blockquote>
1919
1920 b
1921 !! html
1922 a <blockquote>foo</blockquote>
1923 <p>b
1924 </p>
1925 !! html+tidy
1926 <p>a</p>
1927 <blockquote>
1928 <p>foo</p>
1929 </blockquote>
1930 <p>b</p>
1931 !! end
1932
1933 !! test
1934 Block tag on both lines (<div>)
1935 !! wikitext
1936 a <div>foo</div>
1937
1938 b <div>foo</div>
1939 !! html
1940 a <div>foo</div>
1941 b <div>foo</div>
1942
1943 !! html+tidy
1944 <p>a</p>
1945 <div>foo</div>
1946 <p>b</p>
1947 <div>foo</div>
1948 !! end
1949
1950 !! test
1951 Block tag on both lines (<blockquote>)
1952 !! wikitext
1953 a <blockquote>foo</blockquote>
1954
1955 b <blockquote>foo</blockquote>
1956 !! html
1957 a <blockquote>foo</blockquote>
1958 b <blockquote>foo</blockquote>
1959
1960 !! html+tidy
1961 <p>a</p>
1962 <blockquote>
1963 <p>foo</p>
1964 </blockquote>
1965 <p>b</p>
1966 <blockquote>
1967 <p>foo</p>
1968 </blockquote>
1969 !! end
1970
1971 !! test
1972 Multiple lines without block tags
1973 !! wikitext
1974 <div>foo</div> a
1975 b
1976 c
1977 d<!--foo--> e
1978 x <div>foo</div> z
1979 !! html
1980 <div>foo</div> a
1981 <p>b
1982 c
1983 d e
1984 </p>
1985 x <div>foo</div> z
1986
1987 !! html+tidy
1988 <div>foo</div>
1989 <p>a</p>
1990 <p>b c d e</p>
1991 <p>x</p>
1992 <div>foo</div>
1993 <p>z</p>
1994 !! end
1995
1996 # Tidy strips out the empty <div> tags. Parsoid doesn't.
1997 # So, we have a separate section for Parsoid. We don't want
1998 # to mimic this stripping behavior in Parsoid. It affects
1999 # editing experience and also requires us to maintain additional
2000 # info for RT-ing.
2001 !! test
2002 Empty lines between lines with block tags
2003 !! wikitext
2004 <div></div>
2005
2006
2007 <div></div>a
2008
2009 b
2010 <div>a</div>b
2011
2012 <div>b</div>d
2013
2014
2015 <div>e</div>
2016 !! html
2017 <div></div>
2018 <p><br />
2019 </p>
2020 <div></div>a
2021 <p>b
2022 </p>
2023 <div>a</div>b
2024 <div>b</div>d
2025 <p><br />
2026 </p>
2027 <div>e</div>
2028
2029 !! html+tidy
2030 <p><br /></p>
2031 <p>a</p>
2032 <p>b</p>
2033 <div>a</div>
2034 <p>b</p>
2035 <div>b</div>
2036 <p>d</p>
2037 <p><br /></p>
2038 <div>e</div>
2039 !! html/parsoid
2040 <div data-parsoid='{"stx":"html"}'></div>
2041
2042 <p><br /></p>
2043 <div data-parsoid='{"stx":"html"}'></div><p>a</p>
2044
2045 <p>b</p>
2046 <div data-parsoid='{"stx":"html"}'>a</div><p>b</p>
2047
2048 <div data-parsoid='{"stx":"html"}'>b</div><p>d</p>
2049
2050 <p><br /></p>
2051 <div data-parsoid='{"stx":"html"}'>e</div>
2052 !! end
2053
2054 ## PHP parser emits output which is broken
2055 !! test
2056 Unclosed HTML p-tags should be handled properly
2057 !! wikitext
2058 <div><p>foo</div>
2059 a
2060
2061 b
2062 !! html/php+tidy
2063 <div>
2064 <p>foo</p>
2065 </div>
2066 <p>a</p>
2067 <p>b</p>
2068 !! html/parsoid
2069 <div data-parsoid='{"stx":"html"}'><p data-parsoid='{"stx":"html", "autoInsertedEnd":true}'>foo</p></div>
2070 <p>a</p>
2071 <p>b</p>
2072 !! end
2073
2074 ## SSS FIXME: I can come up with other scenarios where this doesn't work because
2075 ## of eager output of buffered tokens in the p-wrapper. But, I'm going to ignore
2076 ## them for now.
2077 !! test
2078 1. P-wrapping should leave sol-transparent tags outside p-tags where possible
2079 !! options
2080 parsoid=wt2html
2081 !! wikitext
2082 a [[Category:A1]] [[Category:A2]]
2083 [[Category:A3]]
2084 [[Category:A4]]
2085 !! html/parsoid
2086 <p>a</p>
2087 <link rel="mw:PageProp/Category" href="./Category:A1"/> <link rel="mw:PageProp/Category" href="./Category:A2"/> <link rel="mw:PageProp/Category" href="./Category:A3"/> <link rel="mw:PageProp/Category" href="./Category:A4"/>
2088 !! end
2089
2090 !! test
2091 2. P-wrapping should leave sol-transparent tags outside p-tags where possible
2092 !! options
2093 parsoid=wt2html
2094 !! wikitext
2095 [[Category:A1]]a
2096 !! html/parsoid
2097 <link rel="mw:PageProp/Category" href="./Category:A1"/><p>a</p>
2098 !! end
2099
2100 ###
2101 ### Preformatted text
2102 ###
2103 !! test
2104 Preformatted text
2105 !! wikitext
2106 This is some
2107 Preformatted text
2108 With ''italic''
2109 And '''bold'''
2110 And a [[Main Page|link]]
2111 !! html
2112 <pre>This is some
2113 Preformatted text
2114 With <i>italic</i>
2115 And <b>bold</b>
2116 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
2117 </pre>
2118 !! end
2119
2120 !! test
2121 Tabs don't trigger preformatted text
2122 !! wikitext
2123 This is not
2124 preformatted text.
2125 This is preformatted text.
2126 So is this.
2127 !! html/php
2128 <p> This is not
2129 preformatted text.
2130 </p>
2131 <pre>This is preformatted text.
2132 So is this.
2133 </pre>
2134 !! html/parsoid
2135 <p> This is not
2136 preformatted text.</p>
2137 <pre>This is preformatted text.
2138 So is this.</pre>
2139 !! end
2140
2141 !! test
2142 Space before tab needs nowiki pre protection
2143 !! options
2144 parsoid=html2wt
2145 !! html/parsoid
2146 <p> a</p>
2147 !! wikitext
2148 <nowiki> </nowiki> a
2149 !! end
2150
2151 !! test
2152 Ident preformatting with inline content
2153 !! wikitext
2154 a
2155 ''b''
2156 !! html
2157 <pre>a
2158 <i>b</i>
2159 </pre>
2160 !! end
2161
2162 !! test
2163 <pre> with <nowiki> inside (compatibility with 1.6 and earlier)
2164 !! wikitext
2165 <pre><nowiki>
2166 <b>
2167 <cite>
2168 <em>
2169 </nowiki></pre>
2170 !! html
2171 <pre>
2172 &lt;b&gt;
2173 &lt;cite&gt;
2174 &lt;em&gt;
2175 </pre>
2176
2177 !! end
2178
2179 !! test
2180 Regression with preformatted in <center>
2181 !! wikitext
2182 <center>
2183 Blah
2184 </center>
2185 !! html
2186 <center>
2187 <pre>Blah
2188 </pre>
2189 </center>
2190
2191 !! end
2192
2193 !! test
2194 T54763: Preformatted in <blockquote>
2195 !! wikitext
2196 <blockquote>
2197 Blah
2198 {|
2199 |
2200 indented cell (no pre-wrapping!)
2201 |}
2202 </blockquote>
2203 !! html
2204 <blockquote>
2205 <p> Blah
2206 </p>
2207 <table>
2208 <tr>
2209 <td>
2210 <p> indented cell (no pre-wrapping!)
2211 </p>
2212 </td></tr></table>
2213 </blockquote>
2214
2215 !! end
2216
2217 !! test
2218 T53086: Double newlines in blockquotes should be turned into paragraphs
2219 !! wikitext
2220 <blockquote>
2221 Foo
2222
2223 Bar
2224 </blockquote>
2225 !! html
2226 <blockquote>
2227 <p>Foo
2228 </p><p>Bar
2229 </p>
2230 </blockquote>
2231
2232 !! end
2233
2234 !! test
2235 T17491: <ins>/<del> in blockquote
2236 !! wikitext
2237 <blockquote>
2238 Foo <del>bar</del> <ins>baz</ins> quux
2239 </blockquote>
2240 !! html
2241 <blockquote>
2242 <p>Foo <del>bar</del> <ins>baz</ins> quux
2243 </p>
2244 </blockquote>
2245
2246 !! end
2247
2248 # Note that the p-wrapping is newline sensitive, which could be
2249 # considered a bug: tidy will wrap only the 'Foo' in the example
2250 # below in a <p> tag. (see comment 23-25 of T8200)
2251 !! test
2252 T17491: <ins>/<del> in blockquote (2)
2253 !! wikitext
2254 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
2255 </blockquote>
2256 !! html
2257 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
2258 </blockquote>
2259
2260 !! html+tidy
2261 <blockquote>
2262 <p>Foo</p>
2263 <del>bar</del> <ins>baz</ins> quux</blockquote>
2264 !! end
2265
2266 !! test
2267 <pre> with attributes (T5202)
2268 !! wikitext
2269 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
2270 !! html
2271 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
2272
2273 !! end
2274
2275 !! test
2276 <pre> with width attribute (T5202)
2277 !! wikitext
2278 <pre width="8">Narrow screen goodies</pre>
2279 !! html
2280 <pre width="8">Narrow screen goodies</pre>
2281
2282 !! end
2283
2284 !! test
2285 <pre> with forbidden attribute (T5202)
2286 !! wikitext
2287 <pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
2288 !! html
2289 <pre width="8">Narrow screen goodies</pre>
2290
2291 !! end
2292
2293 !! test
2294 Entities inside <pre>
2295 !! wikitext
2296 <pre>&lt;</pre>
2297 !! html
2298 <pre>&lt;</pre>
2299
2300 !! end
2301
2302 !! test
2303 <pre> with forbidden attribute values (T5202)
2304 !! wikitext
2305 <pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
2306 !! html
2307 <pre width="8" style="/* insecure input */">Narrow screen goodies</pre>
2308
2309 !! end
2310
2311 !! test
2312 <nowiki> inside <pre> (T15238)
2313 !! wikitext
2314 <pre>
2315 <nowiki>
2316 </pre>
2317 <pre>
2318 <nowiki></nowiki>
2319 </pre>
2320 <pre><nowiki><nowiki></nowiki>Foo<nowiki></nowiki></nowiki></pre>
2321 !! html
2322 <pre>
2323 &lt;nowiki&gt;
2324 </pre>
2325 <pre>
2326
2327 </pre>
2328 <pre>&lt;nowiki&gt;Foo&lt;/nowiki&gt;</pre>
2329
2330 !! end
2331
2332 !! test
2333 <nowiki> inside of #tag:pre
2334 !! wikitext
2335 {{#tag:pre|Foo <nowiki>&rarr;bar</nowiki>}}
2336 !! html/php
2337 <pre>Foo &#8594;bar</pre>
2338
2339 !! html/parsoid
2340 <pre about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"#tag:pre","function":"tag"},"params":{"1":{"wt":"Foo &lt;nowiki>&amp;rarr;bar&lt;/nowiki>"}},"i":0}}]}'>Foo <span typeof="mw:Entity">→</span>bar</pre>
2341 !! end
2342
2343 ## Don't expect this to rt, Parsoid drops the unmatched closing pre tags that
2344 ## aren't enclosed in nowikis.
2345 !! test
2346 <nowiki> and <pre> preference (first one wins)
2347 !! options
2348 parsoid=wt2html
2349 !! wikitext
2350 <pre>
2351 <nowiki>
2352 </pre>
2353 </nowiki>
2354 </pre>
2355
2356 <nowiki>
2357 <pre>
2358 <nowiki>
2359 </pre>
2360 </nowiki>
2361 </pre>
2362
2363 !! html/php
2364 <pre>
2365 &lt;nowiki&gt;
2366 </pre>
2367 <p>&lt;/nowiki&gt;
2368 &lt;/pre&gt;
2369 </p><p>
2370 &lt;pre&gt;
2371 &lt;nowiki&gt;
2372 &lt;/pre&gt;
2373
2374 &lt;/pre&gt;
2375 </p>
2376 !! html/parsoid
2377 <pre typeof="mw:Extension/pre" about="#mwt2" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\n&lt;nowiki>\n"}}'>&lt;nowiki>
2378 </pre>
2379 <p>&lt;/nowiki></p>
2380
2381
2382 <p><span typeof="mw:Nowiki">
2383 &lt;pre>
2384 &lt;nowiki>
2385 &lt;/pre>
2386 </span></p>
2387 !! end
2388
2389 !! test
2390 </pre> inside nowiki
2391 !! wikitext
2392 <nowiki></pre></nowiki>
2393 !! html
2394 <p>&lt;/pre&gt;
2395 </p>
2396 !! end
2397
2398 # Parsoid doesn't strip empty tags, like Tidy does.
2399 !! test
2400 Empty pre; pre inside other HTML tags (T56946)
2401 !! wikitext
2402 a
2403
2404 <div><pre>
2405 foo
2406 </pre></div>
2407 <pre></pre>
2408 !! html/php
2409 <p>a
2410 </p>
2411 <div><pre>
2412 foo
2413 </pre></div>
2414 <pre></pre>
2415
2416 !! html/php+tidy
2417 <p>a</p>
2418 <div>
2419 <pre>
2420 foo
2421 </pre></div>
2422 !! html/parsoid
2423 <p>a</p>
2424
2425 <div data-parsoid='{"stx":"html"}'><pre typeof="mw:Extension/pre" about="#mwt2" data-parsoid='{"stx":"html"}' data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\nfoo\n"}}'>foo
2426 </pre></div>
2427 <pre typeof="mw:Extension/pre" about="#mwt4" data-parsoid='{"stx":"html"}' data-mw='{"name":"pre","attrs":{},"body":{"extsrc":""}}'></pre>
2428 !! end
2429
2430 !! test
2431 HTML pre followed by indent-pre
2432 !! wikitext
2433 <pre>foo</pre>
2434 bar
2435 !! html
2436 <pre>foo</pre>
2437 <pre>bar
2438 </pre>
2439 !! end
2440
2441 # Note that tidy removes the empty <p> tags from the start and end.
2442 # Parsoid does not, by design.
2443 !! test
2444 Block tag pre
2445 !! wikitext
2446 <p><pre>foo</pre></p>
2447 !! html/php+tidy
2448 <pre>
2449 foo
2450 </pre>
2451 !! html/parsoid
2452 <p class='mw-empty-elt' data-parsoid='{"stx":"html","autoInsertedEnd":true}'></p><pre typeof="mw:Extension/pre" about="#mwt2" data-parsoid='{"stx":"html"}' data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"foo"}}'>foo</pre><p class='mw-empty-elt' data-parsoid='{"autoInsertedStart":true,"stx":"html"}'></p>
2453 !! end
2454
2455 !!test
2456 Templates: Indent-Pre: 1a. Templates that break a line should suppress <pre>
2457 !! wikitext
2458 {{echo|}}
2459 !! html
2460
2461 !!end
2462
2463 !!test
2464 Templates: Indent-Pre: 1b. Templates that break a line should suppress <pre>
2465 !! wikitext
2466 {{echo|
2467 foo}}
2468 !! html
2469 <p>foo
2470 </p>
2471 !!end
2472
2473 !! test
2474 Templates: Indent-Pre: 1c: Wrapping should be based on expanded content
2475 !! wikitext
2476 {{echo|a
2477 b}}
2478 !! html
2479 <pre>a
2480 </pre>
2481 <p>b
2482 </p>
2483 !!end
2484
2485 !! test
2486 Templates: Indent-Pre: 1d: Wrapping should be based on expanded content
2487 !! wikitext
2488 {{echo|a
2489 b
2490 c
2491 d
2492 e
2493 }}
2494 !! html
2495 <pre>a
2496 </pre>
2497 <p>b
2498 c
2499 </p>
2500 <pre>d
2501 </pre>
2502 <p>e
2503 </p>
2504 !!end
2505
2506 !!test
2507 Templates: Indent-Pre: 1e. Wrapping should be based on expanded content
2508 !! wikitext
2509 {{echo| foo}}
2510
2511 {{echo| foo}}{{echo| bar}}
2512
2513 {{echo| foo}}
2514 {{echo| bar}}
2515
2516 {{echo|<!--cmt--> foo}}
2517
2518 <!--cmt-->{{echo| foo}}
2519
2520 {{echo|{{echo| }}bar}}
2521 !! html
2522 <pre>foo
2523 </pre>
2524 <pre>foo bar
2525 </pre>
2526 <pre>foo
2527 bar
2528 </pre>
2529 <pre>foo
2530 </pre>
2531 <pre>foo
2532 </pre>
2533 <pre>bar
2534 </pre>
2535 !!end
2536
2537 !! test
2538 Templates: Indent-Pre: 1f: Wrapping should be based on expanded content
2539 !! wikitext
2540 {{echo| }}a
2541
2542 {{echo|
2543 }}a
2544
2545 {{echo|
2546 b}}
2547
2548 {{echo|a
2549 }}b
2550
2551 {{echo|a
2552 }} b
2553 !! html
2554 <pre>a
2555 </pre>
2556 <p><br />
2557 </p>
2558 <pre>a
2559 </pre>
2560 <p><br />
2561 </p>
2562 <pre>b
2563 </pre>
2564 <p>a
2565 </p>
2566 <pre>b
2567 </pre>
2568 <p>a
2569 </p>
2570 <pre>b
2571 </pre>
2572 !!end
2573
2574 ## Hmm, should Parsoid rt this?
2575 !! test
2576 Pres with newline attributes
2577 !! options
2578 parsoid=wt2html,html2html
2579 !! wikitext
2580 <pre class="one
2581 two">hi</pre>
2582 !! html/php
2583 <pre class="one two">hi</pre>
2584
2585 !! html/parsoid
2586 <pre typeof="mw:Extension/pre" about="#mwt2" class="one two" data-mw='{"name":"pre","attrs":{"class":"one two"},"body":{"extsrc":"hi"}}'>hi</pre>
2587 !! end
2588
2589 !! test
2590 Things that look like <pre> tags aren't treated as such
2591 !! wikitext
2592 Barack Obama <President> of the United States
2593 <President></President>
2594 !! html
2595 <p>Barack Obama &lt;President&gt; of the United States
2596 &lt;President&gt;&lt;/President&gt;
2597 </p>
2598 !! end
2599
2600 !! test
2601 Handle broken pre-like tags (T66025)
2602 !! options
2603 parsoid=wt2html
2604 !! wikitext
2605 {{echo|<pre <pre>x</pre>}}
2606
2607 <table><pre </table>
2608 !! html/php
2609 <pre>x</pre>
2610 <table>&lt;pre </table>
2611
2612 !! html/php+tidy
2613 <pre>
2614 x
2615 </pre>
2616 <p>&lt;pre</p>
2617 !! html/parsoid
2618 <pre about="#mwt1" typeof="mw:Transclusion mw:Extension/pre" data-parsoid='{"a":{"&lt;pre":null},"sa":{"&lt;pre":""},"stx":"html","pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;pre &lt;pre>x&lt;/pre>"}},"i":0}}]}'>x</pre>
2619
2620
2621 <p>&lt;pre </p>
2622
2623 <table></table>
2624 !! end
2625
2626 !! test
2627 Parsoid: handle pre with space after attribute
2628 !! options
2629 parsoid=wt2html
2630 !! wikitext
2631 <pre style="width:50%;" >{{echo|foo}}</pre>
2632 !! html/php
2633 <pre style="width:50%;">{{echo|foo}}</pre>
2634
2635 !! html/parsoid
2636 <pre typeof="mw:Extension/pre" about="#mwt2" style="width:50%;" data-mw='{"name":"pre","attrs":{"style":"width:50%;"},"body":{"extsrc":"{{echo|foo}}"}}'>{{echo|foo}}</pre>
2637 !! end
2638
2639 # TODO / maybe: fix wt2wt for this
2640 !! test
2641 Parsoid: Don't paragraph-wrap fosterable content
2642 !! options
2643 parsoid=wt2html
2644 !! wikitext
2645 {|
2646 <td></td>
2647 <td></td>
2648
2649
2650
2651 |}
2652 !! html
2653 <table>
2654
2655 <tbody>
2656 <tr>
2657 <td></td>
2658
2659 <td></td></tr>
2660
2661
2662
2663 </tbody></table>
2664 !! end
2665
2666 !! test
2667 Parsoid: Don't paragraph-wrap fosterable content even if table syntax is unbalanced
2668 !! options
2669 parsoid=wt2html
2670 !! wikitext
2671 {|
2672 <td>
2673 <td>
2674 </td>
2675
2676
2677
2678 |}
2679 !! html
2680 <table>
2681
2682 <tbody>
2683 <tr>
2684 <td></td>
2685
2686 <td>
2687 </td></tr>
2688
2689
2690
2691 </tbody></table>
2692 !! end
2693
2694
2695 #--------------------------------------------------------------------
2696 # Transclusion parameter whitespace stripping tests
2697 # Behavior is different for positional and named parameters
2698 #--------------------------------------------------------------------
2699 !! test
2700 Templates: Strip leading and trailing whitespace from named-param values
2701 !! wikitext
2702 {{echo|1= a }}
2703
2704 {{echo|1= {{echo|b}} }}
2705
2706 {{echo| 1 =
2707 c }}
2708
2709 {{echo| 1 =
2710 * d
2711 }}
2712 !! html
2713 <p>a
2714 </p><p>b
2715 </p><p>c
2716 </p>
2717 <ul><li> d</li></ul>
2718
2719 !! end
2720
2721 !! test
2722 Templates: Don't strip whitespace from positional-param values
2723 !! wikitext
2724 {{echo|a }}
2725
2726 {{echo|{{echo|b}} }}
2727
2728 {{echo| c
2729 }}
2730
2731 {{echo| {{echo|d}}
2732 }}
2733
2734 {{echo|
2735 e}}
2736
2737 {{echo|
2738 * f}}
2739
2740 {{echo|
2741 }}g
2742 !! html
2743 <p>a
2744 </p><p>b
2745 </p>
2746 <pre>c
2747 </pre>
2748 <p><br />
2749 </p>
2750 <pre>d
2751 </pre>
2752 <p><br />
2753 </p>
2754 <pre>e
2755 </pre>
2756 <p><br />
2757 </p>
2758 <ul><li> f</li></ul>
2759 <p><br />
2760 </p>
2761 <pre>g
2762 </pre>
2763 !! end
2764
2765 !! test
2766 Templates: Don't recognize targets split by newlines
2767 !! options
2768 parsoid=wt2html
2769 !! wikitext
2770 {{ech
2771 o|foo}}
2772 !! html/php
2773 <p>{{ech
2774 o|foo}}
2775 </p>
2776 !! html/parsoid
2777 <p>{{ech
2778 o|foo}}</p>
2779 !! end
2780
2781 !! test
2782 Templates: Recognize targets when newlines and comments don't split the target
2783 !! options
2784 parsoid=wt2html
2785 !! wikitext
2786 {{
2787 <!--X--> ech<!--X-->o<!--X-->
2788 <!--X--> <!--X-->
2789
2790 |foo}}
2791 !! html/php
2792 <p>foo
2793 </p>
2794 !! html/parsoid
2795 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"ech&lt;!--X-->o&lt;!--X--> \n &lt;!--X--> &lt;!--X-->\n\n ","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2796 !! end
2797
2798 !! test
2799 Templates: Handle empty comment-and-ws-only lines correctly
2800 !! wikitext
2801 {{echo|foo
2802 <!--should be ignored-->
2803 <!--should be ignored as well-->
2804 bar}}
2805 !! html/php
2806 <p>foo
2807 bar
2808 </p>
2809 !! html/parsoid
2810 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo\n&lt;!--should be ignored-->\n &lt;!--should be ignored as well-->\nbar"}},"i":0}}]}'>foo <!--should be ignored--> <!--should be ignored as well--> bar</p>
2811 !! end
2812
2813 !! test
2814 Templates: Handle comments in the target
2815 !! wikitext
2816 {{echo
2817 <!-- should be ignored -->
2818 |foo}}
2819
2820 {{echo
2821 <!-- should be ignored and spaces on next line should not trip us up (T147742) -->
2822 |foo}}
2823
2824 {{echo<!-- should be ignored -->
2825 |foo}}
2826
2827 {{echo<!-- should be ignored -->|foo}}
2828
2829 {{<!-- should be ignored -->echo|foo}}
2830 !! html/php
2831 <p>foo
2832 </p><p>foo
2833 </p><p>foo
2834 </p><p>foo
2835 </p><p>foo
2836 </p>
2837 !! html/parsoid
2838 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo\n&lt;!-- should be ignored -->\n","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2839
2840 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo\n&lt;!-- should be ignored and spaces on next line should not trip us up (T147742) -->\n ","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2841
2842 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo&lt;!-- should be ignored -->\n","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2843
2844 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo&lt;!-- should be ignored -->","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2845
2846 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2847 !! end
2848
2849 !! test
2850 Templates: Handle comments in parameter names (T69657)
2851 !! wikitext
2852 {{echo|1
2853 <!-- should be ignored -->
2854 =foo}}
2855
2856 {{echo|
2857 <!-- should be ignored -->
2858 1 = foo}}
2859
2860 {{echo|1<!-- should be ignored -->=foo}}
2861
2862 {{echo|<!-- should be ignored -->1=foo}}
2863 !! html/php
2864 <p>foo
2865 </p><p>foo
2866 </p><p>foo
2867 </p><p>foo
2868 </p>
2869 !! html/parsoid
2870 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo","key":{"wt":"1\n&lt;!-- should be ignored -->"}}},"i":0}}]}'>foo</p>
2871
2872 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo","key":{"wt":"&lt;!-- should be ignored -->\n1"}}},"i":0}}]}'>foo</p>
2873
2874 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo","key":{"wt":"1&lt;!-- should be ignored -->"}}},"i":0}}]}'>foo</p>
2875
2876 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo","key":{"wt":"&lt;!-- should be ignored -->1"}}},"i":0}}]}'>foo</p>
2877 !! end
2878
2879 !! test
2880 Templates: Other wikitext in parameter names (T69657)
2881 !! wikitext
2882 {{echo|''1''=foo}}
2883 !! html/php
2884 <p>{{{1}}}
2885 </p>
2886 !! html/parsoid
2887 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"&#39;&#39;1&#39;&#39;":{"wt":"foo"}},"i":0}}]}'>{{{1}}}</p>
2888 !! end
2889
2890 !! test
2891 Templates: With colons
2892 !! wikitext
2893 {{With: Colon}}
2894 !! html/php
2895 <p>Template with colon
2896 </p>
2897 !! html/parsoid
2898 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"With: Colon","href":"./Template:With:_Colon"},"params":{},"i":0}}]}'>Template with colon</p>
2899 !! end
2900
2901 #--------------------------------------------------------------------
2902 # Transclusion parameter escaping tests
2903 #--------------------------------------------------------------------
2904
2905 !! test
2906 Templates: Parsoid parameter escaping test 1
2907 !! wikitext
2908 {{echo|[foo]|{{echo|[bar]}}}}
2909 !! html/php+tidy
2910 <p>[foo]</p>
2911 !! html/parsoid
2912 <p about="#mwt1" typeof="mw:Transclusion"
2913 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[foo]"},"2":{"wt":"{{echo|[bar]}}"}},"i":0}}]}'>[foo]</p>
2914 !! end
2915
2916 !! test
2917 Parsoid: Pipes in external links in template parameter
2918 !! wikitext
2919 {{echo|[{{echo|http://example.com}} link]}}
2920 !! html/php+tidy
2921 <p><a rel="nofollow" class="external text" href="http://example.com">link</a></p>
2922 !! html/parsoid
2923 <p><a rel="mw:ExtLink" href="http://example.com" about="#mwt31" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[{{echo|http://example.com}} link]"}},"i":0}}]}'>link</a></p>
2924 !! end
2925
2926 !! test
2927 Parsoid: pipe in transclusion parameter
2928 !! wikitext
2929 {{echo|http://foo.com/a&#124;b}}
2930 !! html/php+tidy
2931 <p><a rel="nofollow" class="external free" href="http://foo.com/a%7Cb">http://foo.com/a%7Cb</a></p>
2932 !! html/parsoid
2933 <p><a rel="mw:ExtLink" href="http://foo.com/a%7Cb" about="#mwt1"
2934 typeof="mw:Transclusion"
2935 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"http://foo.com/a&amp;#124;b"}},"i":0}}]}'>http://foo.com/a%7Cb</a></p>
2936 !! end
2937
2938 !! test
2939 Parsoid: Pipe in external link target and content in template parameter
2940 !! options
2941 parsoid=html2wt,wt2wt
2942 !! wikitext
2943 {{echo|[http://foo.com/a&#124;b a&#124;b]}}
2944 !! html/php+tidy
2945 <p><a rel="nofollow" class="external text" href="http://foo.com/a%7Cb">a|b</a></p>
2946 !! html/parsoid
2947 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2948 typeof="mw:Transclusion"
2949 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},
2950 "params":{"1":{"wt":"[http://foo.com/a|b a|b]"}},"i":0}}]}'>a|b</a></p>
2951 !! end
2952
2953 !! test
2954 Parsoid: Pipe in template with nested template in external link target in template parameter (seriously)
2955 !! options
2956 parsoid
2957 !! wikitext
2958 {{echo|[{{fullurl:{{FULLPAGENAME}}|action=edit}} bar]}}
2959 !! html
2960 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[{{fullurl:{{FULLPAGENAME}}|action=edit}} bar]"}},"i":0}}]}'>[Main Page bar]</p>
2961 !! end
2962
2963 !! test
2964 Templates: Don't escape already nowiki-escaped text in template parameters
2965 !! options
2966 parsoid=html2wt,wt2wt
2967 !! wikitext
2968 {{echo|foo<nowiki>|</nowiki>bar}}
2969 {{echo|<nowiki>&lt;div&gt;</nowiki>}}
2970 {{echo|<nowiki></nowiki>}}
2971 !! html/php+tidy
2972 <p>foo|bar &lt;div&gt;</p>
2973 !! html/parsoid
2974 <p><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo<nowiki>|</nowiki>bar"}},"i":0}}]}'}'>foo</span><span typeof="mw:Nowiki" about="#mwt1">|</span><span about="#mwt1">bar</span>
2975 <span typeof="mw:Transclusion mw:Nowiki" about="#mwt2" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<nowiki>&amp;lt;div&amp;gt;</nowiki>"}},"i":0}}]}'><span typeof="mw:Entity">&lt;</span>div<span typeof="mw:Entity">&gt;</span></span>
2976 <span typeof="mw:Transclusion mw:Nowiki" about="#mwt3" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<nowiki></nowiki>"}},"i":0}}]}'></span>
2977 </p>
2978 !! end
2979
2980 ## T54824
2981 !! test
2982 Templates: '=' char in nested transclusions should not trigger nowiki escapes or conversion to named param
2983 !! options
2984 parsoid=html2wt,wt2wt
2985 !! wikitext
2986 {{echo|{{echo|1=bar}}}}
2987 !! html/php+tidy
2988 <p>bar</p>
2989 !! html/parsoid
2990 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"{{echo|1=bar}}"}},"i":0}}]}'>bar</p>
2991 !! end
2992
2993 ## T58733
2994 !! test
2995 Templates parameters with special tokenizing behavior dont get modified because of arg escaping
2996 !! wikitext
2997 {{echo|a : b}}
2998 !! html/php+tidy
2999 <p>a&#160;: b</p>
3000 !! html/parsoid
3001 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a : b"}},"i":0}}]}'>a<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"isDisplayHack":true}'> </span>: b</p>
3002 !! end
3003
3004 ## T73412
3005 !! test
3006 Templates: Preserve blank parameter names
3007 !! wikitext
3008 {{echo|=foo}}
3009 !! html/php+tidy
3010 <p>{{{1}}}</p>
3011 !! html/parsoid
3012 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"":{"wt":"foo"}},"i":0}}]}'>{{{1}}}</p>
3013 !! end
3014
3015 !! test
3016 Templates: Preserve blank parameter names in other positions
3017 !! wikitext
3018 {{blank_param|bar|=foo}}
3019 !! html/php+tidy
3020 <p>bar foo</p>
3021 !! html/parsoid
3022 <p about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"},{"k":"","named":true}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"blank_param","href":"./Template:Blank_param"},"params":{"1":{"wt":"bar"},"":{"wt":"foo"}},"i":0}}]}'>bar
3023 foo</p>
3024 !! end
3025
3026 ###
3027 ### Parsoid-centric tests for testing RT edge cases for pre
3028 ###
3029
3030 !!test
3031 1a. Indent-Pre and Comments
3032 !! wikitext
3033 a
3034 <!--a-->
3035 c
3036 !! html
3037 <pre>a
3038 </pre>
3039 <p>c
3040 </p>
3041 !!end
3042
3043 !!test
3044 1b. Indent-Pre and Comments
3045 !! wikitext
3046 a
3047 <!--a-->
3048 c
3049 !! html
3050 <pre>a
3051 </pre>
3052 <p>c
3053 </p>
3054 !!end
3055
3056 !!test
3057 1c. Indent-Pre and Comments
3058 !! wikitext
3059 <!--a--> a
3060
3061 <!--a--> a
3062 !! html
3063 <pre> a
3064 </pre>
3065 <pre> a
3066 </pre>
3067 !!end
3068
3069 !!test
3070 1d. Indent-Pre and Comments
3071 (Pre-handler currently cannot distinguish between comment/ws order and normalizes them to [comment,ws] order)
3072 !! wikitext
3073 <!--a--> a
3074
3075 <!--b-->b
3076 !! html
3077 <pre>a
3078 </pre>
3079 <pre>b
3080 </pre>
3081 !!end
3082
3083 !!test
3084 2a. Indent-Pre and tables
3085 !! wikitext
3086 {|
3087 |-
3088 !h1!!h2
3089 |foo||bar
3090 |}
3091 !! html
3092 <table>
3093
3094 <tr>
3095 <th>h1</th>
3096 <th>h2
3097 </th>
3098 <td>foo</td>
3099 <td>bar
3100 </td></tr></table>
3101
3102 !!end
3103
3104 !!test
3105 2b. Indent-Pre and tables
3106 !! wikitext
3107 {|
3108 |-
3109 |foo
3110 |}
3111 !! html
3112 <table>
3113
3114 <tr>
3115 <td>foo
3116 </td></tr></table>
3117
3118 !!end
3119
3120 !!test
3121 2c. Indent-Pre and tables (T44252)
3122 !! wikitext
3123 {|
3124 |+ foo
3125 ! | bar
3126 |}
3127 !! html
3128 <table>
3129 <caption> foo
3130 </caption>
3131 <tr>
3132 <th> bar
3133 </th></tr></table>
3134
3135 !!end
3136
3137 !!test
3138 2d. Indent-Pre and tables
3139 !! wikitext
3140 a
3141 {|
3142 | b
3143 |}
3144 !! html/php
3145 <pre>a
3146 </pre>
3147 <table>
3148 <tr>
3149 <td> b
3150 </td></tr></table>
3151
3152 !! html/parsoid
3153 <pre>a</pre>
3154 <table>
3155 <tbody><tr><td> b</td></tr>
3156 </tbody></table>
3157 !!end
3158
3159 !!test
3160 2e. Indent-Pre and table-line syntax
3161 !! wikitext
3162 a
3163 | b
3164 | c
3165 !! html/php
3166 <pre>a
3167 | b
3168 | c
3169 </pre>
3170 !!end
3171
3172 !!test
3173 2f. Indent-pre started by table-line syntax
3174 !! wikitext
3175 a
3176 | b
3177 | c
3178 !! html/php
3179 <p>a
3180 </p>
3181 <pre>| b
3182 | c
3183 </pre>
3184 !! html/parsoid
3185 <p>a</p>
3186 <pre>
3187 | b
3188 | c</pre>
3189 !!end
3190
3191 !! test
3192 2g. Indented table markup mixed with indented pre content (proposed in T8200)
3193 !! wikitext
3194 <table>
3195 <tr>
3196 <td>
3197 Text that should be rendered preformatted
3198 </td>
3199 </tr>
3200 </table>
3201 !! html
3202 <table>
3203 <tr>
3204 <td>
3205 <pre>Text that should be rendered preformatted
3206 </pre>
3207 </td>
3208 </tr>
3209 </table>
3210
3211 !! end
3212
3213 !!test
3214 3a. Indent-Pre and block tags (single-line html)
3215 !! wikitext
3216 a <p> foo </p>
3217 b <div> foo </div>
3218 c <blockquote> foo </blockquote>
3219 <span> foo </span>
3220 !! html
3221 a <p> foo </p>
3222 b <div> foo </div>
3223 c <blockquote> foo </blockquote>
3224 <pre><span> foo </span>
3225 </pre>
3226 !! html/parsoid
3227 <p>a </p><p data-parsoid='{"stx":"html"}'> foo </p>
3228 <p>b </p><div data-parsoid='{"stx":"html"}'> foo </div>
3229 <p>c </p><blockquote data-parsoid='{"stx":"html"}'> foo </blockquote>
3230 <pre><span> foo </span>
3231 </pre>
3232 !! html+tidy
3233 <p>a</p>
3234 <p>foo</p>
3235 <p>b</p>
3236 <div>foo</div>
3237 <p>c</p>
3238 <blockquote>
3239 <p>foo</p>
3240 </blockquote>
3241 <pre>
3242 <span> foo </span>
3243 </pre>
3244 !! end
3245
3246 !!test
3247 3b. Indent-Pre and block tags (multi-line html)
3248 !! wikitext
3249 a <span>foo</span>
3250 b <div> foo </div>
3251 !! html
3252 <pre>a <span>foo</span>
3253 </pre>
3254 b <div> foo </div>
3255
3256 !! html/parsoid
3257 <pre>a <span data-parsoid='{"stx":"html"}'>foo</span></pre>
3258 b <div data-parsoid='{"stx":"html"}'> foo </div>
3259 !! html+tidy
3260 <pre>
3261 a <span>foo</span>
3262 </pre>
3263 <p>b</p>
3264 <div>foo</div>
3265 !!end
3266
3267 !!test
3268 3c. Indent-Pre and block tags (pre-content on separate line)
3269 !! wikitext
3270 <p>
3271 foo
3272 </p>
3273
3274 <div>
3275 foo
3276 </div>
3277
3278 <center>
3279 foo
3280 </center>
3281
3282 <blockquote>
3283 foo
3284 </blockquote>
3285
3286 <blockquote>
3287 <pre>
3288 foo
3289 </pre>
3290 </blockquote>
3291
3292 <table><tr><td>
3293 foo
3294 </td></tr></table>
3295
3296 <ul><li>
3297 foo
3298 </li></ul>
3299
3300 !! html
3301 <p>
3302 foo
3303 </p>
3304 <div>
3305 <pre>foo
3306 </pre>
3307 </div>
3308 <center>
3309 <pre>foo
3310 </pre>
3311 </center>
3312 <blockquote>
3313 <p> foo
3314 </p>
3315 </blockquote>
3316 <blockquote>
3317 <pre>
3318 foo
3319 </pre>
3320 </blockquote>
3321 <table><tr><td>
3322 <pre>foo
3323 </pre>
3324 </td></tr></table>
3325 <ul><li>
3326 foo
3327 </li></ul>
3328
3329 !!end
3330
3331 !! test
3332 4. Indent-Pre and extension tags
3333 !! wikitext
3334 a <tag />
3335 !! html/php
3336 a <pre>
3337 NULL
3338 array (
3339 )
3340 </pre>
3341
3342 !! html/parsoid
3343 a <pre typeof="mw:Extension/tag" about="#mwt2" data-parsoid='{}' data-mw='{"name":"tag","attrs":{},"body":null}'></pre>
3344 !! end
3345
3346 !! test
3347 5. Indent-Pre and html pre
3348 !! wikitext
3349 <pre class="123">hi</pre>
3350 !! html/php
3351 <pre class="123">hi</pre>
3352
3353 !! html/parsoid
3354 <pre typeof="mw:Extension/pre" about="#mwt2" class="123" data-mw='{"name":"pre","attrs":{"class":"123"},"body":{"extsrc":"hi"}}'>hi</pre>
3355 !! end
3356
3357 !!test
3358 Render paragraphs when indent-pre is suppressed in blocklevels
3359 !! wikitext
3360 <blockquote>
3361 foo
3362
3363 bar
3364 </blockquote>
3365 !! html
3366 <blockquote>
3367 <p> foo
3368 </p><p> bar
3369 </p>
3370 </blockquote>
3371
3372 !!end
3373
3374 !!test
3375 4. Multiple spaces at start-of-line
3376 !! wikitext
3377 <p> foo </p>
3378 foo
3379 {|
3380 |foo
3381 |}
3382 !! html
3383 <p> foo </p>
3384 <pre> foo
3385 </pre>
3386 <table>
3387 <tr>
3388 <td>foo
3389 </td></tr></table>
3390
3391 !!end
3392
3393 ## NOTE: the leading white-space chars on empty line are significant
3394 !! test
3395 5a. White-space in indent-pre
3396 !! wikitext
3397 a<br />
3398
3399 b
3400 !! html
3401 <pre>a<br />
3402
3403 b
3404 </pre>
3405 !! end
3406
3407 ## NOTE: the leading white-space chars on empty line are significant
3408 !! test
3409 5b. White-space in indent-pre
3410 !! wikitext
3411 a
3412
3413 b
3414
3415
3416 c
3417 !! html
3418 <pre>a
3419
3420 b
3421
3422
3423 c
3424 </pre>
3425 !! end
3426
3427 !! test
3428 5c. White-space in indent-pre
3429 !! wikitext
3430 ''a''
3431 ''b''
3432 ''c''
3433 !! html
3434 <pre><i>a</i>
3435 <i>b</i>
3436 <i>c</i>
3437 </pre>
3438 !! end
3439
3440 !! test
3441 6. Pre-blocks should extend across lines with leading WS even when there is no wrappable content
3442 !! wikitext
3443 a
3444
3445 <!-- continue -->
3446 b
3447
3448 c
3449
3450 d
3451 !! html
3452 <pre>a
3453
3454 b
3455 </pre>
3456 <pre>c
3457
3458 </pre>
3459 <p>d
3460 </p>
3461 !! end
3462
3463 !! test
3464 7a. Indent-pre and category links
3465 !! options
3466 parsoid=wt2html,wt2wt
3467 !! wikitext
3468 [[Category:foo]] <!-- No pre-wrapping -->
3469 {{echo| [[Category:foo]]}} <!-- No pre-wrapping -->
3470 !! html/php+tidy
3471 !! html/parsoid
3472 <link rel="mw:PageProp/Category" href="./Category:Foo"> <!-- No pre&#x2D;wrapping -->
3473 <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":" [[Category:foo]]"}},"i":0}}]}'> </span><link rel="mw:PageProp/Category" href="./Category:Foo" about="#mwt1"> <!-- No pre&#x2D;wrapping -->
3474 !! end
3475
3476 ## We used to, but no longer wt2wt this test since the default serializer
3477 ## will normalize all categories to serialize on their own line.
3478 ## This wikitext usage is going to be fairly uncommon in production and
3479 ## selser will take care of preserving formatting in those scenarios.
3480 !! test
3481 7b. Indent-pre and category links
3482 !! options
3483 parsoid=wt2html
3484 !! wikitext
3485 [[Category:foo]] a
3486 [[Category:foo]] {{echo|b}}
3487 !! html/parsoid
3488 <pre><link rel="mw:PageProp/Category" href="./Category:Foo"> a
3489 <link rel="mw:PageProp/Category" href="./Category:Foo"> <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"b"}},"i":0}}]}'>b</span></pre>
3490 !! end
3491
3492 !! test
3493 Indent-Pre: Newlines in comments shouldn't affect sol state
3494 !! wikitext
3495 a <!--
3496 foo
3497 --> b
3498 !! html/php+tidy
3499 <p>a b</p>
3500 !! html/parsoid
3501 <p>a <!--
3502 foo
3503 --> b</p>
3504 !! end
3505
3506 ###
3507 ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
3508 ###
3509
3510 !!test
3511 HTML-pre: 1. embedded newlines
3512 !! wikitext
3513 <pre>foo</pre>
3514
3515 <pre>
3516 foo
3517 </pre>
3518
3519 <pre>
3520
3521 foo
3522 </pre>
3523
3524 <pre>
3525
3526
3527 foo
3528 </pre>
3529 !! html/php+tidy
3530 <pre>
3531 foo
3532 </pre>
3533 <pre>
3534 foo
3535 </pre>
3536 <pre>
3537
3538 foo
3539 </pre>
3540 <pre>
3541
3542
3543 foo
3544 </pre>
3545 !! html/parsoid
3546 <pre typeof="mw:Extension/pre" about="#mwt2" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"foo"}}'>foo</pre>
3547
3548 <pre typeof="mw:Extension/pre" about="#mwt4" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\nfoo\n"}}'>foo
3549 </pre>
3550
3551 <pre typeof="mw:Extension/pre" about="#mwt6" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\n\nfoo\n"}}'>
3552
3553 foo
3554 </pre>
3555
3556 <pre typeof="mw:Extension/pre" about="#mwt8" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\n\n\nfoo\n"}}'>
3557
3558
3559 foo
3560 </pre>
3561 !!end
3562
3563 !! test
3564 HTML-pre: big spaces
3565 !! wikitext
3566 <pre>
3567
3568
3569
3570
3571 haha
3572
3573
3574
3575
3576 haha
3577
3578
3579
3580
3581 </pre>
3582 !! html/php+tidy
3583 <pre>
3584
3585
3586
3587
3588 haha
3589
3590
3591
3592
3593 haha
3594
3595
3596
3597
3598 </pre>
3599 !! html/parsoid
3600 <pre typeof="mw:Extension/pre" about="#mwt2" data-parsoid='{"stx":"html"}' data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\n\n\n\n\nhaha\n\n\n\n\nhaha\n\n\n\n\n"}}'>
3601
3602
3603
3604
3605 haha
3606
3607
3608
3609
3610 haha
3611
3612
3613
3614
3615 </pre>
3616 !! end
3617
3618 !!test
3619 HTML-pre: 2: indented text
3620 !! wikitext
3621 <pre>
3622 foo
3623 </pre>
3624 !! html
3625 <pre>
3626 foo
3627 </pre>
3628
3629 !!end
3630
3631 !!test
3632 HTML-pre: 3: other wikitext
3633 !! wikitext
3634 <pre>
3635 * foo
3636 # bar
3637 = no-h =
3638 '' no-italic ''
3639 [[ NoLink ]]
3640 </pre>
3641 !! html/php
3642 <pre>
3643 * foo
3644 # bar
3645 = no-h =
3646 '' no-italic ''
3647 [[ NoLink ]]
3648 </pre>
3649
3650 !! html/parsoid
3651 <pre typeof="mw:Extension/pre" about="#mwt2" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\n* foo\n# bar\n= no-h =\n&#39;&#39; no-italic &#39;&#39;\n[[ NoLink ]]\n"}}'>* foo
3652 # bar
3653 = no-h =
3654 '' no-italic ''
3655 [[ NoLink ]]
3656 </pre>
3657 !!end
3658
3659 ###
3660 ### Definition lists
3661 ###
3662 !! test
3663 Simple definition
3664 !! wikitext
3665 ; name : Definition
3666 !! html
3667 <dl><dt> name&#160;</dt>
3668 <dd> Definition</dd></dl>
3669
3670 !! end
3671
3672 !! test
3673 Definition list for indentation only
3674 !! wikitext
3675 : Indented text
3676 !! html
3677 <dl><dd> Indented text</dd></dl>
3678
3679 !! end
3680
3681 !! test
3682 Definition list with no space
3683 !! wikitext
3684 ;name:Definition
3685 !! html
3686 <dl><dt>name</dt>
3687 <dd>Definition</dd></dl>
3688
3689 !!end
3690
3691 !! test
3692 Definition list with URL link
3693 !! wikitext
3694 ; http://example.com/ : definition
3695 !! html
3696 <dl><dt> <a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&#160;</dt>
3697 <dd> definition</dd></dl>
3698
3699 !! end
3700
3701 !! test
3702 Definition list with bracketed URL link
3703 !! wikitext
3704 ;[http://www.example.com/ Example]:Something about it
3705 !! html
3706 <dl><dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt>
3707 <dd>Something about it</dd></dl>
3708
3709 !! end
3710
3711 !! test
3712 Definition list with wikilink containing colon
3713 !! wikitext
3714 ; [[Help:FAQ]]: The least-read page on Wikipedia
3715 !! html
3716 <dl><dt> <a href="/index.php?title=Help:FAQ&amp;action=edit&amp;redlink=1" class="new" title="Help:FAQ (page does not exist)">Help:FAQ</a></dt>
3717 <dd> The least-read page on Wikipedia</dd></dl>
3718
3719 !! end
3720
3721 # At Brion's and JeLuF's insistence... :)
3722 !! test
3723 Definition list with news link containing colon
3724 !! wikitext
3725 ; news:alt.wikipedia.rox: This isn't even a real newsgroup!
3726 !! html/php
3727 <dl><dt> <a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a></dt>
3728 <dd> This isn't even a real newsgroup!</dd></dl>
3729
3730 !! html/parsoid
3731 <dl><dt> <a rel="mw:ExtLink" href="news:alt.wikipedia.rox" data-parsoid='{"stx":"url"}'>news:alt.wikipedia.rox</a></dt><dd data-parsoid='{"stx":"row"}'> This isn't even a real newsgroup!</dd></dl>
3732 !! end
3733
3734 !! test
3735 Malformed definition list with colon
3736 !! wikitext
3737 ; news:alt.wikipedia.rox -- don't crash or enter an infinite loop
3738 !! html
3739 <dl><dt> <a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a> -- don't crash or enter an infinite loop</dt></dl>
3740
3741 !! end
3742
3743 !! test
3744 Definition lists: colon in external link text
3745 !! wikitext
3746 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
3747 !! html
3748 <dl><dt> <a rel="nofollow" class="external text" href="http://www.wikipedia2.org/">Wikipedia&#160;: The Next Generation</a></dt>
3749 <dd> OK, I made that up</dd></dl>
3750
3751 !! end
3752
3753 !! test
3754 Definition lists: colon in HTML attribute
3755 !! wikitext
3756 ;<b style="display: inline">bold</b>
3757 !! html
3758 <dl><dt><b style="display: inline">bold</b></dt></dl>
3759
3760 !! end
3761
3762 !! test
3763 Definition lists: self-closed tag
3764 !! wikitext
3765 ;one<br/>two : two-line fun
3766 !! html
3767 <dl><dt>one<br />two&#160;</dt>
3768 <dd> two-line fun</dd></dl>
3769
3770 !! end
3771
3772 !! test
3773 Definition lists: ignore colons inside tags
3774 !! wikitext
3775 ;one <b>two : tag <i>fun:</i>:</b>: def
3776 !! html
3777 <dl><dt>one <b>two&#160;: tag <i>fun:</i>:</b></dt>
3778 <dd> def</dd></dl>
3779
3780 !! end
3781
3782 !! test
3783 Definition lists: excess closed tags
3784 !! wikitext
3785 ;one</b>two : bad tag fun
3786 !! html/php+tidy
3787 <dl>
3788 <dt>onetwo&#160;</dt>
3789 <dd>bad tag fun</dd>
3790 </dl>
3791 !! html/parsoid
3792 <dl>
3793 <dt>onetwo</dt>
3794 <dd>bad tag fun</dd>
3795 </dl>
3796 !! end
3797
3798 !! test
3799 T13748: Literal closing tags
3800 !! wikitext
3801 <dl>
3802 <dt>test 1</dt>
3803 <dd>test test test test test</dd>
3804 <dt>test 2</dt>
3805 <dd>test test test test test</dd>
3806 </dl>
3807 !! html
3808 <dl>
3809 <dt>test 1</dt>
3810 <dd>test test test test test</dd>
3811 <dt>test 2</dt>
3812 <dd>test test test test test</dd>
3813 </dl>
3814
3815 !! end
3816
3817 !! test
3818 Definition and unordered list using wiki syntax nested in unordered list using html tags.
3819 !! wikitext
3820 <ul><li>
3821 ; term : description
3822 * unordered
3823 </li></ul>
3824 !! html
3825 <ul><li>
3826 <dl><dt> term&#160;</dt>
3827 <dd> description</dd></dl>
3828 <ul><li> unordered</li></ul>
3829 </li></ul>
3830
3831 !! end
3832
3833 !! test
3834 Definition list with empty definition and following paragraph
3835 !! wikitext
3836 ; term:
3837 Paragraph text
3838 !! html
3839 <dl><dt> term</dt>
3840 <dd></dd></dl>
3841 <p>Paragraph text
3842 </p>
3843 !! end
3844
3845 !! test
3846 Nested definition lists using html syntax
3847 !! wikitext
3848 <dl><dt>x</dt>
3849 <dd>a</dd>
3850 <dd>b</dd></dl>
3851 !! html
3852 <dl><dt>x</dt>
3853 <dd>a</dd>
3854 <dd>b</dd></dl>
3855
3856 !! end
3857
3858 !! test
3859 Definition Lists: No nesting: Multiple dd's
3860 !! wikitext
3861 ;x
3862 :a
3863 :b
3864 !! html
3865 <dl><dt>x</dt>
3866 <dd>a</dd>
3867 <dd>b</dd></dl>
3868
3869 !! end
3870
3871 !! test
3872 Definition Lists: Indentation: Regular
3873 !! wikitext
3874 :i1
3875 ::i2
3876 :::i3
3877 !! html
3878 <dl><dd>i1
3879 <dl><dd>i2
3880 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3881
3882 !! end
3883
3884 !! test
3885 Definition Lists: Indentation: Missing 1st level
3886 !! wikitext
3887 ::i2
3888 :::i3
3889 !! html
3890 <dl><dd><dl><dd>i2
3891 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3892
3893 !! end
3894
3895 !! test
3896 Definition Lists: Indentation: Multi-level indent
3897 !! wikitext
3898 :::i3
3899 !! html
3900 <dl><dd><dl><dd><dl><dd>i3</dd></dl></dd></dl></dd></dl>
3901
3902 !! end
3903
3904 !! test
3905 Definition Lists: Hacky use to indent tables
3906 !! wikitext
3907 ::{|
3908 |foo
3909 |bar
3910 |}
3911 this text
3912 should be left alone
3913 !! html
3914 <dl><dd><dl><dd><table>
3915 <tr>
3916 <td>foo
3917 </td>
3918 <td>bar
3919 </td></tr></table></dd></dl></dd></dl>
3920 <p>this text
3921 should be left alone
3922 </p>
3923 !! end
3924
3925 !! test
3926 Definition Lists: Hacky use to indent tables, with comments (T65979)
3927 !! wikitext
3928 <!-- foo -->
3929 ::{|
3930 |foo
3931 |bar
3932 |}<!-- bar -->
3933 this text
3934 should be left alone
3935 !! html/parsoid
3936 <!-- foo -->
3937 <dl><dd><dl><dd><table><tr>
3938 <td>foo</td>
3939 <td>bar</td>
3940 </tr></table><!-- bar --></dd></dl></dd></dl>
3941 <p>this text
3942 should be left alone</p>
3943 !! end
3944
3945 !! test
3946 Definition Lists: Hacky use to indent tables, with comment before table
3947 !! wikitext
3948 ::<!-- foo -->{|
3949 |foo
3950 |}
3951 !! html/parsoid
3952 <dl><dd><dl><dd><!-- foo --><table><tr>
3953 <td>foo</td>
3954 </tr></table></dd></dl></dd></dl>
3955 !! end
3956
3957 # The trailing whitespace in this test is to catch a regression in
3958 # Parsoid after T54473.
3959 !! test
3960 Definition Lists: Hacky use to indent tables (WS-insensitive)
3961 !! wikitext
3962 : {|
3963 |a
3964 |}
3965 !! html/php
3966 <dl><dd><table>
3967 <tr>
3968 <td>a
3969 </td></tr></table></dd></dl>
3970
3971 !! html/parsoid
3972 <dl><dd> <table>
3973 <tbody><tr><td>a</td></tr>
3974 </tbody></table> </dd></dl>
3975 !! end
3976
3977 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
3978 ## as an empty dt item. It also ignores all but the last ";" when followed
3979 ## by ":" later on. So, ";" are not ignored in ";;;t3" but are ignored in
3980 ## ";;;t3 :d1". So, PHP parser behavior is a little inconsistent wrt multiple
3981 ## ";"s.
3982 ##
3983 ## Ex: ";;t2 ::d2" is transformed into:
3984 ##
3985 ## <dl>
3986 ## <dt>t2 </dt>
3987 ## <dd>
3988 ## <dl>
3989 ## <dt></dt>
3990 ## <dd>d2</dd>
3991 ## </dl>
3992 ## </dd>
3993 ## </dl>
3994 ##
3995 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
3996 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
3997 ##
3998 ## <dl>
3999 ## <dt>
4000 ## <dl>
4001 ## <dt>t2 </dt>
4002 ## <dd>:d2</dd>
4003 ## </dl>
4004 ## </dt>
4005 ## </dl>
4006 ##
4007 ## All Parsoid only definition list tests have this difference.
4008 ##
4009 ## See also: https://phabricator.wikimedia.org/T8569
4010 ## and https://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
4011
4012 !! test
4013 Table / list interaction: indented table with lists in table contents
4014 !! wikitext
4015 :{|
4016 |-
4017 | a
4018 * b
4019 |-
4020 | c
4021 * d
4022 |}
4023 !! html
4024 <dl><dd><table>
4025
4026 <tr>
4027 <td> a
4028 <ul><li> b</li></ul>
4029 </td></tr>
4030 <tr>
4031 <td> c
4032 <ul><li> d</li></ul>
4033 </td></tr></table></dd></dl>
4034
4035 !! end
4036
4037 !!test
4038 Table / list interaction: lists nested in tables nested in indented lists
4039 !! wikitext
4040 :{|
4041 |
4042 :a
4043 :b
4044 |
4045 *c
4046 *d
4047 |}
4048
4049 *e
4050 *f
4051 !! html
4052 <dl><dd><table>
4053 <tr>
4054 <td>
4055 <dl><dd>a</dd>
4056 <dd>b</dd></dl>
4057 </td>
4058 <td>
4059 <ul><li>c</li>
4060 <li>d</li></ul>
4061 </td></tr></table></dd></dl>
4062 <ul><li>e</li>
4063 <li>f</li></ul>
4064
4065 !!end
4066
4067 !! test
4068 Definition Lists: Nesting: Multi-level (Parsoid only)
4069 !! options
4070 parsoid
4071 !! wikitext
4072 ;t1 :d1
4073 ;;t2 ::d2
4074 ;;;t3 :::d3
4075 !! html
4076 <dl>
4077 <dt>t1 </dt>
4078 <dd>d1</dd>
4079 <dt>
4080 <dl>
4081 <dt>t2 </dt>
4082 <dd>:d2</dd>
4083 <dt>
4084 <dl>
4085 <dt>t3 </dt>
4086 <dd>::d3</dd>
4087 </dl>
4088 </dt>
4089 </dl>
4090 </dt>
4091 </dl>
4092
4093
4094 !! end
4095
4096
4097 !! test
4098 Definition Lists: Nesting: Test 2 (Parsoid only)
4099 !! wikitext
4100 ;t1
4101 ::d2
4102 !! html/php+tidy
4103 <dl>
4104 <dt>t1</dt>
4105 <dd>
4106 <dl>
4107 <dd>d2</dd>
4108 </dl>
4109 </dd>
4110 </dl>
4111 !! html/parsoid
4112 <dl>
4113 <dt>t1</dt>
4114 <dd>
4115 <dl>
4116 <dd>d2</dd>
4117 </dl>
4118 </dd>
4119 </dl>
4120
4121 !! end
4122
4123
4124 !! test
4125 Definition Lists: Nesting: Test 3 (Parsoid only)
4126 !! wikitext
4127 :;t1
4128 ::::d2
4129 !! html/php+tidy
4130 <dl>
4131 <dd>
4132 <dl>
4133 <dt>t1</dt>
4134 <dd>
4135 <dl>
4136 <dd>
4137 <dl>
4138 <dd>d2</dd>
4139 </dl>
4140 </dd>
4141 </dl>
4142 </dd>
4143 </dl>
4144 </dd>
4145 </dl>
4146 !! html/parsoid
4147 <dl>
4148 <dd>
4149 <dl>
4150 <dt>t1</dt>
4151 <dd>
4152 <dl>
4153 <dd>
4154 <dl>
4155 <dd>d2</dd>
4156 </dl>
4157 </dd>
4158 </dl>
4159 </dd>
4160 </dl>
4161 </dd>
4162 </dl>
4163
4164 !! end
4165
4166
4167 !! test
4168 Definition Lists: Nesting: Test 4
4169 !! wikitext
4170 ::;t3
4171 :::d3
4172 !! html
4173 <dl><dd><dl><dd><dl><dt>t3</dt>
4174 <dd>d3</dd></dl></dd></dl></dd></dl>
4175
4176 !! end
4177
4178
4179 ## The Parsoid team believes the following three test exposes a
4180 ## bug in the PHP parser. (Parsoid team thinks the PHP parser is
4181 ## wrong to close the <dl> after the <dt> containing the <ul>.)
4182 ## It also exposes a "misfeature" in tidy, which doesn't like
4183 ## <dl> tags with a single <dt> child; it converts the <dt> into
4184 ## a <dd> in that case. (Parsoid leaves the <dt> alone!)
4185 !! test
4186 Definition Lists: Mixed Lists: Test 1
4187 !! wikitext
4188 :;* foo
4189 ::* bar
4190 :; baz
4191 !! html/php
4192 <dl><dd><dl><dt><ul><li> foo</li>
4193 <li> bar</li></ul></dt></dl>
4194 <dl><dt> baz</dt></dl></dd></dl>
4195
4196 !! html/php+tidy
4197 <dl>
4198 <dd>
4199 <dl>
4200 <dd>
4201 <ul>
4202 <li>foo</li>
4203 <li>bar</li>
4204 </ul>
4205 </dd>
4206 </dl>
4207 <dl>
4208 <dt>baz</dt>
4209 </dl>
4210 </dd>
4211 </dl>
4212 !! html/parsoid
4213 <dl>
4214 <dd><dl>
4215 <dt><ul>
4216 <li> foo
4217 </li>
4218 </ul></dt>
4219 <dd><ul>
4220 <li> bar
4221 </li>
4222 </ul></dd>
4223 <dt> baz</dt>
4224 </dl></dd>
4225 </dl>
4226 !! end
4227
4228 !! test
4229 Definition Lists: Mixed Lists: Test 2
4230 !! wikitext
4231 *: d1
4232 *: d2
4233 !! html
4234 <ul><li><dl><dd> d1</dd>
4235 <dd> d2</dd></dl></li></ul>
4236
4237 !! end
4238
4239
4240 !! test
4241 Definition Lists: Mixed Lists: Test 3
4242 !! wikitext
4243 *::: d1
4244 *::: d2
4245 !! html
4246 <ul><li><dl><dd><dl><dd><dl><dd> d1</dd>
4247 <dd> d2</dd></dl></dd></dl></dd></dl></li></ul>
4248
4249 !! end
4250
4251
4252 !! test
4253 Definition Lists: Mixed Lists: Test 4
4254 !! wikitext
4255 *;d1 :d2
4256 *;d3 :d4
4257 !! html
4258 <ul><li><dl><dt>d1&#160;</dt>
4259 <dd>d2</dd>
4260 <dt>d3&#160;</dt>
4261 <dd>d4</dd></dl></li></ul>
4262
4263 !! end
4264
4265
4266 !! test
4267 Definition Lists: Mixed Lists: Test 5
4268 !! wikitext
4269 *:d1
4270 *:: d2
4271 !! html
4272 <ul><li><dl><dd>d1
4273 <dl><dd> d2</dd></dl></dd></dl></li></ul>
4274
4275 !! end
4276
4277
4278 !! test
4279 Definition Lists: Mixed Lists: Test 6
4280 !! wikitext
4281 #*:d1
4282 #*::: d3
4283 !! html
4284 <ol><li><ul><li><dl><dd>d1
4285 <dl><dd><dl><dd> d3</dd></dl></dd></dl></dd></dl></li></ul></li></ol>
4286
4287 !! end
4288
4289
4290 !! test
4291 Definition Lists: Mixed Lists: Test 7
4292 !! wikitext
4293 :* d1
4294 :* d2
4295 !! html
4296 <dl><dd><ul><li> d1</li>
4297 <li> d2</li></ul></dd></dl>
4298
4299 !! end
4300
4301
4302 !! test
4303 Definition Lists: Mixed Lists: Test 8
4304 !! wikitext
4305 :* d1
4306 ::* d2
4307 !! html
4308 <dl><dd><ul><li> d1</li></ul>
4309 <dl><dd><ul><li> d2</li></ul></dd></dl></dd></dl>
4310
4311 !! end
4312
4313
4314 !! test
4315 Definition Lists: Mixed Lists: Test 9
4316 !! wikitext
4317 *;foo :bar
4318 !! html
4319 <ul><li><dl><dt>foo&#160;</dt>
4320 <dd>bar</dd></dl></li></ul>
4321
4322 !! end
4323
4324
4325 !! test
4326 Definition Lists: Mixed Lists: Test 10
4327 !! wikitext
4328 *#;foo :bar
4329 !! html
4330 <ul><li><ol><li><dl><dt>foo&#160;</dt>
4331 <dd>bar</dd></dl></li></ol></li></ul>
4332
4333 !! end
4334
4335 # This is a regression test for T175099
4336 # html/php+tidy is insufficient since Tidy covers up the bug.
4337 # But once Tidy is replaced with RemexHTML, html/php+tidy is good enough
4338 !! test
4339 Definition Lists: Mixed Lists: Test 11
4340 !! wikitext
4341 ; a
4342 :* b
4343 !! html/*
4344 <dl><dt> a</dt>
4345 <dd>
4346 <ul><li> b</li></ul></dd></dl>
4347
4348 !! end
4349
4350 # The Parsoid team disagrees with the PHP parser's seemingly-random
4351 # rules regarding dd/dt on the next two tests. Parsoid is more
4352 # consistent, and recognizes the shared nesting and keeps the
4353 # still-open tags around until the nesting is complete.
4354 # (And tidy again converts <dt> to <dd> before 'bar'.)
4355
4356 !! test
4357 Definition Lists: Mixed Lists: Test 12
4358 !! wikitext
4359 *#*#;*;;foo :bar
4360 *#*#;boo :baz
4361 !! html/php
4362 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt>
4363 <dd><ul><li><dl><dt><dl><dt>bar</dt></dl></dd></dl></li></ul></dd></dl>
4364 <dl><dt>boo&#160;</dt>
4365 <dd>baz</dd></dl></li></ol></li></ul></li></ol></li></ul>
4366
4367 !! html/php+tidy
4368 <ul>
4369 <li>
4370 <ol>
4371 <li>
4372 <ul>
4373 <li>
4374 <ol>
4375 <li>
4376 <dl>
4377 <dt>foo&#160;</dt>
4378 <dd>
4379 <ul>
4380 <li>
4381 <dl>
4382 <dd>
4383 <dl>
4384 <dt>bar</dt>
4385 </dl>
4386 </dd>
4387 </dl>
4388 </li>
4389 </ul>
4390 </dd>
4391 </dl>
4392 <dl>
4393 <dt>boo&#160;</dt>
4394 <dd>baz</dd>
4395 </dl>
4396 </li>
4397 </ol>
4398 </li>
4399 </ul>
4400 </li>
4401 </ol>
4402 </li>
4403 </ul>
4404 !! html/parsoid
4405 <ul>
4406 <li>
4407 <ol>
4408 <li>
4409 <ul>
4410 <li>
4411 <ol>
4412 <li>
4413 <dl>
4414 <dt>
4415 <ul>
4416 <li>
4417 <dl>
4418 <dt>
4419 <dl>
4420 <dt>foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
4421 <dd data-parsoid='{"stx":"row"}'>bar</dd>
4422 </dl></dt>
4423 </dl></li>
4424 </ul></dt>
4425 <dt>boo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
4426 <dd data-parsoid='{"stx":"row"}'>baz</dd>
4427 </dl></li>
4428 </ol></li>
4429 </ul></li>
4430 </ol></li>
4431 </ul>
4432 !! end
4433
4434
4435 # Another case where tidy converts a <dt> to a <dd> (but Parsoid doesn't).
4436 # From whitelist:
4437 # * The test is wrong, there are two colons where there should be :;
4438 # * The PHP parser is wrong to close the <dl> after the <dt> containing the <ul>.
4439 !! test
4440 Definition Lists: Weird Ones: Test 1
4441 !! wikitext
4442 *#;*::;; foo : bar (who uses this?)
4443 !! html/php
4444 <ul><li><ol><li><dl><dt> foo&#160;</dt>
4445 <dd><ul><li><dl><dd><dl><dd><dl><dt><dl><dt> bar (who uses this?)</dt></dl></dd></dl></dd></dl></dd></dl></li></ul></dd></dl></li></ol></li></ul>
4446
4447 !! html/php+tidy
4448 <ul>
4449 <li>
4450 <ol>
4451 <li>
4452 <dl>
4453 <dt>foo&#160;</dt>
4454 <dd>
4455 <ul>
4456 <li>
4457 <dl>
4458 <dd>
4459 <dl>
4460 <dd>
4461 <dl>
4462 <dd>
4463 <dl>
4464 <dt>bar (who uses this?)</dt>
4465 </dl>
4466 </dd>
4467 </dl>
4468 </dd>
4469 </dl>
4470 </dd>
4471 </dl>
4472 </li>
4473 </ul>
4474 </dd>
4475 </dl>
4476 </li>
4477 </ol>
4478 </li>
4479 </ul>
4480 !! html/parsoid
4481 <ul>
4482 <li>
4483 <ol>
4484 <li>
4485 <dl>
4486 <dt>
4487 <ul>
4488 <li>
4489 <dl>
4490 <dd>
4491 <dl>
4492 <dd>
4493 <dl>
4494 <dt>
4495 <dl>
4496 <dt> foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span></dt>
4497 <dd data-parsoid='{"stx":"row"}'> bar (who uses this?)</dd>
4498 </dl></dt>
4499 </dl></dd>
4500 </dl></dd>
4501 </dl></li>
4502 </ul></dt>
4503 </dl></li>
4504 </ol></li>
4505 </ul>
4506 !! end
4507
4508 !! test
4509 Definition Lists: colons occurring in tags
4510 !! wikitext
4511 ;a:b
4512 ;'''a:b'''
4513 ;<i>a:b</i>
4514 ;<span>a:b</span>
4515 ;<div>a:b</div>
4516 ;<div>a
4517 :b</div>
4518 ;{{echo|a:b}}
4519 ;{{echo|''a:b''}}
4520 ;;;''a:b''
4521 !! html+tidy
4522 <dl>
4523 <dt>a</dt>
4524 <dd>b</dd>
4525 <dt><b>a:b</b></dt>
4526 <dt><i>a:b</i></dt>
4527 <dt><span>a:b</span></dt>
4528 <dd>
4529 <div>a:b</div>
4530 </dd>
4531 <dd>
4532 <div>a
4533 <dl>
4534 <dd>b</dd>
4535 </dl>
4536 </div>
4537 </dd>
4538 <dt>a</dt>
4539 <dd>b</dd>
4540 <dt><i>a:b</i></dt>
4541 </dl>
4542 <dl>
4543 <dd>
4544 <dl>
4545 <dd>
4546 <dl>
4547 <dt><i>a:b</i></dt>
4548 </dl>
4549 </dd>
4550 </dl>
4551 </dd>
4552 </dl>
4553 !! html/parsoid
4554 <dl><dt>a</dt><dd data-parsoid='{"stx":"row"}'>b</dd>
4555 <dt><b>a:b</b></dt>
4556 <dt><i data-parsoid='{"stx":"html"}'>a:b</i></dt>
4557 <dt><span data-parsoid='{"stx":"html"}'>a:b</span></dt>
4558 <dt><div data-parsoid='{"stx":"html"}'>a:b</div></dt>
4559 <dt><div data-parsoid='{"stx":"html","autoInsertedEnd":true}'>a</div></dt>
4560 <dd>b</dd>
4561 <dt><span about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a:b"}},"i":0}}]}'>a:b</span></dt>
4562 <dt><i about="#mwt2" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&#39;&#39;a:b&#39;&#39;"}},"i":0}}]}'>a:b</i>
4563 <dl><dt><dl><dt><i>a:b</i></dt></dl></dt></dl></dt></dl>
4564 !! end
4565
4566 !! test
4567 Definition Lists: colons and tables 1
4568 !! wikitext
4569 :{|
4570 | x
4571 |}
4572 :{|
4573 | y
4574 |}
4575 !! html
4576 <dl><dd><table>
4577 <tr>
4578 <td> x
4579 </td></tr></table></dd></dl>
4580 <dl><dd><table>
4581 <tr>
4582 <td> y
4583 </td></tr></table></dd></dl>
4584
4585 !! end
4586
4587 # Parsoid's output (as documented below) differs from php's in this case.
4588 # This is probably a bug. If we fixup parsoid to match php's output, the
4589 # above test should pass and the below test case can be removed. It is
4590 # unclear which output is more desirable.
4591
4592 !! test
4593 Definition Lists: colons and tables 2
4594 !! wikitext
4595 :{|
4596 | x
4597 |}
4598 :{|
4599 | y
4600 |}
4601 !! html/parsoid
4602 <dl><dd><table>
4603 <tr>
4604 <td> x
4605 </td></tr></table></dd>
4606 <dd><table>
4607 <tr>
4608 <td> y
4609 </td></tr></table></dd></dl>
4610 !! end
4611
4612 !! test
4613 Definition Lists: template interaction
4614 !! wikitext
4615 ::{{definition_list}}
4616
4617 :one
4618 ::{{definition_list}}
4619 :::two
4620 :::three
4621 ::four
4622 !! html/parsoid
4623 <dl><dd><dl data-parsoid='{}'><dd about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[]]}' data-mw='{"parts":[":",{"template":{"target":{"wt":"definition_list","href":"./Template:Definition_list"},"params":{},"i":0}}]}'>one</dd><span about="#mwt1">
4624 </span><dd about="#mwt1">two</dd></dl></dd></dl>
4625
4626 <dl><dd data-parsoid='{}'>one
4627 <dl><dd about="#mwt2" typeof="mw:Transclusion" data-parsoid='{"pi":[[]]}' data-mw='{"parts":["::",{"template":{"target":{"wt":"definition_list","href":"./Template:Definition_list"},"params":{},"i":0}},"\n:::two\n:::three"]}'>one</dd><span about="#mwt2">
4628 </span><dd about="#mwt2">two
4629 <dl><dd>two</dd>
4630 <dd>three</dd></dl></dd>
4631 <dd data-parsoid='{}'>four</dd></dl></dd></dl>
4632 !! end
4633
4634
4635 ###
4636 ### External links
4637 ###
4638 !! test
4639 External links: non-bracketed
4640 !! wikitext
4641 Non-bracketed: http://example.com
4642 !! html
4643 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4644 </p>
4645 !! end
4646
4647 # parsoid doesn't explicitly mark autonumbered links, see T55505
4648 !! test
4649 External links: numbered
4650 !! wikitext
4651 Numbered: [http://example.com]
4652 Numbered: [http://example.net]
4653 Numbered: [http://example.com]
4654 !! html/php
4655 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
4656 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
4657 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
4658 </p>
4659 !! html/parsoid
4660 <p>Numbered: <a rel="mw:ExtLink" href="http://example.com"></a>
4661 Numbered: <a rel="mw:ExtLink" href="http://example.net"></a>
4662 Numbered: <a rel="mw:ExtLink" href="http://example.com"></a></p>
4663 !!end
4664
4665 !! test
4666 External links: specified text
4667 !! wikitext
4668 Specified text: [http://example.com link]
4669 !! html
4670 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
4671 </p>
4672 !!end
4673
4674 !! test
4675 External links: trail
4676 !! wikitext
4677 Linktrails should not work for external links: [http://example.com link]s
4678 !! html
4679 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
4680 </p>
4681 !! end
4682
4683 !! test
4684 External links: dollar sign in URL
4685 !! wikitext
4686 http://example.com/1$2345
4687 !! html
4688 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
4689 </p>
4690 !! end
4691
4692 # parsoid doesn't explicitly mark autonumbered links, see T55505
4693 !! test
4694 External links: dollar sign in URL (autonumber)
4695 !! wikitext
4696 [http://example.com/1$2345]
4697 !! html/php
4698 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
4699 </p>
4700 !! html/parsoid
4701 <p><a rel="mw:ExtLink" href="http://example.com/1$2345"></a></p>
4702 !!end
4703
4704 !! test
4705 External links: open square bracket forbidden in URL (T6377)
4706 !! options
4707 parsoid=wt2html,wt2wt,html2html
4708 !! wikitext
4709 http://example.com/1[2345
4710 !! html/php
4711 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
4712 </p>
4713 !! html/parsoid
4714 <p><a rel="mw:ExtLink" href="http://example.com/1">http://example.com/1</a>[2345</p>
4715 !! end
4716
4717 !! test
4718 External links: open square bracket forbidden in URL (named) (T6377)
4719 !! options
4720 parsoid=wt2html,html2html
4721 !! wikitext
4722 [http://example.com/1[2345]
4723 !! html/php
4724 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4725 </p>
4726 !! html/parsoid
4727 <p><a rel="mw:ExtLink" href="http://example.com/1">[2345</a></p>
4728 !!end
4729
4730 # parsoid adds a space before the link name
4731 !! test
4732 External links: open square bracket forbidden in URL (named) (T6377)
4733 Parsoid variant.
4734 !! wikitext
4735 [http://example.com/1 [2345]
4736 !! html
4737 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4738 </p>
4739 !!end
4740
4741 !! test
4742 External links: nowiki in URL link text (T8230)
4743 !! wikitext
4744 [http://example.com/ <nowiki>''example site''</nowiki>]
4745 !! html
4746 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
4747 </p>
4748 !! end
4749
4750 !! test
4751 External links: newline forbidden in text (T8230 regression check)
4752 !! wikitext
4753 [http://example.com/ first
4754 second]
4755 !! html
4756 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
4757 second]
4758 </p>
4759 !!end
4760
4761 !! test
4762 External links: Pipe char between url and text
4763 !! wikitext
4764 [http://example.com | link]
4765 !! html
4766 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
4767 </p>
4768 !!end
4769
4770 !! test
4771 External links: protocol-relative URL in brackets
4772 !! wikitext
4773 [//example.com/ Test]
4774 !! html
4775 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
4776 </p>
4777 !! end
4778
4779 # parsoid doesn't explicitly mark autonumbered links, see T55505
4780 !! test
4781 External links: protocol-relative URL in brackets without text
4782 !! wikitext
4783 [//example.com]
4784 !! html/php
4785 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
4786 </p>
4787 !! html/parsoid
4788 <p><a rel="mw:ExtLink" href="//example.com"></a></p>
4789 !! end
4790
4791 !! test
4792 External links: protocol-relative URL in free text is left alone
4793 !! wikitext
4794 //example.com/Foo
4795 !! html
4796 <p>//example.com/Foo
4797 </p>
4798 !!end
4799
4800 !! test
4801 External links: protocol-relative URL in the middle of a word is left alone (T32269)
4802 !! wikitext
4803 foo//example.com/Foo
4804 !! html
4805 <p>foo//example.com/Foo
4806 </p>
4807 !! end
4808
4809 !! test
4810 External links: with no contents
4811 !! wikitext
4812 [http://en.wikipedia.org/wiki/Foo]
4813
4814 [[wikipedia:Foo|Bar]]
4815
4816 [[wikipedia:Foo|<span>Bar</span>]]
4817 !! html/php
4818 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/wiki/Foo">[1]</a>
4819 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
4820 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo"><span>Bar</span></a>
4821 </p>
4822 !! html/parsoid
4823 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo"></a></p>
4824 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo">Bar</a></p>
4825 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo"><span>Bar</span></a></p>
4826 !! end
4827
4828 !! test
4829 External links: Free with trailing punctuation
4830 !! wikitext
4831 http://example.com,
4832 http://example.com;
4833 http://example.com\
4834 http://example.com.
4835 http://example.com:
4836 http://example.com!
4837 http://example.com?
4838 http://example.com)
4839 http://example.com/url_with_(brackets)
4840 (http://example.com/url_without_brackets)
4841 http://example.com/url_with_entity&amp;
4842 http://example.com/url_with_entity&#x26;
4843 http://example.com/url_with_entity&#038;
4844 http://example.com/url_with_entity&nbsp;
4845 http://example.com/url_with_entity&#xA0;
4846 http://example.com/url_with_entity&#160;
4847 http://example.com/url_with_entity&lt;
4848 http://example.com/url_with_entity&#x3C;
4849 http://example.com/url_with_entity&#60;
4850 !! html/php
4851 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
4852 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>;
4853 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>\
4854 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.
4855 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
4856 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>!
4857 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>?
4858 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
4859 <a rel="nofollow" class="external free" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
4860 (<a rel="nofollow" class="external free" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
4861 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4862 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4863 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4864 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#160;
4865 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#xa0;
4866 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#160;
4867 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&lt;
4868 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#x3c;
4869 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#60;
4870 </p>
4871 !! html/parsoid
4872 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>,
4873 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>;
4874 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>\
4875 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>.
4876 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:
4877 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>!
4878 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>?
4879 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)
4880 <a rel="mw:ExtLink" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
4881 (<a rel="mw:ExtLink" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
4882 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4883 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4884 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4885 <a rel="mw:ExtLink" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span>
4886 <a rel="mw:ExtLink" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#xA0;","srcContent":" "}'> </span>
4887 <a rel="mw:ExtLink" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#160;","srcContent":" "}'> </span>
4888 <a rel="mw:ExtLink" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;lt;","srcContent":"&lt;"}'>&lt;</span>
4889 <a rel="mw:ExtLink" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#x3C;","srcContent":"&lt;"}'>&lt;</span>
4890 <a rel="mw:ExtLink" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#60;","srcContent":"&lt;"}'>&lt;</span></p>
4891 !! end
4892
4893 !! test
4894 External links: tricky Parsoid html2html case
4895 !! options
4896 parsoid=wt2html,wt2wt,html2html
4897 !! wikitext
4898 http://example.com/url_with_entity&amp;amp;
4899 !! html/php
4900 <p><a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;amp">http://example.com/url_with_entity&amp;amp</a>;
4901 </p>
4902 !! html/parsoid
4903 <p><a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;amp">http://example.com/url_with_entity&amp;amp</a>;</p>
4904 !! end
4905
4906 !! test
4907 External links: Free with trailing quotes (T113666)
4908 !! wikitext
4909 '''News:''' Stuff here
4910
4911 news:'a'b''c''d e
4912 !! html/php
4913 <p><b>News:</b> Stuff here
4914 </p><p><a rel="nofollow" class="external free" href="news:'a'b">news:'a'b</a><i>c</i>d e
4915 </p>
4916 !! html/parsoid
4917 <p><b>News:</b> Stuff here</p>
4918 <p><a rel="mw:ExtLink" href="news:'a'b">news:'a'b</a><i>c</i>d e</p>
4919 !! end
4920
4921 !! test
4922 External links: with entity
4923 !! wikitext
4924 [http://&#x20;www.librarieswithoutborders.org Libraries without borders]
4925 !! html/php
4926 <p><a rel="nofollow" class="external text" href="http://+www.librarieswithoutborders.org">Libraries without borders</a>
4927 </p>
4928 !! html/parsoid
4929 <p><a rel="mw:ExtLink" href="http://+www.librarieswithoutborders.org" data-parsoid='{"a":{"href":"http://+www.librarieswithoutborders.org"},"sa":{"href":"http://&amp;#x20;www.librarieswithoutborders.org"}}'>Libraries without borders</a></p>
4930 !! end
4931
4932 !! test
4933 External links: Lone protocols are never linked (T105697)
4934 !! wikitext
4935 http://
4936 http://;
4937 (http://)
4938 bitcoin:
4939 bitcoin:;
4940 (bitcoin:)
4941 !! html
4942 <p>http://
4943 http://;
4944 (http://)
4945 bitcoin:
4946 bitcoin:;
4947 (bitcoin:)
4948 </p>
4949 !! end
4950
4951 !! test
4952 External links: No preceding word characters allowed (T67278)
4953 !! wikitext
4954 NOPEhttp://example.com
4955 N0http://example.com
4956 ok:http://example.com
4957 ok-http://example.com
4958 !! html
4959 <p>NOPEhttp://example.com
4960 N0http://example.com
4961 ok:<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4962 ok-<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4963 </p>
4964 !! end
4965
4966 !! test
4967 External links: nofollow domain exception
4968 !! wikitext
4969 A [https://no-nofollow.org/foobar link], and another [https://example.org link].
4970 !! html
4971 <p>A <a class="external text" href="https://no-nofollow.org/foobar">link</a>, and another <a rel="nofollow" class="external text" href="https://example.org">link</a>.
4972 </p>
4973 !!end
4974
4975 !! test
4976 External image
4977 !! wikitext
4978 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4979 !! html
4980 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png"/>
4981 </p>
4982 !! end
4983
4984 !! test
4985 External image from https
4986 !! wikitext
4987 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4988 !! html
4989 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png"/>
4990 </p>
4991 !! end
4992
4993 !! test
4994 External image (when not allowed)
4995 !! options
4996 wgAllowExternalImages=0
4997 !! wikitext
4998 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4999 !! html
5000 <p>External image: <a rel="nofollow" class="external free" href="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png">http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png</a>
5001 </p>
5002 !! end
5003
5004 !! test
5005 Link to non-http image, no img tag
5006 !! wikitext
5007 Link to non-http image, no img tag: ftp://example.com/test.jpg
5008 !! html
5009 <p>Link to non-http image, no img tag: <a rel="nofollow" class="external free" href="ftp://example.com/test.jpg">ftp://example.com/test.jpg</a>
5010 </p>
5011 !! end
5012
5013 !! test
5014 External links: terminating separator
5015 !! wikitext
5016 Terminating separator: http://example.com/thing,
5017 !! html
5018 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
5019 </p>
5020 !! end
5021
5022 !! test
5023 External links: intervening separator
5024 !! wikitext
5025 Intervening separator: http://example.com/1,2,3
5026 !! html
5027 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
5028 </p>
5029 !! end
5030
5031 !! test
5032 External links: old bug with URL in query
5033 !! wikitext
5034 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
5035 !! html
5036 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
5037 </p>
5038 !! end
5039
5040 !! test
5041 External links: old URL-in-URL bug, mixed protocols
5042 !! wikitext
5043 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
5044 !! html
5045 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
5046 </p>
5047 !!end
5048
5049 # Since Parsoid is starting to emit canonical wikitext for links,
5050 # [http://example.com http://example.com] will not RT back to that
5051 # form anymore.
5052 !! test
5053 External links: URL in text
5054 !! options
5055 parsoid=wt2html
5056 !! wikitext
5057 URL in text: [http://example.com http://example.com]
5058 !! html/php
5059 <p>URL in text: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
5060 </p>
5061 !! html/parsoid
5062 <p>URL in text: <a rel="mw:ExtLink" href="http://example.com">http://example.com</a></p>
5063 !! end
5064
5065 !! test
5066 External links: Clickable images
5067 !! wikitext
5068 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
5069 !! html/php
5070 <p>ja-style clickable images: <a rel="nofollow" class="external text" href="http://example.com"><img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png"/></a>
5071 </p>
5072 !! html/parsoid
5073 <p>ja-style clickable images: <a rel="mw:ExtLink" href="http://example.com"><img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" data-parsoid='{"type":"extlink"}'/></a></p>
5074 !! end
5075
5076 !! test
5077 External links: raw ampersand
5078 !! wikitext
5079 Old &amp; use: http://x&y
5080 !! html
5081 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
5082 </p>
5083 !! end
5084
5085 !! test
5086 External links: encoded ampersand
5087 !! wikitext
5088 Old &amp; use: http://x&amp;y
5089 !! html/php
5090 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
5091 </p>
5092 !! html/parsoid
5093 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y">http://x&amp;y</a></p>
5094 !! end
5095
5096 !! test
5097 External links: encoded equals (T8102)
5098 !! wikitext
5099 http://example.com/?foo&#61;bar
5100 !! html/php
5101 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
5102 </p>
5103 !! html/parsoid
5104 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a></p>
5105 !! end
5106
5107 ##
5108 ## Note that parsoid doesn't explicit mark autonumbered links, nor
5109 ## does it number them. As discussed in T55505, we can identify
5110 ## autonumbered links via CSS.
5111 ##
5112
5113 !! test
5114 External links: [raw ampersand]
5115 !! wikitext
5116 Old &amp; use: [http://x&y]
5117 !! html/php
5118 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
5119 </p>
5120 !! html/parsoid
5121 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
5122 !! end
5123
5124 # note that parsoid html is identical to [raw ampersand] case; so html2wt
5125 # mode will return the [raw ampersand] wikitext
5126 !! test
5127 External links: [encoded ampersand]
5128 !! options
5129 parsoid=wt2html,wt2wt,html2html
5130 !! wikitext
5131 Old &amp; use: [http://x&amp;y]
5132 !! html/php
5133 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
5134 </p>
5135 !! html/parsoid
5136 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
5137 !! end
5138
5139 !! test
5140 External links: [raw equals]
5141 !! wikitext
5142 [http://example.com/?foo=bar]
5143 !! html/php
5144 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
5145 </p>
5146 !! html/parsoid
5147 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
5148 !! end
5149
5150 # note that parsoid html is identical to [raw equals] case; so html2wt
5151 # mode will return the [raw equals] wikitext
5152 !! test
5153 External links: [encoded equals] (T8102)
5154 !! options
5155 parsoid=wt2html,wt2wt,html2html
5156 !! wikitext
5157 [http://example.com/?foo&#61;bar]
5158 !! html/php
5159 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
5160 </p>
5161 !! html/parsoid
5162 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
5163 !! end
5164
5165 # xxx parsoid strips the IDN character, so the round-trip tests will
5166 # obviously fail and are disabled. --cscott
5167 !! test
5168 External links: [IDN ignored character reference in hostname; strip it right off]
5169 !! options
5170 parsoid=wt2html,wt2wt,html2html
5171 !! wikitext
5172 [http://e&zwnj;xample.com/]
5173 !! html/php
5174 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
5175 </p>
5176 !! html/parsoid
5177 <p><a rel="mw:ExtLink" href="http://example.com/"></a></p>
5178 !! end
5179
5180 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
5181 # Where an external link could easily circumvent the sanitization of the text of
5182 # a link like this (where an IDN-ignore character is in the URL somewhere), this
5183 # test demands a higher standard. That's a bit strange.
5184 #
5185 # Example:
5186 #
5187 # http://e‌xample.com -> [http://example.com|http://example.com]
5188 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
5189 #
5190 # The first example is sanitized, but the second is not. Any security benefits
5191 # from this production are trivial to circumvent. Either remove this test and
5192 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
5193 # the test accordingly.
5194 #
5195 # All our love,
5196 # The Parsoid team.
5197 # xxx parsoid strips the IDN character, so the round-trip tests will
5198 # obviously fail and are disabled. --cscott
5199 !! test
5200 External links: IDN ignored character reference in hostname; strip it right off
5201 !! options
5202 parsoid=wt2html,html2html
5203 !! wikitext
5204 http://e&zwnj;xample.com/
5205 !! html/php
5206 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
5207 </p>
5208 !! html/parsoid
5209 <p><a rel="mw:ExtLink" href="http://example.com/">http://example.com/</a></p>
5210 !! end
5211
5212 !! test
5213 External links: www.jpeg.org (T2554)
5214 !! wikitext
5215 http://www.jpeg.org
5216 !! html
5217 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
5218 </p>
5219 !! end
5220
5221 # parsoid doesn't explicitly mark autonumbered links, see T55505
5222 !! test
5223 External links: URL within URL (T2002)
5224 !! wikitext
5225 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
5226 !! html/php
5227 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
5228 </p>
5229 !! html/parsoid
5230 <p><a rel="mw:ExtLink" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp"></a></p>
5231 !! end
5232
5233 !! test
5234 T2361: URL inside bracketed URL
5235 !! wikitext
5236 [http://www.example.com/foo http://www.example.com/bar]
5237 !! html
5238 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
5239 </p>
5240 !! end
5241
5242 !! test
5243 T2361: URL within URL, not bracketed
5244 !! wikitext
5245 http://www.example.com/foo?=http://www.example.com/bar
5246 !! html
5247 <p><a rel="nofollow" class="external free" href="http://www.example.com/foo?=http://www.example.com/bar">http://www.example.com/foo?=http://www.example.com/bar</a>
5248 </p>
5249 !! end
5250
5251 !! test
5252 T2289: ">"-token in URL-tail
5253 !! wikitext
5254 http://www.example.com/<hello>
5255 !! html
5256 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
5257 </p>
5258 !!end
5259
5260 !! test
5261 T2289: literal ">"-token in URL-tail
5262 !! wikitext
5263 http://www.example.com/<b>html</b>
5264 !! html/php
5265 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
5266 </p>
5267 !! html/parsoid
5268 <p><a rel="mw:ExtLink" href="http://www.example.com/" data-parsoid='{"stx":"url"}'>http://www.example.com/</a><b data-parsoid='{"stx":"html"}'>html</b></p>
5269 !! end
5270
5271 !! test
5272 T2289: ">"-token in bracketed URL
5273 !! wikitext
5274 [http://www.example.com/<hello> stuff]
5275 !! html
5276 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
5277 </p>
5278 !!end
5279
5280 !! test
5281 T2289: literal ">"-token in bracketed URL
5282 !! wikitext
5283 [http://www.example.com/<b>html</b> stuff]
5284 !! html
5285 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
5286 </p>
5287 !!end
5288
5289 !! test
5290 T2289: literal double quote at end of URL
5291 !! wikitext
5292 http://www.example.com/"hello"
5293 !! html
5294 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
5295 </p>
5296 !!end
5297
5298 !! test
5299 T2289: literal double quote in bracketed URL
5300 !! wikitext
5301 [http://www.example.com/"hello" stuff]
5302 !! html
5303 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
5304 </p>
5305 !!end
5306
5307 !! test
5308 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (T7081)
5309 !! wikitext
5310 [http://www.example.com test]
5311 !! html
5312 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
5313 </p>
5314 !! end
5315
5316 !! test
5317 External links: link text with spaces
5318 !! wikitext
5319 [http://www.example.com a b c]
5320 [http://www.example.com ''a'' ''b'']
5321 !! html
5322 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
5323 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
5324 </p>
5325 !! end
5326
5327 !! test
5328 External links: wiki links within external link (T5695)
5329 !! options
5330 parsoid=wt2html,html2html
5331 !! wikitext
5332 [http://example.com [[wikilink]] embedded in ext link]
5333 !! html/php
5334 <p><a rel="nofollow" class="external text" href="http://example.com"></a><a href="/index.php?title=Wikilink&amp;action=edit&amp;redlink=1" class="new" title="Wikilink (page does not exist)">wikilink</a><a rel="nofollow" class="external text" href="http://example.com"> embedded in ext link</a>
5335 </p>
5336 !! html/parsoid
5337 <p><a rel="mw:ExtLink" href="http://example.com"></a><a rel="mw:WikiLink" href="./Wikilink" title="Wikilink">wikilink</a><span> embedded in ext link</span></p>
5338 !! end
5339
5340 !! test
5341 T2787: Links with one slash after the url protocol are invalid
5342 !! wikitext
5343 http:/example.com
5344
5345 [http:/example.com title]
5346 !! html
5347 <p>http:/example.com
5348 </p><p>[http:/example.com title]
5349 </p>
5350 !! end
5351
5352 !! test
5353 Bracketed external links with template-generated invalid target
5354 !! wikitext
5355 [{{echo|http:/example.com}} title]
5356 !! html
5357 <p>[http:/example.com title]
5358 </p>
5359 !! end
5360
5361 # wt2html only because Parsoid would want to add <nowiki>s coming from html
5362 !! test
5363 Broken wikilinks (but not external links) prevent templates from closing
5364 !! options
5365 parsoid=wt2html
5366 !! wikitext
5367 [http://example.com x
5368
5369 {{echo|[http://example.com x}}
5370
5371 [[Foo
5372
5373 {{echo|[[Foo}}
5374 !! html/php
5375 <p>[<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> x
5376 </p><p>[<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> x
5377 </p><p>[[Foo
5378 </p><p>{{echo|[[Foo}}
5379 </p>
5380 !! html/parsoid
5381 <p>[<a rel="mw:ExtLink" href="http://example.com">http://example.com</a> x</p>
5382 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[http://example.com x"}},"i":0}}]}'>[<a rel="mw:ExtLink" href="http://example.com">http://example.com</a> x</p>
5383 <p>[[Foo</p>
5384 <p>{{echo|[[Foo}}</p>
5385 !! end
5386
5387 !! test
5388 Wikilinks with embedded newlines are not broken
5389 !! wikitext
5390 {{echo|[[ Foo
5391 B
5392 C]]}}
5393 !! html/php
5394 <p>[[ Foo
5395 B
5396 C]]
5397 </p>
5398 !! html/parsoid
5399 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[ Foo\nB\nC]]"}},"i":0}}]}'>[[ Foo B C]]</p>
5400 !! end
5401
5402 !! test
5403 Broken templates
5404 !! options
5405 parsoid=wt2html
5406 !! wikitext
5407 {{echo|[[Foo|}}]]
5408
5409 [[Foo|{{echo|]]}}
5410 !! html/php
5411 <p>{{echo|<a href="/wiki/Foo" title="Foo">}}</a>
5412 </p><p>[[Foo|]]
5413 </p>
5414 !! html/parsoid
5415 <p>{{echo|<a rel="mw:WikiLink" href="./Foo" title="Foo">}}</a></p>
5416 <p>[[Foo|<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"]]"}},"i":0}}]}'>]]</span></p>
5417 !! end
5418
5419 !! test
5420 T4702: Mismatched <i>, <b> and <a> tags are invalid
5421 !! wikitext
5422 ''[http://example.com text'']
5423 [http://example.com '''text]'''
5424 ''Something [http://example.com in italic'']
5425 ''Something [http://example.com mixed''''', even bold]'''
5426 '''''Now [http://example.com both''''']
5427 !! html
5428 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
5429 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
5430 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
5431 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
5432 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
5433 </p>
5434 !! end
5435
5436
5437 !! test
5438 T6781: %26 in URL
5439 !! wikitext
5440 http://www.example.com/?title=AT%26T
5441 !! html/php
5442 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
5443 </p>
5444 !! html/parsoid
5445 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a></p>
5446 !! end
5447
5448 # According to https://www.w3.org/TR/2011/WD-html5-20110525/Overview.html#parsing-urls a plain
5449 # % is actually legal in HTML5. Any change in output would need testing though.
5450 !! test
5451 T6781, T7267: %25 in URL
5452 !! wikitext
5453 http://www.example.com/?title=100%25_Bran
5454 !! html/php
5455 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=100%25_Bran">http://www.example.com/?title=100%25_Bran</a>
5456 </p>
5457 !! html/parsoid
5458 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran">http://www.example.com/?title=100%25_Bran</a></p>
5459 !! end
5460
5461 !! test
5462 T6781, T7267: %28, %29 in URL
5463 !! wikitext
5464 http://www.example.com/?title=Ben-Hur_%281959_film%29
5465 !! html/php
5466 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">http://www.example.com/?title=Ben-Hur_%281959_film%29</a>
5467 </p>
5468 !! html/parsoid
5469 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">http://www.example.com/?title=Ben-Hur_%281959_film%29</a></p>
5470 !! end
5471
5472
5473 !! test
5474 T6781: %26 in autonumber URL
5475 !! wikitext
5476 [http://www.example.com/?title=AT%26T]
5477 !! html/php
5478 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
5479 </p>
5480 !! html/parsoid
5481 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T"></a></p>
5482 !! end
5483
5484 !! test
5485 T6781, T7267: %26 in autonumber URL
5486 !! wikitext
5487 [http://www.example.com/?title=100%25_Bran]
5488 !! html/php
5489 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
5490 </p>
5491 !! html/parsoid
5492 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran"></a></p>
5493 !! end
5494
5495 !! test
5496 T6781, T7267: %28, %29 in autonumber URL
5497 !! wikitext
5498 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
5499 !! html/php
5500 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
5501 </p>
5502 !! html/parsoid
5503 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29"></a></p>
5504 !! end
5505
5506
5507 !! test
5508 T6781: %26 in bracketed URL
5509 !! wikitext
5510 [http://www.example.com/?title=AT%26T link]
5511 !! html/php
5512 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
5513 </p>
5514 !! html/parsoid
5515 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">link</a></p>
5516 !! end
5517
5518 !! test
5519 T6781, T7267: %25 in bracketed URL
5520 !! wikitext
5521 [http://www.example.com/?title=100%25_Bran link]
5522 !! html
5523 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
5524 </p>
5525 !! end
5526
5527 !! test
5528 T6781, T7267: %28, %29 in bracketed URL
5529 !! wikitext
5530 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
5531 !! html/php
5532 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
5533 </p>
5534 !! html/parsoid
5535 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a></p>
5536 !! end
5537
5538 !! test
5539 External link containing a period in the anchor. (T65947)
5540 !! wikitext
5541 [//foo.org/bar#baz. bang]
5542
5543 [//foo.org/bar. bang]
5544 !! html/php
5545 <p><a rel="nofollow" class="external text" href="//foo.org/bar#baz.">bang</a>
5546 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar.">bang</a>
5547 </p>
5548 !! html/parsoid
5549 <p><a rel="mw:ExtLink" href="//foo.org/bar#baz.">bang</a></p>
5550 <p><a rel="mw:ExtLink" href="//foo.org/bar.">bang</a></p>
5551 !! end
5552
5553 !! test
5554 External link containing a single quote. (T65947)
5555 !! wikitext
5556 [//foo.org/bar'baz]
5557
5558 [//foo.org/bar'baz bang]
5559 !! html/php
5560 <p><a rel="nofollow" class="external autonumber" href="//foo.org/bar'baz">[1]</a>
5561 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar'baz">bang</a>
5562 </p>
5563 !! html/parsoid
5564 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz"></a></p>
5565 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz">bang</a></p>
5566 !! end
5567
5568 !! test
5569 External link containing double-single-quotes in text '' (T6598 sanity check)
5570 !! wikitext
5571 Some [http://example.com/ pretty ''italics'' and stuff]!
5572 !! html
5573 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
5574 </p>
5575 !! end
5576
5577 !! test
5578 External link containing double-single-quotes in text embedded in italics (T6598 sanity check)
5579 !! wikitext
5580 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
5581 !! html
5582 <p><i>Some </i><a rel="nofollow" class="external text" href="http://example.com/"><i>pretty </i>italics<i> and stuff</i></a><i>!</i>
5583 </p>
5584 !! end
5585
5586 !! test
5587 External link containing double-single-quotes with no space separating the url from text in italics
5588 !! wikitext
5589 [http://www.musee-picasso.fr/pages/page_id18528_u1l2.htm''La muerte de Casagemas'' (1901) en el sitio de [[Museo Picasso (París)|Museo Picasso]].]
5590 !! html/php
5591 <p><a rel="nofollow" class="external text" href="http://www.musee-picasso.fr/pages/page_id18528_u1l2.htm"><i>La muerte de Casagemas</i> (1901) en el sitio de <a href="/index.php?title=Museo_Picasso_(Par%C3%ADs)&amp;action=edit&amp;redlink=1" class="new" title="Museo Picasso (París) (page does not exist)">Museo Picasso</a>.</a>
5592 </p>
5593 !! html/php+tidy
5594 <p><a rel="nofollow" class="external text" href="http://www.musee-picasso.fr/pages/page_id18528_u1l2.htm"><i>La muerte de Casagemas</i> (1901) en el sitio de</a> <a href="/index.php?title=Museo_Picasso_(Par%C3%ADs)&amp;action=edit&amp;redlink=1" class="new" title="Museo Picasso (París) (page does not exist)">Museo Picasso</a>.</p>
5595 !! html/parsoid
5596 <p><a rel="mw:ExtLink" href="http://www.musee-picasso.fr/pages/page_id18528_u1l2.htm"><i>La muerte de Casagemas</i> (1901) en el sitio de </a><a rel="mw:WikiLink" href="./Museo_Picasso_(París)" title="Museo Picasso (París)">Museo Picasso</a><span>.</span></p>
5597 !! end
5598
5599 !! test
5600 External link with comments in link text
5601 !! wikitext
5602 [http://www.google.com Google <!-- comment -->]
5603 !! html/php
5604 <p><a rel="nofollow" class="external text" href="http://www.google.com">Google </a>
5605 </p>
5606 !! html/parsoid
5607 <p><a rel="mw:ExtLink" href="http://www.google.com">Google <!-- comment --></a></p>
5608 !! end
5609
5610 !! test
5611 External link to bare IPv4 address
5612 !! wikitext
5613 [http://192.168.0.1 Link]
5614 !! html/php
5615 <p><a rel="nofollow" class="external text" href="http://192.168.0.1">Link</a>
5616 </p>
5617 !! html/parsoid
5618 <p><a rel="mw:ExtLink" href="http://192.168.0.1">Link</a></p>
5619 !! end
5620
5621 !! test
5622 URL-encoding in URL functions (single parameter)
5623 !! wikitext
5624 {{localurl:Some page|amp=&}}
5625 !! html
5626 <p>/index.php?title=Some_page&amp;amp=&amp;
5627 </p>
5628 !! end
5629
5630 !! test
5631 URL-encoding in URL functions (multiple parameters)
5632 !! wikitext
5633 {{localurl:Some page|q=?&amp=&}}
5634 !! html
5635 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
5636 </p>
5637 !! end
5638
5639 !! test
5640 Brackets in urls
5641 !! wikitext
5642 http://example.com/index.php?foozoid%5B%5D=bar
5643
5644 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
5645 !! html/php
5646 <p><a rel="nofollow" class="external free" href="http://example.com/index.php?foozoid%5B%5D=bar">http://example.com/index.php?foozoid%5B%5D=bar</a>
5647 </p><p><a rel="nofollow" class="external free" href="http://example.com/index.php?foozoid%5B%5D=bar">http://example.com/index.php?foozoid%5B%5D=bar</a>
5648 </p>
5649 !! html/parsoid
5650 <p><a rel="mw:ExtLink" href="http://example.com/index.php?foozoid%5B%5D=bar">http://example.com/index.php?foozoid%5B%5D=bar</a></p>
5651
5652 <p><a rel="mw:ExtLink" href="http://example.com/index.php?foozoid%5B%5D=bar" data-parsoid='{"stx":"url","a":{"href":"http://example.com/index.php?foozoid%5B%5D=bar"},"sa":{"href":"http://example.com/index.php?foozoid&amp;#x5B;&amp;#x5D;=bar"}}'>http://example.com/index.php?foozoid%5B%5D=bar</a></p>
5653 !! end
5654
5655 !! test
5656 IPv6 urls, autolink format (T23261)
5657 !! wikitext
5658 http://[2404:130:0:1000::187:2]/index.php
5659
5660 Examples from RFC 2373, section 2.2:
5661 * http://[1080::8:800:200C:417A]/unicast
5662 * http://[FF01::101]/multicast
5663 * http://[::1]/loopback
5664 * http://[::]/unspecified
5665 * http://[::13.1.68.3]/ipv4compat
5666 * http://[::FFFF:129.144.52.38]/ipv4compat
5667
5668 Examples from RFC 2732, section 2:
5669 * http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html
5670 * http://[1080:0:0:0:8:800:200C:417A]/index.html
5671 * http://[3ffe:2a00:100:7031::1]
5672 * http://[1080::8:800:200C:417A]/foo
5673 * http://[::192.9.5.5]/ipng
5674 * http://[::FFFF:129.144.52.38]:80/index.html
5675 * http://[2010:836B:4179::836B:4179]
5676
5677 !! html/php
5678 <p><a rel="nofollow" class="external free" href="http://[2404:130:0:1000::187:2]/index.php">http://[2404:130:0:1000::187:2]/index.php</a>
5679 </p><p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2373">RFC 2373</a>, section 2.2:
5680 </p>
5681 <ul><li> <a rel="nofollow" class="external free" href="http://[1080::8:800:200C:417A]/unicast">http://[1080::8:800:200C:417A]/unicast</a></li>
5682 <li> <a rel="nofollow" class="external free" href="http://[FF01::101]/multicast">http://[FF01::101]/multicast</a></li>
5683 <li> <a rel="nofollow" class="external free" href="http://[::1]/loopback">http://[::1]/loopback</a></li>
5684 <li> <a rel="nofollow" class="external free" href="http://[::]/unspecified">http://[::]/unspecified</a></li>
5685 <li> <a rel="nofollow" class="external free" href="http://[::13.1.68.3]/ipv4compat">http://[::13.1.68.3]/ipv4compat</a></li>
5686 <li> <a rel="nofollow" class="external free" href="http://[::FFFF:129.144.52.38]/ipv4compat">http://[::FFFF:129.144.52.38]/ipv4compat</a></li></ul>
5687 <p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2732">RFC 2732</a>, section 2:
5688 </p>
5689 <ul><li> <a rel="nofollow" class="external free" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html</a></li>
5690 <li> <a rel="nofollow" class="external free" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">http://[1080:0:0:0:8:800:200C:417A]/index.html</a></li>
5691 <li> <a rel="nofollow" class="external free" href="http://[3ffe:2a00:100:7031::1]">http://[3ffe:2a00:100:7031::1]</a></li>
5692 <li> <a rel="nofollow" class="external free" href="http://[1080::8:800:200C:417A]/foo">http://[1080::8:800:200C:417A]/foo</a></li>
5693 <li> <a rel="nofollow" class="external free" href="http://[::192.9.5.5]/ipng">http://[::192.9.5.5]/ipng</a></li>
5694 <li> <a rel="nofollow" class="external free" href="http://[::FFFF:129.144.52.38]:80/index.html">http://[::FFFF:129.144.52.38]:80/index.html</a></li>
5695 <li> <a rel="nofollow" class="external free" href="http://[2010:836B:4179::836B:4179]">http://[2010:836B:4179::836B:4179]</a></li></ul>
5696
5697 !! html/parsoid
5698 <p><a rel="mw:ExtLink" href="http://[2404:130:0:1000::187:2]/index.php">http://[2404:130:0:1000::187:2]/index.php</a></p>
5699
5700 <p>Examples from <a href="//tools.ietf.org/html/rfc2373" rel="mw:ExtLink">RFC 2373</a>, section 2.2:</p>
5701 <ul><li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/unicast">http://[1080::8:800:200C:417A]/unicast</a></li>
5702 <li> <a rel="mw:ExtLink" href="http://[FF01::101]/multicast">http://[FF01::101]/multicast</a></li>
5703 <li> <a rel="mw:ExtLink" href="http://[::1]/loopback">http://[::1]/loopback</a></li>
5704 <li> <a rel="mw:ExtLink" href="http://[::]/unspecified">http://[::]/unspecified</a></li>
5705 <li> <a rel="mw:ExtLink" href="http://[::13.1.68.3]/ipv4compat">http://[::13.1.68.3]/ipv4compat</a></li>
5706 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]/ipv4compat">http://[::FFFF:129.144.52.38]/ipv4compat</a></li></ul>
5707
5708 <p>Examples from <a href="//tools.ietf.org/html/rfc2732" rel="mw:ExtLink">RFC 2732</a>, section 2:</p>
5709 <ul><li> <a rel="mw:ExtLink" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html</a></li>
5710 <li> <a rel="mw:ExtLink" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">http://[1080:0:0:0:8:800:200C:417A]/index.html</a></li>
5711 <li> <a rel="mw:ExtLink" href="http://[3ffe:2a00:100:7031::1]">http://[3ffe:2a00:100:7031::1]</a></li>
5712 <li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/foo">http://[1080::8:800:200C:417A]/foo</a></li>
5713 <li> <a rel="mw:ExtLink" href="http://[::192.9.5.5]/ipng">http://[::192.9.5.5]/ipng</a></li>
5714 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]:80/index.html">http://[::FFFF:129.144.52.38]:80/index.html</a></li>
5715 <li> <a rel="mw:ExtLink" href="http://[2010:836B:4179::836B:4179]">http://[2010:836B:4179::836B:4179]</a></li></ul>
5716 !! end
5717
5718 !! test
5719 IPv6 urls, bracketed format (T23261)
5720 !! wikitext
5721 [http://[2404:130:0:1000::187:2]/index.php test]
5722
5723 Examples from RFC 2373, section 2.2:
5724 * [http://[1080::8:800:200C:417A] unicast]
5725 * [http://[FF01::101] multicast]
5726 * [http://[::1]/ loopback]
5727 * [http://[::] unspecified]
5728 * [http://[::13.1.68.3] ipv4compat]
5729 * [http://[::FFFF:129.144.52.38] ipv4compat]
5730
5731 Examples from RFC 2732, section 2:
5732 * [http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html 1]
5733 * [http://[1080:0:0:0:8:800:200C:417A]/index.html 2]
5734 * [http://[3ffe:2a00:100:7031::1] 3]
5735 * [http://[1080::8:800:200C:417A]/foo 4]
5736 * [http://[::192.9.5.5]/ipng 5]
5737 * [http://[::FFFF:129.144.52.38]:80/index.html 6]
5738 * [http://[2010:836B:4179::836B:4179] 7]
5739
5740 !! html/php
5741 <p><a rel="nofollow" class="external text" href="http://[2404:130:0:1000::187:2]/index.php">test</a>
5742 </p><p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2373">RFC 2373</a>, section 2.2:
5743 </p>
5744 <ul><li> <a rel="nofollow" class="external text" href="http://[1080::8:800:200C:417A]">unicast</a></li>
5745 <li> <a rel="nofollow" class="external text" href="http://[FF01::101]">multicast</a></li>
5746 <li> <a rel="nofollow" class="external text" href="http://[::1]/">loopback</a></li>
5747 <li> <a rel="nofollow" class="external text" href="http://[::]">unspecified</a></li>
5748 <li> <a rel="nofollow" class="external text" href="http://[::13.1.68.3]">ipv4compat</a></li>
5749 <li> <a rel="nofollow" class="external text" href="http://[::FFFF:129.144.52.38]">ipv4compat</a></li></ul>
5750 <p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2732">RFC 2732</a>, section 2:
5751 </p>
5752 <ul><li> <a rel="nofollow" class="external text" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">1</a></li>
5753 <li> <a rel="nofollow" class="external text" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">2</a></li>
5754 <li> <a rel="nofollow" class="external text" href="http://[3ffe:2a00:100:7031::1]">3</a></li>
5755 <li> <a rel="nofollow" class="external text" href="http://[1080::8:800:200C:417A]/foo">4</a></li>
5756 <li> <a rel="nofollow" class="external text" href="http://[::192.9.5.5]/ipng">5</a></li>
5757 <li> <a rel="nofollow" class="external text" href="http://[::FFFF:129.144.52.38]:80/index.html">6</a></li>
5758 <li> <a rel="nofollow" class="external text" href="http://[2010:836B:4179::836B:4179]">7</a></li></ul>
5759
5760 !! html/parsoid
5761 <p><a rel="mw:ExtLink" href="http://[2404:130:0:1000::187:2]/index.php">test</a></p>
5762
5763 <p>Examples from <a href="//tools.ietf.org/html/rfc2373" rel="mw:ExtLink">RFC 2373</a>, section 2.2:</p>
5764 <ul><li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]">unicast</a></li>
5765 <li> <a rel="mw:ExtLink" href="http://[FF01::101]">multicast</a></li>
5766 <li> <a rel="mw:ExtLink" href="http://[::1]/">loopback</a></li>
5767 <li> <a rel="mw:ExtLink" href="http://[::]">unspecified</a></li>
5768 <li> <a rel="mw:ExtLink" href="http://[::13.1.68.3]">ipv4compat</a></li>
5769 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]">ipv4compat</a></li></ul>
5770
5771 <p>Examples from <a href="//tools.ietf.org/html/rfc2732" rel="mw:ExtLink">RFC 2732</a>, section 2:</p>
5772 <ul><li> <a rel="mw:ExtLink" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">1</a></li>
5773 <li> <a rel="mw:ExtLink" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">2</a></li>
5774 <li> <a rel="mw:ExtLink" href="http://[3ffe:2a00:100:7031::1]">3</a></li>
5775 <li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/foo">4</a></li>
5776 <li> <a rel="mw:ExtLink" href="http://[::192.9.5.5]/ipng">5</a></li>
5777 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]:80/index.html">6</a></li>
5778 <li> <a rel="mw:ExtLink" href="http://[2010:836B:4179::836B:4179]">7</a></li></ul>
5779 !! end
5780
5781 !! test
5782 Non-extlinks in brackets
5783 !! wikitext
5784 [foo]
5785 [foo bar]
5786 [foo ''bar'']
5787 [fool's] errand
5788 [fool's errand]
5789 [{{echo|foo}}]
5790 [{{echo|foo}} bar]
5791 [{{echo|foo}} ''bar'']
5792 [{{echo|foo}}l's] errand
5793 [{{echo|foo}}l's errand]
5794 [url={{echo|foo}}]
5795 [url=http://example.com]
5796 [http:// bare protocols don't count]
5797 !! html/php
5798 <p>[foo]
5799 [foo bar]
5800 [foo <i>bar</i>]
5801 [fool's] errand
5802 [fool's errand]
5803 [foo]
5804 [foo bar]
5805 [foo <i>bar</i>]
5806 [fool's] errand
5807 [fool's errand]
5808 [url=foo]
5809 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
5810 [http:// bare protocols don't count]
5811 </p>
5812 !! html/parsoid
5813 <p>[foo]
5814 [foo bar]
5815 [foo <i>bar</i>]
5816 [fool's] errand
5817 [fool's errand]
5818 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}"}'>foo</span>]
5819 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}"}'>foo</span> bar]
5820 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}"}'>foo</span> <i>bar</i>]
5821 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}l&#39;s"}'>fool's</span>] errand
5822 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}l&#39;s"}'>fool's</span> errand]
5823 [<span typeof="mw:Placeholder" data-parsoid='{"src":"url={{echo|foo}}"}'>url=foo</span>]
5824 [url=<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>]
5825 [http:// bare protocols don't count]</p>
5826 !! end
5827
5828 !! test
5829 Percent encoding in external links
5830 !! wikitext
5831 [https://github.com/search?l=&q=ResourceLoader+%40wikimedia Search]
5832 !! html/php
5833 <p><a rel="nofollow" class="external text" href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a>
5834 </p>
5835 !! html/parsoid
5836 <p><a rel="mw:ExtLink"
5837 href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a></p>
5838 !! end
5839
5840 !! test
5841 Use url link syntax for links where the content is equal the link target
5842 !! wikitext
5843 http://example.com
5844 !! html/php
5845 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
5846 </p>
5847 !! html/parsoid
5848 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></p>
5849 !! end
5850
5851 !! test
5852 Parenthesis in external links, especially URL links
5853 !! wikitext
5854 http://example.com)
5855
5856 http://example.com/test)
5857
5858 http://example.com/(test)
5859
5860 http://example.com/((test)
5861
5862 (http://example.com/(test))
5863
5864 (http://example.com/(test)))))
5865
5866 http://example.com/a)b
5867
5868 [http://example.com) foo]
5869 !! html/php
5870 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5871 </p><p><a rel="nofollow" class="external free" href="http://example.com/test">http://example.com/test</a>)
5872 </p><p><a rel="nofollow" class="external free" href="http://example.com/(test)">http://example.com/(test)</a>
5873 </p><p><a rel="nofollow" class="external free" href="http://example.com/((test)">http://example.com/((test)</a>
5874 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test))">http://example.com/(test))</a>
5875 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test)))))">http://example.com/(test)))))</a>
5876 </p><p><a rel="nofollow" class="external free" href="http://example.com/a)b">http://example.com/a)b</a>
5877 </p><p><a rel="nofollow" class="external text" href="http://example.com)">foo</a>
5878 </p>
5879 !! html/parsoid
5880 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)</p>
5881 <p><a rel="mw:ExtLink" href="http://example.com/test">http://example.com/test</a>)</p>
5882 <p><a rel="mw:ExtLink" href="http://example.com/(test)">http://example.com/(test)</a></p>
5883 <p><a rel="mw:ExtLink" href="http://example.com/((test)">http://example.com/((test)</a></p>
5884 <p>(<a rel="mw:ExtLink" href="http://example.com/(test))">http://example.com/(test))</a></p>
5885 <p>(<a rel="mw:ExtLink" href="http://example.com/(test)))))">http://example.com/(test)))))</a></p>
5886 <p><a rel="mw:ExtLink" href="http://example.com/a)b">http://example.com/a)b</a></p>
5887 <p><a rel="mw:ExtLink" href="http://example.com)">foo</a></p>
5888 !! end
5889
5890 !! test
5891 Parenthesis in external links, w/ transclusion or comment
5892 !! wikitext
5893 (http://example.com/{{echo|hi}})
5894
5895 (http://example.com<!-- hi -->)
5896 !! html/php
5897 <p>(<a rel="nofollow" class="external free" href="http://example.com/hi">http://example.com/hi</a>)
5898 </p><p>(<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5899 </p>
5900 !! html/parsoid
5901 <p>(<a typeof="mw:ExpandedAttrs" about="#mwt2" rel="mw:ExtLink" href="http://example.com/hi" data-parsoid='{"stx":"url","a":{"href":"http://example.com/hi"},"sa":{"href":"http://example.com/{{echo|hi}}"}}' data-mw='{"attribs":[[{"txt":"href"},{"html":"http://example.com/&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[20,31,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"hi\"}},\"i\":0}}]}&#39;>hi&lt;/span>"}]]}'>http://example.com/hi</a>)</p>
5902
5903 <p>(<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url","a":{"href":"http://example.com"},"sa":{"href":"http://example.com&lt;!-- hi -->"}}'>http://example.com</a>)</p>
5904 !! end
5905
5906 !! test
5907 Serialize <a> tags with invalid link targets as plain text
5908 !! options
5909 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
5910 !! html/parsoid
5911 <a rel="mw:WikiLink" href="[[foo]]">text</a>
5912 <a rel="mw:WikiLink" href="[[foo]]">*text</a>
5913 <a rel="mw:WikiLink" href="[[foo]]">[[foo]]</a>
5914 <a rel="mw:WikiLink" href="[[foo]]">*a [[foo]]</a>
5915 !! wikitext
5916 text
5917 <nowiki>*</nowiki>text
5918 <nowiki>[[foo]]</nowiki>
5919 <nowiki>*</nowiki>a <nowiki>[[foo]]</nowiki>
5920 !! end
5921
5922 !! test
5923 mw:ExtLink -vs- mw:WikiLink (T94723)
5924 !! options
5925 parsoid=html2wt
5926 !! html/parsoid
5927 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"piped","a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>Bar</a>
5928 <a rel="mw:WikiLink" href="./Foo" title="Foo">Bar</a>
5929 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
5930 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
5931 <p>
5932 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
5933 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
5934 </p>
5935 !! wikitext
5936 [[Foo|Bar]]
5937 [[Foo|Bar]]
5938 [[wikipedia:Foo|Bar]]
5939 [[wikipedia:Foo|Bar]]
5940
5941 [[wikipedia:European_Robin|European Robin]]
5942 [[wikipedia:European_Robin|European Robin]]
5943 !! end
5944
5945 !! test
5946 mw:ExtLink linking to a interwiki URL can be round-tripped losslessly (T94723)
5947 !! options
5948 parsoid=wt2wt
5949 !! wikitext
5950 [http://en.wikipedia.org/wiki/European_Robin European Robin]
5951 !! html/parsoid
5952 THIS SECTION IS NOT USED (but Parsoid won't run the test without it)
5953 !! end
5954
5955
5956 ###
5957 ### Quotes
5958 ###
5959
5960 !! test
5961 Quotes
5962 !! wikitext
5963 Normal text. '''Bold text.''' Normal text. ''Italic text.''
5964
5965 Normal text. '''''Bold italic text.''''' Normal text.
5966 !! html
5967 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
5968 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
5969 </p>
5970 !! end
5971
5972
5973 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
5974 # parser strips. The wikitext contains just the first half of the bold
5975 # quote pair.
5976 !! test
5977 Unclosed and unmatched quotes
5978 !! wikitext
5979 '''''Bold italic text '''with bold deactivated''' in between.'''''
5980
5981 '''''Bold italic text ''with italic deactivated'' in between.'''''
5982
5983 '''Bold text..
5984
5985 ..spanning two paragraphs (should not work).'''
5986
5987 '''Bold tag left open
5988
5989 ''Italic tag left open
5990
5991 Normal text.
5992
5993 <!-- Unmatching number of opening, closing tags: -->
5994 '''This year''''s election ''should'' beat '''last year''''s.
5995
5996 ''Tom'''s car is bigger than ''Susan'''s.
5997
5998 Plain ''italic'''s plain
5999 !! html/php
6000 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
6001 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
6002 </p><p><b>Bold text..</b>
6003 </p><p>..spanning two paragraphs (should not work).
6004 </p><p><b>Bold tag left open</b>
6005 </p><p><i>Italic tag left open</i>
6006 </p><p>Normal text.
6007 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
6008 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
6009 </p><p>Plain <i>italic'</i>s plain
6010 </p>
6011 !! html/parsoid
6012 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
6013 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
6014 </p><p><b>Bold text..</b>
6015 </p><p>..spanning two paragraphs (should not work).<b></b>
6016 </p><p><b>Bold tag left open</b>
6017 </p><p><i>Italic tag left open</i>
6018 </p><p>Normal text.
6019 </p>
6020 <!-- Unmatching number of opening, closing tags: -->
6021 <p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
6022 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
6023 </p><p>Plain <i>italic'</i>s plain
6024 </p>
6025 !! end
6026
6027 ###
6028 ### Tables
6029 ###
6030 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
6031 ###
6032
6033 # This should not produce <table></table> as <table><tr><td></td></tr></table>
6034 # is the bare minimum required by the spec, see:
6035 # https://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
6036 # Parsoid team replies: empty table tags are legal in HTML5
6037 !! test
6038 A table with no data.
6039 !! options
6040 parsoid=wt2html
6041 !! wikitext
6042 {||}
6043 !! html/php
6044
6045 !! html/parsoid
6046 <table></table>
6047
6048 !! end
6049
6050 !! test
6051 A table with stray table end tags on start tag line (wt2html)
6052 !! options
6053 parsoid=wt2html
6054 !! wikitext
6055 {|style="color: red;"|}
6056
6057 {|style="color: red;" |}
6058 |foo
6059 |}
6060
6061 {|style="color: red;"|} id="foo"
6062 |foo
6063 |}
6064
6065 {|style="color: red;" |} id="foo"
6066 |foo
6067 |}
6068 !! html
6069 <table style="color: red;"></table>
6070
6071 <table style="color: red;">
6072 <tbody><tr>
6073 <td>foo</td>
6074 </tr></tbody>
6075 </table>
6076
6077 <table style="color: red;" id="foo">
6078 <tbody><tr>
6079 <td>foo</td>
6080 </tr></tbody>
6081 </table>
6082
6083 <table style="color: red;" id="foo">
6084 <tbody><tr>
6085 <td>foo</td>
6086 </tr></tbody>
6087 </table>
6088
6089 !! end
6090
6091 !! test
6092 A table with no data (take 2)
6093 !! wikitext
6094 {|
6095 |}
6096 !! html/parsoid
6097 <table></table>
6098 !! end
6099
6100 # A table with nothing but a caption is invalid XHTML, we might want to render
6101 # this as <p>caption</p>
6102 # Parsoid team replies: table with only a caption is legal in HTML5
6103 !! test
6104 A table with nothing but a caption
6105 !! wikitext
6106 {|
6107 |+ caption
6108 |}
6109 !! html/php
6110 <table>
6111 <caption> caption
6112 </caption><tr><td></td></tr></table>
6113
6114 !! html/parsoid
6115 <table><caption> caption</caption></table>
6116 !! end
6117
6118 !! test
6119 A table with caption with default-spaced attributes and a table row
6120 !! wikitext
6121 {|
6122 |+ style="color: red;" | caption1
6123 |-
6124 | foo
6125 |}
6126 !! html
6127 <table>
6128 <caption style="color: red;"> caption1
6129 </caption>
6130 <tr>
6131 <td> foo
6132 </td></tr></table>
6133
6134 !! end
6135
6136 !! test
6137 A table with captions with non-default spaced attributes and a table row
6138 !! wikitext
6139 {|
6140 |+style="color: red;"|caption2
6141 |+ style="color: red;"| caption3
6142 |-
6143 | foo
6144 |}
6145 !! html
6146 <table>
6147 <caption style="color: red;">caption2
6148 </caption>
6149 <caption style="color: red;"> caption3
6150 </caption>
6151 <tr>
6152 <td> foo
6153 </td></tr></table>
6154
6155 !! end
6156
6157 !! test
6158 Table td-cell syntax variations
6159 !! wikitext
6160 {|
6161 | foo bar foo | baz
6162 | foo bar foo || baz
6163 | style='color:red;' | baz
6164 | style='color:red;' || baz
6165 |}
6166 !! html
6167 <table>
6168 <tr>
6169 <td> baz
6170 </td>
6171 <td> foo bar foo </td>
6172 <td> baz
6173 </td>
6174 <td style="color:red;"> baz
6175 </td>
6176 <td> style='color:red;' </td>
6177 <td> baz
6178 </td></tr></table>
6179
6180 !! end
6181
6182 !! test
6183 Simple table
6184 !! wikitext
6185 {|
6186 | 1 || 2
6187 |-
6188 | 3 || 4
6189 |}
6190 !! html
6191 <table>
6192 <tr>
6193 <td> 1 </td>
6194 <td> 2
6195 </td></tr>
6196 <tr>
6197 <td> 3 </td>
6198 <td> 4
6199 </td></tr></table>
6200
6201 !! end
6202
6203 !! test
6204 Simple table but with multiple dashes for row wikitext
6205 !! wikitext
6206 {|
6207 | foo
6208 |-----
6209 | bar
6210 |}
6211 !! html
6212 <table>
6213 <tr>
6214 <td> foo
6215 </td></tr>
6216 <tr>
6217 <td> bar
6218 </td></tr></table>
6219
6220 !! end
6221
6222 !! test
6223 Multiplication table
6224 !! wikitext
6225 {| border="1" cellpadding="2"
6226 |+Multiplication table
6227 |-
6228 ! &times; !! 1 !! 2 !! 3
6229 |-
6230 ! 1
6231 | 1 || 2 || 3
6232 |-
6233 ! 2
6234 | 2 || 4 || 6
6235 |-
6236 ! 3
6237 | 3 || 6 || 9
6238 |-
6239 ! 4
6240 | 4 || 8 || 12
6241 |-
6242 ! 5
6243 | 5 || 10 || 15
6244 |}
6245 !! html
6246 <table border="1" cellpadding="2">
6247 <caption>Multiplication table
6248 </caption>
6249 <tr>
6250 <th> &#215; </th>
6251 <th> 1 </th>
6252 <th> 2 </th>
6253 <th> 3
6254 </th></tr>
6255 <tr>
6256 <th> 1
6257 </th>
6258 <td> 1 </td>
6259 <td> 2 </td>
6260 <td> 3
6261 </td></tr>
6262 <tr>
6263 <th> 2
6264 </th>
6265 <td> 2 </td>
6266 <td> 4 </td>
6267 <td> 6
6268 </td></tr>
6269 <tr>
6270 <th> 3
6271 </th>
6272 <td> 3 </td>
6273 <td> 6 </td>
6274 <td> 9
6275 </td></tr>
6276 <tr>
6277 <th> 4
6278 </th>
6279 <td> 4 </td>
6280 <td> 8 </td>
6281 <td> 12
6282 </td></tr>
6283 <tr>
6284 <th> 5
6285 </th>
6286 <td> 5 </td>
6287 <td> 10 </td>
6288 <td> 15
6289 </td></tr></table>
6290
6291 !! end
6292
6293 !! test
6294 Accept "||" in table headings
6295 !! wikitext
6296 {|
6297 !h1 || h2
6298 |}
6299 !! html
6300 <table>
6301 <tr>
6302 <th>h1 </th>
6303 <th> h2
6304 </th></tr></table>
6305
6306 !! end
6307
6308 !! test
6309 Accept "!!" in table data
6310 !! wikitext
6311 {|
6312 | Foo!! ||
6313 |}
6314 !! html
6315 <table>
6316 <tr>
6317 <td> Foo!! </td>
6318 <td>
6319 </td></tr></table>
6320
6321 !! html/parsoid
6322 <table>
6323 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'> Foo!! </td><td data-parsoid='{"stx_v":"row","autoInsertedEnd":true}'></td></tr>
6324 </tbody></table>
6325 !! end
6326
6327 !! test
6328 Accept "||" in indented table headings
6329 !! wikitext
6330 :{|
6331 !h1 || h2
6332 |}
6333 !! html
6334 <dl><dd><table>
6335 <tr>
6336 <th>h1 </th>
6337 <th> h2
6338 </th></tr></table></dd></dl>
6339
6340 !! end
6341
6342 !! test
6343 Accept "!!" in templates
6344 !! wikitext
6345 {|
6346 !a {{echo|b!!c}}
6347 |}
6348 !! html/php
6349 <table>
6350 <tr>
6351 <th>a b</th>
6352 <th>c
6353 </th></tr></table>
6354
6355 !! html/parsoid
6356 <table>
6357 <tbody><tr><th typeof="mw:Transclusion" about="#mwt1" data-parsoid='{"autoInsertedEnd":true,"pi":[[{"k":"1"}]]}' data-mw='{"parts":["!a ",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"b!!c"}},"i":0}}]}'>a b</th><th about="#mwt1">c</th></tr>
6358 !! end
6359
6360 !! test
6361 Accept "!!" in table headings after newline
6362 !! wikitext
6363 {|
6364 !a
6365 b!!c
6366 |}
6367 !! html/php
6368 <table>
6369 <tr>
6370 <th>a
6371 <p>b!!c
6372 </p>
6373 </th></tr></table>
6374
6375 !! html/parsoid
6376 <table>
6377 <tbody><tr><th>a
6378 <p>b!!c</p></th></tr>
6379 </tbody></table>
6380 !! end
6381
6382 !! test
6383 Accept "!!" in table data of mixed wikitext / html syntax
6384 !! wikitext
6385 {|
6386 !a
6387 <tr><td>b!!c</td></tr>
6388 |}
6389 !! html+tidy
6390 <table>
6391 <tr>
6392 <th>a</th>
6393 </tr>
6394 <tr>
6395 <td>b!!c</td>
6396 </tr>
6397 </table>
6398 !! html/parsoid
6399 <table>
6400 <tbody><tr><th>a</th></tr>
6401 <tr data-parsoid='{"stx":"html"}'><td data-parsoid='{"stx":"html"}'>b!!c</td></tr>
6402 </tbody></table>
6403 !! end
6404
6405 !! test
6406 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
6407 !! wikitext
6408 {|
6409 !| h1
6410 || a
6411 |}
6412 !! html
6413 <table>
6414 <tr>
6415 <th> h1
6416 </th>
6417 <td> a
6418 </td></tr></table>
6419
6420 !! end
6421
6422 !!test
6423 Accept "| !" at start of line in tables (ignore !-attribute)
6424 !! wikitext
6425 {|
6426 |-
6427 | !style="color:red" | bar
6428 |}
6429 !! html
6430 <table>
6431
6432 <tr>
6433 <td> bar
6434 </td></tr></table>
6435
6436 !!end
6437
6438 !!test
6439 Allow +/- in 2nd and later cells in a row, in 1st cell when td-attrs are present, or in 1st cell when there is a space between "|" and +/-
6440 !! wikitext
6441 {|
6442 |-
6443 |style='color:red;'|+1
6444 |style='color:blue;'|-1
6445 |-
6446 | 1 || 2 || 3
6447 | 1 ||+2 ||-3
6448 |-
6449 | +1
6450 | -1
6451 |}
6452 !! html
6453 <table>
6454
6455 <tr>
6456 <td style="color:red;">+1
6457 </td>
6458 <td style="color:blue;">-1
6459 </td></tr>
6460 <tr>
6461 <td> 1 </td>
6462 <td> 2 </td>
6463 <td> 3
6464 </td>
6465 <td> 1 </td>
6466 <td>+2 </td>
6467 <td>-3
6468 </td></tr>
6469 <tr>
6470 <td> +1
6471 </td>
6472 <td> -1
6473 </td></tr></table>
6474
6475 !!end
6476
6477 !! test
6478 Table rowspan
6479 !! wikitext
6480 {| border=1
6481 | Cell 1, row 1
6482 |rowspan=2| Cell 2, row 1 (and 2)
6483 | Cell 3, row 1
6484 |-
6485 | Cell 1, row 2
6486 | Cell 3, row 2
6487 |}
6488 !! html
6489 <table border="1">
6490 <tr>
6491 <td> Cell 1, row 1
6492 </td>
6493 <td rowspan="2"> Cell 2, row 1 (and 2)
6494 </td>
6495 <td> Cell 3, row 1
6496 </td></tr>
6497 <tr>
6498 <td> Cell 1, row 2
6499 </td>
6500 <td> Cell 3, row 2
6501 </td></tr></table>
6502
6503 !! end
6504
6505 !! test
6506 Nested table
6507 !! wikitext
6508 {| border=1
6509 | &alpha;
6510 |
6511 {| bgcolor=#ABCDEF border=2
6512 |nested
6513 |-
6514 |table
6515 |}
6516 |the original table again
6517 |}
6518 !! html
6519 <table border="1">
6520 <tr>
6521 <td> &#945;
6522 </td>
6523 <td>
6524 <table bgcolor="#ABCDEF" border="2">
6525 <tr>
6526 <td>nested
6527 </td></tr>
6528 <tr>
6529 <td>table
6530 </td></tr></table>
6531 </td>
6532 <td>the original table again
6533 </td></tr></table>
6534
6535 !! end
6536
6537 !! test
6538 Invalid attributes in table cell (T3830)
6539 !! wikitext
6540 {|
6541 |Cell:|broken
6542 |}
6543 !! html
6544 <table>
6545 <tr>
6546 <td>broken
6547 </td></tr></table>
6548
6549 !! end
6550
6551 !! test
6552 Table cell attributes: Pipes protected by nowikis should be treated as a plain character
6553 !! wikitext
6554 {|
6555 | title="foo" |bar
6556 | title="foo<nowiki>|</nowiki>" |bar
6557 | title="foo<nowiki>|</nowiki>" bar
6558 |}
6559 !! html/php
6560 <table>
6561 <tr>
6562 <td title="foo">bar
6563 </td>
6564 <td title="foo&#124;">bar
6565 </td>
6566 <td> title="foo|" bar
6567 </td></tr></table>
6568
6569 !! html/parsoid
6570 <table>
6571 <tbody><tr><td title="foo">bar</td>
6572 <td title="foo|" data-parsoid='{"a":{"title":"foo|"},"sa":{"title":"foo&lt;nowiki>|&lt;/nowiki>"},"autoInsertedEnd":true}'>bar</td>
6573 <td> title="foo<span typeof="mw:Nowiki">|</span>" bar</td></tr>
6574 </tbody></table>
6575 !! end
6576
6577 # See: http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html
6578 # N.B. The "|}" to close the table is missing from the input, so parsoid's
6579 # *2wt modes will fail.
6580 !! test
6581 Table security: embedded pipes
6582 !! options
6583 parsoid=wt2html,html2html
6584 !! wikitext
6585 {|
6586 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
6587 !! html/php
6588 <table>
6589 <tr>
6590 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
6591 <td>]" onmouseover="alert(document.cookie)"&gt;test
6592 </td>
6593 </tr>
6594 </table>
6595
6596 !! html/parsoid
6597 <table><tbody>
6598 <tr>
6599 <td data-parsoid='{"startTagSrc":"| ","attrSepSrc":"|","autoInsertedEnd":true}'>[<a rel="mw:ExtLink" href="ftp://%7Cx" data-parsoid='{"stx":"url","a":{"href":"ftp://%7Cx"},"sa":{"href":"ftp://|x"}}'>ftp://%7Cx</a></td><td data-parsoid='{"stx_v":"row","autoInsertedEnd":true}'>]" onmouseover="alert(document.cookie)">test</td></tr></tbody></table>
6600 !! end
6601
6602 !! test
6603 Element attributes with double ! should not be broken up by <th>
6604 !! wikitext
6605 {|
6606 ! hi <div class="!!">ha</div> ho
6607 |}
6608 !! html/php
6609 <table>
6610 <tr>
6611 <th> hi <div class="!!">ha</div> ho
6612 </th></tr></table>
6613
6614 !! html/parsoid
6615 <table>
6616 <tbody><tr><th> hi <div class="!!" data-parsoid='{"stx":"html"}'>ha</div> ho</th></tr>
6617 </tbody></table>
6618 !! end
6619
6620 !! test
6621 ! and || in element attributes should not be parsed as <th>/<td>
6622 !! wikitext
6623 {|
6624 | <div style="color: red !important;" data-contrived="put this here ||">hi</div>
6625 |}
6626 !! html/php
6627 <table>
6628 <tr>
6629 <td> <div style="color: red !important;" data-contrived="put this here &#124;&#124;">hi</div>
6630 </td></tr></table>
6631
6632 !! html/parsoid
6633 <table>
6634 <tbody><tr><td> <div style="color: red !important;" data-contrived="put this here ||" data-parsoid='{"stx":"html"}'>hi</div></td></tr>
6635 </tbody></table>
6636 !! end
6637
6638 # FIXME: The output seems broken. Filed as T110268.
6639 !! test
6640 ! and || in td attributes should not be parsed as <th>/<td>
6641 !! options
6642 parsoid=wt2html
6643 !! wikitext
6644 {|
6645 | style="color: red !important;" data-contrived="put this here ||" | foo
6646 |}
6647 !! html/php
6648 <table>
6649 <tr>
6650 <td> style="color: red !important;" data-contrived="put this here </td>
6651 <td> foo
6652 </td></tr></table>
6653
6654 !! html/parsoid
6655 <table>
6656 <tbody><tr><td> style="color: red !important;" data-contrived="put this here </td><td data-parsoid='{"stx_v":"row","a":{"\"":null},"sa":{"\"":""},"autoInsertedEnd":true}'> foo</td></tr>
6657 </tbody></table>
6658 !! end
6659
6660 !! test
6661 Break on | in element attribute in template
6662 !! options
6663 parsoid=wt2html,html2html
6664 !! wikitext
6665 {{echo|1=<div class="hi|ho">ha</div>}}
6666 !! html/php
6667 <p>ho"&gt;ha&lt;/div&gt;
6668 </p>
6669 !! html/parsoid
6670 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"ho\">ha&lt;/div>"}},"i":0}}]}'>ho">ha</span>
6671 !! end
6672
6673 !! test
6674 Break on | in element attribute name in template
6675 !! wikitext
6676 {{echo|<div cla|ss="hiho">ha</div>}}
6677 !! html/parsoid
6678 <p about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"},{"k":"ss","named":true}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;div cla"},"ss":{"wt":"\"hiho\">ha&lt;/div>"}},"i":0}}]}'>&lt;div cla</p>
6679 !! end
6680
6681 !! test
6682 Don't break on | in extension attribute in template
6683 !! wikitext
6684 {{echo|<ref name="hi|ho">ha</ref>}}
6685
6686 <references />
6687 !! html/parsoid
6688 <p><span about="#mwt2" class="mw-ref" id="cite_ref-hi.7Cho_1-0" rel="dc:references" typeof="mw:Transclusion mw:Extension/ref" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;ref name=\"hi|ho\">ha&lt;/ref>"}},"i":0}}]}'><a href="./Main_Page#cite_note-hi.7Cho-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></span></p>
6689
6690 <ol class="mw-references references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-hi.7Cho-1" id="cite_note-hi.7Cho-1"><a href="./Main_Page#cite_ref-hi.7Cho_1-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-hi.7Cho-1" class="mw-reference-text">ha</span></li></ol>
6691 !! end
6692
6693 ## We don't support roundtripping of these attributes in Parsoid.
6694 ## Selective serialization takes care of preventing dirty diffs.
6695 ## But, on edits, we dirty-diff the invalid attribute text.
6696 !! test
6697 Invalid text in table attributes should be discarded
6698 !! options
6699 parsoid=wt2html
6700 !! wikitext
6701 {| <span>boo</span> style='border:1px solid black'
6702 | <span>boo</span> style='color:blue' | 1
6703 |<span>boo</span> style='color:blue'| 2
6704 |}
6705 !! html/php
6706 <table style="border:1px solid black">
6707 <tr>
6708 <td style="color:blue"> 1
6709 </td>
6710 <td style="color:blue"> 2
6711 </td></tr></table>
6712
6713 !! html/parsoid
6714 <table style="border:1px solid black">
6715 <tr>
6716 <td style="color:blue"> 1</td>
6717 <td style="color:blue"> 2</td>
6718 </tr>
6719 </table>
6720 !! end
6721
6722 !! test
6723 Invalid text in table attributes should be preserved by selective serializer
6724 !! options
6725 parsoid={
6726 "modes": ["selser"],
6727 "changes": [
6728 ["td:first-child", "text", "abc"],
6729 ["td + td", "text", "xyz"]
6730 ]
6731 }
6732 !! wikitext
6733 {| <span>boo</span> style='border:1px solid black'
6734 | <span>boo</span> style='color:blue' | 1
6735 |<span>boo</span> style='color:blue'| 2
6736 |}
6737 !! wikitext/edited
6738 {| <span>boo</span> style='border:1px solid black'
6739 | <span>boo</span> style='color:blue' |abc
6740 |<span>boo</span> style='color:blue'|xyz
6741 |}
6742 !! end
6743
6744 !! test
6745 1. Template-generated table cell attributes and cell content
6746 !! wikitext
6747 {|
6748 |{{table_attribs}}
6749 | {{table_attribs}}
6750 || {{table_attribs_5}}
6751 | <!--foo--> <!--bar--> <!--baz--> {{table_attribs}}
6752 |align=center {{table_attribs}}
6753 | <!--foo--> align=center <!--bar--> {{table_attribs}}
6754 |}
6755 !! html
6756 <table>
6757 <tr>
6758 <td style="color:red;">Foo
6759 </td>
6760 <td style="color:red;">Foo
6761 </td>
6762 <td> style="color:red;"</td>
6763 <td>Bar
6764 </td>
6765 <td style="color:red;">Foo
6766 </td>
6767 <td align="center" style="color:red;">Foo
6768 </td>
6769 <td align="center" style="color:red;">Foo
6770 </td></tr></table>
6771
6772 !! end
6773
6774 !! test
6775 2. Template-generated table cell attributes and cell content
6776 !! wikitext
6777 {|
6778 |{{table_attribs_2}}
6779 |}
6780 !! html/php
6781 <table>
6782 <tr>
6783 <td style="color:red;">Foo
6784 </td>
6785 <td>Bar</td>
6786 <td>Baz
6787 </td></tr></table>
6788
6789 !! html/parsoid
6790 <table>
6791 <tbody><tr><td about="#mwt1" typeof="mw:Transclusion" style="color:red;" data-mw='{"parts":["|",{"template":{"target":{"wt":"table_attribs_2","href":"./Template:Table_attribs_2"},"params":{},"i":0}}]}'>Foo</td>
6792 <td about="#mwt1">Bar</td><td about="#mwt1">Baz</td></tr>
6793 </tbody></table>
6794 !! end
6795
6796 !! test
6797 3. Template-generated table cell attributes and cell content
6798 !! wikitext
6799 {|
6800 !align=center {{table_header_cells}}
6801 |-
6802 |align=center {{table_cells}}
6803 |}
6804 !! html/php
6805 <table>
6806 <tr>
6807 <th align="center" style="color:red;">Foo</th>
6808 <th style="color:red;"><i>Bar</i></th>
6809 <th style="color:brown;"><i>Foo</i> and Baz
6810 </th></tr>
6811 <tr>
6812 <td align="center" style="color:red;">Foo</td>
6813 <td style="color:red;"><i>Bar</i></td>
6814 <td style="color:brown;"><i>Foo</i> and Baz
6815 </td></tr></table>
6816
6817 !! html/parsoid
6818 <table>
6819 <tbody><tr><th align="center" style="color:red;" typeof="mw:Transclusion" about="#mwt1" data-mw='{"parts":["!align=center ",{"template":{"target":{"wt":"table_header_cells","href":"./Template:Table_header_cells"},"params":{},"i":0}}]}'>Foo</th><th about="#mwt1" style="color:red;"><i about="#mwt1">Bar</i></th><th about="#mwt1" style="color:brown;"><i about="#mwt1">Foo</i> and Baz</th></tr><tr>
6820 <td align="center" style="color:red;" typeof="mw:Transclusion" about="#mwt1" data-mw='{"parts":["|align=center ",{"template":{"target":{"wt":"table_cells","href":"./Template:Table_cells"},"params":{},"i":0}}]}'>Foo</td><td about="#mwt1" style="color:red;"><i about="#mwt1">Bar</i></td><td about="#mwt1" style="color:brown;"><i about="#mwt1">Foo</i> and Baz</td></tr>
6821 </tbody></table>
6822 !! end
6823
6824 !! test
6825 4. Template-generated table cell attributes and cell content inside a templated table
6826 !! wikitext
6827 {{tbl-start}}
6828 !align=center {{table_header_cells}}
6829 |-
6830 |align=center {{table_cells}}
6831 {{tbl-end}}
6832 !! html/php
6833 <table>
6834 <tr>
6835 <th align="center" style="color:red;">Foo</th>
6836 <th style="color:red;"><i>Bar</i></th>
6837 <th style="color:brown;"><i>Foo</i> and Baz
6838 </th></tr>
6839 <tr>
6840 <td align="center" style="color:red;">Foo</td>
6841 <td style="color:red;"><i>Bar</i></td>
6842 <td style="color:brown;"><i>Foo</i> and Baz
6843 </td></tr></table>
6844
6845 !! html/parsoid
6846 <table about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[],[],[],[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"tbl-start","href":"./Template:Tbl-start"},"params":{},"i":0}},"\n!align=center ",{"template":{"target":{"wt":"table_header_cells","href":"./Template:Table_header_cells"},"params":{},"i":1}},"\n|-\n|align=center ",{"template":{"target":{"wt":"table_cells","href":"./Template:Table_cells"},"params":{},"i":2}},"\n",{"template":{"target":{"wt":"tbl-end","href":"./Template:Tbl-end"},"params":{},"i":3}}]}'>
6847 <tbody><tr><th align="center" style="color:red;">Foo</th><th style="color:red;"><i>Bar</i></th><th style="color:brown;"><i>Foo</i> and Baz</th></tr>
6848 <tr>
6849 <td align="center" style="color:red;">Foo</td><td style="color:red;"><i>Bar</i></td><td style="color:brown;"><i>Foo</i> and Baz</td></tr>
6850 </tbody></table>
6851 !! end
6852
6853 ## Edge case fix to prevent future regressions
6854 !! test
6855 T107652: <ref>s in templates that also generate table cell attributes should be rendered properly
6856 !! wikitext
6857 {|
6858 |{{table_attribs_7}}
6859 |}
6860 <references />
6861 !! html/parsoid
6862 <table>
6863 <tbody><tr><td style="background:#f9f9f9;" typeof="mw:Transclusion" about="#mwt1" data-mw='{"parts":["|",{"template":{"target":{"wt":"table_attribs_7","href":"./Template:Table_attribs_7"},"params":{},"i":0}}]}'>Foo<span class="mw-ref" id="cite_ref-1" rel="dc:references" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="./Main_Page#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></span></td></tr>
6864 </tbody></table>
6865 <ol class="mw-references references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><a href="./Main_Page#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text" data-parsoid="{}">foo</span></li></ol>
6866 !! end
6867
6868 !! test
6869 Table with row followed by newlines and table heading
6870 !! options
6871 parsoid=wt2html,html2html
6872 !! wikitext
6873 {|
6874 |-
6875
6876 ! foo
6877 |}
6878 !! html/*
6879 <table>
6880
6881
6882 <tr>
6883 <th> foo
6884 </th></tr></table>
6885
6886 !! end
6887
6888 !! test
6889 Table with empty line following the start tag
6890 !! options
6891 parsoid=wt2html,html2html
6892 !! wikitext
6893 {|
6894
6895 |-
6896 | foo
6897 |}
6898 !! html/*
6899 <table>
6900
6901
6902 <tr>
6903 <td> foo
6904 </td></tr></table>
6905
6906 !! end
6907
6908 !! test
6909 Table attributes with empty value
6910 !! options
6911 parsoid=wt2html,html2html
6912 !! wikitext
6913 {|
6914 | style=| hello
6915 |}
6916 !! html/php
6917 <table>
6918 <tr>
6919 <td style=""> hello
6920 </td></tr></table>
6921
6922 !! html/parsoid
6923 <table>
6924 <tbody><tr><td style=""> hello</td></tr>
6925 </tbody></table>
6926 !! end
6927
6928 !! test
6929 Wikitext table with a lot of comments
6930 !! wikitext
6931 {|
6932 <!-- c0 -->
6933 | foo
6934 <!-- c1 -->
6935 |-<!-- c2 -->
6936 <!-- c3 -->
6937 |<!-- c4 -->
6938 <!-- c5 -->
6939 |}
6940 !! html
6941 <table>
6942 <tr>
6943 <td> foo
6944 </td></tr>
6945 <tr>
6946 <td>
6947 </td></tr></table>
6948
6949 !! end
6950
6951 !! test
6952 Wikitext table comments represented in parsoid dom
6953 !! wikitext
6954 {|<!--c1--><!--c2-->
6955 |-<!--c3-->
6956 | x
6957 |}
6958 !! html/php+tidy
6959 <table>
6960 <tr>
6961 <td>x</td>
6962 </tr>
6963 </table>
6964 !! html/parsoid
6965 <table><!--c1--><!--c2-->
6966 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'><!--c3-->
6967 <td data-parsoid='{"autoInsertedEnd":true}'> x</td></tr>
6968 </tbody></table>
6969 !! end
6970
6971 !! test
6972 Wikitext table with double-line table cell
6973 !! wikitext
6974 {|
6975 |a
6976 b
6977 |}
6978 !! html
6979 <table>
6980 <tr>
6981 <td>a
6982 <p>b
6983 </p>
6984 </td></tr></table>
6985
6986 !! end
6987
6988 !! test
6989 Table cell with a single comment
6990 !! wikitext
6991 {|
6992 | <!-- c1 -->
6993 | a
6994 |}
6995 !! html
6996 <table>
6997 <tr>
6998 <td>
6999 </td>
7000 <td> a
7001 </td></tr></table>
7002
7003 !! end
7004
7005 !! test
7006 Table-cell after a comment-only-empty-line
7007 !! wikitext
7008 {|
7009 |a
7010 <!--c1-->
7011 <!--c2-->| b
7012 |}
7013 !! html
7014 <table>
7015 <tr>
7016 <td>a
7017 </td>
7018 <td> b
7019 </td></tr></table>
7020
7021 !! html/parsoid
7022 <table>
7023 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>a</td>
7024 <!--c1-->
7025 <!--c2--><td data-parsoid='{"autoInsertedEnd":true}'> b</td></tr>
7026 </tbody></table>
7027
7028 !! end
7029
7030 !! test
7031 Build table with {{!}}
7032 !! wikitext
7033 {{{!}} class="wikitable"
7034 ! header
7035 ! second header
7036 {{!}}- style="color:red;"
7037 {{!}} data {{!}}{{!}} style="color:red;" {{!}} second data
7038 {{!}}}
7039 !! html
7040 <table class="wikitable">
7041 <tr>
7042 <th> header
7043 </th>
7044 <th> second header
7045 </th></tr>
7046 <tr style="color:red;">
7047 <td> data </td>
7048 <td style="color:red;"> second data
7049 </td></tr></table>
7050
7051 !! end
7052
7053 !! test
7054 Build table with pipe as data
7055 !! wikitext
7056 {| class="wikitable"
7057 ! header
7058 ! second header
7059 |- style="color:red;"
7060 | data || style="color:red;" | second data
7061 |-
7062 | style="color:red;" | data with | || style="color:red;" | second data with |
7063 |-
7064 || data with | ||| second data with |
7065 |}
7066 !! html
7067 <table class="wikitable">
7068 <tr>
7069 <th> header
7070 </th>
7071 <th> second header
7072 </th></tr>
7073 <tr style="color:red;">
7074 <td> data </td>
7075 <td style="color:red;"> second data
7076 </td></tr>
7077 <tr>
7078 <td style="color:red;"> data with | </td>
7079 <td style="color:red;"> second data with |
7080 </td></tr>
7081 <tr>
7082 <td> data with | </td>
7083 <td> second data with |
7084 </td></tr></table>
7085
7086 !! end
7087
7088 !! test
7089 Build table with wikilink
7090 !! wikitext
7091 {| class="wikitable"
7092 ! header || second header
7093 |- style="color:red;"
7094 | data [[Main Page|linktext]] || second data [[Main Page|linktext]]
7095 |-
7096 | data || second data [[Main Page|link|text with pipe]]
7097 |}
7098 !! html
7099 <table class="wikitable">
7100 <tr>
7101 <th> header </th>
7102 <th> second header
7103 </th></tr>
7104 <tr style="color:red;">
7105 <td> data <a href="/wiki/Main_Page" title="Main Page">linktext</a> </td>
7106 <td> second data <a href="/wiki/Main_Page" title="Main Page">linktext</a>
7107 </td></tr>
7108 <tr>
7109 <td> data </td>
7110 <td> second data <a href="/wiki/Main_Page" title="Main Page">link|text with pipe</a>
7111 </td></tr></table>
7112
7113 !! end
7114
7115 # The expected HTML structure in this test is debatable. The PHP parser does
7116 # not parse this kind of table at all. The main focus for Parsoid is on
7117 # round-tripping, so this output is ok for now. TODO: revisit!
7118 !! test
7119 Wikitext table with html-syntax row
7120 !! wikitext
7121 {|
7122 |-
7123 <td>foo</td>
7124 |}
7125 !! html/parsoid
7126 <table>
7127 <tbody>
7128 <tr>
7129 <td>foo</td></tr></tbody></table>
7130 !! end
7131
7132 !! test
7133 Implicit <td> after a |-
7134 !! options
7135 parsoid=wt2html,html2html
7136 !! wikitext
7137 {|
7138 |-
7139 a
7140 |}
7141 !! html/php
7142 <table>
7143
7144 a
7145 </table>
7146
7147 !! html/php+tidy
7148 <p>a</p>
7149 !! html/parsoid
7150 <p data-parsoid='{"fostered":true,"autoInsertedEnd":true}'>a</p><table>
7151 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
7152
7153 </tr></tbody></table>
7154 !! end
7155
7156 !! test
7157 Lists should be recognized in an implicit <td> context
7158 !! options
7159 parsoid=wt2html,html2html
7160 !! wikitext
7161 {|
7162 |-
7163 *a
7164 |}
7165 !! html/php
7166 <table>
7167
7168 <ul><li>a</li></ul>
7169 </table>
7170
7171 !! html/php+tidy
7172 <ul>
7173 <li>a</li>
7174 </ul>
7175 !! html/parsoid
7176 <ul data-parsoid='{"fostered":true,"autoInsertedEnd":true}'><li>a</li></ul><table>
7177 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
7178
7179 </tr></tbody></table>
7180 !! end
7181
7182 !! test
7183 Table cells not properly parsed in an implicit-td context
7184 !! wikitext
7185 {|
7186 |-
7187 {{table_attribs_4}} || a || b
7188 |}
7189 !! html/php+tidy
7190 <table>
7191 <tr>
7192 <td style="background-color:#DC241f;" width="10px"></td>
7193 <td>a</td>
7194 <td>b</td>
7195 </tr>
7196 </table>
7197 !! html/parsoid
7198 <table>
7199 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
7200 <td style="background-color:#DC241f;" width="10px" about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"autoInsertedEnd":true,"pi":[[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"table_attribs_4","href":"./Template:Table_attribs_4"},"params":{},"i":0}}," || a || b"]}'> </td><td about="#mwt1"> a </td><td about="#mwt1"> b</td></tr>
7201 !! end
7202
7203 !! test
7204 Parsoid: Round-trip tables directly followed by content (T53219)
7205 !! options
7206 parsoid=wt2html,wt2wt
7207 !! wikitext
7208 {|
7209 |foo
7210 |} bar
7211
7212 {|
7213 |baz
7214 |}<b>quux</b>
7215 !! html+tidy
7216 <table>
7217 <tr>
7218 <td>foo</td>
7219 </tr>
7220 </table>
7221 <p>bar</p>
7222 <table>
7223 <tr>
7224 <td>baz</td>
7225 </tr>
7226 </table>
7227 <p><b>quux</b></p>
7228 !! end
7229
7230 !! test
7231 Parsoid: Default to a newline after tables in new content (T53219)
7232 !! options
7233 parsoid=html2wt
7234 !! html/parsoid
7235 <table><tbody>
7236 <tr><td>foo</td></tr></tbody></table> bar
7237 <table><tbody>
7238 <tr><td>baz</td></tr></tbody></table><b>quux</b>
7239 !! wikitext
7240 {|
7241 |foo
7242 |}
7243 <nowiki> </nowiki>bar
7244 {|
7245 |baz
7246 |}
7247 '''quux'''
7248 !! end
7249
7250 !! test
7251 Parsoid: newline inducing block nodes don't suppress <nowiki>
7252 !! options
7253 parsoid=html2wt
7254 !! html/parsoid
7255 a<h1>foo</h1>
7256 !! wikitext
7257 <nowiki> </nowiki>a
7258
7259 = foo =
7260 !! end
7261
7262 !! test
7263 Parsoid: Row-syntax table headings followed by comment & table cells
7264 !! options
7265 parsoid=wt2html,wt2wt
7266 !! wikitext
7267 {|
7268 ! foo || bar
7269 <!-- foo --> || baz || quux
7270 |}
7271 !! html/php
7272 <table>
7273 <tr>
7274 <th> foo </th>
7275 <th> bar
7276 </th>
7277 <td> baz </td>
7278 <td> quux
7279 </td></tr></table>
7280
7281 !! html/parsoid
7282 <table>
7283 <tbody><tr><th> foo </th><th> bar
7284 <!-- foo --> </th><td> baz </td><td> quux</td></tr>
7285 </tbody></table>
7286 !! end
7287
7288 !!test
7289 Parsoid: Recover better from broken table attributes
7290 !!options
7291 parsoid=wt2html
7292 !!wikitext
7293 {| class="foo
7294 | class="bar" |
7295 foo
7296 |}
7297 !!html/php+tidy
7298 <table class="foo">
7299 <tr>
7300 <td class="bar">
7301 <p>foo</p>
7302 </td>
7303 </tr>
7304 </table>
7305 !!html/parsoid
7306 <table class="foo">
7307 <tr>
7308 <td class="bar">
7309 <p>foo</p></td></tr>
7310 </tbody></table>
7311 !!end
7312
7313 !! test
7314 Tables: Digest broken attributes on table and tr tag
7315 !! options
7316 parsoid=wt2html
7317 !! wikitext
7318 {| || |} ++
7319 |- || || ++ --
7320 |- > [
7321 |}
7322 !! html
7323 <table>
7324 <tbody>
7325 <tr class='mw-empty-elt'></tr>
7326 <tr class='mw-empty-elt'></tr>
7327 </tbody></table>
7328 !! end
7329
7330 # T137406: Whitespace in the HTML
7331 !! test
7332 1. Generate correct wikitext for tables with thead/tbody/tfoot
7333 !! options
7334 parsoid=html2wt
7335 !! html/parsoid
7336 <table>
7337 <caption>Test</caption>
7338 <thead>
7339 <tr>
7340 <th>Month</th>
7341 <th>Savings</th>
7342 </tr>
7343 </thead>
7344 <tbody>
7345 <tr>
7346 <td>January</td>
7347 <td>$100</td>
7348 </tr>
7349 <tr>
7350 <td>February</td>
7351 <td>$80</td>
7352 </tr>
7353 </tbody>
7354 <tfoot>
7355 <tr>
7356 <td>Sum</td>
7357 <td>$180</td>
7358 </tr>
7359 </tfoot>
7360 </table>
7361 !! wikitext
7362 {|
7363 |+Test
7364 !Month
7365 !Savings
7366 |-
7367 |January
7368 |$100
7369 |-
7370 |February
7371 |$80
7372 |-
7373 |Sum
7374 |$180
7375 |}
7376 !! html/php+tidy
7377 <table>
7378 <caption>Test</caption>
7379 <tr>
7380 <th>Month</th>
7381 <th>Savings</th>
7382 </tr>
7383 <tr>
7384 <td>January</td>
7385 <td>$100</td>
7386 </tr>
7387 <tr>
7388 <td>February</td>
7389 <td>$80</td>
7390 </tr>
7391 <tr>
7392 <td>Sum</td>
7393 <td>$180</td>
7394 </tr>
7395 </table>
7396 !! end
7397
7398 # T137406: No whitespace in the HTML
7399 !! test
7400 2. Generate correct wikitext for tables with thead/tbody/tfoot
7401 !! options
7402 parsoid=html2wt
7403 !! html/parsoid
7404 <table><thead><tr><th>heading</th></tr></thead><tbody><tr><td>foo</td></tr></tbody></table>
7405 !! wikitext
7406 {|
7407 !heading
7408 |-
7409 |foo
7410 |}
7411 !! end
7412
7413 !! test
7414 Testing serialization after deletion in references
7415 !! options
7416 parsoid={
7417 "modes": ["wt2wt"],
7418 "changes": [
7419 ["#x", "remove"]
7420 ]
7421 }
7422 !! wikitext
7423 hi <ref><div id="x">ho</div></ref>
7424
7425 <references />
7426 !! wikitext/edited
7427 hi <ref></ref>
7428
7429 <references />
7430 !! end
7431
7432 !!test
7433 Testing serialization after deletion of table cells
7434 !!options
7435 parsoid={
7436 "modes": ["wt2wt", "selser"],
7437 "changes": [
7438 ["#x", "remove"]
7439 ]
7440 }
7441 !!wikitext
7442 {|
7443 !h1 !!h2 !!h3
7444 | id="x" |c1 {{!}}{{!}}{{!}}c2 |||c3
7445 |}
7446 !! wikitext/edited
7447 {|
7448 !h1 !!h2 !!h3
7449 |c2 |||c3
7450 |}
7451 !!end
7452
7453 !! test
7454 Testing selser after addition of new row before first row (T125419)
7455 !! options
7456 parsoid={
7457 "modes": ["wt2wt", "selser"],
7458 "changes": [
7459 [ "tr", "before", "<tr><td>X</td></tr>" ]
7460 ]
7461 }
7462 !! wikitext
7463 {|
7464 |a
7465 |}
7466 !! wikitext/edited
7467 {|
7468 |X
7469 |-
7470 |a
7471 |}
7472 !! end
7473
7474 !! test
7475 Serialize new table rows in a HTML table using HTML tags
7476 !! options
7477 parsoid={
7478 "modes": ["wt2wt", "selser"],
7479 "changes": [
7480 [ "tr", "before", "<tr><td>X</td></tr>" ]
7481 ]
7482 }
7483 !! wikitext
7484 <table><tr><td>a</td></tr></table>
7485 !! wikitext/edited
7486 <table><tr><td>X</td></tr><tr><td>a</td></tr></table>
7487 !! end
7488
7489 !! test
7490 Serialize new table cells in a HTML row using HTML tags
7491 !! options
7492 parsoid={
7493 "modes": ["wt2wt", "selser"],
7494 "changes": [
7495 [ "td", "before", "<td>X</td>" ]
7496 ]
7497 }
7498 !! wikitext
7499 <table><tr><td>a</td></tr></table>
7500 !! wikitext/edited
7501 <table><tr><td>X</td><td>a</td></tr></table>
7502 !! end
7503
7504 !! test
7505 Wikitext tables can be nested inside HTML tables
7506 !! options
7507 parsoid=html2wt
7508 !! html
7509 <table data-parsoid='{"stx":"html"}'>
7510 <tr><td>
7511 <table>
7512 <tr><td>foo</td></tr>
7513 </table>
7514 </td></tr>
7515 </table>
7516 !! wikitext
7517 <table>
7518 <tr><td>
7519 {|
7520 |foo
7521 |}
7522 </td></tr>
7523 </table>
7524 !! end
7525
7526 !! test
7527 Serialize wikitext list items as HTML list items when embedded in a HTML list
7528 !! options
7529 parsoid=html2wt
7530 !! html
7531 <ul data-parsoid='{"stx": "html"}'>
7532 <li data-parsoid='{}'>a</li>
7533 <li>b</li>
7534 </ul>
7535 !! wikitext
7536 <ul>
7537 <li>a</li>
7538 <li>b</li>
7539 </ul>
7540 !! end
7541
7542 # SSS FIXME: Is this actually a good thing given the
7543 # odd nested list output that is generated by MW?
7544 # <ul><li>foo<ul>..</ul></li></ul> instead of
7545 # <ul><li>foo</li><ul>..</ul></ul>
7546 !! test
7547 Wikitext lists can be nested inside HTML lists
7548 !! options
7549 parsoid=html2wt
7550 !! html
7551 <ul data-parsoid='{"stx": "html"}'>
7552 <li data-parsoid='{"stx": "html"}'>a
7553 <ul><li>b</li></ul>
7554 </li>
7555 </ul>
7556
7557 <ul data-parsoid='{"stx": "html"}'>
7558 <li>x
7559 <ul><li>y</li></ul>
7560 </li>
7561 </ul>
7562 !! wikitext
7563 <ul>
7564 <li>a
7565 * b
7566 </li>
7567 </ul>
7568
7569 <ul>
7570 <li>x
7571 * y
7572 </li>
7573 </ul>
7574 !! end
7575
7576 ###
7577 ### Internal links
7578 ###
7579 !! test
7580 Plain link, capitalized
7581 !! wikitext
7582 [[Main Page]]
7583 !! html
7584 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
7585 </p>
7586 !! end
7587
7588 !! test
7589 Plain link, uncapitalized
7590 !! wikitext
7591 [[main Page]]
7592 !! html
7593 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
7594 </p>
7595 !! end
7596
7597 !! test
7598 Piped link
7599 !! wikitext
7600 [[Main Page|The Main Page]]
7601 !! html
7602 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
7603 </p>
7604 !! end
7605
7606 !! test
7607 Piped link with comment in link text
7608 !! wikitext
7609 [[Main Page|The Main<!--front--> Page]]
7610 !! html
7611 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
7612 </p>
7613 !! end
7614
7615 !! test
7616 Piped link with multiple pipe characters in link text
7617 !! wikitext
7618 [[Main Page||The|Main|Page|]]
7619 !! html/php
7620 <p><a href="/wiki/Main_Page" title="Main Page">|The|Main|Page|</a>
7621 </p>
7622 !! html/parsoid
7623 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">|The|Main|Page|</a></p>
7624 !! end
7625
7626 !! test
7627 Piped link with no link text
7628 !! wikitext
7629 [[Thomas Bek (bishop of St David's)|]]
7630 !! html/php
7631 <p>[[Thomas Bek (bishop of St David's)|]]
7632 </p>
7633 !! html/parsoid
7634 <p>[[Thomas Bek (bishop of St David's)|]]</p>
7635 !! end
7636
7637 !! test
7638 Piped link with empty link text
7639 !! wikitext
7640 [[Main Page|<nowiki/>]] - empty nowiki
7641 [[Main Page| ]] - empty space
7642 [[Main Page|&nbsp;]] - empty non breaking space
7643 !! html/php
7644 <p><a href="/wiki/Main_Page" title="Main Page"></a> - empty nowiki
7645 <a href="/wiki/Main_Page" title="Main Page"> </a> - empty space
7646 <a href="/wiki/Main_Page" title="Main Page">&#160;</a> - empty non breaking space
7647 </p>
7648 !! html/parsoid
7649 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page"><span typeof="mw:Nowiki"></span></a> - empty nowiki
7650 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page"> </a> - empty space
7651 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page"><span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span></a> - empty non breaking space</p>
7652 !! end
7653
7654 !! test
7655 Broken link
7656 !! wikitext
7657 [[Zigzagzogzagzig]]
7658 !! html
7659 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
7660 </p>
7661 !! end
7662
7663 !! test
7664 Broken link with fragment
7665 !! wikitext
7666 [[Zigzagzogzagzig#zug]]
7667 !! html
7668 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
7669 </p>
7670 !! end
7671
7672 !! test
7673 Special page link with fragment
7674 !! wikitext
7675 [[Special:Version#anchor]]
7676 !! html
7677 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
7678 </p>
7679 !! end
7680
7681 !! test
7682 Nonexistent special page link with fragment
7683 !! wikitext
7684 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
7685 !! html
7686 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
7687 </p>
7688 !! end
7689
7690 !! test
7691 Link with prefix
7692 !! wikitext
7693 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
7694 !! html
7695 <p>xxx<a href="/wiki/Main_Page" title="Main Page">main Page</a>, xxx<a href="/wiki/Main_Page" title="Main Page">Main Page</a>, Xxx<a href="/wiki/Main_Page" title="Main Page">main Page</a> XXX<a href="/wiki/Main_Page" title="Main Page">main Page</a>, XXX<a href="/wiki/Main_Page" title="Main Page">Main Page</a>
7696 </p>
7697 !! end
7698
7699 !! test
7700 Link with suffix
7701 !! wikitext
7702 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
7703 !! html
7704 <p><a href="/wiki/Main_Page" title="Main Page">Main Pagexxx</a>, <a href="/wiki/Main_Page" title="Main Page">Main Page</a>XXX, <a href="/wiki/Main_Page" title="Main Page">Main Page</a>!!!
7705 </p>
7706 !! end
7707
7708 !! article
7709 prefixed article
7710 !! text
7711 Some text
7712 !! endarticle
7713
7714 !! test
7715 T45661: Piped links with identical prefixes
7716 !! wikitext
7717 [[prefixed article|prefixed articles with spaces]]
7718
7719 [[prefixed article|prefixed articlesaoeu]]
7720
7721 [[Main Page|Main Page test]]
7722 !! html
7723 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
7724 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
7725 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
7726 </p>
7727 !! end
7728
7729
7730 !! test
7731 Link with HTML entity in suffix / tail
7732 !! wikitext
7733 [[Main Page]]&quot;, [[Main Page]]&#97;
7734 !! html/php
7735 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>&quot;, <a href="/wiki/Main_Page" title="Main Page">Main Page</a>&#97;
7736 </p>
7737 !! html/parsoid
7738 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;quot;","srcContent":"\""}'>"</span>, <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#97;","srcContent":"a"}'>a</span></p>
7739 !! end
7740
7741 !! test
7742 Link with 3 brackets
7743 !! wikitext
7744 [[[Main Page]]]
7745 Foo [[[Main Page]]]
7746 !! html
7747 <p>[[[Main Page]]]
7748 Foo [[[Main Page]]]
7749 </p>
7750 !! end
7751
7752 !! test
7753 Link with 4 brackets
7754 !! wikitext
7755 [[[[Main Page]]]]
7756 !! html
7757 <p>[[<a href="/wiki/Main_Page" title="Main Page">Main Page</a>]]
7758 </p>
7759 !! end
7760
7761 !! test
7762 Piped link with 3 brackets
7763 !! wikitext
7764 [[[main page|the main page]]]
7765 !! html
7766 <p>[[[main page|the main page]]]
7767 </p>
7768 !! end
7769
7770 !! test
7771 Piped link with extlink-like text
7772 !! wikitext
7773 [[Main Page|[bar]]]
7774 [[Main Page|This is a [bar]]]
7775 [[Main Page|[bar]]
7776 !! html/php
7777 <p><a href="/wiki/Main_Page" title="Main Page">[bar]</a>
7778 <a href="/wiki/Main_Page" title="Main Page">This is a [bar]</a>
7779 <a href="/wiki/Main_Page" title="Main Page">[bar</a>
7780 </p>
7781 !! html/parsoid
7782 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>[bar]</a>
7783 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>This is a [bar]</a>
7784 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>[bar</a></p>
7785 !! end
7786
7787 !! test
7788 Link with multiple pipes
7789 !! wikitext
7790 [[Main Page|The|Main|Page]]
7791 !! html
7792 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
7793 </p>
7794 !! end
7795
7796 !! test
7797 Anchor containing a #. (T65430)
7798 !! wikitext
7799 [[Main Page#And#Link]]
7800 !! html/php
7801 <p><a href="/wiki/Main_Page#And.23Link" title="Main Page">Main Page#And#Link</a>
7802 </p>
7803 !! html/parsoid
7804 <p><a rel="mw:WikiLink" href="./Main_Page#And.23Link" title="Main Page" data-parsoid='{"stx":"simple","a":{"href":"./Main_Page#And.23Link"},"sa":{"href":"Main Page#And#Link"}}'>Main Page#And#Link</a></p>
7805 !! end
7806
7807 !! test
7808 Link to namespaces
7809 !! wikitext
7810 [[Talk:Parser testing]], [[Meta:Disclaimers]]
7811 !! html
7812 <p><a href="/index.php?title=Talk:Parser_testing&amp;action=edit&amp;redlink=1" class="new" title="Talk:Parser testing (page does not exist)">Talk:Parser testing</a>, <a href="/index.php?title=Meta:Disclaimers&amp;action=edit&amp;redlink=1" class="new" title="Meta:Disclaimers (page does not exist)">Meta:Disclaimers</a>
7813 </p>
7814 !! end
7815
7816 !! test
7817 Link with space in namespace
7818 !! wikitext
7819 [[User talk:Foo bar]]
7820 !! html
7821 <p><a href="/index.php?title=User_talk:Foo_bar&amp;action=edit&amp;redlink=1" class="new" title="User talk:Foo bar (page does not exist)">User talk:Foo bar</a>
7822 </p>
7823 !! end
7824
7825 !! article
7826 MemoryAlpha:AlphaTest
7827 !! text
7828 This is an article in the MemoryAlpha namespace
7829 (which shadows the memoryalpha interwiki link).
7830 !! endarticle
7831
7832 !! test
7833 Namespace takes precedence over interwiki link (T53680)
7834 !! wikitext
7835 [[MemoryAlpha:AlphaTest]]
7836 !! html
7837 <p><a href="/wiki/MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
7838 </p>
7839 !! end
7840
7841 # The previous test doesn't work correctly in html2*, due to not recognizing the
7842 # link as an internal one. This one checks for the correct behavior.
7843 !! test
7844 Link to namespace preferred over interwiki with correct rel attribute
7845 !! options
7846 parsoid=html2wt,html2html
7847 !! html/parsoid
7848 <p><a rel="mw:WikiLink" href="./MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a></p>
7849 !! wikitext
7850 [[MemoryAlpha:AlphaTest]]
7851 !! end
7852
7853 !! test
7854 Piped link to namespace
7855 !! wikitext
7856 [[Meta:Disclaimers|The disclaimers]]
7857 !! html
7858 <p><a href="/index.php?title=Meta:Disclaimers&amp;action=edit&amp;redlink=1" class="new" title="Meta:Disclaimers (page does not exist)">The disclaimers</a>
7859 </p>
7860 !! end
7861
7862 !! test
7863 Link containing }
7864 !! wikitext
7865 [[Usually caused by a typo (oops}]]
7866 !! html
7867 <p>[[Usually caused by a typo (oops}]]
7868 </p>
7869 !! end
7870
7871 !! article
7872 7% Solution
7873 !! text
7874 Just a test of an article title containing a percent.
7875 !! endarticle
7876
7877 !! test
7878 Link containing % (not as a hex sequence)
7879 !! wikitext
7880 [[7% Solution]]
7881 [[7% Solution|7%25 Solution]]
7882 !! html/php
7883 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
7884 <a href="/wiki/7%25_Solution" title="7% Solution">7%25 Solution</a>
7885 </p>
7886 !! html/parsoid
7887 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a>
7888 <a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7%25 Solution</a></p>
7889 !! end
7890
7891 # note that the parsoid HTML is identical to the previous test output,
7892 # so the previous test ensures that the html2wt mode will generate the
7893 # "not as a hex sequence" wikitext.
7894 !! test
7895 Link containing % as a single hex sequence interpreted to char
7896 !! options
7897 parsoid=wt2wt,wt2html,html2html
7898 !! wikitext
7899 [[7%25 Solution]]
7900 [[7%25 Solution|7%25 Solution]]
7901 !! html/php
7902 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
7903 <a href="/wiki/7%25_Solution" title="7% Solution">7%25 Solution</a>
7904 </p>
7905 !! html/parsoid
7906 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a>
7907 <a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7%25 Solution</a></p>
7908 !!end
7909
7910 !! test
7911 Link containing % as a double hex sequence interpreted to hex sequence
7912 !! wikitext
7913 [[7%2525 Solution]]
7914 !! html
7915 <p>[[7%2525 Solution]]
7916 </p>
7917 !!end
7918
7919 ## Example for such a section: == < ==
7920 !! test
7921 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
7922 !! wikitext
7923 [[%23%3c]][[%23%3e]]
7924 !! html/php
7925 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
7926 </p>
7927 !! html/parsoid
7928 <p><a rel="mw:WikiLink" href="./Main_Page#.3C" title="Main Page" data-parsoid='{"stx":"simple","a":{"href":"./Main_Page#.3C"},"sa":{"href":"%23%3c"}}'>#&lt;</a><a rel="mw:WikiLink" href="./Main_Page#.3E" title="Main Page" data-parsoid='{"stx":"simple","a":{"href":"./Main_Page#.3E"},"sa":{"href":"%23%3e"}}'>#></a></p>
7929 !! end
7930
7931 !! test
7932 Link containing "<#" and ">#" as a hex sequences
7933 !! wikitext
7934 [[%3c%23]][[%3e%23]]
7935 !! html
7936 <p>[[%3c%23]][[%3e%23]]
7937 </p>
7938 !! end
7939
7940 !! test
7941 Link containing an equals sign
7942 !! wikitext
7943 [[Special:BookSources/isbn=4-00-026157-6]]
7944 !! html/php
7945 <p><a href="/wiki/Special:BookSources/isbn%3D4-00-026157-6" title="Special:BookSources/isbn=4-00-026157-6">Special:BookSources/isbn=4-00-026157-6</a>
7946 </p>
7947 !! html/parsoid
7948 <p><a rel="mw:WikiLink" href="./Special:BookSources/isbn=4-00-026157-6" title="Special:BookSources/isbn=4-00-026157-6">Special:BookSources/isbn=4-00-026157-6</a></p>
7949 !! end
7950
7951 !! article
7952 Foo~bar
7953 !! text
7954 Just a test of an article title containing a tilde.
7955 !! endarticle
7956
7957 # note that links containing signatures, like [[Foo~~~~]], are
7958 # massaged by the pre-save transform (PST) and so the tildes are never
7959 # seen by the parser.
7960 !! test
7961 Link containing a tilde
7962 !! wikitext
7963 [[Foo~bar]]
7964 !! html/php
7965 <p><a href="/wiki/Foo~bar" title="Foo~bar">Foo~bar</a>
7966 </p>
7967 !! html/parsoid
7968 <p><a rel="mw:WikiLink" href="./Foo~bar" title="Foo~bar">Foo~bar</a></p>
7969 !! end
7970
7971 !! test
7972 Link containing double-single-quotes '' (T6598)
7973 !! wikitext
7974 [[Lista d''e paise d''o munno]]
7975 !! html/php
7976 <p><a href="/index.php?title=Lista_d%27%27e_paise_d%27%27o_munno&amp;action=edit&amp;redlink=1" class="new" title="Lista d''e paise d''o munno (page does not exist)">Lista d''e paise d''o munno</a>
7977 </p>
7978 !! html/parsoid
7979 <p><a rel="mw:WikiLink" href="./Lista_d''e_paise_d''o_munno" title="Lista d''e paise d''o munno">Lista d''e paise d''o munno</a></p>
7980 !! end
7981
7982 !! test
7983 Link containing double quotes and spaces
7984 !! wikitext
7985 [[Cool "Gator"]]
7986 !! html/php
7987 <p><a href="/index.php?title=Cool_%22Gator%22&amp;action=edit&amp;redlink=1" class="new" title="Cool &quot;Gator&quot; (page does not exist)">Cool "Gator"</a>
7988 </p>
7989 !! html/parsoid
7990 <p><a rel="mw:WikiLink" href="./Cool_%22Gator%22" title='Cool "Gator"'>Cool "Gator"</a></p>
7991 !! end
7992
7993 !! test
7994 File containing double quotes and spaces
7995 !! wikitext
7996 [[File:Cool "Gator".png]]
7997 !! html/parsoid
7998 <p><span class="mw-default-size" typeof="mw:Error mw:Image" data-parsoid='{"optList":[]}' data-mw='{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}]}'><a href="./File:Cool_%22Gator%22.png" data-parsoid='{"a":{"href":"./File:Cool_%22Gator%22.png"},"sa":{"href":"File:Cool \"Gator\".png"}}'><img resource='./File:Cool_"Gator".png' src="./Special:FilePath/Cool_%22Gator%22.png" height="220" width="220" data-parsoid='{"a":{"resource":"./File:Cool_\"Gator\".png","height":"220","width":"220","src":"./Special:FilePath/Cool_%22Gator%22.png"},"sa":{"resource":"File:Cool \"Gator\".png","src":"./Special:FilePath/Cool_\"Gator\".png"}}'/></a></span></p>
7999 !! end
8000
8001 !! test
8002 Redirect containing double quotes and spaces
8003 !! wikitext
8004 #REDIRECT [[Cool "Gator"]]
8005 !! html/parsoid
8006 <link rel="mw:PageProp/redirect" href="./Cool_%22Gator%22" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Cool_%22Gator%22"},"sa":{"href":"Cool \"Gator\""}}'/>
8007 !! end
8008
8009 !! test
8010 Link containing double-single-quotes '' in text (T6598 sanity check)
8011 !! wikitext
8012 Some [[Link|pretty ''italics'' and stuff]]!
8013 !! html/php
8014 <p>Some <a href="/index.php?title=Link&amp;action=edit&amp;redlink=1" class="new" title="Link (page does not exist)">pretty <i>italics</i> and stuff</a>!
8015 </p>
8016 !! html/parsoid
8017 <p>Some <a rel="mw:WikiLink" href="./Link" title="Link">pretty <i>italics</i> and stuff</a>!</p>
8018 !! end
8019
8020 !! test
8021 Link containing double-single-quotes '' in text embedded in italics (T6598 sanity check)
8022 !! wikitext
8023 ''Some [[Link|pretty ''italics'' and stuff]]!''
8024 !! html
8025 <p><i>Some <a href="/index.php?title=Link&amp;action=edit&amp;redlink=1" class="new" title="Link (page does not exist)">pretty <i>italics</i> and stuff</a>!</i>
8026 </p>
8027 !! end
8028
8029 !! test
8030 Link with double quotes in title part (literal) and alternate part (interpreted)
8031 !! wikitext
8032 [[File:Denys_Savchenko_''Pentecoste''.jpg]]
8033
8034 [[''Pentecoste'']]
8035
8036 [[''Pentecoste''|Pentecoste]]
8037
8038 [[''Pentecoste''|''Pentecoste'']]
8039 !! html/php
8040 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Denys_Savchenko_%27%27Pentecoste%27%27.jpg" class="new" title="File:Denys Savchenko &#39;&#39;Pentecoste&#39;&#39;.jpg">File:Denys Savchenko <i>Pentecoste</i>.jpg</a>
8041 </p><p><a href="/index.php?title=%27%27Pentecoste%27%27&amp;action=edit&amp;redlink=1" class="new" title="''Pentecoste'' (page does not exist)">''Pentecoste''</a>
8042 </p><p><a href="/index.php?title=%27%27Pentecoste%27%27&amp;action=edit&amp;redlink=1" class="new" title="''Pentecoste'' (page does not exist)">Pentecoste</a>
8043 </p><p><a href="/index.php?title=%27%27Pentecoste%27%27&amp;action=edit&amp;redlink=1" class="new" title="''Pentecoste'' (page does not exist)"><i>Pentecoste</i></a>
8044 </p>
8045 !! html/parsoid
8046 <p><span class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}]}'><a href="./File:Denys_Savchenko_''Pentecoste''.jpg"><img resource="./File:Denys_Savchenko_''Pentecoste''.jpg" src="./Special:FilePath/Denys_Savchenko_''Pentecoste''.jpg" height="220" width="220"/></a></span></p>
8047 <p><a rel="mw:WikiLink" href="./''Pentecoste''" title="''Pentecoste''">''Pentecoste''</a></p>
8048 <p><a rel="mw:WikiLink" href="./''Pentecoste''" title="''Pentecoste''">Pentecoste</a></p>
8049 <p><a rel="mw:WikiLink" href="./''Pentecoste''" title="''Pentecoste''"><i>Pentecoste</i></a></p>
8050 !! end
8051
8052 !! test
8053 Broken image links with HTML captions (T41700)
8054 !! wikitext
8055 [[File:Nonexistent|<script></script>]]
8056 [[File:Nonexistent|100x100px|<script></script>]]
8057 [[File:Nonexistent|&lt;]]
8058 [[File:Nonexistent|a<i>b</i>c]]
8059 !! html/php
8060 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
8061 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
8062 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
8063 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
8064 </p>
8065 !! html/parsoid
8066 <p><span class="mw-default-size" typeof="mw:Error mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"&lt;script>&lt;/script>"}]}' data-mw='{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}],"caption":"&amp;lt;script>&amp;lt;/script>"}'><a href="./File:Nonexistent" data-parsoid='{"a":{"href":"./File:Nonexistent"},"sa":{}}'><img resource="./File:Nonexistent" src="./Special:FilePath/Nonexistent" height="220" width="220" data-parsoid='{"a":{"resource":"./File:Nonexistent","height":"220","width":"220"},"sa":{"resource":"File:Nonexistent"}}'/></a></span>
8067 <span typeof="mw:Error mw:Image" data-parsoid='{"optList":[{"ck":"width","ak":"100x100px"},{"ck":"caption","ak":"&lt;script>&lt;/script>"}]}' data-mw='{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}],"caption":"&amp;lt;script>&amp;lt;/script>"}'><a href="./File:Nonexistent" data-parsoid='{"a":{"href":"./File:Nonexistent"},"sa":{}}'><img resource="./File:Nonexistent" src="./Special:FilePath/Nonexistent" height="100" width="100" data-parsoid='{"a":{"resource":"./File:Nonexistent","height":"100","width":"100"},"sa":{"resource":"File:Nonexistent"}}'/></a></span>
8068 <span class="mw-default-size" typeof="mw:Error mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"&amp;lt;"}]}' data-mw='{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}],"caption":"&lt;span typeof=\"mw:Entity\" data-parsoid=&#39;{\"src\":\"&amp;amp;lt;\",\"srcContent\":\"&amp;lt;\",\"dsr\":[107,111,null,null]}&#39;>&amp;lt;&lt;/span>"}'><a href="./File:Nonexistent" data-parsoid='{"a":{"href":"./File:Nonexistent"},"sa":{}}'><img resource="./File:Nonexistent" src="./Special:FilePath/Nonexistent" height="220" width="220" data-parsoid='{"a":{"resource":"./File:Nonexistent","height":"220","width":"220"},"sa":{"resource":"File:Nonexistent"}}'/></a></span>
8069 <span class="mw-default-size" typeof="mw:Error mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"a&lt;i>b&lt;/i>c"}]}' data-mw='{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}],"caption":"a&lt;i data-parsoid=&#39;{\"stx\":\"html\",\"dsr\":[134,142,3,4]}&#39;>b&lt;/i>c"}'><a href="./File:Nonexistent" data-parsoid='{"a":{"href":"./File:Nonexistent"},"sa":{}}'><img resource="./File:Nonexistent" src="./Special:FilePath/Nonexistent" height="220" width="220" data-parsoid='{"a":{"resource":"./File:Nonexistent","height":"220","width":"220"},"sa":{"resource":"File:Nonexistent"}}'/></a></span></p>
8070 !! end
8071
8072 !! test
8073 Plain link to URL
8074 !! wikitext
8075 [[http://www.example.com]]
8076 !! html/php
8077 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
8078 </p>
8079 !! html/parsoid
8080 <p>[<a rel="mw:ExtLink" href="http://www.example.com"></a>]</p>
8081 !! end
8082
8083 !! test
8084 Plain link to URL with link text
8085 !! wikitext
8086 [[http://www.example.com Link text]]
8087 !! html
8088 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
8089 </p>
8090 !! end
8091
8092 !! test
8093 Plain link to protocol-relative URL
8094 !! wikitext
8095 [[//www.example.com]]
8096 !! html/php
8097 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
8098 </p>
8099 !! html/parsoid
8100 <p>[<a rel="mw:ExtLink" href="//www.example.com"></a>]</p>
8101 !! end
8102
8103 !! test
8104 Plain link to protocol-relative URL with link text
8105 !! wikitext
8106 [[//www.example.com Link text]]
8107 !! html
8108 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
8109 </p>
8110 !! end
8111
8112 !! test
8113 Plain link to page with question mark in title
8114 !! wikitext
8115 [[A?b]]
8116
8117 [[A?b|Baz]]
8118 !! html
8119 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
8120 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
8121 </p>
8122 !! end
8123
8124 # I'm fairly sure the expected result here is wrong.
8125 # We want these to be URL links, not pseudo-pages with URLs for titles....
8126 # However the current output is also pretty screwy.
8127 #
8128 # ----
8129 # I'm changing it to match the current output--it arguably makes more
8130 # sense in the light of the test above. Old expected result was:
8131 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
8132 #</p>
8133 # But I think this test is bordering on "garbage in, garbage out" anyway.
8134 # -- wtm
8135 !! test
8136 Piped link to URL
8137 !! wikitext
8138 Piped link to URL: [[http://www.example.com|an example URL]]
8139 !! html/php
8140 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
8141 </p>
8142 !! html/parsoid
8143 <p>Piped link to URL: [<a rel="mw:ExtLink" href="http://www.example.com%7Can" data-parsoid='{"a":{"href":"http://www.example.com%7Can"},"sa":{"href":"http://www.example.com|an"}}'>example URL</a>]</p>
8144 !! end
8145
8146 !! test
8147 Plain link in template argument
8148 !! options
8149 parsoid=wt2html
8150 !! wikitext
8151 {{echo|[http://www.example.com |123]}}
8152
8153 {{echo|[[http://www.example.com |123]]}}
8154
8155 {{echo|[[http://www.example.com |123]}}
8156
8157 {{echo|[http://www.example.com |123]]}}
8158 !! html/php
8159 <p>[<a rel="nofollow" class="external free" href="http://www.example.com">http://www.example.com</a>
8160 </p><p>[<a rel="nofollow" class="external text" href="http://www.example.com">|123</a>]
8161 </p><p>{{echo|[<a rel="nofollow" class="external text" href="http://www.example.com">|123</a>}}
8162 </p><p>[<a rel="nofollow" class="external free" href="http://www.example.com">http://www.example.com</a>
8163 </p>
8164 !! html/parsoid
8165 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[http://www.example.com "},"2":{"wt":"123]"}},"i":0}}]}'>[<a rel="mw:ExtLink" href="http://www.example.com">http://www.example.com</a> </p>
8166
8167 <p about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[http://www.example.com |123]]"}},"i":0}}]}'>[<a rel="mw:ExtLink" href="http://www.example.com">|123</a>]</p>
8168
8169 <p>{{echo|[<a rel="mw:ExtLink" href="http://www.example.com" data-parsoid='{"targetOff":114,"contentOffsets":[114,118],"dsr":[90,119,24,1]}'>|123</a>}}</p>
8170
8171 <p about="#mwt3" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[http://www.example.com "},"2":{"wt":"123]]"}},"i":0}}]}'>[<a rel="mw:ExtLink" href="http://www.example.com">http://www.example.com</a> </p>
8172 !! end
8173
8174 !! test
8175 T2002: [[page|http://url/]] should link to page, not http://url/
8176 !! wikitext
8177 [[Main Page|http://url/]]
8178 !! html/php
8179 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
8180 </p>
8181 !! html/parsoid
8182 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">http://url/</a></p>
8183 !! end
8184
8185 # Parsoid does not mark self-links, by design.
8186 !! test
8187 T2337: Escaped self-links should be bold
8188 !! options
8189 title=[[Bug462]]
8190 !! wikitext
8191 [[Bu&#103;462]] [[Bug462]]
8192 !! html/php
8193 <p><a class="mw-selflink selflink">Bu&#103;462</a> <a class="mw-selflink selflink">Bug462</a>
8194 </p>
8195 !! html/php+tidy
8196 <p><a class="mw-selflink selflink">Bug462</a> <a class="mw-selflink selflink">Bug462</a></p>
8197 !! html/parsoid
8198 <p><a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a> <a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a></p>
8199 !! end
8200
8201 !! test
8202 Self-link to section should not be bold
8203 !! options
8204 title=[[Main Page]]
8205 !! wikitext
8206 [[Main Page#section]]
8207 !! html
8208 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
8209 </p>
8210 !! end
8211
8212 !! article
8213 00
8214 !! text
8215 This is 00.
8216 !! endarticle
8217
8218 !!test
8219 Self-link to numeric title
8220 !!options
8221 title=[[0]]
8222 !! wikitext
8223 [[0]]
8224 !! html
8225 <p><a class="mw-selflink selflink">0</a>
8226 </p>
8227 !!end
8228
8229 !!test
8230 Link to numeric-equivalent title
8231 !!options
8232 title=[[0]]
8233 !! wikitext
8234 [[00]]
8235 !! html
8236 <p><a href="/wiki/00" title="00">00</a>
8237 </p>
8238 !!end
8239
8240 !! test
8241 <nowiki> inside a link
8242 !! wikitext
8243 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
8244 !! html
8245 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
8246 </p>
8247 !! end
8248
8249 !! test
8250 Non-breaking spaces in title
8251 !! wikitext
8252 [[&nbsp; Main &nbsp; Page &nbsp;]]
8253 !! html
8254 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
8255 </p>
8256 !!end
8257
8258 # Add new article for the test below so that it doesn't red-link
8259 !! article
8260 Foo bar baz
8261 !! text
8262 boo
8263 !! endarticle
8264
8265 !! test
8266 Multiple spaces in titles should normalize to a single underscore
8267 !! options
8268 parsoid=wt2html,wt2wt
8269 !! wikitext
8270 [[Foo bar baz|x]]
8271 [[Foo bar baz|x]]
8272 [[Foo bar baz|x]]
8273 !! html/php
8274 <p><a href="/wiki/Foo_bar_baz" title="Foo bar baz">x</a>
8275 <a href="/wiki/Foo_bar_baz" title="Foo bar baz">x</a>
8276 <a href="/wiki/Foo_bar_baz" title="Foo bar baz">x</a>
8277 </p>
8278 !! html/parsoid
8279 <p><a rel="mw:WikiLink" href="./Foo_bar_baz" title="Foo bar baz">x</a>
8280 <a rel="mw:WikiLink" href="./Foo_bar_baz" title="Foo bar baz">x</a>
8281 <a rel="mw:WikiLink" href="./Foo_bar_baz" title="Foo bar baz">x</a>
8282 </p>
8283 !! end
8284
8285 !! test
8286 Internal link with ca linktrail, surrounded by bold apostrophes (T29473 primary issue)
8287 !! options
8288 language=ca
8289 !! wikitext
8290 '''[[Main Page]]'''
8291 !! html
8292 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
8293 </p>
8294 !! end
8295
8296 !! test
8297 Internal link with ca linktrail, surrounded by italic apostrophes (T29473 primary issue)
8298 !! options
8299 language=ca
8300 !! wikitext
8301 ''[[Main Page]]''
8302 !! html
8303 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
8304 </p>
8305 !! end
8306
8307 !! test
8308 Internal link with en linktrail: no apostrophes (T29473)
8309 !! options
8310 language=en
8311 !! wikitext
8312 [[Something]]'nice
8313 !! html
8314 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
8315 </p>
8316 !! end
8317
8318 !! test
8319 Internal link with ca linktrail with apostrophes (T29473)
8320 !! options
8321 language=ca
8322 !! wikitext
8323 [[Something]]'nice
8324 !! html
8325 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
8326 </p>
8327 !! end
8328
8329 !! test
8330 Internal link with kaa linktrail with apostrophes (T29473)
8331 !! options
8332 language=kaa
8333 !! wikitext
8334 [[Something]]'nice
8335 !! html
8336 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (bet ele jaratılmag'an)">Something'nice</a>
8337 </p>
8338 !! end
8339
8340 !! test
8341 Link with multiple ":" in a subpage-supporting namespace (T65636)
8342 !! wikitext
8343 [[User:Foo/Test/63636:Bar|Test]]
8344 !! html/php
8345 <p><a href="/index.php?title=User:Foo/Test/63636:Bar&amp;action=edit&amp;redlink=1" class="new" title="User:Foo/Test/63636:Bar (page does not exist)">Test</a>
8346 </p>
8347 !! html/parsoid
8348 <p><a rel="mw:WikiLink" href="./User:Foo/Test/63636:Bar" title="User:Foo/Test/63636:Bar">Test</a></p>
8349 !! end
8350
8351 ## Mainly a sanity check for Parsoid
8352 !! test
8353 Handle title parsing for subpages
8354 !! options
8355 title=[[/123123]]
8356 subpage
8357 !! wikitext
8358 123
8359 !! html/php
8360 <p>123
8361 </p>
8362 !! html/parsoid
8363 <p>123</p>
8364 !! end
8365
8366 !! article
8367 User:Test/123
8368 !! text
8369 test 123
8370 !! endarticle
8371
8372 !! test
8373 Link to a subpage from a namespace other than main
8374 !! options
8375 title=[[User:Test]]
8376 subpage
8377 !! wikitext
8378 [[/123]]
8379 !! html/php
8380 <p><a href="/wiki/User:Test/123" title="User:Test/123">/123</a>
8381 </p>
8382 !! html/parsoid
8383 <p><a rel="mw:WikiLink" href="./User:Test/123" title="User:Test/123" data-parsoid='{"stx":"simple","a":{"href":"./User:Test/123"},"sa":{"href":"/123"}}'>/123</a></p>
8384 !! end
8385
8386 !! test
8387 Ensure that transclusion titles are not url-decoded
8388 !! options
8389 subpage title=[[Test]]
8390 parsoid=wt2html
8391 !! wikitext
8392 {{Bar%C3%A9}} {{/Bar%C3%A9}}
8393 !! html/php
8394 <p>{{Bar%C3%A9}} {{/Bar%C3%A9}}
8395 </p>
8396 !! html/parsoid
8397 <p>{{Bar%C3%A9}} {{/Bar%C3%A9}}</p>
8398 !! end
8399
8400 !! test
8401 Purely hash wikilink
8402 !! options
8403 title=[[User:Test/123]]
8404 subpage
8405 !! wikitext
8406 [[#a|b]]
8407 !! html/php
8408 <p><a href="#a">b</a>
8409 </p>
8410 !! html/parsoid
8411 <p><a rel="mw:WikiLink" href="./User:Test/123#a" data-parsoid='{"stx":"piped","a":{"href":"./User:Test/123#a"},"sa":{"href":"#a"}}'>b</a></p>
8412 !! end
8413
8414 !! test
8415 Serialization of purely hash wikilink
8416 !! options
8417 title=[[User:Test/123]]
8418 subpage
8419 parsoid=html2wt
8420 !! html/parsoid
8421 <p><a href="#a">[[</a></p>
8422 !! wikitext
8423 [[#a|<nowiki>[[</nowiki>]]
8424 !! html/php
8425 <p><a href="#a">[[</a>
8426 </p>
8427 !! end
8428
8429 !! test
8430 1. Interaction of linktrail and template encapsulation
8431 !! wikitext
8432 {{echo|[[Foo]]}}l
8433 !! html/parsoid
8434 <p><a rel="mw:WikiLink" href="./Foo" title="Foo" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[Foo]]"}},"i":0}},"l"]}'>Fool</a></p>
8435 !! end
8436
8437 !! test
8438 2. Interaction of linktrail and template encapsulation
8439 !! options
8440 parsoid
8441 !! wikitext
8442 {{echo|Some [[Fool]]}}s
8443 !! html
8444 <p><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Some [[Fool]]"}},"i":0}},"s"]}' data-parsoid='{"pi":[[{"k":"1"}]]}'>Some </span><a rel="mw:WikiLink" href="./Fool" title="Fool" about="#mwt1" data-parsoid='{"stx":"simple","a":{"href":"./Fool"},"sa":{"href":"Fool"},"tail":"s"}'>Fools</a></p>
8445 !! end
8446
8447 !! test
8448 3. Interaction of linktrail and template encapsulation
8449 !! options
8450 parsoid
8451 !! wikitext
8452 {{echo|Some [[Fool]]s are '''bold and foolish'''}}
8453 !! html
8454 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Some [[Fool]]s are &#39;&#39;&#39;bold and foolish&#39;&#39;&#39;"}},"i":0}}]}' data-parsoid='{"pi":[[{"k":"1"}]]}'>Some <a rel="mw:WikiLink" href="./Fool" title="Fool" data-parsoid='{"stx":"simple","a":{"href":"./Fool"},"sa":{"href":"Fool"},"tail":"s"}'>Fools</a> are <b>bold and foolish</b></p>
8455 !! end
8456
8457 !! article
8458 Söfnuður
8459 !! text
8460 Test.
8461 !! endarticle
8462
8463 !! test
8464 Internal link with is link prefix
8465 !! options
8466 language=is
8467 !! wikitext
8468 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
8469 !! html
8470 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
8471 </p>
8472 !! end
8473
8474 !! article
8475 Mótmælendatrú
8476 !! text
8477 Test.
8478 !! endarticle
8479
8480 !! test
8481 Internal link with is link trail and link prefix
8482 !! options
8483 language=is
8484 !! wikitext
8485 [[mótmælendatrú|xxx]]ar
8486 [[mótmælendatrú]]ar
8487 mótmælenda[[söfnuður]]
8488 mótmælenda[[söfnuður|söfnuðir]]
8489 mótmælenda[[söfnuður|söfnuðir]]xxx
8490 !! html
8491 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
8492 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
8493 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
8494 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
8495 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
8496 </p>
8497 !! end
8498
8499 !! test
8500 Parsoid link trail escaping
8501 !! options
8502 parsoid=html2wt,html2html
8503 !! html/parsoid
8504 <p><a rel="mw:WikiLink" href="./Apple" title="Apple">apple</a>s</p>
8505 !! wikitext
8506 [[apple]]<nowiki/>s
8507 !! end
8508
8509 !! test
8510 Parsoid link prefix escaping
8511 !! options
8512 language=is
8513 parsoid=html2wt,html2html
8514 !! html/parsoid
8515 <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="./Söfnuður" title="Söfnuður">söfnuður</a></p>
8516 !! wikitext
8517 Aðrir mótmælenda<nowiki/>[[söfnuður]]
8518 !! end
8519
8520 !! test
8521 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
8522 !! wikitext
8523 [[Foo| bar]]
8524
8525 [[Foo| ''bar'']]
8526
8527 [http://wp.org foo]
8528
8529 [http://wp.org ''foo'']
8530 !! html
8531 <p><a href="/wiki/Foo" title="Foo"> bar</a>
8532 </p><p><a href="/wiki/Foo" title="Foo"> <i>bar</i></a>
8533 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
8534 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
8535 </p>
8536 !! end
8537
8538 !! test
8539 Parsoid: Scoped parsing should handle mixed transclusions and plain text
8540 !! wikitext
8541 [[Foo|{{echo|a}} b {{echo|c}}]]
8542 !! html/parsoid
8543 <p><a rel="mw:WikiLink" href="./Foo" title="Foo"><span about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a"}},"i":0}}]}'>a</span> b <span about="#mwt3" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"c"}},"i":0}}]}'>c</span></a></p>
8544 !! end
8545
8546 !! test
8547 Link with angle bracket after anchor
8548 !! wikitext
8549 [[Foo#<bar>]]
8550 !! html/php
8551 <p><a href="/wiki/Foo#.3Cbar.3E" title="Foo">Foo#&lt;bar&gt;</a>
8552 </p>
8553 !! html/parsoid
8554 <p><a rel="mw:WikiLink" href="./Foo#.3Cbar.3E" title="Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo#.3Cbar.3E"},"sa":{"href":"Foo#&lt;bar>"}}'>Foo#&lt;bar></a></p>
8555 !! end
8556
8557 ###
8558 ### Interwiki links (see maintenance/interwiki.sql)
8559 ###
8560
8561 !! test
8562 Inline interwiki link
8563 !! options
8564 parsoid=wt2html,wt2wt,html2html
8565 !! wikitext
8566 [[MeatBall:SoftSecurity]]
8567 !! html/php
8568 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
8569 </p>
8570 !! html/parsoid
8571 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a></p>
8572 !! end
8573
8574 !! test
8575 Inline interwiki link with empty title (T4372)
8576 !! options
8577 parsoid=wt2html,wt2wt,html2html
8578 !! wikitext
8579 [[MeatBall:]]
8580 !! html/php
8581 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
8582 </p>
8583 !! html/parsoid
8584 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?" title="meatball:">MeatBall:</a></p>
8585 !! end
8586
8587 !! test
8588 Interwiki link encoding conversion (T3636)
8589 !! wikitext
8590 *[[Wikipedia:ro:Olteni&#0355;a]]
8591 *[[Wikipedia:ro:Olteni&#355;a]]
8592 !! html
8593 <ul><li><a href="http://en.wikipedia.org/wiki/ro:Olteni%C5%A3a" class="extiw" title="wikipedia:ro:Olteniţa">Wikipedia:ro:Olteni&#355;a</a></li>
8594 <li><a href="http://en.wikipedia.org/wiki/ro:Olteni%C5%A3a" class="extiw" title="wikipedia:ro:Olteniţa">Wikipedia:ro:Olteni&#355;a</a></li></ul>
8595
8596 !! html+tidy
8597 <ul>
8598 <li><a href="http://en.wikipedia.org/wiki/ro:Olteni%C5%A3a" class="extiw" title="wikipedia:ro:Olteniţa">Wikipedia:ro:Olteniţa</a></li>
8599 <li><a href="http://en.wikipedia.org/wiki/ro:Olteni%C5%A3a" class="extiw" title="wikipedia:ro:Olteniţa">Wikipedia:ro:Olteniţa</a></li>
8600 </ul>
8601 !! end
8602
8603 !! test
8604 Interwiki link with fragment (T4130)
8605 !! wikitext
8606 [[MeatBall:SoftSecurity#foo]]
8607 !! html
8608 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
8609 </p>
8610 !! end
8611
8612 !! test
8613 Link scenarios with escaped fragments
8614 !! wikitext
8615 [[#Is this great?]]
8616 [[Foo#Is this great?]]
8617 [[meatball:Foo#Is this great?]]
8618 !! html/php
8619 <p><a href="#Is_this_great.3F">#Is this great?</a>
8620 <a href="/wiki/Foo#Is_this_great.3F" title="Foo">Foo#Is this great?</a>
8621 <a href="http://www.usemod.com/cgi-bin/mb.pl?Foo#Is_this_great.3F" class="extiw" title="meatball:Foo">meatball:Foo#Is this great?</a>
8622 </p>
8623 !! html/parsoid
8624 <p><a rel="mw:WikiLink" href="./Main_Page#Is_this_great.3F" data-parsoid='{"stx":"simple","a":{"href":"./Main_Page#Is_this_great.3F"},"sa":{"href":"#Is this great?"}}'>#Is this great?</a>
8625 <a rel="mw:WikiLink" href="./Foo#Is_this_great.3F" title="Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo#Is_this_great.3F"},"sa":{"href":"Foo#Is this great?"}}'>Foo#Is this great?</a>
8626 <a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?Foo#Is_this_great.3F" title="meatball:Foo" data-parsoid='{"stx":"simple","a":{"href":"http://www.usemod.com/cgi-bin/mb.pl?Foo#Is_this_great.3F"},"sa":{"href":"meatball:Foo#Is this great?"},"isIW":true}'>meatball:Foo#Is this great?</a></p>
8627 !! end
8628
8629 # Ideally the wikipedia: prefix here should be proto-relative too
8630 # [CSA]: this is kind of a bogus test, as the PHP parser test doesn't
8631 # define the 'en' prefix, and originally the test used 'wikipedia',
8632 # which isn't a localinterwiki prefix hence the links to the 'en:Foo'
8633 # article.
8634 !! test
8635 Different interwiki prefixes mapping to the same URL
8636 !! wikitext
8637 [[:en:Foo]]
8638
8639 [[:en:Foo|Foo]]
8640
8641 [[wikipedia:Foo]]
8642
8643 [[:wikipedia:Foo|Foo]]
8644
8645 [[wikipedia:en:Foo]]
8646
8647 [[:wikipedia:en:Foo]]
8648
8649 [[ wikiPEdia :Foo]]
8650 !! html/parsoid
8651 <p><a rel="mw:ExtLink" href="//en.wikipedia.org/wiki/Foo" data-parsoid='{"stx":"simple","a":{"href":"//en.wikipedia.org/wiki/Foo"},"sa":{"href":":en:Foo"},"isIW":true}' title="en:Foo">en:Foo</a></p>
8652
8653 <p><a rel="mw:ExtLink" href="//en.wikipedia.org/wiki/Foo" data-parsoid='{"stx":"piped","a":{"href":"//en.wikipedia.org/wiki/Foo"},"sa":{"href":":en:Foo"},"isIW":true}' title="en:Foo">Foo</a></p>
8654
8655 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" data-parsoid='{"stx":"simple","a":{"href":"http://en.wikipedia.org/wiki/Foo"},"sa":{"href":"wikipedia:Foo"},"isIW":true}' title="wikipedia:Foo">wikipedia:Foo</a></p>
8656
8657 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" data-parsoid='{"stx":"piped","a":{"href":"http://en.wikipedia.org/wiki/Foo"},"sa":{"href":":wikipedia:Foo"},"isIW":true}' title="wikipedia:Foo">Foo</a></p>
8658
8659 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/en:Foo" data-parsoid='{"stx":"simple","a":{"href":"http://en.wikipedia.org/wiki/en:Foo"},"sa":{"href":"wikipedia:en:Foo"},"isIW":true}' title="wikipedia:en:Foo">wikipedia:en:Foo</a></p>
8660
8661 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/en:Foo" data-parsoid='{"stx":"simple","a":{"href":"http://en.wikipedia.org/wiki/en:Foo"},"sa":{"href":":wikipedia:en:Foo"},"isIW":true}' title="wikipedia:en:Foo">wikipedia:en:Foo</a></p>
8662
8663 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" data-parsoid='{"stx":"simple","a":{"href":"http://en.wikipedia.org/wiki/Foo"},"sa":{"href":" wikiPEdia :Foo"},"isIW":true}' title="wikipedia:Foo"> wikiPEdia :Foo</a></p>
8664 !! end
8665
8666 !! test
8667 Interwiki links that cannot be represented in wiki syntax
8668 !! wikitext
8669 [[meatball:ok]]
8670 [[meatball:ok#foo|ok with fragment]]
8671 [[meatball:ok_as_well?|ok ending with ? mark]]
8672 [http://de.wikipedia.org/wiki/Foo?action=history has query]
8673 [http://de.wikipedia.org/wiki/#foo is just fragment]
8674
8675 !! html/php
8676 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?ok" class="extiw" title="meatball:ok">meatball:ok</a>
8677 <a href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" class="extiw" title="meatball:ok">ok with fragment</a>
8678 <a href="http://www.usemod.com/cgi-bin/mb.pl?ok_as_well%3F" class="extiw" title="meatball:ok as well?">ok ending with ? mark</a>
8679 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
8680 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a>
8681 </p>
8682 !! html/parsoid
8683 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok" title="meatball:ok">meatball:ok</a>
8684 <a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" title="meatball:ok">ok with fragment</a>
8685 <a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok_as_well?" title="meatball:ok as well?">ok ending with ? mark</a>
8686 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
8687 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a></p>
8688 !! end
8689
8690 !! test
8691 Interwiki links: trail
8692 !! wikitext
8693 [[wikipedia:Foo|Ba]]r
8694 !! html/php
8695 <p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
8696 </p>
8697 !! html/parsoid
8698 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" data-parsoid='{"stx":"piped","a":{"href":"http://en.wikipedia.org/wiki/Foo"},"sa":{"href":"wikipedia:Foo"},"isIW":true,"tail":"r"}' title="wikipedia:Foo">Bar</a></p>
8699 !! end
8700
8701 !! test
8702 Local interwiki link
8703 !! options
8704 parsoid=wt2html,wt2wt,html2html
8705 !! wikitext
8706 [[local:Template:Foo]]
8707 !! html/php
8708 <p><a href="/wiki/Template:Foo" title="Template:Foo">local:Template:Foo</a>
8709 </p>
8710 !! html/parsoid
8711 <p><a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">local:Template:Foo</a></p>
8712 !! end
8713
8714 # Parsoid does not mark self-links, by design.
8715 !! test
8716 Local interwiki link: self-link to current page
8717 !! options
8718 title=[[Main Page]]
8719 parsoid=wt2html,wt2wt,html2html
8720 !! wikitext
8721 [[local:Main Page]]
8722 !! html/php
8723 <p><a class="mw-selflink selflink">local:Main Page</a>
8724 </p>
8725 !! html/parsoid
8726 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:Main Page</a></p>
8727 !! end
8728
8729 !! test
8730 Local interwiki link: prefix only (T66167)
8731 !! options
8732 parsoid=wt2html,wt2wt,html2html
8733 !! wikitext
8734 [[local:]]
8735 !! html/php
8736 <p><a href="/wiki/Main_Page" title="Main Page">local:</a>
8737 </p>
8738 !! html/parsoid
8739 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:</a></p>
8740 !! end
8741
8742 !! test
8743 Local interwiki link: with additional interwiki prefix (T63357)
8744 !! options
8745 parsoid=wt2html,wt2wt,html2html
8746 !! wikitext
8747 [[local:meatball:Hello]]
8748 !! html/php
8749 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?Hello" class="extiw" title="meatball:Hello">local:meatball:Hello</a>
8750 </p>
8751 !! html/parsoid
8752 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?Hello" title="meatball:Hello">local:meatball:Hello</a></p>
8753 !! end
8754
8755 !! test
8756 Multiple local interwiki link prefixes
8757 !! wikitext
8758 [[local:local:local:local:mi:local:Foo]]
8759 !! options
8760 parsoid=wt2html,wt2wt,html2html
8761 !! html/php
8762 <p><a href="/wiki/Foo" title="Foo">local:local:local:local:mi:local:Foo</a>
8763 </p>
8764 !! html/parsoid
8765 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">local:local:local:local:mi:local:Foo</a></p>
8766 !! end
8767
8768 ###
8769 ### Interlanguage links
8770 ### Language links (so that searching for '### language' matches..)
8771 ###
8772
8773 !! test
8774 Interlanguage link
8775 !! wikitext
8776 Blah blah blah
8777 [[zh:Chinese]]
8778 !! html/php
8779 <p>Blah blah blah
8780 </p>
8781 !! html/parsoid
8782 <p>Blah blah blah</p>
8783 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8784 !! end
8785
8786 ## parsoid html2wt will lose the space variations
8787 !! test
8788 Interlanguage link with spacing
8789 !! options
8790 parsoid=wt2html,wt2wt,html2html
8791 !! wikitext
8792 Blah blah blah
8793 [[ zh : Chinese ]]
8794 !! html/php
8795 <p>Blah blah blah
8796 </p>
8797 !! html/parsoid
8798 <p>Blah blah blah</p>
8799 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8800 !! end
8801
8802 !! test
8803 Double interlanguage link
8804 !! wikitext
8805 Blah blah blah
8806 [[es:Spanish]]
8807 [[zh:Chinese]]
8808 !! html/php
8809 <p>Blah blah blah
8810 </p>
8811 !! html/parsoid
8812 <p>Blah blah blah</p>
8813 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
8814 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8815 !! end
8816
8817 ## parsoid html2wt will lose the space variations
8818 !! test
8819 Interlanguage link variations
8820 !! options
8821 parsoid=wt2html,wt2wt,html2html
8822 !! wikitext
8823 Blah blah blah
8824 [[ es :Spanish]]
8825 [[ ZH :Chinese]]
8826 [[es:Foo_bar]]
8827 !! html/php
8828 <p>Blah blah blah
8829 </p>
8830 !! html/parsoid
8831 <p>Blah blah blah</p>
8832 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish" />
8833 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese" />
8834 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar" />
8835 !! end
8836
8837 !! test
8838 Escaping of interlanguage links (T129218, T156308)
8839 !! wikitext
8840 Blah blah blah
8841 [[:es:Spanish]]
8842 [[ : zh : Chinese ]]
8843 !! html/php
8844 <p>Blah blah blah
8845 <a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">es:Spanish</a>
8846 <a href="http://zh.wikipedia.org/wiki/Chinese" class="extiw" title="zh:Chinese"> zh : Chinese </a>
8847 </p>
8848 !! html/parsoid
8849 <p>Blah blah blah
8850 <a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">es:Spanish</a>
8851 <a rel="mw:ExtLink" href="http://zh.wikipedia.org/wiki/Chinese" title="zh:Chinese"> zh : Chinese </a></p>
8852 !! end
8853
8854 !! test
8855 Multiple colons escaping interlanguage links
8856 !! options
8857 parsoid=wt2html
8858 !! wikitext
8859 [[:es:Spanish]]
8860 [[::es:Spanish]]
8861 [[:::es:Spanish]]
8862 !! html/php
8863 <p><a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">es:Spanish</a>
8864 [[::es:Spanish]]
8865 [[:::es:Spanish]]
8866 </p>
8867 !! html/parsoid
8868 <p><a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">es:Spanish</a>
8869 [[::es:Spanish]]
8870 [[:::es:Spanish]]</p>
8871 !! end
8872
8873 ## parsoid html2wt will normalize the space to _
8874 !! test
8875 Space and question mark encoding in interlanguage links (T95473)
8876 !! options
8877 parsoid=wt2html,wt2wt,html2html
8878 !! wikitext
8879 Blah blah blah
8880 [[es:Foo bar?]]
8881 !! html/php
8882 <p>Blah blah blah
8883 </p>
8884 !! html/parsoid
8885 <p>Blah blah blah</p>
8886 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar%3F" />
8887 !! end
8888
8889 !! test
8890 Interlanguage link, with prefix links
8891 !! options
8892 language=ln
8893 !! wikitext
8894 Blah blah blah
8895 [[zh:Chinese]]
8896 !! html/php
8897 <p>Blah blah blah
8898 </p>
8899 !! html/parsoid
8900 <p>Blah blah blah</p>
8901 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8902 !! end
8903
8904 !! test
8905 Double interlanguage link, with prefix links (T10897)
8906 !! options
8907 language=ln
8908 !! wikitext
8909 Blah blah blah
8910 [[es:Spanish]]
8911 [[zh:Chinese]]
8912 !! html/php
8913 <p>Blah blah blah
8914 </p>
8915 !! html/parsoid
8916 <p>Blah blah blah</p>
8917 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
8918 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8919 !! end
8920
8921 !! test
8922 "Extra" interlanguage links (T34189 / gerrit 111390)
8923 !! wikitext
8924 Blah blah blah
8925 [[mul:Article]]
8926 !! html/php
8927 <p>Blah blah blah
8928 </p>
8929 !! html/parsoid
8930 <p>Blah blah blah</p>
8931 <link rel="mw:PageProp/Language" title="Multilingual" href="http://wikisource.org/wiki/Article"/>
8932 !! end
8933
8934 ## PHP parser tests script needs an update
8935 ## Parsoid html2wt will normalize output to [[:zh:Chinese]]
8936 !! test
8937 Language links render as inline links if $wgInterwikiMagic=false
8938 !! options
8939 wgInterwikiMagic=false
8940 parsoid=wt2html,wt2wt,html2html
8941 !! wikitext
8942 Blah blah blah
8943 [[zh:Chinese]]
8944 !! html/parsoid
8945 <p>Blah blah blah <a rel="mw:ExtLink" href="http://zh.wikipedia.org/wiki/Chinese" title="zh:Chinese">zh:Chinese</a></p>
8946 !! end
8947
8948 ## PHP parser tests script needs an update
8949 ## Parsoid html2wt will normalize output to [[:zh:Chinese]]
8950 !! test
8951 Language links render as inline links in the Talk namespace
8952 !! options
8953 title=Talk:Foo
8954 parsoid=wt2html,wt2wt,html2html
8955 !! wikitext
8956 Blah blah blah
8957 [[zh:Chinese]]
8958 !! html/parsoid
8959 <p>Blah blah blah <a rel="mw:ExtLink" href="http://zh.wikipedia.org/wiki/Chinese" title="zh:Chinese">zh:Chinese</a></p>
8960 !! end
8961
8962 !! test
8963 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
8964 !! options
8965 language=ln
8966 !! wikitext
8967 [[WW&nbsp;II]]
8968 !! html
8969 <p><a href="/index.php?title=WW_II&amp;action=edit&amp;redlink=1" class="new" title="WW II (lonkásá ezalí tɛ̂)">WW&#160;II</a>
8970 </p>
8971 !! end
8972
8973 !! test
8974 Parsoid T55221: Wikilinks should be properly entity-escaped
8975 !! options
8976 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
8977 !! html/parsoid
8978 <p>He&amp;nbsp;llo <a href="./Foo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
8979 <p>He&amp;nbsp;llo <a href="./He&amp;nbsp;llo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
8980 !! wikitext
8981 He&amp;nbsp;llo [[Foo|He&amp;nbsp;llo]]
8982
8983 He&amp;nbsp;llo He&amp;nbsp;llo
8984 !! html/php
8985 <p>He&amp;nbsp;llo <a href="/wiki/Foo" title="Foo">He&amp;nbsp;llo</a>
8986 </p><p>He&amp;nbsp;llo He&amp;nbsp;llo
8987 </p>
8988 !! end
8989
8990 # html2wt will fail because of title normalization without data-parsoid
8991 !! test
8992 Parsoid: handle constructor well
8993 !! options
8994 parsoid=wt2html,wt2wt
8995 !! wikitext
8996 [[constructor]]
8997
8998 [[constructor:foo]]
8999 !! html/php
9000 <p><a href="/index.php?title=Constructor&amp;action=edit&amp;redlink=1" class="new" title="Constructor (page does not exist)">constructor</a>
9001 </p><p><a href="/index.php?title=Constructor:foo&amp;action=edit&amp;redlink=1" class="new" title="Constructor:foo (page does not exist)">constructor:foo</a>
9002 </p>
9003 !! html/parsoid
9004 <p><a rel="mw:WikiLink" href="./Constructor" title="Constructor" data-parsoid='{"stx":"simple","a":{"href":"./Constructor"},"sa":{"href":"constructor"}}'>constructor</a></p>
9005
9006 <p><a rel="mw:WikiLink" href="./Constructor:foo" title="Constructor:foo" data-parsoid='{"stx":"simple","a":{"href":"./Constructor:foo"},"sa":{"href":"constructor:foo"}}'>constructor:foo</a></p>
9007 !! end
9008
9009 !! article
9010 ko:
9011 !! text
9012 Test.
9013 !! endarticle
9014
9015 # Note that `ko` isn't a known interlanguage prefix
9016 !! test
9017 Parsoid: recognize interlanguage links without a target page
9018 !! options
9019 ill
9020 !! wikitext
9021 [[es:]]
9022
9023 [[ko:]]
9024 !! html/php
9025 es:
9026 !! html/parsoid
9027 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/"/>
9028
9029 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
9030 !! end
9031
9032 # Note that `ko` isn't a known interwiki prefix
9033 !! test
9034 Parsoid: recognize interwiki links without a target page
9035 !! options
9036 parsoid=wt2html,wt2wt,html2html
9037 !! wikitext
9038 [[:es:]]
9039
9040 [[:ko:]]
9041 !! html/php
9042 <p><a href="http://es.wikipedia.org/wiki/" class="extiw" title="es:">es:</a>
9043 </p><p><a href="/wiki/Ko:" title="Ko:">ko:</a>
9044 </p>
9045 !! html/parsoid
9046 <p><a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/" title="es:">es:</a></p>
9047 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
9048 !! end
9049
9050 !! test
9051 Handle interwiki links pointing to the current wiki as plain wiki links (T47209)
9052 !! wikitext
9053 [[mi:Foo]]
9054 !! html/php
9055 <p><a href="/wiki/Foo" title="Foo">mi:Foo</a>
9056 </p>
9057 !! html/parsoid
9058 <p><a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo"},"sa":{"href":"mi:Foo"}}'>mi:Foo</a></p>
9059 !! end
9060
9061 !! test
9062 Interlanguage link with preceding local interwiki link (T70085)
9063 !! options
9064 parsoid=wt2html,wt2wt,html2html
9065 !! wikitext
9066 Blah blah blah
9067 [[local:es:Spanish]]
9068 !! html/php
9069 <p>Blah blah blah
9070 <a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">local:es:Spanish</a>
9071 </p>
9072 !! html/parsoid
9073 <p>Blah blah blah
9074 <a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">local:es:Spanish</a></p>
9075 !! end
9076
9077 !! test
9078 Looks like an interlanguage link, but is actually a local interwiki
9079 !! options
9080 parsoid=wt2html,wt2wt,html2html
9081 !! wikitext
9082 Blah blah blah
9083 [[mi:Template:Foo]]
9084 !! html/php
9085 <p>Blah blah blah
9086 <a href="/wiki/Template:Foo" title="Template:Foo">mi:Template:Foo</a>
9087 </p>
9088 !! html/parsoid
9089 <p>Blah blah blah
9090 <a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">mi:Template:Foo</a></p>
9091 !! end
9092
9093 ###
9094 ### Redirects, Parsoid-only
9095 ###
9096
9097 !! test
9098 1. Simple redirect to page
9099 !! wikitext
9100 #REDIRECT [[Main Page]]
9101 !! html/parsoid
9102 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
9103 !! end
9104
9105 !! test
9106 2. Other redirect variants
9107 !! wikitext
9108 #REDIRECT [[Main_Page]]
9109 !! html/parsoid
9110 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Main_Page"},"sa":{"href":"Main_Page"}}'/>
9111 !! end
9112
9113 # Not a valid redirect in PHP (although perhaps it was, once upon a time)
9114 # This tests the Parsoid bail-out code.
9115 !! test
9116 3. Other redirect variants
9117 !! wikitext
9118 #REDIRECT [[<nowiki>[[Bar]]</nowiki>]]
9119 !! html/parsoid
9120 <ol><li data-parsoid>REDIRECT [[[[Bar]]]]</li></ol>
9121 !! end
9122
9123 !! test
9124 4. Redirect to a templated destination
9125 !! wikitext
9126 #REDIRECT [[{{echo|Foo}}bar]]
9127 !! html/parsoid
9128 <link about="#mwt2" typeof="mw:ExpandedAttrs" rel="mw:PageProp/redirect" href="./Foobar" data-parsoid='{"a":{"href":"./Foobar"},"sa":{"href":"{{echo|Foo}}bar"}}' data-mw='{"attribs":[[{"txt":"href"},{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[12,24,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"Foo\"}},\"i\":0}}]}&#39;>Foo&lt;/span>bar"}]]}'/>
9129 !! end
9130
9131 !! test
9132 Empty redirect
9133 !! options
9134 parsoid=wt2html,wt2wt
9135 !! wikitext
9136 #REDIRECT [[]]
9137 !! html/parsoid
9138 <ol>
9139 <li>REDIRECT [[]]</li></ol>
9140 !! end
9141
9142 !! test
9143 Optional colon in #REDIRECT
9144 !! options
9145 # the colon is archaic syntax. we support it for wt2html, but we
9146 # don't care that it roundtrips back to the modern syntax.
9147 parsoid=wt2html,html2html
9148 !! wikitext
9149 #REDIRECT:[[Main Page]]
9150 !! html/parsoid
9151 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
9152 !! end
9153
9154 !! test
9155 Whitespace in #REDIRECT with optional colon
9156 !! options
9157 # the colon and gratuitous whitespace is archaic syntax. we support
9158 # it for wt2html, but we don't care that it roundtrips back to the
9159 # modern syntax (without extra whitespace)
9160 parsoid=wt2html,html2html
9161 !! wikitext
9162
9163 #REDIRECT
9164 :
9165 [[Main Page]]
9166 !! html/parsoid
9167 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
9168 !! end
9169
9170 !! test
9171 Piped link in #REDIRECT
9172 !! options
9173 # content after piped link is ignored. we support this syntax,
9174 # but don't care that the piped link is lost when we roundtrip this.
9175 parsoid=wt2html
9176 !! wikitext
9177 #REDIRECT [[Main Page|bar]]
9178 !! html/parsoid
9179 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
9180 !! end
9181
9182 !! test
9183 Redirect to category (T104502)
9184 !! options
9185 parsoid=wt2html,wt2wt
9186 !! wikitext
9187 #REDIRECT [[Category:Foo]]
9188 !! html/parsoid
9189 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
9190 !! end
9191
9192 !! test
9193 Redirect to category with URL encoding (T104502)
9194 !! options
9195 parsoid=wt2html
9196 !! wikitext
9197 #REDIRECT [[Category%3AFoo]]
9198 !! html/parsoid
9199 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
9200 !! end
9201
9202 !! test
9203 Redirect to category page
9204 !! wikitext
9205 #REDIRECT [[:Category:Foo]]
9206 !! html/parsoid
9207 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
9208 !! end
9209
9210 !! test
9211 Redirect to image page (1)
9212 !! wikitext
9213 #REDIRECT [[File:Wiki.png]]
9214 !! html/parsoid
9215 <link rel="mw:PageProp/redirect" href="./File:Wiki.png"/>
9216 !! end
9217
9218 !! test
9219 Redirect to image page (2)
9220 !! wikitext
9221 #REDIRECT [[Image:Wiki.png]]
9222 !! html/parsoid
9223 <link rel="mw:PageProp/redirect" href="./File:Wiki.png" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./File:Wiki.png"},"sa":{"href":"Image:Wiki.png"}}'/>
9224 !! end
9225
9226 # html2wt disabled because wts serializes as "#REDIRECT [[:en:File:Wiki.png]]"
9227 # Next test confirms this.
9228 !! test
9229 Redirect to language (1) (T104918)
9230 !! options
9231 parsoid=wt2html,wt2wt,html2html
9232 !! wikitext
9233 #REDIRECT [[en:File:Wiki.png]]
9234 !! html/parsoid
9235 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
9236 !! end
9237
9238 !! test
9239 Redirect to language (2) (T104918)
9240 !! wikitext
9241 #REDIRECT [[:en:File:Wiki.png]]
9242 !! html/parsoid
9243 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
9244 !! end
9245
9246 !! test
9247 Redirect to interwiki (T104918)
9248 !! wikitext
9249 #REDIRECT [[meatball:File:Wiki.png]]
9250 !! html/parsoid
9251 <link rel="mw:PageProp/redirect" href="http://www.usemod.com/cgi-bin/mb.pl?File:Wiki.png"/>
9252 !! end
9253
9254 !! test
9255 Non-English #REDIRECT
9256 !! options
9257 language=is
9258 !! wikitext
9259 #TILVÍSUN [[Main Page]]
9260 !! html/parsoid
9261 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#TILVÍSUN ","a":{"href":"./Main_Page"},"sa":{"href":"Main Page"}}'/>
9262 !! end
9263
9264 !! test
9265 Redirect syntax under text isn't considered a redirect
9266 !! wikitext
9267 some text
9268 #redirect [[Main Page]]
9269 !! html/parsoid
9270 <p>some text</p>
9271 <ol data-parsoid='{}'><li data-parsoid='{}'>redirect <a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"simple","a":{"href":"./Main_Page"},"sa":{"href":"Main Page"}}'>Main Page</a></li></ol>
9272 !! end
9273
9274 !! test
9275 New redirect
9276 !! options
9277 parsoid=html2wt
9278 !! html/parsoid
9279 <p>Foo<link rel="mw:PageProp/redirect" href="./Foo"/></p>
9280 !! wikitext
9281 #REDIRECT [[Foo]]
9282 Foo
9283 !! end
9284
9285 !! test
9286 Redirect followed by block on the same line
9287 !! options
9288 parsoid=wt2html
9289 !! wikitext
9290 #REDIRECT [[Main Page]]<!-- haha -->== hi ==
9291 !! html/parsoid
9292 <link rel="mw:PageProp/redirect" href="./Main_Page"/><!-- haha --><h2 id="hi"> hi </h2>
9293 !! end
9294
9295 !! test
9296 Redirect followed by a newline
9297 !! wikitext
9298 #REDIRECT [[Main Page]]
9299 A newline
9300 !! html/parsoid
9301 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
9302 <p>A newline</p>
9303 !! end
9304
9305 !! test
9306 Redirect followed by multiple newlines
9307 !! wikitext
9308 #REDIRECT [[Main Page]]
9309
9310
9311 A newline
9312 !! html/parsoid
9313 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
9314
9315 <p><br/>
9316 A newline</p>
9317 !! end
9318
9319 !! test
9320 Drop duplicate redirects
9321 !! options
9322 parsoid=html2wt
9323 !! html/parsoid
9324 <link rel="mw:PageProp/redirect" href="./Foo"/>
9325 <link rel="mw:PageProp/redirect" href="./Bar"/>
9326 <link rel="mw:PageProp/redirect" href="./Baz"/>
9327 !! wikitext
9328 #REDIRECT [[Foo]]
9329 !! end
9330
9331 ##
9332 ## XHTML tidiness
9333 ###
9334
9335 !! test
9336 <br> to <br />
9337 !! wikitext
9338 1<br>2<br />3
9339 !! html
9340 <p>1<br />2<br />3
9341 </p>
9342 !! end
9343
9344 !! test
9345 Broken br tag sanitization
9346 !! wikitext
9347 </br>
9348 !! html/php
9349 <p>&lt;/br&gt;
9350 </p>
9351 !! end
9352
9353 # TODO: Fix html2html mode (T53055)!
9354 !! test
9355 Parsoid: Broken br tag recognition
9356 !! options
9357 parsoid=wt2html
9358 !! wikitext
9359 </br>
9360
9361 <br/ >
9362 !! html+tidy
9363 <p><br /></p>
9364 <p><br /></p>
9365 !! end
9366
9367 !! test
9368 Incorrecly removing closing slashes from correctly formed XHTML
9369 !! wikitext
9370 <br style="clear:both;" />
9371 !! html
9372 <p><br style="clear:both;" />
9373 </p>
9374 !! end
9375
9376 !! test
9377 Failing to transform badly formed HTML into correct XHTML
9378 !! wikitext
9379 <br style="clear: left;">
9380 <br style="clear: right;">
9381 <br style="clear: both;">
9382 !! html
9383 <p><br style="clear: left;" />
9384 <br style="clear: right;" />
9385 <br style="clear: both;" />
9386 </p>
9387 !!end
9388
9389 ## FIXME: Is Parsoid's acceptance of self-closing html-tags
9390 ## a feature or a bug? See https://phabricator.wikimedia.org/T76962
9391 !! test
9392 Handling html with a div self-closing tag
9393 !! wikitext
9394 <div title />
9395 <div title/>
9396 <div title/ >
9397 <div title=bar />
9398 <div title=bar/>
9399 <div title=bar/ >
9400 !! html/php
9401 <p>&lt;div title /&gt;
9402 &lt;div title/&gt;
9403 </p>
9404 <div>
9405 <p>&lt;div title=bar /&gt;
9406 &lt;div title=bar/&gt;
9407 </p>
9408 <div title="bar/"></div>
9409 </div>
9410
9411 !! html/parsoid
9412 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
9413 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
9414 <div title="" data-parsoid='{"stx":"html","selfClose":true,"brokenHTMLTag":true}'></div>
9415 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
9416 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
9417 <div title="bar/" data-parsoid='{"stx":"html","autoInsertedEnd":true}'></div>
9418 !! end
9419
9420 !! test
9421 Handling html with a br self-closing tag
9422 !! wikitext
9423 <br title />
9424 <br title/>
9425 <br title/ >
9426 <br title=bar />
9427 <br title=bar/>
9428 <br title=bar/ >
9429 !! html/php
9430 <p><br title="" />
9431 <br title="" />
9432 <br />
9433 <br title="bar" />
9434 <br title="bar" />
9435 <br title="bar/" />
9436 </p>
9437 !! html/parsoid
9438 <p><br title="" />
9439 <br title="" />
9440 <br title="" />
9441 <br title="bar" />
9442 <br title="bar" />
9443 <br title="bar/" />
9444 </p>
9445 !! end
9446
9447 !! test
9448 Horizontal ruler (should it add that extra space?)
9449 !! wikitext
9450 <hr>
9451 <hr >
9452 foo <hr
9453 > bar
9454 !! html+tidy
9455 <hr />
9456 <hr />
9457 <p>foo</p>
9458 <hr />
9459 <p>bar</p>
9460 !! end
9461
9462 !! test
9463 Horizontal ruler -- 4+ dashes render hr
9464 !! wikitext
9465 ----
9466 !! html
9467 <hr />
9468
9469 !! end
9470
9471 !! test
9472 Horizontal ruler -- eats additional dashes on the same line
9473 !! wikitext
9474 ---------
9475 !! html
9476 <hr />
9477
9478 !! end
9479
9480 !! test
9481 Horizontal ruler -- does not collapse dashes on consecutive lines
9482 !! wikitext
9483 ----
9484 ----
9485 !! html
9486 <hr />
9487 <hr />
9488
9489 !! end
9490
9491 !! test
9492 Horizontal ruler -- <4 dashes render as plain text
9493 !! wikitext
9494 ---
9495 !! html
9496 <p>---
9497 </p>
9498 !! end
9499
9500 !! test
9501 Horizontal ruler -- Supports content following dashes on same line
9502 !! wikitext
9503 ---- Foo
9504 !! html
9505 <hr /> Foo
9506
9507 !! html+tidy
9508 <hr />
9509 <p>Foo</p>
9510 !! end
9511
9512 ###
9513 ### Block-level elements
9514 ###
9515 !! test
9516 Common list
9517 !! wikitext
9518 *Common list
9519 * item 2
9520 *item 3
9521 !! html
9522 <ul><li>Common list</li>
9523 <li> item 2</li>
9524 <li>item 3</li></ul>
9525
9526 !! end
9527
9528 !! test
9529 Numbered list
9530 !! wikitext
9531 #Numbered list
9532 #item 2
9533 # item 3
9534 !! html
9535 <ol><li>Numbered list</li>
9536 <li>item 2</li>
9537 <li> item 3</li></ol>
9538
9539 !! end
9540
9541 !! test
9542 Mixed list
9543 !! wikitext
9544 *Mixed list
9545 *# with numbers
9546 ** and bullets
9547 *# and numbers
9548 *bullets again
9549 **bullet level 2
9550 ***bullet level 3
9551 ***#Number on level 4
9552 **bullet level 2
9553 **#Number on level 3
9554 **#Number on level 3
9555 *#number level 2
9556 *Level 1
9557 *** Level 3
9558 #** Level 3, but ordered
9559 !! html
9560 <ul><li>Mixed list
9561 <ol><li> with numbers</li></ol>
9562 <ul><li> and bullets</li></ul>
9563 <ol><li> and numbers</li></ol></li>
9564 <li>bullets again
9565 <ul><li>bullet level 2
9566 <ul><li>bullet level 3
9567 <ol><li>Number on level 4</li></ol></li></ul></li>
9568 <li>bullet level 2
9569 <ol><li>Number on level 3</li>
9570 <li>Number on level 3</li></ol></li></ul>
9571 <ol><li>number level 2</li></ol></li>
9572 <li>Level 1
9573 <ul><li><ul><li> Level 3</li></ul></li></ul></li></ul>
9574 <ol><li><ul><li><ul><li> Level 3, but ordered</li></ul></li></ul></li></ol>
9575
9576 !! end
9577
9578 !! test
9579 1. Nested mixed wikitext and html list
9580 !! wikitext
9581 * hi
9582 * <ul><li>ho</li></ul>
9583 * hi
9584 ** ho
9585 !! html/php
9586 <ul><li> hi</li>
9587 <li> <ul><li>ho</li></ul></li>
9588 <li> hi
9589 <ul><li> ho</li></ul></li></ul>
9590
9591 !! html/parsoid
9592 <ul><li> hi</li>
9593 <li> <ul data-parsoid='{"stx":"html"}'><li data-parsoid='{"stx":"html"}'>ho</li></ul></li>
9594 <li> hi
9595 <ul><li> ho</li></ul></li></ul>
9596 !! end
9597
9598 !! test
9599 2. Nested mixed wikitext and html list (incompatible)
9600 !! wikitext
9601 ; hi
9602 : {{echo|<li>ho</li>}}
9603 !! html/php
9604 <dl><dt> hi</dt>
9605 <dd> <li>ho</li></dd></dl>
9606
9607 !! html/parsoid
9608 <dl><dt> hi</dt>
9609 <dd> <li about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"stx":"html","pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;li>ho&lt;/li>"}},"i":0}}]}'>ho</li></dd></dl>
9610 !! end
9611
9612 !! test
9613 Nested lists 1
9614 !! wikitext
9615 *foo
9616 **bar
9617 !! html
9618 <ul><li>foo
9619 <ul><li>bar</li></ul></li></ul>
9620
9621 !! end
9622
9623 !! test
9624 Nested lists 2
9625 !! wikitext
9626 **foo
9627 *bar
9628 !! html
9629 <ul><li><ul><li>foo</li></ul></li>
9630 <li>bar</li></ul>
9631
9632 !! end
9633
9634 !! test
9635 Nested lists 3 (first element empty)
9636 !! wikitext
9637 *
9638 **bar
9639 !! html
9640 <ul><li>
9641 <ul><li>bar</li></ul></li></ul>
9642
9643 !! end
9644
9645 !! test
9646 Nested lists 4 (first element empty)
9647 !! wikitext
9648 **
9649 *bar
9650 !! html
9651 <ul><li><ul><li></li></ul></li>
9652 <li>bar</li></ul>
9653
9654 !! end
9655
9656 !! test
9657 Nested lists 5 (both elements empty)
9658 !! wikitext
9659 **
9660 *
9661 !! html
9662 <ul><li><ul><li></li></ul></li>
9663 <li></li></ul>
9664
9665 !! end
9666
9667 !! test
9668 Nested lists 6 (both elements empty)
9669 !! wikitext
9670 *
9671 **
9672 !! html
9673 <ul><li>
9674 <ul><li></li></ul></li></ul>
9675
9676 !! end
9677
9678 !! test
9679 Nested lists 7 (skip initial nesting levels)
9680 !! wikitext
9681 *** foo
9682 !! html
9683 <ul><li><ul><li><ul><li> foo</li></ul></li></ul></li></ul>
9684
9685 !! end
9686
9687 !! test
9688 Nested lists 8 (multiple nesting transitions)
9689 !! wikitext
9690 * foo
9691 *** bar
9692 ** baz
9693 * boo
9694 !! html
9695 <ul><li> foo
9696 <ul><li><ul><li> bar</li></ul></li>
9697 <li> baz</li></ul></li>
9698 <li> boo</li></ul>
9699
9700 !! end
9701
9702 !! test
9703 Nested lists 9 (extension interaction)
9704 !! options
9705 parsoid
9706 !! wikitext
9707 *<references />
9708 !! html/parsoid
9709 <ul><li data-parsoid='{}'><ol class="mw-references references" typeof="mw:Extension/references" about="#mwt2" data-parsoid='{}' data-mw='{"name":"references","attrs":{}}'></ol></li></ul>
9710 !! end
9711
9712 !! test
9713 1. Lists with start-of-line-transparent tokens before bullets: Comments
9714 !! wikitext
9715 *foo
9716 *<!--cmt-->bar
9717 <!--cmt-->*baz
9718 !! html
9719 <ul><li>foo</li>
9720 <li>bar</li>
9721 <li>baz</li></ul>
9722
9723 !! end
9724
9725 !! test
9726 2. Lists with start-of-line-transparent tokens before bullets: Template close
9727 !! wikitext
9728 *foo {{echo|bar
9729 }}*baz
9730 !! html
9731 <ul><li>foo bar</li>
9732 <li>baz</li></ul>
9733
9734 !! end
9735
9736 !! test
9737 List items are not parsed correctly following a <pre> block (T2785)
9738 !! wikitext
9739 * <pre>foo</pre>
9740 * <pre>bar</pre>
9741 * zar
9742 !! html/php
9743 <ul><li> <pre>foo</pre></li>
9744 <li> <pre>bar</pre></li>
9745 <li> zar</li></ul>
9746
9747 !! html/parsoid
9748 <ul><li> <pre typeof="mw:Extension/pre" about="#mwt2" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"foo"}}'>foo</pre></li>
9749 <li> <pre typeof="mw:Extension/pre" about="#mwt4" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"bar"}}'>bar</pre></li>
9750 <li> zar</li></ul>
9751 !! end
9752
9753 !! test
9754 List items from template
9755 !! wikitext
9756
9757 {{inner list}}
9758 * item 2
9759
9760 * item 0
9761 {{inner list}}
9762 * item 2
9763
9764 * item 0
9765 * notSOL{{inner list}}
9766 * item 2
9767 !! html
9768 <ul><li> item 1</li>
9769 <li> item 2</li></ul>
9770 <ul><li> item 0</li>
9771 <li> item 1</li>
9772 <li> item 2</li></ul>
9773 <ul><li> item 0</li>
9774 <li> notSOL</li>
9775 <li> item 1</li>
9776 <li> item 2</li></ul>
9777
9778 !! end
9779
9780 !! test
9781 List interrupted by empty line or heading
9782 !! wikitext
9783 * foo
9784
9785 ** bar
9786 == A heading ==
9787 * Another list item
9788 !! html
9789 <ul><li> foo</li></ul>
9790 <ul><li><ul><li> bar</li></ul></li></ul>
9791 <h2><span class="mw-headline" id="A_heading">A heading</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: A heading">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
9792 <ul><li> Another list item</li></ul>
9793
9794 !!end
9795
9796 !!test
9797 Multiple list tags generated by templates
9798 !! wikitext
9799 {{echo|<li>}}a
9800 {{echo|<li>}}b
9801 {{echo|<li>}}c
9802 !! html
9803 <li>a
9804 <li>b
9805 <li>c</li>
9806 </li>
9807 </li>
9808
9809 !! html+tidy
9810 <ul>
9811 <li>a</li>
9812 <li>b</li>
9813 <li>c</li>
9814 </ul>
9815 !!end
9816
9817 !!test
9818 Single-comment whitespace lines dont break lists, and neither do multi-comment whitespace lines
9819 !! wikitext
9820 *a
9821 <!--This line will NOT split the list-->
9822 *b
9823 <!--This line will NOT split the list either-->
9824 *c
9825 <!--foo--> <!----> <!--This line NOT split the list either-->
9826 *d
9827 !! html
9828 <ul><li>a</li>
9829 <li>b</li>
9830 <li>c</li>
9831 <li>d</li></ul>
9832
9833 !!end
9834
9835 !!test
9836 Replacing whitespace with tabs still doesn't break the list (gerrit 78327)
9837 !! wikitext
9838 *a
9839 <!--This line will NOT split the list-->
9840 *b
9841 <!--This line will NOT split the list either-->
9842 *c
9843 <!--foo--> <!----> <!--This line NOT split the list
9844 either-->
9845 *d
9846 !! html
9847 <ul><li>a</li>
9848 <li>b</li>
9849 <li>c</li>
9850 <li>d</li></ul>
9851
9852 !!end
9853
9854 !!test
9855 Test the li-hack
9856 (The PHP parser relies on Tidy for the hack)
9857 !!options
9858 parsoid=wt2html,wt2wt
9859 !! wikitext
9860 * foo
9861 * <li>li-hack
9862 * {{echo|<li>templated li-hack}}
9863 * <!--foo--> <li> unsupported li-hack with preceding comments
9864
9865 <ul>
9866 <li><li>not a li-hack
9867 </li>
9868 </ul>
9869 !! html+tidy
9870 <ul>
9871 <li>foo</li>
9872 <li>li-hack</li>
9873 <li>templated li-hack</li>
9874 <li>unsupported li-hack with preceding comments</li>
9875 </ul>
9876 <ul>
9877 <li>not a li-hack</li>
9878 </ul>
9879 !! html/parsoid
9880 <ul><li> foo</li>
9881 <li data-parsoid='{"stx":"html","autoInsertedEnd":true,"liHackSrc":"* "}'>li-hack</li>
9882 <li about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"stx":"html","autoInsertedEnd":true,,"pi":[[{"k":"1"}]]}' data-mw='{"parts":["* ",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;li>templated li-hack"}},"i":0}}]}'>templated li-hack</li>
9883 <li data-parsoid='{"autoInsertedEnd":true}'> <!--foo--> </li><li data-parsoid='{"stx":"html","autoInsertedEnd":true}'> unsupported li-hack with preceding comments</li></ul>
9884
9885 <ul data-parsoid='{"stx":"html"}'>
9886 <li class="mw-empty-elt" data-parsoid='{"stx":"html","autoInsertedEnd":true}'></li><li data-parsoid='{"stx":"html"}'>not a li-hack
9887 </li>
9888 </ul>
9889
9890 !!end
9891
9892 !! test
9893 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
9894 !! options
9895 parsoid
9896 !! wikitext
9897 # foo
9898 ## bar
9899 * foo
9900 ** bar
9901 : foo
9902 :: bar
9903 !! html
9904 <ol>
9905 <li> foo<ol>
9906 <li> bar</li>
9907 </ol></li>
9908 </ol><ul>
9909 <li> foo<ul>
9910 <li> bar</li>
9911 </ul></li>
9912 </ul><dl>
9913 <dd> foo<dl>
9914 <dd> bar</dd>
9915 </dl></dd>
9916 </dl>
9917 !! end
9918
9919 !! test
9920 Parsoid: Test of whitespace serialization with Templated bullets
9921 !! options
9922 parsoid
9923 !! wikitext
9924 * {{bullet}}
9925 !! html/parsoid
9926 <ul>
9927 <li class="mw-empty-elt"> </li><li about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"bullet","href":"./Template:Bullet"},"params":{},"i":0}}]}'> Bar</li>
9928 </ul>
9929 !! end
9930
9931 # ------------------------------------------------------------------------
9932 # The next set of tests are about Parsoid's ability to handle badly nested
9933 # tags (parse, minimize scope of fixup, and roundtrip back)
9934 # ------------------------------------------------------------------------
9935
9936 !! test
9937 Unbalanced closing block tags break a list
9938 (php parser relies on Tidy to fix up)
9939 !! wikitext
9940 <div>
9941 *a</div><div>
9942 *b</div>
9943 !! html+tidy
9944 <div>
9945 <ul>
9946 <li>a</li>
9947 </ul>
9948 </div>
9949 <div>
9950 <ul>
9951 <li>b</li>
9952 </ul>
9953 </div>
9954 !! end
9955
9956 # Parsoid fails this test, but it might be tricky to support properly.
9957 # See T70395.
9958 !! test
9959 Unbalanced closing non-block tags don't break a list
9960 (php parser relies on Tidy to fix up)
9961 !! wikitext
9962 <span>
9963 *a</span><span>
9964 *b</span>
9965 !! html/php+tidy
9966 <ul>
9967 <li><span>a</span></li>
9968 <li><span>b</span></li>
9969 </ul>
9970 !! html/parsoid
9971 <span>
9972 <ul>
9973 <li>a<span></span>
9974 </li>
9975 <li>b
9976 </li>
9977 </ul>
9978 </span>
9979 !! end
9980
9981 !! test
9982 Unclosed formatting tags that straddle lists are closed and reopened
9983 (php parser relies on Tidy to fix up)
9984 !! options
9985 parsoid=wt2html,wt2wt,html2html
9986 !! wikitext
9987 # <s> a
9988 # b </s>
9989 !! html/php+tidy
9990 <ol>
9991 <li><s>a</s></li>
9992 <li><s>b</s></li>
9993 </ol>
9994 !! html/parsoid
9995 <ol><li> <s> a</s></li>
9996 <li><s> b </s></li></ol>
9997 !! end
9998
9999 # See T70395.
10000 !!test
10001 1. List embedded in a formatting tag
10002 !! wikitext
10003 <small>
10004 * foo
10005 </small>
10006 !! html/php+tidy
10007 <ul>
10008 <li><small>foo</small></li>
10009 </ul>
10010 !! html/parsoid
10011 <small>
10012 <ul>
10013 <li> foo</li>
10014 </ul>
10015 </small>
10016 !!end
10017
10018 ## Ugly Parsoid output here
10019 ## Not sure what the right output is.
10020 !!test
10021 2. List embedded in a formatting tag
10022 !! wikitext
10023 <small>
10024 *a
10025 *b</small>
10026 !! html/php+tidy
10027 <ul>
10028 <li><small>a</small></li>
10029 <li><small>b</small></li>
10030 </ul>
10031 !! html/parsoid
10032 <small></small>
10033 <ul><small>
10034 <li>a</li>
10035 </small>
10036 <li><small>b</small></li>
10037 </ul>
10038 !!end
10039
10040 # Ugly Parsoid and PHP parser output here
10041 # Not sure if we want to make this a test!
10042 #
10043 ## !!test
10044 ## 3. Unclosed formatting tags in list elements
10045 ## !! wikitext
10046 ## *<small>a
10047 ## *<small>b
10048 ## !! html/php+tidy
10049 ## <ul>
10050 ## <li><small>a</small></li>
10051 ## <li><small><small>b</small></small></li>
10052 ## </ul>
10053 ## !! html/parsoid
10054 ## <ul>
10055 ## <li><small>a</small></li>
10056 ## <small>
10057 ## <li><small>b</small></li>
10058 ## </small></ul>
10059 ## !!end
10060
10061 # This is a bug in the PHP parser + tidy combination.
10062 # (The </tr> tag gets parsed as text and html-escaped by PHP,
10063 # and then fostered out of the table by tidy.)
10064 # We believe the Parsoid output to be correct.
10065 !! test
10066 Table with missing opening <tr> tag
10067 !! options
10068 parsoid=wt2html,wt2wt
10069 !! wikitext
10070 <table>
10071 <td>foo</td>
10072 </tr>
10073 </table>
10074 !! html+tidy
10075 <table>
10076 <tr>
10077 <td>foo</td>
10078 </tr>
10079 </table>
10080 !! end
10081
10082 ###
10083 ### Magic Words
10084 ###
10085
10086 # Note that the current date is hard-coded as
10087 # 1970-01-01T00:02:03Z (a Thursday)
10088 # when running parser tests. The timezone is also fixed to GMT, so
10089 # local date will be identical to current date.
10090
10091 !! test
10092 Magic Word: {{CURRENTDAY}}
10093 !! wikitext
10094 {{CURRENTDAY}}
10095 !! html
10096 <p>1
10097 </p>
10098 !! end
10099
10100 !! test
10101 Magic Word: {{CURRENTDAY2}}
10102 !! wikitext
10103 {{CURRENTDAY2}}
10104 !! html
10105 <p>01
10106 </p>
10107 !! end
10108
10109 !! test
10110 Magic Word: {{CURRENTDAYNAME}}
10111 !! wikitext
10112 {{CURRENTDAYNAME}}
10113 !! html
10114 <p>Thursday
10115 </p>
10116 !! end
10117
10118 !! test
10119 Magic Word: {{CURRENTDOW}}
10120 !! wikitext
10121 {{CURRENTDOW}}
10122 !! html
10123 <p>4
10124 </p>
10125 !! end
10126
10127 !! test
10128 Magic Word: {{CURRENTMONTH}}
10129 !! wikitext
10130 {{CURRENTMONTH}}
10131 !! html
10132 <p>01
10133 </p>
10134 !! end
10135
10136 !! test
10137 Magic Word: {{CURRENTMONTH1}}
10138 !! wikitext
10139 {{CURRENTMONTH1}}
10140 !! html
10141 <p>1
10142 </p>
10143 !! end
10144
10145 !! test
10146 Magic Word: {{CURRENTMONTHABBREV}}
10147 !! wikitext
10148 {{CURRENTMONTHABBREV}}
10149 !! html
10150 <p>Jan
10151 </p>
10152 !! end
10153
10154 !! test
10155 Magic Word: {{CURRENTMONTHNAME}}
10156 !! wikitext
10157 {{CURRENTMONTHNAME}}
10158 !! html
10159 <p>January
10160 </p>
10161 !! end
10162
10163 !! test
10164 Magic Word: {{CURRENTMONTHNAMEGEN}}
10165 !! wikitext
10166 {{CURRENTMONTHNAMEGEN}}
10167 !! html
10168 <p>January
10169 </p>
10170 !! end
10171
10172 !! test
10173 Magic Word: {{CURRENTTIME}}
10174 !! wikitext
10175 {{CURRENTTIME}}
10176 !! html
10177 <p>00:02
10178 </p>
10179 !! end
10180
10181 !! test
10182 Magic Word: {{CURRENTHOUR}}
10183 !! wikitext
10184 {{CURRENTHOUR}}
10185 !! html
10186 <p>00
10187 </p>
10188 !! end
10189
10190 !! test
10191 Magic Word: {{CURRENTWEEK}} (T6594)
10192 !! wikitext
10193 {{CURRENTWEEK}}
10194 !! html
10195 <p>1
10196 </p>
10197 !! end
10198
10199 !! test
10200 Magic Word: {{CURRENTYEAR}}
10201 !! wikitext
10202 {{CURRENTYEAR}}
10203 !! html
10204 <p>1970
10205 </p>
10206 !! end
10207
10208 !! test
10209 Magic Word: {{CURRENTTIMESTAMP}}
10210 !! wikitext
10211 {{CURRENTTIMESTAMP}}
10212 !! html
10213 <p>19700101000203
10214 </p>
10215 !! end
10216
10217 !! test
10218 Magic Words LOCAL (UTC)
10219 !! wikitext
10220 * {{LOCALMONTH}}
10221 * {{LOCALMONTH1}}
10222 * {{LOCALMONTHNAME}}
10223 * {{LOCALMONTHNAMEGEN}}
10224 * {{LOCALMONTHABBREV}}
10225 * {{LOCALDAY}}
10226 * {{LOCALDAY2}}
10227 * {{LOCALDAYNAME}}
10228 * {{LOCALYEAR}}
10229 * {{LOCALTIME}}
10230 * {{LOCALHOUR}}
10231 * {{LOCALWEEK}}
10232 * {{LOCALDOW}}
10233 * {{LOCALTIMESTAMP}}
10234 !! html
10235 <ul><li> 01</li>
10236 <li> 1</li>
10237 <li> January</li>
10238 <li> January</li>
10239 <li> Jan</li>
10240 <li> 1</li>
10241 <li> 01</li>
10242 <li> Thursday</li>
10243 <li> 1970</li>
10244 <li> 00:02</li>
10245 <li> 00</li>
10246 <li> 1</li>
10247 <li> 4</li>
10248 <li> 19700101000203</li></ul>
10249
10250 !! end
10251
10252 !! test
10253 Magic Word: {{FULLPAGENAME}}
10254 !! options
10255 title=[[User:Ævar Arnfjörð Bjarmason]]
10256 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10257 !! wikitext
10258 {{FULLPAGENAME}}
10259 !! html/*
10260 <p>User:Ævar Arnfjörð Bjarmason
10261 </p>
10262 !! end
10263
10264 !! test
10265 Magic Word: {{FULLPAGENAMEE}}
10266 !! options
10267 title=[[User:Ævar Arnfjörð Bjarmason]]
10268 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10269 !! wikitext
10270 {{FULLPAGENAMEE}}
10271 !! html/*
10272 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10273 </p>
10274 !! end
10275
10276 !! test
10277 Magic Word: {{TALKSPACE}}
10278 !! options
10279 title=[[User:Ævar Arnfjörð Bjarmason]]
10280 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10281 !! wikitext
10282 {{TALKSPACE}}
10283 !! html/*
10284 <p>User talk
10285 </p>
10286 !! end
10287
10288 !! test
10289 Magic Word: {{TALKSPACE}}, same namespace
10290 !! options
10291 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10292 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10293 !! wikitext
10294 {{TALKSPACE}}
10295 !! html/*
10296 <p>User talk
10297 </p>
10298 !! end
10299
10300 !! test
10301 Magic Word: {{TALKSPACE}}, main namespace
10302 !! options
10303 title=[[Parser Test]]
10304 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10305 !! wikitext
10306 {{TALKSPACE}}
10307 !! html/*
10308 <p>Talk
10309 </p>
10310 !! end
10311
10312 !! test
10313 Magic Word: {{TALKSPACEE}}
10314 !! options
10315 title=[[User:Ævar Arnfjörð Bjarmason]]
10316 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10317 !! wikitext
10318 {{TALKSPACEE}}
10319 !! html/*
10320 <p>User_talk
10321 </p>
10322 !! end
10323
10324 !! test
10325 Magic Word: {{SUBJECTSPACE}}
10326 !! options
10327 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10328 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10329 !! wikitext
10330 {{SUBJECTSPACE}}
10331 !! html/*
10332 <p>User
10333 </p>
10334 !! end
10335
10336 !! test
10337 Magic Word: {{SUBJECTSPACE}}, same namespace
10338 !! options
10339 title=[[User:Ævar Arnfjörð Bjarmason]]
10340 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10341 !! wikitext
10342 {{SUBJECTSPACE}}
10343 !! html/*
10344 <p>User
10345 </p>
10346 !! end
10347
10348 !! test
10349 Magic Word: {{SUBJECTSPACE}}, main namespace
10350 !! options
10351 title=[[Parser Test]]
10352 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10353 !! wikitext
10354 {{SUBJECTSPACE}}
10355 !! html/*
10356
10357 !! end
10358
10359 !! test
10360 Magic Word: {{SUBJECTSPACEE}}
10361 !! options
10362 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10363 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10364 !! wikitext
10365 {{SUBJECTSPACEE}}
10366 !! html/*
10367 <p>User
10368 </p>
10369 !! end
10370
10371 !! test
10372 Magic Word: {{NAMESPACE}}
10373 !! options
10374 title=[[User:Ævar Arnfjörð Bjarmason]]
10375 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10376 !! wikitext
10377 {{NAMESPACE}}
10378 !! html/*
10379 <p>User
10380 </p>
10381 !! end
10382
10383 !! test
10384 Magic Word: {{NAMESPACEE}}
10385 !! options
10386 title=[[User:Ævar Arnfjörð Bjarmason]]
10387 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10388 !! wikitext
10389 {{NAMESPACEE}}
10390 !! html/*
10391 <p>User
10392 </p>
10393 !! end
10394
10395 !! test
10396 Magic Word: {{NAMESPACENUMBER}}
10397 !! options
10398 title=[[User:Ævar Arnfjörð Bjarmason]]
10399 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10400 !! wikitext
10401 {{NAMESPACENUMBER}}
10402 !! html/*
10403 <p>2
10404 </p>
10405 !! end
10406
10407 !! test
10408 Magic Word: {{SUBPAGENAME}}
10409 !! options
10410 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
10411 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10412 !! wikitext
10413 {{SUBPAGENAME}}
10414 !! html/*
10415 <p>sub ö
10416 </p>
10417 !! end
10418
10419 !! test
10420 Magic Word: {{SUBPAGENAMEE}}
10421 !! options
10422 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
10423 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10424 !! wikitext
10425 {{SUBPAGENAMEE}}
10426 !! html/*
10427 <p>sub_%C3%B6
10428 </p>
10429 !! end
10430
10431 !! test
10432 Magic Word: {{ROOTPAGENAME}}
10433 !! options
10434 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
10435 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10436 !! wikitext
10437 {{ROOTPAGENAME}}
10438 !! html/*
10439 <p>Ævar Arnfjörð Bjarmason
10440 </p>
10441 !! end
10442
10443 !! test
10444 Magic Word: {{ROOTPAGENAMEE}}
10445 !! options
10446 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
10447 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10448 !! wikitext
10449 {{ROOTPAGENAMEE}}
10450 !! html/*
10451 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10452 </p>
10453 !! end
10454
10455 !! test
10456 Magic Word: {{BASEPAGENAME}}
10457 !! options
10458 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
10459 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10460 !! wikitext
10461 {{BASEPAGENAME}}
10462 !! html/*
10463 <p>Ævar Arnfjörð Bjarmason
10464 </p>
10465 !! end
10466
10467 !! test
10468 Magic Word: {{BASEPAGENAMEE}}
10469 !! options
10470 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
10471 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10472 !! wikitext
10473 {{BASEPAGENAMEE}}
10474 !! html/*
10475 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10476 </p>
10477 !! end
10478
10479 !! test
10480 Magic Word: {{TALKPAGENAME}}
10481 !! options
10482 title=[[User:Ævar Arnfjörð Bjarmason]]
10483 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10484 !! wikitext
10485 {{TALKPAGENAME}}
10486 !! html/*
10487 <p>User talk:Ævar Arnfjörð Bjarmason
10488 </p>
10489 !! end
10490
10491 !! test
10492 Magic Word: {{TALKPAGENAMEE}}
10493 !! options
10494 title=[[User:Ævar Arnfjörð Bjarmason]]
10495 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10496 !! wikitext
10497 {{TALKPAGENAMEE}}
10498 !! html/*
10499 <p>User_talk:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10500 </p>
10501 !! end
10502
10503 !! test
10504 Magic Word: {{SUBJECTPAGENAME}}
10505 !! options
10506 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10507 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10508 !! wikitext
10509 {{SUBJECTPAGENAME}}
10510 !! html/*
10511 <p>User:Ævar Arnfjörð Bjarmason
10512 </p>
10513 !! end
10514
10515 !! test
10516 Magic Word: {{SUBJECTPAGENAMEE}}
10517 !! options
10518 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10519 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10520 !! wikitext
10521 {{SUBJECTPAGENAMEE}}
10522 !! html/*
10523 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10524 </p>
10525 !! end
10526
10527 !! test
10528 Magic Word: {{NUMBEROFFILES}}
10529 !! options
10530 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10531 !! wikitext
10532 {{NUMBEROFFILES}}
10533 !! html/*
10534 <p>7
10535 </p>
10536 !! end
10537
10538 !! test
10539 Magic Word: {{PAGENAME}}
10540 !! options
10541 title=[[User:Ævar Arnfjörð Bjarmason]]
10542 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10543 !! wikitext
10544 {{PAGENAME}}
10545 !! html/*
10546 <p>Ævar Arnfjörð Bjarmason
10547 </p>
10548 !! end
10549
10550 !! test
10551 Magic Word: {{PAGENAME}} with metacharacters
10552 !! options
10553 title=[['foo & bar = baz']]
10554 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10555 !! wikitext
10556 ''{{PAGENAME}}''
10557 !! html/php
10558 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
10559 </p>
10560 !! html+tidy
10561 <p><i>'foo &amp; bar = baz'</i></p>
10562 !! end
10563
10564 !! test
10565 Magic Word: {{PAGENAME}} with metacharacters (T28781)
10566 !! options
10567 title=[[*RFC 1234 http://example.com/]]
10568 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10569 !! wikitext
10570 {{PAGENAME}}
10571 !! html/php
10572 <p>&#42;RFC&#32;1234 http&#58;//example.com/
10573 </p>
10574 !! html+tidy
10575 <p>*RFC 1234 http://example.com/</p>
10576 !! end
10577
10578 !! test
10579 Magic Word: {{PAGENAMEE}}
10580 !! options
10581 title=[[User:Ævar Arnfjörð Bjarmason]]
10582 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10583 !! wikitext
10584 {{PAGENAMEE}}
10585 !! html/*
10586 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10587 </p>
10588 !! end
10589
10590 !! test
10591 Magic Word: {{PAGENAMEE}} with metacharacters (T28781)
10592 !! options
10593 title=[[*RFC 1234 http://example.com/]]
10594 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10595 !! wikitext
10596 {{PAGENAMEE}}
10597 !! html/php
10598 <p>&#42;RFC_1234_http&#58;//example.com/
10599 </p>
10600 !! html+tidy
10601 <p>*RFC_1234_http://example.com/</p>
10602 !! end
10603
10604 !! test
10605 Magic Word: {{REVISIONID}}
10606 !! options
10607 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10608 showflags
10609 !! wikitext
10610 {{REVISIONID}}
10611 !! html/*
10612 <p>1337
10613 </p>
10614 flags=vary-revision-id
10615 !! end
10616
10617 !! test
10618 Magic Word: {{SCRIPTPATH}}
10619 !! options
10620 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10621 !! wikitext
10622 {{SCRIPTPATH}}
10623 !! html/*
10624
10625 !! end
10626
10627 !! test
10628 Magic Word: {{STYLEPATH}}
10629 !! options
10630 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10631 !! wikitext
10632 {{STYLEPATH}}
10633 !! html/*
10634 <p>/skins
10635 </p>
10636 !! end
10637
10638 !! test
10639 Magic Word: {{SERVER}}
10640 !! options
10641 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10642 !! wikitext
10643 {{SERVER}}
10644 !! html/*
10645 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
10646 </p>
10647 !! end
10648
10649 !! test
10650 Magic Word: {{SERVERNAME}}
10651 !! options
10652 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10653 !! wikitext
10654 {{SERVERNAME}}
10655 !! html/*
10656 <p>example.org
10657 </p>
10658 !! end
10659
10660 !! test
10661 Magic Word: {{SITENAME}}
10662 !! options
10663 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10664 !! wikitext
10665 {{SITENAME}}
10666 !! html/*
10667 <p>MediaWiki
10668 </p>
10669 !! end
10670
10671 !! test
10672 Magic Word: {{PAGELANGUAGE}}
10673 !! options
10674 language=fr
10675 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10676 !! wikitext
10677 {{PAGELANGUAGE}}
10678 !! html/*
10679 <p>fr
10680 </p>
10681 !! end
10682
10683 !! test
10684 Magic Word: {{PAGELANGUAGE}} on a page with no explicitly set language
10685 !! options
10686 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10687 !! wikitext
10688 {{PAGELANGUAGE}}
10689 !! html/*
10690 <p>en
10691 </p>
10692 !! end
10693
10694 !! test
10695 Case-sensitive magic words, when cased differently, should just be template transclusions
10696 !! wikitext
10697 {{CurrentMonth}}
10698 {{currentday}}
10699 {{cURreNTweEK}}
10700 {{currentHour}}
10701 !! html
10702 <p><a href="/index.php?title=Template:CurrentMonth&amp;action=edit&amp;redlink=1" class="new" title="Template:CurrentMonth (page does not exist)">Template:CurrentMonth</a>
10703 <a href="/index.php?title=Template:Currentday&amp;action=edit&amp;redlink=1" class="new" title="Template:Currentday (page does not exist)">Template:Currentday</a>
10704 <a href="/index.php?title=Template:CURreNTweEK&amp;action=edit&amp;redlink=1" class="new" title="Template:CURreNTweEK (page does not exist)">Template:CURreNTweEK</a>
10705 <a href="/index.php?title=Template:CurrentHour&amp;action=edit&amp;redlink=1" class="new" title="Template:CurrentHour (page does not exist)">Template:CurrentHour</a>
10706 </p>
10707 !! end
10708
10709 !! test
10710 Case-insensitive magic words should still work with weird casing.
10711 !! wikitext
10712 {{sErVeRNaMe}}
10713 {{LCFirst:AOEU}}
10714 {{ucFIRST:aoeu}}
10715 {{SERver}}
10716 !! html
10717 <p>example.org
10718 aOEU
10719 Aoeu
10720 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
10721 </p>
10722 !! end
10723
10724 # From plwiki:PLOS_ONE
10725 !! test
10726 Parsoid: Page property magic word with magic word contents
10727 !! wikitext
10728 {{DISPLAYTITLE:''{{PAGENAME}}''}}
10729 !! html/parsoid
10730 <meta property="mw:PageProp/displaytitle" content="Main Page" about="#mwt3" typeof="mw:ExpandedAttrs" data-parsoid='{"src":"{{DISPLAYTITLE:&#39;&#39;{{PAGENAME}}&#39;&#39;}}"}' data-mw='{"attribs":[[{"txt":"content"},{"html":"DISPLAYTITLE:&lt;i data-parsoid=&#39;{\"dsr\":[15,31,2,2]}&#39;>&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[]],\"dsr\":[17,29,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"PAGENAME\",\"function\":\"pagename\"},\"params\":{},\"i\":0}}]}&#39;>Main Page&lt;/span>&lt;/i>"}]]}'/>
10731 !! end
10732
10733 # NOTE: mw:ExpandedAttrs is not the best typeof here. mw:Transclusion is better.
10734 # But, this is a limitation of our representation and is documented in
10735 # TemplateHandler.js in processSpecialMagicWord
10736 !! test
10737 Parsoid: Template-generated DISPLAYTITLE
10738 !! wikitext
10739 {{{{echo|DISPLAYTITLE}}:Foo}}
10740 !! options
10741 showtitle
10742 !! config
10743 wgAllowDisplayTitle=true
10744 wgRestrictDisplayTitle=false
10745 !! html/php
10746 Foo
10747
10748 !! html/parsoid
10749 <meta property="mw:PageProp/displaytitle" content="Foo" about="#mwt1" typeof="mw:ExpandedAttrs" data-parsoid='{"pi":[[]]}' data-mw='{"attribs":[[{"txt":"content"},{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[2,23,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"DISPLAYTITLE\"}},\"i\":0}}]}&#39;>DISPLAYTITLE&lt;/span>:Foo"}]]}'/>
10750 !! end
10751
10752 !! test
10753 Namespace 1 {{ns:1}}
10754 !! wikitext
10755 {{ns:1}}
10756 !! html
10757 <p>Talk
10758 </p>
10759 !! end
10760
10761 !! test
10762 Namespace 1 {{ns:01}}
10763 !! wikitext
10764 {{ns:01}}
10765 !! html
10766 <p>Talk
10767 </p>
10768 !! end
10769
10770 !! test
10771 Namespace 0 {{ns:0}} (T6783)
10772 !! wikitext
10773 {{ns:0}}
10774 !! html
10775
10776 !! end
10777
10778 !! test
10779 Namespace 0 {{ns:00}} (T6783)
10780 !! wikitext
10781 {{ns:00}}
10782 !! html
10783
10784 !! end
10785
10786 !! test
10787 Namespace -1 {{ns:-1}}
10788 !! wikitext
10789 {{ns:-1}}
10790 !! html
10791 <p>Special
10792 </p>
10793 !! end
10794
10795 !! test
10796 Namespace User {{ns:User}}
10797 !! wikitext
10798 {{ns:User}}
10799 !! html
10800 <p>User
10801 </p>
10802 !! end
10803
10804 !! test
10805 Namespace User talk {{ns:User_talk}}
10806 !! wikitext
10807 {{ns:User_talk}}
10808 !! html
10809 <p>User talk
10810 </p>
10811 !! end
10812
10813 !! test
10814 Namespace User talk {{ns:uSeR tAlK}}
10815 !! wikitext
10816 {{ns:uSeR tAlK}}
10817 !! html
10818 <p>User talk
10819 </p>
10820 !! end
10821
10822 !! test
10823 Namespace File {{ns:File}}
10824 !! wikitext
10825 {{ns:File}}
10826 !! html
10827 <p>File
10828 </p>
10829 !! end
10830
10831 !! test
10832 Namespace File {{ns:Image}}
10833 !! wikitext
10834 {{ns:Image}}
10835 !! html
10836 <p>File
10837 </p>
10838 !! end
10839
10840 !! test
10841 Namespace (lang=de) Benutzer {{ns:User}}
10842 !! options
10843 language=de
10844 !! wikitext
10845 {{ns:User}}
10846 !! html
10847 <p>Benutzer
10848 </p>
10849 !! end
10850
10851 !! test
10852 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
10853 !! options
10854 language=de
10855 !! wikitext
10856 {{ns:3}}
10857 !! html
10858 <p>Benutzer Diskussion
10859 </p>
10860 !! end
10861
10862 !! test
10863 Urlencode
10864 !! wikitext
10865 {{urlencode:hi world?!}}
10866 {{urlencode:hi world?!|WIKI}}
10867 {{urlencode:hi world?!|PATH}}
10868 {{urlencode:hi world?!|QUERY}}
10869 !! html/php
10870 <p>hi+world%3F%21
10871 hi_world%3F!
10872 hi%20world%3F%21
10873 hi+world%3F%21
10874 </p>
10875 !! end
10876
10877 !! test
10878 Magic Word: prioritize type info over data-parsoid
10879 !! options
10880 parsoid=html2wt
10881 !! html/parsoid
10882 <meta property="mw:PageProp/forcetoc" data-parsoid='{"magicSrc":"__NOTOC__"}'/>
10883 !! wikitext
10884 __FORCETOC__
10885 !! end
10886
10887 !! test
10888 Magic Word: serialize on separate line (parsoid)
10889 !! options
10890 parsoid=wt2wt,html2wt
10891 !! wikitext
10892 foo
10893 __NOTOC__
10894 bar
10895 !! html/parsoid
10896 foo<meta property="mw:PageProp/notoc"/>bar
10897 !! end
10898
10899 !! test
10900 Magic Word: rt non-english wikis
10901 !! options
10902 parsoid=wt2wt
10903 language=de
10904 !! wikitext
10905 __NOEDITSECTION__
10906 !! html/parsoid
10907 <meta property="mw:PageProp/noeditsection" data-parsoid='{"magicSrc":"__NOEDITSECTION__"}'/>
10908 !! end
10909
10910 !!test
10911 __proto__ is treated as normal wikitext (T105997)
10912 !!wikitext
10913 __proto__
10914 !!html
10915 <p>__proto__
10916 </p>
10917 !!end
10918
10919 ###
10920 ### Magic links
10921 ###
10922 !! test
10923 Magic links: internal link to RFC (T2479)
10924 !! wikitext
10925 [[RFC 123]]
10926 !! html/php
10927 <p><a href="/index.php?title=RFC_123&amp;action=edit&amp;redlink=1" class="new" title="RFC 123 (page does not exist)">RFC 123</a>
10928 </p>
10929 !! html/parsoid
10930 <p><a rel="mw:WikiLink" href="./RFC_123" title="RFC 123">RFC 123</a></p>
10931 !! end
10932
10933 !! test
10934 Magic links: RFC (T2479)
10935 !! wikitext
10936 RFC 822
10937 !! html/php
10938 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
10939 </p>
10940 !! html/parsoid
10941 <p><a href="//tools.ietf.org/html/rfc822" rel="mw:ExtLink">RFC 822</a></p>
10942 !! end
10943
10944 !! test
10945 Magic links: RFC (T67278)
10946 !! wikitext
10947 This is RFC 822 but thisRFC 822 is not RFC 822linked.
10948 !! html/php
10949 <p>This is <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a> but thisRFC 822 is not RFC 822linked.
10950 </p>
10951 !! html/parsoid
10952 <p>This is <a href="//tools.ietf.org/html/rfc822" rel="mw:ExtLink">RFC 822</a> but thisRFC 822 is not RFC 822linked.</p>
10953 !! end
10954
10955 !! test
10956 Magic links: RFC (w/ non-newline whitespace, T30950/T31025)
10957 !! wikitext
10958 RFC &nbsp;&#160;&#0160;&#xA0;&#Xa0; 822
10959 RFC
10960 822
10961 !! html/php
10962 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
10963 RFC
10964 822
10965 </p>
10966 !! html/parsoid
10967 <p><a href="//tools.ietf.org/html/rfc822" rel="mw:ExtLink">RFC <span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#160;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#0160;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#xA0;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#Xa0;","srcContent":" "}'> </span> 822</a>
10968 RFC
10969 822</p>
10970 !! end
10971
10972 !! test
10973 Magic links: ISBN (T3937)
10974 !! wikitext
10975 ISBN 0-306-40615-2
10976 !! html/php
10977 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
10978 </p>
10979 !! html/parsoid
10980 <p><a href="./Special:BookSources/0306406152" rel="mw:WikiLink">ISBN 0-306-40615-2</a></p>
10981 !! end
10982
10983 !! test
10984 Magic links: ISBN (T67278)
10985 !! wikitext
10986 This is ISBN 978-0-316-09811-3 but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.
10987 !! html/php
10988 <p>This is <a href="/wiki/Special:BookSources/9780316098113" class="internal mw-magiclink-isbn">ISBN 978-0-316-09811-3</a> but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.
10989 </p>
10990 !! html/parsoid
10991 <p>This is <a href="./Special:BookSources/9780316098113" rel="mw:WikiLink">ISBN 978-0-316-09811-3</a> but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.</p>
10992 !! end
10993
10994 !! test
10995 Magic links: ISBN (w/ non-newline whitespace, T30950/T31025)
10996 !! wikitext
10997 ISBN &nbsp;&#160;&#0160;&#xA0;&#Xa0; 978&nbsp;0&#160;316&#0160;09811&#xA0;3
10998 ISBN
10999 9780316098113
11000 ISBN 978
11001 0316098113
11002 !! html/php
11003 <p><a href="/wiki/Special:BookSources/9780316098113" class="internal mw-magiclink-isbn">ISBN 978 0 316 09811 3</a>
11004 ISBN
11005 9780316098113
11006 ISBN 978
11007 0316098113
11008 </p>
11009 !! html/parsoid
11010 <p><a href="./Special:BookSources/9780316098113" rel="mw:WikiLink">ISBN <span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#160;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#0160;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#xA0;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#Xa0;","srcContent":" "}'> </span> 978<span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span>0<span typeof="mw:Entity" data-parsoid='{"src":"&amp;#160;","srcContent":" "}'> </span>316<span typeof="mw:Entity" data-parsoid='{"src":"&amp;#0160;","srcContent":" "}'> </span>09811<span typeof="mw:Entity" data-parsoid='{"src":"&amp;#xA0;","srcContent":" "}'> </span>3</a>
11011 ISBN
11012 9780316098113
11013 ISBN 978
11014 0316098113</p>
11015 !! end
11016
11017 !! test
11018 Magic links: PMID incorrectly converts space to underscore
11019 !! wikitext
11020 PMID 1234
11021 !! html/php
11022 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
11023 </p>
11024 !! html/parsoid
11025 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract" rel="mw:ExtLink">PMID 1234</a></p>
11026 !! end
11027
11028 !! test
11029 Magic links: PMID (T67278)
11030 !! wikitext
11031 This is PMID 1234 but thisPMID 1234 is not PMID 1234linked.
11032 !! html/php
11033 <p>This is <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a> but thisPMID 1234 is not PMID 1234linked.
11034 </p>
11035 !! html/parsoid
11036 <p>This is <a href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract" rel="mw:ExtLink">PMID 1234</a> but thisPMID 1234 is not PMID 1234linked.</p>
11037 !! end
11038
11039 !! test
11040 Magic links: PMID (w/ non-newline whitespace, T30950/T31025)
11041 !! wikitext
11042 PMID &nbsp;&#160;&#0160;&#xA0;&#Xa0; 1234
11043 PMID
11044 1234
11045 !! html/php
11046 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
11047 PMID
11048 1234
11049 </p>
11050 !! html/parsoid
11051 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract" rel="mw:ExtLink">PMID <span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#160;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#0160;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#xA0;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#Xa0;","srcContent":" "}'> </span> 1234</a>
11052 PMID
11053 1234</p>
11054 !! end
11055
11056 # <nowiki> nodes shouldn't be inserted during html2wt by Parsoid,
11057 # since these are ExtLinkText, not MagicLinkText
11058 !! test
11059 Magic links: use appropriate serialization for "almost" magic links.
11060 !! wikitext
11061 X[[Special:BookSources/0978739256|foo]]
11062
11063 X[//tools.ietf.org/html/rfc1234 foo]
11064 !! html/php
11065 <p>X<a href="/wiki/Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a>
11066 </p><p>X<a rel="nofollow" class="external text" href="//tools.ietf.org/html/rfc1234">foo</a>
11067 </p>
11068 !! html/parsoid
11069 <p>X<a rel="mw:WikiLink" href="./Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a></p>
11070 <p>X<a rel="mw:ExtLink" href="//tools.ietf.org/html/rfc1234">foo</a></p>
11071 !! end
11072
11073 !! test
11074 Magic links: All disabled (T47942)
11075 !! options
11076 wgEnableMagicLinks={"ISBN":false, "PMID":false, "RFC":false}
11077 !! wikitext
11078 ISBN 0-306-40615-2
11079 PMID 1234
11080 RFC 4321
11081 !! html/php
11082 <p>ISBN 0-306-40615-2
11083 PMID 1234
11084 RFC 4321
11085 </p>
11086 !! end
11087
11088 ###
11089 ### Templates
11090 ####
11091
11092 !! test
11093 Nonexistent template
11094 !! wikitext
11095 {{thistemplatedoesnotexist}}
11096 !! html
11097 <p><a href="/index.php?title=Template:Thistemplatedoesnotexist&amp;action=edit&amp;redlink=1" class="new" title="Template:Thistemplatedoesnotexist (page does not exist)">Template:Thistemplatedoesnotexist</a>
11098 </p>
11099 !! end
11100
11101 !! test
11102 Template with invalid target containing tags
11103 !! wikitext
11104 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
11105 !! html
11106 <p>{{a<b>b</b>|foo|a=b|a = b}}
11107 </p>
11108 !! end
11109
11110 !! test
11111 Template with invalid target containing unclosed tag
11112 !! wikitext
11113 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
11114 !! html
11115 <p>{{a<b>|foo|a=b|a = b}}</b>
11116 </p>
11117 !! end
11118
11119 !! test
11120 Template with invalid target containing wikilink
11121 !! wikitext
11122 {{[[Main Page]]}}
11123 !! html/php
11124 <p>{{<a href="/wiki/Main_Page" title="Main Page">Main Page</a>}}
11125 </p>
11126 !! html/parsoid
11127 <p><span typeof="mw:Transclusion" about="#mwt1" data-mw='{"parts":[{"template":{"target":{"wt":"[[Main Page]]"},"params":{},"i":0}}]}'>{{</span><a rel="mw:WikiLink" href="./Main_Page" about="#mwt1">Main Page</a><span about="#mwt1">}}</span></p>
11128 !! end
11129
11130 !! test
11131 Template with just whitespace in it, T70421
11132 !! wikitext
11133 {{echo|{{ }}}}
11134 !! html/parsoid
11135 <p about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"{{ }}"}},"i":0}}]}'>{{ }}</p>
11136 !! end
11137
11138 !! article
11139 Template:test
11140 !! text
11141 This is a test template
11142 !! endarticle
11143
11144 !! test
11145 Simple template
11146 !! wikitext
11147 {{test}}
11148 !! html
11149 <p>This is a test template
11150 </p>
11151 !! end
11152
11153 !! test
11154 Template with explicit namespace
11155 !! wikitext
11156 {{Template:test}}
11157 !! html
11158 <p>This is a test template
11159 </p>
11160 !! end
11161
11162
11163 !! article
11164 Template:paramtest
11165 !! text
11166 This is a test template with parameter {{{param}}}
11167 !! endarticle
11168
11169 !! test
11170 Template parameter
11171 !! wikitext
11172 {{paramtest|param=foo}}
11173 !! html
11174 <p>This is a test template with parameter foo
11175 </p>
11176 !! end
11177
11178 !! article
11179 Template:paramtestnum
11180 !! text
11181 [[{{{1}}}|{{{2}}}]]
11182 !! endarticle
11183
11184 !! test
11185 Template unnamed parameter
11186 !! wikitext
11187 {{paramtestnum|Main Page|the main page}}
11188 !! html
11189 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
11190 </p>
11191 !! end
11192
11193 !! article
11194 Template:templatesimple
11195 !! text
11196 (test)
11197 !! endarticle
11198
11199 !! article
11200 Template:templateredirect
11201 !! text
11202 #redirect [[Template:templatesimple]]
11203 !! endarticle
11204
11205 !! article
11206 Template:templateasargtestnum
11207 !! text
11208 {{{{{1}}}}}
11209 !! endarticle
11210
11211 !! article
11212 Template:templateasargtest
11213 !! text
11214 {{template{{{templ}}}}}
11215 !! endarticle
11216
11217 !! article
11218 Template:templateasargtest2
11219 !! text
11220 {{{{{templ}}}}}
11221 !! endarticle
11222
11223 !! test
11224 Template with template name as unnamed argument
11225 !! wikitext
11226 {{templateasargtestnum|templatesimple}}
11227 !! html
11228 <p>(test)
11229 </p>
11230 !! end
11231
11232 !! test
11233 Template with template name as argument
11234 !! wikitext
11235 {{templateasargtest|templ=simple}}
11236 !! html
11237 <p>(test)
11238 </p>
11239 !! end
11240
11241 !! test
11242 Template with template name as argument (2)
11243 !! wikitext
11244 {{templateasargtest2|templ=templatesimple}}
11245 !! html
11246 <p>(test)
11247 </p>
11248 !! end
11249
11250 !! article
11251 Template:templateasargtestdefault
11252 !! text
11253 {{{{{templ|templatesimple}}}}}
11254 !! endarticle
11255
11256 !! article
11257 Template:templa
11258 !! text
11259 '''templ'''
11260 !! endarticle
11261
11262 !! test
11263 Template with default value
11264 !! wikitext
11265 {{templateasargtestdefault}}
11266 !! html
11267 <p>(test)
11268 </p>
11269 !! end
11270
11271 !! test
11272 Template with default value (value set)
11273 !! wikitext
11274 {{templateasargtestdefault|templ=templa}}
11275 !! html
11276 <p><b>templ</b>
11277 </p>
11278 !! end
11279
11280 !! test
11281 Template redirect
11282 !! wikitext
11283 {{templateredirect}}
11284 !! html/php
11285 <p>(test)
11286 </p>
11287 !! html/parsoid
11288 <link rel="mw:PageProp/redirect" href="./Template:Templatesimple" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"templateredirect","href":"./Template:Templateredirect"},"params":{},"i":0}}]}'/>
11289 !! end
11290
11291 !! test
11292 Template with argument in separate line
11293 !! wikitext
11294 {{ templateasargtest |
11295 templ = simple }}
11296 !! html
11297 <p>(test)
11298 </p>
11299 !! end
11300
11301 !! test
11302 Template with complex template as argument
11303 !! wikitext
11304 {{paramtest|
11305 param ={{ templateasargtest |
11306 templ = simple }}}}
11307 !! html
11308 <p>This is a test template with parameter (test)
11309 </p>
11310 !! end
11311
11312 !! test
11313 Templates with templated name
11314 !! wikitext
11315 {{{{echo|echo}}|foo}}
11316 {{{{echo|inner list}} }}
11317 !! html
11318 <p>foo
11319 </p>
11320 <ul><li> item 1</li></ul>
11321
11322 !! html/parsoid
11323 <p about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"{{echo|echo}}","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
11324 <ul about="#mwt4" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"{{echo|inner list}} ","href":"./Template:Inner_list"},"params":{},"i":0}}]}'><li> item 1</li></ul>
11325 !! end
11326
11327 # Parsoid markup is deliberate "broken". This is an edge case.
11328 # See long comment in TemplateHandler.js:convertAttribsToString.
11329 !! test
11330 Templates with invalid templated targets
11331 !! wikitext
11332 {{echo
11333 {{echo|foo}}
11334 }}
11335 !! html/php
11336 <p>{{echo
11337 foo
11338 }}
11339 </p>
11340 !! html/parsoid
11341 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo\n{{echo|foo}}\n"},"params":{},"i":0}}]}'>{{echo
11342 foo }}</p>
11343 !! end
11344
11345 !! test
11346 Template with thumb image (with link in description)
11347 !! wikitext
11348 {{paramtest|param=[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
11349 !! html/php
11350 This is a test template with parameter <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/index.php?title=Special:Upload&amp;wpDestFile=Noimage.png" class="new" title="File:Noimage.png">File:Noimage.png</a> <div class="thumbcaption"><a href="/index.php?title=No_link&amp;action=edit&amp;redlink=1" class="new" title="No link (page does not exist)">link</a> <a href="/index.php?title=No_link&amp;action=edit&amp;redlink=1" class="new" title="No link (page does not exist)">caption</a></div></div></div>
11351
11352 !! html+tidy
11353 <p>This is a test template with parameter</p>
11354 <div class="thumb tright">
11355 <div class="thumbinner" style="width:182px;"><a href="/index.php?title=Special:Upload&amp;wpDestFile=Noimage.png" class="new" title="File:Noimage.png">File:Noimage.png</a>
11356 <div class="thumbcaption"><a href="/index.php?title=No_link&amp;action=edit&amp;redlink=1" class="new" title="No link (page does not exist)">link</a> <a href="/index.php?title=No_link&amp;action=edit&amp;redlink=1" class="new" title="No link (page does not exist)">caption</a></div>
11357 </div>
11358 </div>
11359 !! html/parsoid
11360 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"paramtest","href":"./Template:Paramtest"},"params":{"param":{"wt":"[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]"}},"i":0}}]}'>This is a test template with parameter </p><figure class="mw-default-size" typeof="mw:Error mw:Image/Thumb" about="#mwt1" data-mw='{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}]}'><a href="./File:Noimage.png" ><img resource="./File:Noimage.png" src="./Special:FilePath/Noimage.png" height="220" width="220"/></a><figcaption><a rel="mw:WikiLink" href="./No_link" title="No link">link</a> <a rel="mw:WikiLink" href="./No_link" title="No link">caption</a></figcaption></figure>
11361 !! end
11362
11363 !! article
11364 Template:complextemplate
11365 !! text
11366 {{{1}}} {{paramtest|
11367 param ={{{param}}}}}
11368 !! endarticle
11369
11370 !! test
11371 Template with complex arguments
11372 !! wikitext
11373 {{complextemplate|
11374 param ={{ templateasargtest |
11375 templ = simple }}|[[Template:complextemplate|link]]}}
11376 !! html
11377 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
11378 </p>
11379 !! end
11380
11381 !! test
11382 T2553: link with two variables in a piped link
11383 !! wikitext
11384 {|
11385 |[[{{{1}}}|{{{2}}}]]
11386 |}
11387 !! html/php
11388 <table>
11389 <tr>
11390 <td>[[{{{1}}}|{{{2}}}]]
11391 </td></tr></table>
11392
11393 !! html/parsoid
11394 <table>
11395 <tbody><tr><td>[[<span about="#mwt5" typeof="mw:Param" data-mw='{"parts":[{"templatearg":{"target":{"wt":"1"},"params":{},"i":0}}]}'>{{{1}}}</span>|<span about="#mwt2" typeof="mw:Param" data-mw='{"parts":[{"templatearg":{"target":{"wt":"2"},"params":{},"i":0}}]}'>{{{2}}}</span>]]</td></tr>
11396 </tbody></table>
11397 !! end
11398
11399 # See: T2553
11400 !! test
11401 Abort table cell attribute parsing on wikilink
11402 !! wikitext
11403 {|
11404 | testing [[one|two]] | three || four
11405 | testing one two | three || four
11406 | testing="[[one|two]]" | three || four
11407 |}
11408 !! html/php
11409 <table>
11410 <tr>
11411 <td> testing <a href="/index.php?title=One&amp;action=edit&amp;redlink=1" class="new" title="One (page does not exist)">two</a> | three </td>
11412 <td> four
11413 </td>
11414 <td> three </td>
11415 <td> four
11416 </td>
11417 <td> testing="<a href="/index.php?title=One&amp;action=edit&amp;redlink=1" class="new" title="One (page does not exist)">two</a>" | three </td>
11418 <td> four
11419 </td></tr></table>
11420
11421 !! html/parsoid
11422 <table>
11423 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'> testing <a rel="mw:WikiLink" href="./One" title="One" data-parsoid='{"stx":"piped","a":{"href":"./One"},"sa":{"href":"one"}}'>two</a> | three </td><td data-parsoid='{"stx_v":"row","autoInsertedEnd":true}'> four</td>
11424 <td data-parsoid='{"a":{"testing":null,"one":null,"two":null},"sa":{"testing":"","one":"","two":""},"autoInsertedEnd":true}'> three </td><td data-parsoid='{"stx_v":"row","autoInsertedEnd":true}'> four</td>
11425 <td> testing="<a rel="mw:WikiLink" href="./One" title="One" data-parsoid='{"stx":"piped","a":{"href":"./One"},"sa":{"href":"one"}}'>two</a>" | three </td><td data-parsoid='{"stx_v":"row","autoInsertedEnd":true}'> four</td></tr>
11426 </tbody></table>
11427 !! end
11428
11429 !! test
11430 Don't abort table cell attribute parsing if wikilink is found in template arg
11431 !! wikitext
11432 {|
11433 | Test {{#tag:ref|One two "[[three]]" four}}
11434 |}
11435 !! html/parsoid
11436 <table>
11437 <tbody><tr><td> Test <ref about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"#tag:ref","function":"tag"},"params":{"1":{"wt":"One two \"[[three]]\" four"}},"i":0}}]}'>One two "<a rel="mw:WikiLink" href="./Three" title="Three">three</a>" four</ref></td></tr>
11438 </tbody></table>
11439 !! end
11440
11441 !! test
11442 Magic variable as template parameter
11443 !! wikitext
11444 {{paramtest|param={{SITENAME}}}}
11445 !! html
11446 <p>This is a test template with parameter MediaWiki
11447 </p>
11448 !! end
11449
11450 !! article
11451 Template:linktest
11452 !! text
11453 [[{{{param}}}|link]]
11454 !! endarticle
11455
11456 !! test
11457 Template parameter as link source
11458 !! wikitext
11459 {{linktest|param=Main Page}}
11460 !! html
11461 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
11462 </p>
11463 !! end
11464
11465 !!article
11466 Template:paramtest2
11467 !! text
11468 including another template, {{paramtest|param={{{arg}}}}}
11469 !! endarticle
11470
11471 !! test
11472 Template passing argument to another template
11473 !! wikitext
11474 {{paramtest2|arg='hmm'}}
11475 !! html
11476 <p>including another template, This is a test template with parameter 'hmm'
11477 </p>
11478 !! end
11479
11480 !! article
11481 Template:Linktest2
11482 !! text
11483 Main Page
11484 !! endarticle
11485
11486 !! test
11487 Template as link source
11488 !! wikitext
11489 [[{{linktest2}}]]
11490
11491 [[{{linktest2}}|Main Page]]
11492
11493 [[{{linktest2}}]]Page
11494 !! html
11495 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
11496 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
11497 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
11498 </p>
11499 !! end
11500
11501
11502 !! article
11503 Template:loop1
11504 !! text
11505 {{loop2}}
11506 !! endarticle
11507
11508 !! article
11509 Template:loop2
11510 !! text
11511 {{loop1}}
11512 !! endarticle
11513
11514 !! test
11515 Template infinite loop
11516 !! wikitext
11517 {{loop1}}
11518 !! html
11519 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
11520 </p>
11521 !! end
11522
11523 !! test
11524 Template from main namespace
11525 !! wikitext
11526 {{:Main Page}}
11527 !! html
11528 <p>blah blah
11529 </p>
11530 !! end
11531
11532 !! article
11533 Template:table
11534 !! text
11535 {|
11536 | 1 || 2
11537 |-
11538 | 3 || 4
11539 |}
11540 !! endarticle
11541
11542 !! test
11543 T2529: Template with table, not included at beginning of line
11544 !! wikitext
11545 foo {{table}}
11546 !! html
11547 <p>foo
11548 </p>
11549 <table>
11550 <tr>
11551 <td> 1 </td>
11552 <td> 2
11553 </td></tr>
11554 <tr>
11555 <td> 3 </td>
11556 <td> 4
11557 </td></tr></table>
11558
11559 !! end
11560
11561 !! test
11562 T2523: Template shouldn't eat newline (or add an extra one before table)
11563 !! wikitext
11564 foo
11565 {{table}}
11566 !! html
11567 <p>foo
11568 </p>
11569 <table>
11570 <tr>
11571 <td> 1 </td>
11572 <td> 2
11573 </td></tr>
11574 <tr>
11575 <td> 3 </td>
11576 <td> 4
11577 </td></tr></table>
11578
11579 !! end
11580
11581 !! test
11582 T2041: Template parameters shown as broken links
11583 !! wikitext
11584 {{{parameter}}}
11585 !! html
11586 <p>{{{parameter}}}
11587 </p>
11588 !! end
11589
11590 !! test
11591 Template with targets containing wikilinks
11592 !! options
11593 parsoid=wt2html
11594 !! wikitext
11595 {{[[foo]]}}
11596
11597 {{[[{{echo|foo}}]]}}
11598
11599 {{{{echo|[[foo}}]]}}
11600 !! html/php
11601 <p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
11602 </p><p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
11603 </p><p>{{[[foo}}]]
11604 </p>
11605 !! html/parsoid
11606 <p>{{<a rel="mw:WikiLink" href="./Foo" title="Foo">foo</a>}}</p>
11607 <p>{{<a typeof="mw:ExpandedAttrs" rel="mw:WikiLink" href="./Foo" title="Foo" data-mw='{"attribs":[[{"txt":"href"},{"html":"&lt;span about=\"#mwt3\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[17,29,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"foo\"}},\"i\":0}}]}&#39;>foo&lt;/span>"}]]}'>foo</a>}}</p>
11608 <p>{{<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[foo}}]]"}},"i":0}}]}'>[[foo}}]]</span></p>
11609 !! end
11610
11611 !! article
11612 Template:''
11613 !! text
11614 bar
11615 !! endarticle
11616
11617 !! test
11618 Templates: Double quotes as template target
11619 !! wikitext
11620 foo {{''}} baz
11621 !! html/php
11622 <p>foo bar baz
11623 </p>
11624 !! html/parsoid
11625 <p>foo <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"&#39;&#39;","href":"./Template:&#39;&#39;"},"params":{},"i":0}}]}'>bar</span> baz
11626 </p>
11627 !! end
11628
11629 ## This test is about making sure Parsoid's data-mw is well formed in the
11630 ## face of multiple templates with intersecting and overlapping ranges. The
11631 ## wikitext itself is wretched.
11632 !! test
11633 Templates with intersecting and overlapping ranges
11634 !! wikitext
11635 {|{{echo|
11636 <p>ha</p>}}
11637 {|{{echo|
11638 <p>ho</p>}}
11639 {{echo|{{!}}hi}}
11640 |}
11641 !! html/php+tidy
11642 <p>ha</p>
11643 <p>ho</p>
11644 <table>
11645 <tr>
11646 <td></td>
11647 </tr>
11648 <tr>
11649 <td>hi</td>
11650 </tr>
11651 </table>
11652 <table>
11653 <tr>
11654 <td></td>
11655 </tr>
11656 </table>
11657 !! html/parsoid
11658 <p about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"stx":"html","autoInsertedEnd":true,"pi":[[{"k":"1"}],[{"k":"1"}],[{"k":"1"}]],"firstWikitextNode":"table"}' data-mw='{"parts":["{|",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"\n&lt;p>ha&lt;/p>"}},"i":0}},"\n","{|",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"\n&lt;p>ho&lt;/p>"}},"i":1}},"\n",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"{{!}}hi"}},"i":2}},"\n|}"]}'>ha</p><table about="#mwt1" typeof="mw:ExpandedAttrs" data-mw='{"attribs":[[{"txt":"","html":""},{"html":""}]]}'>
11659
11660 </table><p about="#mwt1">ho</p><table about="#mwt1" typeof="mw:ExpandedAttrs" data-mw='{"attribs":[[{"txt":"","html":""},{"html":""}]]}'>
11661
11662 <tbody><tr><td>hi</td></tr>
11663 </tbody></table>
11664 !! end
11665
11666 !! article
11667 Template:MSGNW test
11668 !! text
11669 ''None'' of '''this''' should be
11670 * interpreted
11671 but rather passed unmodified
11672 {{test}}
11673 <gallery>
11674 File:Foobar.jpg
11675 </gallery>
11676 <!-- comment -->
11677 !! endarticle
11678
11679 # hmm, fix this or just deprecate msgnw and document its behavior?
11680 !! test
11681 msgnw keyword
11682 !! wikitext
11683 {{msgnw:MSGNW test}}
11684 !! html/php
11685 <p>&#39;&#39;None&#39;&#39; of &#39;&#39;&#39;this&#39;&#39;&#39; should be
11686 &#42; interpreted
11687 &#32;but rather passed unmodified
11688 &#123;&#123;test&#125;&#125;
11689 &#60;gallery&#62;
11690 File:Foobar.jpg
11691 &#60;/gallery&#62;
11692 &#60;!-- comment --&#62;
11693 </p>
11694 !! end
11695
11696 !! test
11697 int keyword
11698 !! wikitext
11699 {{int:youhavenewmessages|lots of money|not!}}
11700 !! html
11701 <p>You have lots of money (not!).
11702 </p>
11703 !! end
11704
11705 !! test
11706 int keyword - non-existing message
11707 !! wikitext
11708 {{int:var}}
11709 !! html
11710 <p>⧼var⧽
11711 </p>
11712 !! end
11713
11714 !! article
11715 Template:Includes
11716 !! text
11717 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
11718 !! endarticle
11719
11720 !! test
11721 <includeonly> and <noinclude> being included
11722 !! wikitext
11723 {{Includes}}
11724 !! html
11725 <p>Foobar
11726 </p>
11727 !! end
11728
11729 !! article
11730 Template:Includes2
11731 !! text
11732 <onlyinclude>Foo</onlyinclude>bar
11733 !! endarticle
11734
11735 !! test
11736 <onlyinclude> being included
11737 !! wikitext
11738 {{Includes2}}
11739 !! html
11740 <p>Foo
11741 </p>
11742 !! end
11743
11744
11745 !! article
11746 Template:Includes3
11747 !! text
11748 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
11749 !! endarticle
11750
11751 !! test
11752 <onlyinclude> and <includeonly> being included
11753 !! wikitext
11754 {{Includes3}}
11755 !! html
11756 <p>Foo
11757 </p>
11758 !! end
11759
11760 !! test
11761 <includeonly> and <noinclude> on a page
11762 !! wikitext
11763 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
11764 !! html
11765 <p>Foozar
11766 </p>
11767 !! end
11768
11769 !! test
11770 Un-closed <noinclude>
11771 !! wikitext
11772 <noinclude>
11773 !! html
11774 !! end
11775
11776 !! test
11777 <onlyinclude> on a page
11778 !! wikitext
11779 <onlyinclude>Foo</onlyinclude>bar
11780 !! html
11781 <p>Foobar
11782 </p>
11783 !! end
11784
11785 !! test
11786 Un-closed <onlyinclude>
11787 !! wikitext
11788 <onlyinclude>
11789 !! html
11790 !! end
11791
11792 !!test
11793 Self-closed noinclude, includeonly, onlyinclude tags
11794 !! wikitext
11795 <noinclude />
11796 <includeonly />
11797 <onlyinclude />
11798 !! html
11799 <p><br />
11800 </p>
11801 !!end
11802
11803 !!test
11804 Unbalanced includeonly and noinclude tags
11805 !! wikitext
11806 {|
11807 |a</noinclude>
11808 |b</noinclude></noinclude>
11809 |c</noinclude></includeonly>
11810 |d</includeonly></includeonly>
11811 |}
11812 !! html
11813 <table>
11814 <tr>
11815 <td>a
11816 </td>
11817 <td>b
11818 </td>
11819 <td>c&lt;/includeonly&gt;
11820 </td>
11821 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
11822 </td></tr></table>
11823
11824 !!end
11825
11826 !! article
11827 Template:Includeonly section
11828 !! text
11829 <includeonly>
11830 ==Includeonly section==
11831 </includeonly>
11832 ==Section T-1==
11833 !!endarticle
11834
11835 !! test
11836 T8563: Edit link generation for section shown by <includeonly>
11837 !! wikitext
11838 {{includeonly section}}
11839 !! html
11840 <h2><span class="mw-headline" id="Includeonly_section">Includeonly section</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Template:Includeonly_section&amp;action=edit&amp;section=T-1" title="Template:Includeonly section">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
11841 <h2><span class="mw-headline" id="Section_T-1">Section T-1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Template:Includeonly_section&amp;action=edit&amp;section=T-2" title="Template:Includeonly section">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
11842
11843 !! end
11844
11845 # Uses same input as the contents of [[Template:Includeonly section]]
11846 !! test
11847 T8563: Section extraction for section shown by <includeonly>
11848 !! options
11849 section=T-2
11850 !! wikitext
11851 <includeonly>
11852 ==Includeonly section==
11853 </includeonly>
11854 ==Section T-2==
11855 !! html
11856 ==Section T-2==
11857 !! end
11858
11859 !! test
11860 T8563: Edit link generation for section suppressed by <includeonly>
11861 !! wikitext
11862 <includeonly>
11863 ==Includeonly section==
11864 </includeonly>
11865 ==Section 1==
11866 !! html
11867 <h2><span class="mw-headline" id="Section_1">Section 1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Section 1">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
11868
11869 !! end
11870
11871 !! test
11872 T8563: Section extraction for section suppressed by <includeonly>
11873 !! options
11874 section=1
11875 !! wikitext
11876 <includeonly>
11877 ==Includeonly section==
11878 </includeonly>
11879 ==Section 1==
11880 !! html
11881 ==Section 1==
11882 !! end
11883
11884 !! test
11885 Un-closed <includeonly>
11886 !! wikitext
11887 <includeonly>
11888 !! html/php
11889 !! html/parsoid
11890 <meta typeof="mw:Includes/IncludeOnly" data-parsoid='{"src":"&lt;includeonly>"}'/>
11891 !! end
11892
11893 ## We used to, but no longer wt2wt this test since the default serializer
11894 ## will normalize the include directives to serialize on their own line.
11895 ## Selser will take care of preserving formatting in scenarios where they
11896 ## intermingled with other wikitext.
11897 !! test
11898 Includes and comments at SOL
11899 !! options
11900 parsoid=wt2html,html2html
11901 !! wikitext
11902 <!-- comment --><noinclude><!-- comment --></noinclude><!-- comment -->== hu ==
11903
11904 <noinclude>
11905 some
11906 </noinclude>* stuff
11907 * here
11908
11909 <includeonly>can have stuff</includeonly>=== here ===
11910
11911 !! html/php
11912 <h2><span class="mw-headline" id="hu">hu</span></h2>
11913 <p>some
11914 </p>
11915 <ul><li> stuff</li>
11916 <li> here</li></ul>
11917 <h3><span class="mw-headline" id="here">here</span></h3>
11918
11919 !! html/parsoid
11920 <!-- comment --><meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/><!-- comment --><meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"&lt;/noinclude>"}'/><!-- comment --><h2> hu </h2>
11921
11922 <meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/>
11923 <p>some</p>
11924 <meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"&lt;/noinclude>"}'/><ul><li> stuff</li>
11925 <li> here</li></ul>
11926
11927 <meta typeof="mw:Includes/IncludeOnly" data-parsoid='{"src":"&lt;includeonly>can have stuff&lt;/includeonly>"}'/><meta typeof="mw:Includes/IncludeOnly/End" data-parsoid='{"src":""}'/><h3> here </h3>
11928
11929 !! end
11930
11931 # TODO: test with DOM fragment reuse!
11932 !! test
11933 Parsoid: DOM fragment reuse
11934 !! options
11935 parsoid=wt2wt,wt2html
11936 !! wikitext
11937 a{{echo|b<table></table>c}}d
11938
11939 a{{echo|b
11940 <table></table>
11941 c}}d
11942
11943 {{echo|a
11944
11945 <table></table>
11946
11947 b}}
11948 !! html
11949 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":["a",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"b&lt;table>&lt;/table>c"}},"i":0}},"d"]}' data-parsoid='{"pi":[[{"k":"1"}]]}'>ab</p><table about="#mwt1" data-parsoid='{"stx":"html"}'></table><p about="#mwt1">cd</p>
11950
11951 <p about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":["a",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"b\n&lt;table>&lt;/table>\nc"}},"i":0}},"d"]}' data-parsoid='{"pi":[[{"k":"1"}]]}'>ab</p><span about="#mwt2">
11952 </span><table about="#mwt2" data-parsoid='{"stx":"html"}'></table><span about="#mwt2">
11953 </span><p about="#mwt2">cd</p>
11954
11955 <p about="#mwt3" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\n\n&lt;table>&lt;/table>\n\nb"}},"i":0}}]}' data-parsoid='{"pi":[[{"k":"1"}]]}'>a</p><span about="#mwt3">
11956
11957 </span><table about="#mwt3" data-parsoid='{"stx":"html"}'></table><span about="#mwt3">
11958
11959 </span><p about="#mwt3">b</p>
11960 !! end
11961
11962 !! test
11963 Parsoid: Merge double tds (T52603)
11964 !! options
11965 parsoid
11966 !! wikitext
11967 {|
11968 |{{echo|{{!}} foo}}
11969 |}
11970 !! html
11971 <table><tbody>
11972 <tr><td about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":["|",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"{{!}} foo"}},"i":0}}]}'> foo</td></tr>
11973 </tbody></table>
11974 !! end
11975
11976 !! test
11977 Parsoid: Merge double tds in nested transclusion content (T52603)
11978 !! options
11979 parsoid
11980 !! wikitext
11981 {{echo|<div>}}
11982 {|
11983 |{{echo|{{!}} foo}}
11984 |}
11985 {{echo|</div>}}
11986 !! html
11987 <div about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<div>"}},"i":0}},"\n{|\n|",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"{{!}} foo"}},"i":1}},"\n|}\n",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"</div>"}},"i":2}}]}'>
11988 <table><tbody>
11989 <tr><td data-mw='{"parts":["|"]}'> foo</td></tr>
11990 </tbody></table>
11991 </div>
11992 !! end
11993
11994 ###
11995 ### <includeonly> and <noinclude> in attributes
11996 ###
11997 !!test
11998 0. includeonly around the entire attribute
11999 !! wikitext
12000 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
12001 !! html
12002 <p><span id="v2">bar</span>
12003 </p>
12004 !!end
12005
12006 !!test
12007 1. includeonly in html attr key
12008 !! wikitext
12009 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
12010 !! html
12011 <p><span id="foo">bar</span>
12012 </p>
12013 !!end
12014
12015 !!test
12016 2. includeonly in html attr value
12017 !! wikitext
12018 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
12019 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
12020 !! html
12021 <p><span id="v1">bar</span>
12022 <span id="v1">bar</span>
12023 </p>
12024 !!end
12025
12026 !!test
12027 3. includeonly in part of an attr value
12028 !! wikitext
12029 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
12030 !! html
12031 <p><span style="color:red;">bar</span>
12032 </p>
12033 !!end
12034
12035 !!test
12036 4. includeonly in table attributes
12037 !! wikitext
12038 {|
12039 |- <noinclude>
12040 |-
12041 |a
12042 </noinclude>
12043 |- <includeonly>
12044 |-
12045 |b
12046 </includeonly>
12047 |}
12048 !! html
12049 <table>
12050
12051
12052 <tr>
12053 <td>a
12054 </td></tr>
12055 </table>
12056
12057 !!end
12058
12059 ###
12060 ### Preprocessor precedence tests
12061 ### See: https://www.mediawiki.org/wiki/Preprocessor_ABNF
12062 ###
12063 ##{{[[-{{{{{{[[Foo|bar}}]]}-}}}}}]]
12064 !! test
12065 Preprocessor precedence 1: link is rightmost opening
12066 !! options
12067 parsoid=wt2html
12068 !! wikitext
12069 {{[[Foo|bar}}]]
12070
12071 But close-brace is not a valid character in a link title:
12072 {{[[Foo}}|bar]]
12073
12074 However, we can still tell this was handled as a link in the preprocessor:
12075 {{echo|[[Foo}}|bar]]|bat}}
12076 !! html/php
12077 <p>{{<a href="/wiki/Foo" title="Foo">bar}}</a>
12078 </p><p>But close-brace is not a valid character in a link title:
12079 {{[[Foo}}|bar]]
12080 </p><p>However, we can still tell this was handled as a link in the preprocessor:
12081 [[Foo}}|bar]]
12082 </p>
12083 !! html/parsoid
12084 <p>{{<a rel="mw:WikiLink" href="./Foo" title="Foo">bar}}</a></p>
12085 <p>But close-brace is not a valid character in a link title: {{[[Foo}}|bar]]</p>
12086 <p>However, we can still tell this was handled as a link in the preprocessor: <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[Foo}}|bar]]"},"2":{"wt":"bat"}},"i":0}}]}'>[[Foo}}|bar]]</span></p>
12087 !! end
12088
12089 !! test
12090 Preprocessor precedence 2: template is rightmost opening
12091 !! options
12092 language=zh
12093 !! wikitext
12094 -{{echo|foo}-}}-
12095 !! html/php
12096 <p>-foo}--
12097 </p>
12098 !! html/parsoid
12099 <p>-<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo}-"}},"i":0}}]}'>foo}-</span>-</p>
12100 !! end
12101
12102 !! test
12103 Preprocessor precedence 3: language converter is rightmost opening
12104 !! options
12105 language=zh
12106 parsoid=wt2html
12107 !! wikitext
12108 {{echo|hi}}
12109
12110 {{-{R|echo|hi}}}-
12111
12112 [[-{R|raw]]}-
12113 !! html/php
12114 <p>hi
12115 </p><p>{{echo|hi}}
12116 </p><p>[[raw]]
12117 </p>
12118 !! html/parsoid
12119 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"hi"}},"i":0}}]}'>hi</p>
12120 <p>{{<span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"echo|hi}}"}}'></span></p>
12121 <p>[[<span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"raw]]"}}'></span></p>
12122 !! end
12123
12124 !! test
12125 Preprocessor precedence 4: left-most angle bracket
12126 !! options
12127 language=zh
12128 !! wikitext
12129 <!--{raw}-->
12130 !! html/php
12131 !! html/parsoid
12132 <!--{raw}-->
12133 !! end
12134
12135 !! article
12136 Template:Precedence5
12137 !! text
12138 {{{{{1}}}}}
12139 !! endarticle
12140
12141 !! test
12142 Preprocessor precedence 5: tplarg takes precedence over template
12143 !! wikitext
12144 {{Precedence5|Bullet}}
12145 !! html/php
12146 <ul><li> Bar</li></ul>
12147
12148 !! html/parsoid
12149 <ul typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"Precedence5","href":"./Template:Precedence5"},"params":{"1":{"wt":"Bullet"}},"i":0}}]}'><li> Bar</li></ul>
12150 !! end
12151
12152 !! test
12153 Preprocessor precedence 6: broken link is rightmost opening
12154 !! options
12155 parsoid=wt2html
12156 !! wikitext
12157 {{echo|[[Foo}}
12158
12159 {{echo|[[Foo|bar|bat=baz}}
12160 !! html/php
12161 <p>{{echo|[[Foo}}
12162 </p><p>{{echo|[[Foo|bar|bat=baz}}
12163 </p>
12164 !! html/parsoid
12165 <p>{{echo|[[Foo}}</p>
12166 <p>{{echo|[[Foo|bar|bat=baz}}</p>
12167 !! end
12168
12169 # This next test exposes a difference between PHP and Parsoid:
12170 # Given [[Foo|{{echo|Bar]]x}}y]]z:
12171 # 1) Both PHP and Parsoid ignore the `]]` inside the `echo` in the
12172 # "preprocessor" stage. The `{{echo` extends until the `x}}`, and the
12173 # outer `[[Foo` extends until the `y]]`
12174 # 2a) But then the PHP preprocessor emits `[[Foo|Bar]]xy]]z` as an
12175 # intermediate result (after template expansion), and link processing
12176 # happens on this intermediate result, which moves the wikilink
12177 # boundary leftward to `[[Foo|Bar]]`
12178 # 2b) Parsoid works in a single step, so it's going to keep the
12179 # wikilink as extending to the `y]]`
12180 # 3a) Then PHP does linktrail processing which slurps up the trailing
12181 # `xy` inside the link.
12182 # 3b) Parsoid will do linktrail processing to slurp up the trailing
12183 # `z` inside the link.
12184 # This is "correct" behavior. Parsoid's basic worldview is that the
12185 # `]]` inside the template shouldn't be allowed to leak out to affect
12186 # the surrounding wikilink. PHP may match Parsoid (in the future)
12187 # if you use {{#balance}} (T114445).
12188
12189 !! test
12190 Preprocessor precedence 7: broken template is rightmost opening
12191 !! options
12192 parsoid=wt2html
12193 !! wikitext
12194 [[Foo|{{echo|Bar]]
12195
12196 [[Foo|{{echo|Bar]]-x}}-y]]-z
12197
12198 Careful: linktrails can move the end of the wikilink:
12199 [[Foo|{{echo|y']]a}}l]]l
12200 !! html/php
12201 <p><a href="/wiki/Foo" title="Foo">{{echo|Bar</a>
12202 </p><p><a href="/wiki/Foo" title="Foo">Bar</a>-x-y]]-z
12203 </p><p>Careful: linktrails can move the end of the wikilink:
12204 <a href="/wiki/Foo" title="Foo">y'al</a>]]l
12205 </p>
12206 !! html/parsoid
12207 <p>[[Foo|{{echo|Bar]]</p>
12208 <p><a rel="mw:WikiLink" href="./Foo" title="Foo"><span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Bar]]-x"}},"i":0}}]}'>Bar]]-x</span>-y</a>-z</p>
12209 <p>Careful: linktrails can move the end of the wikilink:
12210 <a rel="mw:WikiLink" href="./Foo" title="Foo"><span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"y&#39;]]a"}},"i":0}}]}'>y']]a</span>ll</a></p>
12211 !! end
12212
12213 !! test
12214 Preprocessor precedence 8: broken language converter is rightmost opening
12215 !! options
12216 language=zh
12217 !! wikitext
12218 [[Foo-{R|raw]]
12219 !! html
12220 <p>[[Foo-{R|raw]]
12221 </p>
12222 !! end
12223
12224 !! article
12225 Template:Preprocessor_precedence_9
12226 !! text
12227 ;4: {{{{1}}}}
12228 ;5: {{{{{2}}}}}
12229 ;6: {{{{{{3}}}}}}
12230 ;7: {{{{{{{4}}}}}}}
12231 !! endarticle
12232
12233 !! test
12234 Preprocessor precedence 9: groups of braces
12235 !! wikitext
12236 {{Preprocessor precedence 9|Four|Bullet|1|2}}
12237 !! html/php
12238 <dl><dt>4</dt>
12239 <dd> {Four}</dd>
12240 <dt>5</dt>
12241 <dd> </dd></dl>
12242 <ul><li> Bar</li></ul>
12243 <dl><dt>6</dt>
12244 <dd> Four</dd>
12245 <dt>7</dt>
12246 <dd> {Bullet}</dd></dl>
12247
12248 !! html/parsoid
12249 <dl about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"Preprocessor precedence 9","href":"./Template:Preprocessor_precedence_9"},"params":{"1":{"wt":"Four"},"2":{"wt":"Bullet"},"3":{"wt":"1"},"4":{"wt":"2"}},"i":0}}]}'>
12250 <dt>4</dt>
12251 <dd>{Four}</dd>
12252 <dt>5</dt>
12253 <dd></dd>
12254 </dl><ul about="#mwt1">
12255 <li>Bar</li>
12256 </ul><span about="#mwt1"> </span><dl about="#mwt1">
12257 <dt>6</dt>
12258 <dd>Four</dd>
12259 <dt>7</dt>
12260 <dd>{Bullet}</dd>
12261 </dl>
12262 !! end
12263
12264 !! article
12265 Template:Preprocessor_precedence_10
12266 !! text
12267 ;1: -{R|raw}-
12268 ;2: -{{Bullet}}-
12269 ;3: -{{{1}}}-
12270 ;4: -{{{{2}}}}-
12271 ;5: -{{{{{3}}}}}-
12272 ;6: -{{{{{{4}}}}}}-
12273 ;7: -{{{{{{{5}}}}}}}-
12274 !! endarticle
12275
12276 !! test
12277 Preprocessor precedence 10: groups of braces with leading dash
12278 !! options
12279 language=zh
12280 !! wikitext
12281 {{Preprocessor precedence 10|Three|raw2|Bullet|1|2}}
12282 !! html/php
12283 <dl><dt>1</dt>
12284 <dd> raw</dd>
12285 <dt>2</dt>
12286 <dd> -</dd></dl>
12287 <ul><li> Bar-</li></ul>
12288 <dl><dt>3</dt>
12289 <dd> -Three-</dd>
12290 <dt>4</dt>
12291 <dd> raw2</dd>
12292 <dt>5</dt>
12293 <dd> -</dd></dl>
12294 <ul><li> Bar-</li></ul>
12295 <dl><dt>6</dt>
12296 <dd> -Three-</dd>
12297 <dt>7</dt>
12298 <dd> raw2</dd></dl>
12299
12300 !! html/parsoid
12301 <dl about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"Preprocessor precedence 10","href":"./Template:Preprocessor_precedence_10"},"params":{"1":{"wt":"Three"},"2":{"wt":"raw2"},"3":{"wt":"Bullet"},"4":{"wt":"1"},"5":{"wt":"2"}},"i":0}}]}'>
12302 <dt>1</dt>
12303 <dd><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"raw"}}'></span></dd>
12304 <dt>2</dt>
12305 <dd>-</dd>
12306 </dl><ul about="#mwt1">
12307 <li>Bar-</li>
12308 </ul><span about="#mwt1"> </span><dl about="#mwt1">
12309 <dt>3</dt>
12310 <dd>-Three-</dd>
12311 <dt>4</dt>
12312 <dd><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"raw2"}}'></span></dd>
12313 <dt>5</dt>
12314 <dd>-</dd>
12315 </dl><ul about="#mwt1">
12316 <li>Bar-</li>
12317 </ul><span about="#mwt1"> </span><dl about="#mwt1">
12318 <dt>6</dt>
12319 <dd>-Three-</dd>
12320 <dt>7</dt>
12321 <dd><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"raw2"}}'></span></dd>
12322 </dl>
12323 !! end
12324
12325 !! test
12326 Preprocessor precedence 11: found during visual diff testing
12327 !! wikitext
12328 {{#tag:span|-{{#tag:span|-{{echo|x}}}}}}
12329
12330 {{echo|-{{echo|-{{echo|x}}}}}}
12331
12332 {{echo|-{{echo|x}}}}
12333 !! html/php
12334 <p><span>-<span>-x</span></span>
12335 </p><p>--x
12336 </p><p>-x
12337 </p>
12338 !! html/parsoid
12339 <p><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"#tag:span","function":"tag"},"params":{"1":{"wt":"-{{#tag:span|-{{echo|x}}}}"}},"i":0}}]}'>-<span>-x</span></span></p>
12340
12341 <p about="#mwt4" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"-{{echo|-{{echo|x}}}}"}},"i":0}}]}'>--x</p>
12342
12343 <p about="#mwt7" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"-{{echo|x}}"}},"i":0}}]}'>-x</p>
12344 !! end
12345
12346 !! test
12347 Preprocessor precedence 12: broken language converter closed by brace.
12348 !! options
12349 parsoid=wt2html
12350 !! wikitext
12351 This form breaks the template, which is unfortunate:
12352 * {{echo|foo-{bar}bat}}
12353
12354 But if the broken language converter markup is inside an extension
12355 tag, nothing bad happens:
12356 * <nowiki>foo-{bar}bat</nowiki>
12357 * {{echo|<nowiki>foo-{bar}bat</nowiki>}}
12358 * <pre>foo-{bar}bat</pre>
12359 * {{echo|<pre>foo-{bar}bat</pre>}}
12360
12361 <tag>foo-{bar}bat</tag>
12362 {{echo|<tag>foo-{bar}bat</tag>}}
12363
12364 !! html/php+tidy
12365 <p>This form breaks the template, which is unfortunate:</p>
12366 <ul>
12367 <li>{{echo|foo-{bar}bat}}</li>
12368 </ul>
12369 <p>But if the broken language converter markup is inside an extension tag, nothing bad happens:</p>
12370 <ul>
12371 <li>foo-{bar}bat</li>
12372 <li>foo-{bar}bat</li>
12373 <li>
12374 <pre>
12375 foo-{bar}bat
12376 </pre></li>
12377 <li>
12378 <pre>
12379 foo-{bar}bat
12380 </pre></li>
12381 </ul>
12382 <pre>
12383 'foo-{bar}bat'
12384 array (
12385 )
12386 </pre>
12387 <pre>
12388 'foo-{bar}bat'
12389 array (
12390 )
12391 </pre>
12392 !! html/parsoid
12393 <p>This form breaks the template, which is unfortunate:</p>
12394 <ul>
12395 <li>{{echo|foo-{bar}bat}}</li>
12396 </ul>
12397 <p>But if the broken language converter markup is inside an extension tag, nothing bad happens:</p>
12398 <ul>
12399 <li><span typeof="mw:Nowiki">foo-{bar}bat</span></li>
12400 <li><span typeof="mw:Transclusion mw:Nowiki" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;nowiki>foo-{bar}bat&lt;/nowiki>"}},"i":0}}]}'>foo-{bar}bat</span></li>
12401 <li><pre typeof="mw:Extension/pre" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"foo-{bar}bat"}}'>foo-{bar}bat</pre></li>
12402 <li><pre typeof="mw:Transclusion mw:Extension/pre" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;pre>foo-{bar}bat&lt;/pre>"}},"i":0}}]}'>foo-{bar}bat</pre></li>
12403 </ul>
12404 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"foo-{bar}bat"}}'></pre> <pre typeof="mw:Extension/tag mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;tag>foo-{bar}bat&lt;/tag>"}},"i":0}}]}'></pre>
12405 !! end
12406
12407 !! test
12408 Preprocessor precedence 13: broken language converter in external link
12409 !! options
12410 parsoid=wt2html
12411 !! wikitext
12412 * [http://example.com/-{foo Example in URL]
12413 * [http://example.com Example in -{link} description]
12414 * {{echo|[http://example.com/-{foo Breaks template, however]}}
12415 !! html/php+tidy
12416 <ul>
12417 <li><a rel="nofollow" class="external text" href="http://example.com/-{foo">Example in URL</a></li>
12418 <li><a rel="nofollow" class="external text" href="http://example.com">Example in -{link} description</a></li>
12419 <li>{{echo|<a rel="nofollow" class="external text" href="http://example.com/-{foo">Breaks template, however</a>}}</li>
12420 </ul>
12421 !! html/parsoid
12422 <ul>
12423 <li><a rel="mw:ExtLink" href="http://example.com/-{foo">Example in URL</a></li>
12424 <li><a rel="mw:ExtLink" href="http://example.com">Example in -{link} description</a></li>
12425 <li>{{echo|<a rel="mw:ExtLink" href="http://example.com/-{foo">Breaks template, however</a>}}</li>
12426 </ul>
12427 !! end
12428
12429 !! test
12430 Preprocessor precedence 14: broken language converter in comment
12431 !! wikitext
12432 * <!--{{foo}}--> ...should be ok
12433 * <!---{{foo}}--> ...extra dashes
12434 * {{echo|foo<!-- -{bar} -->bat}} ...should be ok
12435 !! html/php+tidy
12436 <ul>
12437 <li>...should be ok</li>
12438 <li>...extra dashes</li>
12439 <li>foobat ...should be ok</li>
12440 </ul>
12441 !! html/parsoid
12442 <ul>
12443 <li><!--{{foo}}--> ...should be ok</li>
12444 <li><!--&#x2D;{{foo}}--> ...extra dashes</li>
12445 <li><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo&lt;!-- -{bar} -->bat"}},"i":0}}]}'>foo</span><span about="#mwt1"><!-- &#x2D;{bar} --></span><span about="#mwt1">bat</span> ...should be ok</li>
12446 </ul>
12447 !! end
12448
12449 !! test
12450 Preprocessor precedence 15: broken brace markup in headings
12451 !! options
12452 parsoid=wt2html
12453 !! wikitext
12454 __NOTOC__ __NOEDITSECTION__
12455 ===1 foo[bar 1===
12456 1
12457 ===2 foo[[bar 2===
12458 2
12459 ===3 foo{bar 3===
12460 3
12461 ===4 foo{{bar 4===
12462 4
12463 ===5 foo{{{bar 5===
12464 5
12465 ===6 foo-{bar 6===
12466 6
12467 !! html/php+tidy
12468 <h3><span class="mw-headline" id="1_foo.5Bbar_1">1 foo[bar 1</span></h3>
12469 <p>1</p>
12470 <h3><span class="mw-headline" id="2_foo.5B.5Bbar_2">2 foo[[bar 2</span></h3>
12471 <p>2</p>
12472 <h3><span class="mw-headline" id="3_foo.7Bbar_3">3 foo{bar 3</span></h3>
12473 <p>3</p>
12474 <h3><span class="mw-headline" id="4_foo.7B.7Bbar_4">4 foo{{bar 4</span></h3>
12475 <p>4</p>
12476 <h3><span class="mw-headline" id="5_foo.7B.7B.7Bbar_5">5 foo{{{bar 5</span></h3>
12477 <p>5</p>
12478 <h3><span class="mw-headline" id="6_foo-.7Bbar_6">6 foo-{bar 6</span></h3>
12479 <p>6</p>
12480 !! html/parsoid
12481 <meta property="mw:PageProp/notoc"/> <meta property="mw:PageProp/noeditsection"/
12482 >
12483 <h3>1 foo[bar 1</h3>
12484 <p>1</p>
12485 <h3>2 foo[[bar 2</h3>
12486 <p>2</p>
12487 <h3>3 foo{bar 3</h3>
12488 <p>3</p>
12489 <h3>4 foo{{bar 4</h3>
12490 <p>4</p>
12491 <h3>5 foo{{{bar 5</h3>
12492 <p>5</p>
12493 <h3>6 foo-{bar 6</h3>
12494 <p>6</p>
12495 !! end
12496
12497 !! test
12498 Preprocessor precedence 16: matching closing braces to opening braces
12499 !! options
12500 language=zh
12501 parsoid=wt2html
12502 !! wikitext
12503 -{{{echo|foo}}bar}-
12504 !! html/php
12505 <p>foobar
12506 </p>
12507 !! html/parsoid
12508 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[2,14,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"foo\"}},\"i\":0}}]}&#39;>foo&lt;/span>bar"}}'></span></p>
12509 !! end
12510
12511 ###
12512 ### Token Stream Patcher tests
12513 ###
12514 ### These tests won't always pass wt2wt and other modes because
12515 ### on serialization, the table will be output on a new line.
12516 ### For now, we are blacklisting them, and using this to test selser.
12517 ###
12518
12519 !!test
12520 1. Table tag in SOL posn. should get reparsed correctly with valid TSR
12521 !!options
12522 parsoid=wt2html,wt2wt
12523 !!wikitext
12524 {{echo|}}{| width = '100%'
12525 |foo
12526 |}
12527 !!html/parsoid
12528 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":""}},"i":0}}]}'></span><table width="100%">
12529 <tbody><tr><td>foo</td></tr>
12530 </tbody></table>
12531 !!end
12532
12533 ## We used to, but no longer wt2wt this test since the default serializer
12534 ## will normalize the include directives to serialize on their own line.
12535 ## Selser will take care of preserving formatting in scenarios where they
12536 ## intermingled with other wikitext.
12537 !!test
12538 2. Table tag in SOL posn. should get reparsed correctly with valid TSR
12539 !!options
12540 parsoid=wt2html
12541 !!wikitext
12542 <includeonly>a</includeonly>{| {{{b}}}
12543 |c
12544 |}
12545 !!html/parsoid
12546 <meta typeof="mw:Includes/IncludeOnly" data-parsoid='{"src":"&lt;includeonly>a&lt;/includeonly>"}'/><meta typeof="mw:Includes/IncludeOnly/End" data-parsoid='{"src":""}'/><table about="#mwt2" typeof="mw:ExpandedAttrs" data-parsoid='{"a":{"{{{b}}}":null},"sa":{"{{{b}}}":""}}' data-mw='{"attribs":[[{"txt":"{{{b}}}","html":"&lt;span about=\"#mwt1\" typeof=\"mw:Param\" data-parsoid=&#39;{\"pi\":[[]],\"dsr\":[31,38,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"templatearg\":{\"target\":{\"wt\":\"b\"},\"params\":{},\"i\":0}}]}&#39;>{{{b}}}&lt;/span>"},{"html":""}]]}'>
12547 <tbody><tr><td>c</td></tr>
12548 </tbody></table>
12549 !!end
12550
12551 !! test
12552 Table wikitext syntax outside wiki-tables
12553 !! wikitext
12554 a
12555 |+ not a caption
12556 ! not a table heading
12557 |- not a table row
12558 | not a table cell
12559 | class="foo bar" | baz
12560 b
12561 |}
12562 |-
12563 c
12564 !! html
12565 <p>a
12566 |+ not a caption
12567 ! not a table heading
12568 |- not a table row
12569 | not a table cell
12570 | class="foo bar" | baz
12571 b
12572 |}
12573 |-
12574 c
12575 </p>
12576 !! end
12577
12578 ###
12579 ### Testing parsing of templates where a template arg
12580 ### has the same name as the template itself.
12581 ###
12582
12583 !! article
12584 Template:quote
12585 !! text
12586 {{{quote|{{{1}}}}}}
12587 !! endarticle
12588
12589 !!test
12590 Templates: Template Name/Arg clash: 1. Use of positional param
12591 !! wikitext
12592 {{quote|foo}}
12593 !! html
12594 <p>foo
12595 </p>
12596 !!end
12597
12598 !!test
12599 Templates: Template Name/Arg clash: 2. Use of named param
12600 !! wikitext
12601 {{quote|quote=foo}}
12602 !! html
12603 <p>foo
12604 </p>
12605 !!end
12606
12607 !!test
12608 Templates: Template Name/Arg clash: 3. Use of named param with empty input
12609 !! wikitext
12610 {{quote|quote}}
12611 !! html
12612 <p>quote
12613 </p>
12614 !!end
12615
12616 ###
12617 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
12618 ###
12619
12620 !!test
12621 Templates: 1. Simple use
12622 !! wikitext
12623 {{echo|Foo}}
12624 !! html
12625 <p>Foo
12626 </p>
12627 !!end
12628
12629 !!test
12630 Templates: 2. Inside a block tag
12631 !! wikitext
12632 <div>{{echo|Foo}}</div>
12633 <blockquote>{{echo|Foo}}</blockquote>
12634 !! html
12635 <div>Foo</div>
12636 <blockquote>Foo</blockquote>
12637
12638 !! html+tidy
12639 <div>Foo</div>
12640 <blockquote>
12641 <p>Foo</p>
12642 </blockquote>
12643 !!end
12644
12645 !!test
12646 Templates: P-wrapping: 1a. Templates on consecutive lines
12647 !! wikitext
12648 {{echo|Foo}}
12649 {{echo|bar}}
12650 !! html
12651 <p>Foo
12652 bar
12653 </p>
12654 !!end
12655
12656 !!test
12657 Templates: P-wrapping: 1b. Templates on consecutive lines
12658 !! wikitext
12659 Foo
12660
12661 {{echo|bar}}
12662 {{echo|baz}}
12663 !! html
12664 <p>Foo
12665 </p><p>bar
12666 baz
12667 </p>
12668 !!end
12669
12670 !!test
12671 Templates: P-wrapping: 1c. Templates on consecutive lines
12672 !! wikitext
12673 {{echo|Foo}}
12674 {{echo|bar}} <div>baz</div>
12675 !! html
12676 <p>Foo
12677 </p>
12678 bar <div>baz</div>
12679
12680 !! html+tidy
12681 <p>Foo</p>
12682 <p>bar</p>
12683 <div>baz</div>
12684 !! end
12685
12686 !!test
12687 Templates: P-wrapping: 1d. Template preceded by comment-only line
12688 !!options
12689 parsoid
12690 !! wikitext
12691 <!-- foo -->
12692 {{echo|Bar}}
12693 !! html
12694 <!-- foo -->
12695
12696 <p about="#mwt223" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Bar"}},"i":0}}]}'>Bar</p>
12697 !!end
12698
12699 !!test
12700 Templates: Inline Text: 1. Multiple template uses
12701 !! wikitext
12702 {{echo|Foo}}bar{{echo|baz}}
12703 !! html
12704 <p>Foobarbaz
12705 </p>
12706 !!end
12707
12708 !!test
12709 Templates: Inline Text: 2. Back-to-back template uses
12710 !! wikitext
12711 {{echo|Foo}}{{echo|bar}}
12712 !! html
12713 <p>Foobar
12714 </p>
12715 !!end
12716
12717 !!test
12718 Templates: Block Tags: 1. Multiple template uses
12719 !! wikitext
12720 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
12721 !! html
12722 <div>Foo</div><div>bar</div><div>baz</div>
12723
12724 !!end
12725
12726 !!test
12727 Templates: Block Tags: 2. Back-to-back template uses
12728 !! wikitext
12729 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
12730 !! html
12731 <div>Foo</div><div>bar</div>
12732
12733 !!end
12734
12735 # This is an edge case relating to paragraph wrapping.
12736 !!test
12737 Templates: Correctly encapsulate templates producing </p> tag without a corresponding <p> tag
12738 !! wikitext
12739 {{echo|a
12740 b</p>}}
12741 !! html/parsoid
12742 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\nb&lt;/p>"}},"i":0}}]}'>a
12743 b</p>
12744 !!end
12745
12746 !!test
12747 Templates: Links: 1. Simple example
12748 !! wikitext
12749 {{echo|[[Foo|bar]]}}
12750 !! html
12751 <p><a href="/wiki/Foo" title="Foo">bar</a>
12752 </p>
12753 !!end
12754
12755 !!test
12756 Templates: Links: 2. Generation of link href
12757 !! wikitext
12758 [[{{echo|Foo}}|bar]]
12759 !! html
12760 <p><a href="/wiki/Foo" title="Foo">bar</a>
12761 </p>
12762 !!end
12763
12764 !!test
12765 Templates: Links: 3. Generation of part of a link href
12766 !! wikitext
12767 [[Fo{{echo|o}}|bar]]
12768
12769 [[Foo{{echo|bar}}]]
12770
12771 [[Foo{{echo|bar}}baz]]
12772
12773 [[Foo{{echo|bar}}|bar]]
12774
12775 [[:Foo{{echo|bar}}]]
12776
12777 [[:Foo{{echo|bar}}|bar]]
12778 !! html
12779 <p><a href="/wiki/Foo" title="Foo">bar</a>
12780 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
12781 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
12782 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
12783 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
12784 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
12785 </p>
12786 !!end
12787
12788 !!test
12789 Templates: Links: 4. Multiple templates generating link href
12790 !! wikitext
12791 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
12792 !! html
12793 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
12794 </p>
12795 !!end
12796
12797 !!test
12798 Templates: Links: 5. Generation of link text
12799 !! wikitext
12800 [[Foo|{{echo|bar}}]]
12801 !! html
12802 <p><a href="/wiki/Foo" title="Foo">bar</a>
12803 </p>
12804 !!end
12805
12806 !!test
12807 Templates: Links: 5. Nested templates (only outermost template should be marked)
12808 !! wikitext
12809 {{echo|[[{{echo|Foo}}|bar]]}}
12810 !! html
12811 <p><a href="/wiki/Foo" title="Foo">bar</a>
12812 </p>
12813 !!end
12814
12815 !!test
12816 Templates: HTML Tag: 1. Generation of HTML attr. key
12817 !! wikitext
12818 <div {{echo|style}}="color:red;">foo</div>
12819 !! html
12820 <div style="color:red;">foo</div>
12821
12822 !!end
12823
12824 !!test
12825 Templates: HTML Tag: 2. Generation of HTML attr. value
12826 !! wikitext
12827 <div style={{echo|'color:red;'}}>foo</div>
12828 !! html
12829 <div style="color:red;">foo</div>
12830
12831 !!end
12832
12833 !!test
12834 Templates: HTML Tag: 3. Generation of HTML attr key and value
12835 !! wikitext
12836 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
12837 !! html
12838 <div style="color:red;">foo</div>
12839
12840 !!end
12841
12842 !!test
12843 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
12844 !! wikitext
12845 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
12846 !! html
12847 <div title="This is a long title with just one piece templated">foo</div>
12848
12849 !!end
12850
12851 !!test
12852 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
12853 !! wikitext
12854 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
12855 !! html
12856 <div title="This is a long title with just one piece templated">foo</div>
12857
12858 !!end
12859
12860 !!test
12861 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
12862 !! wikitext
12863 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
12864 !! html
12865 <div title="This is a long title with just one piece templated">foo</div>
12866
12867 !!end
12868
12869 # SSS FIXME: While it is great we added support for all this,
12870 # do we want to make this part of the spec? Maybe we want to
12871 # deprecate this kind of usage in the future?
12872 !!test
12873 Templates: HTML Tag: 7. Generation of partial attribute key string
12874 !! wikitext
12875 <div st{{echo|yle}}="color:red;">foo</div>
12876 !! html
12877 <div style="color:red;">foo</div>
12878
12879 !!end
12880
12881 !! test
12882 Templates: HTML Tag: 8. Template-generated attribute (k=v)
12883 !! wikitext
12884 <div {{echo|1=id="v1"}}>bar</div>
12885 !! html
12886 <div id="v1">bar</div>
12887
12888 !!end
12889
12890 !! test
12891 Templates: HTML Tag: 9. Multiple template-generated attributes
12892 !! wikitext
12893 <div {{echo|1=id="v1" title="foo"}}>bar</div>
12894 !! html
12895 <div id="v1" title="foo">bar</div>
12896
12897 !!end
12898
12899 !! test
12900 Templates: Support for templates generating attributes and content
12901 !! wikitext
12902 {| {{mixed_attr_content_template}}
12903 |-
12904 |bar
12905 |}
12906 !! html/php
12907 <table style="color:red;" title="T48811">
12908
12909 <tr>
12910 <td>foo
12911 </td></tr>
12912 <tr>
12913 <td>bar
12914 </td></tr></table>
12915
12916 !! html/parsoid
12917 <table style="color:red;" title="T48811" about="#mwt1" typeof="mw:Transclusion mw:ExpandedAttrs" data-mw='{"parts":["{| ",{"template":{"target":{"wt":"mixed_attr_content_template","href":"./Template:Mixed_attr_content_template"},"params":{},"i":0}},"\n|-\n|bar\n|}"]}'>
12918 <tbody><tr>
12919 <td>foo</td></tr>
12920 <tr>
12921 <td>bar</td></tr>
12922 </tbody></table>
12923 !!end
12924
12925 !! test
12926 1. Entities and nowikis inside templated attributes should be handled correctly
12927 !! wikitext
12928 <div {{echo|style{{=}}"background:&#35;f9f9f9;"}}>foo</div>
12929 !! html/php
12930 <div style="background:#f9f9f9;">foo</div>
12931
12932 !! html/parsoid
12933 <div style="background:#f9f9f9;" about="#mwt3" typeof="mw:ExpandedAttrs" data-parsoid='{"stx":"html"}' data-mw='{"attribs":[[{"txt":"style","html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[5,49,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"style{{=}}\\\"background:&amp;amp;#35;f9f9f9;\\\"\"}},\"i\":0}}]}&#39;>style&lt;/span>&lt;span typeof=\"mw:Nowiki\" about=\"#mwt1\" data-parsoid=\"{}\">=&lt;/span>&lt;span about=\"#mwt1\" data-parsoid=\"{}\">\"background:&lt;/span>&lt;span typeof=\"mw:Entity\" about=\"#mwt1\" data-parsoid=&#39;{\"src\":\"&amp;amp;#35;\",\"srcContent\":\"#\"}&#39;>#&lt;/span>&lt;span about=\"#mwt1\" data-parsoid=\"{}\">f9f9f9;\"&lt;/span>"},{"html":""}]]}'>foo</div>
12934 !! end
12935
12936 !! test
12937 2. Entities and nowikis inside templated attributes should be handled correctly
12938 !! wikitext
12939 {|
12940 |{{table_attribs_3}}
12941 |}
12942 !! html/php
12943 <table>
12944 <tr>
12945 <td style="background:#f9f9f9;">Foo
12946 </td></tr></table>
12947
12948 !! html/parsoid
12949 <table>
12950 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td style="background:#f9f9f9;" typeof="mw:Transclusion" about="#mwt1" data-parsoid='{"autoInsertedEnd":true,"pi":[[]]}' data-mw='{"parts":["|",{"template":{"target":{"wt":"table_attribs_3","href":"./Template:Table_attribs_3"},"params":{},"i":0}}]}'>Foo</td></tr>
12951 </tbody></table>
12952 !! end
12953
12954 !! test
12955 3. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
12956 !! wikitext
12957 {{tbl-start}}
12958 |{{table_attribs_3}}
12959 {{tbl-end}}
12960 !! html/php
12961 <table>
12962 <tr>
12963 <td style="background:#f9f9f9;">Foo
12964 </td></tr></table>
12965
12966 !! html/parsoid
12967 <table about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[],[],[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"tbl-start","href":"./Template:Tbl-start"},"params":{},"i":0}},"\n|",{"template":{"target":{"wt":"table_attribs_3","href":"./Template:Table_attribs_3"},"params":{},"i":1}},"\n",{"template":{"target":{"wt":"tbl-end","href":"./Template:Tbl-end"},"params":{},"i":2}}]}'>
12968 <tbody><tr><td style="background:#f9f9f9;">Foo</td></tr>
12969 </tbody></table>
12970 !! end
12971
12972 # T107622
12973 !! test
12974 4. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
12975 !! wikitext
12976 {|
12977 | {{table_attribs_6}} hi
12978 |}
12979 !! html/php
12980 <table>
12981 <tr>
12982 <td style="background: red;"> hi
12983 </td></tr></table>
12984
12985 !! html/parsoid
12986 <table>
12987 <tbody><tr><td style="background: red;" typeof="mw:Transclusion" about="#mwt1" data-parsoid='{"autoInsertedEnd":true,"pi":[[]]}' data-mw='{"parts":["| ",{"template":{"target":{"wt":"table_attribs_6","href":"./Template:Table_attribs_6"},"params":{},"i":0}}," hi"]}'> hi</td></tr>
12988 </tbody></table>
12989 !! end
12990
12991 !!test
12992 Templates: HTML Tables: 1. Generating start of a HTML table
12993 !! wikitext
12994 {{echo|<table><tr><td>foo</td>}}</tr></table>
12995 !! html
12996 <table><tr><td>foo</td></tr></table>
12997
12998 !!end
12999
13000 !!test
13001 Templates: HTML Tables: 2a. Generating middle of a HTML table
13002 !! wikitext
13003 <table><tr>{{echo|<td>foo</td>}}</tr></table>
13004 !! html
13005 <table><tr><td>foo</td></tr></table>
13006
13007 !!end
13008
13009 !!test
13010 Templates: HTML Tables: 2b. Generating middle of a HTML table
13011 !! wikitext
13012 <table>{{echo|<tr><td>foo</td></tr>}}</table>
13013 !! html
13014 <table><tr><td>foo</td></tr></table>
13015
13016 !!end
13017
13018 !!test
13019 Templates: HTML Tables: 3. Generating end of a HTML table
13020 !! wikitext
13021 <table><tr>{{echo|<td>foo</td></tr></table>}}
13022 !! html
13023 <table><tr><td>foo</td></tr></table>
13024
13025 !!end
13026
13027 !!test
13028 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
13029 !! wikitext
13030 {{echo|<table>}}<tr><td>foo</td></tr></table>
13031 !! html
13032 <table><tr><td>foo</td></tr></table>
13033
13034 !!end
13035
13036 !!test
13037 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
13038 !! wikitext
13039 <table>{{echo|<tr>}}<td>foo</td></tr></table>
13040 !! html
13041 <table><tr><td>foo</td></tr></table>
13042
13043 !!end
13044
13045 !!test
13046 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
13047 !! wikitext
13048 <table><tr>{{echo|<td>}}foo</td></tr></table>
13049 !! html
13050 <table><tr><td>foo</td></tr></table>
13051
13052 !!end
13053
13054 !!test
13055 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
13056 !! wikitext
13057 <table><tr><td>foo{{echo|</td>}}</tr></table>
13058 !! html
13059 <table><tr><td>foo</td></tr></table>
13060
13061 !!end
13062
13063 !!test
13064 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
13065 !! wikitext
13066 <table><tr><td>foo</td>{{echo|</tr>}}</table>
13067 !! html
13068 <table><tr><td>foo</td></tr></table>
13069
13070 !!end
13071
13072 !!test
13073 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
13074 !! wikitext
13075 <table><tr><td>foo</td></tr>{{echo|</table>}}
13076 !! html
13077 <table><tr><td>foo</td></tr></table>
13078
13079 !!end
13080
13081 !!test
13082 Templates: HTML Tables: 5. Proper fostering of categories from inside
13083 !!options
13084 parsoid=wt2html,wt2wt
13085 !! wikitext
13086 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
13087 <!--Two categories (T52330)-->
13088 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
13089 !! html
13090 <link rel="mw:PageProp/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
13091 <!--Two categories (T52330)-->
13092 <link rel="mw:PageProp/Category" href="./Category:Bar1"><link rel="mw:PageProp/Category" href="./Category:Bar2"><table><tbody><tr><td>foo</td></tr></tbody></table>
13093 !!end
13094
13095 !!test
13096 Templates: Wiki Tables: 1a. Fostering of entire template content
13097 !! wikitext
13098 {|
13099 {{echo|a}}
13100 |}
13101 !! html
13102 <table>
13103 a
13104 <tr><td></td></tr></table>
13105
13106 !! html+tidy
13107 <p>a</p>
13108 <table>
13109 <tr>
13110 <td></td>
13111 </tr>
13112 </table>
13113 !! end
13114
13115 !!test
13116 Templates: Wiki Tables: 1b. Fostering of entire template content
13117 !! wikitext
13118 {|
13119 {{echo|<div>}}
13120 foo
13121 {{echo|</div>}}
13122 |}
13123 !! html
13124 <table>
13125 <div>
13126 <p>foo
13127 </p>
13128 </div>
13129 <tr><td></td></tr></table>
13130
13131 !! html+tidy
13132 <div>
13133 <p>foo</p>
13134 </div>
13135 <table>
13136 <tr>
13137 <td></td>
13138 </tr>
13139 </table>
13140 !! end
13141
13142 !!test
13143 Templates: Wiki Tables: 2. Fostering of partial template content
13144 !! wikitext
13145 {|
13146 {{echo|a
13147 <div>b</div>}}
13148 |}
13149 !! html
13150 <table>
13151 a
13152 <div>b</div>
13153 <tr><td></td></tr></table>
13154
13155 !! html+tidy
13156 <p>a</p>
13157 <div>b</div>
13158 <table>
13159 <tr>
13160 <td></td>
13161 </tr>
13162 </table>
13163 !! end
13164
13165 !!test
13166 Templates: Wiki Tables: 3. td-content via multiple templates
13167 !! wikitext
13168 {|
13169 {{echo|{{pipe}}a}}{{echo|b}}
13170 |}
13171 !! html
13172 <table>
13173 <tr>
13174 <td>ab
13175 </td></tr></table>
13176
13177 !!end
13178
13179 !!test
13180 Templates: Wiki Tables: 4. Templated tags, no content
13181 !! wikitext
13182 {{tbl-start}}
13183 {{tbl-end}}
13184 !! html
13185 <table>
13186 <tr><td></td></tr></table>
13187
13188 !!end
13189
13190 !!test
13191 Templates: Wiki Tables: 5. Templated tags, regular td-tags
13192 !! wikitext
13193 {{tbl-start}}
13194 |foo
13195 {{tbl-end}}
13196 !! html
13197 <table>
13198 <tr>
13199 <td>foo
13200 </td></tr></table>
13201
13202 !!end
13203
13204 !!test
13205 Templates: Wiki Tables: 6. Templated tags, templated td-tags
13206 !! wikitext
13207 {{tbl-start}}
13208 {{!}}foo
13209 {{tbl-end}}
13210 !! html
13211 <table>
13212 <tr>
13213 <td>foo
13214 </td></tr></table>
13215
13216 !!end
13217
13218 ## This test case is very specific to Parsoid's internals
13219 ## and is hence only tested for Parsoid's code. Parsoid uses
13220 ## a <meta> marker tag for <ref> tags and they are expanded
13221 ## much later. We are verifying that this <meta> tag usage
13222 ## doesn't prevent foster parenting.
13223 !!test
13224 Templates: Wiki Tables: 7. Fosterable <ref>s should get fostered
13225 !!wikitext
13226 {{PartialTable}}<ref>foo</ref>
13227 |}
13228
13229 <references />
13230 !!html/parsoid
13231 <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Transclusion mw:Extension/ref" data-mw='{"parts":[{"template":{"target":{"wt":"PartialTable","href":"./Template:PartialTable"},"params":{},"i":0}},"&lt;ref>foo&lt;/ref>\n|}"]}'><a href="./Main_Page#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span><table about="#mwt2">
13232 <tbody>
13233 </tbody></table>
13234
13235 <ol class="mw-references references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><a href="./Main_Page#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo</span></li></ol>
13236 !!end
13237
13238 !! test
13239 Templates: Wiki Tables: 8. Fosterable meta-tags should get fostered
13240 !! wikitext
13241 {{echo|
13242 {{{!}}
13243 {{!}}-}}
13244 <onlyinclude>
13245 |foo
13246 </onlyinclude>
13247 {{!}}}
13248 !! html/parsoid
13249 <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"\n{{{!}}\n{{!}}-"}},"i":0}},"\n&lt;onlyinclude>\n|foo\n&lt;/onlyinclude>\n{{!}}}"]}'>
13250 </span><meta typeof="mw:Includes/OnlyInclude" about="#mwt1"/><table about="#mwt1">
13251 <tbody><tr>
13252
13253 <td>foo
13254 <meta typeof="mw:Includes/OnlyInclude/End"/></td></tr>
13255 </tbody></table>
13256 !! end
13257
13258 !!test
13259 Templates: Lists: Multi-line list-items via templates
13260 !! wikitext
13261 *{{echo|a {{nonexistent|
13262 unused}}}}
13263 *{{echo|b {{nonexistent|
13264 unused}}}}
13265 !! html
13266 <ul><li>a <a href="/index.php?title=Template:Nonexistent&amp;action=edit&amp;redlink=1" class="new" title="Template:Nonexistent (page does not exist)">Template:Nonexistent</a></li>
13267 <li>b <a href="/index.php?title=Template:Nonexistent&amp;action=edit&amp;redlink=1" class="new" title="Template:Nonexistent (page does not exist)">Template:Nonexistent</a></li></ul>
13268
13269 !!end
13270
13271 !!test
13272 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
13273 !! wikitext
13274 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
13275 !! html
13276 <p><i>ab</i>c<i>d</i>e
13277 </p>
13278 !!end
13279
13280 !!test
13281 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
13282 (PHP parser generates misnested html)
13283 !! wikitext
13284 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
13285 !! html/parsoid
13286 <p><span about="#mwt1" typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo_with_span&quot;,&quot;href&quot;:&quot;./Template:Echo_with_span&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;''a&quot;}},&quot;i&quot;:0}}]}"><i>a</i></span><i about="#mwt2" typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo_with_span&quot;,&quot;href&quot;:&quot;./Template:Echo_with_span&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;b''c''d&quot;}},&quot;i&quot;:0}},{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo_with_span&quot;,&quot;href&quot;:&quot;./Template:Echo_with_span&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;''e&quot;}},&quot;i&quot;:1}}]}"><span>b</span></i><span about="#mwt2">c</span><i about="#mwt2">d<span></span></i><span about="#mwt2">e</span></p>
13287 !!end
13288
13289 !!test
13290 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
13291 (PHP parser generates misnested html; Parsoid html2wt mode adds newlines between {{echo}}s)
13292 !! options
13293 parsoid=wt2html,wt2wt
13294 !! wikitext
13295 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
13296 !! html
13297 <div about="#mwt1" typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo_with_div&quot;,&quot;href&quot;:&quot;./Template:Echo_with_div&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;''a&quot;}},&quot;i&quot;:0}}]}"><i>a</i></div>
13298 <div about="#mwt2" typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo_with_div&quot;,&quot;href&quot;:&quot;./Template:Echo_with_div&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;b''c''d&quot;}},&quot;i&quot;:0}}]}"><i>b</i>c<i>d</i></div>
13299 <div about="#mwt3" typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo_with_div&quot;,&quot;href&quot;:&quot;./Template:Echo_with_div&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;''e&quot;}},&quot;i&quot;:0}}]}">e</div>
13300 !!end
13301
13302 !!test
13303 Templates: Ugly nesting: 4. Divs opened/closed across templates
13304 !! wikitext
13305 a<div>b{{echo|c</div>d}}e
13306 !! html
13307 a<div>bc</div>de
13308
13309 !! html+tidy
13310 <p>a</p>
13311 <div>bc</div>
13312 <p>de</p>
13313 !! end
13314
13315 !!test
13316 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
13317 (Parsoid-centric)
13318 !! options
13319 parsoid
13320 !! wikitext
13321 {|
13322 |{{echo|foo</table>}}
13323 |bar
13324 |}
13325 !! html
13326 <table about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":["{|\n|",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo</table>"}},"i":0}},"\n|bar\n|}"]}'>
13327
13328 <tbody>
13329 <tr>
13330 <td>foo</td></tr></tbody></table><span about="#mwt1">
13331 </span><span about="#mwt1">|bar</span><span about="#mwt1">
13332 |}</span>
13333 !!end
13334
13335 !!test
13336 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
13337 (Parsoid-centric)
13338 !! options
13339 parsoid
13340 !! wikitext
13341 <table>
13342 <tr>
13343 <td>
13344 <table>
13345 <tr>
13346 <td>1. {{echo|foo </table>}}</td>
13347 <td> bar </td>
13348 <td>2. {{echo|baz </table>}}</td>
13349 </tr>
13350 <tr>
13351 <td>abc</td>
13352 </tr>
13353 </table>
13354 </td>
13355 </tr>
13356 <tr>
13357 <td>xyz</td>
13358 </tr>
13359 </table>
13360 !! html
13361 <table about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":["<table>\n <tr>\n <td>\n <table>\n <tr>\n <td>1. ",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo </table>"}},"i":0}},"</td>\n <td> bar </td>\n <td>2. ",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"baz </table>"}},"i":1}},"</td>\n </tr>\n <tr>\n <td>abc</td>\n </tr>\n </table>\n </td>\n </tr>\n <tr>\n <td>xyz</td>\n </tr>\n</table>"]}'>
13362 <tbody><tr>
13363 <td>
13364 <table>
13365 <tbody><tr>
13366 <td>1. foo </td></tr></tbody></table></td>
13367 <td> bar </td>
13368 <td>2. baz </td></tr></tbody></table><span about="#mwt2">
13369 </span><span about="#mwt2">
13370 </span><span about="#mwt2">
13371 </span><span about="#mwt2">abc</span><span about="#mwt2">
13372 </span><span about="#mwt2">
13373 </span><span about="#mwt2">
13374 </span><span about="#mwt2">
13375 </span><span about="#mwt2">
13376 </span><span about="#mwt2">
13377 </span><span about="#mwt2">xyz</span><span about="#mwt2">
13378 </span><span about="#mwt2">
13379 </span>
13380 !!end
13381
13382 !! test
13383 Templates: Ugly templates: 3. newline-only template parameter
13384 !! wikitext
13385 foo {{echo|
13386 }}
13387 !! html
13388 <p>foo
13389 </p>
13390 !! end
13391
13392 # This looks like a bug: a single newline triggers p/br for some reason.
13393 !! test
13394 Templates: Ugly templates: 4. newline-only template parameter inconsistency
13395 !! wikitext
13396 {{echo|
13397 }}
13398 !! html
13399 <p><br />
13400 </p>
13401 !! end
13402
13403 # T66017 -- ugly wikitext with fostered content generates two template ranges that
13404 # have a true overlap (T1-start - T2-start - T1-end - T2-end).
13405 !! test
13406 Templates: Ugly templates: 5. Template encapsulation test: Non-trivial overlap of template ranges is properly handled
13407 !! wikitext
13408 {{echo|<table>}}
13409 {{echo|<div>foo}}
13410 {{echo|</table>}}
13411 !! html/parsoid
13412 <div about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;table>"}},"i":0}},"\n",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;div>foo"}},"i":1}},"\n",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;/table>"}},"i":2}}]}' data-parsoid='{"stx":"html","autoInsertedEnd":true,"pi":[[{"k":"1"}],[{"k":"1"}],[{"k":"1"}]]}'>foo
13413 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
13414 </table>
13415 !! end
13416
13417 # T66017 -- ugly wikitext with fostered content generates two template ranges
13418 # that are "identical" and generate nesting cycles in the algorithm
13419 !! test
13420 Templates: Ugly templates: 6. Template encapsulation test: Cyclical nesting of template ranges is properly handled
13421 !! wikitext
13422 {{echo|<table><tr><td><table>}}
13423 {{echo|<div>}}
13424 {{echo|</div>}}
13425 !! html/parsoid
13426 <table about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;table>&lt;tr>&lt;td>&lt;table>"}},"i":0}},"\n",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;div>"}},"i":1}},"\n",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;/div>"}},"i":2}}]}' data-parsoid='{"stx":"html","autoInsertedEnd":true,"pi":[[{"k":"1"}],[{"k":"1"}],[{"k":"1"}]]}'><tbody><tr data-parsoid='{"stx":"html"}'><td data-parsoid='{"stx":"html"}'><div data-parsoid='{"stx":"html"}'>
13427 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
13428 </table></td></tr></tbody></table>
13429 !! end
13430
13431 !! test
13432 Templates: Parameters substituted at the top-level
13433 !! wikitext
13434 {{{foo|''who'' {{echo|me}}? '''never!'''}}}
13435
13436 {{{foo|bar|baz}}}
13437 !! html/php
13438 <p><i>who</i> me? <b>never!</b>
13439 </p><p>bar
13440 </p>
13441 !! html/parsoid
13442 <p about="#mwt2" typeof="mw:Param" data-mw='{"parts":[{"templatearg":{"target":{"wt":"foo"},"params":{"1":{"wt":"&#39;&#39;who&#39;&#39; {{echo|me}}? &#39;&#39;&#39;never!&#39;&#39;&#39;"}},"i":0}}]}'><i>who</i> me? <b>never!</b></p>
13443
13444 <p about="#mwt3" typeof="mw:Param" data-mw='{"parts":[{"templatearg":{"target":{"wt":"foo"},"params":{"1":{"wt":"bar"},"2":{"wt":"baz"}},"i":0}}]}'>bar</p>
13445 !! end
13446
13447 !! test
13448 Templates: Param with empty arg in the final position
13449 !! wikitext
13450 {{{hi|}}}
13451 !! html/parsoid
13452 <span about="#mwt1" typeof="mw:Param" data-mw='{"parts":[{"templatearg":{"target":{"wt":"hi"},"params":{"1":{"wt":""}},"i":0}}]}'></span>
13453 !! end
13454
13455 !!test
13456 Parser Functions: 1. Simple example
13457 !! wikitext
13458 {{uc:foo}}
13459 !! html
13460 <p>FOO
13461 </p>
13462 !!end
13463
13464 !!test
13465 Parser Functions: 2. Nested use (only outermost should be marked up)
13466 !! wikitext
13467 {{uc:{{lc:FOO}}}}
13468 !! html
13469 <p>FOO
13470 </p>
13471 !!end
13472
13473 ###
13474 ### Pre-save transform tests
13475 ###
13476 !! test
13477 pre-save transform: subst:
13478 !! options
13479 pst
13480 !! wikitext
13481 {{subst:test}}
13482 !! html/php
13483 This is a test template
13484 !! end
13485
13486 !! test
13487 pre-save transform: normal template
13488 !! options
13489 pst
13490 !! wikitext
13491 {{test}}
13492 !! html/php
13493 {{test}}
13494 !! end
13495
13496 !! test
13497 pre-save transform: nonexistent template
13498 !! options
13499 pst
13500 !! wikitext
13501 {{thistemplatedoesnotexist}}
13502 !! html/php
13503 {{thistemplatedoesnotexist}}
13504 !! end
13505
13506 !! test
13507 pre-save transform: subst magic variables
13508 !! options
13509 pst
13510 !! wikitext
13511 {{subst:SITENAME}}
13512 !! html/php
13513 MediaWiki
13514 !! end
13515
13516 # This is T2089, which I fixed. -- wtm
13517 !! test
13518 pre-save transform: subst: templates with parameters
13519 !! options
13520 pst
13521 !! wikitext
13522 {{subst:paramtest|param="something else"}}
13523 !! html/php
13524 This is a test template with parameter "something else"
13525 !! end
13526
13527 !! article
13528 Template:nowikitest
13529 !! text
13530 <nowiki>'''not wiki'''</nowiki>
13531 !! endarticle
13532
13533 !! test
13534 pre-save transform: nowiki in subst (T3188)
13535 !! options
13536 pst
13537 !! wikitext
13538 {{subst:nowikitest}}
13539 !! html/php
13540 <nowiki>'''not wiki'''</nowiki>
13541 !! end
13542
13543 !! article
13544 Template:commenttest
13545 !! text
13546 This template has <!-- a comment --> in it.
13547 !! endarticle
13548
13549 !! test
13550 pre-save transform: comment in subst (T3936)
13551 !! options
13552 pst
13553 !! wikitext
13554 {{subst:commenttest}}
13555 !! html/php
13556 This template has <!-- a comment --> in it.
13557 !! end
13558
13559 !! test
13560 pre-save transform: unclosed tag
13561 !! options
13562 pst
13563 !! wikitext
13564 <nowiki>'''not wiki'''
13565 !! html/php
13566 <nowiki>'''not wiki'''
13567 !! end
13568
13569 !! test
13570 pre-save transform: mixed tag case
13571 !! options
13572 pst
13573 !! wikitext
13574 <NOwiki>'''not wiki'''</noWIKI>
13575 !! html/php
13576 <NOwiki>'''not wiki'''</noWIKI>
13577 !! end
13578
13579 !! test
13580 pre-save transform: unclosed comment in <nowiki>
13581 !! options
13582 pst
13583 !! wikitext
13584 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
13585 !! html/php
13586 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
13587 !!end
13588
13589 # Leading @ in this template definition works around a limitation
13590 # in parsoid's parserTests which otherwise strips the <span> from the
13591 # result (confusing it for a template wrapper)
13592 !! article
13593 Template:dangerous
13594 !!text
13595 @<span onmouseover="alert('crap')">Oh no</span>
13596 !!endarticle
13597
13598 !!test
13599 (confirming safety of fix for subst T3936)
13600 !! wikitext
13601 {{Template:dangerous}}
13602 !! html
13603 <p>@<span>Oh no</span>
13604 </p>
13605 !! end
13606
13607 !! test
13608 pre-save transform: comment containing gallery (T7024)
13609 !! options
13610 pst
13611 !! wikitext
13612 <!-- <gallery>data</gallery> -->
13613 !! html/php
13614 <!-- <gallery>data</gallery> -->
13615 !!end
13616
13617 !! test
13618 pre-save transform: comment containing extension
13619 !! options
13620 pst
13621 !! wikitext
13622 <!-- <tag>data</tag> -->
13623 !! html/php
13624 <!-- <tag>data</tag> -->
13625 !!end
13626
13627 !! test
13628 pre-save transform: comment containing nowiki
13629 !! options
13630 pst
13631 !! wikitext
13632 <!-- <nowiki>data</nowiki> -->
13633 !! html/php
13634 <!-- <nowiki>data</nowiki> -->
13635 !!end
13636
13637 !! test
13638 pre-save transform: <noinclude> in subst (T5298)
13639 !! options
13640 pst
13641 !! wikitext
13642 {{subst:Includes}}
13643 !! html/php
13644 Foobar
13645 !! end
13646
13647 !! test
13648 pre-save transform: <onlyinclude> in subst (T5298)
13649 !! options
13650 pst
13651 !! wikitext
13652 {{subst:Includes2}}
13653 !! html/php
13654 Foo
13655 !! end
13656
13657 !! article
13658 Template:SubstTest
13659 !!text
13660 {{<includeonly>subst:</includeonly>Includes}}
13661 !! endarticle
13662
13663 !! article
13664 Template:SafeSubstTest
13665 !! text
13666 {{<includeonly>safesubst:</includeonly>Includes}}
13667 !! endarticle
13668
13669 !! test
13670 T24297: safesubst: works during PST
13671 !! options
13672 pst
13673 !! wikitext
13674 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
13675 !! html/php
13676 FoobarFoobar
13677 !! end
13678
13679 !! test
13680 T24297: safesubst: works during normal parse
13681 !! wikitext
13682 {{SafeSubstTest}}
13683 !! html
13684 <p>Foobar
13685 </p>
13686 !! end
13687
13688 !! test
13689 subst: does not work during normal parse
13690 !! wikitext
13691 {{SubstTest}}
13692 !! html
13693 <p>{{subst:Includes}}
13694 </p>
13695 !! end
13696
13697 !! test
13698 pre-save transform: context links ("pipe trick")
13699 !! options
13700 pst
13701 !! wikitext
13702 [[Article (context)|]]
13703 [[Bar:Article|]]
13704 [[:Bar:Article|]]
13705 [[Bar:Article (context)|]]
13706 [[:Bar:Article (context)|]]
13707 [[|Article]]
13708 [[|Article (context)]]
13709 [[Bar:X (Y) Z|]]
13710 [[:Bar:X (Y) Z|]]
13711 !! html/php
13712 [[Article (context)|Article]]
13713 [[Bar:Article|Article]]
13714 [[:Bar:Article|Article]]
13715 [[Bar:Article (context)|Article]]
13716 [[:Bar:Article (context)|Article]]
13717 [[Article]]
13718 [[Article (context)]]
13719 [[Bar:X (Y) Z|X (Y) Z]]
13720 [[:Bar:X (Y) Z|X (Y) Z]]
13721 !! end
13722
13723 !! test
13724 pre-save transform: context links ("pipe trick") with interwiki prefix
13725 !! options
13726 pst
13727 !! wikitext
13728 [[interwiki:Article|]]
13729 [[:interwiki:Article|]]
13730 [[interwiki:Bar:Article|]]
13731 [[:interwiki:Bar:Article|]]
13732 !! html/php
13733 [[interwiki:Article|Article]]
13734 [[:interwiki:Article|Article]]
13735 [[interwiki:Bar:Article|Bar:Article]]
13736 [[:interwiki:Bar:Article|Bar:Article]]
13737 !! end
13738
13739 !! test
13740 pre-save transform: context links ("pipe trick") with parens in title
13741 !! options
13742 pst title=[[Somearticle (context)]]
13743 !! wikitext
13744 [[|Article]]
13745 !! html/php
13746 [[Article (context)|Article]]
13747 !! end
13748
13749 !! test
13750 pre-save transform: context links ("pipe trick") with comma in title
13751 !! options
13752 pst title=[[Someplace, Somewhere]]
13753 !! wikitext
13754 [[|Otherplace]]
13755 [[Otherplace, Elsewhere|]]
13756 [[Otherplace, Elsewhere, Anywhere|]]
13757 !! html/php
13758 [[Otherplace, Somewhere|Otherplace]]
13759 [[Otherplace, Elsewhere|Otherplace]]
13760 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
13761 !! end
13762
13763 !! test
13764 pre-save transform: context links ("pipe trick") with parens and comma
13765 !! options
13766 pst title=[[Someplace (IGNORED), Somewhere]]
13767 !! wikitext
13768 [[|Otherplace]]
13769 [[Otherplace (place), Elsewhere|]]
13770 !! html/php
13771 [[Otherplace, Somewhere|Otherplace]]
13772 [[Otherplace (place), Elsewhere|Otherplace]]
13773 !! end
13774
13775 !! test
13776 pre-save transform: context links ("pipe trick") with comma and parens
13777 !! options
13778 pst title=[[Who, me? (context)]]
13779 !! wikitext
13780 [[|Yes, you.]]
13781 [[Me, Myself, and I (1937 song)|]]
13782 !! html/php
13783 [[Yes, you. (context)|Yes, you.]]
13784 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
13785 !! end
13786
13787 !! test
13788 pre-save transform: context links ("pipe trick") with namespace
13789 !! options
13790 pst title=[[Ns:Somearticle]]
13791 !! wikitext
13792 [[|Article]]
13793 !! html/php
13794 [[Ns:Article|Article]]
13795 !! end
13796
13797 !! test
13798 pre-save transform: context links ("pipe trick") with namespace and parens
13799 !! options
13800 pst title=[[Ns:Somearticle (context)]]
13801 !! wikitext
13802 [[|Article]]
13803 !! html/php
13804 [[Ns:Article (context)|Article]]
13805 !! end
13806
13807 !! test
13808 pre-save transform: context links ("pipe trick") with namespace and comma
13809 !! options
13810 pst title=[[Ns:Somearticle, Context, Whatever]]
13811 !! wikitext
13812 [[|Article]]
13813 !! html/php
13814 [[Ns:Article, Context, Whatever|Article]]
13815 !! end
13816
13817 !! test
13818 pre-save transform: context links ("pipe trick") with namespace, comma and parens
13819 !! options
13820 pst title=[[Ns:Somearticle, Context (context)]]
13821 !! wikitext
13822 [[|Article]]
13823 !! html/php
13824 [[Ns:Article (context)|Article]]
13825 !! end
13826
13827 !! test
13828 pre-save transform: context links ("pipe trick") with namespace, parens and comma
13829 !! options
13830 pst title=[[Ns:Somearticle (IGNORED), Context]]
13831 !! wikitext
13832 [[|Article]]
13833 !! html/php
13834 [[Ns:Article, Context|Article]]
13835 !! end
13836
13837 !! test
13838 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, T32149)
13839 !! options
13840 pst
13841 !! wikitext
13842 [[Article(context)|]]
13843 [[Bar:Article(context)|]]
13844 [[:Bar:Article(context)|]]
13845 [[|Article(context)]]
13846 [[Bar:X(Y)Z|]]
13847 [[:Bar:X(Y)Z|]]
13848 !! html/php
13849 [[Article(context)|Article]]
13850 [[Bar:Article(context)|Article]]
13851 [[:Bar:Article(context)|Article]]
13852 [[Article(context)]]
13853 [[Bar:X(Y)Z|X(Y)Z]]
13854 [[:Bar:X(Y)Z|X(Y)Z]]
13855 !! end
13856
13857 !! test
13858 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, T32149)
13859 !! options
13860 pst
13861 !! wikitext
13862 [[Article (context)|]]
13863 [[Bar:Article (context)|]]
13864 [[:Bar:Article (context)|]]
13865 [[|Article (context)]]
13866 [[Bar:X (Y) Z|]]
13867 [[:Bar:X (Y) Z|]]
13868 !! html/php
13869 [[Article (context)|Article]]
13870 [[Bar:Article (context)|Article]]
13871 [[:Bar:Article (context)|Article]]
13872 [[Article (context)]]
13873 [[Bar:X (Y) Z|X (Y) Z]]
13874 [[:Bar:X (Y) Z|X (Y) Z]]
13875 !! end
13876
13877 !! test
13878 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, T32149)
13879 !! options
13880 pst
13881 !! wikitext
13882 [[Article(context)|]]
13883 [[Bar:Article(context)|]]
13884 [[:Bar:Article(context)|]]
13885 [[|Article(context)]]
13886 [[Bar:X(Y)Z|]]
13887 [[:Bar:X(Y)Z|]]
13888 !! html/php
13889 [[Article(context)|Article]]
13890 [[Bar:Article(context)|Article]]
13891 [[:Bar:Article(context)|Article]]
13892 [[Article(context)]]
13893 [[Bar:X(Y)Z|X(Y)Z]]
13894 [[:Bar:X(Y)Z|X(Y)Z]]
13895 !! end
13896
13897 !! test
13898 pre-save transform: context links ("pipe trick") with commas (T23660)
13899 !! options
13900 pst
13901 !! wikitext
13902 [[Article (context), context|]]
13903 [[Article (context),context|]]
13904 [[Bar:Article (context), context|]]
13905 [[Bar:Article (context),context|]]
13906 [[:Bar:Article (context), context|]]
13907 [[:Bar:Article (context),context|]]
13908 !! html/php
13909 [[Article (context), context|Article]]
13910 [[Article (context),context|Article]]
13911 [[Bar:Article (context), context|Article]]
13912 [[Bar:Article (context),context|Article]]
13913 [[:Bar:Article (context), context|Article]]
13914 [[:Bar:Article (context),context|Article]]
13915 !! end
13916
13917 !! test
13918 Parsoid: backwards pipe trick
13919 !! wikitext
13920 [[|'''bar''']]
13921 !! html/php
13922 <p>[[|<b>bar</b>]]
13923 </p>
13924 !! html/parsoid
13925 <p>[[|<b>bar</b>]]</p>
13926 !! end
13927
13928 !! test
13929 pre-save transform: trim trailing empty lines
13930 !! options
13931 pst
13932 !! wikitext
13933 Empty lines are trimmed
13934
13935
13936
13937
13938 !! html/php
13939 Empty lines are trimmed
13940 !! end
13941
13942 !! test
13943 pre-save transform: Signature expansion
13944 !! options
13945 pst
13946 !! wikitext
13947 * ~~~
13948 * ~~~~
13949 * ~~~~~
13950 * <noinclude>~~~</noinclude>
13951 * <includeonly>~~~</includeonly>
13952 * <onlyinclude>~~~</onlyinclude>
13953 !! html/php
13954 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
13955 * [[Special:Contributions/127.0.0.1|127.0.0.1]] 00:02, 1 January 1970 (UTC)
13956 * 00:02, 1 January 1970 (UTC)
13957 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
13958 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
13959 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
13960 !! end
13961
13962
13963 !! test
13964 ParserOutput flags from signature expansion (T84843)
13965 !! options
13966 pst
13967 showflags
13968 !! wikitext
13969 ~~~~
13970 !! html/php
13971 [[Special:Contributions/127.0.0.1|127.0.0.1]] 00:02, 1 January 1970 (UTC)
13972 flags=user-signature
13973 !! end
13974
13975
13976 !! test
13977 pre-save transform: Signature expansion in nowiki tags (T2093)
13978 !! options
13979 pst disabled
13980 !! wikitext
13981 Shall not expand:
13982
13983 <nowiki>~~~~</nowiki>
13984
13985 <includeonly><nowiki>~~~~</nowiki></includeonly>
13986
13987 <noinclude><nowiki>~~~~</nowiki></noinclude>
13988
13989 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
13990
13991 {{subst:Foo}} shall be converted to FOO
13992
13993 As well as inside noinclude/onlyinclude
13994 <noinclude>{{subst:Foo}}</noinclude>
13995 <onlyinclude>{{subst:Foo}}</onlyinclude>
13996
13997 But not inside includeonly
13998 <includeonly>{{subst:Foo}}</includeonly>
13999 !! html/php
14000 Shall not expand:
14001
14002 <nowiki>~~~~</nowiki>
14003
14004 <includeonly><nowiki>~~~~</nowiki></includeonly>
14005
14006 <noinclude><nowiki>~~~~</nowiki></noinclude>
14007
14008 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
14009
14010 FOO shall be converted to FOO
14011
14012 As well as inside noinclude/onlyinclude
14013 <noinclude>FOO</noinclude>
14014 <onlyinclude>FOO</onlyinclude>
14015
14016 But not inside includeonly
14017 <includeonly>{{subst:Foo}}</includeonly>
14018 !! end
14019
14020 !! test
14021 Parsoid: Recognize nowiki with trailing space in tags
14022 !! options
14023 parsoid=wt2html
14024 !! wikitext
14025 <nowiki ><div>[[foo]]</nowiki >
14026
14027 a<nowiki / >b
14028
14029 c<nowiki />d
14030
14031 e<nowiki/ >f
14032 !! html
14033 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
14034 <p>ab</p>
14035 <p>cd</p>
14036 <p>ef</p>
14037 !! end
14038
14039 !! test
14040 Parsoid: Recognize nowiki with odd capitalization
14041 !! options
14042 parsoid=wt2html
14043 !! wikitext
14044 <noWikI ><div>[[foo]]</Nowiki >
14045 !! html
14046 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
14047 !! end
14048
14049
14050 !! test
14051 Parsoid: Escape nowiki with trailing space in tags
14052 !! options
14053 parsoid=html2wt
14054 !! html/parsoid
14055 <p>&lt;nowiki &gt; foo &lt/nowiki ></p>
14056 <p>a&lt;nowiki /&gt;b</p>
14057 <p>c&lt;nowiki/ &gt;d</p>
14058 !! wikitext
14059 &lt;nowiki &gt; foo &lt;/nowiki &gt;
14060
14061 a&lt;nowiki /&gt;b
14062
14063 c&lt;nowiki/ &gt;d
14064 !! end
14065
14066 !! test
14067 Parsoid: Escape weird noWikI capitalizations
14068 !! options
14069 parsoid=html2wt
14070 !! html/parsoid
14071 <p>&lt;noWikI &gt; foo &lt/NoWikI ></p>
14072 !! wikitext
14073 &lt;noWikI &gt; foo &lt;/NoWikI &gt;
14074 !! end
14075
14076 ###
14077 ### Message transform tests
14078 ###
14079 !! test
14080 message transform: magic variables
14081 !! options
14082 msg
14083 !! wikitext
14084 {{SITENAME}}
14085 !! html
14086 MediaWiki
14087 !! end
14088
14089 !! test
14090 message transform: should not transform wiki markup
14091 !! options
14092 msg
14093 !! wikitext
14094 ''test''
14095 !! html
14096 ''test''
14097 !! end
14098
14099 !! test
14100 message transform: <noinclude> in transcluded template (T6926)
14101 !! options
14102 msg
14103 !! wikitext
14104 {{Includes}}
14105 !! html
14106 Foobar
14107 !! end
14108
14109 !! test
14110 message transform: <onlyinclude> in transcluded template (T6926)
14111 !! options
14112 msg
14113 !! wikitext
14114 {{Includes2}}
14115 !! html
14116 Foo
14117 !! end
14118
14119 !! test
14120 {{#special:}} page name, known
14121 !! options
14122 msg
14123 !! wikitext
14124 {{#special:Recentchanges}}
14125 !! html
14126 Special:RecentChanges
14127 !! end
14128
14129 !! test
14130 {{#special:}} page name with subpage, known
14131 !! options
14132 msg
14133 !! wikitext
14134 {{#special:Recentchanges/param}}
14135 !! html
14136 Special:RecentChanges/param
14137 !! end
14138
14139 !! test
14140 {{#special:}} page name, unknown
14141 !! options
14142 msg
14143 !! wikitext
14144 {{#special:foobar nonexistent}}
14145 !! html
14146 Special:Foobar nonexistent
14147 !! end
14148
14149 !! test
14150 {{#speciale:}} page name, known
14151 !! options
14152 msg
14153 !! wikitext
14154 {{#speciale:Recentchanges}}
14155 !! html
14156 Special:RecentChanges
14157 !! end
14158
14159 !! test
14160 {{#speciale:}} page name with subpage, known
14161 !! options
14162 msg
14163 !! wikitext
14164 {{#speciale:Recentchanges/param}}
14165 !! html
14166 Special:RecentChanges/param
14167 !! end
14168
14169 !! test
14170 {{#speciale:}} page name, unknown
14171 !! options
14172 msg
14173 !! wikitext
14174 {{#speciale:foobar nonexistent}}
14175 !! html
14176 Special:Foobar_nonexistent
14177 !! end
14178
14179 ###
14180 ### Images
14181 ###
14182 ### For Parsoid-specific tests, see
14183 #### https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
14184
14185 !! test
14186 Simple image
14187 !! options
14188 parsoid=wt2html,wt2wt,html2html
14189 !! wikitext
14190 [[Image:foobar.jpg]]
14191 !! html/php
14192 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
14193 </p>
14194 !! html/parsoid
14195 <p><span class="mw-default-size" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
14196 !! end
14197
14198 !! test
14199 Serialize simple image with figure-inline wrapper
14200 !! options
14201 parsoid=html2wt
14202 !! html/parsoid
14203 <p><figure-inline class="mw-default-size" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></figure-inline></p>
14204 !! wikitext
14205 [[File:Foobar.jpg]]
14206 !! end
14207
14208 !! test
14209 Simple image (using File: namespace, now canonical)
14210 !! wikitext
14211 [[File:Foobar.jpg]]
14212 !! html/php
14213 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
14214 </p>
14215 !! html/parsoid
14216 <p><span class="mw-default-size" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
14217 !! end
14218
14219 !! test
14220 Right-aligned image
14221 !! wikitext
14222 [[File:Foobar.jpg|right]]
14223 !! html/php
14224 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
14225
14226 !! html/parsoid
14227 <figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></figure>
14228 !! end
14229
14230 !! test
14231 Image with caption
14232 !! wikitext
14233 [[File:Foobar.jpg|right|Caption text]]
14234 !! html/php
14235 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption text"><img alt="Caption text" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
14236
14237 !! html/parsoid
14238 <figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>Caption text</figcaption></figure>
14239 !! end
14240
14241 !! test
14242 Image with caption, T55312 #1
14243 !! wikitext
14244 [[File:Foobar.jpg|right|Caption page stuff]]
14245 !! html/php
14246 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption page stuff"><img alt="Caption page stuff" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
14247
14248 !! html/parsoid
14249 <figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>Caption page stuff</figcaption></figure>
14250 !! end
14251
14252 !! test
14253 Image with caption, T55312 #2
14254 !! wikitext
14255 [[File:Foobar.jpg|right|Caption page=]]
14256 !! html/php
14257 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption page="><img alt="Caption page=" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
14258
14259 !! html/parsoid
14260 <figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>Caption page=</figcaption></figure>
14261 !! end
14262
14263 !! test
14264 Image with caption, T55312 #3
14265 !! wikitext
14266 [[File:Foobar.jpg|right|Caption page=stuff]]
14267 !! html/php
14268 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption page=stuff"><img alt="Caption page=stuff" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
14269
14270 !! html/parsoid
14271 <figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>Caption page=stuff</figcaption></figure>
14272 !! end
14273
14274 !! test
14275 Image caption with pipe entity
14276 !! wikitext
14277 [[File:Foobar.jpg|thumb|one &#x7C; two]]
14278 [[File:Foobar.jpg|thumb|one ''two'' &#x7C; three]]
14279 !! html/php
14280 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>one &#x7c; two</div></div></div>
14281 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>one <i>two</i> &#x7c; three</div></div></div>
14282
14283 !! html/parsoid
14284 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>one <span typeof="mw:Entity">|</span> two</figcaption></figure>
14285 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>one <i>two</i> <span typeof="mw:Entity">|</span> three</figcaption></figure>
14286 !! end
14287
14288 !! test
14289 Allow empty links in image captions (T62753)
14290 !! options
14291 thumbsize=220
14292 !! wikitext
14293 [[File:Foobar.jpg|thumb|Caption [[Link1]]
14294 [[]]
14295 [[Link2]]
14296 ]]
14297 !! html/php
14298 <div class="thumb tright"><div class="thumbinner" style="width:222px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>Caption <a href="/index.php?title=Link1&amp;action=edit&amp;redlink=1" class="new" title="Link1 (page does not exist)">Link1</a> [[]] <a href="/index.php?title=Link2&amp;action=edit&amp;redlink=1" class="new" title="Link2 (page does not exist)">Link2</a></div></div></div>
14299
14300 !! html/parsoid
14301 <figure class="mw-default-size" typeof="mw:Image/Thumb" data-parsoid='{"optList":[{"ck":"thumbnail","ak":"thumb"},{"ck":"caption","ak":"Caption [[Link1]]\n[[]]\n[[Link2]]\n"}]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"25","width":"220"},"sa":{"resource":"File:Foobar.jpg"}}'/></a><figcaption>Caption <a rel="mw:WikiLink" href="./Link1" title="Link1" data-parsoid='{"stx":"simple","a":{"href":"./Link1"},"sa":{"href":"Link1"}}'>Link1</a>
14302 [[]]
14303 <a rel="mw:WikiLink" href="./Link2" title="Link2" data-parsoid='{"stx":"simple","a":{"href":"./Link2"},"sa":{"href":"Link2"}}'>Link2</a>
14304 </figcaption></figure>
14305 !! end
14306
14307 !! test
14308 Titles in unlinked images (T23454)
14309 !! wikitext
14310 [[File:Foobar.jpg|link=|stuff]]
14311 !! html/php
14312 <p><img alt="stuff" src="http://example.com/images/3/3a/Foobar.jpg" title="stuff" width="1941" height="220" />
14313 </p>
14314 !! end
14315
14316 !! test
14317 Link with empty target
14318 !! wikitext
14319 [[]]
14320 !! html
14321 <p>[[]]
14322 </p>
14323 !! end
14324
14325 !! test
14326 Image with link trail
14327 !! wikitext
14328 Linktrails should not work for images: [[File:Foobar.jpg]]s
14329 !! html/php
14330 <p>Linktrails should not work for images: <a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>s
14331 </p>
14332 !! html/parsoid
14333 <p>Linktrails should not work for images: <span class="mw-default-size" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span>s</p>
14334 !! end
14335
14336 !! test
14337 Image with empty attribute
14338 !! options
14339 parsoid=wt2html,wt2wt,html2html
14340 !! wikitext
14341 [[File:Foobar.jpg|right||Caption text]]
14342 !! html/php
14343 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption text"><img alt="Caption text" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
14344
14345 !! html/parsoid
14346 <figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>Caption text</figcaption></figure>
14347 !! end
14348
14349 !! test
14350 1. Block image with individual attributes from templates
14351 !! wikitext
14352 [[File:Foobar.jpg|thumb|{{echo|137px}}|This is a caption]]
14353 !! html/php
14354 <div class="thumb tright"><div class="thumbinner" style="width:139px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/137px-Foobar.jpg" width="137" height="16" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/206px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/274px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>This is a caption</div></div></div>
14355
14356 !! html/parsoid
14357 <figure typeof="mw:Image/Thumb mw:ExpandedAttrs" about="#mwt2" data-parsoid='{"optList":[{"ck":"thumbnail","ak":"thumb"},{"ck":"width","ak":"{{echo|137px}}"},{"ck":"caption","ak":"This is a caption"}]}' data-mw='{"attribs":[["thumbnail",{"html":"thumb"}],["width",{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[24,38,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"137px\"}},\"i\":0}}]}&#39;>137px&lt;/span>"}]]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/137px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="16" width="137" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"16","width":"137"},"sa":{"resource":"File:Foobar.jpg"}}'/></a><figcaption>This is a caption</figcaption></figure>
14358 !! end
14359
14360 !! test
14361 2. Block Image with individual attributes from templates
14362 !! wikitext
14363 [[File:Foobar.jpg|{{echo|thumb}}|{{echo|137px}}|This is a caption]]
14364 !! html/php
14365 <div class="thumb tright"><div class="thumbinner" style="width:139px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/137px-Foobar.jpg" width="137" height="16" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/206px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/274px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>This is a caption</div></div></div>
14366
14367 !! html/parsoid
14368 <figure typeof="mw:Image/Thumb mw:ExpandedAttrs" about="#mwt3" data-parsoid='{"optList":[{"ck":"thumbnail","ak":"{{echo|thumb}}"},{"ck":"width","ak":"{{echo|137px}}"},{"ck":"caption","ak":"This is a caption"}]}' data-mw='{"attribs":[["thumbnail",{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[18,32,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"thumb\"}},\"i\":0}}]}&#39;>thumb&lt;/span>"}],["width",{"html":"&lt;span about=\"#mwt2\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[33,47,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"137px\"}},\"i\":0}}]}&#39;>137px&lt;/span>"}]]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/137px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="16" width="137" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"16","width":"137"},"sa":{"resource":"File:Foobar.jpg"}}'/></a><figcaption>This is a caption</figcaption></figure>
14369 !! end
14370
14371 !! test
14372 3. Inline image with individual attributes from templates
14373 !! wikitext
14374 [[File:Foobar.jpg|{{echo|50px}}]]
14375 !! html/php
14376 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" width="50" height="6" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/75px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/100px-Foobar.jpg 2x" /></a>
14377 </p>
14378 !! html/parsoid
14379 <p><span typeof="mw:Image mw:ExpandedAttrs" about="#mwt2" data-parsoid='{"optList":[{"ck":"width","ak":"{{echo|50px}}"}]}' data-mw='{"attribs":[["width",{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[18,31,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"50px\"}},\"i\":0}}]}&#39;>50px&lt;/span>"}]]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="6" width="50" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"6","width":"50"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
14380 !! end
14381
14382 ## Parsoid does not provide editing support for images where templates produce multiple image attributes.
14383 ## To signal this, we add a 'mw:Placeholder' type to such images. This could change in the future.
14384 !! test
14385 Image with multiple attributes from the same template
14386 !! wikitext
14387 [[File:Foobar.jpg|{{image_attribs}}]]
14388 !! html/php
14389 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption text"><img alt="Caption text" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
14390
14391 !! html/parsoid
14392 <figure class="mw-default-size mw-halign-right" typeof="mw:Image mw:Placeholder"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>Caption text</figcaption></figure>
14393 !! end
14394
14395 !! test
14396 Image with link tails
14397 !! options
14398 thumbsize=220
14399 !! wikitext
14400 123[[File:Foobar.jpg]]456
14401 123[[File:Foobar.jpg|right]]456
14402 123[[File:Foobar.jpg|thumb]]456
14403 !! html/php
14404 <p>123<a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>456
14405 </p>
14406 123<div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>456
14407 123<div class="thumb tright"><div class="thumbinner" style="width:222px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div></div></div></div>456
14408
14409 !! html/php+tidy
14410 <p>123<a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>456</p>
14411 <p>123</p>
14412 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
14413 <p>456 123</p>
14414 <div class="thumb tright">
14415 <div class="thumbinner" style="width:222px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a>
14416 <div class="thumbcaption">
14417 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
14418 </div>
14419 </div>
14420 </div>
14421 <p>456</p>
14422 !! html/parsoid
14423 <p>123<span class="mw-default-size" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span>456</p>
14424 <p>123</p><figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></figure><p>456</p>
14425 <p>123</p><figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a></figure><p>456</p>
14426 !! end
14427
14428 !! test
14429 Image with multiple captions -- only last one is accepted
14430 !! wikitext
14431 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
14432 !! html/php
14433 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption3 - accepted"><img alt="Caption3 - accepted" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
14434
14435 !! html/parsoid
14436 <figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>Caption3 - accepted</figcaption></figure>
14437 !! end
14438
14439 !! test
14440 Image with multiple widths -- use last
14441 !! wikitext
14442 [[File:Foobar.jpg|200px|300px|caption]]
14443 !! html/php
14444 <p><a href="/wiki/File:Foobar.jpg" class="image" title="caption"><img alt="caption" src="http://example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg" width="300" height="34" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/450px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/600px-Foobar.jpg 2x" /></a>
14445 </p>
14446 !! html/parsoid
14447 <p><span typeof="mw:Image" data-mw='{"caption":"caption"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="34" width="300"/></a></span></p>
14448 !! end
14449
14450 !! test
14451 Image with multiple alignments -- use first (T50664)
14452 !! options
14453 thumbsize=220
14454 !! wikitext
14455 [[File:Foobar.jpg|thumb|left|right|center|caption]]
14456
14457 [[File:Foobar.jpg|middle|text-top|caption]]
14458 !! html/php
14459 <div class="thumb tleft"><div class="thumbinner" style="width:222px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>caption</div></div></div>
14460 <p><a href="/wiki/File:Foobar.jpg" class="image" title="caption"><img alt="caption" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" style="vertical-align: middle" /></a>
14461 </p>
14462 !! html/parsoid
14463 <figure class="mw-default-size mw-halign-left" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>caption</figcaption></figure>
14464 <p><span class="mw-default-size mw-valign-middle" typeof="mw:Image" data-mw='{"caption":"caption"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
14465 !! end
14466
14467 !! test
14468 Image with width attribute at different positions
14469 !! wikitext
14470 [[File:Foobar.jpg|200px|right|Caption]]
14471 [[File:Foobar.jpg|right|200px|Caption]]
14472 [[File:Foobar.jpg|right|Caption|200px]]
14473 !! html/php
14474 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption"><img alt="Caption" src="http://example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" width="200" height="23" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/400px-Foobar.jpg 2x" /></a></div>
14475 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption"><img alt="Caption" src="http://example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" width="200" height="23" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/400px-Foobar.jpg 2x" /></a></div>
14476 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption"><img alt="Caption" src="http://example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" width="200" height="23" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/400px-Foobar.jpg 2x" /></a></div>
14477
14478 !! html/parsoid
14479 <figure class="mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="23" width="200"/></a><figcaption>Caption</figcaption></figure>
14480 <figure class="mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="23" width="200"/></a><figcaption>Caption</figcaption></figure>
14481 <figure class="mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="23" width="200"/></a><figcaption>Caption</figcaption></figure>
14482 !! end
14483
14484 # a sad bit of backward-compatibility
14485 !! test
14486 Image with size specified with pxpx (T15500, T53628)
14487 !! options
14488 parsoid=wt2html,wt2wt,html2html
14489 !! wikitext
14490 [[File:Foobar.jpg|20pxpx]]
14491 [[File:Foobar.jpg|200x20pxpx]]
14492 !! html/php
14493 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/20px-Foobar.jpg" width="20" height="2" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/30px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/40px-Foobar.jpg 2x" /></a>
14494 <a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/177px-Foobar.jpg" width="177" height="20" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/265px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/353px-Foobar.jpg 2x" /></a>
14495 </p>
14496 !! html/parsoid
14497 <p><span typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/20px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="2" width="20"/></a></span> <span typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/177px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="20" width="177"/></a></span></p>
14498 !! end
14499
14500 !! test
14501 Image with link parameter, wiki target
14502 !! wikitext
14503 [[File:Foobar.jpg|link=Main Page]]
14504 !! html/php
14505 <p><a href="/wiki/Main_Page" title="Main Page"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
14506 </p>
14507 !! html/parsoid
14508 <p><span class="mw-default-size" typeof="mw:Image"><a href="./Main_Page"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
14509 !! end
14510
14511 # parsoid T51293 (part 1)
14512 !! test
14513 Image with link parameter, URL target
14514 !! wikitext
14515 [[File:Foobar.jpg|link=http://example.com/]]
14516 !! html/php
14517 <p><a href="http://example.com/" rel="nofollow"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
14518 </p>
14519 !! html/parsoid
14520 <p><span class="mw-default-size" typeof="mw:Image"><a href="http://example.com/"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
14521 !! end
14522
14523 # parsoid T51293 (part 2)
14524 !! test
14525 Image with link parameter, protocol-less URL target
14526 !! wikitext
14527 [[File:Foobar.jpg|link=//example.com/]]
14528 !! html/php
14529 <p><a href="//example.com/" rel="nofollow"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
14530 </p>
14531 !! html/parsoid
14532 <p><span class="mw-default-size" typeof="mw:Image"><a href="//example.com/"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
14533 !! end
14534
14535 !! test
14536 Escaping non-block captions (T107435)
14537 !! options
14538 parsoid={
14539 "modes": ["wt2wt"],
14540 "changes": [
14541 ["[typeof~='mw:Image']", "attr", "data-mw", "{\"caption\": \"|\"}"]
14542 ]
14543 }
14544 !! wikitext
14545 [[Image:Foobar.jpg|caption]]
14546 !! wikitext/edited
14547 [[Image:Foobar.jpg|<nowiki>|</nowiki>]]
14548 !! end
14549
14550 # wgExternalLinkTarget not supported by Parsoid
14551 !! test
14552 Image with link parameter, wgExternalLinkTarget
14553 !! wikitext
14554 [[Image:foobar.jpg|link=http://example.com/]]
14555 !! config
14556 wgExternalLinkTarget='foobar'
14557 !! html/php
14558 <p><a href="http://example.com/" target="foobar" rel="nofollow noreferrer noopener"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
14559 </p>
14560 !! end
14561
14562 !! test
14563 Image with link parameter, wgNoFollowLinks set to false
14564 !! wikitext
14565 [[Image:foobar.jpg|link=http://example.com/]]
14566 !! config
14567 wgNoFollowLinks=false
14568 !! html
14569 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
14570 </p>
14571 !! end
14572
14573 !! test
14574 Image with link parameter, wgNoFollowDomainExceptions
14575 !! wikitext
14576 [[Image:foobar.jpg|link=http://example.com/]]
14577 !! config
14578 wgNoFollowDomainExceptions='example.com'
14579 !! html
14580 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
14581 </p>
14582 !! end
14583
14584 # wgExternalLinkTarget not supported by Parsoid
14585 !! test
14586 Image with link parameter, wgExternalLinkTarget, unnamed parameter
14587 !! wikitext
14588 [[Image:foobar.jpg|link=http://example.com/|Title]]
14589 !! config
14590 wgExternalLinkTarget='foobar'
14591 !! html/php
14592 <p><a href="http://example.com/" title="Title" target="foobar" rel="nofollow noreferrer noopener"><img alt="Title" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
14593 </p>
14594 !! end
14595
14596 !! test
14597 Image with empty link parameter
14598 !! wikitext
14599 [[File:Foobar.jpg|link=]]
14600 !! html/php
14601 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
14602 </p>
14603 !! html/parsoid
14604 <p><span class="mw-default-size" typeof="mw:Image"><span><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></span></span></p>
14605 !! end
14606
14607 !! test
14608 Image with link parameter (wiki target) and unnamed parameter
14609 !! wikitext
14610 [[File:Foobar.jpg|link=Main_Page|Title]]
14611 !! html/php
14612 <p><a href="/wiki/Main_Page" title="Title"><img alt="Title" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
14613 </p>
14614 !! html/parsoid
14615 <p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"Title"}'><a href="./Main_Page"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
14616 !! end
14617
14618 !! test
14619 Image with link parameter (URL target) and unnamed parameter
14620 !! wikitext
14621 [[File:Foobar.jpg|link=http://example.com/|Title]]
14622 !! html/php
14623 <p><a href="http://example.com/" title="Title" rel="nofollow"><img alt="Title" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
14624 </p>
14625 !! html/parsoid
14626 <p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"Title"}'><a href="http://example.com/"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
14627 !! end
14628
14629 !! test
14630 Thumbnail image with link parameter
14631 !! options
14632 thumbsize=220
14633 parsoid=wt2html,wt2wt,html2html
14634 !! wikitext
14635 [[File:Foobar.jpg|thumb|link=http://example.com/|Title]]
14636 !! html/php
14637 <div class="thumb tright"><div class="thumbinner" style="width:222px;"><a href="http://example.com/"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>Title</div></div></div>
14638
14639 !! html/parsoid
14640 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="http://example.com/"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>Title</figcaption></figure>
14641 !! end
14642
14643 !! test
14644 Manually-specified thumbnail image
14645 !! options
14646 thumbsize=220
14647 !! wikitext
14648 [[File:Foobar.jpg|thumbnail=Thumb.png|Title]]
14649 !! html/php
14650 <div class="thumb tright"><div class="thumbinner" style="width:137px;"><a href="/wiki/File:Foobar.jpg"><img alt="" src="http://example.com/images/e/ea/Thumb.png" width="135" height="135" class="thumbimage" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>Title</div></div></div>
14651
14652 !! html/parsoid
14653 <figure class="mw-default-size" typeof="mw:Image/Thumb" data-mw='{"thumb":"Thumb.png"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/e/ea/Thumb.png" data-file-width="135" data-file-height="135" data-file-type="bitmap" height="135" width="135"/></a><figcaption>Title</figcaption></figure>
14654 !! end
14655
14656 !! test
14657 Manually-specified thumbnail image with explicit link to wiki page
14658 !! options
14659 thumbsize=220
14660 parsoid=wt2html,wt2wt,html2html
14661 !! wikitext
14662 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|Title]]
14663 !! html/php
14664 <div class="thumb tright"><div class="thumbinner" style="width:137px;"><a href="/wiki/Main_Page" title="Main Page"><img alt="" src="http://example.com/images/e/ea/Thumb.png" width="135" height="135" class="thumbimage" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>Title</div></div></div>
14665
14666 !! html/parsoid
14667 <figure class="mw-default-size" typeof="mw:Image/Thumb" data-mw='{"thumb":"Thumb.png"}'><a href="./Main_Page"><img resource="./File:Foobar.jpg" src="//example.com/images/e/ea/Thumb.png" data-file-width="135" data-file-height="135" data-file-type="bitmap" height="135" width="135"/></a><figcaption>Title</figcaption></figure>
14668 !! end
14669
14670 !! test
14671 Manually-specified thumbnail image with explicit link to url
14672 !! options
14673 thumbsize=220
14674 parsoid=wt2html,wt2wt,html2html
14675 !! wikitext
14676 [[File:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
14677 !! html/php
14678 <div class="thumb tright"><div class="thumbinner" style="width:137px;"><a href="http://example.com"><img alt="" src="http://example.com/images/e/ea/Thumb.png" width="135" height="135" class="thumbimage" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>Title</div></div></div>
14679
14680 !! html/parsoid
14681 <figure class="mw-default-size" typeof="mw:Image/Thumb" data-mw='{"thumb":"Thumb.png"}'><a href="http://example.com"><img resource="./File:Foobar.jpg" src="//example.com/images/e/ea/Thumb.png" data-file-width="135" data-file-height="135" data-file-type="bitmap" height="135" width="135"/></a><figcaption>Title</figcaption></figure>
14682 !! end
14683
14684 !! test
14685 Manually-specified thumbnail image with explicit no link
14686 !! options
14687 thumbsize=220
14688 parsoid=wt2html,wt2wt,html2html
14689 !! wikitext
14690 [[File:Foobar.jpg|thumb=Thumb.png|link=|Title]]
14691 !! html/php
14692 <div class="thumb tright"><div class="thumbinner" style="width:137px;"><img alt="" src="http://example.com/images/e/ea/Thumb.png" width="135" height="135" class="thumbimage" /> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>Title</div></div></div>
14693
14694 !! html/parsoid
14695 <figure class="mw-default-size" typeof="mw:Image/Thumb" data-mw='{"thumb":"Thumb.png"}'><span><img resource="./File:Foobar.jpg" src="//example.com/images/e/ea/Thumb.png" data-file-width="135" data-file-height="135" data-file-type="bitmap" height="135" width="135"/></span><figcaption>Title</figcaption></figure>
14696 !! end
14697
14698 !! test
14699 Manually-specified thumbnail image with explicit link and alt text
14700 !! options
14701 thumbsize=220
14702 parsoid=wt2html,wt2wt,html2html
14703 !! wikitext
14704 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|alt=alttext|Title]]
14705 !! html/php
14706 <div class="thumb tright"><div class="thumbinner" style="width:137px;"><a href="/wiki/Main_Page" title="Main Page"><img alt="alttext" src="http://example.com/images/e/ea/Thumb.png" width="135" height="135" class="thumbimage" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>Title</div></div></div>
14707
14708 !! html/parsoid
14709 <figure class="mw-default-size" typeof="mw:Image/Thumb" data-mw='{"thumb":"Thumb.png"}'><a href="./Main_Page"><img alt="alttext" resource="./File:Foobar.jpg" src="//example.com/images/e/ea/Thumb.png" data-file-width="135" data-file-height="135" data-file-type="bitmap" height="135" width="135"/></a><figcaption>Title</figcaption></figure>
14710 !! end
14711
14712 !! test
14713 Image with frame and link
14714 !! options
14715 parsoid=wt2html,wt2wt,html2html
14716 !! wikitext
14717 [[File:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
14718 !! html/php
14719 <div class="thumb tleft"><div class="thumbinner" style="width:1943px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="thumbimage" /></a> <div class="thumbcaption">This is a test image <a href="/wiki/Main_Page" title="Main Page">Main Page</a></div></div></div>
14720
14721 !! html/parsoid
14722 <figure class="mw-default-size mw-halign-left" typeof="mw:Image/Frame"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>This is a test image <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a></figcaption></figure>
14723 !! end
14724
14725 !! test
14726 Image with frame and link and explicit alt
14727 !! options
14728 parsoid=wt2html,wt2wt,html2html
14729 !! wikitext
14730 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
14731 !! html/php
14732 <div class="thumb tleft"><div class="thumbinner" style="width:1943px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Altitude" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="thumbimage" /></a> <div class="thumbcaption">This is a test image <a href="/wiki/Main_Page" title="Main Page">Main Page</a></div></div></div>
14733
14734 !! html/parsoid
14735 <figure class="mw-default-size mw-halign-left" typeof="mw:Image/Frame"><a href="./File:Foobar.jpg"><img alt="Altitude" resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>This is a test image <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a></figcaption></figure>
14736 !! end
14737
14738 !! test
14739 Image with wiki markup in implicit alt
14740 !! wikitext
14741 [[Image:Foobar.jpg|testing '''bold''' in alt]]
14742
14743 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
14744 !! html/php
14745 <p><a href="/wiki/File:Foobar.jpg" class="image" title="testing bold in alt"><img alt="testing bold in alt" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
14746 </p><p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="testing bold in alt" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
14747 </p>
14748 !! html/parsoid
14749 <p><span class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"testing &#39;&#39;&#39;bold&#39;&#39;&#39; in alt"}]}' data-mw='{"caption":"testing &lt;b data-parsoid=&#39;{\"dsr\":[27,37,3,3]}&#39;>bold&lt;/b> in alt"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"Image:Foobar.jpg"}}'/></a></span></p>
14750
14751 <p><span class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"alt","ak":"alt=testing &#39;&#39;&#39;bold&#39;&#39;&#39; in alt"}]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img alt="testing bold in alt" resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"alt":"testing bold in alt","resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"alt":"alt=testing &#39;&#39;&#39;bold&#39;&#39;&#39; in alt","resource":"Image:Foobar.jpg"}}'/></a></span></p>
14752 !! end
14753
14754 !! test
14755 Alt image option should handle most kinds of wikitext without barfing
14756 !! wikitext
14757 [[Image:Foobar.jpg|thumb|This is the image caption|alt=This is a [[link]] and a {{echo|''bold template''}}.]]
14758 !! html/php
14759 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="This is a link and a bold template." src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>This is the image caption</div></div></div>
14760
14761 !! html/parsoid
14762 <figure class="mw-default-size" typeof="mw:Image/Thumb mw:ExpandedAttrs" about="#mwt2" data-parsoid='{"optList":[{"ck":"thumbnail","ak":"thumb"},{"ck":"caption","ak":"This is the image caption"},{"ck":"alt","ak":"alt=This is a [[link]] and a {{echo|&#39;&#39;bold template&#39;&#39;}}."}]}' data-mw='{"attribs":[["thumbnail",{"html":"thumb"}],["alt",{"html":"alt=This is a &lt;a rel=\"mw:WikiLink\" href=\"./Link\" title=\"Link\" data-parsoid=&#39;{\"stx\":\"simple\",\"a\":{\"href\":\"./Link\"},\"sa\":{\"href\":\"link\"},\"dsr\":[65,73,2,2]}&#39;>link&lt;/a> and a &lt;i about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"dsr\":[80,106,null,null],\"pi\":[[{\"k\":\"1\"}]]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"&amp;#39;&amp;#39;bold template&amp;#39;&amp;#39;\"}},\"i\":0}}]}&#39;>bold template&lt;/i>."}]]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img alt="This is a link and a bold template." resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220" data-parsoid='{"a":{"alt":"This is a link and a bold template.","resource":"./File:Foobar.jpg","height":"25","width":"220"},"sa":{"alt":"alt=This is a [[link]] and a {{echo|&#39;&#39;bold template&#39;&#39;}}.","resource":"Image:Foobar.jpg"}}'/></a><figcaption>This is the image caption</figcaption></figure>
14763 !! end
14764
14765 ###################
14766 # Conflicting image format options.
14767 # First option specified should 'win'.
14768 # All three cases in each test should be identical.
14769
14770 !! test
14771 Image with 'frameless' first.
14772 !! options
14773 parsoid=wt2html,wt2wt,html2html
14774 !! wikitext
14775 [[File:Foobar.jpg|frameless|caption]]
14776
14777 [[File:Foobar.jpg|frameless|frame|caption]]
14778
14779 [[File:Foobar.jpg|frameless|thumb|caption]]
14780 !! html/php
14781 <p><a href="/wiki/File:Foobar.jpg" class="image" title="caption"><img alt="caption" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a>
14782 </p><p><a href="/wiki/File:Foobar.jpg" class="image" title="caption"><img alt="caption" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a>
14783 </p><p><a href="/wiki/File:Foobar.jpg" class="image" title="caption"><img alt="caption" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a>
14784 </p>
14785 !! html/parsoid
14786 <p><span class="mw-default-size" typeof="mw:Image/Frameless" data-mw='{"caption":"caption"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a></span></p>
14787 <p><span class="mw-default-size" typeof="mw:Image/Frameless" data-mw='{"caption":"caption"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a></span></p>
14788 <p><span class="mw-default-size" typeof="mw:Image/Frameless" data-mw='{"caption":"caption"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a></span></p>
14789 !! end
14790
14791 !! test
14792 Image with 'frame' first.
14793 !! options
14794 parsoid=wt2html,wt2wt,html2html
14795 !! wikitext
14796 [[File:Foobar.jpg|frame|caption]]
14797 [[File:Foobar.jpg|frame|frameless|caption]]
14798 [[File:Foobar.jpg|frame|thumb|caption]]
14799 !! html/php
14800 <div class="thumb tright"><div class="thumbinner" style="width:1943px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="thumbimage" /></a> <div class="thumbcaption">caption</div></div></div>
14801 <div class="thumb tright"><div class="thumbinner" style="width:1943px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="thumbimage" /></a> <div class="thumbcaption">caption</div></div></div>
14802 <div class="thumb tright"><div class="thumbinner" style="width:1943px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="thumbimage" /></a> <div class="thumbcaption">caption</div></div></div>
14803
14804 !! html/parsoid
14805 <figure class="mw-default-size" typeof="mw:Image/Frame"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>caption</figcaption></figure>
14806 <figure class="mw-default-size" typeof="mw:Image/Frame"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>caption</figcaption></figure>
14807 <figure class="mw-default-size" typeof="mw:Image/Frame"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>caption</figcaption></figure>
14808 !! end
14809
14810 !! test
14811 Image with 'thumb' first.
14812 !! options
14813 parsoid=wt2html,wt2wt,html2html
14814 !! wikitext
14815 [[File:Foobar.jpg|thumb|caption]]
14816 [[File:Foobar.jpg|thumb|frameless|caption]]
14817 [[File:Foobar.jpg|thumb|frame|caption]]
14818 !! html/php
14819 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>caption</div></div></div>
14820 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>caption</div></div></div>
14821 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>caption</div></div></div>
14822
14823 !! html/parsoid
14824 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>caption</figcaption></figure>
14825 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>caption</figcaption></figure>
14826 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>caption</figcaption></figure>
14827 !! end
14828
14829 ###################
14830 # Image sizing.
14831 # See https://www.mediawiki.org/wiki/Help:Images#Size_and_frame
14832 # and https://phabricator.wikimedia.org/T64258
14833 # Foobar has actual size of 1941x220
14834 # 1. Thumbs & frameless always reduce, can't be enlarged unless it's
14835 # a scalable format.
14836 # 2. Framed images always ignore size options; always render at default size.
14837 # 3. "Unspecified format" and border are the only types which can be
14838 # enlarged.
14839
14840 !! test
14841 Image: unspecified format and border enlarge
14842 !! options
14843 parsoid=wt2html,wt2wt,html2html
14844 !! wikitext
14845 [[File:Foobar.jpg|2000px]]
14846
14847 [[File:Foobar.jpg|border|2000px]]
14848 !! html/php
14849 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="2000" height="227" /></a>
14850 </p><p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="2000" height="227" class="thumbborder" /></a>
14851 </p>
14852 !! html/parsoid
14853 <p><span typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="227" width="2000"/></a></span></p>
14854 <p><span class="mw-image-border" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="227" width="2000"/></a></span></p>
14855 !! end
14856
14857 !! test
14858 Image: "unspecified format" and border reduce
14859 !! options
14860 parsoid=wt2html,wt2wt,html2html
14861 !! wikitext
14862 [[File:Foobar.jpg|1000px]]
14863
14864 [[File:Foobar.jpg|border|1000px]]
14865 !! html/php
14866 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/1000px-Foobar.jpg" width="1000" height="113" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/1500px-Foobar.jpg 1.5x, http://example.com/images/3/3a/Foobar.jpg 2x" /></a>
14867 </p><p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/1000px-Foobar.jpg" width="1000" height="113" class="thumbborder" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/1500px-Foobar.jpg 1.5x, http://example.com/images/3/3a/Foobar.jpg 2x" /></a>
14868 </p>
14869 !! html/parsoid
14870 <p><span typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/1000px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="113" width="1000"/></a></span></p>
14871 <p><span class="mw-image-border" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/1000px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="113" width="1000"/></a></span></p>
14872 !! end
14873
14874 !! test
14875 Image: thumbs reduce
14876 !! options
14877 parsoid=wt2html,wt2wt,html2html
14878 !! wikitext
14879 [[File:Foobar.jpg|thumb|50px]]
14880 !! html/php
14881 <div class="thumb tright"><div class="thumbinner" style="width:52px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" width="50" height="6" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/75px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/100px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div></div></div></div>
14882
14883 !! html/parsoid
14884 <figure typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="6" width="50"/></a></figure>
14885 !! end
14886
14887 !! test
14888 Image: bitmap thumbs can't be enlarged past original size, but vector can.
14889 !! options
14890 parsoid=wt2html,wt2wt,html2html
14891 !! wikitext
14892 [[File:Foobar.jpg|thumb|2000px]]
14893
14894 [[File:Foobar.svg|thumb|2000px]]
14895 !! html/php
14896 <div class="thumb tright"><div class="thumbinner" style="width:1943px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="thumbimage" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div></div></div></div>
14897 <div class="thumb tright"><div class="thumbinner" style="width:2002px;"><a href="/wiki/File:Foobar.svg" class="image"><img alt="Foobar.svg" src="http://example.com/images/thumb/f/ff/Foobar.svg/2000px-Foobar.svg.png" width="2000" height="1500" class="thumbimage" srcset="http://example.com/images/thumb/f/ff/Foobar.svg/3000px-Foobar.svg.png 1.5x, http://example.com/images/thumb/f/ff/Foobar.svg/4000px-Foobar.svg.png 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.svg" class="internal" title="Enlarge"></a></div></div></div></div>
14898
14899 !! html/parsoid
14900 <figure typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></figure>
14901 <figure typeof="mw:Image/Thumb"><a href="./File:Foobar.svg"><img resource="./File:Foobar.svg" src="//example.com/images/thumb/f/ff/Foobar.svg/2000px-Foobar.svg.png" data-file-width="240" data-file-height="180" data-file-type="drawing" height="1500" width="2000"/></a></figure>
14902 !! end
14903
14904 !! test
14905 Image: frameless can reduce in size
14906 !! options
14907 parsoid=wt2html,wt2wt,html2html
14908 !! wikitext
14909 [[File:Foobar.jpg|frameless|50px]]
14910 !! html/php
14911 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" width="50" height="6" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/75px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/100px-Foobar.jpg 2x" /></a>
14912 </p>
14913 !! html/parsoid
14914 <p><span typeof="mw:Image/Frameless"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="6" width="50"/></a></span></p>
14915 !! end
14916
14917 !! test
14918 Image: bitmap frameless can't be enlarged past original size, but vector can
14919 !! options
14920 parsoid=wt2html,wt2wt,html2html
14921 !! wikitext
14922 [[File:Foobar.jpg|frameless|2000px]]
14923
14924 [[File:Foobar.svg|frameless|2000px]]
14925 !! html/php
14926 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
14927 </p><p><a href="/wiki/File:Foobar.svg" class="image"><img alt="Foobar.svg" src="http://example.com/images/thumb/f/ff/Foobar.svg/2000px-Foobar.svg.png" width="2000" height="1500" srcset="http://example.com/images/thumb/f/ff/Foobar.svg/3000px-Foobar.svg.png 1.5x, http://example.com/images/thumb/f/ff/Foobar.svg/4000px-Foobar.svg.png 2x" /></a>
14928 </p>
14929 !! html/parsoid
14930 <p><span typeof="mw:Image/Frameless"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
14931 <p><span typeof="mw:Image/Frameless"><a href="./File:Foobar.svg"><img resource="./File:Foobar.svg" src="//example.com/images/thumb/f/ff/Foobar.svg/2000px-Foobar.svg.png" data-file-width="240" data-file-height="180" data-file-type="drawing" height="1500" width="2000"/></a></span></p>
14932 !! end
14933
14934 !! test
14935 Image: framed images are always unscaled.
14936 !! options
14937 parsoid=wt2html,wt2wt,html2html
14938 !! wikitext
14939 [[File:Foobar.jpg|frame]]
14940
14941 [[File:Foobar.jpg|frame|50px]]
14942
14943 [[File:Foobar.jpg|frame|50x50px]]
14944
14945 [[File:Foobar.jpg|frame|2000px]]
14946 !! html/php
14947 <div class="thumb tright"><div class="thumbinner" style="width:1943px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="thumbimage" /></a> <div class="thumbcaption"></div></div></div>
14948 <div class="thumb tright"><div class="thumbinner" style="width:1943px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="thumbimage" /></a> <div class="thumbcaption"></div></div></div>
14949 <div class="thumb tright"><div class="thumbinner" style="width:1943px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="thumbimage" /></a> <div class="thumbcaption"></div></div></div>
14950 <div class="thumb tright"><div class="thumbinner" style="width:1943px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="thumbimage" /></a> <div class="thumbcaption"></div></div></div>
14951
14952 !! html/parsoid
14953 <figure class="mw-default-size" typeof="mw:Image/Frame"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></figure>
14954 <figure typeof="mw:Image/Frame"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></figure>
14955 <figure typeof="mw:Image/Frame"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></figure>
14956 <figure typeof="mw:Image/Frame"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></figure>
14957 !! end
14958
14959 ###################
14960
14961 !! test
14962 Link to image page- image page normally doesn't exists, hence edit link
14963 Add test with existing image page
14964 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
14965 !! wikitext
14966 [[:Image:test]]
14967 !! html
14968 <p><a href="/index.php?title=File:Test&amp;action=edit&amp;redlink=1" class="new" title="File:Test (page does not exist)">Image:test</a>
14969 </p>
14970 !! end
14971
14972 !! test
14973 T20784 Link to non-existent image page with caption should use caption as link text
14974 !! wikitext
14975 [[:Image:test|caption]]
14976 !! html
14977 <p><a href="/index.php?title=File:Test&amp;action=edit&amp;redlink=1" class="new" title="File:Test (page does not exist)">caption</a>
14978 </p>
14979 !! end
14980
14981 !! test
14982 Frameless image caption with a free URL
14983 !! wikitext
14984 [[File:Foobar.jpg|http://example.com]]
14985 !! html/php
14986 <p><a href="/wiki/File:Foobar.jpg" class="image" title="http://example.com"><img alt="http://example.com" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
14987 </p>
14988 !! html/parsoid
14989 <p><span class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"http://example.com"}]}' data-mw='{"caption":"&lt;a rel=\"mw:ExtLink\" href=\"http://example.com\" data-parsoid=&#39;{\"stx\":\"url\",\"dsr\":[18,36,0,0]}&#39;>http://example.com&lt;/a>"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
14990 !! end
14991
14992 !! test
14993 Thumbnail image caption with a free URL
14994 !! options
14995 thumbsize=220
14996 !! wikitext
14997 [[File:Foobar.jpg|thumb|http://example.com]]
14998 !! html/php
14999 <div class="thumb tright"><div class="thumbinner" style="width:222px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></div></div></div>
15000
15001 !! html/parsoid
15002 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></figcaption></figure>
15003 !! end
15004
15005 !! test
15006 Thumbnail image caption with a free URL and explicit alt
15007 !! options
15008 thumbsize=220
15009 parsoid=wt2html,wt2wt,html2html
15010 !! wikitext
15011 [[File:Foobar.jpg|thumb|http://example.com|alt=Alteration]]
15012 !! html/php
15013 <div class="thumb tright"><div class="thumbinner" style="width:222px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Alteration" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></div></div></div>
15014
15015 !! html/parsoid
15016 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img alt="Alteration" resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></figcaption></figure>
15017 !! end
15018
15019 !! test
15020 SVG thumbnails with no language set
15021 !! options
15022 !! wikitext
15023 [[File:Foobar.svg|thumb|caption]]
15024 !! html/php
15025 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.svg" class="image"><img alt="" src="http://example.com/images/thumb/f/ff/Foobar.svg/180px-Foobar.svg.png" width="180" height="135" class="thumbimage" srcset="http://example.com/images/thumb/f/ff/Foobar.svg/270px-Foobar.svg.png 1.5x, http://example.com/images/thumb/f/ff/Foobar.svg/360px-Foobar.svg.png 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.svg" class="internal" title="Enlarge"></a></div>caption</div></div></div>
15026
15027 !! html/parsoid
15028 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.svg"><img resource="./File:Foobar.svg" src="//example.com/images/thumb/f/ff/Foobar.svg/220px-Foobar.svg.png" data-file-width="240" data-file-height="180" data-file-type="drawing" height="165" width="220"/></a><figcaption>caption</figcaption></figure>
15029 !! end
15030
15031 !! test
15032 SVG thumbnails with language de
15033 !! options
15034 parsoid=wt2html,wt2wt,html2html
15035 !! wikitext
15036 [[File:Foobar.svg|thumb|caption|lang=de]]
15037 !! html/php
15038 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/index.php?title=File:Foobar.svg&amp;lang=de" class="image"><img alt="" src="http://example.com/images/thumb/f/ff/Foobar.svg/langde-180px-Foobar.svg.png" width="180" height="135" class="thumbimage" srcset="http://example.com/images/thumb/f/ff/Foobar.svg/langde-270px-Foobar.svg.png 1.5x, http://example.com/images/thumb/f/ff/Foobar.svg/langde-360px-Foobar.svg.png 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.svg" class="internal" title="Enlarge"></a></div>caption</div></div></div>
15039
15040 !! html/parsoid
15041 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.svg"><img resource="./File:Foobar.svg" src="//example.com/images/thumb/f/ff/Foobar.svg/220px-Foobar.svg.png" lang="de" data-file-width="240" data-file-height="180" data-file-type="drawing" height="165" width="220"/></a><figcaption>caption</figcaption></figure>
15042 !! end
15043
15044 !! test
15045 SVG thumbnails with invalid language code
15046 !! options
15047 parsoid=wt2html,wt2wt,html2html
15048 !! wikitext
15049 [[File:Foobar.svg|thumb|caption|lang=invalid.language.code]]
15050 !! html/php
15051 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.svg" class="image"><img alt="" src="http://example.com/images/thumb/f/ff/Foobar.svg/180px-Foobar.svg.png" width="180" height="135" class="thumbimage" srcset="http://example.com/images/thumb/f/ff/Foobar.svg/270px-Foobar.svg.png 1.5x, http://example.com/images/thumb/f/ff/Foobar.svg/360px-Foobar.svg.png 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.svg" class="internal" title="Enlarge"></a></div>lang=invalid.language.code</div></div></div>
15052
15053 !! html/parsoid
15054 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.svg"><img resource="./File:Foobar.svg" src="//example.com/images/f/ff/Foobar.svg" data-file-width="240" data-file-height="180" data-file-type="drawing" height="165" width="220"/></a><figcaption>lang=invalid.language.code</figcaption></figure>
15055 !! end
15056
15057 !! test
15058 T3887: A ISBN with a thumbnail
15059 !! wikitext
15060 [[File:Foobar.jpg|thumb|ISBN 1235467890]]
15061 !! html/php
15062 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div><a href="/wiki/Special:BookSources/1235467890" class="internal mw-magiclink-isbn">ISBN 1235467890</a></div></div></div>
15063
15064 !! html/parsoid
15065 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption><a href="./Special:BookSources/1235467890" rel="mw:WikiLink">ISBN 1235467890</a></figcaption></figure>
15066 !! end
15067
15068 !! test
15069 T3887: A RFC with a thumbnail
15070 !! wikitext
15071 [[File:Foobar.jpg|thumb|This is RFC 12354]]
15072 !! html/php
15073 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>This is <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc12354">RFC 12354</a></div></div></div>
15074
15075 !! html/parsoid
15076 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>This is <a href="//tools.ietf.org/html/rfc12354" rel="mw:ExtLink">RFC 12354</a></figcaption></figure>
15077 !! end
15078
15079 !! test
15080 T3887: A mailto link with a thumbnail
15081 !! wikitext
15082 [[File:Foobar.jpg|thumb|Please mailto:nobody@example.com]]
15083 !! html/php
15084 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>Please <a rel="nofollow" class="external free" href="mailto:nobody@example.com">mailto:nobody@example.com</a></div></div></div>
15085
15086 !! html/parsoid
15087 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>Please <a rel="mw:ExtLink" href="mailto:nobody@example.com">mailto:nobody@example.com</a></figcaption></figure>
15088 !! end
15089
15090 # Pending resolution to T2368
15091 !! test
15092 T2648: Frameless image caption with a link
15093 !! wikitext
15094 [[File:Foobar.jpg|text with a [[link]] in it]]
15095 !! html/php
15096 <p><a href="/wiki/File:Foobar.jpg" class="image" title="text with a link in it"><img alt="text with a link in it" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
15097 </p>
15098 !! html/parsoid
15099 <p><span class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"text with a [[link]] in it"}]}' data-mw='{"caption":"text with a &lt;a rel=\"mw:WikiLink\" href=\"./Link\" title=\"Link\" data-parsoid=&#39;{\"stx\":\"simple\",\"a\":{\"href\":\"./Link\"},\"sa\":{\"href\":\"link\"},\"dsr\":[30,38,2,2]}&#39;>link&lt;/a> in it"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
15100 !! end
15101
15102 !! test
15103 T2648: Frameless image caption with a link (suffix)
15104 !! wikitext
15105 [[File:Foobar.jpg|text with a [[link]]foo in it]]
15106 !! html/php
15107 <p><a href="/wiki/File:Foobar.jpg" class="image" title="text with a linkfoo in it"><img alt="text with a linkfoo in it" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
15108 </p>
15109 !! html/parsoid
15110 <p><span class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"text with a [[link]]foo in it"}]}' data-mw='{"caption":"text with a &lt;a rel=\"mw:WikiLink\" href=\"./Link\" title=\"Link\" data-parsoid=&#39;{\"stx\":\"simple\",\"a\":{\"href\":\"./Link\"},\"sa\":{\"href\":\"link\"},\"dsr\":[30,41,2,5],\"tail\":\"foo\"}&#39;>linkfoo&lt;/a> in it"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
15111 !! end
15112
15113 !! test
15114 T2648: Frameless image caption with an interwiki link
15115 !! wikitext
15116 [[File:Foobar.jpg|text with a [[MeatBall:Link]] in it]]
15117 !! html/php
15118 <p><a href="/wiki/File:Foobar.jpg" class="image" title="text with a MeatBall:Link in it"><img alt="text with a MeatBall:Link in it" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
15119 </p>
15120 !! html/parsoid
15121 <p><span class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"text with a [[MeatBall:Link]] in it"}]}' data-mw='{"caption":"text with a &lt;a rel=\"mw:ExtLink\" href=\"http://www.usemod.com/cgi-bin/mb.pl?Link\" title=\"meatball:Link\" data-parsoid=&#39;{\"stx\":\"simple\",\"a\":{\"href\":\"http://www.usemod.com/cgi-bin/mb.pl?Link\"},\"sa\":{\"href\":\"MeatBall:Link\"},\"isIW\":true,\"dsr\":[30,47,2,2]}&#39;>MeatBall:Link&lt;/a> in it"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
15122 !! end
15123
15124 !! test
15125 T2648: Frameless image caption with a piped interwiki link
15126 !! wikitext
15127 [[File:Foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
15128 !! html/php
15129 <p><a href="/wiki/File:Foobar.jpg" class="image" title="text with a link in it"><img alt="text with a link in it" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
15130 </p>
15131 !! html/parsoid
15132 <p><span class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"text with a [[MeatBall:Link|link]] in it"}]}' data-mw='{"caption":"text with a &lt;a rel=\"mw:ExtLink\" href=\"http://www.usemod.com/cgi-bin/mb.pl?Link\" title=\"meatball:Link\" data-parsoid=&#39;{\"stx\":\"piped\",\"a\":{\"href\":\"http://www.usemod.com/cgi-bin/mb.pl?Link\"},\"sa\":{\"href\":\"MeatBall:Link\"},\"isIW\":true,\"dsr\":[30,52,16,2]}&#39;>link&lt;/a> in it"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
15133 !! end
15134
15135 !! test
15136 T107474: Frameless image caption with <nowiki>
15137 !! wikitext
15138 [[File:Foobar.jpg|<nowiki>text with a [[MeatBall:Link|link]] in it</nowiki>]]
15139 !! html/parsoid
15140 <p><span class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"&lt;nowiki>text with a [[MeatBall:Link|link]] in it&lt;/nowiki>"}]}' data-mw='{"caption":"&lt;span typeof=\"mw:Nowiki\" data-parsoid=&#39;{\"dsr\":[18,75,8,9]}&#39;>text with a [[MeatBall:Link|link]] in it&lt;/span>"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
15141 !! end
15142
15143 !! test
15144 Escape HTML special chars in image alt text
15145 !! wikitext
15146 [[File:Foobar.jpg|& < > "]]
15147 !! html/php
15148 <p><a href="/wiki/File:Foobar.jpg" class="image" title="&amp; &lt; &gt; &quot;"><img alt="&amp; &lt; &gt; &quot;" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
15149 </p>
15150 !! html/parsoid
15151 <p><span class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"&amp; &lt; > \""}]}' data-mw='{"caption":"&amp;amp; &amp;lt; > \""}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
15152 !! end
15153
15154 !! test
15155 Escape HTML special chars in image alt text with LanguageConverter
15156 !! options
15157 language=zh
15158 !! wikitext
15159 [[File:Foobar.jpg|& < > "]]
15160 !! html/php
15161 <p><a href="/wiki/File:Foobar.jpg" class="image" title="&amp; &lt; &gt; &quot;"><img alt="&amp; &lt; &gt; &quot;" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
15162 </p>
15163 !! html/parsoid
15164 <p><span class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"&amp; &lt; > \""}]}' data-mw='{"caption":"&amp;amp; &amp;lt; > \""}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
15165 !! end
15166
15167 !! test
15168 Entities in file name and attributes
15169 !! wikitext
15170 [[File:7%25 solution.gif|manualthumb=7%25 solution.gif|link=7%25 solution|[[7%25 solution]]]]
15171 !! html/php
15172 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=7%25_solution.gif" class="new" title="File:7% solution.gif">7% solution</a>
15173 </p>
15174 !! html/parsoid
15175 <p><span class="mw-default-size" typeof="mw:Error mw:Image" data-parsoid='{"optList":[{"ck":"bogus","ak":"manualthumb=7%25 solution.gif"},{"ck":"link","ak":"link=7%25 solution"},{"ck":"caption","ak":"[[7%25 solution]]"}]}' data-mw='{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}],"caption":"&lt;a rel=\"mw:WikiLink\" href=\"./7%25_solution\" title=\"7% solution\" data-parsoid=&#39;{\"stx\":\"simple\",\"a\":{\"href\":\"./7%25_solution\"},\"sa\":{\"href\":\"7%25 solution\"},\"dsr\":[74,91,2,2]}&#39;>7% solution&lt;/a>"}'><a href="./7%25_solution" data-parsoid='{"a":{"href":"./7%25_solution"},"sa":{"href":"link=7%25 solution"}}'><img resource="./File:7%25_solution.gif" src="./Special:FilePath/7%25_solution.gif" height="220" width="220" data-parsoid='{"a":{"resource":"./File:7%25_solution.gif","height":"220","width":"220"},"sa":{"resource":"File:7%25 solution.gif"}}'/></a></span></p>
15176 !! end
15177
15178 !! test
15179 T2499: Alt text should have &#1234;, not &amp;1234;
15180 !! wikitext
15181 [[File:Foobar.jpg|&#9792;]]
15182 !! html/php
15183 <p><a href="/wiki/File:Foobar.jpg" class="image" title="♀"><img alt="♀" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
15184 </p>
15185 !! html/parsoid
15186 <p><span class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"&amp;#9792;"}]}' data-mw='{"caption":"&lt;span typeof=\"mw:Entity\" data-parsoid=&#39;{\"src\":\"&amp;amp;#9792;\",\"srcContent\":\"♀\",\"dsr\":[18,25,null,null]}&#39;>♀&lt;/span>"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
15187 !! end
15188
15189 !! test
15190 Broken image caption with link
15191 !! options
15192 parsoid=wt2html,wt2wt,html2html
15193 !! wikitext
15194 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
15195 !! html/php
15196 <p>[[Image:Foobar.jpg|thumb|This is a broken caption. But <a href="/wiki/Main_Page" title="Main Page">this</a> is just an ordinary link.
15197 </p>
15198 !! html/parsoid
15199 <p>[[Image:Foobar.jpg|thumb|This is a broken caption. But <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">this</a> is just an ordinary link.</p>
15200 !! end
15201
15202 !! test
15203 Image caption containing another image
15204 !! wikitext
15205 [[File:Foobar.jpg|thumb|This is a caption with another [[File:Thumb.png|image]] inside it!]]
15206 !! html/php
15207 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>This is a caption with another <a href="/wiki/File:Thumb.png" class="image" title="image"><img alt="image" src="http://example.com/images/e/ea/Thumb.png" width="135" height="135" /></a> inside it!</div></div></div>
15208
15209 !! html/parsoid
15210 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>This is a caption with another <span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"image"}'><a href="./File:Thumb.png"><img resource="./File:Thumb.png" src="//example.com/images/e/ea/Thumb.png" data-file-width="135" data-file-height="135" data-file-type="bitmap" height="135" width="135"/></a></span> inside it!</figcaption></figure>
15211 !! end
15212
15213 !! test
15214 Image: caption containing a newline
15215 !! wikitext
15216 [[File:Foobar.jpg|This
15217 *is some text]]
15218 !! html/php
15219 <p><a href="/wiki/File:Foobar.jpg" class="image" title="This *is some text"><img alt="This *is some text" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
15220 </p>
15221 !! html/parsoid
15222 <p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"This\n*is some text"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
15223 !!end
15224
15225 !!test
15226 Image: caption containing leading space
15227 (The leading space should not trigger nowiki escaping in wt2wt mode)
15228 !! wikitext
15229 [[File:Foobar.jpg|thumb| bar]]
15230 !! html/php
15231 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>bar</div></div></div>
15232
15233 !! html/parsoid
15234 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption> bar</figcaption></figure>
15235 !!end
15236
15237 !! test
15238 Image: caption containing a table
15239 !! options
15240 parsoid=wt2html,wt2wt,html2html
15241 !! wikitext
15242 [[Image:Foobar.jpg|thumb|200px|This is an example image thumbnail caption with a table
15243 {|
15244 ! Foo !! Bar
15245 |-
15246 | Foo1 || Bar1
15247 |}
15248 and some more text.]]
15249 !! html/php
15250 <div class="thumb tright"><div class="thumbinner" style="width:202px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" width="200" height="23" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/400px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>This is an example image thumbnail caption with a table <table> <tr> <th> Foo </th> <th> Bar </th></tr> <tr> <td> Foo1 </td> <td> Bar1 </td></tr></table> and some more text.</div></div></div>
15251
15252 !! html/parsoid
15253 <figure typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="23" width="200"/></a><figcaption>This is an example image thumbnail caption with a table
15254 <table>
15255 <tbody>
15256 <tr><th>Foo </th><th>Bar</th></tr>
15257 <tr>
15258 <td>Foo1 </td>
15259 <td>Bar1</td></tr></tbody></table>and some more text.</figcaption></figure>
15260 !! end
15261
15262 !! test
15263 T5090: External links other than http: in image captions
15264 !! wikitext
15265 [[File:Foobar.jpg|thumb|200x200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
15266 !! html/php
15267 <div class="thumb tright"><div class="thumbinner" style="width:202px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" width="200" height="23" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/400px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>This caption has <a rel="nofollow" class="external text" href="irc://example.net">irc</a> and <a rel="nofollow" class="external text" href="https://example.com">Secure</a> ext links in it.</div></div></div>
15268
15269 !! html/parsoid
15270 <figure typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="23" width="200"/></a><figcaption>This caption has <a rel="mw:ExtLink" href="irc://example.net">irc</a> and <a rel="mw:ExtLink" href="https://example.com">Secure</a> ext links in it.</figcaption></figure>
15271 !! end
15272
15273 !! test
15274 Custom class
15275 !! options
15276 parsoid=wt2html,wt2wt,html2html
15277 !! wikitext
15278 [[Image:foobar.jpg|a|class=b]]
15279 !! html/php
15280 <p><a href="/wiki/File:Foobar.jpg" class="image" title="a"><img alt="a" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="b" /></a>
15281 </p>
15282 !! html/parsoid
15283 <p><span class="mw-default-size b" typeof="mw:Image" data-mw='{"caption":"a"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
15284 !! end
15285
15286 !! test
15287 Localized image handling (1).
15288 !! options
15289 parsoid=wt2html,wt2wt,html2html
15290 language=es
15291 !! wikitext
15292 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
15293 !! html/php
15294 <div class="floatleft"><a href="/wiki/Foo" title="caption"><img alt="caption" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
15295
15296 !! html/parsoid
15297 <figure class="mw-default-size mw-halign-left" typeof="mw:Image"><a href="./Foo"><img resource="./Archivo:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>caption</figcaption></figure>
15298 !! end
15299
15300 !! test
15301 Localized image handling (2).
15302 !! options
15303 thumbsize=220
15304 parsoid=wt2html,wt2wt,html2html
15305 language=es
15306 !! wikitext
15307 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
15308 !! html/php
15309 <div class="thumb tleft"><div class="thumbinner" style="width:222px;"><a href="/wiki/Foo" title="Foo"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/Archivo:Foobar.jpg" class="internal" title="Aumentar"></a></div>caption</div></div></div>
15310
15311 !! html/parsoid
15312 <figure class="mw-default-size mw-halign-left" typeof="mw:Image/Thumb"><a href="./Foo"><img resource="./Archivo:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>caption</figcaption></figure>
15313 !! end
15314
15315 !! test
15316 Localized image handling (3).
15317 !! options
15318 language=fa
15319 parsoid=html2wt
15320 !! html/parsoid
15321 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a></figure>
15322 !! wikitext
15323 [[File:Foobar.jpg|بندانگشتی]]
15324 !! end
15325
15326 !! test
15327 "border", "frameless" and "class" attributes on an image.
15328 !! options
15329 thumbsize=220
15330 parsoid=wt2html,wt2wt,html2html
15331 !! wikitext
15332 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
15333 !! html/php
15334 <p><a href="/wiki/File:Foobar.jpg" class="image" title="caption"><img alt="caption" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="extra thumbborder" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a>
15335 </p>
15336 !! html/parsoid
15337 <p><span class="mw-default-size mw-image-border extra" typeof="mw:Image/Frameless" data-mw='{"caption":"caption"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a></span></p>
15338 !! end
15339
15340 # Note that 'right' is the default alignment, despite the misspelled 'righ' below
15341 !! test
15342 Invalid image attributes (T64500)
15343 !! options
15344 thumbsize=220
15345 parsoid=wt2html,wt2wt,html2html
15346 !! wikitext
15347 [[File:Foobar.jpg|thumb|float|left|caption]]
15348
15349 [[File:Foobar.jpg|thumb|righ|caption]]
15350
15351 [[File:Foobar.jpg|bogus1|thumb|bogus2|left|bogus3|caption]]
15352 !! html/php
15353 <div class="thumb tleft"><div class="thumbinner" style="width:222px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>caption</div></div></div>
15354 <div class="thumb tright"><div class="thumbinner" style="width:222px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>caption</div></div></div>
15355 <div class="thumb tleft"><div class="thumbinner" style="width:222px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>caption</div></div></div>
15356
15357 !! html/parsoid
15358 <figure class="mw-default-size mw-halign-left" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>caption</figcaption></figure>
15359 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>caption</figcaption></figure>
15360 <figure class="mw-default-size mw-halign-left" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>caption</figcaption></figure>
15361 !! end
15362
15363 !! article
15364 File:Barfoo.jpg
15365 !! text
15366 #REDIRECT [[File:Barfoo.jpg]]
15367 !! endarticle
15368
15369 # FIXME: Parsoid should run this test -- but we'd need to teach the
15370 # mockAPI about the redirected Barfoo.jpg image.
15371 !! test
15372 Redirected image
15373 !! wikitext
15374 [[Image:Barfoo.jpg]]
15375 !! html/php
15376 <p><a href="/wiki/File:Barfoo.jpg" class="mw-redirect" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
15377 </p>
15378 !! end
15379
15380 !! test
15381 Missing image with uploads disabled
15382 !! options
15383 wgEnableUploads=0
15384 !! wikitext
15385 [[File:Foobaz.jpg]]
15386 !! html/php
15387 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
15388 </p>
15389 !! html/parsoid
15390 <p><span class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}]}'><a href="./File:Foobaz.jpg"><img resource="./File:Foobaz.jpg" src="./Special:FilePath/Foobaz.jpg" height="220" width="220"/></a></span></p>
15391 !! end
15392
15393 # Parsoid-specific testing for images
15394 # https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
15395 # Currently imperfect due to a flaw in the Parsoid testrunner
15396 # Work in progress
15397 # THESE TESTS SHOULD BE MOVED UP and merged with the php-specific
15398 # image tests.
15399
15400 !! test
15401 Parsoid-specific image handling - simple image with size and middle alignment
15402 !! wikitext
15403 [[File:Foobar.jpg|middle|50px]]
15404 !! html/parsoid
15405 <p><span class="mw-valign-middle" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="6" width="50"/></a></span></p>
15406 !! end
15407
15408 !! test
15409 Parsoid-specific image handling - simple image with size, middle alignment,
15410 non-standard namespace alias
15411 !! options
15412 parsoid=wt2wt,wt2html,html2html
15413 !! wikitext
15414 [[Image:Foobar.jpg|middle|50px]]
15415 !! html/parsoid
15416 <p><span class="mw-valign-middle" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="6" width="50"/></a></span></p>
15417 !! end
15418
15419 !! test
15420 Parsoid-specific image handling - simple image with size and middle alignment
15421 (existing content)
15422 !! wikitext
15423 [[File:Foobar.jpg|50px|middle]]
15424 !! html/parsoid
15425 <p><span class="mw-valign-middle" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"width","ak":"50px"},{"ck":"middle","ak":"middle"}]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="6" width="50" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"6","width":"50"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
15426 !! end
15427
15428 !! test
15429 Parsoid-specific image handling - simple image with size and middle alignment
15430 and non-standard namespace name
15431 !! options
15432 parsoid=wt2html,wt2wt,html2html
15433 !! wikitext
15434 [[Image:Foobar.jpg|50px|middle]]
15435 !! html/parsoid
15436 <p><span class="mw-valign-middle" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="6" width="50"/></a></span></p>
15437 !! end
15438
15439 !! test
15440 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
15441 !! wikitext
15442 [[File:Foobar.jpg|500x10px|baseline|caption]]
15443 !! html/parsoid
15444 <p><span class="mw-valign-baseline" typeof="mw:Image" data-mw='{"caption":"caption"}' data-parsoid='{"optList":[{"ck":"width","ak":"500x10px"},{"ck":"baseline","ak":"baseline"},{"ck":"caption","ak":"caption"}],"size":"500x10"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/89px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="10" width="89" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"10","width":"89"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
15445 !! end
15446
15447 !! test
15448 Parsoid-specific image handling - simple image with border and size spec
15449 !! wikitext
15450 [[File:Foobar.jpg|50px|border|caption]]
15451 !! html/parsoid
15452 <p><span class="mw-image-border" typeof="mw:Image" data-mw='{"caption":"caption"}' data-parsoid='{"optList":[{"ck":"width","ak":"50px"},{"ck":"border","ak":"border"},{"ck":"caption","ak":"caption"}]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="6" width="50" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"6","width":"50"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
15453 !! end
15454
15455 !! test
15456 Parsoid-specific image handling - thumbnail with halign, valign, and caption
15457 !! wikitext
15458 [[File:Foobar.jpg|left|baseline|thumb|caption content]]
15459 !! html/parsoid
15460 <figure class="mw-default-size mw-halign-left mw-valign-baseline" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>caption content</figcaption></figure>
15461 !! end
15462
15463 !! test
15464 Parsoid-specific image handling - thumbnail with halign, valign, and caption
15465 (existing content)
15466 !! wikitext
15467 [[File:Foobar.jpg|thumb|left|baseline|caption content]]
15468 !! html/parsoid
15469 <figure class="mw-default-size mw-halign-left mw-valign-baseline" typeof="mw:Image/Thumb" data-parsoid='{"optList":[{"ck":"thumbnail","ak":"thumb"},{"ck":"left","ak":"left"},{"ck":"baseline","ak":"baseline"},{"ck":"caption","ak":"caption content"}]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"25","width":"220"},"sa":{"resource":"File:Foobar.jpg"}}'/></a><figcaption>caption content</figcaption></figure>
15470 !! end
15471
15472 !! test
15473 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
15474 !! wikitext
15475 [[Image:Foobar.jpg|right|middle|thumb|50x50px|caption]]
15476 !! html/parsoid
15477 <figure class="mw-halign-right mw-valign-middle" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="6" width="50"/></a><figcaption>caption</figcaption></figure>
15478 !! end
15479
15480 !! test
15481 Parsoid-specific image handling - thumbnail with specific size, halign,
15482 valign, and caption (existing content)
15483 !! wikitext
15484 [[File:Foobar.jpg|thumb|50x50px|right|middle|caption]]
15485 !! html/parsoid
15486 <figure class="mw-halign-right mw-valign-middle" typeof="mw:Image/Thumb" data-parsoid='{"optList":[{"ck":"thumbnail","ak":"thumb"},{"ck":"width","ak":"50x50px"},{"ck":"right","ak":"right"},{"ck":"middle","ak":"middle"},{"ck":"caption","ak":"caption"}],"size":"50x50"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="6" width="50" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"6","width":"50"},"sa":{"resource":"File:Foobar.jpg"}}'/></a><figcaption>caption</figcaption></figure>
15487 !! end
15488
15489 !! test
15490 Parsoid-specific image handling - framed image with specific size and caption
15491 (size is ignored)
15492 !! options
15493 parsoid=wt2html,wt2wt,html2html
15494 !! wikitext
15495 [[File:Foobar.jpg|frame|500x50px|caption]]
15496 !! html/parsoid
15497 <figure typeof="mw:Image/Frame"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>caption</figcaption></figure>
15498 !! end
15499
15500 !! test
15501 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption
15502 (size is ignored)
15503 !! options
15504 parsoid=wt2html,wt2wt,html2html
15505 !! wikitext
15506 [[File:Foobar.jpg|left|baseline|frame|500x50px|caption]]
15507 !! html/parsoid
15508 <figure class="mw-halign-left mw-valign-baseline" typeof="mw:Image/Frame"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>caption</figcaption></figure>
15509 !! end
15510
15511 !! test
15512 Parsoid-specific image handling - frameless image with specific size, border, and caption
15513 !! wikitext
15514 [[File:Foobar.jpg|frameless|442x50px|border|caption]]
15515 !! html/parsoid
15516 <p><span class="mw-image-border" typeof="mw:Image/Frameless" data-mw='{"caption":"caption"}' data-parsoid='{"optList":[{"ck":"frameless","ak":"frameless"},{"ck":"width","ak":"442x50px"},{"ck":"border","ak":"border"},{"ck":"caption","ak":"caption"}],"size":"442x50"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/442px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="50" width="442" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"50","width":"442"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
15517 !! end
15518
15519 !! test
15520 Parsoid-specific image handling - simple image with a formatted caption
15521 !! wikitext
15522 [[File:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
15523 !! html/parsoid
15524 <p><span class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"&lt;table>&lt;tr>&lt;td>a&lt;/td>&lt;td>b&lt;/td>&lt;/tr>&lt;tr>&lt;td>c&lt;/td>&lt;/tr>&lt;/table>"}]}' data-mw='{"caption":"&lt;table data-parsoid=&#39;{\"stx\":\"html\",\"dsr\":[18,81,7,8]}&#39;>&lt;tbody data-parsoid=&#39;{\"dsr\":[25,73,0,0]}&#39;>&lt;tr data-parsoid=&#39;{\"stx\":\"html\",\"dsr\":[25,54,4,5]}&#39;>&lt;td data-parsoid=&#39;{\"stx\":\"html\",\"dsr\":[29,39,4,5]}&#39;>a&lt;/td>&lt;td data-parsoid=&#39;{\"stx\":\"html\",\"dsr\":[39,49,4,5]}&#39;>b&lt;/td>&lt;/tr>&lt;tr data-parsoid=&#39;{\"stx\":\"html\",\"dsr\":[54,73,4,5]}&#39;>&lt;td data-parsoid=&#39;{\"stx\":\"html\",\"dsr\":[58,68,4,5]}&#39;>c&lt;/td>&lt;/tr>&lt;/tbody>&lt;/table>"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
15525 !! end
15526
15527 !! test
15528 Parsoid-specific image handling - caption with a template in it
15529 !! wikitext
15530 [[File:Foobar.jpg|thumb|200x23px|This caption has a {{echo|transclusion}} in it.]]
15531 !! html/parsoid
15532 <figure typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="23" width="200"></a><figcaption>This caption has a <span about="#mwt1" typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;transclusion&quot;}},&quot;i&quot;:0}}]}">transclusion</span> in it.</figcaption></figure>
15533 !! end
15534
15535 !! test
15536 Parsoid-specific image handling - caption with unbalanced tags in it
15537 !! options
15538 parsoid=wt2html,wt2wt,html2html
15539 !! wikitext
15540 foo
15541 [[File:Foobar.jpg|thumb|200x200px|This caption has a <center>unbalanced tag in it.]]
15542 bar
15543 !! html/parsoid
15544 <p>foo</p>
15545 <figure typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="23" width="200"/></a><figcaption>This caption has a <center>unbalanced tag in it.</center></figcaption></figure>
15546 <p>bar</p>
15547 !! end
15548
15549 !! test
15550 Parsoid-specific image handling - empty caption (1)
15551 !! options
15552 parsoid=wt2html,wt2wt
15553 !! wikitext
15554 [[File:Foobar.jpg|thumb|]]
15555 !! html/parsoid
15556 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption></figcaption></figure>
15557 !! end
15558
15559 # empty captions don't get serialized unless we're in the "round trip" case
15560 !! test
15561 Parsoid-specific image handling - empty caption (2)
15562 !! options
15563 parsoid=html2wt
15564 !! html/parsoid
15565 <figure class="mw-default-size" typeof="mw:Image/Thumb">
15566 <a href="./File:Foobar.jpg">
15567 <img resource="./File:Foobar.jpg"
15568 src="//example.com/images/3/3a/Foobar.jpg"
15569 data-file-width="1941" data-file-height="220" data-file-type="bitmap"
15570 height="25" width="220"/>
15571 </a>
15572 <figcaption></figcaption>
15573 </figure>
15574 !! wikitext
15575 [[File:Foobar.jpg|thumb]]
15576 !! end
15577
15578 !! test
15579 Parsoid-specific image handling - whitespace caption
15580 !! wikitext
15581 [[File:Foobar.jpg|thumb| ]]
15582 !! html/parsoid
15583 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption> </figcaption></figure>
15584 !! end
15585
15586 !! test
15587 Parsoid-specific image handling - lang option
15588 !! wikitext
15589 foo
15590 [[File:Foobar.svg|lang=de|caption]]
15591 bar
15592 !! html/parsoid
15593 <p>foo
15594 <span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"caption"}'><a href="./File:Foobar.svg"><img resource="./File:Foobar.svg" src="//example.com/images/f/ff/Foobar.svg" lang="de" data-file-width="240" data-file-height="180" data-file-type="drawing" height="180" width="240"/></a></span>
15595 bar</p>
15596 !! end
15597
15598 ## Edge case bugs in Parsoid from T93580
15599 !! test
15600 T93580: 1. Templated <ref> inside block images
15601 !! wikitext
15602 [[File:Foobar.jpg|thumb|Caption with templated ref: {{echo|<ref>foo</ref>}}]]
15603
15604 <references />
15605 !! html/parsoid
15606 <figure class="mw-default-size" typeof="mw:Image/Thumb" data-parsoid='{"optList":[{"ck":"thumbnail","ak":"thumb"},{"ck":"caption","ak":"Caption with templated ref: {{echo|&lt;ref>foo&lt;/ref>}}"}]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"25","width":"220"},"sa":{"resource":"File:Foobar.jpg"}}'/></a><figcaption>Caption with templated ref: <span about="#mwt5" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Transclusion mw:Extension/ref" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;ref>foo&lt;/ref>"}},"i":0}}]}'><a href="./Main_Page#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></span></figcaption></figure>
15607
15608 <ol class="mw-references references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><a href="./Main_Page#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text" data-parsoid="{}">foo</span></li></ol>
15609 !! end
15610
15611 !! test
15612 T93580: 2. <ref> inside inline images
15613 !! wikitext
15614 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: <ref>foo</ref>]]
15615
15616 <references />
15617 !! html/parsoid
15618 <p><span class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"Undisplayed caption in inline image with ref: &lt;ref>foo&lt;/ref>"}]}' data-mw='{"caption":"Undisplayed caption in inline image with ref: &lt;span about=\"#mwt2\" class=\"mw-ref\" id=\"cite_ref-1\" rel=\"dc:references\" typeof=\"mw:Extension/ref\" data-parsoid=&#39;{\"dsr\":[64,78,5,6]}&#39; data-mw=&#39;{\"name\":\"ref\",\"body\":{\"id\":\"mw-reference-text-cite_note-1\"},\"attrs\":{}}&#39;>&lt;a href=\"./Main_Page#cite_note-1\" style=\"counter-reset: mw-Ref 1;\" data-parsoid=\"{}\">&lt;span class=\"mw-reflink-text\" data-parsoid=\"{}\">[1]&lt;/span>&lt;/a>&lt;/span>&lt;meta typeof=\"mw:Extension/ref/Marker\" about=\"#mwt2\" data-parsoid=&#39;{\"group\":\"\",\"name\":\"\",\"content\":\"foo\",\"hasRefInRef\":false,\"dsr\":[64,78,5,6]}&#39;/>"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
15619
15620 <ol class="mw-references references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><a href="./Main_Page#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text" data-parsoid="{}">foo</span></li></ol>
15621 !! end
15622
15623 !! test
15624 T93580: 3. Templated <ref> inside inline images
15625 !! wikitext
15626 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: {{echo|<ref>{{echo|foo}}</ref>}}]]
15627
15628 <references />
15629 !! html/parsoid
15630 <p><span class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"Undisplayed caption in inline image with ref: {{echo|&lt;ref>{{echo|foo}}&lt;/ref>}}"}]}' data-mw='{"caption":"Undisplayed caption in inline image with ref: &lt;span about=\"#mwt2\" class=\"mw-ref\" id=\"cite_ref-1\" rel=\"dc:references\" typeof=\"mw:Transclusion mw:Extension/ref\" data-parsoid=&#39;{\"dsr\":[64,96,null,null],\"pi\":[[{\"k\":\"1\"}]]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"&amp;lt;ref>{{echo|foo}}&amp;lt;/ref>\"}},\"i\":0}}]}&#39;>&lt;a href=\"./Main_Page#cite_note-1\" style=\"counter-reset: mw-Ref 1;\" data-parsoid=\"{}\">&lt;span class=\"mw-reflink-text\" data-parsoid=\"{}\">[1]&lt;/span>&lt;/a>&lt;/span>&lt;meta typeof=\"mw:Transclusion mw:Extension/ref/Marker\" about=\"#mwt2\" data-parsoid=&#39;{\"group\":\"\",\"name\":\"\",\"content\":\"foo\",\"hasRefInRef\":false,\"dsr\":[64,96,null,null],\"pi\":[[{\"k\":\"1\"}]]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"&amp;lt;ref>{{echo|foo}}&amp;lt;/ref>\"}},\"i\":0}}]}&#39;/>"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
15631
15632 <ol class="mw-references references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><a href="./Main_Page#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text" data-parsoid="{}">foo</span></li></ol>
15633 !! end
15634
15635 ###
15636 ### Subpages
15637 ###
15638 !! article
15639 Subpage test/subpage
15640 !! text
15641 foo
15642 !! endarticle
15643
15644 !! test
15645 Subpage link
15646 !! options
15647 subpage title=[[Subpage test]]
15648 !! wikitext
15649 [[/subpage]]
15650 !! html
15651 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
15652 </p>
15653 !! end
15654
15655 !! test
15656 Subpage noslash link
15657 !! options
15658 subpage title=[[Subpage test]]
15659 !! wikitext
15660 [[/subpage/]]
15661 !! html
15662 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
15663 </p>
15664 !! end
15665
15666 !! article
15667 Subpage test/1/2/subpage
15668 !! text
15669 blah
15670 !! endarticle
15671
15672 !! test
15673 Relative subpage noslash link
15674 !! options
15675 parsoid=wt2wt,wt2html,html2html
15676 subpage title=[[Subpage test/1/2/3/4]]
15677 !! wikitext
15678 [[../../subpage/]]
15679
15680 [[../../subpage]]
15681 !! html/php
15682 <p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a>
15683 </p><p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage test/1/2/subpage</a>
15684 </p>
15685 !! html/parsoid
15686 <p><a rel="mw:WikiLink" href="./Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a></p>
15687 <p><a rel="mw:WikiLink" href="./Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
15688 !! end
15689
15690 !! test
15691 Parsoid: dot-slash prefixed wikilinks
15692 !! wikitext
15693 [[./foo]]
15694
15695 [[././bar]]
15696
15697 [[././baz/]]
15698 !! html/php
15699 <p>[[./foo]]
15700 </p><p>[[././bar]]
15701 </p><p>[[././baz/]]
15702 </p>
15703 !! html/parsoid
15704 <p>[[./foo]]
15705 </p><p>[[././bar]]
15706 </p><p>[[././baz/]]
15707 </p>
15708 !! end
15709
15710 !! test
15711 Render invalid page names as plain text (T53090)
15712 !! wikitext
15713 [[./../foo|bar]]
15714 [[foo�|bar]]
15715 [[foo/.|bar]]
15716 [[foo/..|bar]]
15717 [[foo~~~bar]]
15718 [[foo>bar]]
15719 [[foo[bar]]
15720 [[.]]
15721 [[..]]
15722 [[foo././bar]]
15723 [[foo[http://example.com]xyz]]
15724
15725 [[{{echo|./../foo}}|bar]]
15726 [[{{echo|foo/.}}|bar]]
15727 [[{{echo|foo/..}}|bar]]
15728 [[{{echo|foo~~~~bar}}]]
15729 [[{{echo|foo>bar}}]]
15730 [[{{echo|foo././bar}}]]
15731 [[{{echo|foo{bar}}]]
15732 [[{{echo|foo}bar}}]]
15733 [[{{echo|foo[bar}}]]
15734 [[{{echo|foo]bar}}]]
15735 [[{{echo|foo<bar}}]]
15736 !!html/php
15737 <p>[[./../foo|bar]]
15738 [[foo�|bar]]
15739 [[foo/.|bar]]
15740 [[foo/..|bar]]
15741 [[foo~~~bar]]
15742 [[foo&gt;bar]]
15743 [[foo[bar]]
15744 [[.]]
15745 [[..]]
15746 [[foo././bar]]
15747 [[foo<a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>xyz]]
15748 </p><p>[[./../foo|bar]]
15749 [[foo/.|bar]]
15750 [[foo/..|bar]]
15751 [[foo~~~~bar]]
15752 [[foo&gt;bar]]
15753 [[foo././bar]]
15754 [[foo{bar]]
15755 [[foo}bar]]
15756 [[foo[bar]]
15757 [[foo]bar]]
15758 [[foo&lt;bar]]
15759 </p>
15760 !!html/parsoid
15761 <p>[[./../foo|bar]]
15762 [[foo�|bar]]
15763 [[foo/.|bar]]
15764 [[foo/..|bar]]
15765 [[foo~~~bar]]
15766 [[foo>bar]]
15767 [[foo[bar]]
15768 [[.]]
15769 [[..]]
15770 [[foo././bar]]
15771 [[foo<a rel="mw:ExtLink" href="http://example.com"></a>xyz]]</p>
15772
15773 <p>[[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"./../foo"}},"i":0}}]}'>./../foo</span>|bar]]
15774 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/."}},"i":0}}]}'>foo/.</span>|bar]]
15775 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/.."}},"i":0}}]}'>foo/..</span>|bar]]
15776 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo~~~~bar"}},"i":0}}]}'>foo~~~~bar</span>]]
15777 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo>bar"}},"i":0}}]}'>foo>bar</span>]]
15778 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo././bar"}},"i":0}}]}'>foo././bar</span>]]
15779 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo{bar"}},"i":0}}]}'>foo{bar</span>]]
15780 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo}bar"}},"i":0}}]}'>foo}bar</span>]]
15781 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo[bar"}},"i":0}}]}'>foo[bar</span>]]
15782 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo]bar"}},"i":0}}]}'>foo]bar</span>]]
15783 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo&lt;bar"}},"i":0}}]}'>foo&lt;bar</span>]]</p>
15784 !!end
15785
15786 !! test
15787 Disabled subpages
15788 !! wikitext
15789 [[/subpage]]
15790 !! html
15791 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
15792 </p>
15793 !! end
15794
15795 !! test
15796 T2561: {{/Subpage}}
15797 !! options
15798 subpage title=[[Page]]
15799 !! wikitext
15800 {{/Subpage}}
15801 !! html
15802 <p><a href="/index.php?title=Page/Subpage&amp;action=edit&amp;redlink=1" class="new" title="Page/Subpage (page does not exist)">Page/Subpage</a>
15803 </p>
15804 !! end
15805
15806 ###
15807 ### Categories
15808 ###
15809 !! article
15810 Category:MediaWiki User's Guide
15811 !! text
15812 blah
15813 !! endarticle
15814
15815 !! test
15816 Link to category
15817 !! wikitext
15818 [[:Category:MediaWiki User's Guide]]
15819 !! html
15820 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
15821 </p>
15822 !! end
15823
15824 !! test
15825 Simple category
15826 !! options
15827 cat
15828 !! wikitext
15829 [[Category:MediaWiki User's Guide]]
15830 !! html/php
15831 cat=MediaWiki_User's_Guide sort=
15832 !! html/parsoid
15833 <link rel="mw:PageProp/Category" href="./Category:MediaWiki_User's_Guide" data-parsoid='{"stx":"simple","a":{"href":"./Category:MediaWiki_User&#39;s_Guide"},"sa":{"href":"Category:MediaWiki User&#39;s Guide"}}'/>
15834 !! end
15835
15836 !! test
15837 PAGESINCATEGORY invalid title fatal (r33546 fix)
15838 !! wikitext
15839 {{PAGESINCATEGORY:<bogus>}}
15840 !! html
15841 <p>0
15842 </p>
15843 !! end
15844
15845 !! test
15846 Category with different sort key
15847 !! options
15848 cat
15849 !! wikitext
15850 [[Category:MediaWiki User's Guide|Foo]]
15851 !! html/php
15852 cat=MediaWiki_User's_Guide sort=Foo
15853 !! html/parsoid
15854 <link rel="mw:PageProp/Category" href="./Category:MediaWiki_User's_Guide#Foo" data-parsoid='{"stx":"piped","a":{"href":"./Category:MediaWiki_User&#39;s_Guide"},"sa":{"href":"Category:MediaWiki User&#39;s Guide"}}'/>
15855 !! end
15856
15857 !! test
15858 Category with identical sort key
15859 !! options
15860 cat
15861 !! wikitext
15862 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
15863 !! html/php
15864 cat=MediaWiki_User's_Guide sort=MediaWiki User's Guide
15865 !! html/parsoid
15866 <link rel="mw:PageProp/Category" href="./Category:MediaWiki_User's_Guide#MediaWiki%20User's%20Guide" data-parsoid='{"stx":"piped","a":{"href":"./Category:MediaWiki_User&#39;s_Guide"},"sa":{"href":"Category:MediaWiki User&#39;s Guide"}}'/>
15867 !! end
15868
15869 !! test
15870 Category with empty sort key
15871 !! options
15872 cat
15873 pst
15874 !! wikitext
15875 [[Category:MediaWiki User's Guide|]]
15876 !! html/php
15877 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
15878 !! end
15879
15880 !! test
15881 Category with empty sort key and parentheses
15882 !! options
15883 cat
15884 pst
15885 !! wikitext
15886 [[Category:Foo (bar)|]]
15887 !! html/php
15888 [[Category:Foo (bar)|Foo]]
15889 !! end
15890
15891 !! test
15892 Category with link tail
15893 !! options
15894 cat
15895 pst
15896 !! wikitext
15897 123[[Category:Foo]]456
15898 !! html/php
15899 123[[Category:Foo]]456
15900 !! end
15901
15902 !! test
15903 Category with template
15904 !! options
15905 cat
15906 pst
15907 !! wikitext
15908 [[Category:{{echo|Foo}}]]
15909 !! html/php
15910 [[Category:{{echo|Foo}}]]
15911 !! end
15912
15913 !! test
15914 Category with template in sort key
15915 !! options
15916 cat
15917 pst
15918 !! wikitext
15919 [[Category:Foo|{{echo|Bar}}]]
15920 !! html/php
15921 [[Category:Foo|{{echo|Bar}}]]
15922 !! end
15923
15924 !! test
15925 Category with template in sort key and title
15926 !! options
15927 cat
15928 pst
15929 !! wikitext
15930 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
15931 !! html/php
15932 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
15933 !! end
15934
15935 ## We used to, but no longer wt2wt this test since the default serializer
15936 ## will normalize all categories to serialize on their own line.
15937 ## This wikitext usage is going to be fairly uncommon in production and
15938 ## selser will take care of preserving formatting in those scenarios.
15939 !! test
15940 Category / paragraph interactions
15941 !! options
15942 parsoid=wt2html
15943 !! wikitext
15944 Foo [[Category:Baz]] Bar
15945
15946 Foo [[Category:Baz]]
15947 Bar
15948
15949 Foo
15950 [[Category:Baz]]
15951 Bar
15952
15953 Foo
15954 [[Category:Baz]] Bar
15955
15956 Foo
15957 [[Category:Baz]]
15958 [[Category:Baz]]
15959 [[Category:Baz]]
15960 Bar
15961
15962 [[Category:Baz]]
15963 [[Category:Baz]]
15964 [[Category:Baz]]
15965
15966 [[Category:Baz]]
15967 {{echo|[[Category:Baz]]}}
15968 [[Category:Baz]]
15969 !! html/php
15970 <p>Foo Bar
15971 </p><p>Foo
15972 Bar
15973 </p><p>Foo
15974 Bar
15975 </p><p>Foo Bar
15976 </p><p>Foo
15977 Bar
15978 </p>
15979 !! html/parsoid
15980 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
15981 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
15982 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
15983 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
15984 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> <link rel="mw:PageProp/Category" href="./Category:Baz"/> <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar <link rel="mw:PageProp/Category" href="./Category:Baz"/> <link rel="mw:PageProp/Category" href="./Category:Baz"/> <link rel="mw:PageProp/Category" href="./Category:Baz"/> <link rel="mw:PageProp/Category" href="./Category:Baz"/> <link rel="mw:PageProp/Category" href="./Category:Baz" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[Category:Baz]]"}},"i":0}}]}'/></p>
15985 <link rel="mw:PageProp/Category" href="./Category:Baz"/>
15986 !! end
15987
15988 ## We used to, but no longer wt2wt this test since the default serializer
15989 ## will normalize all categories to serialize on their own line.
15990 ## This wikitext usage is going to be fairly uncommon in production and
15991 ## selser will take care of preserving formatting in those scenarios.
15992 ##
15993 ## The whitespace on the empty line is part of the test. Please do not delete
15994 !! test
15995 1. Categories and newlines: All preceding newlines should be suppressed (courtesy T2087)
15996 !! options
15997 parsoid=wt2html
15998 !! wikitext
15999 This
16000
16001 [[Category:Foo]] and this should be part of same paragraph (not an indent-pre)
16002
16003 {{echo|[[Category:Foo]] and so should this!}}
16004 !! html/php
16005 <p>This and this should be part of same paragraph (not an indent-pre) and so should this!
16006 </p>
16007 !! html/parsoid
16008 <p>This
16009
16010 <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of same paragraph (not an indent-pre)
16011
16012 <link rel="mw:PageProp/Category" href="./Category:Foo" about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[Category:Foo]] and so should this!"}},"i":0}}]}'/><span about="#mwt1"> and so should this!</span></p>
16013 !! end
16014
16015 ## Parsoid will not try to wt2wt this while preserving newlines because
16016 ## it suppresses excess newlines within list items -- and we don't want to
16017 ## introduce a special case just for categories, which is, in reality somewhat
16018 ## odd behavior -- categories are unlikely to be used in list items like this
16019 ## in top-level pages and are only likely to show up in template-generated
16020 ## list items where this RT-ing is a non-issue.
16021 ##
16022 ## The whitespace on the empty line is part of the test. Please do not delete
16023 !! test
16024 2. Categories and newlines: All preceding newlines should be suppressed (courtesy T2087)
16025 !! options
16026 parsoid=wt2html
16027 !! wikitext
16028 * This
16029
16030 [[Category:Foo]] and this should be part of the same list item
16031 * So should this
16032
16033 {{echo|[[Category:Foo]] and this should be part of the same list item}}
16034 !! html
16035 <ul><li>This and this should be part of the same list item</li>
16036 <li>So should this and this should be part of the same list item</li></ul>
16037 !! html/parsoid
16038 <ul>
16039 <li>This <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of the same list item</li>
16040 <li>So should this <link rel="mw:PageProp/Category" href="./Category:Foo" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[Category:Foo]] and this should be part of the same list item"}},"i":0}}]}'/><span> and this should be part of the same list item</span></li>
16041 </ul>
16042 !! end
16043
16044 ## Newlines and categories that follow the last item of a list
16045 ## are treated differently because this (list followed by categories)
16046 ## is an extremely common pattern on wikis.
16047 !! test
16048 3. Categories and newlines: newline suppression for last list item should RT properly
16049 !! wikitext
16050 * a
16051 * b
16052
16053 [[Category:Foo]]
16054
16055 [[Category:Bar]]
16056 [[Category:Baz]]
16057 !! html/parsoid
16058 <ul><li> a</li>
16059 <li> b</li></ul>
16060
16061 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
16062
16063 <link rel="mw:PageProp/Category" href="./Category:Bar" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
16064 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
16065 !! end
16066
16067 !! test
16068 4. Categories and newlines: newline suppression for last list item should RT properly
16069 !! wikitext
16070 * a
16071 **** b
16072
16073 [[Category:Foo]]
16074 !! html/parsoid
16075 <ul><li> a
16076 <ul><li><ul><li><ul><li> b</li></ul></li></ul></li></ul></li></ul>
16077
16078 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
16079 !! end
16080
16081 ## only wt2html for this to make sure the algo only applies to the rightmost path
16082 !! test
16083 5. Categories and newlines: migrateTrailingCategories dom pass should only run on the rightmost path of nested lists
16084 !! options
16085 parsoid=wt2html
16086 !! wikitext
16087 * a
16088 ** b
16089 [[Category:Foo]]
16090 * c
16091 ** d
16092 [[Category:Foo]]
16093 !! html/parsoid
16094 <ul><li> a
16095 <ul><li> b
16096 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/></li></ul></li>
16097 <li> c
16098 <ul><li> d</li></ul></li></ul>
16099 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
16100 !! end
16101
16102 ## We used to, but no longer wt2wt this test since the default serializer
16103 ## will normalize all categories to serialize on their own line.
16104 ## This wikitext usage is going to be fairly uncommon in production and
16105 ## selser will take care of preserving formatting in those scenarios.
16106 !! test
16107 6. Categories and newlines: migrateTrailingCategories dom pass should not migrate categories not preceded by newlines
16108 !! options
16109 parsoid=wt2html
16110 !! wikitext
16111 * a [[Category:Foo]]
16112 !! html/parsoid
16113 <ul><li>a <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/></li></ul>
16114 !! end
16115
16116 # This test also demonstrates because of newline+category tunneling
16117 # through the list hander, template wrapping doesn't expand to the
16118 # containing list when the list item swallows the category.
16119 !! test
16120 7. Categories and newlines: migrateTrailingCategories dom pass should leave template content alone
16121 !! wikitext
16122 * {{echo|a
16123 [[Category:Foo]]}}
16124 !! html/parsoid
16125 <ul><li> <span about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\n[[Category:Foo]]"}},"i":0}}]}'>a
16126 </span><link rel="mw:PageProp/Category" href="./Category:Foo" about="#mwt1" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/></li></ul>
16127 !! end
16128
16129 !! test
16130 8. Categories and newlines: migrateTrailingCategories dom pass should not get tripped by intervening templates
16131 !! wikitext
16132 * a
16133
16134 {{echo|[[Category:Foo]]
16135 [[Category:Bar]]}}
16136 [[Category:Baz]]
16137 !! html/parsoid
16138 <ul><li> a</li></ul>
16139
16140 <link rel="mw:PageProp/Category" href="./Category:Foo" about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"},"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[Category:Foo]]\n[[Category:Bar]]"}},"i":0}}]}'/><span about="#mwt1">
16141 </span><link rel="mw:PageProp/Category" href="./Category:Bar" about="#mwt1" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
16142 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
16143 !! end
16144
16145 !! test
16146 9. Categories and newlines: should behave properly with linkprefix (T87753)
16147 !! options
16148 language=ar
16149 !! wikitext
16150 foo bar
16151 foo bar
16152 [[تصنيف:Foo]]
16153 [[تصنيف:Bar]]
16154 !! html/php
16155 <p>foo bar
16156 foo bar
16157 </p>
16158 !! html/parsoid
16159 <p>foo bar
16160 foo bar</p>
16161 <link rel="mw:PageProp/Category" href="./تصنيف:Foo"/>
16162 <link rel="mw:PageProp/Category" href="./تصنيف:Bar"/>
16163 !! end
16164
16165 !! test
16166 10. No regressions on internal links following category (T174639)
16167 !! options
16168 parsoid=wt2html,html2html
16169 !! wikitext
16170 [[Category:Foo]]<div>a
16171
16172 [[Foo]]</div>
16173 !! html/php
16174 <div>a
16175 <a href="/wiki/Foo" title="Foo">Foo</a></div>
16176
16177 !! html/parsoid
16178 <link rel="mw:PageProp/Category" href="./Category:Foo"/><div>a
16179
16180 <a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a></div>
16181 !! end
16182
16183 # Note that Parsoid differs slightly from PHP due to T175421
16184 !! test
16185 11. Special case where only newlines separate links (T175416)
16186 !! options
16187 parsoid=wt2html,html2html
16188 !! wikitext
16189 [[Category:Foo]]
16190
16191 [[Foo]][[es:Alimento]]
16192
16193 [[Foo]]
16194 !! html/php
16195 <p><br />
16196 <a href="/wiki/Foo" title="Foo">Foo</a>
16197 </p><p><a href="/wiki/Foo" title="Foo">Foo</a>
16198 </p>
16199 !! html/parsoid
16200 <link rel="mw:PageProp/Category" href="./Category:Foo"/>
16201
16202 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a></p><link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Alimento"/>
16203
16204 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a></p>
16205 !! end
16206
16207 !! test
16208 Category links with multiple namespaces
16209 !! wikitext
16210 [[Category:Project:Foo]]
16211 !! html/parsoid
16212 <link rel="mw:PageProp/Category" href="./Category:Project:Foo" />
16213 !! end
16214
16215 !! test
16216 Parsoid: Serialize link to category page with colon escape
16217 !! options
16218 parsoid
16219 !! wikitext
16220
16221 [[:Category:Foo]]
16222 [[:Category:Foo|Bar]]
16223 !! html
16224 <p>
16225 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Category:Foo</a>
16226 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Bar</a>
16227 </p>
16228 !! end
16229
16230 # We used to, but no longer wt2wt this test since the default serializer
16231 # will normalize all categories to serialize on their own line.
16232 # This wikitext usage is going to be fairly uncommon in production and
16233 # selser will take care of preventing whitespace insertion if this
16234 # occurs in an article.
16235 #
16236 # html2html disabled for the same reason (whitespace insertion between
16237 # x and y).
16238 #
16239 # html2wt disabled because it localizes the "Category" namespace.
16240 !! test
16241 Link prefix/suffixes aren't applied to category links
16242 !! options
16243 parsoid=wt2html
16244 language=is
16245 !! wikitext
16246 x[[Category:Foo]]y
16247 !! html/php
16248 <p>xy
16249 </p>
16250 !! html/parsoid
16251 <p>x<link rel="mw:PageProp/Category" href="./Flokkur:Foo" data-parsoid=""/>y</p>
16252 !! end
16253
16254 !! test
16255 Link prefix/suffixes aren't applied to language links
16256 !! options
16257 parsoid=wt2html
16258 language=is
16259 !! wikitext
16260 x[[es:Foo]]y
16261 !! html/php
16262 <p>xy
16263 </p>
16264 !! html/parsoid
16265 <p>x<link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo" data-parsoid=""/>y</p>
16266 !! end
16267
16268 !! test
16269 Parsoid: Serialize link to file page with colon escape
16270 !! options
16271 parsoid
16272 !! wikitext
16273
16274 [[:File:Foo.png]]
16275 [[:File:Foo.png|Bar]]
16276 !! html
16277 <p>
16278 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">File:Foo.png</a>
16279 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">Bar</a>
16280 </p>
16281 !! end
16282
16283 !! test
16284 Parsoid: Serialize a genuine category link without colon escape
16285 !! options
16286 parsoid
16287 !! wikitext
16288 [[Category:Foo]]
16289 [[Category:Foo|Bar]]
16290 !! html
16291 <link rel="mw:PageProp/Category" href="./Category:Foo">
16292 <link rel="mw:PageProp/Category" href="./Category:Foo#Bar">
16293 !! end
16294
16295 !! test
16296 Normalize hrefs properly before testing for invalid link targets (T72894)
16297 !! options
16298 parsoid=html2wt
16299 !! html/parsoid
16300 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne"/>
16301 !! wikitext
16302 [[Category:Toxine bactérienne]]
16303 !! end
16304
16305 !! test
16306 Parsoid: Defaultsort
16307 !! wikitext
16308 {{DEFAULTSORT:Foo}}
16309 !! html/parsoid
16310 <meta property="mw:PageProp/categorydefaultsort" content="Foo"/>
16311 !! end
16312
16313 # NOTE: mw:ExpandedAttrs is not the best typeof here. mw:Transclusion is better.
16314 # But, this is a limitation of our representation and is documented in
16315 # TemplateHandler.js in processSpecialMagicWord
16316 !! test
16317 Parsoid: Defaultsort (template-generated)
16318 !! wikitext
16319 {{{{echo|DEFAULTSORT}}:Foo}}
16320 !! html/parsoid
16321 <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"}]]}'/>
16322 !! end
16323
16324 ###
16325 ### Inter-language links
16326 ###
16327 !! test
16328 Interlanguage links
16329 !! options
16330 ill
16331 !! wikitext
16332 [[es:Alimento]]
16333 [[fr:Nourriture]]
16334 [[zh:食品]]
16335 !! html/php
16336 es:Alimento fr:Nourriture zh:食品
16337 !! html/parsoid
16338 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Alimento"/>
16339 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/Nourriture"/>
16340 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/食品"/>
16341 !! end
16342
16343 !! test
16344 Duplicate interlanguage links (T26502)
16345 !! options
16346 ill
16347 !! wikitext
16348 [[es:1]]
16349 [[es:2]]
16350 [[fr:1]]
16351 [[fr:2]]
16352 !! html/php
16353 es:1 fr:1
16354 !! html/parsoid
16355 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/1"/>
16356 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/2"/>
16357 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/1"/>
16358 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/2"/>
16359 !! end
16360
16361 ###
16362 ### Sections
16363 ###
16364 !! test
16365 Basic section headings
16366 !! wikitext
16367 == Headline 1 ==
16368 Some text
16369
16370 ==Headline 2==
16371 More
16372 ===Smaller headline===
16373 Blah blah
16374 !! html
16375 <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>
16376 <p>Some text
16377 </p>
16378 <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>
16379 <p>More
16380 </p>
16381 <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>
16382 <p>Blah blah
16383 </p>
16384 !! end
16385
16386 !! test
16387 Section headings with TOC
16388 !! wikitext
16389 == Headline 1 ==
16390 === Subheadline 1 ===
16391 ===== Skipping a level =====
16392 ====== Skipping a level ======
16393
16394 == Headline 2 ==
16395 Some text
16396 ===Another headline===
16397 !! html
16398 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
16399 <ul>
16400 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
16401 <ul>
16402 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
16403 <ul>
16404 <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>
16405 <ul>
16406 <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>
16407 </ul>
16408 </li>
16409 </ul>
16410 </li>
16411 </ul>
16412 </li>
16413 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
16414 <ul>
16415 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
16416 </ul>
16417 </li>
16418 </ul>
16419 </div>
16420
16421 <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>
16422 <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>
16423 <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>
16424 <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>
16425 <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>
16426 <p>Some text
16427 </p>
16428 <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>
16429
16430 !! end
16431
16432 !! test
16433 TOC anchors don't collide
16434 !! wikitext
16435 __FORCETOC__
16436 == Headline 2 ==
16437 == Headline ==
16438 == Headline 2 ==
16439 == Headline ==
16440 !! html/php
16441 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
16442 <ul>
16443 <li class="toclevel-1 tocsection-1"><a href="#Headline_2"><span class="tocnumber">1</span> <span class="toctext">Headline 2</span></a></li>
16444 <li class="toclevel-1 tocsection-2"><a href="#Headline"><span class="tocnumber">2</span> <span class="toctext">Headline</span></a></li>
16445 <li class="toclevel-1 tocsection-3"><a href="#Headline_2_2"><span class="tocnumber">3</span> <span class="toctext">Headline 2</span></a></li>
16446 <li class="toclevel-1 tocsection-4"><a href="#Headline_3"><span class="tocnumber">4</span> <span class="toctext">Headline</span></a></li>
16447 </ul>
16448 </div>
16449
16450 <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>
16451 <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>
16452 <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>
16453 <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>
16454
16455 !! end
16456
16457 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
16458 !! test
16459 Handling of sections up to level 6 and beyond
16460 !! wikitext
16461 = Level 1 Heading=
16462 == Level 2 Heading==
16463 === Level 3 Heading===
16464 ==== Level 4 Heading====
16465 ===== Level 5 Heading=====
16466 ====== Level 6 Heading======
16467 ======= Level 7 Heading=======
16468 ======== Level 8 Heading========
16469 ========= Level 9 Heading=========
16470 ========== Level 10 Heading==========
16471 !! html
16472 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
16473 <ul>
16474 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
16475 <ul>
16476 <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>
16477 <ul>
16478 <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>
16479 <ul>
16480 <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>
16481 <ul>
16482 <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>
16483 <ul>
16484 <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>
16485 <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>
16486 <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>
16487 <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>
16488 <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>
16489 </ul>
16490 </li>
16491 </ul>
16492 </li>
16493 </ul>
16494 </li>
16495 </ul>
16496 </li>
16497 </ul>
16498 </li>
16499 </ul>
16500 </div>
16501
16502 <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>
16503 <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>
16504 <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>
16505 <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>
16506 <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>
16507 <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>
16508 <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>
16509 <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>
16510 <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>
16511 <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>
16512
16513 !! end
16514
16515 !! test
16516 TOC regression (T11764)
16517 !! wikitext
16518 == title 1 ==
16519 === title 1.1 ===
16520 ==== title 1.1.1 ====
16521 === title 1.2 ===
16522 == title 2 ==
16523 === title 2.1 ===
16524 !! html
16525 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
16526 <ul>
16527 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
16528 <ul>
16529 <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>
16530 <ul>
16531 <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>
16532 </ul>
16533 </li>
16534 <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>
16535 </ul>
16536 </li>
16537 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
16538 <ul>
16539 <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>
16540 </ul>
16541 </li>
16542 </ul>
16543 </div>
16544
16545 <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>
16546 <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>
16547 <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>
16548 <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>
16549 <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>
16550 <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>
16551
16552 !! end
16553
16554 !! test
16555 TOC for heading containing <span id="..."></span> (T96153)
16556 !! wikitext
16557 __FORCETOC__
16558 ==<span id="old-anchor"></span>New title==
16559 !! html/php
16560 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
16561 <ul>
16562 <li class="toclevel-1 tocsection-1"><a href="#New_title"><span class="tocnumber">1</span> <span class="toctext">New title</span></a></li>
16563 </ul>
16564 </div>
16565
16566 <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>
16567
16568 !! end
16569
16570 !! test
16571 TOC with wgMaxTocLevel=3 (T8204)
16572 !! options
16573 wgMaxTocLevel=3
16574 !! wikitext
16575 == title 1 ==
16576 === title 1.1 ===
16577 ==== title 1.1.1 ====
16578 === title 1.2 ===
16579 == title 2 ==
16580 === title 2.1 ===
16581 !! html
16582 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
16583 <ul>
16584 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
16585 <ul>
16586 <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>
16587 <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>
16588 </ul>
16589 </li>
16590 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
16591 <ul>
16592 <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>
16593 </ul>
16594 </li>
16595 </ul>
16596 </div>
16597
16598 <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>
16599 <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>
16600 <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>
16601 <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>
16602 <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>
16603 <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>
16604
16605 !! end
16606
16607 !! test
16608 TOC with wgMaxTocLevel=3 and two level four headings (T8204)
16609 !! options
16610 wgMaxTocLevel=3
16611 !! wikitext
16612 ==Section 1==
16613 ===Section 1.1===
16614 ====Section 1.1.1====
16615 ====Section 1.1.1.1====
16616 ==Section 2==
16617 !! html
16618 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
16619 <ul>
16620 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
16621 <ul>
16622 <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>
16623 </ul>
16624 </li>
16625 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
16626 </ul>
16627 </div>
16628
16629 <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>
16630 <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>
16631 <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>
16632 <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>
16633 <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>
16634
16635 !! end
16636
16637
16638 !! test
16639 Resolving duplicate section names
16640 !! wikitext
16641 == Foo bar ==
16642 == Foo bar ==
16643 !! html
16644 <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>
16645 <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>
16646
16647 !! end
16648
16649 !! test
16650 Resolving duplicate section names with differing case (T12721)
16651 !! wikitext
16652 == Foo bar ==
16653 == Foo Bar ==
16654 !! html
16655 <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>
16656 <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>
16657
16658 !! end
16659
16660 !! article
16661 Template:sections
16662 !! text
16663 ===Section 1===
16664 ==Section 2==
16665 !! endarticle
16666
16667 !! test
16668 Template with sections, __NOTOC__
16669 !! wikitext
16670 __NOTOC__
16671 ==Section 0==
16672 {{sections}}
16673 ==Section 4==
16674 !! html
16675 <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>
16676 <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>
16677 <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>
16678 <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>
16679
16680 !! end
16681
16682 !! test
16683 __NOEDITSECTION__ keyword
16684 !! wikitext
16685 __NOEDITSECTION__
16686 ==Section 1==
16687 ==Section 2==
16688 !! html
16689 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
16690 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
16691
16692 !! end
16693
16694 !! test
16695 Link inside a section heading
16696 !! wikitext
16697 ==Section with a [[Main Page|link]] in it==
16698 !! html
16699 <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>
16700
16701 !! end
16702
16703 !! test
16704 TOC regression (T14077)
16705 !! wikitext
16706 __TOC__
16707 == title 1 ==
16708 === title 1.1 ===
16709 == title 2 ==
16710 !! html
16711 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
16712 <ul>
16713 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
16714 <ul>
16715 <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>
16716 </ul>
16717 </li>
16718 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
16719 </ul>
16720 </div>
16721
16722 <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>
16723 <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>
16724 <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>
16725
16726 !! end
16727
16728 !! test
16729 T3219 URL next to image (good)
16730 !! wikitext
16731 http://example.com [[File:Foobar.jpg]]
16732 !! html/php
16733 <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>
16734 </p>
16735 !! html/parsoid
16736 <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>
16737 !!end
16738
16739 !! test
16740 Short headings with trailing space should match behavior of Parser::doHeadings (T21910)
16741 !! wikitext
16742 ===
16743 The line above must have a trailing space!
16744 === <!--
16745 --> <!-- -->
16746 But just in case it doesn't...
16747 !! html
16748 <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>
16749 <p>The line above must have a trailing space!
16750 </p>
16751 <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>
16752 <p>But just in case it doesn't...
16753 </p>
16754 !! end
16755
16756 !! test
16757 Header with special characters (T27462)
16758 !! wikitext
16759 The tooltips shall not show entities to the user (ie. be double escaped)
16760
16761 == text > text ==
16762 section 1
16763
16764 == text < text ==
16765 section 2
16766
16767 == text & text ==
16768 section 3
16769
16770 == text ' text ==
16771 section 4
16772
16773 == text " text ==
16774 section 5
16775 !! html
16776 <p>The tooltips shall not show entities to the user (ie. be double escaped)
16777 </p>
16778 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
16779 <ul>
16780 <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>
16781 <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>
16782 <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>
16783 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
16784 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
16785 </ul>
16786 </div>
16787
16788 <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>
16789 <p>section 1
16790 </p>
16791 <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>
16792 <p>section 2
16793 </p>
16794 <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>
16795 <p>section 3
16796 </p>
16797 <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>
16798 <p>section 4
16799 </p>
16800 <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>
16801 <p>section 5
16802 </p>
16803 !! end
16804
16805 !! test
16806 Header with space, plus and underscore as entity
16807 !! wikitext
16808 Id should not contain + for spaces
16809
16810 == Space between Text ==
16811 section 1
16812
16813 == Space-Entity&#32;between&#32;Text ==
16814 section 2
16815
16816 == Plus+between+Text ==
16817 section 3
16818
16819 == Plus-Entity&#43;between&#43;Text ==
16820 section 4
16821
16822 == Underscore_between_Text ==
16823 section 5
16824
16825 == Underscore-Entity&#95;between&#95;Text ==
16826 section 6
16827
16828 [[#Space between Text]]
16829 [[#Space-Entity&#32;between&#32;Text]]
16830 [[#Plus+between+Text]]
16831 [[#Plus-Entity&#43;between&#43;Text]]
16832 [[#Underscore_between_Text]]
16833 [[#Underscore-Entity&#95;between&#95;Text]]
16834 !! html
16835 <p>Id should not contain + for spaces
16836 </p>
16837 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
16838 <ul>
16839 <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>
16840 <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>
16841 <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>
16842 <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>
16843 <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>
16844 <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>
16845 </ul>
16846 </div>
16847
16848 <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>
16849 <p>section 1
16850 </p>
16851 <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>
16852 <p>section 2
16853 </p>
16854 <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>
16855 <p>section 3
16856 </p>
16857 <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>
16858 <p>section 4
16859 </p>
16860 <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>
16861 <p>section 5
16862 </p>
16863 <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>
16864 <p>section 6
16865 </p><p><a href="#Space_between_Text">#Space between Text</a>
16866 <a href="#Space-Entity_between_Text">#Space-Entity&#32;between&#32;Text</a>
16867 <a href="#Plus.2Bbetween.2BText">#Plus+between+Text</a>
16868 <a href="#Plus-Entity.2Bbetween.2BText">#Plus-Entity&#43;between&#43;Text</a>
16869 <a href="#Underscore_between_Text">#Underscore_between_Text</a>
16870 <a href="#Underscore-Entity_between_Text">#Underscore-Entity&#95;between&#95;Text</a>
16871 </p>
16872 !! end
16873
16874 !! test
16875 Headers with excess '=' characters
16876 (Are similar tests necessary beyond the 1st level?)
16877 !! wikitext
16878 =foo==
16879 ==foo=
16880 =''italic'' heading==
16881 ==''italic'' heading=
16882 !! html
16883 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
16884 <ul>
16885 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
16886 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
16887 <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>
16888 <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>
16889 </ul>
16890 </div>
16891
16892 <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>
16893 <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>
16894 <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>
16895 <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>
16896
16897 !! end
16898
16899 !! test
16900 HTML headers vs TOC (T25393)
16901 (__NOEDITSECTION__ for clearer output, doesn't matter here)
16902 !! wikitext
16903 <h1>Header 1</h1>
16904 == Header 1.1 ==
16905 == Header 1.2 ==
16906
16907 <h1>Header 2
16908 </h1>
16909 == Header 2.1 ==
16910 == Header 2.2 ==
16911 __NOEDITSECTION__
16912 !! html
16913 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
16914 <ul>
16915 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
16916 <ul>
16917 <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>
16918 <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>
16919 </ul>
16920 </li>
16921 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
16922 <ul>
16923 <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>
16924 <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>
16925 </ul>
16926 </li>
16927 </ul>
16928 </div>
16929
16930 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
16931 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
16932 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
16933 <h1><span class="mw-headline" id="Header_2">Header 2</span></h1>
16934 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
16935 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
16936
16937 !! end
16938
16939 !! test
16940 Single-line or multiline-comments can follow headings
16941 !! options
16942 parsoid=wt2html,wt2wt
16943 !! wikitext
16944 ==foo==<!---->
16945 ==bar==<!--c1-->
16946 ==baz==<!--
16947 c2
16948 c3-->
16949 !! html
16950 <h2><span class="mw-headline" id="foo">foo</span></h2>
16951 <h2><span class="mw-headline" id="bar">bar</span></h2>
16952 <h2><span class="mw-headline" id="baz">baz</span></h2>
16953
16954 !! end
16955
16956 !! test
16957 T3219 URL next to image (broken)
16958 !! wikitext
16959 http://example.com[[File:Foobar.jpg]]
16960 !! html/php
16961 <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>
16962 </p>
16963 !! html/parsoid
16964 <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>
16965 !!end
16966
16967 !! test
16968 T3186 news: in the middle of text
16969 !! wikitext
16970 http://en.wikinews.org/wiki/Wikinews:Workplace
16971 !! html
16972 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
16973 </p>
16974 !!end
16975
16976
16977 !! test
16978 Namespaced link must have a title
16979 !! wikitext
16980 [[Project:]]
16981 !! html
16982 <p>[[Project:]]
16983 </p>
16984 !!end
16985
16986 !! test
16987 Namespaced link must have a title (bad fragment version)
16988 !! wikitext
16989 [[Project:#fragment]]
16990 !! html
16991 <p>[[Project:#fragment]]
16992 </p>
16993 !!end
16994
16995
16996 ###
16997 ### HTML tags and HTML attributes
16998 ###
16999
17000 !! test
17001 div with no attributes
17002 !! wikitext
17003 <div>HTML rocks</div>
17004 !! html
17005 <div>HTML rocks</div>
17006
17007 !! end
17008
17009 !! test
17010 div with double-quoted attribute
17011 !! wikitext
17012 <div id="rock">HTML rocks</div>
17013 !! html
17014 <div id="rock">HTML rocks</div>
17015
17016 !! end
17017
17018 !! test
17019 div with single-quoted attribute
17020 !! wikitext
17021 <div id='rock'>HTML rocks</div>
17022 !! html
17023 <div id="rock">HTML rocks</div>
17024
17025 !! end
17026
17027 !! test
17028 div with unquoted attribute
17029 !! wikitext
17030 <div id=rock>HTML rocks</div>
17031 !! html
17032 <div id="rock">HTML rocks</div>
17033
17034 !! end
17035
17036 !! test
17037 div with illegal double attributes
17038 !! wikitext
17039 <div id="a" id="b">HTML rocks</div>
17040 !! html
17041 <div id="b">HTML rocks</div>
17042
17043 !!end
17044
17045 !! test
17046 div with empty attribute value, space before equals
17047 !! options
17048 parsoid=wt2html,html2html
17049 !! wikitext
17050 <div class =>HTML rocks</div>
17051 !! html/php
17052 <div class="">HTML rocks</div>
17053
17054 !! html/parsoid
17055 <div class="" data-parsoid='{"stx":"html"}'>HTML rocks</div>
17056 !! end
17057
17058 !! test
17059 div with multiple empty attribute values
17060 !! options
17061 parsoid=wt2html,html2html
17062 !! wikitext
17063 <div id= title=>HTML rocks</div>
17064 !! html/php
17065 <div id="title.3D">HTML rocks</div>
17066
17067 !! html/parsoid
17068 <div id="title.3D" data-parsoid='{"stx":"html"}'>HTML rocks</div>
17069 !! end
17070
17071 !! test
17072 table with multiple empty attribute values
17073 !! options
17074 parsoid=wt2html,html2html
17075 !! wikitext
17076 {| title= id=
17077 | hi
17078 |}
17079 !! html/php
17080 <table title="id=">
17081 <tr>
17082 <td> hi
17083 </td></tr></table>
17084
17085 !! html/parsoid
17086 <table title="id=">
17087 <tbody><tr><td> hi</td></tr>
17088 </tbody></table>
17089 !! end
17090
17091 !! test
17092 div with braces in attribute value
17093 !! wikitext
17094 <div title="{}">Foo</div>
17095 !! html/php
17096 <div title="&#123;&#125;">Foo</div>
17097
17098 !! html/parsoid
17099 <div title="{}">Foo</div>
17100 !! end
17101
17102 !! test
17103 div with empty attribute value, no space before equals
17104 !! options
17105 parsoid=wt2html,html2html
17106 !! wikitext
17107 <div class=>HTML rocks</div>
17108 !! html/php
17109 <div class="">HTML rocks</div>
17110
17111 !! html/parsoid
17112 <div class="">HTML rocks</div>
17113 !! end
17114
17115 !! test
17116 HTML multiple attributes correction
17117 !! wikitext
17118 <p class="error" class="awesome">Awesome!</p>
17119 !! html
17120 <p class="awesome">Awesome!</p>
17121
17122 !!end
17123
17124 !! test
17125 Table multiple attributes correction
17126 !! wikitext
17127 {|
17128 !+ class="error" class="awesome"| status
17129 |}
17130 !! html
17131 <table>
17132 <tr>
17133 <th class="awesome"> status
17134 </th></tr></table>
17135
17136 !!end
17137
17138 !! test
17139 DIV IN UPPERCASE
17140 !! wikitext
17141 <DIV ID="x">HTML ROCKS</DIV>
17142 !! html
17143 <div id="x">HTML ROCKS</div>
17144
17145 !!end
17146
17147 !! test
17148 Non-ASCII pseudo-tags are rendered as text
17149 !! wikitext
17150 <khyô>
17151 !! html
17152 <p>&lt;khyô&gt;
17153 </p>
17154 !! end
17155
17156 !! test
17157 Pseudo-tag with URL 'name' renders as url link
17158 !! wikitext
17159 <http://example.com/>
17160 !! html
17161 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
17162 </p>
17163 !! end
17164
17165 !! test
17166 text with amp in the middle of nowhere
17167 !! wikitext
17168 Remember AT&T?
17169 !! html
17170 <p>Remember AT&amp;T?
17171 </p>
17172 !! end
17173
17174 !! test
17175 text with character entity: eacute
17176 !! wikitext
17177 I always thought &eacute; was a cute letter.
17178 !! html
17179 <p>I always thought &#233; was a cute letter.
17180 </p>
17181 !! html+tidy
17182 <p>I always thought é was a cute letter.</p>
17183 !! end
17184
17185 !! test
17186 text with entity-escaped character entity-like string: eacute
17187 !! wikitext
17188 I always thought &amp;eacute; was a cute letter.
17189 !! html
17190 <p>I always thought &amp;eacute; was a cute letter.
17191 </p>
17192 !! end
17193
17194 !! test
17195 text with undefined character entity: xacute
17196 !! wikitext
17197 I always thought &xacute; was a cute letter.
17198 !! html
17199 <p>I always thought &amp;xacute; was a cute letter.
17200 </p>
17201 !! end
17202
17203 !! test
17204 HTML5 tags
17205 !! wikitext
17206 <data value="5">five</data>
17207 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
17208 <mark>This highlighted text</mark>
17209 !! html
17210 <p><data value="5">five</data>
17211 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
17212 <mark>This highlighted text</mark>
17213 </p>
17214 !! end
17215
17216 !! test
17217 HTML tag with leading space is parsed as text
17218 !! wikitext
17219 < div>foo< /div>
17220 !! html
17221 <p>&lt; div&gt;foo&lt; /div&gt;
17222 </p>
17223 !! end
17224
17225 ## Don't expect Parsoid and PHP to match, since PHP isn't exactly following
17226 ## the HTML5 parsing spec.
17227 !! test
17228 Element with broken attribute syntax
17229 !! options
17230 parsoid=wt2html
17231 !! wikitext
17232 <div style=" style="123">hi</div>
17233 <div =>ho</div>
17234 !! html/php
17235 <div style="123">hi</div>
17236 <div>ho</div>
17237
17238 !! html/parsoid
17239 <div style=" style=" data-parsoid='{"stx":"html","a":{"123\"":null},"sa":{"123\"":""}}'>hi</div>
17240 <div data-parsoid='{"stx":"html","a":{"=":null},"sa":{"=":""}}'>ho</div>
17241 !! end
17242
17243 ###
17244 ### Nesting tests (see T43545, T52604, T53081)
17245 ###
17246
17247 # This test case is fixed in Parsoid by domino 1.0.12. (T52604)
17248 # Note that html2wt is considerably more difficult if we use <b> in
17249 # the test case, instead of <small>
17250 !! test
17251 Ensure that HTML adoption agency algorithm is properly implemented.
17252 !! wikitext
17253 <small>X<small>Y</small>Z</small>
17254 !! html
17255 <p><small>X<small>Y</small>Z</small>
17256 </p>
17257 !! end
17258
17259 # This was T43545 in the PHP parser.
17260 # Note that tidy doesn't handle this correctly.
17261 !! test
17262 Nesting of <kbd>
17263 !! wikitext
17264 <kbd>X<kbd>Y</kbd>Z</kbd>
17265 !! html
17266 <p><kbd>X<kbd>Y</kbd>Z</kbd>
17267 </p>
17268 !! end
17269
17270 # The following cases were T53081 in the PHP parser.
17271 # Note that there are some other nestable tags (b, i, etc) which are
17272 # not covered; see T53081 for discussion.
17273
17274 # Note that tidy doesn't handle this correctly.
17275 !! test
17276 Nesting of <em>
17277 !! wikitext
17278 <em>X<em>Y</em>Z</em>
17279 !! html
17280 <p><em>X<em>Y</em>Z</em>
17281 </p>
17282 !! end
17283
17284 # Note that tidy doesn't handle this correctly.
17285 !! test
17286 Nesting of <strong>
17287 !! wikitext
17288 <strong>X<strong>Y</strong>Z</strong>
17289 !! html
17290 <p><strong>X<strong>Y</strong>Z</strong>
17291 </p>
17292 !! end
17293
17294 !! test
17295 Nesting of <q>
17296 !! wikitext
17297 <q>X<q>Y</q>Z</q>
17298 !! html+tidy
17299 <p><q>X<q>Y</q>Z</q></p>
17300 !! end
17301
17302 # Note that tidy doesn't handle this correctly.
17303 !! test
17304 Nesting of <ruby>
17305 !! wikitext
17306 <ruby>X<ruby>Y</ruby>Z</ruby>
17307 !! html
17308 <p><ruby>X<ruby>Y</ruby>Z</ruby>
17309 </p>
17310 !! end
17311
17312 # Note that tidy doesn't handle this correctly.
17313 !! test
17314 Nesting of <bdo>
17315 !! wikitext
17316 <bdo>X<bdo>Y</bdo>Z</bdo>
17317 !! html
17318 <p><bdo>X<bdo>Y</bdo>Z</bdo>
17319 </p>
17320 !! end
17321
17322
17323 ###
17324 ### Media links
17325 ###
17326
17327 !! test
17328 Media link
17329 !! wikitext
17330 [[Media:Foobar.jpg]]
17331 [[Media:Video.ogv]]
17332 [[:Media:Video.ogv]]
17333 !! html/php
17334 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
17335 <a href="http://example.com/images/0/00/Video.ogv" class="internal" title="Video.ogv">Media:Video.ogv</a>
17336 <a href="http://example.com/images/0/00/Video.ogv" class="internal" title="Video.ogv">Media:Video.ogv</a>
17337 </p>
17338 !! html/parsoid
17339 <p><a rel="mw:MediaLink" href="//example.com/images/3/3a/Foobar.jpg" title="Foobar.jpg">Media:Foobar.jpg</a>
17340 <a rel="mw:MediaLink" href="//example.com/images/0/00/Video.ogv" title="Video.ogv">Media:Video.ogv</a>
17341 <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>
17342 !! end
17343
17344 !! test
17345 Media link with text
17346 !! wikitext
17347 [[Media:Foobar.jpg|A neat file to look at]]
17348 !! html/php
17349 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
17350 </p>
17351 !! html/parsoid
17352 <p><a rel="mw:MediaLink" href="//example.com/images/3/3a/Foobar.jpg" title="Foobar.jpg">A neat file to look at</a></p>
17353 !! end
17354
17355 # FIXME: this is still bad HTML tag nesting
17356 # FIXME: doBlockLevels won't wrap this in a paragraph because it contains a div
17357 !! test
17358 Media link with nasty text
17359 !! wikitext
17360 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
17361 !! html/php
17362 <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>
17363
17364 !! html+php/tidy
17365 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Safe Link</a></p>
17366 <div style="display:none">" onmouseover="alert(document.cookie)" onfoo="</div>
17367 !! html/parsoid
17368 <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>
17369
17370 !! end
17371
17372 !! test
17373 Media link to nonexistent file (T3702)
17374 !! wikitext
17375 [[Media:No such.jpg]]
17376 [[Media:No_such file.jpg]]
17377 !! html/php
17378 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
17379 <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>
17380 </p>
17381 !! html/parsoid
17382 <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>
17383 <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>
17384 !! end
17385
17386 !! test
17387 Image link to nonexistent file (T3850 - good)
17388 !! wikitext
17389 [[File:No_such.jpg]]
17390 !! html/php
17391 <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>
17392 </p>
17393 !! html/parsoid
17394 <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>
17395 !! end
17396
17397 !! test
17398 :Image link to nonexistent file (T3850 - bad)
17399 !! wikitext
17400 [[:Image:No such.jpg]]
17401 !! html/php
17402 <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>
17403 </p>
17404 !! html/parsoid
17405 <p><a rel="mw:WikiLink" href="./File:No_such.jpg" title="File:No such.jpg">Image:No such.jpg</a></p>
17406 !! end
17407
17408 !! test
17409 Character reference normalization in link text (T3938)
17410 !! wikitext
17411 [[Main Page|this&that]]
17412 !! html
17413 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
17414 </p>
17415 !!end
17416
17417 !! article
17418 אַ
17419 !! text
17420 Test for unicode normalization
17421
17422 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
17423 !! endarticle
17424
17425 !! test
17426 (T21451) Links should refer to the normalized form.
17427 !! wikitext
17428 [[&#xFB2E;]]
17429 [[&#x5d0;&#x5b7;]]
17430 [[&#x5d0;ַ]]
17431 [[א&#x5b7;]]
17432 [[אַ]]
17433 !! html
17434 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
17435 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
17436 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
17437 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
17438 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
17439 </p>
17440 !! end
17441
17442 !! test
17443 Empty attribute crash test (T4067)
17444 !! wikitext
17445 <font color="">foo</font>
17446 !! html
17447 <p><font color="">foo</font>
17448 </p>
17449 !! end
17450
17451 !! test
17452 Empty attribute crash test single-quotes (T4067)
17453 !! wikitext
17454 <font color=''>foo</font>
17455 !! html
17456 <p><font color="">foo</font>
17457 </p>
17458 !! end
17459
17460 !! test
17461 Attribute test: equals, then nothing
17462 !! options
17463 parsoid=wt2html,html2html
17464 !! wikitext
17465 <font color=>foo</font>
17466 !! html/php
17467 <p><font color="">foo</font>
17468 </p>
17469 !! html/parsoid
17470 <p><font color="" data-parsoid='{"stx":"html"}'>foo</font></p>
17471 !! end
17472
17473 !! test
17474 Attribute test: unquoted value
17475 !! options
17476 parsoid=wt2html,html2html
17477 !! wikitext
17478 <font color=x>foo</font>
17479 !! html/php
17480 <p><font color="x">foo</font>
17481 </p>
17482 !! html/parsoid
17483 <p><font color="x" data-parsoid='{"stx":"html"}'>foo</font></p>
17484 !! end
17485
17486 !! test
17487 Attribute test: unquoted but illegal value (hash)
17488 !! wikitext
17489 <font color=#x>foo</font>
17490 !! html
17491 <p><font color="#x">foo</font>
17492 </p>
17493 !! end
17494
17495 # Parsoid does not serialize to empty attribute syntax,
17496 # so wt2wt and html2wt cases are skipped
17497 !! test
17498 Attribute test: no value (T54330)
17499 !! options
17500 parsoid=wt2html,html2html
17501 !! wikitext
17502 <font color>foo</font>
17503 !! html/php
17504 <p><font color="">foo</font>
17505 </p>
17506 !! html/parsoid
17507 <p><font color="">foo</font></p>
17508 !! end
17509
17510 !! test
17511 T4095: link with three closing brackets
17512 !! wikitext
17513 [[Main Page]]]
17514 !! html/php
17515 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
17516 </p>
17517 !! html/parsoid
17518 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a>]</p>
17519 !! end
17520
17521 !! test
17522 T4095: link with pipe and three closing brackets
17523 !! wikitext
17524 [[Main Page|link]]]
17525 !! html/php
17526 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
17527 </p>
17528 !! html/parsoid
17529 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">link</a>]</p>
17530 !! end
17531
17532 !! test
17533 T4095: link with pipe and three closing brackets, version 2
17534 !! wikitext
17535 [[Main Page|[http://example.com/]]]
17536 !! html/php
17537 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
17538 </p>
17539 !! html/parsoid
17540 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">[http://example.com/]</a></p>
17541 !! end
17542
17543
17544 ###
17545 ### Safety
17546 ###
17547
17548 !! article
17549 Template:Dangerous attribute
17550 !! text
17551 " onmouseover="alert(document.cookie)
17552 !! endarticle
17553
17554 !! article
17555 Template:Dangerous style attribute
17556 !! text
17557 border-size: expression(alert(document.cookie))
17558 !! endarticle
17559
17560 !! article
17561 Template:Div style
17562 !! text
17563 <div style="float: right; {{{1}}}">Magic div</div>
17564 !! endarticle
17565
17566 !! test
17567 T4304: HTML attribute safety (safe template; regression T4309)
17568 !! wikitext
17569 <div title="{{test}}"></div>
17570 !! html/php
17571 <div title="This is a test template"></div>
17572
17573 !! html/parsoid
17574 <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>
17575 !! end
17576
17577 # Parsoid has enough context to handle this case
17578 !! test
17579 T4304: HTML attribute safety (dangerous template; 2309)
17580 !! wikitext
17581 <div title="{{dangerous attribute}}"></div>
17582 !! html/php
17583 <div title=""></div>
17584
17585 !! html/parsoid
17586 <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>
17587 !! end
17588
17589 !! test
17590 T4304: HTML attribute safety (dangerous style template; 2309)
17591 !! wikitext
17592 <div style="{{dangerous style attribute}}"></div>
17593 !! html/php
17594 <div style="/* insecure input */"></div>
17595
17596 !! html/parsoid
17597 <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>
17598 !! end
17599
17600 !! test
17601 T4304: HTML attribute safety (safe parameter; 2309)
17602 !! wikitext
17603 {{div style|width: 200px}}
17604 !! html/php
17605 <div style="float: right; width: 200px">Magic div</div>
17606
17607 !! html/parsoid
17608 <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>
17609 !! end
17610
17611 !! test
17612 T4304: HTML attribute safety (unsafe parameter; 2309)
17613 !! wikitext
17614 {{div style|width: expression(alert(document.cookie))}}
17615 !! html/php
17616 <div style="/* insecure input */">Magic div</div>
17617
17618 !! html/parsoid
17619 <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>
17620 !! end
17621
17622 ## Parsoid output here differs; needs investigation.
17623 !! test
17624 T4304: HTML attribute safety (unsafe breakout parameter; 2309)
17625 !! wikitext
17626 {{div style|"><script>alert(document.cookie)</script>}}
17627 !! html
17628 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
17629
17630 !! end
17631
17632 ## Parsoid output here differs; needs investigation.
17633 !! test
17634 T4304: HTML attribute safety (unsafe breakout parameter 2; 2309)
17635 !! wikitext
17636 {{div style|" ><script>alert(document.cookie)</script>}}
17637 !! html
17638 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
17639
17640 !! end
17641
17642 !! test
17643 T4304: HTML attribute safety (link)
17644 !! wikitext
17645 <div title="[[Main Page]]"></div>
17646 !! html
17647 <div title="&#91;&#91;Main Page]]"></div>
17648
17649 !! end
17650
17651 !! test
17652 T4304: HTML attribute safety (italics)
17653 !! wikitext
17654 <div title="''foobar''"></div>
17655 !! html
17656 <div title="&#39;&#39;foobar&#39;&#39;"></div>
17657
17658 !! end
17659
17660 !! test
17661 T4304: HTML attribute safety (bold)
17662 !! wikitext
17663 <div title="'''foobar'''"></div>
17664 !! html
17665 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
17666
17667 !! end
17668
17669 !! test
17670 T4304: HTML attribute safety (ISBN)
17671 !! wikitext
17672 <div title="ISBN 1234567890"></div>
17673 !! html
17674 <div title="&#73;SBN 1234567890"></div>
17675
17676 !! end
17677
17678 !! test
17679 T4304: HTML attribute safety (RFC)
17680 !! wikitext
17681 <div title="RFC 1234"></div>
17682 !! html
17683 <div title="&#82;FC 1234"></div>
17684
17685 !! end
17686
17687 !! test
17688 T4304: HTML attribute safety (PMID)
17689 !! wikitext
17690 <div title="PMID 1234567890"></div>
17691 !! html
17692 <div title="&#80;MID 1234567890"></div>
17693
17694 !! end
17695
17696 !! test
17697 T4304: HTML attribute safety (web link)
17698 !! wikitext
17699 <div title="http://example.com/"></div>
17700 !! html
17701 <div title="http&#58;//example.com/"></div>
17702
17703 !! end
17704
17705 !! test
17706 T4304: HTML attribute safety (named web link)
17707 !! wikitext
17708 <div title="[http://example.com/ link]"></div>
17709 !! html
17710 <div title="&#91;http&#58;//example.com/ link]"></div>
17711
17712 !! end
17713
17714 !! test
17715 T5244: HTML attribute safety (extension; safe)
17716 !! wikitext
17717 <div style="<nowiki>background:blue</nowiki>"></div>
17718 !! html/php
17719 <div style="background:blue"></div>
17720
17721 !! html/parsoid
17722 <div style="background:blue" data-parsoid='{"stx":"html","a":{"style":"background:blue"},"sa":{"style":"&lt;nowiki>background:blue&lt;/nowiki>"}}'></div>
17723 !! end
17724
17725 !! test
17726 T5244: HTML attribute safety (extension; unsafe)
17727 !! wikitext
17728 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
17729 !! html/php
17730 <div style="/* insecure input */"></div>
17731
17732 !! html/parsoid
17733 <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>
17734 !! end
17735
17736 # More MSIE fun discovered by Tom Gilder
17737
17738 !! test
17739 MSIE CSS safety test: spurious slash
17740 !! wikitext
17741 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
17742 !! html/php
17743 <div style="/* insecure input */">evil</div>
17744
17745 !! html/parsoid
17746 <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>
17747 !! end
17748
17749 !! test
17750 MSIE CSS safety test: hex code
17751 !! wikitext
17752 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
17753 !! html/php
17754 <div style="/* insecure input */">evil</div>
17755
17756 !! html/parsoid
17757 <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>
17758 !! end
17759
17760 !! test
17761 MSIE CSS safety test: comment in url
17762 !! wikitext
17763 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
17764 !! html/php
17765 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
17766
17767 !! html/parsoid
17768 <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>
17769 !! end
17770
17771 !! test
17772 MSIE CSS safety test: comment in expression
17773 !! wikitext
17774 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
17775 !! html/php
17776 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
17777
17778 !! html/parsoid
17779 <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>
17780 !! end
17781
17782 !! test
17783 CSS safety test (all browsers): vertical tab (T57332 / CVE-2013-4567)
17784 !! wikitext
17785 <p style="font-size: 100px; background-image:url\b(https://www.google.com/images/srpr/logo6w.png)">A</p>
17786 !! html/php
17787 <p style="/* invalid control char */">A</p>
17788
17789 !! html/parsoid
17790 <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>
17791 !! end
17792
17793 !! test
17794 MSIE 6 CSS safety test: Fullwidth (T57332)
17795 !! wikitext
17796 <p style="font-size: 100px; color: expression((title='XSSed'),'red')">A</p>
17797 <div style="top:EXPRESSION(alert())">B</div>
17798 !! html/php
17799 <p style="/* insecure input */">A</p>
17800 <div style="/* insecure input */">B</div>
17801
17802 !! html/parsoid
17803 <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>
17804 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"top:EXPRESSION(alert())"}}'>B</div>
17805 !! end
17806
17807 !! test
17808 MSIE 6 CSS safety test: IPA extensions (T57332)
17809 !! wikitext
17810 <div style="background-image:uʀʟ(javascript:alert())">A</div>
17811 <p style="font-size: 100px; color: expʀessɪoɴ((title='XSSed'),'red')">B</p>
17812 !! html/php
17813 <div style="/* insecure input */">A</div>
17814 <p style="/* insecure input */">B</p>
17815
17816 !! html/parsoid
17817 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"background-image:uʀʟ(javascript:alert())"}}'>A</div>
17818 <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>
17819 !! end
17820
17821 !! test
17822 MSIE 6 CSS safety test: sup/sub script (T57332)
17823 !! wikitext
17824 <div style="background-image:url⁽javascript:alert())">A</div>
17825 <div style="background-image:url₍javascript:alert())">B</div>
17826 <p style="font-size: 100px; color: expressioⁿ((title='XSSed'),'red')">C</p>
17827 !! html/php
17828 <div style="/* insecure input */">A</div>
17829 <div style="/* insecure input */">B</div>
17830 <p style="/* insecure input */">C</p>
17831
17832 !! html/parsoid
17833 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"background-image:url⁽javascript:alert())"}}'>A</div>
17834 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"background-image:url₍javascript:alert())"}}'>B</div>
17835 <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>
17836 !! end
17837
17838 !! test
17839 Opera -o-link CSS
17840 !! options
17841 parsoid=wt2html,html2html
17842 !! wikitext
17843 <div
17844 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;"
17845 style="-o-link:attr(title);-o-link-source:current">X</div>
17846 !! html/php
17847 <div title="data:text/html,&lt;img src=1 onerror=alert(1)&gt;" style="/* insecure input */">X</div>
17848
17849 !! html/parsoid
17850 <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>
17851 !! end
17852
17853 !! test
17854 MSIE 6 CSS safety test: Repetition markers (T57332)
17855 !! wikitext
17856 <p style="font-size: 100px; color: expres〱ion((title='XSSed'),'red')">A</p>
17857 <p style="font-size: 100px; color: expresゝion((title='XSSed'),'red')">B</p>
17858 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">C</p>
17859 <p style="font-size: 100px; color: expresヽion((title='XSSed'),'red')">D</p>
17860 <p style="font-size: 100px; color: expresﹽion((title='XSSed'),'red')">E</p>
17861 <p style="font-size: 100px; color: expresﹼion((title='XSSed'),'red')">F</p>
17862 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">G</p>
17863 !! html/php
17864 <p style="/* insecure input */">A</p>
17865 <p style="/* insecure input */">B</p>
17866 <p style="/* insecure input */">C</p>
17867 <p style="/* insecure input */">D</p>
17868 <p style="/* insecure input */">E</p>
17869 <p style="/* insecure input */">F</p>
17870 <p style="/* insecure input */">G</p>
17871
17872 !! html/parsoid
17873 <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>
17874 <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>
17875 <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>
17876 <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>
17877 <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>
17878 <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>
17879 <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>
17880 !! end
17881
17882 !! test
17883 Table attribute legitimate extension
17884 !! wikitext
17885 {|
17886 !+ style="<nowiki>color:blue</nowiki>"| status
17887 |}
17888 !! html
17889 <table>
17890 <tr>
17891 <th style="color:blue"> status
17892 </th></tr></table>
17893
17894 !!end
17895
17896 !! test
17897 Table attribute safety
17898 !! wikitext
17899 {|
17900 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
17901 |}
17902 !! html
17903 <table>
17904 <tr>
17905 <th style="/* insecure input */"> status
17906 </th></tr></table>
17907
17908 !! end
17909
17910 !! test
17911 CSS line continuation 1
17912 !! wikitext
17913 <div style="background-image: u\&#10;rl(test.jpg);"></div>
17914 !! html
17915 <div style="/* insecure input */"></div>
17916
17917 !! end
17918
17919 !! test
17920 CSS line continuation 2
17921 !! wikitext
17922 <div style="background-image: u\&#13;rl(test.jpg); "></div>
17923 !! html
17924 <div style="/* invalid control char */"></div>
17925
17926 !! end
17927
17928 !! article
17929 Template:Identity
17930 !! text
17931 {{{1}}}
17932 !! endarticle
17933
17934 !! test
17935 Expansion of multi-line templates in attribute values (T8255)
17936 !! wikitext
17937 <div style="background: {{identity|#00FF00}}">-</div>
17938 !! html
17939 <div style="background: #00FF00">-</div>
17940
17941 !! end
17942
17943 !! test
17944 Expansion of multi-line templates in attribute values (T8255 sanity check)
17945 !! wikitext
17946 <div style="background:
17947 #00FF00">-</div>
17948 !! html/php
17949 <div style="background: #00FF00">-</div>
17950
17951 !! html/parsoid
17952 <div style="background:
17953 #00FF00">-</div>
17954 !! end
17955
17956 !! test
17957 Expansion of multi-line templates in attribute values (T8255 sanity check 2)
17958 !! wikitext
17959 <div style="background: &#10;#00FF00">-</div>
17960 !! html
17961 <div style="background: &#10;#00FF00">-</div>
17962
17963 !! end
17964
17965 !! test
17966 Tags which are hidden from Tidy cannot pass through the Sanitizer
17967 !! wikitext
17968 <mw:toc><script>alert();</script></mw:toc>
17969 !! html+tidy
17970 <p>&lt;mw:toc&gt;&lt;script&gt;alert();&lt;/script&gt;&lt;/mw:toc&gt;</p>
17971 !! end
17972
17973 ###
17974 ### Parser hooks (see tests/parser/parserTestsParserHook.php for the <tag> extension)
17975 ###
17976
17977 !! test
17978 Parser hook: empty input
17979 !! wikitext
17980 <tag></tag>
17981 !! html/php
17982 <pre>
17983 ''
17984 array (
17985 )
17986 </pre>
17987
17988 !! html/parsoid
17989 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
17990 !! end
17991
17992 ## Don't expect parsoid to rt this form.
17993 !! test
17994 Parser hook: empty input using terminated empty elements
17995 !! options
17996 parsoid=wt2html,html2html
17997 !! wikitext
17998 <tag/>
17999 !! html/php
18000 <pre>
18001 NULL
18002 array (
18003 )
18004 </pre>
18005
18006 !! html/parsoid
18007 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":null}' data-parsoid='{}' about="#mwt2"></pre>
18008 !! end
18009
18010 !! test
18011 Parser hook: empty input using terminated empty elements (space before)
18012 !! wikitext
18013 <tag />
18014 !! html/php
18015 <pre>
18016 NULL
18017 array (
18018 )
18019 </pre>
18020
18021 !! html/parsoid
18022 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":null}' data-parsoid='{}' about="#mwt2"></pre>
18023 !! end
18024
18025 !! test
18026 Parser hook: basic input
18027 !! wikitext
18028 <tag>input</tag>
18029 !! html/php
18030 <pre>
18031 'input'
18032 array (
18033 )
18034 </pre>
18035
18036 !! html/parsoid
18037 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
18038 !! end
18039
18040 ## Don't expect parsoid to rt this form.
18041 !! test
18042 Parser hook: case insensitive
18043 !! options
18044 parsoid=wt2html,html2html
18045 !! wikitext
18046 <TAG>input</TAG>
18047 !! html/php
18048 <pre>
18049 'input'
18050 array (
18051 )
18052 </pre>
18053
18054 !! html/parsoid
18055 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
18056 !! end
18057
18058 ## Don't expect parsoid to rt this form.
18059 !! test
18060 Parser hook: case insensitive, redux
18061 !! options
18062 parsoid=wt2html,html2html
18063 !! wikitext
18064 <TaG>input</TAg>
18065 !! html/php
18066 <pre>
18067 'input'
18068 array (
18069 )
18070 </pre>
18071
18072 !! html/parsoid
18073 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
18074 !! end
18075
18076 !! test
18077 Parser hook: nested tags
18078 !! wikitext
18079 <tag><tag></tag></tag>
18080 !! html/php
18081 <pre>
18082 '<tag>'
18083 array (
18084 )
18085 </pre>&lt;/tag&gt;
18086
18087 !! html/parsoid
18088 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"&lt;tag>"}}' data-parsoid='{}' about="#mwt2"></pre>&lt;/tag>
18089 !! end
18090
18091 !! test
18092 Parser hook: basic arguments
18093 !! wikitext
18094 <tag width="200" height="100" depth="50" square=""></tag>
18095 !! html/php
18096 <pre>
18097 ''
18098 array (
18099 'width' => '200',
18100 'height' => '100',
18101 'depth' => '50',
18102 'square' => '',
18103 )
18104 </pre>
18105
18106 !! html/parsoid
18107 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
18108 !! end
18109
18110 ## Don't expect parsoid to rt this form.
18111 !! test
18112 Parser hook: basic arguments, variations
18113 !! options
18114 parsoid=wt2html,html2html
18115 !! wikitext
18116 <tag width=200 height = "100" depth = '50' square></tag>
18117 !! html/php
18118 <pre>
18119 ''
18120 array (
18121 'width' => '200',
18122 'height' => '100',
18123 'depth' => '50',
18124 'square' => '',
18125 )
18126 </pre>
18127
18128 !! html/parsoid
18129 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
18130 !! end
18131
18132 !! test
18133 Parser hook: argument containing a forward slash (T7344)
18134 !! wikitext
18135 <tag filename="/tmp/bla"></tag>
18136 !! html/php
18137 <pre>
18138 ''
18139 array (
18140 'filename' => '/tmp/bla',
18141 )
18142 </pre>
18143
18144 !! html/parsoid
18145 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"filename":"/tmp/bla"},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
18146 !! end
18147
18148 ## Don't expect parsoid to rt this form.
18149 !! test
18150 Parser hook: empty input using terminated empty elements (T4374)
18151 !! options
18152 parsoid=wt2html,html2html
18153 !! wikitext
18154 <tag foo=bar/>text
18155 !! html/php
18156 <pre>
18157 NULL
18158 array (
18159 'foo' => 'bar',
18160 )
18161 </pre>text
18162
18163 !! html/parsoid
18164 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"foo":"bar"},"body":null}' data-parsoid='{}' about="#mwt2"></pre>text
18165 !! end
18166
18167 ## </tag> should be output literally since there is no matching tag that begins it
18168 ## Don't expect parsoid to rt this form.
18169 !! test
18170 Parser hook: basic arguments using terminated empty elements (T4374)
18171 !! options
18172 parsoid=wt2html
18173 !! wikitext
18174 <tag width=200 height = "100" depth = '50' square/>
18175 other stuff
18176 </tag>
18177 !! html/php
18178 <pre>
18179 NULL
18180 array (
18181 'width' => '200',
18182 'height' => '100',
18183 'depth' => '50',
18184 'square' => '',
18185 )
18186 </pre>
18187 <p>other stuff
18188 &lt;/tag&gt;
18189 </p>
18190 !! html/parsoid
18191 <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
18192 &lt;/tag></p>
18193 !! end
18194
18195 ## Don't expect parsoid to rt this form.
18196 !! test
18197 Parser hook: Don't allow unclosed extension tags
18198 !! options
18199 parsoid=wt2html
18200 !! wikitext
18201 test <tag>123
18202
18203 this is a '''test'''
18204 !! html/php
18205 <p>test &lt;tag&gt;123
18206 </p><p>this is a <b>test</b>
18207 </p>
18208 !! html/parsoid
18209 <p>test &lt;tag>123</p>
18210
18211 <p>this is a <b>test</b></p>
18212 !! end
18213
18214 ###
18215 ### (see tests/parser/parserTestsParserHook.php for the <statictag> extension)
18216 ###
18217
18218 !! test
18219 Parser hook: static parser hook not inside a comment
18220 !! wikitext
18221 <statictag>hello, world</statictag>
18222
18223 <statictag action="flush" />
18224 !! html/php
18225 <p><br />
18226 hello, world
18227 </p>
18228 !! html/parsoid
18229 <p><span typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{},"body":{"extsrc":"hello, world"}}' data-parsoid='{}' about="#mwt2"></span></p>
18230 <p typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{"action":"flush"},"body":null}' data-parsoid='{}' about="#mwt4">hello, world</p>
18231 !! end
18232
18233 !! test
18234 Parser hook: static parser hook inside a comment
18235 !! wikitext
18236 <!-- <statictag>hello, world</statictag> -->
18237 <statictag action="flush" />
18238 !! html/php
18239 <p><br />
18240 </p>
18241 !! html/parsoid
18242 <!-- <statictag&#x3E;hello, world</statictag&#x3E; -->
18243 <p typeof='mw:Extension/statictag' data-mw='{"name":"statictag","attrs":{"action":"flush"},"body":null}' data-parsoid='{}' about='#mwt2'></p>
18244 !! end
18245
18246 # Nested template calls; this case was broken by Parser.php rev 1.506,
18247 # since reverted.
18248
18249 !! article
18250 Template:One-parameter
18251 !! text
18252 (My parameter is: {{{1}}})
18253 !! endarticle
18254
18255 !! article
18256 Template:Map-one-parameter
18257 !! text
18258 {{{{{1}}}|{{{2}}}}}
18259 !! endarticle
18260
18261 !! test
18262 Nested template calls
18263 !! wikitext
18264 {{Map-one-parameter|One-parameter|param}}
18265 !! html
18266 <p>(My parameter is: param)
18267 </p>
18268 !! end
18269
18270
18271 ###
18272 ### Sanitizer
18273 ###
18274
18275 # HTML+Tidy effectively strips out the empty tags completely
18276 # But since Parsoid doesn't it wraps the <s></s> tags in p-tags
18277 # which Tidy would have done for the PHP parser had there been content inside it.
18278 !! test
18279 Sanitizer: Closing of open tags
18280 !! wikitext
18281 <s></s><table></table>
18282 !! html
18283 <s></s><table></table>
18284
18285 !! html/parsoid
18286 <p><s></s></p><table></table>
18287 !! end
18288
18289 !! test
18290 Sanitizer: Closing of open but not closed tags
18291 !! wikitext
18292 <s>foo
18293 !! html
18294 <p><s>foo</s>
18295 </p>
18296 !! end
18297
18298 !! test
18299 Sanitizer: Closing of closed but not open tags
18300 !! options
18301 parsoid=wt2html
18302 !! wikitext
18303 </s>
18304 !! html/php+tidy
18305 !! html/parsoid
18306 !! end
18307
18308 !! test
18309 Sanitizer: Closing of closed but not open table tags
18310 !! options
18311 parsoid=wt2html
18312 !! wikitext
18313 Table not started</td></tr></table>
18314 !! html/php+tidy
18315 <p>Table not started</p>
18316 !! html/parsoid
18317 <p>Table not started</p>
18318 !! end
18319
18320 !! test
18321 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
18322 !! wikitext
18323 <span id="æ: v">byte</span>[[#æ: v|backlink]]
18324 !! html/php
18325 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
18326 </p>
18327 !! html/parsoid
18328 <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>
18329 !! end
18330
18331 # In HTML5, the restrictions are that id must contain at least one character,
18332 # and must not contain any space characters.
18333 !! test
18334 Sanitizer: Validating the contents of the id attribute (T6515)
18335 !! options
18336 disabled
18337 !! wikitext
18338 <br id="" /><br id="a space" />
18339 !! html
18340 Something ...
18341 !! end
18342
18343 # In HTML5, id must be unique amongst all the ids in the element's home subtree.
18344 !! test
18345 Sanitizer: Validating id attribute uniqueness (T6515, T8301)
18346 !! options
18347 disabled
18348 !! wikitext
18349 <br id="foo" /><br id="foo" />
18350 !! html
18351 Something need to be done. foo-2 ?
18352 !! end
18353
18354 !! test
18355 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
18356 !! wikitext
18357 <div itemscope>
18358 <meta itemprop="hello" content="world">
18359 <meta http-equiv="refresh" content="5">
18360 <meta itemprop="hello" http-equiv="refresh" content="5">
18361 <link itemprop="hello" href="{{SERVER}}">
18362 <link rel="stylesheet" href="{{SERVER}}">
18363 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
18364 </div>
18365 !! html
18366 <div itemscope="">
18367 <p> <meta itemprop="hello" content="world" />
18368 &lt;meta http-equiv="refresh" content="5"&gt;
18369 <meta itemprop="hello" content="5" />
18370 <link itemprop="hello" href="http&#58;//example.org" />
18371 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
18372 <link itemprop="hello" href="http&#58;//example.org" />
18373 </p>
18374 </div>
18375
18376 !! end
18377
18378 !! test
18379 Sanitizer: Strip comments from CSS attributes
18380 !! options
18381 parsoid=wt2html,wt2wt
18382 !! wikitext
18383 <span style="margin:/*negate mbox-text padding */-0.125em -0.45em; /*rainbow*/rgba(255, 0, 0, 0.3)">2013</span>
18384 !! html/php
18385 <p><span style="margin: -0.125em -0.45em; rgba(255, 0, 0, 0.3)">2013</span>
18386 </p>
18387 !! html/parsoid
18388 <p><span style="margin: -0.125em -0.45em; rgba(255, 0, 0, 0.3)">2013</span></p>
18389 !! end
18390
18391 !! test
18392 Language converter: output gets cut off unexpectedly (T7757)
18393 !! options
18394 language=zh
18395 !! wikitext
18396 this bit is safe: }-
18397
18398 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
18399
18400 then we get cut off here: }-
18401
18402 all additional text is vanished
18403 !! html/php
18404 <p>this bit is safe: }-
18405 </p><p>but if we add a conversion instance: xxx
18406 </p><p>then we get cut off here: }-
18407 </p><p>all additional text is vanished
18408 </p>
18409 !! html/parsoid
18410 <p>this bit is safe: }-</p>
18411 <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>
18412 <p>then we get cut off here: }-</p>
18413 <p>all additional text is vanished</p>
18414 !! end
18415
18416 !! test
18417 Self closed html pairs (T7487)
18418 !! wikitext
18419 <center><font id="bug" />Centered text</center>
18420 <div><font id="bug2" />In div text</div>
18421 !! html+tidy
18422 <center><font id="bug"></font>Centered text</center>
18423 <div><font id="bug2"></font>In div text</div>
18424 !! end
18425
18426 #
18427 #
18428 #
18429
18430 !! test
18431 Punctuation: nbsp before exclamation
18432 !! wikitext
18433 C'est grave !
18434 !! html
18435 <p>C'est grave&#160;!
18436 </p>
18437 !! end
18438
18439 !! test
18440 Punctuation: CSS !important (T13874)
18441 !! wikitext
18442 <div style="width:50% !important">important</div>
18443 !! html
18444 <div style="width:50% !important">important</div>
18445
18446 !!end
18447
18448 !! test
18449 Punctuation: CSS ! important (T13874; with space after)
18450 !! wikitext
18451 <div style="width:50% ! important">important</div>
18452 !! html
18453 <div style="width:50% ! important">important</div>
18454
18455 !!end
18456
18457 !! test
18458 HTML bullet list, closed tags (T7497)
18459 !! wikitext
18460 <ul>
18461 <li>One</li>
18462 <li>Two</li>
18463 </ul>
18464 !! html/php
18465 <ul>
18466 <li>One</li>
18467 <li>Two</li>
18468 </ul>
18469
18470 !! html/parsoid
18471 <ul data-parsoid='{"stx":"html"}'>
18472 <li data-parsoid='{"stx":"html"}'>One</li>
18473 <li data-parsoid='{"stx":"html"}'>Two</li>
18474 </ul>
18475
18476 !! end
18477
18478 !! test
18479 HTML bullet list, unclosed tags (T7497)
18480 !! wikitext
18481 <ul>
18482 <li>One
18483 <li>Two
18484 </ul>
18485 !! html/php+tidy
18486 <ul>
18487 <li>One</li>
18488 <li>Two</li>
18489 </ul>
18490 !! html/parsoid
18491 <ul data-parsoid='{"stx":"html"}'>
18492 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
18493 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
18494 </ul>
18495
18496 !! end
18497
18498 !! test
18499 HTML ordered list, closed tags (T7497)
18500 !! wikitext
18501 <ol>
18502 <li>One</li>
18503 <li>Two</li>
18504 </ol>
18505 !! html/php
18506 <ol>
18507 <li>One</li>
18508 <li>Two</li>
18509 </ol>
18510
18511 !! html/parsoid
18512 <ol data-parsoid='{"stx":"html"}'>
18513 <li data-parsoid='{"stx":"html"}'>One</li>
18514 <li data-parsoid='{"stx":"html"}'>Two</li>
18515 </ol>
18516
18517 !! end
18518
18519 !! test
18520 HTML ordered list, unclosed tags (T7497)
18521 !! options
18522 !! wikitext
18523 <ol>
18524 <li>One
18525 <li>Two
18526 </ol>
18527 !! html/php+tidy
18528 <ol>
18529 <li>One</li>
18530 <li>Two</li>
18531 </ol>
18532 !! html/parsoid
18533 <ol data-parsoid='{"stx":"html"}'>
18534 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
18535 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
18536 </ol>
18537
18538 !! end
18539
18540 !! test
18541 HTML nested bullet list, closed tags (T7497)
18542 !! wikitext
18543 <ul>
18544 <li>One</li>
18545 <li>Two:
18546 <ul>
18547 <li>Sub-one</li>
18548 <li>Sub-two</li>
18549 </ul>
18550 </li>
18551 </ul>
18552 !! html/php
18553 <ul>
18554 <li>One</li>
18555 <li>Two:
18556 <ul>
18557 <li>Sub-one</li>
18558 <li>Sub-two</li>
18559 </ul>
18560 </li>
18561 </ul>
18562
18563 !! html/parsoid
18564 <ul data-parsoid='{"stx":"html"}'>
18565 <li data-parsoid='{"stx":"html"}'>One</li>
18566 <li data-parsoid='{"stx":"html"}'>Two:
18567 <ul data-parsoid='{"stx":"html"}'>
18568 <li data-parsoid='{"stx":"html"}'>Sub-one</li>
18569 <li data-parsoid='{"stx":"html"}'>Sub-two</li>
18570 </ul>
18571 </li>
18572 </ul>
18573 !! end
18574
18575 !! test
18576 HTML nested bullet list, open tags (T7497)
18577 !! wikitext
18578 <ul>
18579 <li>One
18580 <li>Two:
18581 <ul>
18582 <li>Sub-one
18583 <li>Sub-two
18584 </ul>
18585 </ul>
18586 !! html/php+tidy
18587 <ul>
18588 <li>One</li>
18589 <li>Two:
18590 <ul>
18591 <li>Sub-one</li>
18592 <li>Sub-two</li>
18593 </ul>
18594 </li>
18595 </ul>
18596 !! html/parsoid
18597 <ul>
18598 <li>One
18599 </li>
18600 <li>Two:
18601 <ul>
18602 <li>Sub-one
18603 </li>
18604 <li>Sub-two
18605 </li>
18606 </ul>
18607 </li>
18608 </ul>
18609
18610 !! end
18611
18612 !! test
18613 HTML nested ordered list, closed tags (T7497)
18614 !! wikitext
18615 <ol>
18616 <li>One</li>
18617 <li>Two:
18618 <ol>
18619 <li>Sub-one</li>
18620 <li>Sub-two</li>
18621 </ol>
18622 </li>
18623 </ol>
18624 !! html
18625 <ol>
18626 <li>One</li>
18627 <li>Two:
18628 <ol>
18629 <li>Sub-one</li>
18630 <li>Sub-two</li>
18631 </ol>
18632 </li>
18633 </ol>
18634
18635 !! end
18636
18637 !! test
18638 HTML nested ordered list, open tags (T7497)
18639 !! wikitext
18640 <ol>
18641 <li>One
18642 <li>Two:
18643 <ol>
18644 <li>Sub-one
18645 <li>Sub-two
18646 </ol>
18647 </ol>
18648 !! html/php
18649 <ol>
18650 <li>One
18651 <li>Two:
18652 <ol>
18653 <li>Sub-one
18654 <li>Sub-two
18655 </ol>
18656 </ol>
18657
18658 !! html/parsoid
18659 <ol>
18660 <li>One
18661 </li>
18662 <li>Two:
18663 <ol>
18664 <li>Sub-one
18665 </li>
18666 <li>Sub-two
18667 </li>
18668 </ol>
18669 </li>
18670 </ol>
18671
18672 !! end
18673
18674 !! test
18675 HTML ordered list item with parameters oddity
18676 !! wikitext
18677 <ol><li id="fragment">One</li>
18678 </ol>
18679 !! html
18680 <ol><li id="fragment">One</li>
18681 </ol>
18682
18683 !! end
18684
18685 # parsoid doesn't explicitly mark autonumbered links, see T55505
18686 !!test
18687 T7918: autonumbering
18688 !! wikitext
18689 [http://first/] [http://second] [ftp://ftp]
18690
18691 ftp://inlineftp
18692
18693 [mailto:enclosed@mail.tld With target]
18694
18695 [mailto:enclosed@mail.tld]
18696
18697 mailto:inline@mail.tld
18698 !! html/php
18699 <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>
18700 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
18701 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
18702 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
18703 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
18704 </p>
18705 !! html/parsoid
18706 <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>
18707 <p><a rel="mw:ExtLink" href="ftp://inlineftp">ftp://inlineftp</a></p>
18708 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld">With target</a></p>
18709 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld"></a></p>
18710 <p><a rel="mw:ExtLink" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a></p>
18711 !! end
18712
18713
18714 #
18715 # Security and HTML correctness
18716 # From Nick Jenkins' fuzz testing
18717 #
18718
18719 !! test
18720 Fuzz testing: Parser13
18721 !! wikitext
18722 {|
18723 | http://a|
18724 !! html
18725 <table>
18726 <tr>
18727 <td>
18728 </td>
18729 </tr>
18730 </table>
18731
18732 !! end
18733
18734 !! test
18735 Fuzz testing: Parser14
18736 !! wikitext
18737 == onmouseover= ==
18738 http://__TOC__
18739 !! html
18740 <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>
18741 http://<div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
18742 <ul>
18743 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
18744 </ul>
18745 </div>
18746
18747
18748 !! html+tidy
18749 <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>
18750 <p>http://</p>
18751 <div id="toc" class="toc">
18752 <div class="toctitle">
18753 <h2>Contents</h2>
18754 </div>
18755 <ul>
18756 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
18757 </ul>
18758 </div>
18759 <p></p>
18760 !! end
18761
18762 !! test
18763 Fuzz testing: Parser14-table
18764 !! options
18765 parsoid=wt2html,html2html
18766 !! wikitext
18767 ==a==
18768 {| STYLE=__TOC__
18769 !! html
18770 <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>
18771 <table style="&#95;_TOC&#95;_">
18772 <tr><td></td></tr>
18773 </table>
18774
18775 !! html+tidy
18776 <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>
18777 <table style="__TOC__">
18778 <tr>
18779 <td></td>
18780 </tr>
18781 </table>
18782 !! html/parsoid
18783 <h2>a</h2>
18784 <table style="__TOC__"></table>
18785 !! end
18786
18787 # Known to produce bogus xml (extra </td>)
18788 !! test
18789 Fuzz testing: Parser16
18790 !! wikitext
18791 {|
18792 !https://||||||
18793 !! html
18794 <table>
18795 <tr>
18796 <th>https://</th>
18797 <th></th>
18798 <th></th>
18799 <th>
18800 </td>
18801 </tr>
18802 </table>
18803
18804 !! html+tidy
18805 <table>
18806 <tr>
18807 <th>https://</th>
18808 <th></th>
18809 <th></th>
18810 <th></th>
18811 </tr>
18812 </table>
18813 !! end
18814
18815 !! test
18816 Fuzz testing: Parser21
18817 !! wikitext
18818 {|
18819 ! irc://{{ftp://a" onmouseover="alert('hello world');"
18820 |
18821 !! html
18822 <table>
18823 <tr>
18824 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
18825 </th>
18826 <td>
18827 </td>
18828 </tr>
18829 </table>
18830
18831 !! end
18832
18833 !! test
18834 Fuzz testing: Parser22
18835 !! wikitext
18836 http://===r:::https://b
18837
18838 {|
18839 !! html
18840 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
18841 </p>
18842 <table>
18843 <tr><td></td></tr>
18844 </table>
18845
18846 !! end
18847
18848 # Known to produce bad XML for now
18849 !! test
18850 Fuzz testing: Parser24
18851 !! options
18852 parsoid=wt2html
18853 !! wikitext
18854 {|
18855 {{{|
18856 <u CLASS=
18857 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
18858 <br style="onmouseover='alert(document.cookie);' " />
18859
18860 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
18861 |
18862 !! html/php
18863 <table>
18864 {{{|
18865 <u class="&#124;">}}}} &gt;
18866 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
18867
18868 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
18869 <tr>
18870 <td></u>
18871 </td>
18872 </tr>
18873 </table>
18874
18875 !! html/parsoid
18876 <p data-parsoid='{"fostered":true,"autoInsertedEnd":true}'>{{{|
18877 <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>"}'/>}}}} >
18878 <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}'>
18879
18880
18881
18882 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'></td></tr></tbody></table>
18883 !! end
18884
18885 # Note: the current result listed for this is not what the original one was,
18886 # but the original bug was JavaScript injection, which is fixed in any case.
18887 # It's not clear that the original result listed was any more correct than the
18888 # current one. Original result:
18889 # <p>{{{|
18890 # </p>
18891 # <li class="&#124;&#124;">
18892 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
18893 !!test
18894 Fuzz testing: Parser25 (T8055)
18895 !! wikitext
18896 {{{
18897 |
18898 <LI CLASS=||
18899 >
18900 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
18901 !! html/php
18902 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
18903 </p>
18904 !! html/parsoid
18905 <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"]}'>
18906 </span><p about="#mwt1">&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b></p>
18907 !! end
18908
18909 !!test
18910 Fuzz testing: URL adjacent extension (with space, clean)
18911 !! wikitext
18912 http://example.com <nowiki>junk</nowiki>
18913 !! html/php
18914 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
18915 </p>
18916 !! html/parsoid
18917 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a> <span typeof="mw:Nowiki">junk</span></p>
18918 !! end
18919
18920 !!test
18921 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
18922 !! wikitext
18923 http://example.com<nowiki>junk</nowiki>
18924 !! html/php
18925 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
18926 </p>
18927 !! html/parsoid
18928 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a><span typeof="mw:Nowiki">junk</span></p>
18929 !! end
18930
18931 !! test
18932 Fuzz testing: URL adjacent extension (no space, dirty; pre)
18933 !! wikitext
18934 http://example.com<pre>junk</pre>
18935 !! html/php
18936 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
18937
18938 !! html/php+tidy
18939 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></p>
18940 <pre>
18941 junk
18942 </pre>
18943 !! html/parsoid
18944 <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>
18945 !! end
18946
18947 !! test
18948 Fuzz testing: image with bogus manual thumbnail
18949 !! wikitext
18950 [[Image:foobar.jpg|thumbnail= ]]
18951 !! html/php
18952 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
18953
18954 !! html/parsoid
18955 <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>
18956 !! end
18957
18958 !! test
18959 Fuzz testing: encoded newline in generated HTML replacements (T8577)
18960 !! wikitext
18961 <pre dir="&#10;"></pre>
18962 !! html/php
18963 <pre dir="&#10;"></pre>
18964
18965 !! html/parsoid
18966 <pre typeof="mw:Extension/pre" about="#mwt2" dir="&amp;#10;" data-mw='{"name":"pre","attrs":{"dir":"&amp;#10;"},"body":{"extsrc":""}}'></pre>
18967 !! end
18968
18969 !! test
18970 Parsing optional HTML elements (T8171)
18971 !! options
18972 !! wikitext
18973 <table>
18974 <tr>
18975 <td> Some tabular data</td>
18976 <td> More tabular data ...
18977 <td> And yet som tabular data</td>
18978 </tr>
18979 </table>
18980 !! html
18981 <table>
18982 <tr>
18983 <td> Some tabular data</td>
18984 <td> More tabular data ...
18985 </td><td> And yet som tabular data</td>
18986 </tr>
18987 </table>
18988
18989 !! end
18990
18991 !! test
18992 Correct handling of <td>, <tr> (T8171)
18993 !! options
18994 !! wikitext
18995 <table>
18996 <tr>
18997 <td> Some tabular data</td>
18998 <td> More tabular data ...</td>
18999 <td> And yet som tabular data</td>
19000 </tr>
19001 </table>
19002 !! html
19003 <table>
19004 <tr>
19005 <td> Some tabular data</td>
19006 <td> More tabular data ...</td>
19007 <td> And yet som tabular data</td>
19008 </tr>
19009 </table>
19010
19011 !! end
19012
19013
19014 !! test
19015 Parsing crashing regression (fr:JavaScript)
19016 !! wikitext
19017 </body></x>
19018 !! html
19019 <p>&lt;/body&gt;&lt;/x&gt;
19020 </p>
19021 !! end
19022
19023 !! test
19024 Inline wiki vs wiki block nesting
19025 !! wikitext
19026 '''Bold paragraph
19027
19028 New wiki paragraph
19029 !! html
19030 <p><b>Bold paragraph</b>
19031 </p><p>New wiki paragraph
19032 </p>
19033 !! end
19034
19035 # FIXME: The current php output is documented
19036 # and desired output is the parsoid target.
19037 !! test
19038 Inline HTML vs wiki block nesting
19039 !! wikitext
19040 <b>Bold paragraph
19041
19042 New wiki paragraph
19043 !! html/php
19044 <p><b>Bold paragraph
19045 </p><p>New wiki paragraph</b>
19046 </p>
19047 !! html/parsoid
19048 <p><b>Bold paragraph</b>
19049 </p><p>New wiki paragraph
19050 </p>
19051 !! end
19052
19053 # Original result was this:
19054 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
19055 # </p>
19056 # While that might be marginally more intuitive, maybe, the six-apostrophe
19057 # construct is clearly pathological and the result stated here (which is what
19058 # the parser actually does) is about as reasonable as anything.
19059 !!test
19060 Mixing markup for italics and bold
19061 !! options
19062 !! wikitext
19063 '''bold''''''bold''bolditalics'''''
19064 !! html
19065 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
19066 </p>
19067 !! end
19068
19069
19070 !! article
19071 Xyzzyx
19072 !! text
19073 Article for special page transclusion test
19074 !! endarticle
19075
19076 !! test
19077 Special page transclusion
19078 !! options
19079 !! wikitext
19080 {{Special:Prefixindex/Xyzzyx}}
19081 !! html
19082 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
19083 </ul>
19084
19085 !! end
19086
19087 !! test
19088 Special page transclusion twice (T7021)
19089 !! options
19090 !! wikitext
19091 {{Special:Prefixindex/Xyzzyx}}
19092 {{Special:Prefixindex/Xyzzyx}}
19093 !! html
19094 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
19095 </ul>
19096 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
19097 </ul>
19098
19099 !! end
19100
19101 !! test
19102 Transclusion of default MediaWiki message
19103 !! wikitext
19104 {{MediaWiki:Mainpage}}
19105 !! html
19106 <p>Main Page
19107 </p>
19108 !! end
19109
19110 !! test
19111 Transclusion of nonexistent MediaWiki message
19112 !! wikitext
19113 {{MediaWiki:Mainpagexxx}}
19114 !! html
19115 <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>
19116 </p>
19117 !! end
19118
19119 !! test
19120 Transclusion of MediaWiki message with underscore
19121 !! wikitext
19122 {{MediaWiki:history_short}}
19123 !! html
19124 <p>History
19125 </p>
19126 !! end
19127
19128 !! test
19129 Transclusion of MediaWiki message with space
19130 !! wikitext
19131 {{MediaWiki:history short}}
19132 !! html
19133 <p>History
19134 </p>
19135 !! end
19136
19137 !! test
19138 Invalid header with following text
19139 !! wikitext
19140 = x = y
19141 !! html
19142 <p>= x = y
19143 </p>
19144 !! end
19145
19146
19147 !! test
19148 Section extraction test (section 0)
19149 !! options
19150 section=0
19151 !! wikitext
19152 start
19153 ==a==
19154 ===aa===
19155 ====aaa====
19156 ==b==
19157 ===ba===
19158 ===bb===
19159 ====bba====
19160 ===bc===
19161 ==c==
19162 ===ca===
19163 !! html/php
19164 start
19165 !! end
19166
19167 !! test
19168 Section extraction test (section 1)
19169 !! options
19170 section=1
19171 !! wikitext
19172 start
19173 ==a==
19174 ===aa===
19175 ====aaa====
19176 ==b==
19177 ===ba===
19178 ===bb===
19179 ====bba====
19180 ===bc===
19181 ==c==
19182 ===ca===
19183 !! html/php
19184 ==a==
19185 ===aa===
19186 ====aaa====
19187 !! end
19188
19189 !! test
19190 Section extraction test (section 2)
19191 !! options
19192 section=2
19193 !! wikitext
19194 start
19195 ==a==
19196 ===aa===
19197 ====aaa====
19198 ==b==
19199 ===ba===
19200 ===bb===
19201 ====bba====
19202 ===bc===
19203 ==c==
19204 ===ca===
19205 !! html/php
19206 ===aa===
19207 ====aaa====
19208 !! end
19209
19210 !! test
19211 Section extraction test (section 3)
19212 !! options
19213 section=3
19214 !! wikitext
19215 start
19216 ==a==
19217 ===aa===
19218 ====aaa====
19219 ==b==
19220 ===ba===
19221 ===bb===
19222 ====bba====
19223 ===bc===
19224 ==c==
19225 ===ca===
19226 !! html/php
19227 ====aaa====
19228 !! end
19229
19230 !! test
19231 Section extraction test (section 4)
19232 !! options
19233 section=4
19234 !! wikitext
19235 start
19236 ==a==
19237 ===aa===
19238 ====aaa====
19239 ==b==
19240 ===ba===
19241 ===bb===
19242 ====bba====
19243 ===bc===
19244 ==c==
19245 ===ca===
19246 !! html/php
19247 ==b==
19248 ===ba===
19249 ===bb===
19250 ====bba====
19251 ===bc===
19252 !! end
19253
19254 !! test
19255 Section extraction test (section 5)
19256 !! options
19257 section=5
19258 !! wikitext
19259 start
19260 ==a==
19261 ===aa===
19262 ====aaa====
19263 ==b==
19264 ===ba===
19265 ===bb===
19266 ====bba====
19267 ===bc===
19268 ==c==
19269 ===ca===
19270 !! html/php
19271 ===ba===
19272 !! end
19273
19274 !! test
19275 Section extraction test (section 6)
19276 !! options
19277 section=6
19278 !! wikitext
19279 start
19280 ==a==
19281 ===aa===
19282 ====aaa====
19283 ==b==
19284 ===ba===
19285 ===bb===
19286 ====bba====
19287 ===bc===
19288 ==c==
19289 ===ca===
19290 !! html/php
19291 ===bb===
19292 ====bba====
19293 !! end
19294
19295 !! test
19296 Section extraction test (section 7)
19297 !! options
19298 section=7
19299 !! wikitext
19300 start
19301 ==a==
19302 ===aa===
19303 ====aaa====
19304 ==b==
19305 ===ba===
19306 ===bb===
19307 ====bba====
19308 ===bc===
19309 ==c==
19310 ===ca===
19311 !! html/php
19312 ====bba====
19313 !! end
19314
19315 !! test
19316 Section extraction test (section 8)
19317 !! options
19318 section=8
19319 !! wikitext
19320 start
19321 ==a==
19322 ===aa===
19323 ====aaa====
19324 ==b==
19325 ===ba===
19326 ===bb===
19327 ====bba====
19328 ===bc===
19329 ==c==
19330 ===ca===
19331 !! html/php
19332 ===bc===
19333 !! end
19334
19335 !! test
19336 Section extraction test (section 9)
19337 !! options
19338 section=9
19339 !! wikitext
19340 start
19341 ==a==
19342 ===aa===
19343 ====aaa====
19344 ==b==
19345 ===ba===
19346 ===bb===
19347 ====bba====
19348 ===bc===
19349 ==c==
19350 ===ca===
19351 !! html/php
19352 ==c==
19353 ===ca===
19354 !! end
19355
19356 !! test
19357 Section extraction test (section 10)
19358 !! options
19359 section=10
19360 !! wikitext
19361 start
19362 ==a==
19363 ===aa===
19364 ====aaa====
19365 ==b==
19366 ===ba===
19367 ===bb===
19368 ====bba====
19369 ===bc===
19370 ==c==
19371 ===ca===
19372 !! html/php
19373 ===ca===
19374 !! end
19375
19376 !! test
19377 Section extraction test (nonexistent section 11)
19378 !! options
19379 section=11
19380 !! wikitext
19381 start
19382 ==a==
19383 ===aa===
19384 ====aaa====
19385 ==b==
19386 ===ba===
19387 ===bb===
19388 ====bba====
19389 ===bc===
19390 ==c==
19391 ===ca===
19392 !! html/php
19393 !! end
19394
19395 !! test
19396 Section extraction test with bogus heading (section 1)
19397 !! options
19398 section=1
19399 !! wikitext
19400 ==a==
19401 ==bogus== not a legal section
19402 ==b==
19403 !! html/php
19404 ==a==
19405 ==bogus== not a legal section
19406 !! end
19407
19408 !! test
19409 Section extraction test with bogus heading (section 2)
19410 !! options
19411 section=2
19412 !! wikitext
19413 ==a==
19414 ==bogus== not a legal section
19415 ==b==
19416 !! html/php
19417 ==b==
19418 !! end
19419
19420 !! test
19421 Section extraction test with comment after heading (section 1)
19422 !! options
19423 section=1
19424 !! wikitext
19425 ==a==
19426 ==b== <!-- -->
19427 ==c==
19428 !! html/php
19429 ==a==
19430 !! end
19431
19432 !! test
19433 Section extraction test with comment after heading (section 2)
19434 !! options
19435 section=2
19436 !! wikitext
19437 ==a==
19438 ==b== <!-- -->
19439 ==c==
19440 !! html/php
19441 ==b== <!-- -->
19442 !! end
19443
19444 !! test
19445 Section extraction test with bogus <nowiki> heading (section 1)
19446 !! options
19447 section=1
19448 !! wikitext
19449 ==a==
19450 ==bogus== <nowiki>not a legal section</nowiki>
19451 ==b==
19452 !! html/php
19453 ==a==
19454 ==bogus== <nowiki>not a legal section</nowiki>
19455 !! end
19456
19457 !! test
19458 Section extraction test with bogus <nowiki> heading (section 2)
19459 !! options
19460 section=2
19461 !! wikitext
19462 ==a==
19463 ==bogus== <nowiki>not a legal section</nowiki>
19464 ==b==
19465 !! html/php
19466 ==b==
19467 !! end
19468
19469 # Formerly testing for T4587, now resolved by the use of unmarked sections
19470 # instead of respecting commented sections
19471 !! test
19472 Section extraction prefixed by comment (section 1)
19473 !! options
19474 section=1
19475 !! wikitext
19476 <!-- -->==sec1==
19477 ==sec2==
19478 !! html/php
19479 ==sec2==
19480 !!end
19481
19482 !! test
19483 Section extraction prefixed by comment (section 2)
19484 !! options
19485 section=2
19486 !! wikitext
19487 <!-- -->==sec1==
19488 ==sec2==
19489 !! html/php
19490
19491 !!end
19492
19493 # Formerly testing for T4607, now resolved by the use of unmarked sections
19494 # instead of respecting HTML-style headings
19495 !! test
19496 Section extraction, mixed wiki and html (section 1)
19497 !! options
19498 section=1
19499 !! wikitext
19500 <h2>unmarked</h2>
19501 unmarked
19502 ==1==
19503 one
19504 ==2==
19505 two
19506 !! html/php
19507 ==1==
19508 one
19509 !! end
19510
19511 !! test
19512 Section extraction, mixed wiki and html (section 2)
19513 !! options
19514 section=2
19515 !! wikitext
19516 <h2>unmarked</h2>
19517 unmarked
19518 ==1==
19519 one
19520 ==2==
19521 two
19522 !! html/php
19523 ==2==
19524 two
19525 !! end
19526
19527
19528 # Formerly testing for T5342
19529 !! test
19530 Section extraction, heading surrounded by <noinclude>
19531 !! options
19532 section=1
19533 !! wikitext
19534 <noinclude>==unmarked==</noinclude>
19535 ==marked==
19536 !! html/php
19537 ==marked==
19538 !!end
19539
19540 # Test behavior of T21910
19541 !! test
19542 Sectiion with all-equals
19543 !! options
19544 section=2
19545 !! wikitext
19546 ===
19547 The line above must have a trailing space
19548 === <!--
19549 --> <!-- -->
19550 But just in case it doesn't...
19551 !! html/php
19552 === <!--
19553 --> <!-- -->
19554 But just in case it doesn't...
19555 !! end
19556
19557 !! test
19558 Section replacement test (section 0)
19559 !! options
19560 replace=0,"xxx"
19561 !! wikitext
19562 start
19563 ==a==
19564 ===aa===
19565 ====aaa====
19566 ==b==
19567 ===ba===
19568 ===bb===
19569 ====bba====
19570 ===bc===
19571 ==c==
19572 ===ca===
19573 !! html/php
19574 xxx
19575
19576 ==a==
19577 ===aa===
19578 ====aaa====
19579 ==b==
19580 ===ba===
19581 ===bb===
19582 ====bba====
19583 ===bc===
19584 ==c==
19585 ===ca===
19586 !! end
19587
19588 !! test
19589 Section replacement test (section 1)
19590 !! options
19591 replace=1,"xxx"
19592 !! wikitext
19593 start
19594 ==a==
19595 ===aa===
19596 ====aaa====
19597 ==b==
19598 ===ba===
19599 ===bb===
19600 ====bba====
19601 ===bc===
19602 ==c==
19603 ===ca===
19604 !! html/php
19605 start
19606 xxx
19607
19608 ==b==
19609 ===ba===
19610 ===bb===
19611 ====bba====
19612 ===bc===
19613 ==c==
19614 ===ca===
19615 !! end
19616
19617 !! test
19618 Section replacement test (section 2)
19619 !! options
19620 replace=2,"xxx"
19621 !! wikitext
19622 start
19623 ==a==
19624 ===aa===
19625 ====aaa====
19626 ==b==
19627 ===ba===
19628 ===bb===
19629 ====bba====
19630 ===bc===
19631 ==c==
19632 ===ca===
19633 !! html/php
19634 start
19635 ==a==
19636 xxx
19637
19638 ==b==
19639 ===ba===
19640 ===bb===
19641 ====bba====
19642 ===bc===
19643 ==c==
19644 ===ca===
19645 !! end
19646
19647 !! test
19648 Section replacement test (section 3)
19649 !! options
19650 replace=3,"xxx"
19651 !! wikitext
19652 start
19653 ==a==
19654 ===aa===
19655 ====aaa====
19656 ==b==
19657 ===ba===
19658 ===bb===
19659 ====bba====
19660 ===bc===
19661 ==c==
19662 ===ca===
19663 !! html/php
19664 start
19665 ==a==
19666 ===aa===
19667 xxx
19668
19669 ==b==
19670 ===ba===
19671 ===bb===
19672 ====bba====
19673 ===bc===
19674 ==c==
19675 ===ca===
19676 !! end
19677
19678 !! test
19679 Section replacement test (section 4)
19680 !! options
19681 replace=4,"xxx"
19682 !! wikitext
19683 start
19684 ==a==
19685 ===aa===
19686 ====aaa====
19687 ==b==
19688 ===ba===
19689 ===bb===
19690 ====bba====
19691 ===bc===
19692 ==c==
19693 ===ca===
19694 !! html/php
19695 start
19696 ==a==
19697 ===aa===
19698 ====aaa====
19699 xxx
19700
19701 ==c==
19702 ===ca===
19703 !! end
19704
19705 !! test
19706 Section replacement test (section 5)
19707 !! options
19708 replace=5,"xxx"
19709 !! wikitext
19710 start
19711 ==a==
19712 ===aa===
19713 ====aaa====
19714 ==b==
19715 ===ba===
19716 ===bb===
19717 ====bba====
19718 ===bc===
19719 ==c==
19720 ===ca===
19721 !! html/php
19722 start
19723 ==a==
19724 ===aa===
19725 ====aaa====
19726 ==b==
19727 xxx
19728
19729 ===bb===
19730 ====bba====
19731 ===bc===
19732 ==c==
19733 ===ca===
19734 !! end
19735
19736 !! test
19737 Section replacement test (section 6)
19738 !! options
19739 replace=6,"xxx"
19740 !! wikitext
19741 start
19742 ==a==
19743 ===aa===
19744 ====aaa====
19745 ==b==
19746 ===ba===
19747 ===bb===
19748 ====bba====
19749 ===bc===
19750 ==c==
19751 ===ca===
19752 !! html/php
19753 start
19754 ==a==
19755 ===aa===
19756 ====aaa====
19757 ==b==
19758 ===ba===
19759 xxx
19760
19761 ===bc===
19762 ==c==
19763 ===ca===
19764 !! end
19765
19766 !! test
19767 Section replacement test (section 7)
19768 !! options
19769 replace=7,"xxx"
19770 !! wikitext
19771 start
19772 ==a==
19773 ===aa===
19774 ====aaa====
19775 ==b==
19776 ===ba===
19777 ===bb===
19778 ====bba====
19779 ===bc===
19780 ==c==
19781 ===ca===
19782 !! html/php
19783 start
19784 ==a==
19785 ===aa===
19786 ====aaa====
19787 ==b==
19788 ===ba===
19789 ===bb===
19790 xxx
19791
19792 ===bc===
19793 ==c==
19794 ===ca===
19795 !! end
19796
19797 !! test
19798 Section replacement test (section 8)
19799 !! options
19800 replace=8,"xxx"
19801 !! wikitext
19802 start
19803 ==a==
19804 ===aa===
19805 ====aaa====
19806 ==b==
19807 ===ba===
19808 ===bb===
19809 ====bba====
19810 ===bc===
19811 ==c==
19812 ===ca===
19813 !! html/php
19814 start
19815 ==a==
19816 ===aa===
19817 ====aaa====
19818 ==b==
19819 ===ba===
19820 ===bb===
19821 ====bba====
19822 xxx
19823
19824 ==c==
19825 ===ca===
19826 !!end
19827
19828 !! test
19829 Section replacement test (section 9)
19830 !! options
19831 replace=9,"xxx"
19832 !! wikitext
19833 start
19834 ==a==
19835 ===aa===
19836 ====aaa====
19837 ==b==
19838 ===ba===
19839 ===bb===
19840 ====bba====
19841 ===bc===
19842 ==c==
19843 ===ca===
19844 !! html/php
19845 start
19846 ==a==
19847 ===aa===
19848 ====aaa====
19849 ==b==
19850 ===ba===
19851 ===bb===
19852 ====bba====
19853 ===bc===
19854 xxx
19855 !! end
19856
19857 !! test
19858 Section replacement test (section 10)
19859 !! options
19860 replace=10,"xxx"
19861 !! wikitext
19862 start
19863 ==a==
19864 ===aa===
19865 ====aaa====
19866 ==b==
19867 ===ba===
19868 ===bb===
19869 ====bba====
19870 ===bc===
19871 ==c==
19872 ===ca===
19873 !! html/php
19874 start
19875 ==a==
19876 ===aa===
19877 ====aaa====
19878 ==b==
19879 ===ba===
19880 ===bb===
19881 ====bba====
19882 ===bc===
19883 ==c==
19884 xxx
19885 !! end
19886
19887 !! test
19888 Section replacement test with initial whitespace (T15728)
19889 !! options
19890 replace=2,"xxx"
19891 !! wikitext
19892 Preformatted initial line
19893 ==a==
19894 ===a===
19895 !! html/php
19896 Preformatted initial line
19897 ==a==
19898 xxx
19899 !! end
19900
19901
19902 !! test
19903 Section extraction, heading followed by pre with 20 spaces (T8398)
19904 !! options
19905 section=1
19906 !! wikitext
19907 ==a==
19908 a
19909 !! html/php
19910 ==a==
19911 a
19912 !! end
19913
19914 !! test
19915 Section extraction, heading followed by pre with 19 spaces (T8398 sanity check)
19916 !! options
19917 section=1
19918 !! wikitext
19919 ==a==
19920 a
19921 !! html/php
19922 ==a==
19923 a
19924 !! end
19925
19926
19927 !! test
19928 Section extraction, <pre> around bogus header (T12309)
19929 !! options
19930 section=2
19931 !! wikitext
19932 == Section One ==
19933 <pre>
19934 =======
19935 </pre>
19936
19937 == Section Two ==
19938 stuff
19939 !! html/php
19940 == Section Two ==
19941 stuff
19942 !! end
19943
19944 !! test
19945 Section replacement, <pre> around bogus header (T12309)
19946 !! options
19947 replace=2,"xxx"
19948 !! wikitext
19949 == Section One ==
19950 <pre>
19951 =======
19952 </pre>
19953
19954 == Section Two ==
19955 stuff
19956 !! html/php
19957 == Section One ==
19958 <pre>
19959 =======
19960 </pre>
19961
19962 xxx
19963 !! end
19964
19965 !! test
19966 Handling of &#x0A; in URLs
19967 !! wikitext
19968 ** irc://&#x0A;a
19969 !! html/php
19970 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
19971
19972 !! html/parsoid
19973 <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>
19974 !! end
19975
19976 !! test
19977 Handling of %0A in URLs
19978 !! wikitext
19979 ** irc://%0Aa
19980 !! html/php
19981 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
19982
19983 !! html/parsoid
19984 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
19985 !! end
19986
19987 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
19988 !! test
19989 5 quotes, code coverage +1 line
19990 !! options
19991 parsoid=wt2html
19992 !! wikitext
19993 '''''
19994 !! html/php
19995 !! html/parsoid
19996 <p><b><i></i></b></p>
19997 !! end
19998
19999 # same html as previous, but wikitext adjusted to match parsoid html2wt
20000 # note that wt2html and html2html will put the <i> before the <b>
20001 !! test
20002 5 quotes, code coverage +1 line w/ nowiki (1)
20003 !! options
20004 parsoid=wt2wt,html2wt
20005 !! wikitext
20006 '''''<nowiki/>'''''
20007 !! html/php
20008 <p><i></i>
20009 </p>
20010 !! html/parsoid
20011 <p><b><i></i></b></p>
20012 !! end
20013
20014 # same as previous, just swapping the <i> and <b>
20015 !! test
20016 5 quotes, code coverage +1 line w/ nowiki (2)
20017 !! wikitext
20018 '''''<nowiki/>'''''
20019 !! html/php
20020 <p><i></i>
20021 </p>
20022 !! html/parsoid
20023 <p><i><b></b></i></p>
20024 !! end
20025
20026 !! test
20027 Special:Search page linking.
20028 !! wikitext
20029 {{Special:search}}
20030 !! html
20031 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
20032 </p>
20033 !! end
20034
20035 !! test
20036 {{!}} is a magic word
20037 !! wikitext
20038 {{!}} is a magic word there and {{!}} is still a magic word here
20039 | is not a magic word here but {{!}} is still a magic word here
20040 !! html/php
20041 <p>| is a magic word there and | is still a magic word here
20042 | is not a magic word here but | is still a magic word here
20043 </p>
20044 !! html/parsoid
20045 <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
20046 | 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>
20047 !! end
20048
20049 !! test
20050 Say the magic word
20051 !! options
20052 title=[[Parser test]]
20053 !! wikitext
20054 * {{PAGENAME}}
20055 * {{PAGENAMEE}}
20056 * {{FULLPAGENAME}}
20057 * {{FULLPAGENAMEE}}
20058 * {{BASEPAGENAME}}
20059 * {{BASEPAGENAMEE}}
20060 * {{SUBPAGENAME}}
20061 * {{SUBPAGENAMEE}}
20062 * {{ROOTPAGENAME}}
20063 * {{ROOTPAGENAMEE}}
20064 * {{TALKPAGENAME}}
20065 * {{TALKPAGENAMEE}}
20066 * {{SUBJECTPAGENAME}}
20067 * {{SUBJECTPAGENAMEE}}
20068 * {{NAMESPACEE}}
20069 * {{NAMESPACE}}
20070 * {{NAMESPACENUMBER}}
20071 * {{TALKSPACE}}
20072 * {{TALKSPACEE}}
20073 * {{SUBJECTSPACE}}
20074 * {{SUBJECTSPACEE}}
20075 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
20076 !! html
20077 <ul><li> Parser test</li>
20078 <li> Parser_test</li>
20079 <li> Parser test</li>
20080 <li> Parser_test</li>
20081 <li> Parser test</li>
20082 <li> Parser_test</li>
20083 <li> Parser test</li>
20084 <li> Parser_test</li>
20085 <li> Parser test</li>
20086 <li> Parser_test</li>
20087 <li> Talk:Parser test</li>
20088 <li> Talk:Parser_test</li>
20089 <li> Parser test</li>
20090 <li> Parser_test</li>
20091 <li> </li>
20092 <li> </li>
20093 <li> 0</li>
20094 <li> Talk</li>
20095 <li> Talk</li>
20096 <li> </li>
20097 <li> </li>
20098 <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>
20099
20100 !! end
20101 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
20102
20103 !! test
20104 Gallery with valid attributes
20105 !! wikitext
20106 <gallery type="123" summary="345">
20107 File:File:Foobar.jpg
20108 </gallery>
20109 !! html/php
20110 <ul class="gallery mw-gallery-traditional" type="123">
20111 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20112 <div class="thumb" style="height: 150px;">File:Foobar.jpg</div>
20113 <div class="gallerytext">
20114 </div>
20115 </div></li>
20116 </ul>
20117
20118 !! html/parsoid
20119 <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"}}'>
20120 <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>
20121 </ul>
20122 !! end
20123
20124 ## Parsoid thinks the "centre" here is a property, not a caption.
20125 !! test
20126 Gallery
20127 !! options
20128 parsoid={
20129 "modes": ["wt2html"],
20130 "nativeGallery": true
20131 }
20132 !! wikitext
20133 <gallery>
20134 image1.png |
20135 image2.gif|||||
20136
20137 image3|
20138 image4 |300px| centre
20139 image5.svg| http://///////
20140 [[x|xx]]]]
20141 * image6
20142 </gallery>
20143 !! html/php
20144 <ul class="gallery mw-gallery-traditional">
20145 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20146 <div class="thumb" style="height: 150px;">Image1.png</div>
20147 <div class="gallerytext">
20148 </div>
20149 </div></li>
20150 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20151 <div class="thumb" style="height: 150px;">Image2.gif</div>
20152 <div class="gallerytext">
20153 </div>
20154 </div></li>
20155 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20156 <div class="thumb" style="height: 150px;">Image3</div>
20157 <div class="gallerytext">
20158 </div>
20159 </div></li>
20160 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20161 <div class="thumb" style="height: 150px;">Image4</div>
20162 <div class="gallerytext">
20163 <pre>centre
20164 </pre>
20165 </div>
20166 </div></li>
20167 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20168 <div class="thumb" style="height: 150px;">Image5.svg</div>
20169 <div class="gallerytext">
20170 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
20171 </p>
20172 </div>
20173 </div></li>
20174 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20175 <div class="thumb" style="height: 150px;">* image6</div>
20176 <div class="gallerytext">
20177 </div>
20178 </div></li>
20179 </ul>
20180
20181 !! html/parsoid
20182 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt3" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20183 <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>
20184 <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>
20185 <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>
20186 <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>
20187 <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>
20188 <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>
20189 </ul>
20190 !! end
20191
20192 !! test
20193 Gallery (with options, html)
20194 !! options
20195 parsoid={
20196 "modes": ["wt2html", "html2html"],
20197 "nativeGallery": true
20198 }
20199 !! wikitext
20200 <gallery widths="70px" heights="40px" perrow="2" caption="Foo [[Main Page]]">
20201 File:Nonexistent.jpg|caption
20202 File:Nonexistent.jpg
20203 image:foobar.jpg|some '''caption''' [[Main Page]]
20204 image:foobar.jpg
20205 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
20206 </gallery>
20207 !! html/php
20208 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
20209 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
20210 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20211 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
20212 <div class="gallerytext">
20213 <p>caption
20214 </p>
20215 </div>
20216 </div></li>
20217 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20218 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
20219 <div class="gallerytext">
20220 </div>
20221 </div></li>
20222 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20223 <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>
20224 <div class="gallerytext">
20225 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
20226 </p>
20227 </div>
20228 </div></li>
20229 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20230 <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>
20231 <div class="gallerytext">
20232 </div>
20233 </div></li>
20234 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20235 <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>
20236 <div class="gallerytext">
20237 <p>blabla.
20238 </p>
20239 </div>
20240 </div></li>
20241 </ul>
20242
20243 !! html/parsoid
20244 <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":{}}'>
20245 <li class="gallerycaption">Foo <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a></li>
20246 <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>
20247 <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>
20248 <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>
20249 <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>
20250 <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>
20251 </ul>
20252 !! end
20253
20254 !! test
20255 Gallery (with options, extsrc)
20256 !! options
20257 parsoid={
20258 "nativeGallery": false
20259 }
20260 !! wikitext
20261 <gallery widths="70px" heights="40px" perrow="2" caption="Foo [[Main Page]]">
20262 File:Nonexistent.jpg|caption
20263 File:Nonexistent.jpg
20264 image:foobar.jpg|some '''caption''' [[Main Page]]
20265 image:foobar.jpg
20266 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
20267 </gallery>
20268 !! html/php
20269 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
20270 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
20271 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20272 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
20273 <div class="gallerytext">
20274 <p>caption
20275 </p>
20276 </div>
20277 </div></li>
20278 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20279 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
20280 <div class="gallerytext">
20281 </div>
20282 </div></li>
20283 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20284 <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>
20285 <div class="gallerytext">
20286 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
20287 </p>
20288 </div>
20289 </div></li>
20290 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20291 <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>
20292 <div class="gallerytext">
20293 </div>
20294 </div></li>
20295 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20296 <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>
20297 <div class="gallerytext">
20298 <p>blabla.
20299 </p>
20300 </div>
20301 </div></li>
20302 </ul>
20303
20304 !! html/parsoid
20305 <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"}}'>
20306 <li class="gallerycaption">Foo <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a></li>
20307 <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>
20308 <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>
20309 <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>
20310 <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>
20311 <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>
20312 </ul>
20313 !! end
20314
20315 !! test
20316 Gallery with link that has fragment
20317 !! options
20318 parsoid={
20319 "modes": ["wt2html", "html2html"],
20320 "nativeGallery": true
20321 }
20322 !! wikitext
20323 <gallery>
20324 image:foobar.jpg|link=Main_Page
20325 image:foobar.jpg|link=Main_Page#section
20326 image:foobar.jpg|link=Main Page#section|caption
20327 </gallery>
20328 !! html/php
20329 <ul class="gallery mw-gallery-traditional">
20330 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20331 <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>
20332 <div class="gallerytext">
20333 </div>
20334 </div></li>
20335 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20336 <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>
20337 <div class="gallerytext">
20338 </div>
20339 </div></li>
20340 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20341 <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>
20342 <div class="gallerytext">
20343 <p>caption
20344 </p>
20345 </div>
20346 </div></li>
20347 </ul>
20348
20349 !! html/parsoid
20350 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20351 <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>
20352 <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>
20353 <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>
20354 </ul>
20355 !! end
20356
20357 ## Whoops, Parsoid shouldn't be parsing templates in the attribute caption!
20358 !! test
20359 Gallery with template inside caption
20360 !! options
20361 parsoid={
20362 "nativeGallery": true
20363 }
20364 !! wikitext
20365 <gallery caption="{{echo|hi}}">
20366 File:Foobar.jpg|{{echo|ho}}
20367 </gallery>
20368 !! html/php
20369 <ul class="gallery mw-gallery-traditional">
20370 <li class='gallerycaption'>{{echo|hi}}</li>
20371 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20372 <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>
20373 <div class="gallerytext">
20374 <p>ho
20375 </p>
20376 </div>
20377 </div></li>
20378 </ul>
20379
20380 !! html/parsoid
20381 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt6" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20382 <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>
20383 <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>
20384 </ul>
20385 !! end
20386
20387 !! test
20388 Gallery with wikitext inside caption
20389 !! options
20390 parsoid={
20391 "nativeGallery": true
20392 }
20393 !! wikitext
20394 <gallery>
20395 File:Foobar.jpg|alt=galleryalt|[[File:Foobar.jpg|alt=inneralt|20x20px|desc]]
20396 File:Foobar.jpg|alt=galleryalt|{{Test|unamedParam|alt=param}}
20397 </gallery>
20398 !! html/php
20399 <ul class="gallery mw-gallery-traditional">
20400 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20401 <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>
20402 <div class="gallerytext">
20403 <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>
20404 </p>
20405 </div>
20406 </div></li>
20407 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20408 <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>
20409 <div class="gallerytext">
20410 <p>This is a test template
20411 </p>
20412 </div>
20413 </div></li>
20414 </ul>
20415
20416 !! html/parsoid
20417 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt6" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20418 <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>
20419 <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>
20420 </ul>
20421 !! end
20422
20423 !! test
20424 Gallery (with showfilename option)
20425 !! options
20426 parsoid={
20427 "nativeGallery": true
20428 }
20429 !! wikitext
20430 <gallery showfilename="">
20431 File:Nonexistent.jpg|caption
20432 File:Nonexistent.jpg
20433 File:Foobar.jpg|some '''caption''' [[Main Page]]
20434 File:Foobar.jpg
20435 </gallery>
20436 !! html/php
20437 <ul class="gallery mw-gallery-traditional">
20438 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20439 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
20440 <div class="gallerytext">
20441 <p><a href="/wiki/File:Nonexistent.jpg" class="galleryfilename galleryfilename-truncate" title="File:Nonexistent.jpg">Nonexistent.jpg</a>
20442 caption
20443 </p>
20444 </div>
20445 </div></li>
20446 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20447 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
20448 <div class="gallerytext">
20449 <p><a href="/wiki/File:Nonexistent.jpg" class="galleryfilename galleryfilename-truncate" title="File:Nonexistent.jpg">Nonexistent.jpg</a>
20450 </p>
20451 </div>
20452 </div></li>
20453 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20454 <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>
20455 <div class="gallerytext">
20456 <p><a href="/wiki/File:Foobar.jpg" class="galleryfilename galleryfilename-truncate" title="File:Foobar.jpg">Foobar.jpg</a>
20457 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
20458 </p>
20459 </div>
20460 </div></li>
20461 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20462 <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>
20463 <div class="gallerytext">
20464 <p><a href="/wiki/File:Foobar.jpg" class="galleryfilename galleryfilename-truncate" title="File:Foobar.jpg">Foobar.jpg</a>
20465 </p>
20466 </div>
20467 </div></li>
20468 </ul>
20469
20470 !! html/parsoid
20471 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt3" data-mw='{"name":"gallery","attrs":{"showfilename":""},"body":{}}'>
20472 <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>
20473 <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>
20474 <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>
20475 <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>
20476 </ul>
20477 !! end
20478
20479 ## Should Parsoid be preserving these variations? See T151367
20480 !! test
20481 Gallery (with namespace-less filenames)
20482 !! options
20483 parsoid={
20484 "modes": ["wt2html", "html2html"],
20485 "nativeGallery": true
20486 }
20487 !! wikitext
20488 <gallery>
20489 File:Nonexistent.jpg
20490 Nonexistent.jpg
20491 image:foobar.jpg
20492 foobar.jpg
20493 </gallery>
20494 !! html/php
20495 <ul class="gallery mw-gallery-traditional">
20496 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20497 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
20498 <div class="gallerytext">
20499 </div>
20500 </div></li>
20501 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20502 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
20503 <div class="gallerytext">
20504 </div>
20505 </div></li>
20506 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20507 <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>
20508 <div class="gallerytext">
20509 </div>
20510 </div></li>
20511 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20512 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/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>
20513 <div class="gallerytext">
20514 </div>
20515 </div></li>
20516 </ul>
20517
20518 !! html/parsoid
20519 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20520 <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>
20521 <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>
20522 <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>
20523 <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>
20524 </ul>
20525 !! end
20526
20527 !! test
20528 Gallery override link with WikiLink (T36852)
20529 !! options
20530 parsoid={
20531 "nativeGallery": true
20532 }
20533 !! wikitext
20534 <gallery>
20535 File:Foobar.jpg|alt=galleryalt|link=InterWikiLink
20536 </gallery>
20537 !! html/php
20538 <ul class="gallery mw-gallery-traditional">
20539 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20540 <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>
20541 <div class="gallerytext">
20542 </div>
20543 </div></li>
20544 </ul>
20545
20546 !! html/parsoid
20547 <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":{}}'>
20548 <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>
20549 </ul>
20550 !! end
20551
20552 !! test
20553 Gallery override link with absolute external link (T36852)
20554 !! options
20555 parsoid={
20556 "nativeGallery": true
20557 }
20558 !! wikitext
20559 <gallery>
20560 File:Foobar.jpg|alt=galleryalt|link=http://www.example.org
20561 </gallery>
20562 !! html/php
20563 <ul class="gallery mw-gallery-traditional">
20564 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20565 <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>
20566 <div class="gallerytext">
20567 </div>
20568 </div></li>
20569 </ul>
20570
20571 !! html/parsoid
20572 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20573 <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>
20574 </ul>
20575 !! end
20576
20577 !! test
20578 Gallery override link with absolute external link with LanguageConverter
20579 !! options
20580 language=zh
20581 !! input
20582 <gallery>
20583 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
20584 </gallery>
20585 !! result
20586 <ul class="gallery mw-gallery-traditional">
20587 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20588 <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>
20589 <div class="gallerytext">
20590 <p>caption
20591 </p>
20592 </div>
20593 </div></li>
20594 </ul>
20595
20596 !! end
20597
20598 !! test
20599 Gallery override link with malicious javascript (T36852)
20600 !! options
20601 parsoid={
20602 "modes": ["wt2html", "html2html"],
20603 "nativeGallery": true
20604 }
20605 !! wikitext
20606 <gallery>
20607 File:Foobar.jpg|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
20608 </gallery>
20609 !! html/php
20610 <ul class="gallery mw-gallery-traditional">
20611 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20612 <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>
20613 <div class="gallerytext">
20614 </div>
20615 </div></li>
20616 </ul>
20617
20618 !! html/parsoid
20619 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20620 <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>
20621 </ul>
20622 !! end
20623
20624 # Note that parsoid uses the invalid link as a caption, PHP does not.
20625 !! test
20626 Gallery with invalid title as link (T45964)
20627 !! options
20628 parsoid={
20629 "modes": ["wt2html", "html2html"],
20630 "nativeGallery": true
20631 }
20632 !! wikitext
20633 <gallery>
20634 File:Foobar.jpg|link=<
20635 </gallery>
20636 !! html/php
20637 <ul class="gallery mw-gallery-traditional">
20638 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20639 <div class="thumb" style="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>
20640 <div class="gallerytext">
20641 </div>
20642 </div></li>
20643 </ul>
20644
20645 !! html/parsoid
20646 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20647 <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>
20648 </ul>
20649 !! end
20650
20651 !! test
20652 Serialize gallery without attrs in data-mw
20653 !! options
20654 parsoid={
20655 "modes": ["html2wt"],
20656 "nativeGallery": true
20657 }
20658 !! html/parsoid
20659 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","body":{}}'>
20660 <li class="gallerycaption">123</li>
20661 <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>
20662 </ul>
20663 !! wikitext
20664 <gallery caption="123">
20665 File:Test.png
20666 </gallery>
20667 !! end
20668
20669 !! test
20670 Gallery with class and style attributes
20671 !! options
20672 parsoid={
20673 "nativeGallery": true
20674 }
20675 !! wikitext
20676 <gallery class="center" style="text-align: center;">
20677 File:Foobar.jpg
20678 </gallery>
20679 !! html/php
20680 <ul class="gallery mw-gallery-traditional center" style="text-align: center;">
20681 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20682 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/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>
20683 <div class="gallerytext">
20684 </div>
20685 </div></li>
20686 </ul>
20687
20688 !! html/parsoid
20689 <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":{}}'>
20690 <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>
20691 </ul>
20692 !! end
20693
20694 !! test
20695 Gallery in slideshow mode
20696 !! options
20697 parsoid={
20698 "nativeGallery": true
20699 }
20700 !! wikitext
20701 <gallery mode="slideshow" showthumbnails="">
20702 File:Foobar.jpg
20703 </gallery>
20704 !! html/php
20705 <ul class="gallery mw-gallery-slideshow" data-showthumbnails="1">
20706 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20707 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/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>
20708 <div class="gallerytext">
20709 </div>
20710 </div></li>
20711 </ul>
20712
20713 !! html/parsoid
20714 <ul class="gallery mw-gallery-slideshow" data-showthumbnails="1" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{"mode":"slideshow","showthumbnails":""},"body":{}}'>
20715 <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>
20716 </ul>
20717 !! end
20718
20719 !! test
20720 HTML Hex character encoding (spells the word "JavaScript")
20721 !! options
20722 parsoid=wt2html,wt2wt,html2html
20723 !! wikitext
20724 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
20725 !! html/php
20726 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
20727 </p>
20728 !! html/php+tidy
20729 <p>JavaScript</p>
20730 !! html/parsoid
20731 <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>
20732 !! end
20733
20734 !! test
20735 HTML Hex character encoding bogus encoding (T28437 regression check)
20736 !! wikitext
20737 &#xsee;&#XSEE;
20738 !! html/php
20739 <p>&amp;#xsee;&amp;#XSEE;
20740 </p>
20741 !! html/parsoid
20742 <p>&amp;#xsee;&amp;#XSEE;</p>
20743 !! end
20744
20745 !! test
20746 HTML Hex character encoding mixed case
20747 !! options
20748 parsoid=wt2html,wt2wt,html2html
20749 !! wikitext
20750 &#xEE;&#Xee;
20751 !! html/php
20752 <p>&#xee;&#xee;
20753 </p>
20754 !! html/php+tidy
20755 <p>îî</p>
20756 !! html/parsoid
20757 <p><span typeof="mw:Entity">î</span><span typeof="mw:Entity">î</span></p>
20758 !! end
20759
20760 # See: https://www.w3.org/TR/html5/syntax.html#character-references
20761 # Note that U+000C (form feed) is not a valid XML character, so
20762 # it is banned even though allowed in HTML5.
20763 !! test
20764 Illegal character references (T106578)
20765 !! wikitext
20766 ; Null: &#00;
20767 ; FF: &#xC;
20768 ; CR: &#xD;
20769 ; Control (low): &#8;
20770 ; Control (high): &#x7F; &#x9F;
20771 ; Surrogate: &#xD83D;&#xDCA9;
20772 ; This is an okay astral character: &#x1F4A9;
20773 !! html+tidy
20774 <dl>
20775 <dt>Null</dt>
20776 <dd>&amp;#00;</dd>
20777 <dt>FF</dt>
20778 <dd>&amp;#xC;</dd>
20779 <dt>CR</dt>
20780 <dd>&amp;#xD;</dd>
20781 <dt>Control (low)</dt>
20782 <dd>&amp;#8;</dd>
20783 <dt>Control (high)</dt>
20784 <dd>&amp;#x7F; &amp;#x9F;</dd>
20785 <dt>Surrogate</dt>
20786 <dd>&amp;#xD83D;&amp;#xDCA9;</dd>
20787 <dt>This is an okay astral character</dt>
20788 <dd>💩</dd>
20789 </dl>
20790 !! end
20791
20792 !! test
20793 __FORCETOC__ override
20794 !! wikitext
20795 __NEWSECTIONLINK__
20796 __FORCETOC__
20797 !! html/php
20798 <p><br />
20799 </p>
20800 !! end
20801
20802 !! test
20803 ISBN code coverage
20804 !! wikitext
20805 ISBN 978-0-1234-56&#x20;789
20806 !! html
20807 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
20808 </p>
20809 !! html+tidy
20810 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a> 789</p>
20811 !! html/parsoid
20812 <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>
20813 !! end
20814
20815 !! test
20816 ISBN followed by 5 spaces
20817 !! wikitext
20818 ISBN
20819 !! html
20820 <p>ISBN
20821 </p>
20822 !! end
20823
20824 !! test
20825 Double ISBN
20826 !! wikitext
20827 ISBN ISBN 1234567890
20828 !! html/php
20829 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
20830 </p>
20831 !! html/parsoid
20832 <p>ISBN <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a></p>
20833 !! end
20834
20835 # Uppercase X and lowercase x as well
20836 !! test
20837 ISBN with an X
20838 !! wikitext
20839 ISBN 3-462-04561-X
20840 ISBN 3-462-04561-x
20841 ISBN 080442957X
20842 ISBN 080442957x
20843 ISBN 978080442957X
20844 ISBN 978080442957x
20845 !! html/php
20846 <p><a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-X</a>
20847 <a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-x</a>
20848 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957X</a>
20849 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957x</a>
20850 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957X</a>
20851 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957x</a>
20852 </p>
20853 !! html/parsoid
20854 <p><a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-X</a>
20855 <a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-x</a>
20856 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957X</a>
20857 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957x</a>
20858 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957X</a>
20859 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957x</a></p>
20860 !! end
20861
20862 !! test
20863 ISBN with empty prefix (parsoid test)
20864 !! wikitext
20865 ISBN 1234567890
20866 !! html/php
20867 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
20868 </p>
20869 !! html/parsoid
20870 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink">ISBN 1234567890</a></p>
20871 !! end
20872
20873 !! test
20874 T24905: <abbr> followed by ISBN followed by </a>
20875 !! wikitext
20876 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
20877 !! html/php
20878 <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>
20879 </p>
20880 !! html/parsoid
20881 <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>
20882 !! end
20883
20884 !! test
20885 Double RFC
20886 !! wikitext
20887 RFC RFC 1234
20888 !! html
20889 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
20890 </p>
20891 !! end
20892
20893 !! test
20894 Double RFC with a wiki link
20895 !! wikitext
20896 RFC [[RFC 1234]]
20897 !! html
20898 <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>
20899 </p>
20900 !! end
20901
20902 !! test
20903 RFC code coverage
20904 !! wikitext
20905 RFC 983&#x20;987
20906 !! html
20907 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
20908 </p>
20909 !! html+tidy
20910 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a> 987</p>
20911 !! end
20912
20913 !! test
20914 Centre-aligned image
20915 !! wikitext
20916 [[Image:foobar.jpg|centre]]
20917 !! html
20918 <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>
20919
20920 !!end
20921
20922 !! test
20923 None-aligned image
20924 !! wikitext
20925 [[Image:foobar.jpg|none]]
20926 !! html
20927 <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>
20928
20929 !!end
20930
20931 !! test
20932 Width + Height sized image (using px) (height is ignored)
20933 !! wikitext
20934 [[Image:foobar.jpg|640x480px]]
20935 !! html
20936 <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>
20937 </p>
20938 !!end
20939
20940 !! test
20941 Width-sized image (using px, no following whitespace)
20942 !! wikitext
20943 [[Image:foobar.jpg|640px]]
20944 !! html
20945 <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>
20946 </p>
20947 !!end
20948
20949 !! test
20950 Width-sized image (using px, with following whitespace - test regression from r39467)
20951 !! wikitext
20952 [[Image:foobar.jpg|640px ]]
20953 !! html
20954 <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>
20955 </p>
20956 !!end
20957
20958 !! test
20959 Width-sized image (using px, with preceding whitespace - test regression from r39467)
20960 !! wikitext
20961 [[Image:foobar.jpg| 640px]]
20962 !! html
20963 <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>
20964 </p>
20965 !!end
20966
20967 !! test
20968 Image with page parameter
20969 !! options
20970 djvu
20971 !! wikitext
20972 [[File:LoremIpsum.djvu|page=2]]
20973 !! html/php
20974 <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>
20975 </p>
20976 !! html/parsoid
20977 <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>
20978 !! end
20979
20980 !! test
20981 Another italics / bold test
20982 !! wikitext
20983 ''' ''x'
20984 !! html
20985 <pre>'<i> </i>x'
20986 </pre>
20987 !!end
20988
20989 # FIXME: The php output seems broken. It's interleaving some open/close tags.
20990 !! test
20991 dt/dd/dl test
20992 !! wikitext
20993 :;;;::
20994 !! html/php
20995 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dt></dl></dd></dl></dd></dl></dd></dl></dd></dl></dd></dl>
20996
20997 !! html/parsoid
20998 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dd></dl></dd></dl></dt></dl></dt></dl></dt></dl></dd></dl>
20999
21000 !!end
21001
21002 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
21003 !! test
21004 Images with the "|" character in the comment
21005 !! wikitext
21006 [[File:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
21007 !! html/php
21008 <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>
21009
21010 !! html/parsoid
21011 <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>
21012 !! end
21013
21014 !! test
21015 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
21016 !! wikitext
21017 <html><script>alert(1);</script></html>
21018 !! html
21019 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
21020 </p>
21021 !! end
21022
21023 !! test
21024 HTML with raw HTML ($wgRawHtml==true)
21025 !! options
21026 wgRawHtml=1
21027 !! wikitext
21028 <html><script>alert(1);</script></html>
21029 !! html/php
21030 <p><script>alert(1);</script>
21031 </p>
21032 !! end
21033
21034 !! test
21035 Parents of subpages, one level up
21036 !! options
21037 subpage title=[[Subpage test/L1/L2/L3]]
21038 !! wikitext
21039 [[../|L2]]
21040 !! html
21041 <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>
21042 </p>
21043 !! end
21044
21045
21046 !! test
21047 Parents of subpages, one level up, not named
21048 !! options
21049 subpage title=[[Subpage test/L1/L2/L3]]
21050 !! wikitext
21051 [[../]]
21052 !! html
21053 <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>
21054 </p>
21055 !! end
21056
21057
21058
21059 !! test
21060 Parents of subpages, two levels up
21061 !! options
21062 subpage title=[[Subpage test/L1/L2/L3]]
21063 !! wikitext
21064 [[../../|L1]]2
21065
21066 [[../../|L1]]l
21067 !! html
21068 <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
21069 </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>
21070 </p>
21071 !! end
21072
21073 !! test
21074 Parents of subpages, two levels up, without trailing slash or name.
21075 !! options
21076 subpage title=[[Subpage test/L1/L2/L3]]
21077 !! wikitext
21078 [[../..]]
21079 !! html
21080 <p>[[../..]]
21081 </p>
21082 !! end
21083
21084 !! test
21085 Parents of subpages, two levels up, with lots of extra trailing slashes.
21086 !! options
21087 subpage title=[[Subpage test/L1/L2/L3]]
21088 !! wikitext
21089 [[../../////]]
21090 !! html
21091 <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>
21092 </p>
21093 !! end
21094
21095 !! article
21096 Subpage test/L1/L2/L3Sibling
21097 !! text
21098 Sibling article
21099 !! endarticle
21100
21101 !! test
21102 Transclusion of a sibling page (one level up)
21103 !! options
21104 subpage title=[[Subpage test/L1/L2/L3]]
21105 !! wikitext
21106 {{../L3Sibling}}
21107 !! html
21108 <p>Sibling article
21109 </p>
21110 !! end
21111
21112 !! test
21113 Transclusion of a child page
21114 !! options
21115 subpage title=[[Subpage test/L1/L2]]
21116 !! wikitext
21117 {{/L3Sibling}}
21118 !! html
21119 <p>Sibling article
21120 </p>
21121 !! end
21122
21123 # This is wt2html only in Parsoid because we add <nowiki>
21124 # because of {{..}} and we don't expect to fix that to
21125 # eliminate the nowikis selective for {{..}} markup.
21126 !! test
21127 Non-transclusion because of too many up levels
21128 !! options
21129 subpage title=[[Subpage test/L1/L2/L3]]
21130 parsoid=wt2html
21131 !! wikitext
21132 {{../../../../More than parent}}
21133 !! html/php
21134 <p>{{../../../../More than parent}}
21135 </p>
21136 !! html/parsoid
21137 <p>{{../../../../More than parent}}</p>
21138 !! end
21139
21140 !! test
21141 Definition list code coverage
21142 !! wikitext
21143 ; title : def
21144 ; title : def
21145 ;title: def
21146 !! html/php
21147 <dl><dt> title &#160;</dt>
21148 <dd> def</dd>
21149 <dt> title&#160;</dt>
21150 <dd> def</dd>
21151 <dt>title</dt>
21152 <dd> def</dd></dl>
21153
21154 !! html/parsoid
21155 <dl><dt> title <span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
21156 <dt> title<span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
21157 <dt>title</dt><dd> def</dd></dl>
21158 !! end
21159
21160 !! test
21161 Don't fall for the self-closing div
21162 !! wikitext
21163 <div>hello world</div/>
21164 !! html
21165 <div>hello world</div>
21166
21167 !! end
21168
21169 !! test
21170 MSGNW magic word
21171 !! wikitext
21172 {{MSGNW:msg}}
21173 !! html/php
21174 <p>&#91;&#91;:Template:Msg&#93;&#93;
21175 </p>
21176 !! end
21177
21178 !! test
21179 RAW magic word
21180 !! wikitext
21181 {{RAW:QUERTY}}
21182 !! html
21183 <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>
21184 </p>
21185 !! end
21186
21187 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
21188 !! test
21189 Always escape literal '>' in output, not just after '<'
21190 !! wikitext
21191 ><>
21192 !! html
21193 <p>&gt;&lt;&gt;
21194 </p>
21195 !! end
21196
21197 !! test
21198 Template caching
21199 !! wikitext
21200 {{Test}}
21201 {{Test}}
21202 !! html
21203 <p>This is a test template
21204 This is a test template
21205 </p>
21206 !! end
21207
21208
21209 !! article
21210 MediaWiki:Fake
21211 !! text
21212 ==header==
21213 !! endarticle
21214
21215 !! test
21216 Inclusion of !userCanEdit() content
21217 !! wikitext
21218 {{MediaWiki:Fake}}
21219 !! html
21220 <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>
21221
21222 !! end
21223
21224
21225 !! test
21226 Out-of-order TOC heading levels
21227 !! wikitext
21228 ==2==
21229 ======6======
21230 ===3===
21231 =1=
21232 =====5=====
21233 ==2==
21234 !! html
21235 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
21236 <ul>
21237 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
21238 <ul>
21239 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
21240 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
21241 </ul>
21242 </li>
21243 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
21244 <ul>
21245 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
21246 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
21247 </ul>
21248 </li>
21249 </ul>
21250 </div>
21251
21252 <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>
21253 <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>
21254 <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>
21255 <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>
21256 <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>
21257 <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>
21258
21259 !! end
21260
21261
21262 !! test
21263 ISBN with a dummy number
21264 !! wikitext
21265 ISBN ---
21266 !! html
21267 <p>ISBN ---
21268 </p>
21269 !! end
21270
21271
21272 !! test
21273 ISBN with space-delimited number
21274 !! wikitext
21275 ISBN 92 9017 032 8
21276 !! html/php
21277 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
21278 </p>
21279 !! html/parsoid
21280 <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>
21281 !! end
21282
21283
21284 !! test
21285 ISBN with multiple spaces, no number
21286 !! wikitext
21287 ISBN foo
21288 !! html
21289 <p>ISBN foo
21290 </p>
21291 !! end
21292
21293
21294 !! test
21295 ISBN length
21296 !! wikitext
21297 ISBN 123456789
21298
21299 ISBN 1234567890
21300
21301 ISBN 12345678901
21302 !! html/php
21303 <p>ISBN 123456789
21304 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
21305 </p><p>ISBN 12345678901
21306 </p>
21307 !! html/parsoid
21308 <p>ISBN 123456789</p>
21309
21310 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a></p>
21311
21312 <p>ISBN 12345678901</p>
21313 !! end
21314
21315
21316 !! test
21317 ISBN with trailing year (T9110)
21318 !! wikitext
21319 ISBN 1-234-56789-0 - 2006
21320
21321 ISBN 1 234 56789 0 - 2006
21322 !! html/php
21323 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
21324 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
21325 </p>
21326 !! html/parsoid
21327 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1-234-56789-0</a> - 2006</p>
21328
21329 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1 234 56789 0</a> - 2006</p>
21330 !! end
21331
21332
21333 !! test
21334 anchorencode
21335 !! wikitext
21336 {{anchorencode:foo bar©#%n}}
21337 !! html
21338 <p>foo_bar.C2.A9.23.25n
21339 </p>
21340 !! end
21341
21342 !! test
21343 anchorencode trims spaces
21344 !! wikitext
21345 {{anchorencode: __pretty__please__}}
21346 !! html
21347 <p>pretty_please
21348 </p>
21349 !! end
21350
21351 !! test
21352 anchorencode deals with links
21353 !! wikitext
21354 {{anchorencode: [[hello|world]] [[hi]]}}
21355 !! html
21356 <p>world_hi
21357 </p>
21358 !! end
21359
21360 !! test
21361 anchorencode deals with templates
21362 !! wikitext
21363 {{anchorencode: {{Foo}} }}
21364 !! html
21365 <p>FOO
21366 </p>
21367 !! end
21368
21369 !! test
21370 anchorencode encodes like the TOC generator: (T20431)
21371 !! wikitext
21372 === _ +:.3A%3A&&amp;]] ===
21373 {{anchorencode: _ +:.3A%3A&&amp;]] }}
21374 __NOEDITSECTION__
21375 !! html
21376 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
21377 <p>.2B:.3A.253A.26.26.5D.5D
21378 </p>
21379 !! end
21380
21381 !! test
21382 T8200: blockquotes and paragraph formatting
21383 !! wikitext
21384 <blockquote>
21385 foo
21386 </blockquote>
21387
21388 bar
21389
21390 baz
21391 !! html
21392 <blockquote>
21393 <p>foo
21394 </p>
21395 </blockquote>
21396 <p>bar
21397 </p>
21398 <pre>baz
21399 </pre>
21400 !! end
21401
21402 !! test
21403 T10293: Use of center tag ruins paragraph formatting
21404 !! wikitext
21405 <center>
21406 foo
21407 </center>
21408
21409 bar
21410
21411 baz
21412 !! html
21413 <center>
21414 <p>foo
21415 </p>
21416 </center>
21417 <p>bar
21418 </p>
21419 <pre>baz
21420 </pre>
21421 !! end
21422
21423 !!test
21424 Parsing of overlapping (improperly nested) inline html tags
21425 !! wikitext
21426 <span><s>x</span></s>
21427 !! html/php
21428 <p><span><s>x&lt;/span&gt;</s></span>
21429 </p>
21430 !! html/parsoid
21431 <p><span><s>x</s></span>
21432 </p>
21433 !!end
21434
21435 ###
21436 ### Language variants related tests
21437 ###
21438
21439 # Parsoid does not mark self-links.
21440 # Parsoid does not convert links; PHP will do any necessary redirects.
21441
21442 !! test
21443 Self-link in language variants
21444 !! options
21445 title=[[Dunav]] language=sr
21446 !! wikitext
21447 Both [[Dunav]] and [[Дунав]] are names for this river.
21448 !! html/php
21449 <p>Both <a class="mw-selflink selflink">Dunav</a> and <a class="mw-selflink selflink">Дунав</a> are names for this river.
21450 </p>
21451 !! html/parsoid
21452 <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>
21453 !! end
21454
21455 !! article
21456 Дуна
21457 !! text
21458 content
21459 !! endarticle
21460
21461 !! test
21462 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
21463 !! options
21464 title=[[Duna]] language=sr
21465 !! wikitext
21466 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
21467 !! html/php
21468 <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.
21469 </p>
21470 !! html/parsoid
21471 <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>
21472 !! end
21473
21474 !! test
21475 Link to a section of a variant of this title shouldn't be parsed as self-link
21476 !! options
21477 title=[[Duna]] language=sr
21478 !! wikitext
21479 [[Dуна]] is a self-link while [[Dunа#Foo]] and [[Dуна#Foo]] are not self-links.
21480 !! html/php
21481 <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.
21482 </p>
21483 !! html/parsoid
21484 <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>
21485 !! end
21486
21487 !! test
21488 Link to pages in language variants
21489 !! options
21490 language=sr
21491 !! wikitext
21492 Main Page can be written as [[Маин Паге]]
21493 !! html/php
21494 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
21495 </p>
21496 !! html/parsoid
21497 <p>Main Page can be written as <a rel="mw:WikiLink" href="./Маин_Паге" title="Маин Паге">Маин Паге</a></p>
21498 !! end
21499
21500
21501 !! test
21502 Multiple links to pages in language variants
21503 !! options
21504 language=sr
21505 !! wikitext
21506 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
21507 !! html/php
21508 <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>.
21509 </p>
21510 !! html/parsoid
21511 <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>
21512 !! end
21513
21514
21515 !! test
21516 Simple template in language variants
21517 !! options
21518 language=sr
21519 !! wikitext
21520 {{тест}}
21521 !! html/php
21522 <p>This is a test template
21523 </p>
21524 !! end
21525
21526
21527 !! test
21528 Template with explicit namespace in language variants
21529 !! options
21530 language=sr
21531 !! wikitext
21532 {{Template:тест}}
21533 !! html/php
21534 <p>This is a test template
21535 </p>
21536 !! end
21537
21538
21539 !! test
21540 Basic test for template parameter in language variants
21541 !! options
21542 language=sr
21543 !! wikitext
21544 {{парамтест|param=foo}}
21545 !! html/php
21546 <p>This is a test template with parameter foo
21547 </p>
21548 !! end
21549
21550 !! test
21551 Simple category in language variants
21552 !! options
21553 language=sr cat
21554 !! wikitext
21555 [[Category:МедиаWики Усер'с Гуиде]]
21556 !! html/php
21557 cat=МедиаWики_Усер'с_Гуиде sort=
21558 !! html/parsoid
21559 <link rel="mw:PageProp/Category" href="./Категорија:МедиаWики_Усер'с_Гуиде" data-parsoid='{"stx":"simple","a":{"href":"./Категорија:МедиаWики_Усер&#39;с_Гуиде"},"sa":{"href":"Category:МедиаWики Усер&#39;с Гуиде"}}'/>
21560 !! end
21561
21562 !! article
21563 Category:分类
21564 !! text
21565 blah
21566 !! endarticle
21567
21568 !! article
21569 Category:分類
21570 !! text
21571 blah
21572 !! endarticle
21573
21574 ## We used to, but no longer wt2wt this test since the default serializer
21575 ## will normalize all categories to serialize on their own line.
21576 ## This wikitext usage is going to be fairly uncommon in production and
21577 ## selser will take care of preserving formatting in those scenarios.
21578 !! test
21579 Don't convert blue categorylinks to another variant (T35210)
21580 !! options
21581 cat
21582 language=zh
21583 parsoid=wt2html
21584 !! wikitext
21585 [[A]][[Category:分类]]
21586 !! html/php
21587 cat=分类 sort=
21588 !! html/parsoid
21589 <p><a rel="mw:WikiLink" href="./A" title="A">A</a></p>
21590 <link rel="mw:PageProp/Category" href="./Category:分类"/>
21591 !! end
21592
21593 !! test
21594 Stripping -{}- tags (language variants)
21595 !! options
21596 language=sr
21597 !! wikitext
21598 Latin proverb: -{Ne nuntium necare}-
21599 !! html/php
21600 <p>Latin proverb: Ne nuntium necare
21601 </p>
21602 !! html/parsoid
21603 <p>Latin proverb: <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Ne nuntium necare"}}'></span></p>
21604 !! end
21605
21606
21607 !! test
21608 Prevent conversion with -{}- tags (language variants)
21609 !! options
21610 language=sr variant=sr-ec
21611 !! wikitext
21612 Latinski: -{Ne nuntium necare}-
21613 !! html/php
21614 <p>Латински: Ne nuntium necare
21615 </p>
21616 !! html/parsoid
21617 <p>Latinski: <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Ne nuntium necare"}}'></span></p>
21618 !! end
21619
21620
21621 !! test
21622 Prevent conversion of text with -{}- tags (language variants)
21623 !! options
21624 language=sr variant=sr-ec
21625 !! wikitext
21626 Latinski: -{Ne nuntium necare}-
21627 !! html/php
21628 <p>Латински: Ne nuntium necare
21629 </p>
21630 !! html/parsoid
21631 <p>Latinski: <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Ne nuntium necare"}}'></span></p>
21632 !! end
21633
21634
21635 !! test
21636 Prevent conversion of links with -{}- tags (language variants)
21637 !! options
21638 language=sr variant=sr-ec
21639 !! wikitext
21640 -{[[Main Page]]}-
21641 !! html/php
21642 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
21643 </p>
21644 !! html/parsoid
21645 <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>
21646 !! end
21647
21648
21649 !! test
21650 -{}- tags within headlines (within html for parserConvert())
21651 !! options
21652 language=sr variant=sr-ec
21653 !! wikitext
21654 == -{Naslov}- ==
21655
21656 Note that even an unprotected headline ID is not affected by language
21657 conversion:
21658
21659 == Latinski ==
21660 !! html/php
21661 <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>
21662 <p>Ноте тхат евен ан унпротецтед хеадлине ИД ис нот аффецтед бy лангуаге
21663 цонверсион:
21664 </p>
21665 <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>
21666
21667 !! html/parsoid
21668 <h2 id="-.7BNaslov.7D-"><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Naslov"}}'></span></h2>
21669
21670 <p>Note that even an unprotected headline ID is not affected by language
21671 conversion:</p>
21672
21673 <h2 id="Latinski">Latinski</h2>
21674 !! end
21675
21676 !! test
21677 Explicit definition of language variant alternatives
21678 !! options
21679 language=zh variant=zh-tw
21680 !! wikitext
21681 -{zh:China;zh-tw:Taiwan}-, not China
21682 !! html/php
21683 <p>Taiwan, not China
21684 </p>
21685 !! html/parsoid
21686 <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>
21687 !! end
21688
21689 !! test
21690 Filter syntax for language variants
21691 !! options
21692 language=zh variant=zh-tw
21693 !! wikitext
21694 foo-{zh;zh-hans;zh-hant|blog, WEBJOURNAL, WEBLOG}-quux
21695 !! html/php
21696 <p>fooblog, WEBJOURNAL, WEBLOGquux
21697 </p>
21698 !! html/parsoid
21699 <p>foo<span typeof="mw:LanguageVariant" data-mw-variant='{"filter":{"l":["zh","zh-hans","zh-hant"],"t":"blog, WEBJOURNAL, WEBLOG"}}'></span>quux</p>
21700 !! end
21701
21702 # Note that Parsoid post-processing for language variants needs to
21703 # update the `title` attribute here, based on the mw:ExpandedAttrs property
21704 !! test
21705 Conversion around HTML tags
21706 !! options
21707 language=sr variant=sr-ec
21708 !! wikitext
21709 -{H|span=>sr-ec:script;title=>sr-ec:src}-
21710 <span title="La-{sr-el:L;sr-ec:C}-tin">ski</span>
21711 !! html/php
21712 <p>
21713 <span title="ЛаCтин">ски</span>
21714 </p>
21715 !! html/parsoid
21716 <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"}]}'/>
21717 <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>
21718 !! end
21719
21720 !! test
21721 Explicit session-wise two-way language variant mapping (A flag and - flag)
21722 !! options
21723 language=zh variant=zh-tw
21724 !! wikitext
21725 This is -{zh:China; zh-tw:Taiwan}-, but we'll forget that now.
21726
21727 Taiwan is not China.
21728
21729 But -{A|zh:China; zh-tw:Taiwan}- is China,
21730
21731 (This-{-|zh:China; zh-tw:Taiwan}- should be stripped!)
21732
21733 and -{China}- is China.
21734 !! html/php
21735 <p>This is Taiwan, but we'll forget that now.
21736 </p><p>Taiwan is not China.
21737 </p><p>But Taiwan is Taiwan,
21738 </p><p>(This should be stripped!)
21739 </p><p>and China is China.
21740 </p>
21741 !! html/parsoid
21742 <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>
21743 <p>Taiwan is not China.</p>
21744 <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>
21745 <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>
21746 <p>and <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"China"}}'></span> is China.</p>
21747 !! end
21748
21749 !! test
21750 Explicit session-wise one-way language variant mapping (A flag and - flag)
21751 !! options
21752 language=zh variant=zh-tw
21753 !! wikitext
21754 This is -{COUNTRY=>zh:China;COUNTRY=>zh-tw:Taiwan}-, but we'll forget that now.
21755
21756 COUNTRY is China or Taiwan.
21757
21758 But -{A|COUNTRY=>zh:China;COUNTRY=>zh-tw:Taiwan}- is COUNTRY,
21759
21760 (This-{-|COUNTRY=>zh:China;COUNTRY=>zh-tw:Taiwan}- should be stripped!)
21761
21762 and -{COUNTRY}- is COUNTRY.
21763 !! html/php
21764 <p>This is Taiwan, but we'll forget that now.
21765 </p><p>COUNTRY is China or Taiwan.
21766 </p><p>But Taiwan is Taiwan,
21767 </p><p>(This should be stripped!)
21768 </p><p>and COUNTRY is COUNTRY.
21769 </p>
21770 !! html/parsoid
21771 <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>
21772 <p>COUNTRY is China or Taiwan.</p>
21773 <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>
21774 <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>
21775 <p>and <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"COUNTRY"}}'></span> is COUNTRY.</p>
21776 !! end
21777
21778 !! test
21779 Explicit session-wise two-way language variant mapping (H flag for hide)
21780 !! options
21781 language=zh variant=zh-tw
21782 !! wikitext
21783 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
21784
21785 Taiwan is China.
21786 !! html/php
21787 <p>(This should be stripped!)
21788 </p><p>Taiwan is Taiwan.
21789 </p>
21790 !! html/parsoid
21791 <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>
21792 <p>Taiwan is China.</p>
21793 !! end
21794
21795 !! test
21796 Explicit session-wise one-way language variant mapping (H flag for hide)
21797 !! options
21798 language=zh variant=zh-tw
21799 !! wikitext
21800 (This-{H|COUNTRY=>zh:China;COUNTRY=>zh-tw:Taiwan}- should be stripped!)
21801
21802 COUNTRY is Taiwan or China.
21803 !! html/php
21804 <p>(This should be stripped!)
21805 </p><p>Taiwan is Taiwan or China.
21806 </p>
21807 !! html/parsoid
21808 <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>
21809 <p>COUNTRY is Taiwan or China.</p>
21810 !! end
21811
21812 ## Note that parsoid test runner does not support 'showtitle' option.
21813 !! test
21814 Adding explicit conversion rule for title (T flag)
21815 !! options
21816 language=zh variant=zh-tw showtitle
21817 !! wikitext
21818 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
21819
21820 Taiwan is China.
21821 !! html/php
21822 Taiwan
21823 <p>Should be stripped!
21824 </p><p>Taiwan is China.
21825 </p>
21826 !! html/parsoid
21827 <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>
21828 <p>Taiwan is China.</p>
21829 !! end
21830
21831 !! test
21832 Code coverage: T combined with H flag
21833 !! options
21834 language=zh variant=zh-tw showtitle
21835 !! wikitext
21836 Should be stripped-{T;H|zh:China; zh-tw:Taiwan}-!
21837
21838 Taiwan is China.
21839 !! html/php
21840 Taiwan
21841 <p>Should be stripped!
21842 </p><p>Taiwan is Taiwan.
21843 </p>
21844 !! html/parsoid
21845 <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>
21846 <p>Taiwan is China.</p>
21847 !! end
21848
21849 !! test
21850 Code coverage: T with no variants
21851 !! options
21852 language=zh variant=zh-tw showtitle
21853 !! wikitext
21854 -{H|zh:China; zh-tw:Taiwan}-
21855 Taiwan is China.-{T|Taiwan is China}-
21856 !! html/php
21857 Taiwan is China
21858 <p>
21859 Taiwan is Taiwan.
21860 </p>
21861 !! html/parsoid
21862 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"zh","t":"China"},{"l":"zh-tw","t":"Taiwan"}]}'/>
21863 Taiwan is China.<meta typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Taiwan is China"},"title":true}'/></p>
21864 !! end
21865
21866 !! test
21867 Code coverage: rules with no variants
21868 !! options
21869 language=zh variant=zh-tw
21870 !! wikitext
21871 -{H|zh:China; zh-tw:Taiwan}-
21872 Taiwan is China.
21873 -{H|China}-
21874 Taiwan is China.
21875 !! html/php
21876 <p>
21877 Taiwan is Taiwan.
21878
21879 Taiwan is China.
21880 </p>
21881 !! html/parsoid
21882 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"zh","t":"China"},{"l":"zh-tw","t":"Taiwan"}]}'/>
21883 Taiwan is China.
21884 <meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"*","t":"China"}]}'/>
21885 Taiwan is China.</p>
21886 !! end
21887
21888
21889 !! test
21890 Code coverage: D flag for conversion rule
21891 !! options
21892 language=zh variant=zh-tw
21893 !! wikitext
21894 -{D|zh-cn:XA; zh-tw:YA}-
21895 -{A;D|zh-cn:XB; zh-tw:YB}-
21896 -{D;H|zh-cn:XC; zh-tw:YC}-
21897
21898 -{D;H|FOO=>zh-tw:BAR;FOO=>zh-cn:BAT}-
21899
21900 -{D|0=>zh-tw:1}-
21901 -{A;D|2=>zh-tw:3}-
21902 -{D;H|4=>zh-tw:5}-
21903
21904 XA XB XC YA YB YC FOO BAR BAT 012345
21905 !! html/php
21906 <p>大陆:XA;台灣:YA;
21907
21908 大陆:XC;台灣:YC;
21909 </p><p>FOO⇒台灣:BAR;FOO⇒大陆:BAT;
21910 </p><p>0⇒台灣:1;
21911
21912 4⇒台灣:5;
21913 </p><p>XA YB YC YA YB YC BAR BAR BAT 013355
21914 </p>
21915 !! html/parsoid
21916 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"describe":true,"twoway":[{"l":"zh-cn","t":"XA"},{"l":"zh-tw","t":"YA"}]}'></span>
21917 <meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"describe":true,"twoway":[{"l":"zh-cn","t":"XB"},{"l":"zh-tw","t":"YB"}]}'/>
21918 <span typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"describe":true,"twoway":[{"l":"zh-cn","t":"XC"},{"l":"zh-tw","t":"YC"}]}'></span></p>
21919 <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>
21920 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"describe":true,"oneway":[{"f":"0","l":"zh-tw","t":"1"}]}'></span>
21921 <meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"describe":true,"oneway":[{"f":"2","l":"zh-tw","t":"3"}]}'/>
21922 <span typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"describe":true,"oneway":[{"f":"4","l":"zh-tw","t":"5"}]}'></span></p>
21923 <p>XA XB XC YA YB YC FOO BAR BAT 012345</p>
21924 !! end
21925
21926 !! test
21927 Code coverage: N flag for conversion rule
21928 !! options
21929 language=zh variant=zh-cn
21930 !! wikitext
21931 -{N|zh-cn}-
21932
21933 -{N|zh-tw}-
21934
21935 -{N|sr-ec}-
21936 !! html/php
21937 <p>大陆
21938 </p><p>台灣
21939 </p><p>српски (ћирилица)‎
21940 </p>
21941 !! html/parsoid
21942 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"name":{"t":"zh-cn"}}'></span></p>
21943 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"name":{"t":"zh-tw"}}'></span></p>
21944 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"name":{"t":"sr-ec"}}'></span></p>
21945 !! end
21946
21947 # html2wt suppresses the bogus 'D' flag, so this is wt2html only
21948 !! test
21949 Code coverage: N flag for conversion rule (wt2html only)
21950 !! options
21951 language=zh variant=zh-cn
21952 parsoid=wt2html,html2html
21953 !! wikitext
21954 -{D;N|en}-
21955 !! html/php
21956 <p>English
21957 </p>
21958 !! html/parsoid
21959 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"name":{"t":"en"}}' data-parsoid='{"fl":["D","N"]}'></span></p>
21960 !! end
21961
21962 !! test
21963 Testing that changing the language variant here in the tests actually works
21964 !! options
21965 language=zh variant=zh showtitle
21966 !! wikitext
21967 Should be stripped-{T|zh:China; zh-tw:Taiwan}-!
21968 !! html/php
21969 China
21970 <p>Should be stripped!
21971 </p>
21972 !! html/parsoid
21973 <p>Should be stripped<meta typeof="mw:LanguageVariant" data-mw-variant='{"title":true,"twoway":[{"l":"zh","t":"China"},{"l":"zh-tw","t":"Taiwan"}]}'/>!</p>
21974 !! end
21975
21976 !! test
21977 Recursive conversion of alt and title attrs shouldn't clear converter state
21978 !! options
21979 language=zh variant=zh-cn
21980 showtitle
21981 !! wikitext
21982 -{H|zh-cn:Exclamation; zh-tw:exclamation}-
21983 Should be stripped-{T|zh-cn:China; zh-tw:Taiwan}-<span title="exclamation">!</span>
21984 !! html/php
21985 China
21986 <p>
21987 Should be stripped<span title="Exclamation">!</span>
21988 </p>
21989 !! html/parsoid
21990 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"zh-cn","t":"Exclamation"},{"l":"zh-tw","t":"exclamation"}]}'/>
21991 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>
21992 !! end
21993
21994 !! test
21995 T26072: more test on conversion rule for title
21996 !! options
21997 language=zh variant=zh-tw showtitle
21998 !! wikitext
21999 This should be stripped-{T|zh:China; zh-tw:Taiwan}-!
22000
22001 This won't take interferes with the title rule-{H|zh:Beijing; zh-tw:Taipei}-.
22002 !! html/php
22003 Taiwan
22004 <p>This should be stripped!
22005 </p><p>This won't take interferes with the title rule.
22006 </p>
22007 !! html/parsoid
22008 <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>
22009 <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>
22010 !! end
22011
22012 !! test
22013 Partly disable title conversion if variant == main language code
22014 !! options
22015 language=zh variant=zh title=[[ZH]] showtitle
22016 !! wikitext
22017 -{T|zh-cn:CN;zh-tw:TW}-
22018 !! html/php
22019 ZH
22020 <p>
22021 </p>
22022 !! html/parsoid
22023 <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>
22024 !! end
22025
22026 !! test
22027 Partly disable title conversion if variant == main language code, more
22028 !! options
22029 language=zh variant=zh title=[[ZH]] showtitle
22030 !! wikitext
22031 -{T|TW}-
22032 !! html/php
22033 ZH
22034 <p>
22035 </p>
22036 !! html/parsoid
22037 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"TW"},"title":true}'/></p>
22038 !! end
22039
22040 !! test
22041 Raw output of variant escape tags (R flag)
22042 !! options
22043 language=zh variant=zh-tw
22044 !! wikitext
22045 Raw: -{R|zh:China;zh-tw:Taiwan}-
22046 !! html/php
22047 <p>Raw: zh:China;zh-tw:Taiwan
22048 </p>
22049 !! html/parsoid
22050 <p>Raw: <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"zh:China;zh-tw:Taiwan"}}'></span></p>
22051 !! end
22052
22053 # html2wt suppresses the bogus 'D' flags, so this is wt2html only
22054 !! test
22055 Raw output of variant escape tags (R flag) (wt2html only)
22056 !! options
22057 language=zh variant=zh-tw
22058 parsoid=wt2html,html2html
22059 !! wikitext
22060 -{Variant}- -{D|syntax}- -{D;R|options}-
22061 !! html/php
22062 <p>Variant syntax options
22063 </p>
22064 !! html/parsoid
22065 <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>
22066 !! end
22067
22068 !! test
22069 Nested markup inside raw output of variant escape tags (R flag)
22070 !! options
22071 language=zh variant=zh-tw
22072 !! wikitext
22073 Nested raw: -{R|nested -{zh:China;zh-tw:Taiwan}- nested}-
22074 !! html/php
22075 <p>Nested raw: nested Taiwan nested
22076 </p>
22077 !! html/parsoid
22078 <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>
22079 !! end
22080
22081 !! test
22082 Nested markup and spaces inside raw output of variant escape tags (R flag)
22083 !! options
22084 language=zh variant=zh-tw
22085 !! wikitext
22086 X-{ outer -{ inner }- outer }-X
22087 !! html/php
22088 <p>X outer inner outer X
22089 </p>
22090 !! html/parsoid
22091 <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>
22092 !! end
22093
22094 !! test
22095 Templates inside raw output of variant escape tags (R flag)
22096 !! options
22097 language=zh variant=zh-tw
22098 !! wikitext
22099 Nested raw: -{R|nested {{echo|hi}} templates}-
22100 !! html/php
22101 <p>Nested raw: nested hi templates
22102 </p>
22103 !! html/parsoid
22104 <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>
22105 !! end
22106
22107 !! test
22108 Strings evaluating false shouldn't be ignored by Language converter (T51072)
22109 !! options
22110 language=zh variant=zh-cn
22111 !! input
22112 -{zh-cn:0;zh-sg:1;zh-tw:2;zh-hk:3}-
22113 !! html/php
22114 <p>0
22115 </p>
22116 !! html/parsoid
22117 <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>
22118 !! end
22119
22120 !! test
22121 Conversion rules from [numeric-only string] to [something else] (T48634)
22122 !! options
22123 language=zh variant=zh-cn
22124 !! input
22125 -{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
22126 !! html/php
22127 <p>D12345EE12345
22128 </p>
22129 !! html/parsoid
22130 <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>
22131 !! end
22132
22133 !! test
22134 Two-way converter rule entries with an empty value should be ignored (T53551)
22135 !! options
22136 language=zh variant=zh-cn
22137 !! input
22138 -{H|zh-cn:foo;zh-tw:;}-foobar
22139 !! html/php
22140 <p>foobar
22141 </p>
22142 !! html/parsoid
22143 <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>
22144 !! end
22145
22146 !! test
22147 One-way converter rule entries with an empty "from" string should be ignored (T53551)
22148 !! options
22149 language=zh variant=zh-cn
22150 !! input
22151 -{H|=>zh-cn:foo;}-foobar
22152 !! html/php
22153 <p>foobar
22154 </p>
22155 !! html/parsoid
22156 <p><meta typeof="mw:LanguageVariant" data-parsoid='{"tSp":[5]}' data-mw-variant='{"add":true,"oneway":[{"f":"","l":"zh-cn","t":"foo"}]}'/>foobar</p>
22157 !! end
22158
22159 !! test
22160 Empty converter rule entries shouldn't be inserted into the conversion table (T53551)
22161 !! options
22162 language=zh variant=zh-cn
22163 !! input
22164 -{H|}-foobar
22165 !! html/php
22166 <p>foobar
22167 </p>
22168 !! html/parsoid
22169 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"*","t":""}]}'/>foobar</p>
22170 !! end
22171
22172 !! test
22173 Nested using of manual convert syntax
22174 !! options
22175 language=zh variant=zh-hk
22176 !! wikitext
22177 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
22178 !! html/php
22179 <p>Nested: Hello Hong Kong!
22180 </p>
22181 !! html/parsoid
22182 <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>
22183 !! end
22184
22185 !! test
22186 HTML markups with conversion syntax in attribs, nested in other conversion blocks
22187 !! options
22188 language=zh variant=zh-cn
22189 !! wikitext
22190 -{zh;zh-hans;zh-hant|<span title="-{X}-">A</span>}-
22191 !! html/php
22192 <p><span title="X">A</span>
22193 </p>
22194 !! html/parsoid
22195 <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>
22196 !! end
22197
22198 !! test
22199 HTML markups with conversion syntax in attribs, nested in other conversion blocks (not working yet in PHP parser)
22200 !! options
22201 language=zh variant=zh-cn
22202 !! wikitext
22203 -{<span title="-{X}-">A</span>}-
22204 !! html/php+disabled
22205 <p><span title="X">A</span>
22206 </p>
22207 !! html/parsoid
22208 <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>
22209 !! end
22210
22211 # Parsoid and PHP disagree on how to parse this example: Parsoid
22212 # insists that the content of a language converter element be a valid
22213 # DOM fragment or attribute string
22214 !! test
22215 Language converter markup with block content
22216 !! options
22217 language=zh variant=zh-cn
22218 !! wikitext
22219 <span>a-{b<div>c}-d
22220
22221 <span>a-{zh;zh-hans;zh-hant|b<div>c}-d
22222
22223 <span>a-{H|0=>zh-cn:x<span>y;0=>zh-tw:b<div>c}-d
22224 !! html/php+tidy
22225 <p><span>ab</span></p>
22226 <div><span>cd <span>ab</span></span>
22227 <div><span>cd <span>ad</span></span></div>
22228 </div>
22229 !! html/parsoid
22230 <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>
22231
22232 <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>
22233
22234 <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>
22235 !! end
22236
22237 !! test
22238 LanguageConverter selser (1)
22239 !! options
22240 language=zh variant=zh-cn
22241 parsoid={
22242 "modes": ["wt2wt", "selser"],
22243 "changes": [
22244 ["span[typeof]", "attr", "data-mw-variant", "{\"disabled\":{\"t\":\"edited\"}}"]
22245 ]
22246 }
22247 !! wikitext
22248 -{raw}-
22249 !! wikitext/edited
22250 -{edited}-
22251 !! end
22252
22253 !! test
22254 LanguageConverter selser (2)
22255 !! options
22256 language=zh variant=zh-cn
22257 parsoid={
22258 "modes": ["wt2wt", "selser"],
22259 "changes": [
22260 ["span[class='x']", "contents", "text", "-{foo}-"],
22261 ["a", "contents", "text", "-{"],
22262 ["span[typeof]", "attr", "data-mw", "{\"parts\":[{\"template\":{\"target\":{\"wt\":\"1x\",\"href\":\"./Template:1x\"},\"params\":{\"1\":{\"wt\":\"-{\"}},\"i\":0}}]}"]
22263 ]
22264 }
22265 !! wikitext
22266 <span class="x">TEXT1</span>
22267 [http://example.com TEXT2]
22268 [[Foo|TEXT3]]
22269 {{echo|TEXT4}}
22270 !! wikitext/edited
22271 <span class="x"><nowiki>-{foo}-</nowiki></span>
22272 [http://example.com -{]
22273 [[Foo|<nowiki>-{</nowiki>]]
22274 {{1x|<nowiki>-{</nowiki>}}
22275 !! end
22276
22277 # Tests LanguageVariantText in ConstrainedText
22278 !! test
22279 LanguageConverter selser (3)
22280 !! options
22281 language=zh variant=zh-cn
22282 parsoid={
22283 "modes": ["wt2wt", "selser"],
22284 "changes": [
22285 ["td > span", "attr", "typeof", "mw:LanguageVariant"],
22286 ["td > span", "attr", "data-mw-variant", "{\"disabled\":{\"t\":\"edited\"}}"]
22287 ]
22288 }
22289 !! wikitext
22290 {|
22291 |-
22292 |<span>Foo</span>
22293 |}
22294 !! wikitext/edited
22295 {|
22296 |-
22297 |<nowiki/>-{edited}-
22298 |}
22299 !! end
22300
22301 # Tests LanguageVariantText._fromSelser
22302 !! test
22303 LanguageConverter selser (4)
22304 !! options
22305 language=zh variant=zh-cn
22306 parsoid={
22307 "modes": ["wt2wt", "selser"],
22308 "changes": [
22309 ["td > span.x", "remove"]
22310 ]
22311 }
22312 !! wikitext
22313 {|
22314 |-
22315 |<span class="x">Foo</span>-{Bar}-
22316 ||<span class="x">Foo</span>-{Bar}-
22317 |}
22318 !! wikitext/edited
22319 {|
22320 |-
22321 |<nowiki/>-{Bar}-
22322 ||-{Bar}-
22323 |}
22324 !! end
22325
22326 # Since Parsoid is starting to emit canonical wikitext for links,
22327 # [http://example.com http://example.com] will not RT back to that
22328 # form anymore.
22329 # Parsoid does not language-convert links (it is done in a
22330 # post-processing step)
22331 !! test
22332 Proper conversion of text in external links
22333 !! options
22334 language=sr variant=sr-ec
22335 parsoid=wt2html
22336 !! wikitext
22337 http://www.google.com
22338 gopher://www.google.com
22339 [http://www.google.com http://www.google.com]
22340 [gopher://www.google.com gopher://www.google.com]
22341 [https://www.google.com irc://www.google.com]
22342 [ftp://www.google.com www.google.com/ftp://dir]
22343 [//www.google.com www.google.com]
22344 !! html/php
22345 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
22346 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
22347 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
22348 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
22349 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
22350 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
22351 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
22352 </p>
22353 !! html/parsoid
22354 <p><a rel="mw:ExtLink" href="http://www.google.com">http://www.google.com</a>
22355 <a rel="mw:ExtLink" href="gopher://www.google.com">gopher://www.google.com</a>
22356 <a rel="mw:ExtLink" href="http://www.google.com">http://www.google.com</a>
22357 <a rel="mw:ExtLink" href="gopher://www.google.com">gopher://www.google.com</a>
22358 <a rel="mw:ExtLink" href="https://www.google.com">irc://www.google.com</a>
22359 <a rel="mw:ExtLink" href="ftp://www.google.com">www.google.com/ftp://dir</a>
22360 <a rel="mw:ExtLink" href="//www.google.com">www.google.com</a></p>
22361 !! end
22362
22363 !! test
22364 Do not convert roman numbers to language variants
22365 !! options
22366 language=sr variant=sr-ec
22367 !! wikitext
22368 Fridrih IV je car.
22369 !! html/php
22370 <p>Фридрих IV је цар.
22371 </p>
22372 !! html/parsoid
22373 <p>Fridrih IV je car.</p>
22374 !! end
22375
22376 !! test
22377 Unclosed language converter markup "-{"
22378 !! options
22379 language=sr
22380 !! wikitext
22381 -{T|hello
22382 !! html
22383 <p>-{T|hello
22384 </p>
22385 !! end
22386
22387 !! test
22388 Don't convert raw rule "-{R|=&gt;}-" to "=>"
22389 !! options
22390 language=sr
22391 !! wikitext
22392 -{R|=&gt;}-
22393 !! html/php
22394 <p>=&gt;
22395 </p>
22396 !! html/parsoid
22397 <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>
22398 !!end
22399
22400 !! test
22401 Don't break link parsing if language converter markup is in the caption.
22402 !! options
22403 language=sr variant=sr-ec
22404 !! wikitext
22405 [[Main Page|-{R|main page}-]]
22406 !! html/php
22407 <p><a href="/wiki/Main_Page" title="Маин Паге">main page</a>
22408 </p>
22409 !! html/parsoid
22410 <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>
22411 !! end
22412
22413 !! test
22414 T146304: Don't break template parsing if language converter markup is in the parameter.
22415 !! options
22416 language=sr variant=sr-ec
22417 !! wikitext
22418 {{echo|-{R|foo}-}}
22419 !! html/php
22420 <p>foo
22421 </p>
22422 !! html/parsoid
22423 <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>
22424 !! end
22425
22426 !! test
22427 T146305: Don't break image parsing if language converter markup is in the caption.
22428 !! options
22429 language=sr
22430 !! wikitext
22431 [[Датотека:Foobar.jpg|thumb|-{R|caption:}-]]
22432 !! html/php
22433 <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>
22434
22435 !! html/parsoid
22436 <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>
22437 !! end
22438
22439 !! test
22440 T146305: Don't break image parsing if nested language converter markup is in the caption.
22441 !! options
22442 language=zh variant=zh-cn
22443 !! wikitext
22444 [[File:Foobar.jpg|thumb|-{|zh-cn:blog (hk: -{zh-hans|WEBJOURNAL}-, tw: -{zh-hans|WEBLOG}-)}-]]
22445 !! html/php
22446 <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>
22447
22448 !! html/parsoid
22449 <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>
22450 !! end
22451
22452 # XXX html2wt disabled because rich markup in alt is not preserved.
22453 !! test
22454 Don't break gallery if language converter markup is inside.
22455 !! options
22456 language=zh
22457 !! wikitext
22458 <gallery>
22459 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=-{R|foo}-|-{R|bar}-]]|alt=-{R|bat}-
22460 File:foobar.jpg|{{Test|unamedParam|alt=-{R|param}-}}|alt=galleryalt
22461 </gallery>
22462 !! html/php
22463 <ul class="gallery mw-gallery-traditional">
22464 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
22465 <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>
22466 <div class="gallerytext">
22467 <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>
22468 </p>
22469 </div>
22470 </div></li>
22471 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
22472 <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>
22473 <div class="gallerytext">
22474 <p>This is a test template
22475 </p>
22476 </div>
22477 </div></li>
22478 </ul>
22479
22480 !! html/parsoid
22481 <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"}}'>
22482 <li class="gallerybox">
22483 <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>
22484 <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>
22485 </li>
22486 <li class="gallerybox">
22487 <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>
22488 <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>
22489 </li>
22490 </ul>
22491 !! end
22492
22493 !! test
22494 T153135: Don't break list handling if language converter markup is in the item.
22495 !! options
22496 language=zh variant=zh-cn
22497 !! wikitext
22498 ;-{zh-cn:AAA;zh-tw:BBB}-
22499 ;-{R|foo:bar}-
22500 !! html/php
22501 <dl><dt>AAA</dt>
22502 <dt>foo:bar</dt></dl>
22503
22504 !! html/parsoid
22505 <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>
22506 <dt data-parsoid='{"dsr":[25,39,1,0]}'><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"foo:bar"}}'></span></dt>
22507 </dl>
22508 !! end
22509
22510 // Note that parsoid does not protect colons unless language converter
22511 // markup is properly nested, because it is a backtracking parser.
22512 !! test
22513 T153135: Unclosed markup in definition list (code coverage)
22514 !! options
22515 language=zh variant=zh-cn
22516 !! wikitext
22517 ;<b>foo:bar
22518 ;-{zh-cn:AAA
22519 !! html/php+tidy
22520 <dl>
22521 <dt><b>foo:bar</b></dt>
22522 <dt><b>-{zh-cn:AAA</b></dt>
22523 </dl>
22524 !! html/parsoid
22525 <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}'>
22526 <dt data-parsoid='{"dsr":[12,20,1,0]}'>-{zh-cn</dt>
22527 <dd data-parsoid='{"stx":"row","dsr":[20,24,1,0]}'>AAA</dd>
22528 </b></dl>
22529 !! end
22530
22531 !! test
22532 T153135: Nested language converter markup in definition list (code coverage)
22533 !! options
22534 language=zh variant=zh-cn
22535 !! wikitext
22536 ;-{|zh-cn:AAA -{zh-hans|foo:bar}- -{R|bat:baz}-}-:def
22537 !! html/php
22538 <dl><dt>AAA foo:bar bat:baz</dt>
22539 <dd>def</dd></dl>
22540
22541 !! html/parsoid
22542 <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>
22543 <dd data-parsoid='{"stx":"row","dsr":[49,53,1,0]}'>def</dd>
22544 </dl>
22545 !! end
22546
22547 # html2wt mode disabled due to <nowiki> insertion.
22548 !! test
22549 T153140: Don't break table handling if language converter markup is in the cell.
22550 !! options
22551 language=sr variant=sr-ec
22552 parsoid=wt2html,wt2wt,html2html
22553 !! wikitext
22554 {|
22555 |-
22556 | -{R|B}-
22557 |}
22558 !! html/php
22559 <table>
22560
22561 <tr>
22562 <td> B
22563 </td></tr></table>
22564
22565 !! html/parsoid
22566 <table>
22567 <tbody>
22568 <tr>
22569 <td><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"B"}}'></span></td>
22570 </tr>
22571 </tbody>
22572 </table>
22573 !! end
22574
22575 !! test
22576 Language converter tricky html2wt cases (1)
22577 !! options
22578 language=sr
22579 parsoid=html2wt,wt2wt
22580 !! html/parsoid
22581 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"}-"}}'></span></p>
22582 !! wikitext
22583 -{<nowiki>}-</nowiki>}-
22584 !! html/php
22585 <p>&#125;-
22586 </p>
22587 !! end
22588
22589 !! test
22590 Language converter tricky html2wt cases (2)
22591 !! options
22592 language=sr
22593 parsoid=html2wt,wt2wt
22594 !! html/parsoid
22595 <p>-{foo}-</p>
22596 !! wikitext
22597 <nowiki>-{foo}-</nowiki>
22598 !! html/php
22599 <p>-&#123;foo&#125;-
22600 </p>
22601 !! end
22602
22603 !! test
22604 Language converter tricky html2wt cases (3)
22605 !! options
22606 language=sr
22607 parsoid=html2wt,wt2wt
22608 !! html/parsoid
22609 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"|"}}'></span></p>
22610 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"R|raw"}}'></span></p>
22611 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"-{foo}-"}}'></span></p>
22612 !! wikitext
22613 -{R||}-
22614
22615 -{R|R|raw}-
22616
22617 -{<nowiki>-{foo}-</nowiki>}-
22618 !! html/php
22619 <p>|
22620 </p><p>R|raw
22621 </p><p>-&#123;foo&#125;-
22622 </p>
22623 !! end
22624
22625 !! test
22626 Language converter tricky html2wt cases (4)
22627 !! options
22628 language=sr
22629 parsoid=html2wt,wt2wt
22630 !! html/parsoid
22631 <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>
22632 !! wikitext
22633 -{R|{{echo|hey}}}-
22634 !! html/php
22635 <p>hey
22636 </p>
22637 !! end
22638
22639 # Note that the <nowiki> escaping added by parsoid for source text,
22640 # destination text, and language names only works on the PHP side
22641 # for *destination text*. (HTML entity escaping wouldn't work
22642 # any better.) This is probably a bug, at least for source texts.
22643 # (For language names PHP uses a precise regexp based on the languages
22644 # it currently knows have variants, which is fragile since this set
22645 # can grow/shrink over time.)
22646 !! test
22647 Language converter tricky html2wt cases (5)
22648 !! options
22649 language=zh variant=zh-cn
22650 !! html/parsoid
22651 <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>
22652 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"oneway":[{"f":"A","l":"bo:g;us","t":"B"}]}'/></p>
22653 <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>
22654 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"twoway":[{"l":"bo:g;us","t":"xyz"},{"l":"zh-cn","t":"abc"}]}'></span></p>
22655 <p>a:b=>c xyz</p>
22656 !! wikitext
22657 -{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
22658
22659 -{H|A=><nowiki>bo:g;us</nowiki>:B}-
22660
22661 -{A|zh-tw:xyz; zh-cn:<nowiki>0;zh-tw:bar</nowiki>}-
22662
22663 -{<nowiki>bo:g;us</nowiki>:xyz; zh-cn:abc}-
22664
22665 a:b=>c xyz
22666 !! html/php+disabled
22667 <p>foobat;xyz=&gt;zh-cn:abc
22668 </p><p>A
22669 </p><p>0;zh-tw:bar
22670 </p><p>abc
22671 </p><p>a:b=&gt;c 0;zh-tw:bar
22672 </p>
22673 !! end
22674
22675 !! test
22676 T2529: Uncovered bullet
22677 !! wikitext
22678 * Foo {{bullet}}
22679 !! html
22680 <ul><li> Foo </li>
22681 <li> Bar</li></ul>
22682
22683 !! end
22684
22685 # Plain MediaWiki does not remove empty lists, but tidy actually does.
22686 # Templates in Wikipedia rely on this behavior, as tidy has always been
22687 # enabled there. These tests are normally run *without* tidy, so specify the
22688 # full output here.
22689 # To test realistic parsing behavior, apply a tidy-like transformation to both
22690 # the expected output and your parser's output.
22691 !! test
22692 T2529: Uncovered bullet leaving empty list, normally removed by tidy
22693 !! wikitext
22694 ******* Foo {{bullet}}
22695 !! html
22696 <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>
22697 <li> Bar</li></ul>
22698
22699 !! end
22700
22701 !! test
22702 T2529: Uncovered table already at line-start
22703 !! wikitext
22704 x
22705
22706 {{table}}
22707 y
22708 !! html
22709 <p>x
22710 </p>
22711 <table>
22712 <tr>
22713 <td> 1 </td>
22714 <td> 2
22715 </td></tr>
22716 <tr>
22717 <td> 3 </td>
22718 <td> 4
22719 </td></tr></table>
22720 <p>y
22721 </p>
22722 !! end
22723
22724 !! test
22725 T2529: Uncovered bullet in parser function result
22726 !! wikitext
22727 * Foo {{lc:{{bullet}} }}
22728 !! html
22729 <ul><li> Foo </li>
22730 <li> bar</li></ul>
22731
22732 !! end
22733
22734 !! test
22735 T7678: Double-parsed template argument
22736 !! wikitext
22737 {{lc:{{{1}}}|hello}}
22738 !! html
22739 <p>{{{1}}}
22740 </p>
22741 !! end
22742
22743 !! test
22744 T7678: Double-parsed template invocation
22745 !! wikitext
22746 {{lc:{{paramtest {{!}} param = hello }} }}
22747 !! html
22748 <p>{{paramtest | param = hello }}
22749 </p>
22750 !! end
22751
22752 !! test
22753 Case insensitivity of parser functions for non-ASCII characters (T10143)
22754 !! options
22755 language=cs
22756 title=[[Main Page]]
22757 !! wikitext
22758 {{PRVNÍVELKÉ:ěščř}}
22759 {{prvnívelké:ěščř}}
22760 {{PRVNÍMALÉ:ěščř}}
22761 {{prvnímalé:ěščř}}
22762 {{MALÁ:ěščř}}
22763 {{malá:ěščř}}
22764 {{VELKÁ:ěščř}}
22765 {{velká:ěščř}}
22766 !! html
22767 <p>Ěščř
22768 Ěščř
22769 ěščř
22770 ěščř
22771 ěščř
22772 ěščř
22773 ĚŠČŘ
22774 ĚŠČŘ
22775 </p>
22776 !! end
22777
22778 !! test
22779 Morwen/13: Unclosed link followed by heading
22780 !! wikitext
22781 [[link
22782 ==heading==
22783 !! html
22784 <p>[[link
22785 </p>
22786 <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>
22787
22788 !! end
22789
22790 !! test
22791 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
22792 !! wikitext
22793 {{foo|
22794 =heading=
22795 !! html
22796 <p>{{foo|
22797 </p>
22798 <h1><span class="mw-headline" id="heading">heading</span></h1>
22799
22800 !! end
22801
22802 !! test
22803 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
22804 !! wikitext
22805 {{foo|
22806 ==heading==
22807 !! html
22808 <p>{{foo|
22809 </p>
22810 <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>
22811
22812 !! end
22813
22814 !! test
22815 Tildes in comments
22816 !! options
22817 pst
22818 !! wikitext
22819 <!-- ~~~~ -->
22820 !! html/php
22821 <!-- ~~~~ -->
22822 !! end
22823
22824 !! test
22825 Paragraphs inside divs (no extra line breaks)
22826 !! wikitext
22827 <div>Line one
22828
22829 Line two</div>
22830 !! html
22831 <div>Line one
22832 Line two</div>
22833
22834 !! end
22835
22836 !! test
22837 Paragraphs inside divs (extra line break on open)
22838 !! wikitext
22839 <div>
22840 Line one
22841
22842 Line two</div>
22843 !! html
22844 <div>
22845 <p>Line one
22846 </p>
22847 Line two</div>
22848
22849 !! end
22850
22851 !! test
22852 Paragraphs inside divs (extra line break on close)
22853 !! wikitext
22854 <div>Line one
22855
22856 Line two
22857 </div>
22858 !! html
22859 <div>Line one
22860 <p>Line two
22861 </p>
22862 </div>
22863
22864 !! end
22865
22866 !! test
22867 Paragraphs inside divs (extra line break on open and close)
22868 !! wikitext
22869 <div>
22870 Line one
22871
22872 Line two
22873 </div>
22874 !! html
22875 <div>
22876 <p>Line one
22877 </p><p>Line two
22878 </p>
22879 </div>
22880
22881 !! end
22882
22883 !! test
22884 Nesting tags, paragraphs on lines which begin with <div>
22885 !! wikitext
22886 <div></div><strong>A
22887 B</strong>
22888 !! html/php+tidy
22889 <p><strong>A</strong></p>
22890 <p><strong>B</strong></p>
22891 !! html/parsoid
22892 <div></div>
22893 <p><strong>A
22894 B</strong>
22895 </p>
22896 !! end
22897
22898 # T8200: <blockquote> should behave like <div> with respect to line breaks
22899 !! test
22900 T8200: paragraphs inside blockquotes (no extra line breaks)
22901 !! wikitext
22902 <blockquote>Line one
22903
22904 Line two</blockquote>
22905 !! html
22906 <blockquote>Line one
22907 Line two</blockquote>
22908
22909 !! html+tidy
22910 <blockquote>
22911 <p>Line one Line two</p>
22912 </blockquote>
22913 !! end
22914
22915 !! test
22916 T8200: paragraphs inside blockquotes (extra line break on open)
22917 !! wikitext
22918 <blockquote>
22919 Line one
22920
22921 Line two</blockquote>
22922 !! html
22923 <blockquote>
22924 <p>Line one
22925 </p>
22926 Line two</blockquote>
22927
22928 !! html+tidy
22929 <blockquote>
22930 <p>Line one</p>
22931 Line two</blockquote>
22932 !! end
22933
22934 !! test
22935 T8200: paragraphs inside blockquotes (extra line break on close)
22936 !! wikitext
22937 <blockquote>Line one
22938
22939 Line two
22940 </blockquote>
22941 !! html
22942 <blockquote>Line one
22943 <p>Line two
22944 </p>
22945 </blockquote>
22946
22947 !! html+tidy
22948 <blockquote>
22949 <p>Line one</p>
22950 <p>Line two</p>
22951 </blockquote>
22952 !! end
22953
22954 !! test
22955 T8200: paragraphs inside blockquotes (extra line break on open and close)
22956 !! wikitext
22957 <blockquote>
22958 Line one
22959
22960 Line two
22961 </blockquote>
22962 !! html
22963 <blockquote>
22964 <p>Line one
22965 </p><p>Line two
22966 </p>
22967 </blockquote>
22968
22969 !! html+tidy
22970 <blockquote>
22971 <p>Line one</p>
22972 <p>Line two</p>
22973 </blockquote>
22974 !! end
22975
22976 !! test
22977 Paragraphs inside blockquotes/divs (no extra line breaks)
22978 !! wikitext
22979 <blockquote><div>Line one
22980
22981 Line two</div></blockquote>
22982 !! html
22983 <blockquote><div>Line one
22984 Line two</div></blockquote>
22985
22986 !! end
22987
22988 !! test
22989 Paragraphs inside blockquotes/divs (extra line break on open)
22990 !! wikitext
22991 <blockquote><div>
22992 Line one
22993
22994 Line two</div></blockquote>
22995 !! html
22996 <blockquote><div>
22997 <p>Line one
22998 </p>
22999 Line two</div></blockquote>
23000
23001 !! end
23002
23003 !! test
23004 Paragraphs inside blockquotes/divs (extra line break on close)
23005 !! wikitext
23006 <blockquote><div>Line one
23007
23008 Line two
23009 </div></blockquote>
23010 !! html
23011 <blockquote><div>Line one
23012 <p>Line two
23013 </p>
23014 </div></blockquote>
23015
23016 !! end
23017
23018 !! test
23019 Paragraphs inside blockquotes/divs (extra line break on open and close)
23020 !! wikitext
23021 <blockquote><div>
23022 Line one
23023
23024 Line two
23025 </div></blockquote>
23026 !! html
23027 <blockquote><div>
23028 <p>Line one
23029 </p><p>Line two
23030 </p>
23031 </div></blockquote>
23032
23033 !! end
23034
23035 !! test
23036 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
23037 !! options
23038 wgLinkHolderBatchSize=0
23039 !! wikitext
23040 [[meatball:1]]
23041 [[meatball:2]]
23042 [[meatball:3]]
23043 !! html
23044 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
23045 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
23046 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
23047 </p>
23048 !! end
23049
23050 !! test
23051 Free external link invading image caption
23052 !! wikitext
23053 [[Image:Foobar.jpg|thumb|http://x|hello]]
23054 !! html
23055 <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>
23056
23057 !! end
23058
23059 !! test
23060 T17196: localised external link numbers
23061 !! options
23062 language=fa
23063 !! wikitext
23064 [http://en.wikipedia.org/]
23065 !! html/php
23066 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
23067 </p>
23068 !! html/parsoid
23069 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/"></a></p>
23070 !! end
23071
23072 !! test
23073 Multibyte character in padleft
23074 !! wikitext
23075 {{padleft:-Hello|7|Æ}}
23076 !! html
23077 <p>Æ-Hello
23078 </p>
23079 !! end
23080
23081 !! test
23082 Multibyte character in padright
23083 !! wikitext
23084 {{padright:Hello-|7|Æ}}
23085 !! html
23086 <p>Hello-Æ
23087 </p>
23088 !! end
23089
23090 !!test
23091 formatdate parser function
23092 !! wikitext
23093 {{#formatdate:2009-03-24}}
23094 !! html
23095 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
23096 </p>
23097 !! end
23098
23099 !!test
23100 formatdate parser function, with default format
23101 !! wikitext
23102 {{#formatdate:2009-03-24|mdy}}
23103 !! html
23104 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
23105 </p>
23106 !! end
23107
23108 !! test
23109 Spacing of numbers in formatted dates
23110 !! wikitext
23111 {{#formatdate:January 15}}
23112 !! html
23113 <p><span class="mw-formatted-date" title="01-15">January 15</span>
23114 </p>
23115 !! end
23116
23117 !! test
23118 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
23119 !! options
23120 language=nl title=[[MediaWiki:Common.css]]
23121 !! wikitext
23122 {{#formatdate:2009-03-24|dmy}}
23123 !! html
23124 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
23125 </p>
23126 !! end
23127
23128 #
23129 #
23130 #
23131
23132 #
23133 # Edit comments
23134 #
23135
23136 !! test
23137 Edit comment with link
23138 !! options
23139 comment
23140 !! wikitext
23141 I like the [[Main Page]] a lot
23142 !! html/php
23143 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
23144 !!end
23145
23146 !! test
23147 Edit comment with link and link text
23148 !! options
23149 comment
23150 !! wikitext
23151 I like the [[Main Page|best pages]] a lot
23152 !! html/php
23153 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
23154 !!end
23155
23156 !! test
23157 Edit comment with link and link text with suffix
23158 !! options
23159 comment
23160 !! wikitext
23161 I like the [[Main Page|best page]]s a lot
23162 !! html/php
23163 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
23164 !!end
23165
23166 !! test
23167 Edit comment with section link (non-local, eg in history list)
23168 !! options
23169 comment title=[[Main Page]]
23170 !! wikitext
23171 /* External links */ removed bogus entries
23172 !! html/php
23173 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
23174 !!end
23175
23176 !! test
23177 Edit comment with section link and text before it (non-local, eg in history list)
23178 !! options
23179 comment title=[[Main Page]]
23180 !! wikitext
23181 pre-comment text /* External links */ removed bogus entries
23182 !! html/php
23183 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>
23184 !!end
23185
23186 !! test
23187 Edit comment with section link (local, eg in diff view)
23188 !! options
23189 comment local title=[[Main Page]]
23190 !! wikitext
23191 /* External links */ removed bogus entries
23192 !! html/php
23193 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
23194 !!end
23195
23196 !! test
23197 Edit comment with subpage link (T16080)
23198 !! options
23199 comment
23200 subpage
23201 title=[[Subpage test]]
23202 !! wikitext
23203 Poked at a [[/subpage]] here...
23204 !! html/php
23205 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
23206 !!end
23207
23208 !! test
23209 Edit comment with subpage link and link text (T16080)
23210 !! options
23211 comment
23212 subpage
23213 title=[[Subpage test]]
23214 !! wikitext
23215 Poked at a [[/subpage|neat little page]] here...
23216 !! html/php
23217 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
23218 !!end
23219
23220 !! test
23221 Edit comment with bogus subpage link in non-subpage NS (T16080)
23222 !! options
23223 comment
23224 title=[[Subpage test]]
23225 !! wikitext
23226 Poked at a [[/subpage]] here...
23227 !! html/php
23228 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...
23229 !!end
23230
23231 !! test
23232 Edit comment with bare anchor link (local, as on diff)
23233 !! options
23234 comment
23235 local
23236 title=[[Main Page]]
23237 !! wikitext
23238 [[#section]]
23239 !! html/php
23240 <a href="#section">#section</a>
23241 !! end
23242
23243 !! test
23244 Edit comment with bare anchor link (non-local, as on history)
23245 !! options
23246 comment
23247 title=[[Main Page]]
23248 !! wikitext
23249 [[#section]]
23250 !! html/php
23251 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
23252 !! end
23253
23254 !! test
23255 Anchor starting with underscore
23256 !! options
23257 title=[[Foo]]
23258 !! wikitext
23259 [[#_ref|One]]
23260 !! html/php
23261 <p><a href="#_ref">One</a>
23262 </p>
23263 !! html/parsoid
23264 <p><a rel="mw:WikiLink" href="./Foo#_ref" data-parsoid='{"stx":"piped","a":{"href":"./Foo#_ref"},"sa":{"href":"#_ref"}}'>One</a></p>
23265 !! end
23266
23267 !! test
23268 Id starting with underscore
23269 !! wikitext
23270 <div id="_ref"></div>
23271 !! html/*
23272 <div id="_ref"></div>
23273
23274 !! end
23275
23276 !! test
23277 Edit comment with link with more than one pipe (T99346)
23278 !! options
23279 comment
23280 !! wikitext
23281 [[Main Page|Many|pipes]]
23282 !! html/php
23283 <a href="/wiki/Main_Page" title="Main Page">Many|pipes</a>
23284 !! end
23285
23286 !! test
23287 Complex edit comment with link with more than one pipe (T99346)
23288 !! options
23289 comment
23290 !! wikitext
23291 Created page with "<noinclude>[[Category:Requests for permissions/Bot|{{subst:#titleparts:{{subst:PAGENAME}}|1|3}}]]</noinclude> === [[User:MineoBot|]] 8=== {{Request for permissions/links|Mineo..."
23292 !! html/php
23293 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;
23294 !! end
23295
23296 !! test
23297 Space normalisation on autocomment (T24784)
23298 !! options
23299 comment
23300 title=[[Main Page]]
23301 !! wikitext
23302 /* __hello__world__ */
23303 !! html/php
23304 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
23305 !! end
23306
23307 !! test
23308 percent-encoding and + signs in comments (T28410)
23309 !! options
23310 comment
23311 !! wikitext
23312 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
23313 !! html/php
23314 <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>
23315 !! end
23316
23317 # Parsoid doesn't support this yet: see T75581
23318 # but it *should* omit the 'src' attribute if the image is bad.
23319 # PHP side of tests was disabled in
23320 # mediawiki/core:6bd31e7d95161a6e88fa86df60871051da997c3c
23321 # because of issues in the PHP parserTests infrastructure
23322 # (but the output below is indeed what the PHP side emits)
23323 !! test
23324 Bad images - basic functionality
23325 !! wikitext
23326 [[File:Bad.jpg]]
23327 !! DISABLED/html/php
23328 !! html/parsoid
23329 <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>
23330 !! end
23331
23332 !! test
23333 Bad images - T18039: text after bad image disappears
23334 !! wikitext
23335 Foo bar
23336 [[File:Bad.jpg]]
23337 Bar foo
23338 !! DISABLED/html/php
23339 <p>Foo bar
23340 </p><p>Bar foo
23341 </p>
23342 !! html/parsoid
23343 <p>Foo bar
23344 <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>
23345 Bar foo</p>
23346 !! end
23347
23348 !! test
23349 Verify that displaytitle works (T24501) no displaytitle
23350 !! options
23351 showtitle
23352 !! config
23353 wgAllowDisplayTitle=true
23354 wgRestrictDisplayTitle=false
23355 !! wikitext
23356 this is not the the title
23357 !! html/php
23358 Parser test
23359 <p>this is not the the title
23360 </p>
23361 !! end
23362
23363 !! test
23364 Verify that displaytitle works (T24501) RestrictDisplayTitle=false
23365 !! options
23366 showtitle
23367 title=[[Screen]]
23368 !! config
23369 wgAllowDisplayTitle=true
23370 wgRestrictDisplayTitle=false
23371 !! wikitext
23372 this is not the the title
23373 {{DISPLAYTITLE:whatever}}
23374 !! html/php
23375 whatever
23376 <p>this is not the the title
23377 </p>
23378 !! end
23379
23380 !! test
23381 Verify that displaytitle works (T24501) RestrictDisplayTitle=true mismatch
23382 !! options
23383 showtitle
23384 title=[[Screen]]
23385 !! config
23386 wgAllowDisplayTitle=true
23387 wgRestrictDisplayTitle=true
23388 !! wikitext
23389 this is not the the title
23390 {{DISPLAYTITLE:whatever}}
23391 !! html/php
23392 Screen
23393 <p>this is not the the title
23394 </p>
23395 !! end
23396
23397 !! test
23398 Verify that displaytitle works (T24501) RestrictDisplayTitle=true matching
23399 !! options
23400 showtitle
23401 title=[[Screen]]
23402 !! config
23403 wgAllowDisplayTitle=true
23404 wgRestrictDisplayTitle=true
23405 !! wikitext
23406 this is not the the title
23407 {{DISPLAYTITLE:screen}}
23408 !! html/php
23409 screen
23410 <p>this is not the the title
23411 </p>
23412 !! end
23413
23414 !! test
23415 Verify that displaytitle works (T24501) AllowDisplayTitle=false
23416 !! options
23417 showtitle
23418 title=[[Screen]]
23419 !! config
23420 wgAllowDisplayTitle=false
23421 !! wikitext
23422 this is not the the title
23423 {{DISPLAYTITLE:screen}}
23424 !! html/php
23425 Screen
23426 <p>this is not the the title
23427 <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>
23428 </p>
23429 !! end
23430
23431 !! test
23432 Verify that displaytitle works (T24501) AllowDisplayTitle=false no DISPLAYTITLE
23433 !! options
23434 showtitle
23435 title=[[Screen]]
23436 !! config
23437 wgAllowDisplayTitle=false
23438 !! wikitext
23439 this is not the the title
23440 !! html/php
23441 Screen
23442 <p>this is not the the title
23443 </p>
23444 !! end
23445
23446 !! test
23447 Verify that displaytitle handles inline CSS styles (T28547) - rejected value
23448 !! options
23449 showtitle
23450 title=[[Screen]]
23451 !! config
23452 wgAllowDisplayTitle=true
23453 wgRestrictDisplayTitle=true
23454 !! wikitext
23455 this is not the the title
23456 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
23457 !! html/php
23458 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
23459 <p>this is not the the title
23460 </p>
23461 !! end
23462
23463 !! test
23464 Verify that displaytitle handles inline CSS styles (T28547) - accepted value
23465 !! options
23466 showtitle
23467 title=[[Screen]]
23468 !! config
23469 wgAllowDisplayTitle=true
23470 wgRestrictDisplayTitle=true
23471 !! wikitext
23472 this is not the the title
23473 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
23474 !! html/php
23475 <span style="color: red;">s</span>creen
23476 <p>this is not the the title
23477 </p>
23478 !! end
23479
23480 !! test
23481 Page status indicators: Empty name is invalid
23482 !! options
23483 showindicators
23484 !! wikitext
23485 <indicator name=" "></indicator>
23486 <indicator></indicator>
23487 !! html/php
23488 <p><span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
23489 <span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
23490 </p>
23491 !! end
23492
23493 !! test
23494 Page status indicators: Weird syntaxes that are okay
23495 !! options
23496 showindicators
23497 !! wikitext
23498 <indicator name="empty" />
23499 <indicator name="name"></indicator>
23500 !! html/php
23501 empty=
23502 name=
23503 <p><br />
23504 </p>
23505 !! end
23506
23507 !! test
23508 Page status indicators: Torture test
23509 !! options
23510 showindicators
23511 !! wikitext
23512 <indicator name="01">hello world</indicator>
23513 <indicator name="02">[[Main Page]]</indicator>
23514 <indicator name="03">[[File:Foobar.jpg|25px|link=]]</indicator>
23515 <indicator name="04">[[File:Foobar.jpg|25px]]</indicator>
23516 <indicator name="05">* foo
23517 * bar</indicator>
23518 <indicator name="06"><nowiki>foo</nowiki></indicator>
23519 <indicator name="07"> Preformatted</indicator>
23520 <indicator name="08"><div>Broken tag</indicator>
23521 <indicator name="09">{| class=wikitable
23522 | cell
23523 |}</indicator>
23524 <indicator name="10">Two
23525
23526 paragraphs</indicator>
23527 !! html/php
23528 01=hello world
23529 02=<a href="/wiki/Main_Page" title="Main Page">Main Page</a>
23530 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" />
23531 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>
23532 05=<ul><li> foo</li>
23533 <li> bar</li></ul>
23534
23535 06=foo
23536 07=<pre>Preformatted
23537 </pre>
23538 08=<div>Broken tag</div>
23539
23540 09=<table class="wikitable">
23541 <tr>
23542 <td> cell
23543 </td></tr></table>
23544
23545 10=<p>Two
23546 </p><p>paragraphs
23547 </p>
23548 <p><br />
23549 </p><p><br />
23550 </p><p><br />
23551 </p><p><br />
23552 </p><p><br />
23553 </p>
23554 !! end
23555
23556 !! test
23557 preload: check <noinclude> and <includeonly>
23558 !! options
23559 preload
23560 !! wikitext
23561 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
23562 !! html/php
23563 Hello kind world.
23564 !! end
23565
23566 !! test
23567 preload: check <onlyinclude>
23568 !! options
23569 preload
23570 !! wikitext
23571 Goodbye <onlyinclude>Hello world</onlyinclude>
23572 !! html/php
23573 Hello world
23574 !! end
23575
23576 !! test
23577 preload: can pass tags through if we want to
23578 !! options
23579 preload
23580 !! wikitext
23581 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
23582 !! html/php
23583 <includeonly>Hello world</includeonly>
23584 !! end
23585
23586 !! test
23587 preload: check that it doesn't try to do tricks
23588 !! options
23589 preload
23590 !! wikitext
23591 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
23592 !! html/php
23593 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
23594 !! end
23595
23596 !! test
23597 Play a bit with r67090 and T5158
23598 !! wikitext
23599 <div style="width:50% !important">&nbsp;</div>
23600 <div style="width:50%&nbsp;!important">&nbsp;</div>
23601 <div style="width:50%&#160;!important">&nbsp;</div>
23602 <div style="border : solid;">&nbsp;</div>
23603 !! html/php
23604 <div style="width:50% !important">&#160;</div>
23605 <div style="width:50% !important">&#160;</div>
23606 <div style="width:50% !important">&#160;</div>
23607 <div style="border&#160;: solid;">&#160;</div>
23608
23609 !! html/parsoid
23610 <div style="width:50% !important" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
23611 <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>
23612 <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>
23613 <div style="border : solid;" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
23614
23615 !! end
23616
23617 !! test
23618 HTML5 data attributes
23619 !! wikitext
23620 <span data-foo="bar">Baz</span>
23621 <p data-abc-def_hij="">Quuz</p>
23622 !! html/php
23623 <p><span data-foo="bar">Baz</span>
23624 </p>
23625 <p data-abc-def_hij="">Quuz</p>
23626
23627 !! html/parsoid
23628 <p><span data-foo="bar" data-parsoid='{"stx":"html"}'>Baz</span></p>
23629 <p data-abc-def_hij="" data-parsoid='{"stx":"html"}'>Quuz</p>
23630 !! end
23631
23632 !! test
23633 Strip reserved data attributes
23634 !! wikitext
23635 <div data-mw="foo" data-parsoid="bar" data-mw-someext="baz" data-ok="fred" data-ooui="xyzzy" data-bad:ns="ns">d</div>
23636 !! html/php
23637 <div data-ok="fred">d</div>
23638
23639 !! html/parsoid
23640 <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>
23641 !! end
23642
23643 !! test
23644 percent-encoding and + signs in internal links (T28410)
23645 !! wikitext
23646 [[User:+%]] [[Page+title%]]
23647 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
23648 [[%]] [[+]] [[File:%+abc%39|foo|[[bar]]]]
23649 [[%33%45]] [[%33%45+]]
23650 !! html/php
23651 <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>
23652 <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>
23653 <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>
23654 <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>
23655 </p>
23656 !! html/parsoid
23657 <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>
23658 <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>
23659 <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>
23660 <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>
23661 !! end
23662
23663 !! test
23664 Special characters in embedded file links (T29679)
23665 !! wikitext
23666 [[File:Contains & ampersand.jpg]]
23667 [[File:Does not exist.jpg|Title with & ampersand]]
23668 !! html/php
23669 <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>
23670 <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>
23671 </p>
23672 !! html/parsoid
23673 <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>
23674 <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>
23675 !! end
23676
23677 !! test
23678 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
23679 !! wikitext
23680 Text&apos;s been normalized?
23681 !! html
23682 <p>Text&#39;s been normalized?
23683 </p>
23684 !! end
23685
23686 !! test
23687 T21052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
23688 !! wikitext
23689 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
23690 !! html
23691 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
23692 </p>
23693 !! end
23694
23695 !! test
23696 T21052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
23697 !! wikitext
23698 [http://www.example.org/ ideograms]
23699 !! html
23700 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
23701 </p>
23702 !! end
23703
23704 !! test
23705 T21052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
23706 !! wikitext
23707 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
23708 !! html
23709 <p><img src="http://www.example.org/pic.png" alt="pic.png"/> &lt;-- U+3000 (vim: ^Vu3000)
23710 </p>
23711 !! end
23712
23713 !! article
23714 Mediawiki:loop1
23715 !! text
23716 {{Identical|A}}
23717 !! endarticle
23718
23719 !! article
23720 Mediawiki:loop2
23721 !! text
23722 {{Identical|B}}
23723 !! endarticle
23724
23725 !! article
23726 Template:Identical
23727 !! text
23728 {{int:loop1}}
23729 {{int:loop2}}
23730 !! endarticle
23731
23732 !! test
23733 T33098 Template which includes system messages which includes the template
23734 !! wikitext
23735 {{Identical}}
23736 !! html
23737 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
23738 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
23739 </p>
23740 !! end
23741
23742 !! test
23743 T33490 Turkish: ucfirst 'blah'
23744 !! options
23745 language=tr
23746 !! wikitext
23747 {{ucfirst:blah}}
23748 !! html
23749 <p>Blah
23750 </p>
23751 !! end
23752
23753 !! test
23754 T33490 Turkish: ucfirst 'ix'
23755 !! options
23756 language=tr
23757 !! wikitext
23758 {{ucfirst:ix}}
23759 !! html
23760 <p>İx
23761 </p>
23762 !! end
23763
23764 !! test
23765 T33490 Turkish: lcfirst 'BLAH'
23766 !! options
23767 language=tr
23768 !! wikitext
23769 {{lcfirst:BLAH}}
23770 !! html
23771 <p>bLAH
23772 </p>
23773 !! end
23774
23775 !! test
23776 T33490 Turkish: ucfırst (with a dotless i)
23777 !! options
23778 language=tr
23779 !! wikitext
23780 {{ucfırst:blah}}
23781 !! html
23782 <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>
23783 </p>
23784 !! end
23785
23786 !! test
23787 T33490 ucfırst (with a dotless i) with English language
23788 !! options
23789 language=en
23790 !! wikitext
23791 {{ucfırst:blah}}
23792 !! html
23793 <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>
23794 </p>
23795 !! end
23796
23797 # Note that Parsoid doesn't emit an explicit TOC.
23798 # Note also that the html2wt direction tends to emit an extra newline
23799 # between the __TOC__ magicword and the first heading unless *both*
23800 # the <meta> and the <h2> have a data-parsoid attribute set (even if
23801 # it's "{}").
23802
23803 !! test
23804 T28375: TOC with italics
23805 !! options
23806 title=[[Main Page]]
23807 !! wikitext
23808 __TOC__
23809 == ''Lost'' episodes ==
23810 !! html/php
23811 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
23812 <ul>
23813 <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>
23814 </ul>
23815 </div>
23816
23817 <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>
23818
23819 !! html/parsoid
23820 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
23821 <h2 data-parsoid='{}'> <i>Lost</i> episodes </h2>
23822 !! end
23823
23824 !! test
23825 T28375: TOC with bold
23826 !! options
23827 title=[[Main Page]]
23828 !! wikitext
23829 __TOC__
23830 == '''should be bold''' then normal text ==
23831 !! html/php
23832 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
23833 <ul>
23834 <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>
23835 </ul>
23836 </div>
23837
23838 <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>
23839
23840 !! html/parsoid
23841 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
23842 <h2 data-parsoid='{}'> <b>should be bold</b> then normal text </h2>
23843 !! end
23844
23845 !! test
23846 T35845: Headings become cursive in TOC when they contain an image
23847 !! options
23848 title=[[Main Page]]
23849 !! wikitext
23850 __TOC__
23851 == Image [[Image:foobar.jpg]] ==
23852 !! html/php
23853 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
23854 <ul>
23855 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
23856 </ul>
23857 </div>
23858
23859 <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>
23860
23861 !! html/parsoid
23862 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
23863 <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>
23864 !! end
23865
23866 !! test
23867 T35845 (2): Headings become bold in TOC when they contain a blockquote
23868 !! options
23869 title=[[Main Page]]
23870 !! wikitext
23871 __TOC__
23872 == <blockquote>Quote</blockquote> ==
23873 !! html/php
23874 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
23875 <ul>
23876 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
23877 </ul>
23878 </div>
23879
23880 <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>
23881
23882 !! html/php+tidy
23883 <p></p>
23884 <div id="toc" class="toc">
23885 <div class="toctitle">
23886 <h2>Contents</h2>
23887 </div>
23888 <ul>
23889 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
23890 </ul>
23891 </div>
23892 <p></p>
23893 <h2><span class="mw-headline" id="Quote"></span></h2>
23894 <blockquote>
23895 <p><span class="mw-headline" id="Quote">Quote</span></p>
23896 </blockquote>
23897 <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>
23898 !! html/parsoid
23899 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
23900 <h2 data-parsoid='{}'> <blockquote>Quote</blockquote> </h2>
23901 !! end
23902
23903 !! test
23904 Unclosed tags in TOC
23905 !! options
23906 title=[[Main Page]]
23907 !! wikitext
23908 __TOC__
23909 == Proof: 2 < 3 ==
23910 <small>Hanc marginis exiguitas non caperet.</small>
23911 QED
23912 !! html/php
23913 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
23914 <ul>
23915 <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>
23916 </ul>
23917 </div>
23918
23919 <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>
23920 <p><small>Hanc marginis exiguitas non caperet.</small>
23921 QED
23922 </p>
23923 !! html/parsoid
23924 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
23925 <h2 data-parsoid='{}'> Proof: 2 &lt; 3 </h2>
23926 <p><small>Hanc marginis exiguitas non caperet.</small>
23927 QED</p>
23928 !! end
23929
23930 !! test
23931 Multiple tags in TOC
23932 !! wikitext
23933 __TOC__
23934 == <i>Foo</i> <b>Bar</b> ==
23935
23936 == <i>Foo</i> <blockquote>Bar</blockquote> ==
23937 !! html/php
23938 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
23939 <ul>
23940 <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>
23941 <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>
23942 </ul>
23943 </div>
23944
23945 <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>
23946 <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>
23947
23948 !! html/php+tidy
23949 <p></p>
23950 <div id="toc" class="toc">
23951 <div class="toctitle">
23952 <h2>Contents</h2>
23953 </div>
23954 <ul>
23955 <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>
23956 <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>
23957 </ul>
23958 </div>
23959 <p></p>
23960 <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>
23961 <h2><span class="mw-headline" id="Foo_Bar_2"><i>Foo</i></span></h2>
23962 <blockquote>
23963 <p><span class="mw-headline" id="Foo_Bar_2">Bar</span></p>
23964 </blockquote>
23965 <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>
23966 !! html/parsoid
23967 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
23968 <h2 data-parsoid='{}'> <i data-parsoid='{"stx":"html"}'>Foo</i> <b data-parsoid='{"stx":"html"}'>Bar</b> </h2>
23969 <h2> <i data-parsoid='{"stx":"html"}'>Foo</i> <blockquote>Bar</blockquote> </h2>
23970 !! end
23971
23972 # Don't expect Parsoid to roundtrip this until the php parser comes closer to
23973 # html5 tag parsing.
23974 !! test
23975 Tags with parameters in TOC
23976 !! options
23977 parsoid=wt2html
23978 !! wikitext
23979 __TOC__
23980 == <sup class="in-h2">Hello</sup> ==
23981
23982 == <sup class="a > b">Evilbye</sup> ==
23983 !! html/php
23984 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
23985 <ul>
23986 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
23987 <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>
23988 </ul>
23989 </div>
23990
23991 <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>
23992 <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>
23993
23994 !! html/parsoid
23995 <meta property="mw:PageProp/toc" />
23996 <h2> <sup class="in-h2" data-parsoid='{"stx":"html"}'>Hello</sup> </h2>
23997
23998 <h2> <sup class="a " data-parsoid='{"stx":"html"}'> b">Evilbye</sup> </h2>
23999 !! end
24000
24001 !! test
24002 span tags with directionality in TOC
24003 !! wikitext
24004 __TOC__
24005 == <span dir="ltr">C++</span> ==
24006
24007 == <span dir="rtl">זבנג!</span> ==
24008
24009 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
24010
24011 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
24012
24013 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
24014 !! html/php
24015 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
24016 <ul>
24017 <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>
24018 <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>
24019 <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>
24020 <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>
24021 <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>
24022 </ul>
24023 </div>
24024
24025 <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>
24026 <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>
24027 <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>
24028 <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>
24029 <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>
24030
24031 !! html/parsoid
24032 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24033 <h2 data-parsoid='{}'> <span dir="ltr">C++</span> </h2>
24034 <h2> <span dir="rtl">זבנג!</span> </h2>
24035 <h2> <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> </h2>
24036 <h2> <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> </h2>
24037 <h2> <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> </h2>
24038 !! end
24039
24040 !! test
24041 T74884: bdi element in ToC
24042 !! wikitext
24043 __TOC__
24044 == <bdi>test</bdi> ==
24045 !! html/php
24046 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
24047 <ul>
24048 <li class="toclevel-1 tocsection-1"><a href="#test"><span class="tocnumber">1</span> <span class="toctext"><bdi>test</bdi></span></a></li>
24049 </ul>
24050 </div>
24051
24052 <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>
24053
24054 !! html/parsoid
24055 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24056 <h2 data-parsoid='{}'> <bdi>test</bdi> </h2>
24057 !! end
24058
24059 !! test
24060 T35715: s/strike element in ToC
24061 !! wikitext
24062 __TOC__
24063 == <s>test</s> test <strike>test</strike> ==
24064 !! html/php
24065 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
24066 <ul>
24067 <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>
24068 </ul>
24069 </div>
24070
24071 <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>
24072
24073 !! html/parsoid
24074 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24075 <h2 data-parsoid='{}'> <s>test</s> test <strike>test</strike> </h2>
24076 !! end
24077
24078 # Note that the html output does not have the <p></p>, but the
24079 # html+tidy output *does*. This is because the empty <p></p> is
24080 # removed by the sanitizer, but only when tidy is *not* enabled (!).
24081 !! test
24082 Empty <p> tag in TOC, removed by Sanitizer (T92892)
24083 !! wikitext
24084 __TOC__
24085 == x ==
24086 !! html/php
24087 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
24088 <ul>
24089 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
24090 </ul>
24091 </div>
24092
24093 <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>
24094
24095 !! html/php+tidy
24096 <p></p>
24097 <div id="toc" class="toc">
24098 <div class="toctitle">
24099 <h2>Contents</h2>
24100 </div>
24101 <ul>
24102 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
24103 </ul>
24104 </div>
24105 <p></p>
24106 <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>
24107 !! html/parsoid
24108 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24109 <h2 data-parsoid='{}'> x </h2>
24110 !! end
24111
24112 !! article
24113 MediaWiki:T34057
24114 !! text
24115 == {{int:headline_sample}} ==
24116 !! endarticle
24117
24118 !! test
24119 T34057: Title needed when expanding <h> nodes.
24120 !! options
24121 title=[[Main Page]]
24122 !! wikitext
24123 {{int:T34057}}
24124 !! html
24125 <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>
24126
24127 !! end
24128
24129 !! test
24130 Strip marker in urlencode
24131 !! wikitext
24132 {{urlencode:x<nowiki/>y}}
24133 {{urlencode:x<nowiki/>y|wiki}}
24134 {{urlencode:x<nowiki/>y|path}}
24135 {{urlencode:x<pre id="one">two</pre>y}}
24136 !! html/php
24137 <p>xy
24138 xy
24139 xy
24140 xy
24141 </p>
24142 !! end
24143
24144 !! test
24145 Strip marker in lc
24146 !! wikitext
24147 {{lc:x<nowiki/>y}}
24148 !! html
24149 <p>xy
24150 </p>
24151 !! end
24152
24153 !! test
24154 Strip marker in uc
24155 !! wikitext
24156 {{uc:x<nowiki/>y}}
24157 !! html
24158 <p>XY
24159 </p>
24160 !! end
24161
24162 !! test
24163 Strip marker in formatNum
24164 !! wikitext
24165 {{formatnum:1<nowiki/>2}}
24166 {{formatnum:1<nowiki/>2|R}}
24167 !! html
24168 <p>12
24169 12
24170 </p>
24171 !! end
24172
24173 !! test
24174 Check noCommafy in formatNum
24175 !! options
24176 language=be-tarask
24177 !! wikitext
24178 {{formatnum:123456.78}}
24179 {{formatnum:123456.78|NOSEP}}
24180 !! html
24181 <p>123 456,78
24182 123456.78
24183 </p>
24184 !! end
24185
24186 !! test
24187 Wrong option for formatNum (T58199)
24188 !! wikitext
24189 {{formatnum:1,234.56|Random}}
24190 {{formatnum:1,234.56|EVERYTHING}}
24191 {{formatnum:1234.56|any argument that has the string 'NOSEP'}}
24192 !! html
24193 <p>1,234.56
24194 1,234.56
24195 1,234.56
24196 </p>
24197 !! end
24198
24199 !! test
24200 Strip marker in grammar
24201 !! options
24202 language=fi
24203 !! wikitext
24204 {{grammar:elative|foo<nowiki/>bar}}
24205 !! html
24206 <p>foobarista
24207 </p>
24208 !! end
24209
24210 !! test
24211 Strip marker in padleft
24212 !! wikitext
24213 {{padleft:|2|x<nowiki/>y}}
24214 !! html
24215 <p>xy
24216 </p>
24217 !! end
24218
24219 !! test
24220 Strip marker in padright
24221 !! wikitext
24222 {{padright:|2|x<nowiki/>y}}
24223 !! html
24224 <p>xy
24225 </p>
24226 !! end
24227
24228 !! test
24229 Strip marker in anchorencode
24230 !! wikitext
24231 {{anchorencode:x<nowiki/>y}}
24232 !! html
24233 <p>xy
24234 </p>
24235 !! end
24236
24237 !! test
24238 nowiki inside link inside heading (T20295)
24239 !! wikitext
24240 ==[[foo|x<nowiki>y</nowiki>z]]==
24241 !! html
24242 <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>
24243
24244 !! end
24245
24246 !! test
24247 new support for bdi element (T33817)
24248 !! wikitext
24249 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
24250 !! html
24251 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
24252
24253 !!end
24254
24255 !! test
24256 Ignore pipe between table row attributes
24257 !! wikitext
24258 {|
24259 | quux
24260 |- id=foo | style='color: red'
24261 | bar
24262 |}
24263 !! html
24264 <table>
24265 <tr>
24266 <td> quux
24267 </td></tr>
24268 <tr id="foo" style="color: red">
24269 <td> bar
24270 </td></tr></table>
24271
24272 !! end
24273
24274 !!test
24275 Language parser function
24276 !! wikitext
24277 {{#language:ar}}
24278 !! html
24279 <p>العربية
24280 </p>
24281 !! end
24282
24283 !!test
24284 Padleft and padright as substr
24285 !! wikitext
24286 {{padleft:|3|abcde}}
24287 {{padright:|3|abcde}}
24288 !! html
24289 <p>abc
24290 abc
24291 </p>
24292 !! end
24293
24294 !!test
24295 Special parser function
24296 !! wikitext
24297 {{#special:RandomPage}}
24298 {{#special:BaDtItLe}}
24299 {{#special:Foobar}}
24300 !! html
24301 <p>Special:Random
24302 Special:Badtitle
24303 Special:Foobar
24304 </p>
24305 !! end
24306
24307 !!test
24308 T36939 - Case insensitive link parsing ([HttP://])
24309 !! wikitext
24310 [HttP://MediaWiki.Org/]
24311 !! html/php
24312 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
24313 </p>
24314 !! html/parsoid
24315 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/"></a></p>
24316 !! end
24317
24318 !!test
24319 T36939 - Case insensitive link parsing ([HttP:// title])
24320 !! wikitext
24321 [HttP://MediaWiki.Org/ MediaWiki]
24322 !! html
24323 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
24324 </p>
24325 !! end
24326
24327 !!test
24328 T36939 - Case insensitive link parsing (HttP://)
24329 !! wikitext
24330 HttP://MediaWiki.Org/
24331 !! html/php
24332 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
24333 </p>
24334 !! html/parsoid
24335 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a></p>
24336 !! end
24337
24338 !!test
24339 Disable TOC
24340 !! options
24341 notoc
24342 !! wikitext
24343 Lead
24344 == Section 1 ==
24345 == Section 2 ==
24346 == Section 3 ==
24347 == Section 4 ==
24348 == Section 5 ==
24349 !! html
24350 <p>Lead
24351 </p>
24352
24353 <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>
24354 <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>
24355 <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>
24356 <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>
24357 <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>
24358
24359 !! end
24360
24361
24362 ###
24363 ### Parsoid-specific tests
24364 ### Parsoid-PHP parser incompatibilities
24365 ###
24366 !!test
24367 1. SOL-sensitive wikitext tokens as template-args
24368 !!options
24369 parsoid=wt2html,wt2wt
24370 !! wikitext
24371 {{echo|*a}}
24372 {{echo|#a}}
24373 {{echo|:a}}
24374 !! html
24375 <span about="#mwt1" typeof="mw:Transclusion">
24376 </span><ul about="#mwt1"><li>a</li>
24377 </ul>
24378 <span about="#mwt2" typeof="mw:Transclusion">
24379 </span><ol about="#mwt2"><li>a</li>
24380 </ol>
24381 <span about="#mwt3" typeof="mw:Transclusion">
24382 </span><dl about="#mwt3"><dd>a</dd>
24383 </dl>
24384 !!end
24385
24386 #### -----------------------------------------------------------------
24387 #### Parsoid-specific functionality tests
24388 #### -----------------------------------------------------------------
24389
24390 # T65642/T68749: Formatting elt fixup around images is cleaned up.
24391 # We know wt2wt will fail, but we expect selser to pass.
24392 # Due to the nature of our testing, wt2wt and selser tests will enter the
24393 # blacklist and we'll catch selser regressions based on changes to the
24394 # blacklist entries for selser tests.
24395 !! test
24396 1. Bad treebuilder fixup of formatting elt is cleaned up
24397 !! options
24398 parsoid=wt2html,wt2wt
24399 !! wikitext
24400 {|
24401 |
24402 <small>
24403 [[Image:Foobar.jpg|right|Test]]
24404 </small>
24405 |}
24406 !! html/parsoid
24407 <table>
24408 <tbody><tr><td>
24409 <small>
24410 <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>
24411 </small>
24412 </td></tr>
24413 </tbody></table>
24414 !! end
24415
24416 !! test
24417 2. Bad treebuilder fixup of formatting elt is cleaned up
24418 !! options
24419 parsoid=wt2html,wt2wt
24420 !! wikitext
24421 '''foo[[File:Foobar.jpg|thumb|caption]]bar'''
24422
24423 <small>[[Image:Foobar.jpg|right|300px]]</small>
24424 !! html/parsoid
24425
24426 <p><b>foo</b></p>
24427 <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>
24428 <p><b>bar</b></p>
24429 <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>
24430 !! end
24431
24432 !! test
24433 3. Bad treebuilder fixup of formatting elt is cleaned up
24434 !! options
24435 parsoid=wt2html,wt2wt
24436 !! wikitext
24437 <small>'''foo[[File:Foobar.jpg|thumb|caption]]bar'''</small>
24438 !! html/parsoid
24439 <p><small><b>foo</b></small></p>
24440 <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>
24441 <p><small><b>bar</b></small></p>
24442 !! end
24443
24444 !! test
24445 4. Bad treebuilder fixup of formatting elt is cleaned up: formatting tags around captionless images are ignored
24446 !! options
24447 parsoid=wt2html,wt2wt
24448 !! wikitext
24449 '''<small>[[Image:Foobar.jpg|right|300px]]</small>'''
24450 !! html/parsoid
24451 <p><b><small></small></b></p>
24452 <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>
24453 <p></p>
24454 !! end
24455
24456 #### ----------------------------------------------------------------
24457 #### Parsoid-only testing of Parsoid's impl of LST
24458 #### Not implemented yet, see
24459 #### https://www.mediawiki.org/wiki/Parsoid/HTML_based_LST
24460 #### ----------------------------------------------------------------
24461
24462 ## We still need to support serializing the older format while content is stored.
24463 !! test
24464 LST Sections: Backwards compatibility
24465 !! options
24466 parsoid={
24467 "suppressErrors": true,
24468 "modes": ["html2wt"]
24469 }
24470 !! wikitext
24471 <section begin="2011-05-16" />
24472 <section end="2014-04-10 (MW 1.23wmf22)" />
24473 !! html/parsoid
24474 <p><meta typeof="mw:Extension/LabeledSectionTransclusion/begin" content="2011-05-16"/>
24475 <meta typeof="mw:Extension/LabeledSectionTransclusion/end" content="2014-04-10 (MW 1.23wmf22)"/></p>
24476 !! end
24477
24478 !! test
24479 LST Sections: Newfangled approach
24480 !! wikitext
24481 <section begin="2011-05-16" />
24482 <section end="2014-04-10 (MW 1.23wmf22)" />
24483 !! html/parsoid
24484 <p><span typeof="mw:Extension/section" about="#mwt4" data-mw='{"name":"section","attrs":{"begin":"2011-05-16"},"body":null}'>
24485 </span>
24486 <span typeof="mw:Extension/section" about="#mwt6" data-mw='{"name":"section","attrs":{"end":"2014-04-10 (MW 1.23wmf22)"},"body":null}'>
24487 </span></p>
24488 !! end
24489
24490 #--------- Test stripping of empty nodes in template content ----------
24491
24492 !! test
24493 Empty LI and TR nodes should be stripped from template content
24494 !! wikitext
24495 {{EmptyLITest}}
24496 {{EmptyTRTest}}
24497 !! html/parsoid
24498 <ul about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyLITest","href":"./Template:EmptyLITest"},"params":{},"i":0}}]}'>
24499 <li>a</li>
24500 <li>b</li>
24501 </ul>
24502 <table about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRTest","href":"./Template:EmptyTRTest"},"params":{},"i":0}}]}'>
24503 <tbody>
24504 <tr>
24505 <td>foo</td>
24506 </tr>
24507 <tr>
24508 <td>bar</td>
24509 </tr>
24510 </tbody>
24511 </table>
24512 !! end
24513
24514 !! test
24515 Empty LI and TR nodes should not be stripped from top-level content
24516 !! wikitext
24517 * a
24518 *
24519 * b
24520 {|
24521 |-
24522 |-
24523 |foo
24524 |}
24525 !! html/parsoid
24526 <ul>
24527 <li> a</li>
24528 <li class='mw-empty-elt'></li>
24529 <li> b</li>
24530 </ul>
24531 <table>
24532 <tbody>
24533 <tr class='mw-empty-elt'></tr>
24534 <tr>
24535 <td>foo</td>
24536 </tr>
24537 </tbody>
24538 </table>
24539 !! end
24540
24541 !! test
24542 Empty TR nodes should not be stripped if they have any attributes set
24543 !! wikitext
24544 {{EmptyTRWithHTMLAttrTest}}
24545 !! html/parsoid
24546 <table about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRWithHTMLAttrTest","href":"./Template:EmptyTRWithHTMLAttrTest"},"params":{},"i":0}}]}'>
24547 <tr align='center'></tr>
24548 <tr><td>foo</td></tr>
24549 <tr align='center'></tr>
24550 <tr><td>bar</td></tr>
24551 </table>
24552 !! end
24553
24554 #### ----------------------------------------------------------------
24555 #### The following section of tests are primarily to test
24556 #### wikitext escaping capabilities of Parsoid. Given that
24557 #### escaping can be done any number of ways, the wikitext (input)
24558 #### is always adjusted to reflect how Parsoid adds nowiki
24559 #### escape tags.
24560 ####
24561 #### We are marking several tests as parsoid-only since the
24562 #### HTML in the result section is different from what the
24563 #### PHP parser generates for it.
24564 #### ----------------------------------------------------------------
24565
24566
24567 #### --------------- Headings ---------------
24568 #### 0. Unnested
24569 #### 1. Nested inside html <h1>=foo=</h1>
24570 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
24571 #### 3. Nested inside html with wikitext split by html tags
24572 #### 4. No escape needed
24573 #### 5. Empty headings <h1></h1>
24574 #### 6. Heading chars in SOL context
24575 #### ----------------------------------------
24576 !! test
24577 Headings: 0. Unnested
24578 !! options
24579 parsoid=html2wt
24580 !! html/parsoid
24581 <p>=foo=</p>
24582
24583 <p> =foo=
24584 <!--cmt-->
24585 =foo=</p>
24586
24587 <p>=foo<i>a</i>=</p>
24588 !! wikitext
24589 <nowiki>=foo=</nowiki>
24590
24591 <nowiki> </nowiki>=foo=
24592 <!--cmt-->
24593 <nowiki>=foo=</nowiki>
24594
24595 =foo''a''<nowiki>=</nowiki>
24596 !!end
24597
24598 # New headings and existing headings are handled differently
24599 !! test
24600 Headings: 1. Nested inside html
24601 !! options
24602 parsoid=html2wt
24603 !! html/parsoid
24604 <h1>=foo=</h1>
24605 <h2>=foo=</h2>
24606 <h3>=foo=</h3>
24607
24608 <h1 data-parsoid=''>=foo=</h1>
24609 <h2 data-parsoid=''>=foo=</h2>
24610 <h3 data-parsoid=''>=foo=</h3>
24611 <h4 data-parsoid=''>=foo=</h4>
24612 <h5 data-parsoid=''>=foo=</h5>
24613 <h6 data-parsoid=''>=foo=</h6>
24614 !! wikitext
24615 = =foo= =
24616
24617 == =foo= ==
24618
24619 === =foo= ===
24620
24621 =<nowiki>=foo=</nowiki>=
24622 ==<nowiki>=foo=</nowiki>==
24623 ===<nowiki>=foo=</nowiki>===
24624 ====<nowiki>=foo=</nowiki>====
24625 =====<nowiki>=foo=</nowiki>=====
24626 ======<nowiki>=foo=</nowiki>======
24627
24628 !!end
24629
24630 !! test
24631 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
24632 !! options
24633 parsoid=html2wt
24634 !! html/parsoid
24635 <h1>foo</h1>*bar
24636 <h1>foo</h1>=bar
24637 <h1>foo</h1>=bar=
24638 !! wikitext
24639 = foo =
24640 <nowiki>*</nowiki>bar
24641
24642 = foo =
24643 =bar
24644
24645 = foo =
24646 <nowiki>=bar=</nowiki>
24647 !!end
24648
24649 !! test
24650 Headings: 3. Nested inside html with wikitext split by html tags
24651 !! options
24652 parsoid=html2wt
24653 !! html/parsoid
24654 <h1>=<b>bold</b>foo=</h1>
24655 !! wikitext
24656 = ='''bold'''foo= =
24657 !!end
24658
24659 !! test
24660 Headings: 4a. No escaping needed (testing just h1 and h2)
24661 !! options
24662 parsoid=html2wt
24663 !! html/parsoid
24664 <h1>=foo</h1>
24665 <h1>foo=</h1>
24666 <h1> =foo= </h1>
24667 <h1>=foo= bar</h1>
24668 <h2>=foo</h2>
24669 <h2>foo=</h2>
24670 <h1>=</h1>
24671 <h1><i>=</i>foo=</h1>
24672 !! wikitext
24673 = =foo =
24674
24675 = foo= =
24676
24677 = =foo= =
24678
24679 = =foo= bar =
24680
24681 == =foo ==
24682
24683 == foo= ==
24684
24685 = = =
24686
24687 = ''=''foo= =
24688 !!end
24689
24690 !! test
24691 Headings: 4b. No escaping needed (inside p-tags)
24692 !! options
24693 parsoid=html2wt
24694 !! html/parsoid
24695 <p>===
24696 =foo= x
24697 =foo= <s></s>
24698 </p>
24699 !! wikitext
24700 ===
24701 =foo= x
24702 =foo= <s></s>
24703 !!end
24704
24705 !! test
24706 Headings: 5. Empty headings
24707 !! options
24708 parsoid=html2wt
24709 !! html/parsoid
24710 <h1 data-parsoid='{}'></h1>
24711
24712 <h2 data-parsoid='{}'></h2>
24713
24714 <h3 data-parsoid='{}'></h3>
24715
24716 <h4 data-parsoid='{}'></h4>
24717
24718 <h5 data-parsoid='{}'></h5>
24719
24720 <h6 data-parsoid='{}'></h6>
24721 !! wikitext
24722 =<nowiki/>=
24723
24724 ==<nowiki/>==
24725
24726 ===<nowiki/>===
24727
24728 ====<nowiki/>====
24729
24730 =====<nowiki/>=====
24731
24732 ======<nowiki/>======
24733 !!end
24734
24735 !! test
24736 Headings: 6a. Heading chars in SOL context (with trailing spaces)
24737 !! options
24738 parsoid=html2wt
24739 !! html/parsoid
24740 <p>=a=</p>
24741
24742 <p>=a=</p>
24743
24744 <p>=a=</p>
24745 !! wikitext
24746 <nowiki>=a=</nowiki>
24747
24748 <nowiki>=a=</nowiki>
24749
24750 <nowiki>=a=</nowiki>
24751 !!end
24752
24753 !! test
24754 Headings: 6b. Heading chars in SOL context (with trailing newlines)
24755 !! options
24756 parsoid=html2wt
24757 !! html/parsoid
24758 <p>=a=
24759 b</p>
24760
24761 <p>=a=
24762 b</p>
24763
24764 <p>=a=
24765 b</p>
24766 !! wikitext
24767 <nowiki>=a=</nowiki>
24768 b
24769
24770 <nowiki>=a=</nowiki>
24771 b
24772
24773 <nowiki>=a=</nowiki>
24774 b
24775 !!end
24776
24777 !! test
24778 Headings: 6c. Heading chars in SOL context (leading newline break)
24779 !! options
24780 parsoid=html2wt
24781 !! html/parsoid
24782 <p>a
24783 =b=</p>
24784 !! wikitext
24785 a
24786 <nowiki>=b=</nowiki>
24787 !!end
24788
24789 !! test
24790 Headings: 6d. Heading chars in SOL context (with interspersed comments)
24791 !! options
24792 parsoid=html2wt
24793 !! html/parsoid
24794 <!--c0--><p>=a=</p>
24795
24796 <!--c1--><p>=a=</p> <!--c2--> <!--c3-->
24797 !! wikitext
24798 <!--c0--><nowiki>=a=</nowiki>
24799
24800 <!--c1--><nowiki>=a=</nowiki> <!--c2--> <!--c3-->
24801 !!end
24802
24803 !! test
24804 Headings: 6d. Heading chars in SOL context (No escaping needed)
24805 !! options
24806 parsoid=html2wt
24807 !! html/parsoid
24808 =a=<div>b</div>
24809 !! wikitext
24810 =a=<div>b</div>
24811 !!end
24812
24813 !! test
24814 Headings: 7. Insert a newline between new content and headings
24815 !! options
24816 parsoid=html2wt
24817 !! html/parsoid
24818 <h2>NEW</h2>
24819 <p>new</p>
24820 <h2 data-parsoid='{}'>A</h2>
24821 <p data-parsoid='{}'>a</p>
24822 !! wikitext
24823 == NEW ==
24824 new
24825
24826 ==A==
24827 a
24828
24829 !! end
24830
24831 #### --------------- Lists ---------------
24832 #### 0. Outside nests (*foo, etc.)
24833 #### 1. Nested inside html <ul><li>*foo</li></ul>
24834 #### 2. Inside definition lists
24835 #### 3. Only bullets at start should be escaped
24836 #### 4. No escapes needed
24837 #### 5. No unnecessary escapes
24838 #### 6. Escape bullets in SOL position
24839 #### 7. Escape bullets in a multi-line context
24840 #### ----------------------------------------
24841
24842 !! test
24843 Lists: 0. Outside nests
24844 !! options
24845 parsoid=html2wt
24846 !! html/parsoid
24847 <p>*foo</p>
24848
24849 <p>#foo</p>
24850
24851 <p>;Foo:bar</p>
24852 !! wikitext
24853 <nowiki>*</nowiki>foo
24854
24855 <nowiki>#</nowiki>foo
24856
24857 <nowiki>;</nowiki>Foo<nowiki>:</nowiki>bar
24858 !!end
24859
24860 ## Making these next 3 tests Parsoid-only since they are html2wt tests
24861 ## to test wikitext escaping, and insignificant whitespace diffs
24862 ## cause PHP parser tests to barf
24863 !! test
24864 Lists: 1. Nested inside html (No unnecessary escapes)
24865 !! options
24866 parsoid=html2wt
24867 !! html/parsoid
24868 <ul>
24869 <li>*foo</li>
24870 <li>#foo</li>
24871 <li>:foo</li>
24872 <li>;foo</li>
24873 <li data-parsoid='{}'>*foo</li>
24874 <li data-parsoid='{}'>#foo</li>
24875 <li data-parsoid='{}'>:foo</li>
24876 <li data-parsoid='{}'>;foo</li>
24877 </ul>
24878
24879 <ol>
24880 <li>*foo</li>
24881 <li>#foo</li>
24882 <li>:foo</li>
24883 <li>;foo</li>
24884 <li data-parsoid='{}'>*foo</li>
24885 <li data-parsoid='{}'>#foo</li>
24886 <li data-parsoid='{}'>:foo</li>
24887 <li data-parsoid='{}'>;foo</li>
24888 </ol>
24889 !! wikitext
24890 * *foo
24891 * #foo
24892 * :foo
24893 * ;foo
24894 *<nowiki>*foo</nowiki>
24895 *<nowiki>#foo</nowiki>
24896 *<nowiki>:foo</nowiki>
24897 *<nowiki>;foo</nowiki>
24898
24899 # *foo
24900 # #foo
24901 # :foo
24902 # ;foo
24903 #<nowiki>*foo</nowiki>
24904 #<nowiki>#foo</nowiki>
24905 #<nowiki>:foo</nowiki>
24906 #<nowiki>;foo</nowiki>
24907 !!end
24908
24909 !! test
24910 Lists: 2. Inside definition lists
24911 !! options
24912 parsoid=html2wt
24913 !! html/parsoid
24914 <dl><dt>;foo</dt></dl>
24915 <dl><dt>:foo</dt></dl>
24916 <dl><dt>:foo</dt>
24917 <dd>bar</dd></dl>
24918 <dl><dd>:foo</dd></dl>
24919 !! wikitext
24920 ; ;foo
24921
24922 ; <nowiki>:foo</nowiki>
24923
24924 ; <nowiki>:foo</nowiki>
24925 : bar
24926
24927 : :foo
24928 !!end
24929
24930 !! test
24931 Lists: 3. Only bullets at start of text in wikitext-generated HTML should be escaped
24932 !! options
24933 parsoid=html2wt
24934 !! html/parsoid
24935 <ul>
24936 <li>*foo*bar</li>
24937 <li data-parsoid='{}'>*foo<i>it</i>*bar</li>
24938 </ul>
24939 !! wikitext
24940 * *foo*bar
24941 *<nowiki>*foo</nowiki>''it''*bar
24942 !!end
24943
24944 !! test
24945 Lists: 4. No escapes needed
24946 !! options
24947 parsoid=html2wt
24948 !! html/parsoid
24949 <ul>
24950 <li>foo*bar
24951 </li>
24952 </ul>
24953 <ul>
24954 <li><i>foo</i>*bar
24955 </li>
24956 </ul>
24957 <ul>
24958 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>: bar
24959 </li>
24960 </ul>
24961 <ul>
24962 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>*bar
24963 </li>
24964 </ul>
24965 !! wikitext
24966 *foo*bar
24967
24968 *''foo''*bar
24969
24970 *[[Foo]]: bar
24971
24972 *[[Foo]]*bar
24973 !!end
24974
24975 !! test
24976 Lists: 5. No unnecessary escapes
24977 !! options
24978 parsoid=html2wt
24979 !! html/parsoid
24980 <ul><li> bar <span>[[foo]]</span></li></ul>
24981 <ul><li> =bar <span>[[foo]]</span></li></ul>
24982 <ul><li> [[bar <span>[[foo]]</span></li></ul>
24983 <ul><li> ]]bar <span>[[foo]]</span></li></ul>
24984 <ul><li> =bar <span>foo]]</span>=</li></ul>
24985 <ul><li> <s></s>: a</li></ul>
24986 <ul><li> <i>* foo</i></li></ul>
24987
24988 !! wikitext
24989 * bar <span><nowiki>[[foo]]</nowiki></span>
24990
24991 * =bar <span><nowiki>[[foo]]</nowiki></span>
24992
24993 * [[bar <span><nowiki>[[foo]]</nowiki></span>
24994
24995 * ]]bar <span><nowiki>[[foo]]</nowiki></span>
24996
24997 * =bar <span>foo]]</span>=
24998
24999 * <s></s>: a
25000
25001 * ''* foo''
25002 !!end
25003
25004 !! test
25005 Lists: 6. Escape bullets in SOL position
25006 !! options
25007 parsoid=html2wt
25008 !! html/parsoid
25009 <p><!--cmt-->*foo</p>
25010 !! wikitext
25011 <!--cmt--><nowiki>*</nowiki>foo
25012 !!end
25013
25014 !! test
25015 Lists: 7. Escape bullets in a multi-line context
25016 !! options
25017 parsoid=html2wt
25018 !! html/parsoid
25019 <p>a
25020 *b
25021 </p>
25022 !! wikitext
25023 a
25024 <nowiki>*</nowiki>b
25025 !!end
25026
25027 !! test
25028 Lists: 8. Escape colons only if not present in tags
25029 !! options
25030 parsoid=html2wt
25031 !! html/parsoid
25032 <dl><dt>a:b<i>c:d</i></dt></dl>
25033 !! wikitext
25034 ; <nowiki>a:b</nowiki>''c:d''
25035 !! end
25036
25037 #### --------------- HRs ---------------
25038 #### 1. Single line
25039 #### -----------------------------------
25040
25041 !! test
25042 HRs: 1. Single line
25043 !! options
25044 parsoid=html2wt
25045 !! html/parsoid
25046 <hr />----
25047 <hr />=foo=
25048 <hr />*foo
25049 !! wikitext
25050 ----<nowiki>----</nowiki>
25051 ----=foo=
25052 ----*foo
25053 !! end
25054
25055 #### --------------- Tables ---------------
25056 #### 1a. Simple example
25057 #### 1b. No escaping needed (!foo)
25058 #### 1c. No escaping needed (|foo)
25059 #### 1d. No escaping needed (|}foo)
25060 ####
25061 #### 2a. Nested in td (<td>foo|bar</td>)
25062 #### 2b. Nested in td (<td>foo||bar</td>)
25063 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
25064 ####
25065 #### 3a. Nested in th (<th>foo!bar</th>)
25066 #### 3b. Nested in th (<th>foo!!bar</th>)
25067 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
25068 ####
25069 #### 4a. Escape -
25070 #### 4b. Escape +
25071 #### 4c. No escaping needed
25072 #### --------------------------------------
25073
25074 !! test
25075 Tables: 1a. Simple example
25076 !! options
25077 parsoid=html2wt
25078 !! html/parsoid
25079 <p>{|
25080 |}
25081 </p>
25082 !! wikitext
25083 <nowiki>{|</nowiki>
25084 |}
25085 !! end
25086
25087 !! test
25088 Tables: 1b. No escaping needed
25089 !! options
25090 parsoid=html2wt
25091 !! html/parsoid
25092 <p>!foo
25093 </p>
25094 !! wikitext
25095 !foo
25096 !! end
25097
25098 !! test
25099 Tables: 1c. No escaping needed
25100 !! options
25101 parsoid=html2wt
25102 !! html/parsoid
25103 <p>|foo
25104 </p>
25105 !! wikitext
25106 |foo
25107 !! end
25108
25109 !! test
25110 Tables: 1d. No escaping needed
25111 !! options
25112 parsoid=html2wt
25113 !! html/parsoid
25114 <p>|}foo
25115 </p>
25116 !! wikitext
25117 |}foo
25118 !! end
25119
25120 !! test
25121 Tables: 2a. Nested in td
25122 !! options
25123 parsoid=html2wt
25124 !! html/parsoid
25125 <table><tbody><tr>
25126 <td>foo|bar</td></tr>
25127 <tr><td>x<div>a|b</div></td>
25128 </tbody></table>
25129 !! wikitext
25130 {|
25131 |<nowiki>foo|bar</nowiki>
25132 |-
25133 |x<div><nowiki>a|b</nowiki></div>
25134 |}
25135 !! html/php+tidy
25136 <table>
25137 <tr>
25138 <td>foo|bar</td>
25139 </tr>
25140 <tr>
25141 <td>x
25142 <div>a|b</div>
25143 </td>
25144 </tr>
25145 </table>
25146 !! end
25147
25148 !! test
25149 Tables: 2b. Nested in td
25150 !! options
25151 parsoid=html2wt
25152 !! html/parsoid
25153 <table><tbody><tr>
25154 <td>foo||bar</td>
25155 <td>a<i>b||c</i></td>
25156 <td>a<i><div>b||c</div></i></td>
25157 </tr></tbody></table>
25158 !! wikitext
25159 {|
25160 |<nowiki>foo||bar</nowiki>
25161 |a''<nowiki>b||c</nowiki>''
25162 |a''<div><nowiki>b||c</nowiki></div>''
25163 |}
25164 !! html/php
25165 <table>
25166 <tr>
25167 <td>foo||bar
25168 </td>
25169 <td>a<i>b||c</i>
25170 </td>
25171 <td>a<i><div>b||c</div></i>
25172 </td></tr></table>
25173
25174 !! end
25175
25176 !! test
25177 Tables: 2c. Nested in td -- no escaping needed
25178 !! options
25179 parsoid=html2wt
25180 !! html/*
25181 <table>
25182 <tr>
25183 <td>foo!!bar
25184 </td></tr></table>
25185
25186 !! wikitext
25187 {|
25188 |foo!!bar
25189 |}
25190 !! end
25191
25192 !! test
25193 Tables: 3a. Nested in th
25194 !! options
25195 parsoid=html2wt
25196 !! html/*
25197 <table>
25198 <tr>
25199 <th>foo!bar
25200 </th></tr></table>
25201
25202 !! wikitext
25203 {|
25204 !foo!bar
25205 |}
25206 !! end
25207
25208 !! test
25209 Tables: 3b. Nested in th
25210 !! options
25211 parsoid=html2wt
25212 !! html/parsoid
25213 <table><tbody>
25214 <tr><th>foo!!bar</th>
25215 <th><i>foo|bar</i></th>
25216 <th><i>foo!!bar</i></th>
25217 <th><i><span>foo!!bar</span></i></th>
25218 </tr></tbody></table>
25219 !! wikitext
25220 {|
25221 !<nowiki>foo!!bar</nowiki>
25222 !''<nowiki>foo|bar</nowiki>''
25223 !''<nowiki>foo!!bar</nowiki>''
25224 !''<span><nowiki>foo!!bar</nowiki></span>''
25225 |}
25226 !! html/php
25227 <table>
25228 <tr>
25229 <th>foo!!bar
25230 </th>
25231 <th><i>foo|bar</i>
25232 </th>
25233 <th><i>foo!!bar</i>
25234 </th>
25235 <th><i><span>foo!!bar</span></i>
25236 </th></tr></table>
25237
25238 !! end
25239
25240 !! test
25241 Tables: 3c. Nested in th
25242 !! options
25243 parsoid=html2wt
25244 !! html/parsoid
25245 <table><tbody>
25246 <tr><th>foo||bar</th>
25247 <th><span typeof="mw:Nowiki">foo||bar</span></th>
25248 </tr></tbody></table>
25249 !! wikitext
25250 {|
25251 !<nowiki>foo||bar</nowiki>
25252 !<nowiki>foo||bar</nowiki>
25253 |}
25254 !! html/php
25255 <table>
25256 <tr>
25257 <th>foo||bar
25258 </th>
25259 <th>foo||bar
25260 </th></tr></table>
25261
25262 !! end
25263
25264 !! test
25265 Tables: 4a. Escape -
25266 !! options
25267 parsoid=html2wt
25268 !! html/*
25269 <table>
25270 <tr>
25271 <th>-bar
25272 </th></tr>
25273 <tr>
25274 <td>-bar
25275 </td></tr></table>
25276
25277 !! wikitext
25278 {|
25279 !-bar
25280 |-
25281 |<nowiki>-bar</nowiki>
25282 |}
25283 !! end
25284
25285 !! test
25286 Tables: 4b. Escape +
25287 !! options
25288 parsoid=html2wt
25289 !! html/*
25290 <table>
25291 <tr>
25292 <th>+bar
25293 </th></tr>
25294 <tr>
25295 <td>+bar
25296 </td></tr></table>
25297
25298 !! wikitext
25299 {|
25300 !+bar
25301 |-
25302 |<nowiki>+bar</nowiki>
25303 |}
25304 !! end
25305
25306 !! test
25307 Tables: 4c. No escaping needed
25308 !! options
25309 parsoid=html2wt
25310 !! html/parsoid
25311 <table><tbody>
25312 <tr><td>foo-bar</td><td>foo+bar</td></tr>
25313 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
25314 <tr><td>foo
25315 <p>bar|baz
25316 +bar
25317 -bar</p></td></tr>
25318 <tr><td>x
25319 <div>a|b</div></td>
25320 </tbody></table>
25321 !! wikitext
25322 {|
25323 |foo-bar
25324 |foo+bar
25325 |-
25326 |''foo''-bar
25327 |''foo''+bar
25328 |-
25329 |foo
25330 bar|baz
25331 +bar
25332 -bar
25333 |-
25334 |x
25335 <div>a|b</div>
25336 |}
25337 !! html/php
25338 <table>
25339 <tr>
25340 <td>foo-bar
25341 </td>
25342 <td>foo+bar
25343 </td></tr>
25344 <tr>
25345 <td><i>foo</i>-bar
25346 </td>
25347 <td><i>foo</i>+bar
25348 </td></tr>
25349 <tr>
25350 <td>foo
25351 <p>bar|baz
25352 +bar
25353 -bar
25354 </p>
25355 </td></tr>
25356 <tr>
25357 <td>x
25358 <div>a|b</div>
25359 </td></tr></table>
25360
25361 !! end
25362
25363 !! test
25364 Tables: 4d. No escaping needed
25365 !! options
25366 parsoid=html2wt
25367 !! html/parsoid
25368 <table>
25369 <tbody><tr><td><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>-bar</td>
25370 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>+1</td>
25371 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>-2</td></tr>
25372 </tbody></table>
25373 !! wikitext
25374 {|
25375 |[[Foo]]-bar
25376 ||+1
25377 ||-2
25378 |}
25379 !! html/php
25380 <table>
25381 <tr>
25382 <td><a href="/wiki/Foo" title="Foo">Foo</a>-bar
25383 </td>
25384 <td>+1
25385 </td>
25386 <td>-2
25387 </td></tr></table>
25388
25389 !! end
25390
25391 !! test
25392 T97430: Don't emit empty nowiki pairs around marker meta tags
25393 !! options
25394 parsoid=html2wt
25395 !! html/parsoid
25396 <p>*This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
25397 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.</p>
25398 !! wikitext
25399 <nowiki>*</nowiki>This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
25400 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.
25401 !! end
25402
25403 !! test
25404 Unclosed xmlish element in table line shouldn't eat end delimiters
25405 !! options
25406 parsoid=html2wt
25407 !! html/parsoid
25408 <table>
25409 <tbody><tr><td> &lt;foo</td>
25410 <td> bar></td></tr>
25411 </tbody></table>
25412 !! wikitext
25413 {|
25414 | <foo
25415 | bar>
25416 |}
25417 !! html/php
25418 <table>
25419 <tr>
25420 <td> &lt;foo
25421 </td>
25422 <td> bar&gt;
25423 </td></tr></table>
25424
25425 !! end
25426
25427 #### --------------- Links ----------------
25428 #### 1. Quote marks in link text
25429 #### 2. Wikilinks: Escapes needed
25430 #### 3. Wikilinks: No escapes needed
25431 #### 4. Extlinks: Escapes needed
25432 #### 5. Extlinks: No escapes needed
25433 #### --------------------------------------
25434 !! test
25435 Links 1. WikiLinks: No escapes needed
25436 !! options
25437 parsoid=html2wt
25438 !! html/parsoid
25439 <p><a rel="mw:WikiLink" href="Foo" title="Foo">Foo<i>boo</i></a>
25440 <a rel="mw:WikiLink" href="Foo" title="Foo">[Foobar]</a>
25441 <a rel="mw:WikiLink" href="Foo" title="Foo">x [Foobar] x</a></p>
25442 !! wikitext
25443 [[Foo|Foo''boo'']]
25444 [[Foo|[Foobar]]]
25445 [[Foo|x [Foobar] x]]
25446 !! html/php
25447 <p><a href="/wiki/Foo" title="Foo">Foo<i>boo</i></a>
25448 <a href="/wiki/Foo" title="Foo">[Foobar]</a>
25449 <a href="/wiki/Foo" title="Foo">x [Foobar] x</a>
25450 </p>
25451 !! end
25452
25453 !! test
25454 Links 2. WikiLinks: Escapes needed
25455 !! options
25456 parsoid=html2wt
25457 !! html/parsoid
25458 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
25459 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
25460 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
25461 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
25462 <a href="Foo" rel="mw:WikiLink">|Bar</a>
25463 <a href="Foo" rel="mw:WikiLink">]]bar</a>
25464 <a href="Foo" rel="mw:WikiLink">[[bar</a>
25465 <a href="Foo" rel="mw:WikiLink">x [[ y</a>
25466 <a href="Foo" rel="mw:WikiLink">x ]] y</a>
25467 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
25468 !! wikitext
25469 [[Foo|<nowiki>Foobar]</nowiki>]]
25470 [[Foo|x <nowiki>[http://google.com g]</nowiki> x]]
25471 [[Foo|<nowiki>[[Bar]]</nowiki>]]
25472 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
25473 [[Foo|<nowiki>|Bar</nowiki>]]
25474 [[Foo|<nowiki>]]bar</nowiki>]]
25475 [[Foo|<nowiki>[[bar</nowiki>]]
25476 [[Foo|<nowiki>x [[ y</nowiki>]]
25477 [[Foo|<nowiki>x ]] y</nowiki>]]
25478 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
25479 !! html/php
25480 <p><a href="/wiki/Foo" title="Foo">Foobar]</a>
25481 <a href="/wiki/Foo" title="Foo">x [http://google.com g] x</a>
25482 <a href="/wiki/Foo" title="Foo">[[Bar]]</a>
25483 <a href="/wiki/Foo" title="Foo">x [[Bar]] x</a>
25484 <a href="/wiki/Foo" title="Foo">|Bar</a>
25485 <a href="/wiki/Foo" title="Foo">]]bar</a>
25486 <a href="/wiki/Foo" title="Foo">[[bar</a>
25487 <a href="/wiki/Foo" title="Foo">x [[ y</a>
25488 <a href="/wiki/Foo" title="Foo">x ]] y</a>
25489 <a href="/wiki/Foo" title="Foo">x ]] y [[ z</a>
25490 </p>
25491 !! end
25492
25493 !! test
25494 Links 3. WikiLinks: No escapes needed
25495 !! options
25496 parsoid=html2wt
25497 !! html/parsoid
25498 <p><a rel="mw:WikiLink" href="Foo">[Foobar</a>
25499 <a rel="mw:WikiLink" href="Foo" title="Foo">foo|bar</a></p>
25500 !! wikitext
25501 [[Foo|[Foobar]]
25502 [[Foo|foo|bar]]
25503 !! html/php
25504 <p><a href="/wiki/Foo" title="Foo">[Foobar</a>
25505 <a href="/wiki/Foo" title="Foo">foo|bar</a>
25506 </p>
25507 !! end
25508
25509 !! test
25510 Links 4. ExtLinks: Escapes needed
25511 !! options
25512 parsoid=html2wt
25513 !! html/parsoid
25514 <p><a rel="mw:ExtLink" href="http://google.com">[google]</a>
25515 <a rel="mw:ExtLink" href="http://google.com">google]</a>
25516 <a rel="mw:ExtLink" href="http://google.com">goog] le</a></p>
25517 <p>[http://google.com]</p>
25518 <p>[http://google.com google]</p>
25519 <p>[<a rel="mw:ExtLink" href="http://google.com">http://google.com</a>]</p>
25520 <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>
25521 !! wikitext
25522 [http://google.com <nowiki>[google]</nowiki>]
25523 [http://google.com <nowiki>google]</nowiki>]
25524 [http://google.com <nowiki>goog] le</nowiki>]
25525
25526 <nowiki>[http://google.com]</nowiki>
25527
25528 <nowiki>[http://google.com google]</nowiki>
25529
25530 [http://google.com<nowiki>]</nowiki>
25531
25532 [{{echo|http://google.com}}<nowiki>]</nowiki>
25533 !! html/php
25534 <p><a rel="nofollow" class="external text" href="http://google.com">[google]</a>
25535 <a rel="nofollow" class="external text" href="http://google.com">google]</a>
25536 <a rel="nofollow" class="external text" href="http://google.com">goog] le</a>
25537 </p><p>[http://google.com]
25538 </p><p>[http://google.com google]
25539 </p><p>[<a rel="nofollow" class="external free" href="http://google.com">http://google.com</a>]
25540 </p><p>[<a rel="nofollow" class="external free" href="http://google.com">http://google.com</a>]
25541 </p>
25542 !! end
25543
25544 !! test
25545 Links 5. ExtLinks: No escapes needed
25546 !! options
25547 parsoid=html2wt
25548 !! html/parsoid
25549 <p><a rel="mw:ExtLink" href="http://google.com">[google</a></p>
25550 <p>[<a ref="mw:ExtLink" href="http://google.com"></a>]</p>
25551 !! wikitext
25552 [http://google.com [google]
25553
25554 [[http://google.com]]
25555 !! html/php
25556 <p><a rel="nofollow" class="external text" href="http://google.com">[google</a>
25557 </p><p>[<a rel="nofollow" class="external autonumber" href="http://google.com">[1]</a>]
25558 </p>
25559 !! end
25560
25561 !! test
25562 Links 6. Add <nowiki/>s between text-nodes and url-links when required (T66300)
25563 !! options
25564 parsoid=html2wt
25565 !! html/parsoid
25566 <p>x<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>y
25567 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>?x
25568 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>&amp;x
25569 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>'x
25570 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,x
25571 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.x
25572 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
25573 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>:x
25574 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
25575 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>!x
25576 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>=x
25577 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>(x)
25578 <a rel="mw:ExtLink" href="http://example.com(x" data-parsoid='{"stx":"url"}'>http://example.com(x</a>)
25579 </p>
25580 !! wikitext
25581 x<nowiki/>http://example.com<nowiki/>y
25582 http://example.com<nowiki/>?x
25583 http://example.com<nowiki/>&x
25584 http://example.com<nowiki/>'x
25585 http://example.com<nowiki/>,x
25586 http://example.com<nowiki/>.x
25587 http://example.com<nowiki/>;x
25588 http://example.com<nowiki/>:x
25589 http://example.com<nowiki/>;x
25590 http://example.com<nowiki/>!x
25591 http://example.com<nowiki/>=x
25592 http://example.com<nowiki/>(x)
25593 http://example.com(x<nowiki/>)
25594 !! end
25595
25596 !! test
25597 Links 7a. Don't add spurious <nowiki/>s between text-nodes and url-links (T66300)
25598 !! options
25599 parsoid=html2wt
25600 !! html/parsoid
25601 <p>x
25602 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>
25603 y
25604 "<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>"
25605 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>)
25606 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>) foo
25607 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,
25608 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>, foo
25609 </p>
25610 !! wikitext
25611 x
25612 http://example.com
25613 y
25614 "http://example.com"
25615 (http://example.com)
25616 (http://example.com) foo
25617 http://example.com,
25618 http://example.com, foo
25619 !! html/php
25620 <p>x
25621 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
25622 y
25623 "<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>"
25624 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
25625 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>) foo
25626 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
25627 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>, foo
25628 </p>
25629 !! end
25630
25631 !! test
25632 Links 7b. Don't add spurious <nowiki/>s between text-nodes and url-links (T66300)
25633 !! options
25634 parsoid=html2wt
25635 !! html/parsoid
25636 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.,;:!?\
25637 -<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:</p>
25638 !! wikitext
25639 http://example.com.,;:!?\
25640 -http://example.com:
25641 !! html/php
25642 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.,;:!?\
25643 -<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
25644 </p>
25645 !! end
25646
25647 !! test
25648 Links 8. Add <nowiki/>s between text-nodes and RFC-links when required (T66300)
25649 !! options
25650 parsoid=html2wt
25651 !! html/parsoid
25652 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>4
25653 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
25654 X<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y</p>
25655 !! wikitext
25656 RFC 123<nowiki/>4
25657 RFC 123<nowiki/>y
25658 X<nowiki/>RFC 123<nowiki/>y
25659 !! end
25660
25661 !! test
25662 Links 9. Don't add spurious <nowiki/>s between text-nodes and RFC-links (T66300)
25663 !! options
25664 parsoid=html2wt
25665 !! html/parsoid
25666 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>?foo
25667 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>&amp;foo
25668 -<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>-
25669 </p>
25670 !! wikitext
25671 RFC 123?foo
25672 RFC 123&foo
25673 -RFC 123-
25674 !! html/php
25675 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>?foo
25676 <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>&amp;foo
25677 -<a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>-
25678 </p>
25679 !! end
25680
25681 !! test
25682 Links 10. Add <nowiki/>s between text-nodes and PMID-links when required (T66300)
25683 !! options
25684 parsoid=html2wt
25685 !! html/parsoid
25686 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>4
25687 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
25688 X<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
25689 !! wikitext
25690 PMID 123<nowiki/>4
25691 PMID 123<nowiki/>y
25692 X<nowiki/>PMID 123<nowiki/>y
25693 !! end
25694
25695 !! test
25696 Links 11. Don't add spurious <nowiki/>s between text-nodes and PMID-links (T66300)
25697 !! options
25698 parsoid=html2wt
25699 !! html/parsoid
25700 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>?foo
25701 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>&foo
25702 -<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>-
25703 </p>
25704 !! wikitext
25705 PMID 123?foo
25706 PMID 123&foo
25707 -PMID 123-
25708 !! html/php
25709 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>?foo
25710 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>&amp;foo
25711 -<a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>-
25712 </p>
25713 !! end
25714
25715 !! test
25716 Links 12. Add <nowiki/>s between text-nodes and ISBN-links when required (T66300)
25717 !! options
25718 parsoid=html2wt
25719 !! html/parsoid
25720 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>1
25721 <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>x
25722 a<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>b
25723 </p>
25724 !! wikitext
25725 ISBN 1234567890<nowiki/>1
25726 ISBN 1234567890<nowiki/>x
25727 a<nowiki/>ISBN 1234567890<nowiki/>b
25728 !! end
25729
25730 !! test
25731 Links 13. Don't add spurious <nowiki/>s between text-nodes and ISBN-links (T66300)
25732 !! options
25733 parsoid=html2wt
25734 !! html/parsoid
25735 <p>-<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>'s
25736 !! wikitext
25737 -ISBN 1234567890's
25738 !! html/php
25739 <p>-<a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>'s
25740 </p>
25741 !! end
25742
25743 !! test
25744 Links 14. Protect link-like plain text. (Parsoid bug T78425)
25745 !! options
25746 parsoid=html2wt
25747 !! html/*
25748 <p>this is not a link: http://example.com
25749 </p>
25750 !! wikitext
25751 this is not a link: <nowiki>http://example.com</nowiki>
25752 !! end
25753
25754 !! test
25755 Links 15. Link trails can't become link prefixes.
25756 !! options
25757 language=is
25758 parsoid=html2wt
25759 !! html/parsoid
25760 <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>
25761 !! wikitext
25762 [[Söfnuður]]-[[00]]
25763 !! html/php
25764 <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>
25765 </p>
25766 !! end
25767
25768 #### --------------- Quotes ---------------
25769 #### 1. Quotes inside <b> and <i>
25770 #### 2. Link fragments separated by <i> and <b> tags
25771 #### 3. Link fragments inside <i> and <b>
25772 #### 4. No escaping needed
25773 #### --------------------------------------
25774 !! test
25775 1a. Quotes inside <b> and <i>
25776 !! options
25777 parsoid=html2wt
25778 !! html/*
25779 <p><i>'foo'</i>
25780 <i>''foo''</i>
25781 <i>'''foo'''</i>
25782 <i>foo</i>'s
25783 <b>'foo'</b>
25784 <b>''foo''</b>
25785 <b>'''foo'''</b>
25786 <b>foo'<i>bar'</i>baz</b>
25787 <b>foo</b>'s
25788 '<i>foo</i>
25789 <i>foo</i>'
25790 <i>foo'</i>'
25791 '<i>foo</i>'
25792 '<b>foo</b>
25793 <b>foo</b>'
25794 '<b>foo</b>'
25795 <i>fools'<span> errand</span></i>
25796 <i><span>fool</span>'s errand</i>
25797 '<i>foo</i> bar '<i>baz</i>
25798 a|!*#-:;+-~[]{}b'<i>x</i>
25799 </p>
25800 !! wikitext
25801 ''<nowiki/>'foo'''
25802 ''<nowiki>''foo''</nowiki>''
25803 ''<nowiki>'''foo'''</nowiki>''
25804 ''foo''<nowiki/>'s
25805 '''<nowiki/>'foo''''
25806 '''<nowiki>''foo''</nowiki>'''
25807 '''<nowiki>'''foo'''</nowiki>'''
25808 '''foo'<nowiki/>''bar'<nowiki/>''baz'''
25809 '''foo'''<nowiki/>'s
25810 '''foo''
25811 ''foo''<nowiki/>'
25812 ''foo'''<nowiki/>'
25813 '''foo''<nowiki/>'
25814 ''''foo'''
25815 '''foo'''<nowiki/>'
25816 ''''foo'''<nowiki/>'
25817 ''fools'<span> errand</span>''
25818 ''<span>fool</span>'s errand''
25819 '<nowiki/>''foo'' bar '''baz''
25820 a|!*#-:;+-~[]{}b'''x''
25821 !! end
25822
25823 !! test
25824 1b. Quotes inside <b> and <i> with other tags on same line
25825 !! options
25826 parsoid=html2wt
25827 !! html/parsoid
25828 '<i>a</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
25829 <i>a'</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
25830 <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>
25831 <a rel="mw:WikiLink" href="Foo" title="Foo">foo</a> x'<i><a href="Bar" rel="mw:WikiLink" title="Bar">bar</a></i>
25832 '<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>
25833 '<i>foo</i> <div title="name">test</div>
25834 '<i>foo</i> and <br data-parsoid='{"stx":"html","noClose":true}'/> bar
25835 <ol class="mw-references references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
25836 <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>
25837 </ol>
25838 !! wikitext
25839 '''a'' foo ''[[bar]]''
25840 ''a''' foo ''[[bar]]''
25841 ''a''' foo '''{{echo|[[bar]]}}'''
25842 [[foo]] x'''[[bar]]''
25843 '''foo'' <ref>test</ref>
25844 '''foo'' <div title="name">test</div>
25845 '''foo'' and <br> bar
25846 <references />
25847 !! end
25848
25849 !! test
25850 2. Link fragments separated by <i> and <b> tags
25851 !! options
25852 parsoid=html2wt
25853 !! html/parsoid
25854 <p>[[<i>foo</i>hello]]</p>
25855 <p>[[<b>foo</b>hello]]</p>
25856 !! wikitext
25857 [[''foo''<nowiki>hello]]</nowiki>
25858
25859 [['''foo'''<nowiki>hello]]</nowiki>
25860 !! end
25861
25862 # FIXME: Escaping one or both of [[ and ]] is also acceptable --
25863 # this is one of the shortcomings of this format
25864 !! test
25865 3. Link fragments inside <i> and <b>
25866 !! options
25867 parsoid=html2wt
25868 !! html/parsoid
25869 <p><i>[[foo</i>]]</p>
25870 <p><b>[[foo</b>]]</p>
25871 !! wikitext
25872 ''[[foo''<nowiki>]]</nowiki>
25873
25874 '''[[foo'''<nowiki>]]</nowiki>
25875 !! end
25876
25877 !! test
25878 4. No escaping needed
25879 !! options
25880 parsoid=html2wt
25881 !! html/parsoid
25882 <p>'<span><i>bar</i></span>'
25883 '<span><b>bar</b></span>'
25884 'a:b'foo
25885 </p>
25886 !! wikitext
25887 '<span>''bar''</span>'
25888 '<span>'''bar'''</span>'
25889 'a:b'foo
25890 !! end
25891
25892 #### ----------- Paragraphs ---------------
25893 #### 1. No unnecessary escapes
25894 #### --------------------------------------
25895
25896 !! test
25897 1. No unnecessary escapes
25898 !! options
25899 parsoid=html2wt
25900 !! html/parsoid
25901 <p>bar <span>[[foo]]</span>
25902 </p><p>=bar <span>[[foo]]</span>
25903 </p><p>[[bar <span>[[foo]]</span>
25904 </p><p>]]bar <span>[[foo]]</span>
25905 </p><p>=bar <span>foo]]</span>=
25906 </p>
25907 !! wikitext
25908 bar <span><nowiki>[[foo]]</nowiki></span>
25909
25910 =bar <span><nowiki>[[foo]]</nowiki></span>
25911
25912 [[bar <span><nowiki>[[foo]]</nowiki></span>
25913
25914 ]]bar <span><nowiki>[[foo]]</nowiki></span>
25915
25916 =bar <span>foo]]</span><nowiki>=</nowiki>
25917 !!end
25918
25919 #### ----------------------- PRE --------------------------
25920 #### 1. Leading whitespace in SOL context should be escaped
25921 #### ------------------------------------------------------
25922 !! test
25923 1. Leading whitespace in SOL context should be escaped
25924 !! options
25925 parsoid=html2wt
25926 !! html/parsoid
25927 <p> a</p>
25928
25929 <p> a</p>
25930
25931 <p> a(tab)</p>
25932
25933 <p> a
25934 <!--cmt-->
25935 a</p>
25936
25937 <p>a
25938 b</p>
25939
25940 <p>a
25941 b</p>
25942
25943 <p>a
25944 b</p>
25945 !! wikitext
25946 <nowiki> </nowiki>a
25947
25948 <nowiki> </nowiki> a
25949
25950 a(tab)
25951
25952 <nowiki> </nowiki> a
25953 <!--cmt-->
25954 <nowiki> </nowiki>a
25955
25956 a
25957 <nowiki> </nowiki>b
25958
25959 a
25960 b
25961
25962 a
25963 b
25964 !! html/php
25965 <p> a
25966 </p><p> a
25967 </p><p> a(tab)
25968 </p><p> a
25969 a
25970 </p><p>a
25971 b
25972 </p><p>a
25973 b
25974 </p><p>a
25975 b
25976 </p>
25977 !! end
25978
25979 !! test
25980 2. Leading whitespace in non-indent-pre contexts should not be escaped
25981 !! options
25982 parsoid=html2wt
25983 !! html/parsoid
25984 <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>
25985 <ol class="mw-references references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
25986 <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>
25987 b</span></li>
25988 </ol>
25989 !! wikitext
25990 foo <ref>''a''
25991 b</ref>
25992 <references />
25993 !! end
25994
25995 !! test
25996 3. Leading whitespace in indent-pre suppressing contexts should not be escaped
25997 !! options
25998 parsoid=html2wt
25999 !! html/parsoid
26000 <blockquote>
26001 <p>
26002 a
26003 <span>b</span>
26004 c</p>
26005 </blockquote>
26006 !! wikitext
26007 <blockquote>
26008 a
26009 <span>b</span>
26010 c
26011 </blockquote>
26012 !! end
26013
26014 !! test
26015 4. Leading whitespace in indent-pre suppressing contexts should not be escaped
26016 !! options
26017 parsoid=html2wt
26018 !! html/parsoid
26019 <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>
26020 !! wikitext
26021 [[File:Foobar.jpg|thumb|caption]]
26022 !! end
26023
26024 !! test
26025 5. Nowiki escaping should account for indent-pres
26026 !! options
26027 parsoid=html2wt
26028 !! html/parsoid
26029 <pre>==foo==</pre>
26030 !! wikitext
26031 ==foo==
26032 !! end
26033
26034 !!test
26035 T95794: nowiki escaping should account for leading space at start-of-line in an indent-pre block
26036 !! options
26037 parsoid=html2wt
26038 !! html/parsoid
26039 <pre>
26040 * foo
26041 * bar
26042 </pre>
26043 !! wikitext
26044 * foo
26045 * bar
26046 !! end
26047
26048 #### --------------- Behavior Switches --------------------
26049
26050 !! test
26051 1. Valid behavior switches should be escaped
26052 !! options
26053 parsoid=html2wt
26054 !! html/parsoid
26055 __TOC__
26056 <i>__TOC__</i>
26057 !! wikitext
26058 <nowiki>__TOC__</nowiki>
26059 ''<nowiki>__TOC__</nowiki>''
26060 !! end
26061
26062 !! test
26063 2. Invalid behavior switches should not be escaped
26064 !! options
26065 parsoid=html2wt
26066 !! html/parsoid
26067 __TOO__
26068 __|__
26069 !! wikitext
26070 __TOO__
26071 __|__
26072 !! end
26073
26074 # We use indent-pre as an indirect way to test for sol-transparent behavior.
26075 !! test
26076 Behavior switches should be SOL-transparent
26077 !! options
26078 parsoid=html2wt
26079 !! html/parsoid
26080 <meta property="mw:PageProp/toc" />
26081
26082 <!-- this one's bogus -->
26083 <pre>__TOO__</pre>
26084
26085 <pre data-parsoid='{}'><meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/> foo</pre>
26086
26087 <meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/><pre data-parsoid='{}'>bar</pre>
26088 !! wikitext
26089 __TOC__
26090
26091 <!-- this one's bogus -->
26092 __TOO__
26093
26094 __TOC__ foo
26095
26096 __TOC__
26097 bar
26098 !! end
26099
26100 #### --------------- HTML tags ---------------
26101 #### 1. a tags
26102 #### 2. other tags
26103 #### 3. multi-line html tag
26104 #### 4. extension tags
26105 #### -----------------------------------------
26106 !! test
26107 1. a tags
26108 !! options
26109 parsoid=html2wt
26110 !! html/parsoid
26111 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
26112 !! wikitext
26113 <a href="http://google.com">google</a>
26114 !! end
26115
26116 !! test
26117 2. other tags
26118 !! options
26119 parsoid=html2wt
26120 !! html/parsoid
26121 <ul><li> &lt;div&gt;foo&lt;/div&gt;</li>
26122 <li> &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;</li>
26123 <li> &lt;td&gt;</li></ul>
26124
26125 !! wikitext
26126 * <nowiki><div>foo</div></nowiki>
26127 * <nowiki><div style="color:red">foo</div></nowiki>
26128 * <nowiki><td></nowiki>
26129 !! end
26130
26131 !! test
26132 3. multi-line html tag
26133 !! options
26134 parsoid=html2wt
26135 !! html/parsoid
26136 <p>&lt;div
26137 &gt;foo&lt;/div
26138 &gt;
26139 </p>
26140 !! wikitext
26141 <nowiki><div
26142 >foo</div
26143 ></nowiki>
26144 !! end
26145
26146 !! test
26147 4. extension tags
26148 !! options
26149 parsoid=html2wt
26150 !! html/parsoid
26151 <p>&lt;ref&gt;foo&lt;/ref&gt;
26152 </p><p>&lt;ref&gt;bar
26153 </p><p>baz&lt;/ref&gt;
26154 </p>
26155 !! wikitext
26156 <nowiki><ref>foo</ref></nowiki>
26157
26158 <nowiki><ref>bar</nowiki>
26159
26160 baz<nowiki></ref></nowiki>
26161 !! end
26162
26163 #### --------------- Others ---------------
26164 !! test
26165 Escaping nowikis
26166 !! options
26167 parsoid=html2wt
26168 !! html/parsoid
26169 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
26170 </p>
26171 !! wikitext
26172 &lt;nowiki&gt;foo&lt;/nowiki&gt;
26173 !! end
26174
26175 ## The quote-char in the input is necessary for triggering the bug
26176 !! test
26177 (T54035) Nowiki-escaping should not get tripped by " :" in text
26178 !! options
26179 parsoid=html2wt
26180 !! html/parsoid
26181 <p>foo's bar :</p>
26182 !! wikitext
26183 foo's bar :
26184 !! end
26185
26186 #----------- End of wikitext escaping tests --------------
26187
26188 !! test
26189
26190 Tag-like HTML structures are passed through as text
26191 !! wikitext
26192 <x y>
26193
26194 <x.y>
26195
26196 <x-y>
26197
26198 1>2
26199
26200 x<y
26201
26202 a>b
26203
26204 1<d e>f
26205 !! html
26206 <p>&lt;x y&gt;
26207 </p><p>&lt;x.y&gt;
26208 </p><p>&lt;x-y&gt;
26209 </p><p>1&gt;2
26210 </p><p>x&lt;y
26211 </p><p>a&gt;b
26212 </p><p>1&lt;d e&gt;f
26213 </p>
26214 !! end
26215
26216 !! test
26217 HTML tag with necessary entities in attributes
26218 !! wikitext
26219 <span title="&amp;amp;">foo</span>
26220 !! html
26221 <p><span title="&amp;amp;">foo</span>
26222 </p>
26223 !! end
26224
26225 !! test
26226 HTML tag with 'unnecessary' entity encoding in attributes
26227 !! wikitext
26228 <span title="&amp;">foo</span>
26229 !! html
26230 <p><span title="&amp;">foo</span>
26231 </p>
26232 !! end
26233
26234 !! test
26235 HTML tag with broken attribute value quoting
26236 !! options
26237 parsoid=wt2html,html2html
26238 !! wikitext
26239 <span title="Hello world>Foo</span>
26240 !! html/php
26241 <p><span title="Hello world">Foo</span>
26242 </p>
26243 !! html/parsoid
26244 <p><span title="Hello world">Foo</span></p>
26245 !! end
26246
26247 !! test
26248 Self-closed tag with broken attribute value quoting
26249 !! options
26250 parsoid=wt2html,html2html
26251 !! wikitext
26252 <div title="Hello world />Foo
26253 !! html/php+tidy
26254 <div title="Hello world"></div>
26255 <p>Foo</p>
26256 !! html/parsoid
26257 <div title="Hello world " data-parsoid='{"stx":"html","selfClose":true}'></div><p>Foo</p>
26258 !! end
26259
26260 !! test
26261 Table with broken attribute value quoting
26262 !! options
26263 parsoid=wt2html,html2html
26264 !! wikitext
26265 {|
26266 | title="Hello world|Foo
26267 |}
26268 !! html/php
26269 <table>
26270 <tr>
26271 <td title="Hello world">Foo
26272 </td></tr></table>
26273
26274 !! html/parsoid
26275 <table>
26276 <tr>
26277 <td title="Hello world">Foo
26278 </td></tr></table>
26279
26280 !! end
26281
26282 !! test
26283 Table with broken attribute value quoting on consecutive lines
26284 !! options
26285 parsoid=wt2html,html2html
26286 !! wikitext
26287 {|
26288 | title="Hello world|Foo
26289 | style="color:red|Bar
26290 |}
26291 !! html/php
26292 <table>
26293 <tr>
26294 <td title="Hello world">Foo
26295 </td>
26296 <td style="color:red">Bar
26297 </td></tr></table>
26298
26299 !! html/parsoid
26300 <table><tbody>
26301 <tr>
26302 <td title="Hello world">Foo
26303 </td><td style="color: red">Bar
26304 </td></tr></tbody></table>
26305
26306 !! end
26307
26308 !!test
26309 Accept empty td cell attribute
26310 !! wikitext
26311 {|
26312 | align="center" | foo || |
26313 |}
26314 !! html
26315 <table>
26316 <tr>
26317 <td align="center"> foo </td>
26318 <td>
26319 </td></tr></table>
26320
26321 !!end
26322
26323 !!test
26324 Non-empty attributes in th-cells
26325 !! wikitext
26326 {|
26327 ! Foo !! style="color: red" | Bar
26328 |}
26329 !! html
26330 <table>
26331 <tr>
26332 <th> Foo </th>
26333 <th style="color: red"> Bar
26334 </th></tr></table>
26335
26336 !!end
26337
26338 !!test
26339 Accept empty attributes in th-cells
26340 !! wikitext
26341 {|
26342 !| foo !!| bar
26343 |}
26344 !! html
26345 <table>
26346 <tr>
26347 <th> foo </th>
26348 <th> bar
26349 </th></tr></table>
26350
26351 !!end
26352
26353 !!test
26354 Empty table rows go away
26355 !! wikitext
26356 {|
26357 | Hello
26358 | there
26359 |- class="foo"
26360 |-
26361 |}
26362 !! html
26363 <table>
26364 <tr>
26365 <td> Hello
26366 </td>
26367 <td> there
26368 </td></tr>
26369
26370 </table>
26371
26372 !! end
26373
26374 ###
26375 ### Parsoid-centric tests for testing RTing of inter-element separators
26376 ### Edge cases not tested by existing parser tests and specific to
26377 ### Parsoid-specific serialization strategies.
26378 ###
26379
26380 !!test
26381 RT-ed inter-element separators should be valid separators
26382 !! wikitext
26383 {|
26384 |- [[foo]]
26385 |}
26386 !! html/php
26387 <table>
26388
26389 </table>
26390
26391 !! html/parsoid
26392 <table>
26393 <tbody><tr class='mw-empty-elt' data-parsoid='{"startTagSrc":"|-","a":{"[[foo]]":null},"sa":{"[[foo]]":""},"autoInsertedEnd":true}'></tr>
26394 </tbody></table>
26395 !!end
26396
26397 # Parsoid-only since PHP parser relies on Tidy for correct output
26398 !!test
26399 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
26400 !!options
26401 parsoid
26402 !! wikitext
26403 {|
26404 |<small>foo
26405 bar
26406 |}
26407
26408 {|
26409 |<small>foo<small>
26410 |}
26411 !! html
26412 <table>
26413 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'>foo
26414 <p>bar</p></small></td></tr>
26415 </tbody></table>
26416
26417 <table>
26418 <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>
26419 </tbody></table>
26420 !!end
26421
26422 # Note that the "style" attribute is really a template parameter here.
26423 # The = would have to be {{=}} if you wanted the literal.
26424 !!test
26425 Empty TD followed by TD with tpl-generated attribute
26426 !! wikitext
26427 {|
26428 |-
26429 |
26430 |{{echo|style='color:red'}}|foo
26431 |}
26432 !! html
26433 <table>
26434
26435 <tr>
26436 <td>
26437 </td>
26438 <td>foo
26439 </td></tr></table>
26440
26441 !!end
26442
26443 !!test
26444 Indented table with an empty td
26445 !! wikitext
26446 {|
26447 |-
26448 |
26449 |foo
26450 |}
26451 !! html
26452 <table>
26453
26454 <tr>
26455 <td>
26456 </td>
26457 <td>foo
26458 </td></tr></table>
26459
26460 !!end
26461
26462 ## We have some newline diffs RT-ing this edge case
26463 ## and it is not important enough -- we seem to be emitting
26464 ## at most 2 newlines after a </tr> and this is unrelated to
26465 ## the issue from T85627 that this is testing.
26466 !!test
26467 Indented table with blank lines in between (T85627)
26468 !! options
26469 parsoid=wt2html
26470 !! wikitext
26471 {|
26472 |foo
26473
26474
26475 |}
26476 !! html
26477 <table>
26478
26479 <tr>
26480 <td>foo
26481 </td></tr></table>
26482
26483 !!end
26484
26485 !!test
26486 Indented block & table
26487 !! wikitext
26488 <div>foo</div>
26489 {|
26490 |foo
26491 |}
26492 !! html/php
26493 <div>foo</div>
26494 <table>
26495 <tr>
26496 <td>foo
26497 </td></tr></table>
26498
26499 !! html/parsoid
26500 <div data-parsoid='{"stx":"html"}'>foo</div>
26501 <table><tbody>
26502 <tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>foo</td></tr>
26503 </tbody></table>
26504 !!end
26505
26506 !! test
26507 Indent and comment before table row
26508 !! wikitext
26509 {|
26510 <!--hi-->|-
26511 | there
26512 |}
26513 !! html/php
26514 <table>
26515
26516 <tr>
26517 <td> there
26518 </td></tr></table>
26519
26520 !! html/parsoid
26521 <table>
26522 <!--hi--><tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
26523 <td data-parsoid='{"autoInsertedEnd":true}'> there</td></tr>
26524 </tbody></table>
26525 !! end
26526
26527 # Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext
26528 !!test
26529 Empty TR followed by a template-generated TR
26530 !!options
26531 parsoid
26532 !! wikitext
26533 {|
26534 |-
26535 {{echo|<tr><td>foo</td></tr>}}
26536 |}
26537 !! html
26538 <table>
26539 <tbody>
26540 <tr class='mw-empty-elt'></tr>
26541 <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}}]}'>
26542 <td>foo</td></tr>
26543 </tbody></table>
26544 !!end
26545
26546 ## PHP and parsoid output differ for this, and since this is primarily
26547 ## for testing Parsoid's serializer, marking this Parsoid only
26548 !!test
26549 Empty TR followed by mixed-ws-comment line should RT correctly
26550 !!options
26551 parsoid
26552 !! wikitext
26553 {|
26554 |-
26555 <!--c-->
26556 |-
26557 <!--c--> <!--d-->
26558 |}
26559 !! html
26560 <table>
26561 <tbody>
26562 <tr class='mw-empty-elt'></tr>
26563 <!--c-->
26564 <tr>
26565 <!--c--> </tr><!--d-->
26566 </tbody></table>
26567
26568 !!end
26569
26570 !!test
26571 Multi-line image caption generated by templates with/without trailing newlines
26572 !! wikitext
26573 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
26574 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
26575 !! html/parsoid
26576 <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>
26577 <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>
26578 !!end
26579
26580 !! test
26581 New element inserted (without intervening newlines) after an old sol-transparent node should serialize correctly
26582 !! options
26583 parsoid=html2wt
26584 !! html/parsoid
26585 <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>
26586
26587 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{}'/><h1>new heading</h1>
26588 !! wikitext
26589 <includeonly>foo</includeonly>
26590 new para
26591
26592 [[Category:Foo]]
26593
26594 = new heading =
26595 !! end
26596
26597 ## PHP emits broken html for this, and since this is primarily
26598 ## a Parsoid serializer test, marking this Parsoid only
26599 !!test
26600 Improperly nested inline or quotes tags with whitespace in between
26601 !! wikitext
26602 <span> <s>x</span> </s>
26603 ''' ''x''' ''
26604 !! html/parsoid
26605 <p><span> <s>x</s></span><s> </s>
26606 <b> <i>x</i></b><i> </i>
26607 </p>
26608 !!end
26609
26610 !!test
26611 Encapsulate protected attributes from wt
26612 !! wikitext
26613 <div typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
26614
26615 {| typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true"
26616 | ok
26617 |}
26618 !! html/parsoid
26619 <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>
26620
26621 <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">
26622 <tbody><tr><td data-parsoid='{"autoInsertedEnd":true}'> ok</td></tr>
26623 </tbody></table>
26624 !!end
26625
26626 ## Currently the p-wrapper is fragile in how it adds / removes transformations.
26627 ## Having nested or stray pre tags results in the attempt to add duplicates,
26628 ## causing an assertion fail. This test tries to prevent that situation.
26629 !!test
26630 Ensure ParagraphWrapper can deal with stray closing pre tags
26631 !!options
26632 parsoid=wt2html
26633 !! wikitext
26634 plain text</pre>
26635 !! html/parsoid
26636 plain text
26637 !!end
26638
26639 !!test
26640 1. Ensure fostered text content is wrapped in element nodes
26641 !!options
26642 parsoid=wt2html
26643 !! wikitext
26644 <table>hi</table><table>ho</table>
26645 !! html/parsoid
26646 <p>hi</p>
26647 <table></table>
26648 <p>ho</p>
26649 <table></table>
26650 !!end
26651
26652 !!test
26653 2. Ensure fostered text content is wrapped in element nodes (traps regressions around fostered marker on the element getting lost)
26654 !!options
26655 parsoid=wt2html,wt2wt
26656 !! wikitext
26657 <table>
26658 <tr> || ||
26659 <td> a
26660 </table>
26661 !! html/parsoid
26662 <p> || ||
26663 </p><table>
26664 <tbody><tr><td> a</td></tr>
26665 </tbody></table>
26666 !!end
26667
26668 !!test
26669 Encapsulation properly handles null DSR information from foster box
26670 !!options
26671 parsoid=wt2html,wt2wt
26672 !! wikitext
26673 {{echo|<table>foo<tr><td>bar</td></tr></table>}}
26674 !! html/parsoid
26675 <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>
26676 !!end
26677
26678 !!test
26679 1. Encapsulate foster-parented transclusion content
26680 !!options
26681 parsoid=wt2wt,wt2html
26682 !! wikitext
26683 <table>{{echo|foo<tr><td>bar</td></tr>}}</table>
26684 !! html/parsoid
26685 <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>
26686 <tbody>
26687 <tr>
26688 <td>bar</td>
26689 </tr>
26690 </tbody>
26691 </table>
26692 !!end
26693
26694 !!test
26695 2. Encapsulate foster-parented transclusion content
26696 !!options
26697 parsoid=wt2wt,wt2html
26698 !! wikitext
26699 <table><div>{{echo|foo}}</div><tr><td>bar</td></tr></table>
26700 !! html/parsoid
26701 <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>
26702 <table>
26703 <tbody>
26704 <tr>
26705 <td>bar</td>
26706 </tr>
26707 </tbody>
26708 </table>
26709 !!end
26710
26711 !!test
26712 3. Encapsulate foster-parented transclusion content
26713 !!options
26714 parsoid=wt2wt,wt2html
26715 !! wikitext
26716 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
26717 !! html/parsoid
26718 <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;]}">
26719 <p>foo</p>
26720 </div>
26721 <table>
26722 <tbody>
26723 <tr>
26724 <td>bar</td>
26725 </tr>
26726 </tbody>
26727 </table>
26728 !!end
26729
26730 !!test
26731 4. Encapsulate foster-parented transclusion content
26732 !!options
26733 parsoid=wt2wt,wt2html
26734 !! wikitext
26735 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
26736 !! html/parsoid
26737 <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;]}">
26738 <p>foo</p>
26739 </div>
26740 <table>
26741 <tbody>
26742 <tr>
26743 <td>bar</td>
26744 </tr>
26745 </tbody>
26746 </table>
26747 !!end
26748
26749 !!test
26750 5. Encapsulate foster-parented transclusion content
26751 !!options
26752 parsoid=wt2wt,wt2html
26753 !! wikitext
26754 <table><tr><td><div><p>{{echo|foo</p></div></td>foo}}</tr></table>
26755 !! html/parsoid
26756 <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>
26757 <table>
26758 <tbody>
26759 <tr>
26760 <td>
26761 <div>
26762 <p>foo</p>
26763 </div>
26764 </td>
26765 </tr>
26766 </tbody>
26767 </table>
26768 !!end
26769
26770 !!test
26771 6. Encapsulate foster-parented transclusion content
26772 !!options
26773 parsoid=wt2wt,wt2html
26774 !! wikitext
26775 <table><tr><td><div><p>{{echo|foo</p></div></td>foo</tr></table>}}<p>ok</p>
26776 !! html/parsoid
26777 <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>
26778 <table>
26779 <tbody>
26780 <tr>
26781 <td>
26782 <div>
26783 <p>foo</p>
26784 </div>
26785 </td>
26786 </tr>
26787 </tbody>
26788 </table>
26789 <p>ok</p>
26790 !!end
26791
26792 !!test
26793 7. Encapsulate foster-parented transclusion content
26794 !!options
26795 parsoid=wt2wt,wt2html
26796 !! wikitext
26797 <table>{{echo|<p>foo</p>}}<td>bar</td></table>
26798 !! html/parsoid
26799 <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>
26800 <table>
26801 <tbody>
26802 <tr>
26803 <td>bar</td>
26804 </tr>
26805 </tbody>
26806 </table>
26807 !!end
26808
26809 # Note that the wt is broken on purpose: the = should be {{=}} if you
26810 # don't want it to be a template parameter key.
26811 !!test
26812 8. Encapsulate foster-parented transclusion content
26813 !!options
26814 parsoid=wt2wt,wt2html
26815 !! wikitext
26816 {{echo|a
26817 }}{|{{echo|style='color:red'}}
26818 |-
26819 |b
26820 |}
26821 !! html/parsoid
26822 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\n"}},"i":0}}]}'>a</p>
26823 <span> </span>
26824 <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>
26825 <table>
26826 <tbody>
26827 <tr>
26828 <td>b</td>
26829 </tr>
26830 </tbody>
26831 </table>
26832 !!end
26833
26834 !!test
26835 9. Encapsulate foster-parented transclusion content
26836 !!options
26837 parsoid=wt2wt,wt2html
26838 !! wikitext
26839 <table>{{echo|hi</table>hello}}
26840 !! html/parsoid
26841 <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>
26842 !!end
26843
26844 !!test
26845 Table in fosterable position
26846 !!options
26847 parsoid=wt2html
26848 !! wikitext
26849 {{OpenTable}}
26850 <div>
26851 {|
26852 |}
26853 </div>
26854 |}
26855 !! html/parsoid
26856 <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">
26857 </span>
26858 <table about="#mwt1" data-parsoid='{"autoInsertedEnd":true}'></table>
26859
26860 <table>
26861 </table>
26862 !!end
26863
26864 # Parsoid only for T66747
26865 !! test
26866 Properly encapsulate empty-content transclusions in fosterable positions
26867 !! wikitext
26868 <table>
26869 {{#if:|
26870 <td>foo</td>
26871 }}
26872 </table>
26873 !! html/parsoid
26874 <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"}]]}'>
26875
26876 </table>
26877 !! end
26878
26879 !! test
26880 Always encapsulate foster box when template range is expanded to table
26881 !! options
26882 parsoid=wt2wt
26883 !! wikitext
26884 {|
26885 hello
26886 {{OpenTable}}
26887 |}
26888 !! html/parsoid
26889
26890 !! end
26891
26892 !! test
26893 T115289: Unclosed table
26894 !! wikitext
26895 {{echo|<table>}}<!--c-->[[Category:Two]]
26896 !! html/parsoid
26897 <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>
26898 !! end
26899
26900 !! test
26901 T115289: Don't migrate newlines out of tables with fostered content
26902 !! wikitext
26903 <table><td></td>{{echo|<tr>[[Category:One]]}}<!--c-->[[Category:Two]]
26904 !! html/parsoid
26905 <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>
26906 !! end
26907
26908 !! test
26909 T73074: More fostering fun
26910 !! wikitext
26911 <table><td></td>{{echo|<tr>}}<!--c-->[[Category:Two]]
26912 !! html/parsoid
26913 <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>
26914 !! end
26915
26916 !!test
26917 Support <object> element with .data attribute
26918 !!options
26919 parsoid=html2wt
26920 !! html/parsoid
26921 <object data="test.swf"></object>
26922 !! wikitext
26923 <object data="test.swf"></object>
26924 !!end
26925
26926 !! test
26927 Don't block XML namespace declaration
26928 !! wikitext
26929 <span xmlns:dct="http://purl.org/dc/terms/" property="dct:title">MediaWiki</span>
26930 !! html/php
26931 <p><span xmlns:dct="http&#58;//purl.org/dc/terms/" property="dct:title">MediaWiki</span>
26932 </p>
26933 !! html/parsoid
26934 <p><span xmlns:dct="http://purl.org/dc/terms/" data-x-property="dct:title" data-parsoid='{"stx":"html"}'>MediaWiki</span></p>
26935 !! end
26936
26937 # -----------------------------------------------------------------
26938 # The following section of tests are primarily to spec requirements
26939 # around Parsoid's serialization (old, new, edited content)
26940 #
26941 # All these tests are marked Parsoid html2wt and html2html only
26942 # ----------------------------------------------------------------
26943
26944 !! test
26945 Ignore rel attribute in a-tags during serialization to url-links
26946 !! options
26947 parsoid=html2wt
26948 !! html/parsoid
26949 <a href='http://en.wikipedia.org/wiki/Foobar'>http://en.wikipedia.org/wiki/Foobar</a>
26950 <a href='http://en.wikipedia.org/wiki/Foobar' rel='mw:ExtLink'>http://en.wikipedia.org/wiki/Foobar</a>
26951 <a href='http://en.wikipedia.org/wiki/Foobar' rel='mw:WikiLink'>http://en.wikipedia.org/wiki/Foobar</a>
26952 !! wikitext
26953 http://en.wikipedia.org/wiki/Foobar
26954 http://en.wikipedia.org/wiki/Foobar
26955 http://en.wikipedia.org/wiki/Foobar
26956 !! end
26957
26958 # 'mi' is a localinterwiki prefix as well as a language
26959 !! test
26960 Serialize interwiki links pointing to the current wiki as plain wiki links (T67869)
26961 !! options
26962 parsoid=html2wt
26963 !! html/parsoid
26964 <p><a rel="mw:ExtLink" href="http://mi.wikipedia.org/wiki/Foo">Foo</a></p>
26965 !! wikitext
26966 [[Foo]]
26967 !! end
26968
26969 !! test
26970 Parsoid should accept interwiki shortcuts
26971 !! options
26972 parsoid=html2wt
26973 !! html/parsoid
26974 <p><a rel='mw:WikiLink' href='./fr:Foo'>Foo</a>
26975 <a rel='mw:ExtLink' href='./fr:Foo'>Foo</a>
26976 <a href='./fr:Foo'>Foo</a></p>
26977 <p><a rel='mw:WikiLink' href='fr%3AFoo'>Foo</a>
26978 <a rel='mw:ExtLink' href='fr%3AFoo'>Foo</a>
26979 <a href='fr%3AFoo'>Foo</a></p>
26980 <p><a href='FR%3AFoo'>Foo</a>
26981 <a href='./FR:Foo'>Foo</a></p>
26982 !! wikitext
26983 [[:fr:Foo|Foo]]
26984 [[:fr:Foo|Foo]]
26985 [[:fr:Foo|Foo]]
26986
26987 [[:fr:Foo|Foo]]
26988 [[:fr:Foo|Foo]]
26989 [[:fr:Foo|Foo]]
26990
26991 [[:fr:Foo|Foo]]
26992 [[:fr:Foo|Foo]]
26993 !! end
26994
26995 !! test
26996 Parsoid should not accept invalid interwiki shortcuts
26997 !! options
26998 parsoid=html2wt
26999 !! html/parsoid
27000 <p><a rel='mw:WikiLink' href='news:Foo'>Foo</a>
27001 <a rel='mw:ExtLink' href='news:Foo'>Foo</a>
27002 <a href='news:Foo'>Foo</a></p>
27003 !! wikitext
27004 [news:Foo Foo]
27005 [news:Foo Foo]
27006 [news:Foo Foo]
27007 !! end
27008
27009 # See T93839
27010 !! test
27011 New wikilinks should be serialized properly
27012 !! options
27013 parsoid=html2wt
27014 !! html/parsoid
27015 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{}'>Foo</a>
27016 <a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>
27017 <a href="//en.wikipedia.org/wiki/Foo">//en.wikipedia.org/wiki/Foo</a>
27018 <a href="http://en.wikipedia.org/wiki/Foo">http://en.wikipedia.org/wiki/Foo</a>
27019 <a href="//en.wikipedia.org/wiki/Foo_bar">//en.wikipedia.org/wiki/Foo bar</a>
27020 !! wikitext
27021 [[Foo]]
27022 [[Foo]]
27023 [[:en:Foo|//en.wikipedia.org/wiki/Foo]]
27024 http://en.wikipedia.org/wiki/Foo
27025 [[:en:Foo_bar|//en.wikipedia.org/wiki/Foo bar]]
27026 !! end
27027
27028 !! test
27029 New wiki links (href variations)
27030 !! options
27031 parsoid=html2wt
27032 !! html/parsoid
27033 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
27034 <a rel="mw:WikiLink" href="Foo_bar">Foo_bar</a>
27035 <a rel="mw:WikiLink" href="Foo bar">Foo_bar</a>
27036 <a rel="mw:WikiLink" href="./Toxine_bact%C3%A9rienne">Toxine bactérienne</a>
27037 !! wikitext
27038 [[Foo_bar]]
27039 [[Foo_bar]]
27040 [[Foo_bar]]
27041 [[Toxine bactérienne]]
27042 !! end
27043
27044 !! test
27045 New wiki links (content string variations)
27046 !! options
27047 parsoid=html2wt
27048 !! html/parsoid
27049 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
27050 <a rel="mw:WikiLink" href="./Foo_bar">Foo bar</a>
27051 <a rel="mw:WikiLink" href="./Foo_bar">./Foo_bar</a>
27052 !! wikitext
27053 [[Foo_bar]]
27054 [[Foo bar]]
27055 [[Foo_bar|./Foo_bar]]
27056 !! end
27057
27058 !! test
27059 New category links (href variations)
27060 !! options
27061 parsoid=html2wt
27062 !! html/parsoid
27063 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne" />
27064 <link rel="mw:PageProp/Category" href="./Category:Toxine_bact%C3%A9rienne" />
27065 <link rel="mw:PageProp/Category" href="Category:Toxine_bact%C3%A9rienne" />
27066 !! wikitext
27067 [[Category:Toxine bactérienne]]
27068 [[Category:Toxine bactérienne]]
27069 [[Category:Toxine bactérienne]]
27070 !! end
27071
27072 !! test
27073 New sol transparent links don't need indent-pre nowiki protection
27074 !! options
27075 parsoid=html2wt
27076 language=de
27077 !! html/parsoid
27078 <link rel="mw:PageProp/redirect" href="./Main_Page">
27079 <!-- this is good --> <link rel="mw:PageProp/Category" href="./Category:Good" />
27080 <!-- this is great --> <link rel="mw:PageProp/Category" href="./Kategorie:Great" />
27081 !! wikitext
27082 #WEITERLEITUNG [[Main Page]]
27083 <!-- this is good --> [[Category:Good]]
27084 <!-- this is great --> [[Kategorie:Great]]
27085 !! end
27086
27087 !! test
27088 New interlanguage links (href variations)
27089 !! options
27090 parsoid=html2wt
27091 !! html/parsoid
27092 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine bactérienne" />
27093 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bactérienne" />
27094 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bact%C3%A9rienne" />
27095 !! wikitext
27096 [[es:Toxine bactérienne]]
27097 [[es:Toxine_bactérienne]]
27098 [[es:Toxine_bactérienne]]
27099 !! end
27100
27101 !! test
27102 Image: Modifying size of an image (1)
27103 !! options
27104 parsoid={
27105 "modes": ["wt2wt"],
27106 "changes": [
27107 ["img[height]", "attr", "height", "22"],
27108 ["img[width]", "attr", "width", "200"]
27109 ]
27110 }
27111 !! wikitext
27112 [[Image:Foobar.jpg|230x230px]]
27113 !! wikitext/edited
27114 [[Image:Foobar.jpg|200x200px]]
27115 !!end
27116
27117 !! test
27118 Image: Modifying size of an image (2)
27119 !! options
27120 parsoid={
27121 "modes": ["wt2wt"],
27122 "changes": [
27123 ["img[height]", "attr", "height", "100"],
27124 ["img[width]", "attr", "width", "500"]
27125 ]
27126 }
27127 !! wikitext
27128 [[Image:Foobar.jpg|230x230px]]
27129 !! wikitext/edited
27130 [[Image:Foobar.jpg|500x500px]]
27131 !!end
27132
27133 # Change in size is ignored so long as class='mw-default-size'
27134 !! test
27135 Image: Modifying size of an image (3)
27136 !! options
27137 parsoid={
27138 "modes": ["wt2wt"],
27139 "changes": [
27140 ["figure[class]", "removeClass", "mw-default-size"],
27141 ["figure img", "attr", "height", "19"],
27142 ["figure img", "attr", "width", "170"]
27143 ]
27144 }
27145 !! wikitext
27146 [[Image:Foobar.jpg|thumb]]
27147 !! wikitext/edited
27148 [[Image:Foobar.jpg|thumb|170x170px]]
27149 !!end
27150
27151 !! test
27152 Image: Modifying alignment of an image (T50665)
27153 !! options
27154 parsoid={
27155 "modes": ["wt2wt"],
27156 "changes": [
27157 ["figure[class]", "removeClass", "mw-halign-right"],
27158 ["figure[class]", "addClass", "mw-halign-left"]
27159 ]
27160 }
27161 !! wikitext
27162 [[Image:Foobar.jpg|thumb|caption|right]]
27163 !! wikitext/edited
27164 [[Image:Foobar.jpg|thumb|caption|left]]
27165 !! end
27166
27167 !! test
27168 Image: Modifying mw-default-size of an frameless image (T64805)
27169 !! options
27170 parsoid={
27171 "modes": ["wt2wt"],
27172 "changes": [
27173 ["figure.mw-default-size", "removeClass", "mw-default-size"]
27174 ]
27175 }
27176 !! wikitext
27177 [[Image:Foobar.jpg|frameless|right]]
27178 !! wikitext/edited
27179 [[Image:Foobar.jpg|frameless|right|220x220px]]
27180 !! end
27181
27182 !! test
27183 Image: Modifying valign of an image (T51221)
27184 !! options
27185 parsoid={
27186 "modes": ["wt2wt"],
27187 "changes": [
27188 ["*[typeof=\"mw:Image\"]", "removeClass", "mw-valign-middle"],
27189 ["*[typeof=\"mw:Image\"]", "addClass", "mw-valign-text-top"]
27190 ]
27191 }
27192 !! wikitext
27193 [[File:Foobar.jpg|20px|middle]]
27194 !! wikitext/edited
27195 [[File:Foobar.jpg|20px|text-top]]
27196 !! end
27197
27198 !! test
27199 Image: Modifying alt attribute of an image (T58400)
27200 !! options
27201 parsoid={
27202 "modes": ["wt2wt"],
27203 "changes": [
27204 ["img[alt]", "attr", "alt", "some alternate edited text"]
27205 ]
27206 }
27207 !! wikitext
27208 [[File:Foobar.jpg|thumb|some caption|alt=some alternate text]]
27209 !! wikitext/edited
27210 [[File:Foobar.jpg|thumb|some caption|alt=some alternate edited text]]
27211 !!end
27212
27213 !! test
27214 Image: Modifying caption of an image
27215 !! options
27216 parsoid={
27217 "modes": ["wt2wt"],
27218 "changes": [
27219 ["figcaption", "text", "new caption"]
27220 ]
27221 }
27222 !! wikitext
27223 [[Image:Foobar.jpg|thumb|original caption]]
27224 !! wikitext/edited
27225 [[Image:Foobar.jpg|thumb|new caption]]
27226 !!end
27227
27228 !! test
27229 Image: empty alt attribute (T50924)
27230 !! options
27231 parsoid
27232 !! wikitext
27233 [[File:Foobar.jpg|thumb|alt=|bar]]
27234 !! html
27235 <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>
27236 !! end
27237
27238 !! test
27239 Image: new attributes should be serialized in wiki's language for RTL languages (T53852)
27240 !! options
27241 parsoid=html2wt
27242 language=ar
27243 disabled
27244 !! html/parsoid
27245 <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>
27246 !! wikitext
27247 [[Imagen:Foobar.jpg|derecha|miniaturadeimagen]]
27248 !! end
27249
27250 !! test
27251 Image: Block level image should have \n before and after
27252 !! wikitext
27253 123
27254 [[File:Foobar.jpg|right|thumb|150x150px]]
27255 456
27256 !! html/parsoid
27257 <p>123</p>
27258 <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>
27259 <p>456</p>
27260 !! end
27261
27262 !! test
27263 Image: New block level image should have \n before and after (existing content)
27264 !! wikitext
27265 123
27266 [[File:Foobar.jpg|right|thumb|150x150px]]
27267 456
27268 !! html/parsoid
27269 <p>123</p>
27270 <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>
27271 <p>456</p>
27272 !! end
27273
27274 !! test
27275 Image: upright option (parsoid)
27276 !! wikitext
27277 [[File:Foobar.jpg|thumb|upright|caption]]
27278 [[File:Foobar.jpg|thumb|upright=0.5|caption]]
27279 [[File:Foobar.jpg|thumb|500x500px|upright=0.5|caption]]
27280 !! html/parsoid
27281 <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>
27282 <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>
27283 <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>
27284 !! end
27285
27286 !! test
27287 Image: upright option is ignored on inline and frame images (parsoid)
27288 !! wikitext
27289 [[File:Foobar.jpg|500x500px|upright=0.5|caption]]
27290 !! html/parsoid
27291 <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>
27292 !! end
27293
27294 !! test
27295 Image: in template parameter with empty parameter
27296 !! wikitext
27297 {{echo|[[File:Foobar.jpg|link=]]}}
27298 !! html/parsoid
27299 <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>
27300 !! end
27301
27302 !! test
27303 Image: from basic HTML (1)
27304 !! options
27305 parsoid=html2wt
27306 !! html/parsoid
27307 <span typeof="mw:Image">
27308 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
27309 </span>
27310 !! wikitext
27311 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
27312 !! end
27313
27314 !! test
27315 Image: from basic HTML (2)
27316 !! options
27317 parsoid=html2wt
27318 !! html/parsoid
27319 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
27320 !! wikitext
27321 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
27322 !! end
27323
27324 !! test
27325 Image: from basic HTML (3)
27326 !! options
27327 parsoid=html2wt
27328 !! html/parsoid
27329 <a href="Main"><img src="./File:Foobar.jpg" width=100 height=100 alt="Alt"></a>
27330 !! wikitext
27331 [[File:Foobar.jpg|link=Main|alt=Alt|100x100px]]
27332 !! end
27333
27334 !! test
27335 Image: from basic HTML (4)
27336 !! options
27337 parsoid=html2wt
27338 !! html/parsoid
27339 <img src="./File:Foobar.jpg">
27340 !! wikitext
27341 [[File:Foobar.jpg|link=]]
27342 !! end
27343
27344 !! test
27345 Image: Invalid title as link
27346 !! wikitext
27347 [[File:Foobar.jpg|link=<]]
27348 !! html/php
27349 <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>
27350 </p>
27351 !! html/parsoid
27352 <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>
27353 !! end
27354
27355 !! test
27356 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
27357 !! options
27358 parsoid=html2wt
27359 !! html/parsoid
27360 <ul>
27361 <li><p>foo</p></li>
27362 </ul>
27363 !! wikitext
27364 * foo
27365 !! end
27366
27367 !! test
27368 Lists: Serialize correctly even when list tags has unneeded whitespace between tags
27369 !! options
27370 parsoid=html2wt
27371 !! html/parsoid
27372 <ul> <li>foo</li></ul>
27373 !! wikitext
27374 * foo
27375 !! end
27376
27377 !! test
27378 Don't strip leading whitespace when handling indent-pre suppressing tags
27379 !! options
27380 parsoid=html2wt
27381 !! html/parsoid
27382 <table>
27383 <tr><td> indented row</td></tr>
27384 </table>
27385 <blockquote><p>
27386 <b>This is very bold of you!</b>
27387 </p>
27388 <table><tr><td>
27389 indented cell (no pre-wrapping!)
27390 </td></tr></table>
27391 </blockquote>
27392 <p>foo</p>
27393 <div>bar</div>
27394 !! wikitext
27395 {|
27396 | indented row
27397 |}
27398 <blockquote>
27399 '''This is very bold of you!'''
27400
27401 {|
27402 |
27403 indented cell (no pre-wrapping!)
27404 |}
27405 </blockquote>
27406 foo
27407 <div>bar</div>
27408 !! end
27409
27410 !! test
27411 Nowiki-wrap leading whitespace when handling indent-pre inducing tags
27412 !! options
27413 parsoid=html2wt
27414 !! html/parsoid
27415 <p>foo</p>
27416 <span>bar</span>
27417
27418 <span>foo2
27419 </span>bar2
27420
27421 <div>foo</div>
27422 <span>bar</span>
27423
27424 <div>
27425 <span>foo</span>
27426 </div>
27427 !! wikitext
27428 foo
27429
27430 <span>bar</span>
27431
27432 <span>foo2
27433 <nowiki> </nowiki></span>bar2
27434
27435 <div>foo</div>
27436 <nowiki> </nowiki><span>bar</span>
27437
27438 <div>
27439 <nowiki> </nowiki><span>foo</span>
27440 </div>
27441 !! end
27442
27443 !! test
27444 Lists: Dont insert newlines in a serialized list item.
27445 !! options
27446 parsoid=html2wt
27447 !! html/parsoid
27448 <ul><li>a<br>b</li><li>c</li></ul>
27449 !! wikitext
27450 * a<br>b
27451 * c
27452 !! end
27453
27454 !! test
27455 1. Headings: Force sol-transparent links and behavior switches to serialize before/after
27456 !! options
27457 parsoid={
27458 "modes": ["html2wt"],
27459 "scrubWikitext": false
27460 }
27461 !! html/parsoid
27462 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
27463 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
27464
27465 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
27466 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
27467
27468 <h2 data-parsoid='{}'>howdy<link href="./Category:A5" rel="mw:PageProp/Category" /></h2>
27469
27470 <h2><meta property="mw:PageProp/toc" /> ok</h2>
27471 !! wikitext
27472 == hello there [[Category:A1]] ==
27473
27474 == [[Category:A2]] hi pal ==
27475
27476 == <!--foo--> [[Category:A3]] how goes it ==
27477
27478 == it goes well [[Category:A4]] <!--bar--> ==
27479
27480 ==howdy [[Category:A5]]==
27481
27482 == __TOC__ ok ==
27483 !! end
27484
27485 !! test
27486 2. Headings: Force sol-transparent links and behavior switches to serialize before/after
27487 !! options
27488 parsoid={
27489 "modes": ["html2wt"],
27490 "scrubWikitext": true
27491 }
27492 !! html/parsoid
27493 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
27494 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
27495
27496 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
27497 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
27498
27499 <h2><meta property="mw:PageProp/toc" /> ok</h2>
27500 !! wikitext
27501 == hello there ==
27502 [[Category:A1]]
27503 [[Category:A2]]
27504
27505 == hi pal ==
27506
27507 <!--foo--> [[Category:A3]]
27508
27509 == how goes it ==
27510
27511 == it goes well ==
27512 [[Category:A4]] <!--bar-->
27513
27514 __TOC__
27515
27516 == ok ==
27517 !! end
27518
27519 !! test
27520 Headings: Don't hoist metas that come from templates
27521 !! options
27522 parsoid={
27523 "modes": ["html2wt"],
27524 "scrubWikitext": true
27525 }
27526 !! html/parsoid
27527 <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>
27528 !! wikitext
27529 == {{echo|foo [[Category:Foo]]}} ==
27530 !! end
27531
27532 !! test
27533 Headings: Category in ref isn't hoisted
27534 !! options
27535 parsoid={
27536 "modes": ["html2wt"],
27537 "scrubWikitext": true
27538 }
27539 !! html/parsoid
27540 <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>
27541
27542 <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>
27543 !! wikitext
27544 == foo <ref>bar
27545 [[Category:Baz]] </ref> ==
27546
27547 <references />
27548 !! end
27549
27550 !! test
27551 Parsoid: Serialize positional parameters with = in them as named parameter
27552 !! options
27553 parsoid=html2wt
27554 !! html/parsoid
27555 <p about="#mwt1" typeof="mw:Transclusion"
27556 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
27557
27558 <p about="#mwt1" typeof="mw:Transclusion"
27559 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}, "2":{"wt":"bar"}},"i":0}}]}'>foo</p>
27560
27561 <!--Orig params with data-parsoid has heuristics for handling = chars-->
27562 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
27563 <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>
27564 !! wikitext
27565 {{echo|1=f=oo}}
27566
27567 {{echo|1=f=oo|2=bar}}
27568
27569 <!--Orig params with data-parsoid has heuristics for handling = chars-->
27570 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
27571 {{echo|<nowiki>f=oo</nowiki>|bar}}
27572 !! end
27573
27574 !! test
27575 Parsoid: Serialize positional parameters with = in extlink as named parameter
27576 !! options
27577 parsoid=html2wt
27578 !! html/parsoid
27579 <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>
27580 !! wikitext
27581 {{echo|1=http://stuff?is=ok}}
27582 !! end
27583
27584 !! test
27585 Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
27586 !! options
27587 parsoid=html2wt
27588 !! html/parsoid
27589 <div>a<p>b</p></div>
27590 <div>a
27591 <p>b</p></div>
27592 <div>
27593 a
27594 <p>b</p></div>
27595 !! wikitext
27596 <div>a
27597 b
27598 </div>
27599 <div>a
27600 b
27601 </div>
27602 <div>
27603 a
27604
27605 b
27606 </div>
27607 !! end
27608
27609 !! test
27610 Substrings resembling wikitext in hrefs should not get nowiki escapes
27611 !! options
27612 parsoid=html2wt
27613 !! html/parsoid
27614 <a rel="mw:WikiLink" href="./Foo''bar''baz">Foo''bar''baz</a>
27615 !! wikitext
27616 [[Foo''bar''baz]]
27617 !! end
27618
27619 !! test
27620 Enforce single-line context in the serializer
27621 !! options
27622 parsoid=html2wt
27623 !! html/parsoid
27624 <h2>testing
27625 123</h2>
27626
27627 <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">
27628 </span><span about="#mwt1">you</span> </h2>
27629
27630 <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>
27631
27632 <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
27633 there</span></li></ol>
27634
27635 <ul><li>asd
27636 sdf</li></ul>
27637
27638 <ul><li>foo
27639 bar
27640 baz</li>
27641 <li>foo <b>bar</b>
27642 baz</li></ul>
27643
27644 <dl><dt>hi
27645 ho </dt><dd data-parsoid='{"stx":"row"}'> hi
27646 ho</dd></dl>
27647
27648 <dl><dd> <table>
27649 <tbody><tr><td> ha
27650 ha
27651 ha</td></tr>
27652 </tbody></table></dd></dl>
27653 !! wikitext
27654 == testing 123 ==
27655
27656 == hi {{bogus|there
27657 you}} ==
27658
27659 == foo <ref>hello
27660 there</ref> ==
27661
27662 <references />
27663
27664 * asd sdf
27665
27666 * foo bar baz
27667 * foo '''bar''' baz
27668
27669 ; hi ho : hi ho
27670
27671 : {|
27672 | ha
27673 ha
27674 ha
27675 |}
27676 !! end
27677
27678 !! test
27679 Serialize new placeholder space without spans
27680 !! options
27681 parsoid=html2wt
27682 !! html/parsoid
27683 <p>foo<span typeof="mw:Placeholder"> </span>: bar</p>
27684
27685 <p>foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span>: bar</p>
27686
27687 <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>
27688 !! wikitext
27689 foo : bar
27690
27691 foo : bar
27692
27693 <ref>foo : bar</ref>ok
27694 !! end
27695
27696
27697 #-----------------------
27698 # Tag minimization tests
27699 #-----------------------
27700
27701 !! test
27702 1. I/B quote minimization: wikitext-only tags should be combined
27703 !! options
27704 parsoid=html2wt
27705 !! html/parsoid
27706 <p><i>A</i><i>B</i></p>
27707 <p><b>A</b><b>B</b></p>
27708 <p><i>A</i><b><i>B</i></b></p>
27709 <p><b>A</b><i><b>B</b></i></p>
27710 <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
27711 <p><i><b>A</b></i><i><b>B</b></i></p>
27712 <p><i><b>A</b></i><b><i>B</i></b></p>
27713 <p><b><i>A</i></b><i><b>B</b></i></p>
27714 !! wikitext
27715 ''AB''
27716
27717 '''AB'''
27718
27719 ''A'''B'''''
27720
27721 '''A''B'''''
27722
27723 '''A''BC''D'''
27724
27725 '''''AB'''''
27726
27727 '''''AB'''''
27728
27729 '''''AB'''''
27730 !! end
27731
27732 !! test
27733 2. I/B quote minimization: wikitext and html tags should not be combined
27734 !! options
27735 parsoid=html2wt
27736 !! html/parsoid
27737 <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
27738 <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
27739 !! wikitext
27740 ''A''<i>B</i>
27741
27742 ''A''<nowiki/>'''<i>B</i>'''
27743 !! end
27744
27745 !! test
27746 3. I/B quote minimization: templated content stops minimization
27747 !! options
27748 parsoid=html2wt
27749 !! html/parsoid
27750 <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>
27751 <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>
27752 !! wikitext
27753 ''A''{{echo|''B''}}
27754
27755 ''A''{{echo|'''''B'''''}}
27756 !! end
27757
27758 !! test
27759 4. I/B quote minimization: new content should be mimimized with adjacent old content
27760 !! options
27761 parsoid=html2wt
27762 !! html/parsoid
27763 <p><i>A</i><i>B</i></p>
27764 <p><b>A</b><b>B</b></p>
27765 <p><i>A</i><b><i>B</i></b></p>
27766 !! wikitext
27767 ''AB''
27768
27769 '''AB'''
27770
27771 ''A'''B'''''
27772 !! end
27773
27774 !! test
27775 5a. Merge adjacent quote nodes if they've been edited
27776 !! options
27777 parsoid={
27778 "modes": ["wt2wt", "selser"],
27779 "changes": [
27780 ["p", "contents", "remove", ":contains('b')"]
27781 ]
27782 }
27783 !! wikitext
27784 ''a''b''c''
27785 !! wikitext/edited
27786 ''ac''
27787 !! end
27788
27789 !! test
27790 5b. Merge adjacent quote nodes if they've been edited
27791 !! options
27792 parsoid={
27793 "modes": ["wt2wt", "selser"],
27794 "changes": [
27795 ["#x", "remove"]
27796 ]
27797 }
27798 !! wikitext
27799 ''a''<span id="x">b</span>''c''
27800 !! wikitext/edited
27801 ''ac''
27802 !! end
27803
27804 !! test
27805 1. Merge adjacent link nodes as long as at least one element is new
27806 !! options
27807 parsoid={
27808 "modes": ["html2wt"],
27809 "scrubWikitext": true
27810 }
27811 !! html/parsoid
27812 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
27813 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
27814 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a data-parsoid="{}" rel="mw:WikiLink" href="./Football">ball</a>
27815 !! wikitext
27816 [[Football]]
27817 [[Football]]
27818 [[Football|Foot]][[Football|ball]]
27819 !! end
27820
27821 !! test
27822 2. Merge adjacent link nodes and enable additional normalizations
27823 !! options
27824 parsoid={
27825 "modes": ["html2wt"],
27826 "scrubWikitext": true
27827 }
27828 !! html/parsoid
27829 <a rel="mw:WikiLink" href="./Football"><i>Foot</i></a><a rel="mw:WikiLink" href="./Football"><i>ball</i></a>
27830 !! wikitext
27831 [[Football|''Football'']]
27832 !! end
27833
27834 !! test
27835 3. Don't merge adjacent link nodes if scrubWikitext is false
27836 !! options
27837 parsoid={
27838 "modes": ["html2wt"],
27839 "scrubWikitext": false
27840 }
27841 !! html/parsoid
27842 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
27843 !! wikitext
27844 [[Football|Foot]][[Football|ball]]
27845 !! end
27846
27847 #------------------------------
27848 # End of tag minimization tests
27849 #------------------------------
27850
27851 !!test
27852 T56262: New entities
27853 !! options
27854 parsoid=html2wt
27855 !! html/parsoid
27856 <span typeof="mw:Entity">&nbsp;</span>
27857 !! wikitext
27858 &nbsp;
27859 !! end
27860
27861 ## Note that there is no wikitext output for 'unknownproperty' ##
27862 ## Unknown magic words are silently dropped ##
27863
27864 !! test
27865 Magic words
27866 !! options
27867 parsoid=html2wt
27868 !! html/parsoid
27869 <meta property='mw:PageProp/toc' />
27870 <meta property='mw:PageProp/notoc' />
27871 <meta property='mw:PageProp/forcetoc' />
27872 <meta property='mw:PageProp/index' />
27873 <meta property='mw:PageProp/noindex' />
27874 <meta property='mw:PageProp/nogallery' />
27875 <meta property='mw:PageProp/noeditsection' />
27876 <meta property='mw:PageProp/notitleconvert' />
27877 <meta property='mw:PageProp/nocontentconvert' />
27878 <meta property='mw:PageProp/unknownproperty' />
27879 !! wikitext
27880 __TOC__
27881 __NOTOC__
27882 __FORCETOC__
27883 __INDEX__
27884 __NOINDEX__
27885 __NOGALLERY__
27886 __NOEDITSECTION__
27887 __NOTITLECONVERT__
27888 __NOCONTENTCONVERT__
27889 !! end
27890
27891 !! test
27892 Consecutive <pre>s should not get merged
27893 !! options
27894 parsoid=html2wt,html2html
27895 !! html/parsoid
27896 <pre>a</pre><pre>b</pre>
27897
27898 <pre>c
27899 </pre><pre>
27900 d</pre>
27901
27902 <pre>e
27903
27904 </pre><pre>
27905
27906 f</pre>
27907 !! wikitext
27908 a
27909
27910 b
27911
27912 c
27913
27914 d
27915
27916 e
27917
27918
27919
27920 f
27921 !! end
27922
27923 !! test
27924 Edited ISBN links not serializable as ISBN links should serialize as wikilinks
27925 !! options
27926 parsoid=html2wt
27927 !! html/parsoid
27928 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink">ISBN 1234567895</a>
27929 !! wikitext
27930 [[Special:BookSources/1234567890|ISBN 1234567895]]
27931 !! end
27932
27933 !! test
27934 Edited RFC links not serializable as RFC links should serialize as extlinks
27935 !! options
27936 parsoid=html2wt
27937 !! html/parsoid
27938 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink">New RFC</a>
27939 !! wikitext
27940 [//tools.ietf.org/html/rfc123 New RFC]
27941 !! end
27942
27943 !! test
27944 Edited PMID links not serializable as PMID links should serialize as extlinks
27945 !! options
27946 parsoid=html2wt
27947 !! html/parsoid
27948 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink">New PMID</a>
27949 !! wikitext
27950 [//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract New PMID]
27951 !! end
27952
27953 !! test
27954 WTS of autolinks with trailing/surrounding context
27955 !! options
27956 parsoid=html2wt
27957 !! html/parsoid
27958 <p><a href="http://cscott.net">http://cscott.net</a><b>foo</b></p>
27959 <p><a href="http://cscott.net">http://cscott.net</a><b data-parsoid='{"stx":"html"}'>foo</b></p>
27960 <p><b><a href="http://cscott.net">http://cscott.net</a></b></p>
27961 <p><b><a href="http://cscott.net">http://cscott.net</a> </b></p>
27962 <p><b><a href="http://cscott.net">http://cscott.net</a>x</b></p>
27963 <p><a href="http://cscott.net">http://cscott.net</a>x</p>
27964 !! wikitext
27965 http://cscott.net'''foo'''
27966
27967 http://cscott.net<b>foo</b>
27968
27969 '''http://cscott.net'''
27970
27971 '''http://cscott.net '''
27972
27973 '''http://cscott.net<nowiki/>x'''
27974
27975 http://cscott.net<nowiki/>x
27976 !! end
27977
27978 !! test
27979 WTS of autolinks with nowikis (round-trip)
27980 !! wikitext
27981 x<nowiki/>http://cscott.net<nowiki/>x
27982 !! html/parsoid
27983 <p>x<a rel="mw:ExtLink" href="http://cscott.net">http://cscott.net</a>x</p>
27984 !! end
27985
27986 # this is the "easy" test because it leaves in place all the
27987 # data-parsoid information indicating this is an autolink
27988 !! test
27989 WTS of autolinks with escapes (editing)
27990 !! options
27991 parsoid={
27992 "modes": ["wt2wt"],
27993 "changes": [
27994 [ "span", "remove" ]
27995 ]
27996 }
27997 !! wikitext
27998 x<nowiki/>http://cscott.net<nowiki/>x
27999 !! wikitext/edited
28000 x<nowiki/>http://cscott.net<nowiki/>x
28001 !! end
28002
28003 !! test
28004 WTS of edited autolink-like text (T103364)
28005 !! options
28006 parsoid={
28007 "modes": ["wt2wt"],
28008 "changes": [
28009 [ "span[typeof]", "removeAttr", "typeof" ]
28010 ]
28011 }
28012 !! wikitext
28013 Not a link: <nowiki>http://example.com</nowiki>.
28014 !! wikitext/edited
28015 Not a link: <span><nowiki>http://example.com</nowiki></span>.
28016 !! end
28017
28018 !! test
28019 WTS of newly-authored autolink-like text (T103364)
28020 !! options
28021 parsoid=html2wt
28022 !! html/parsoid
28023 <p>http://example.com is not a link.</p>
28024 !! wikitext
28025 <nowiki>http://example.com</nowiki> is not a link.
28026 !! end
28027
28028 !! test
28029 WTS of autolink-like text after an autolink (T108563)
28030 !! options
28031 parsoid=html2wt
28032 !! html/parsoid
28033 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a> http://example.com is not a link.</p>
28034 !! wikitext
28035 http://example.com <nowiki>http://example.com</nowiki> is not a link.
28036 !! end
28037
28038 !! test
28039 Magic links inside links (not autolinked)
28040 !! wikitext
28041 [[Foo|http://example.com]]
28042 [[Foo|RFC 1234]]
28043 [[Foo|PMID 1234]]
28044 [[Foo|ISBN 123456789x]]
28045
28046 [http://foo.com http://example.com]
28047 [http://foo.com RFC 1234]
28048 [http://foo.com PMID 1234]
28049 [http://foo.com ISBN 123456789x]
28050 !! html+tidy
28051 <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>
28052 <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>
28053 !! html/parsoid
28054 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">http://example.com</a>
28055 <a rel="mw:WikiLink" href="./Foo" title="Foo">RFC 1234</a>
28056 <a rel="mw:WikiLink" href="./Foo" title="Foo">PMID 1234</a>
28057 <a rel="mw:WikiLink" href="./Foo" title="Foo">ISBN 123456789x</a></p>
28058
28059 <p><a rel="mw:ExtLink" href="http://foo.com">http://example.com</a>
28060 <a rel="mw:ExtLink" href="http://foo.com">RFC 1234</a>
28061 <a rel="mw:ExtLink" href="http://foo.com">PMID 1234</a>
28062 <a rel="mw:ExtLink" href="http://foo.com">ISBN 123456789x</a></p>
28063 !! end
28064
28065 !! test
28066 Magic links inside image captions (autolinked)
28067 !! wikitext
28068 [[File:Foobar.jpg|thumb|http://example.com]]
28069 [[File:Foobar.jpg|thumb|RFC 1234]]
28070 [[File:Foobar.jpg|thumb|PMID 1234]]
28071 [[File:Foobar.jpg|thumb|ISBN 123456789x]]
28072 !! html+tidy
28073 <div class="thumb tright">
28074 <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>
28075 <div class="thumbcaption">
28076 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
28077 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></div>
28078 </div>
28079 </div>
28080 <div class="thumb tright">
28081 <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>
28082 <div class="thumbcaption">
28083 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
28084 <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a></div>
28085 </div>
28086 </div>
28087 <div class="thumb tright">
28088 <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>
28089 <div class="thumbcaption">
28090 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
28091 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a></div>
28092 </div>
28093 </div>
28094 <div class="thumb tright">
28095 <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>
28096 <div class="thumbcaption">
28097 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
28098 <a href="/wiki/Special:BookSources/123456789X" class="internal mw-magiclink-isbn">ISBN 123456789x</a></div>
28099 </div>
28100 </div>
28101 !! html/parsoid
28102 <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>
28103 <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>
28104 <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>
28105 <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>
28106 !! end
28107
28108 !! test
28109 WTS of magic word text (T109371)
28110 !! options
28111 parsoid=html2wt
28112 !! html/parsoid
28113 <p>RFC 1234</p>
28114 <p><a href="http://foo.com" rel="mw:ExtLink">RFC 1234</a></p>
28115 <p><a href="./Foo" rel="mw:WikiLink">RFC 1234</a></p>
28116 !! wikitext
28117 <nowiki>RFC 1234</nowiki>
28118
28119 [http://foo.com RFC 1234]
28120
28121 [[Foo|RFC 1234]]
28122 !! end
28123
28124 !! test
28125 Edited Redirect link should emit a non-piped wikitext link
28126 !! options
28127 parsoid=html2wt
28128 !! html/parsoid
28129 <link rel="mw:PageProp/redirect" href="Bar" data-parsoid='{"a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>
28130 !! wikitext
28131 #REDIRECT [[Bar]]
28132 !! end
28133
28134 !! test
28135 T75121: Infer extension name from typeOf if data-mw is not present
28136 !! options
28137 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
28138 !! html/parsoid
28139 <div typeOf="mw:Extension/foo"></div>
28140 !! wikitext
28141 <foo />
28142 !! end
28143
28144 # Note that the <p> wrapping isn't present in PHP parser output
28145 # The important thing for this test is that P-wrapping doesn't
28146 # interfere with the <nowiki> protection for leading - in <td>
28147 # (which isn't necessary for <th>).
28148 !! test
28149 T88318: p-wrapped dash in table.
28150 !! options
28151 parsoid=html2wt,wt2wt
28152 !! html/parsoid
28153 <table><tbody>
28154 <tr><th><p>-</p></th><th><p>- </p></th></tr>
28155 <tr><td><p>-</p></td><td><p>- </p></td></tr>
28156 <tr><td><small>-</small></td><td><br/><p>-</p></td><td><br/>-</td></tr>
28157 </tbody></table>
28158 !! wikitext
28159 {|
28160 !-
28161 !-
28162 |-
28163 |<nowiki>-</nowiki>
28164 |<nowiki>- </nowiki>
28165 |-
28166 |<small>-</small>
28167 |<br>
28168 -
28169 |<br>
28170 -
28171 |}
28172 !! html/php+tidy
28173 <table>
28174 <tr>
28175 <th>-</th>
28176 <th>-</th>
28177 </tr>
28178 <tr>
28179 <td>-</td>
28180 <td>-</td>
28181 </tr>
28182 <tr>
28183 <td><small>-</small></td>
28184 <td><br />
28185 <p>-</p>
28186 </td>
28187 <td><br />
28188 <p>-</p>
28189 </td>
28190 </tr>
28191 </table>
28192 !! end
28193
28194 !! test
28195 T149209: WTS: Handle newlines in table cells properly
28196 !! options
28197 parsoid=html2wt
28198 !! html/parsoid
28199 <table>
28200 <tbody>
28201 <tr><td>a
28202 b
28203 </td><td data-parsoid='{"stx_v":"row"}'>c</td></tr>
28204 <tr><td><p>x</p>
28205 </td><td data-parsoid='{"stx_v":"row", "startTagSrc": "{{!}}{{!}}"}'>y</td></tr>
28206 </tbody></table>
28207 <table>
28208 <tbody>
28209 <tr><th>a
28210 b
28211 </th><th data-parsoid='{"stx_v":"row"}'>c</th></tr>
28212 <tr><th><p>x</h>
28213 </th><th data-parsoid='{"stx_v":"row"}'>y</th></tr>
28214 </tbody></table>
28215 !! wikitext
28216 {|
28217 |a
28218 b
28219 |c
28220 |-
28221 |x
28222 {{!}}y
28223 |}
28224 {|
28225 !a
28226 b
28227 !c
28228 |-
28229 !x
28230 !y
28231 |}
28232 !! end
28233
28234 !! test
28235 T149209: Selser: Handle newlines in table cells properly
28236 !! options
28237 parsoid={
28238 "modes": ["selser"],
28239 "changes": [
28240 [ "#h1", "html", "a\nb\n" ],
28241 [ "#h2", "html", "a\nb\n" ],
28242 [ "#c1", "html", "a\nb\n" ],
28243 [ "#c2", "html", "<p>a</p>" ],
28244 [ "#c3", "html", "<p>a</p>" ],
28245 [ "#c4", "html", "edit-me<p>a</p>" ]
28246 ]
28247 }
28248 !! wikitext
28249 {|
28250 ! id="h1" |edit-me!!1
28251 |-
28252 ! id="h2" |edit-me||2
28253 |-
28254 | id="c1" |edit-me||3
28255 |-
28256 | id="c2" |edit-me||4
28257 |-
28258 | id="c3" |edit-me||p||q||r
28259 |-
28260 | id="c4" |edit-me||p||q||r
28261 |}
28262 !! wikitext/edited
28263 {|
28264 ! id="h1" |a
28265 b
28266 !1
28267 |-
28268 ! id="h2" |a
28269 b
28270 !2
28271 |-
28272 | id="c1" |a
28273 b
28274 |3
28275 |-
28276 | id="c2" |a
28277 |4
28278 |-
28279 | id="c3" |a
28280 |p||q||r
28281 |-
28282 | id="c4" |edit-me
28283 a
28284 |p||q||r
28285 |}
28286 !! end
28287
28288 !! test
28289 HTML id attribute with Parsoid-like element ids should not be serialized to wikitext
28290 !! options
28291 parsoid=html2wt
28292 !! html/parsoid
28293 <table id='mwAb'>
28294 <td id='mwAc'>foo</td>
28295 <td id='serialize-this'>bar</td>
28296 </table>
28297 !! wikitext
28298 {|
28299 |foo
28300 | id="serialize-this" |bar
28301 |}
28302 !! end
28303
28304 !! test
28305 Parsoid-like element ids should not be serialized to wikitext unless shadowed
28306 !! options
28307 parsoid=html2wt
28308 !! html/parsoid
28309 <div id="mwAQ" data-parsoid='{"stx":"html","a":{"id":"mwAQ"},"sa":{"id":"hello"}}'>ok</div>
28310 !! wikitext
28311 <div id="hello">ok</div>
28312 !! end
28313
28314 !! test
28315 WTS change modes
28316 !! options
28317 parsoid={
28318 "modes": ["wt2wt"],
28319 "changes": [
28320 [ "#xyz", "before", "<b>before</b> stuff " ],
28321 [ "#xyz", "after", " stuff <i>after</i>" ],
28322 [ "#xyz", "html", "x <b>y</b> z" ]
28323 ]
28324 }
28325 !! wikitext
28326 <span id="xyz">hello</span>
28327 !! wikitext/edited
28328 '''before''' stuff <span id="xyz">x '''y''' z</span> stuff ''after''
28329 !! end
28330
28331 !! test
28332 Never serialize a-tag as html, regardless of what data-parsoid has to say
28333 !! options
28334 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
28335 !! html/parsoid
28336 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"html"}'>Foo</a>
28337 !! wikitext
28338 [[Foo]]
28339 !! end
28340
28341 ## SSS FIXME: This is broken output nevertheless.
28342 ## What might be a reasonable non-broken output for this?
28343 ## This is an edge case unlikely to be seen in production
28344 ## that I am not wasting more time on this right now.
28345 !! test
28346 Never serialize a-tag as html, no matter what attributes it has
28347 !! options
28348 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
28349 !! html/parsoid
28350 <a bad='true' href='http://boo.org'><img src='http://boohoo.org' /></a>
28351 !! wikitext
28352 [http://boo.org http://boohoo.org]
28353 !! end
28354
28355 # Misnested is an indication that selser can reuse the source but these have
28356 # shown to sneak through on occasion. See T101768.
28357 # The original wikitext here is: [http://test.com [[one]] two three]
28358 !! test
28359 Strip span tags added to mark misnested links
28360 !! options
28361 parsoid=html2wt
28362 !! html/parsoid
28363 <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>
28364 !! wikitext
28365 [http://test.com][[one]] two three
28366 !! end
28367
28368 !! test
28369 Catch regression when unpacking misnested links
28370 !! options
28371 parsoid=wt2html
28372 !! wikitext
28373 {{echo|hi}}[http://example.com [[ho]]]
28374 !! html/parsoid
28375 <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>
28376 !! end
28377
28378 !! test
28379 Use data-parsoid.firstWikitextNode to compute newline constraints for template content
28380 !! options
28381 parsoid=html2wt
28382 !! html/parsoid
28383 <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|}"]}'>
28384 <tbody><tr><td>d
28385 </td></tr>
28386 </tbody></table>
28387 !! wikitext
28388 {{echo|a}}
28389 {|{{echo|c
28390 {{!}}d
28391 }}
28392 |}
28393 !! end
28394
28395 ## This test verifies the presence and computation of this attribute indirectly
28396 ## by making an edit and ensuring that the serialization is correct (which it would be
28397 ## only if firstWikitextNode is properly set).
28398 !! test
28399 data-parsoid.firstWikitextNode should be computed properly in the presence of fostered content
28400 !! options
28401 parsoid= {
28402 "modes": ["wt2wt"],
28403 "changes": [
28404 [ "div#x", "remove" ],
28405 [ "div", "before", "<div>new</div>" ]
28406 ]
28407 }
28408 !! wikitext
28409 <div id="x">foo</div>
28410 {|
28411 {{echo|<div>boo</div>
28412 {{!}}b}}
28413 |c
28414 |}
28415 !! wikitext/edited
28416
28417 <div>new</div>
28418 {|
28419 {{echo|<div>boo</div>
28420 {{!}}b}}
28421 |c
28422 |}
28423 !! end
28424
28425 # --------------------------------------------
28426 # Tests spec'ing wikitext serialization norms |
28427 # --------------------------------------------
28428
28429 !! test
28430 Serialize multi-line indent-pre starting with wikitext syntax
28431 !! options
28432 parsoid=html2wt
28433 !! html/parsoid
28434 <pre>* 1
28435 ** 2
28436 * 3</pre>
28437 !! wikitext
28438 * 1
28439 ** 2
28440 * 3
28441 !! end
28442
28443 !! test
28444 1. Categories should always be serialized on their own line
28445 !! options
28446 parsoid=html2wt
28447 !! html/parsoid
28448 foo<link rel="mw:PageProp/Category" href="./Category:Foo">bar
28449 !! wikitext
28450 foo
28451 [[Category:Foo]]
28452 bar
28453 !! end
28454
28455 !! test
28456 2. Categories that are part of templates should not introduce a line break
28457 !! wikitext
28458 foo {{echo|<span>bar</span> [[Category:baz]]}} bar
28459 !! html/parsoid
28460 <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>
28461 !! end
28462
28463 # Careful while editing these next 2 tests. There are \u200f characters
28464 # before and after the <link> tags in the HTML and following some
28465 # of the categories in wikitext
28466 # Do not remove these characters in edits.
28467 #
28468 # As part of the serialization, these bidi characters will get stripped.
28469 !! test
28470 RTL (\u200f) and LTR (\u200e) markers around category tags should be stripped
28471 !! options
28472 parsoid={
28473 "modes": ["html2wt"],
28474 "scrubWikitext": true
28475 }
28476 !! html/parsoid
28477 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏
28478 ‏<link rel="mw:PageProp/Category" href="./קטגוריה:_שיטות_משפט" />‏</p>
28479 !! wikitext
28480 [[קטגוריה:טקסים]]
28481 [[קטגוריה: שיטות משפט]]
28482 !! end
28483
28484 !! test
28485 RTL (\u200f) and LTR (\u200e) markers should not be stripped if followed by a text node
28486 !! options
28487 parsoid={
28488 "modes": ["html2wt"],
28489 "scrubWikitext": true
28490 }
28491 !! html/parsoid
28492 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏y</p>
28493 !! wikitext
28494 [[קטגוריה:טקסים]]
28495 ‏y
28496 !! end
28497
28498 !! test
28499 Lists: Add space after bullets
28500 !! options
28501 parsoid=html2wt
28502 !! html/parsoid
28503 <ul>
28504 <li>foo</li>
28505 <li> bar</li>
28506 <li><span> baz</span></li>
28507 </ul>
28508 !! wikitext
28509 * foo
28510 * bar
28511 * <span> baz</span>
28512 !! end
28513
28514 !! test
28515 1. Headings: Add space before/after == (T53744)
28516 !! options
28517 parsoid=html2wt
28518 !! html/parsoid
28519 <h2>foo</h2>
28520 <h2> bar</h2>
28521 <h2>baz </h2>
28522 <h2><span> baz</span></h2>
28523 !! wikitext
28524 == foo ==
28525
28526 == bar ==
28527
28528 == baz ==
28529
28530 == <span> baz</span> ==
28531 !! end
28532
28533 !! test
28534 2. Headings: Add space before/after == even after hoisted content
28535 !! options
28536 parsoid={
28537 "modes": ["html2wt"],
28538 "scrubWikitext": true
28539 }
28540 !! html/parsoid
28541 <h2> <link href="./Category:A2" rel="mw:PageProp/Category" />ok</h2>
28542 !! wikitext
28543 [[Category:A2]]
28544
28545 == ok ==
28546 !! end
28547
28548 !! test
28549 1. Headings: suppress newly created empty headings
28550 !! options
28551 parsoid={
28552 "modes": ["html2wt"],
28553 "scrubWikitext": true
28554 }
28555 !! html/parsoid
28556 <h2></h2>
28557 !! wikitext
28558 !! end
28559
28560 !! test
28561 2. Headings: don't suppress empty headings if scrubWikitext is false
28562 !! options
28563 parsoid=html2wt
28564 !! html/parsoid
28565 <h2></h2>
28566 !! wikitext
28567 ==<nowiki/>==
28568 !! end
28569
28570 !! test
28571 3. Headings: suppress empty headings on edits
28572 !! options
28573 parsoid={
28574 "modes": ["selser"],
28575 "scrubWikitext": true,
28576 "changes": [
28577 [ "#x", "remove"]
28578 ]
28579 }
28580 !! wikitext
28581 ==<span id="x">foo</span>==
28582 !! wikitext/edited
28583 !! end
28584
28585 !! test
28586 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = true)
28587 !! options
28588 parsoid={
28589 "modes": ["html2wt"],
28590 "scrubWikitext": true
28591 }
28592 !! html/parsoid
28593 <h2>foo<br/>bar</h2>
28594 <h2>foo <span><br/>bar</span> baz</h2>
28595 !! wikitext
28596 == foo bar ==
28597
28598 == foo <span> bar</span> baz ==
28599 !! end
28600
28601 !! test
28602 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = false)
28603 !! options
28604 parsoid={
28605 "modes": ["html2wt"],
28606 "scrubWikitext": false
28607 }
28608 !! html/parsoid
28609 <h2>foo<br/>bar</h2>
28610 !! wikitext
28611 == foo<br> bar ==
28612 !! end
28613
28614 !! test
28615 1. WT Quote Tags: suppress newly created empty style tags
28616 !! options
28617 parsoid={
28618 "modes": ["html2wt"],
28619 "scrubWikitext": true
28620 }
28621 !! html/parsoid
28622 <i></i><b></b>
28623 !! wikitext
28624 !! end
28625
28626 !! test
28627 2. WT Quote Tags: don't suppress empty style tags if scrubWikitext is false
28628 !! options
28629 parsoid=html2wt
28630 !! html/parsoid
28631 <i></i><b></b>
28632 !! wikitext
28633 ''<nowiki/>'''''<nowiki/>'''
28634 !! end
28635
28636 !! test
28637 3. WT Quote Tags: suppress empty style tags on edits
28638 !! options
28639 parsoid={
28640 "modes": ["selser"],
28641 "scrubWikitext": true,
28642 "changes": [
28643 [ "#x", "remove"]
28644 ]
28645 }
28646 !! wikitext
28647 '''<span id="x">foo</span>'''
28648 !! wikitext/edited
28649 !! end
28650
28651 !! test
28652 1. Anchors: suppress newly created empty anchors
28653 !! options
28654 parsoid={
28655 "modes": ["html2wt"],
28656 "scrubWikitext": true
28657 }
28658 !! html/parsoid
28659 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
28660 !! wikitext
28661 !! end
28662
28663 !! test
28664 2. Anchors: don't suppress empty anchors if scrubWikitext is false
28665 !! options
28666 parsoid={
28667 "modes": ["html2wt"],
28668 "scrubWikitext": false
28669 }
28670 !! html/parsoid
28671 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
28672 !! wikitext
28673 [[Test|<nowiki/>]]
28674 !! end
28675
28676 !! test
28677 3. Anchors: suppress empty anchors on edits
28678 !! options
28679 parsoid={
28680 "modes": ["selser"],
28681 "scrubWikitext": true,
28682 "changes": [
28683 [ "#x", "remove"]
28684 ]
28685 }
28686 !! wikitext
28687 [[Test|<span id="x">foo</span>]]
28688 !! wikitext/edited
28689 !! end
28690
28691 !! test
28692 3a. Anchors: do not suppress numbered extlinks
28693 !! options
28694 parsoid={
28695 "modes": ["wt2wt"],
28696 "scrubWikitext": true
28697 }
28698 !! wikitext
28699 [http://foo.com]
28700 !! html/parsoid
28701 <a rel="mw:ExtLink" href="http://foo.com"></a>
28702 !! end
28703
28704 !! test
28705 3b. Anchors: do not suppress numbered extlinks
28706 !! options
28707 parsoid={
28708 "modes": ["wt2wt"],
28709 "scrubWikitext": true,
28710 "changes": [
28711 [ "#x", "remove"]
28712 ]
28713 }
28714 !! wikitext
28715 [http://foo.com <span id="x">foo</span>]
28716 !! wikitext/edited
28717 [http://foo.com]
28718 !! end
28719
28720 !!test
28721 Normalizations should be restricted to edited content
28722 !!options
28723 parsoid={
28724 "modes": ["selser"],
28725 "scrubWikitext": true,
28726 "changes": [
28727 [ "h1", "before", "<i></i>"]
28728 ]
28729 }
28730 !!wikitext
28731 a
28732 = =
28733 b
28734 !!wikitext/edited
28735 a
28736 = =
28737 b
28738 !!end
28739
28740 !! test
28741 1. Multiple normalizations (html2wt)
28742 !! options
28743 parsoid={
28744 "modes": ["html2wt"],
28745 "scrubWikitext": true
28746 }
28747 !! html
28748 <h2><i></i></h2>
28749 <p><a href='Foo' rel='mw:WikiLink'>foo<i></i>
28750 </a><b><i></i></b>x</p>
28751 !! wikitext
28752
28753 [[foo]]
28754 x
28755
28756 !! end
28757
28758 !! test
28759 2. Multiple normalizations (selser)
28760 !! options
28761 parsoid={
28762 "modes": ["selser"],
28763 "scrubWikitext": true,
28764 "changes": [
28765 [ "#x", "after", "<h1><i></i></h1>\n<p> x<b></b></p>"]
28766 ]
28767 }
28768 !! wikitext
28769 <span id="x">foo</span>
28770 !! wikitext/edited
28771 <span id="x">foo</span>
28772
28773 x
28774 !! end
28775
28776 !! test
28777 1. Indent Pre Nowiki: suppress whitespace at the start of new paragraph
28778 !! options
28779 parsoid={
28780 "modes": ["html2wt"],
28781 "scrubWikitext": true
28782 }
28783 !! html/parsoid
28784 <p> hi</p>
28785 <p> hello</p>
28786 !! wikitext
28787 hi
28788
28789 hello
28790 !! end
28791
28792 !! test
28793 2. Indent Pre Nowiki: don't suppress whitespace at the start of new paragraph if scrubWikitext is false
28794 !! options
28795 parsoid=html2wt
28796 !! html/parsoid
28797 <p> hi</p>
28798 <p> hello</p>
28799 !! wikitext
28800 <nowiki> </nowiki>hi
28801
28802 <nowiki> </nowiki> hello
28803 !! end
28804
28805 !! test
28806 3. Indent Pre Nowiki: suppress whitespace after newlines in new paragraph or table cell
28807 !! options
28808 parsoid={
28809 "modes": ["html2wt"],
28810 "scrubWikitext": true
28811 }
28812 !! html/parsoid
28813 <p>Foo
28814 bar
28815 baz</p>
28816
28817 <table><tr><td>Foo
28818 bar
28819 baz bang</td></tr></table>
28820
28821 <p><!--boo--> foo
28822 bar</p>
28823
28824 <p> foo
28825 bar<span>boo</span></p>
28826 !! wikitext
28827 Foo
28828 bar
28829 baz
28830
28831 {|
28832 |Foo
28833 bar
28834 baz bang
28835 |}
28836
28837 <!--boo-->foo
28838 bar
28839
28840 foo
28841 bar<span>boo</span>
28842 !! end
28843
28844 !! test
28845 4. Indent Pre Nowiki: suppress leading whitespace in edited paragraphs
28846 !! options
28847 parsoid={
28848 "modes": ["selser"],
28849 "scrubWikitext": true,
28850 "changes": [
28851 [ "p", "html", " a\n b" ]
28852 ]
28853 }
28854 !! wikitext
28855 xyz
28856 !! wikitext/edited
28857 a
28858 b
28859 !! end
28860
28861 !! test
28862 1. New links that end in spaces
28863 !! options
28864 parsoid={
28865 "modes": ["html2wt"],
28866 "scrubWikitext": false
28867 }
28868 !! html/parsoid
28869 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
28870 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
28871 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
28872 !! wikitext
28873 [[Berlin ]]<nowiki/>is the capital of Germany.
28874
28875 [[Foo ]]'''bar'''
28876
28877 [[Boston ]] is a city.
28878 !! end
28879
28880 !! test
28881 2. New links that end in spaces
28882 !! options
28883 parsoid={
28884 "modes": ["html2wt"],
28885 "scrubWikitext": true
28886 }
28887 !! html/parsoid
28888 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
28889 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
28890 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
28891 !! wikitext
28892 [[Berlin]] is the capital of Germany.
28893
28894 [[Foo]] '''bar'''
28895
28896 [[Boston]] is a city.
28897 !! end
28898
28899 !! test
28900 1. Table cells with escapable prefixes
28901 !! options
28902 parsoid={
28903 "modes": ["html2wt"],
28904 "scrubWikitext": false
28905 }
28906 !! html
28907 <table>
28908 <tr><td>a</td></tr>
28909 <tr><td>-</td></tr>
28910 <tr><td>+</td></tr>
28911 </table>
28912 !! wikitext
28913 {|
28914 |a
28915 |-
28916 |<nowiki>-</nowiki>
28917 |-
28918 |<nowiki>+</nowiki>
28919 |}
28920 !! end
28921
28922 !! test
28923 2. Table cells with escapable prefixes
28924 !! options
28925 parsoid={
28926 "modes": ["html2wt"],
28927 "scrubWikitext": true
28928 }
28929 !! html
28930 <table>
28931 <tr><td>a</td></tr>
28932 <tr><td>-</td></tr>
28933 <tr><td>+</td></tr>
28934 </table>
28935 !! wikitext
28936 {|
28937 |a
28938 |-
28939 | -
28940 |-
28941 | +
28942 |}
28943 !! end
28944
28945 !! test
28946 3a. Table cells with escapable prefixes after edits
28947 !! options
28948 parsoid={
28949 "modes": ["selser"],
28950 "scrubWikitext": true,
28951 "changes": [
28952 [ "table tbody tr:first-child td:first-child", "remove"]
28953 ]
28954 }
28955 !! wikitext
28956 {|
28957 |a||-
28958 |}
28959 !! wikitext/edited
28960 {|
28961 | -
28962 |}
28963 !! end
28964
28965 !! test
28966 3b. Table cells with escapable prefixes after edits
28967 !! options
28968 parsoid={
28969 "modes": ["selser"],
28970 "scrubWikitext": true,
28971 "changes": [
28972 [ "table tbody tr:first-child td:first-child", "html", "-" ],
28973 [ "#x", "remove" ]
28974 ]
28975 }
28976 !! wikitext
28977 {|
28978 |pqr
28979 |<span id="x">foo</span>+
28980 |}
28981 !! wikitext/edited
28982 {|
28983 | -
28984 | +
28985 |}
28986 !! end
28987
28988 # FIXME: This test will fail because
28989 # normalization doesn't realize that the id attribute
28990 # will eliminate the escapable scenario
28991 !! test
28992 4a. Table cells without escapable prefixes after edits
28993 !! options
28994 parsoid={
28995 "modes": ["selser"],
28996 "scrubWikitext": true,
28997 "changes": [
28998 [ "#x", "html", "-" ]
28999 ]
29000 }
29001 !! wikitext
29002 {|
29003 | id="x" |abcd
29004 |}
29005 !! wikitext/edited
29006 {|
29007 | id="x" |-
29008 |}
29009 !! end
29010
29011 ## This tests normalizer's ability to discriminate between
29012 ## cells having identical content.
29013 !! test
29014 4b. Table cells without escapable prefixes after edits
29015 !! options
29016 parsoid={
29017 "modes": ["selser"],
29018 "scrubWikitext": true,
29019 "changes": [
29020 [ "td", "html", "-" ]
29021 ]
29022 }
29023 !! wikitext
29024 {|
29025 |a||b
29026 |}
29027 !! wikitext/edited
29028 {|
29029 | -||-
29030 |}
29031 !! end
29032
29033 ## This tests normalizer's ability to not be tripped by
29034 ## comments (and whitespace)
29035 !! test
29036 4c. Table cells without escapable prefixes after edits
29037 !! options
29038 parsoid={
29039 "modes": ["selser"],
29040 "scrubWikitext": true,
29041 "changes": [
29042 [ "table tbody tr td:first-child", "remove" ]
29043 ]
29044 }
29045 !! wikitext
29046 {|
29047 |-
29048 <!--foo--> |a||-
29049 |}
29050 !! wikitext/edited
29051 {|
29052 |-
29053 <!--foo--> | -
29054 |}
29055 !! end
29056
29057 ## This tests normalizer's ability to handle HTML cells
29058 !! test
29059 4d. Table cells without escapable prefixes after edits
29060 !! options
29061 parsoid={
29062 "modes": ["selser"],
29063 "scrubWikitext": true,
29064 "changes": [
29065 [ "td", "html", "-" ]
29066 ]
29067 }
29068 !! wikitext
29069 <table>
29070 <tr><td>a</td></tr>
29071 </table>
29072 !! wikitext/edited
29073 <table>
29074 <tr><td>-</td></tr>
29075 </table>
29076 !! end
29077
29078 ## T111151 Remove font elements without attributes
29079 !! test
29080 5a. font tags without attributes should be dropped in scrubWikitext mode
29081 !! options
29082 parsoid={
29083 "modes": ["html2wt"],
29084 "scrubWikitext": true
29085 }
29086 !! html
29087 <font>foo</font>
29088 <font><font>bar</font></font>
29089 <font class="x">boo</font>
29090 !! wikitext
29091 foo
29092 bar
29093 <font class="x">boo</font>
29094 !! end
29095
29096 !! test
29097 5b. font tags should not be dropped without scrubWikitext being enabled
29098 !! options
29099 parsoid={
29100 "modes": ["html2wt"],
29101 "scrubWikitext": false
29102 }
29103 !! html
29104 <font>foo</font>
29105 !! wikitext
29106 <font>foo</font>
29107 !! end
29108
29109 !! test
29110 Escape nowiki DOM elements
29111 !! options
29112 parsoid=html2wt
29113 !! html/parsoid
29114 <nowiki><i>foo</i></nowiki>
29115 !! wikitext
29116 &lt;nowiki&gt;''foo''&lt;/nowiki&gt;
29117 !! end
29118
29119 # This is meant to be an interim fix while we go about figuring out
29120 # how to not introduce these trailing <nowiki/>s in the first place.
29121 !! test
29122 T115717: Strip trailing <nowiki/>s (without affecting valid uses)
29123 !! options
29124 parsoid=html2wt
29125 !! html/parsoid
29126 <p>x<meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/>
29127 y</p>
29128 <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>
29129 <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>
29130 !! wikitext
29131 x
29132 y
29133
29134 {{echo|
29135 1 = <nowiki/>}}
29136
29137 {{echo|
29138 1 = <nowiki/>
29139 }}
29140 !! end
29141
29142 # ---------------------------------------------------
29143 # End of tests spec'ing wikitext serialization norms |
29144 # ---------------------------------------------------
29145
29146 # T104032
29147 !! test
29148 Bare inline nodes not wrapped inside p-tags should be treated as p-wrapped
29149 !! options
29150 parsoid=html2wt
29151 !! html/parsoid
29152 a<p>b</p>
29153 <b>c</b><p>d</p>
29154 <table><tr>
29155 <td>a<p>b</p></td>
29156 <td><b>c</b><p>d</p></td>
29157 </tr></table>
29158 !! wikitext
29159 a
29160
29161 b
29162
29163 '''c'''
29164
29165 d
29166 {|
29167 |a
29168 b
29169 |'''c'''
29170 d
29171 |}
29172 !! end
29173
29174 !! test
29175 Anchor without href scenarios
29176 !! options
29177 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
29178 !! html/parsoid
29179 <a class="bc"></a>
29180 <a class="no">dice</a>
29181 <a name="foo"></a>
29182 !! wikitext
29183
29184 dice
29185 <span name="foo"></span>
29186 !! end
29187
29188 !! test
29189 New transclusion added after a list should be serialized after the list
29190 !! options
29191 parsoid=html2wt
29192 !! html/parsoid
29193 <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>
29194 !! wikitext
29195 * a
29196 {{echo|foo}}
29197 !! end
29198
29199 # -----------------------------------------------------------------
29200 # End of section for Parsoid-only html2wt tests for serialization
29201 # of new content
29202 # -----------------------------------------------------------------
29203
29204 # -----------------------------------------------------------------
29205 # The following section of tests are primarily to spec behavior of
29206 # the selective serializer. All these tests have manual selser
29207 # changes. The automated selser changes for all tests handle the
29208 # wide variation of changes, but these tests here capture specs
29209 # deterministically.
29210 # ----------------------------------------------------------------
29211
29212 ## T90517
29213 !! test
29214 Selser: New comments should not be lost
29215 !! options
29216 parsoid={
29217 "modes": ["selser"],
29218 "changes": [
29219 [ "#a", "after", "<!--c1-->" ],
29220 [ "#b", "before", "<!--c2-->" ]
29221 ]
29222 }
29223 !! wikitext
29224 <span id="a">a</span>
29225
29226 <span id="b">b</span>
29227 !! wikitext/edited
29228 <span id="a">a</span><!--c1-->
29229
29230 <!--c2--><span id="b">b</span>
29231 !! end
29232
29233 ## T89383
29234 !! test
29235 Selser: Check for validity of DSR before using it
29236 !! options
29237 parsoid={
29238 "modes": ["selser"],
29239 "changes": [
29240 [ "#a", "before", "<meta property='mw:PageProp/displaytitle' content='foo'>" ]
29241 ]
29242 }
29243 !! wikitext
29244 <span id="a">a</span>
29245 !! wikitext/edited
29246 {{DISPLAYTITLE:foo}}
29247 <span id="a">a</span>
29248 !! end
29249
29250 !! test
29251 1. DOMDiff: Changes to <ref> content should be looked up using id
29252 !! options
29253 parsoid={
29254 "modes": ["selser"],
29255 "changes": [
29256 ["#X", "after", "bar"],
29257 ["#Y", "after", "baz"]
29258 ]
29259 }
29260 !! wikitext
29261 X <ref><span id="X">foo</span></ref>
29262 Y <ref name="a" />
29263 <references>
29264 <ref name="a"><span id="Y">foo</span></ref>
29265 </references>
29266 !! wikitext/edited
29267 X <ref><span id="X">foo</span>bar</ref>
29268 Y <ref name="a" />
29269 <references>
29270 <ref name="a"><span id="Y">foo</span>baz</ref>
29271 </references>
29272 !! end
29273
29274 !! test
29275 2. DOMDiff: Changes to <ref> content should be looked up using id
29276 !! options
29277 parsoid={
29278 "modes": ["selser"],
29279 "changes": [
29280 ["#Z", "after", "bar"]
29281 ]
29282 }
29283 !! wikitext
29284 A <ref>foo bar for a</ref>
29285 B <ref group="X" name="b" />
29286
29287 <references />
29288
29289 <references group="X">
29290 <ref name="b"><span id="Z">foo</span></ref>
29291 </references>
29292 !! wikitext/edited
29293 A <ref>foo bar for a</ref>
29294 B <ref group="X" name="b" />
29295
29296 <references />
29297
29298 <references group="X">
29299 <ref name="b"><span id="Z">foo</span>bar</ref>
29300 </references>
29301 !! end
29302
29303 !! test
29304 DOMDiff: Edits to content nested in elements with templated attributes should not be lost (T139388)
29305 !! options
29306 parsoid={
29307 "modes": ["selser"],
29308 "changes": [
29309 [ "div:first-child", "text", "bar" ]
29310 ]
29311 }
29312 !! wikitext
29313 <div style="{{1x|color:red;}}%">foo</div>
29314 !! wikitext/edited
29315 <div style="{{1x|color:red;}}%">bar</div>
29316 !! end
29317
29318 !! test
29319 Empty LI (T49673)
29320 !! wikitext
29321 * a
29322 *
29323 *
29324 * b
29325 !! html/php+tidy
29326 <ul>
29327 <li>a</li>
29328 <li class="mw-empty-elt"></li>
29329 <li class="mw-empty-elt"></li>
29330 <li>b</li>
29331 </ul>
29332 !! end
29333
29334 !! test
29335 Thumbnail output
29336 !! wikitext
29337 [[File:Thumb.png|thumb]]
29338 !! html/php+tidy
29339 <div class="thumb tright">
29340 <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>
29341 <div class="thumbcaption">
29342 <div class="magnify"><a href="/wiki/File:Thumb.png" class="internal" title="Enlarge"></a></div>
29343 </div>
29344 </div>
29345 </div>
29346 !! end
29347
29348 !! test
29349 unclosed internal link XSS (T137264)
29350 !! wikitext
29351 [[#%3Cscript%3Ealert(1)%3C/script%3E|
29352 !! html/php
29353 <p>[[#&lt;script&gt;alert(1)&lt;/script&gt;|
29354 </p>
29355 !! html/parsoid
29356 <p>[[#%3Cscript%3Ealert(1)%3C/script%3E|</p>
29357 !! end
29358
29359 # Use $wgRawHtml to inject a <style> tag, since you normally can't in wikitext
29360 # (Parsoid doesn't support $wgRawHtml==true)
29361 !! test
29362 Validating that <style> isn't eaten by tidy (T167349)
29363 !! options
29364 wgRawHtml=1
29365 !! wikitext
29366 <div class="foo">
29367 <html><style>.foo::before { content: "<foo>"; }</style></html>
29368 <html><style data-mw-foobar="baz">.foo::after { content: "<bar>"; }</style></html>
29369 </div>
29370 !! html/php+tidy
29371 <div class="foo">
29372 <style>.foo::before { content: "<foo>"; }</style>
29373 <style data-mw-foobar="baz">.foo::after { content: "<bar>"; }</style>
29374 </div>
29375 !! end
29376
29377 !! test
29378 Decoding of HTML entities in headings and links for IDs and link fragments (T103714)
29379 !! wikitext
29380 == A&B&amp;C&amp;amp;D&amp;amp;amp;E ==
29381 [[#A&B&amp;C&amp;amp;D&amp;amp;amp;E]]
29382 !! html/php
29383 <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>
29384 <p><a href="#A.26B.26C.26amp.3BD.26amp.3Bamp.3BE">#A&amp;B&amp;C&amp;amp;D&amp;amp;amp;E</a>
29385 </p>
29386 !! end
29387
29388 !! test
29389 Decoding of HTML entities in indicator names for IDs (T104196)
29390 !! options
29391 showindicators
29392 !! wikitext
29393 <indicator name="1&2&amp;3&amp;amp;4&amp;amp;amp;5">Indicator</indicator>
29394 !! html/php
29395 1&2&3&amp;4&amp;amp;5=Indicator
29396
29397 !! end
29398
29399 !! test
29400 HTML5 ids: fallback to legacy
29401 !! config
29402 wgFragmentMode=[ 'html5', 'legacy' ]
29403 !! wikitext
29404 == Foo bar ==
29405
29406 == foo Bar ==
29407
29408 == Тест ==
29409
29410 == Тест ==
29411
29412 == тест ==
29413
29414 == Hey < # " > % : ' ==
29415 [[#Foo bar]] [[#foo Bar]] [[#Тест]] [[#тест]] [[#Hey < # " > % : ']]
29416
29417 {{anchorencode:💩}} <span id="{{anchorencode:💩}}"></span>
29418
29419 <!-- These two links should produce identical HTML -->
29420 [[#啤酒]] [[#%E5%95%A4%E9%85%92]]
29421
29422 !! html/php
29423 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
29424 <ul>
29425 <li class="toclevel-1 tocsection-1"><a href="#Foo_bar"><span class="tocnumber">1</span> <span class="toctext">Foo bar</span></a></li>
29426 <li class="toclevel-1 tocsection-2"><a href="#foo_Bar_2"><span class="tocnumber">2</span> <span class="toctext">foo Bar</span></a></li>
29427 <li class="toclevel-1 tocsection-3"><a href="#Тест"><span class="tocnumber">3</span> <span class="toctext">Тест</span></a></li>
29428 <li class="toclevel-1 tocsection-4"><a href="#Тест_2"><span class="tocnumber">4</span> <span class="toctext">Тест</span></a></li>
29429 <li class="toclevel-1 tocsection-5"><a href="#тест"><span class="tocnumber">5</span> <span class="toctext">тест</span></a></li>
29430 <li class="toclevel-1 tocsection-6"><a href="#Hey_&lt;_#_&quot;_&gt;_%_:_'"><span class="tocnumber">6</span> <span class="toctext">Hey &lt; # " &gt;&#160;%&#160;: '</span></a></li>
29431 </ul>
29432 </div>
29433
29434 <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>
29435 <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>
29436 <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>
29437 <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>
29438 <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>
29439 <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>
29440 <p><a href="#Foo_bar">#Foo bar</a> <a href="#foo_Bar">#foo Bar</a> <a href="#Тест">#Тест</a> <a href="#тест">#тест</a> <a href="#Hey_&lt;_#_&quot;_&gt;_%_:_'">#Hey &lt; # " &gt;&#160;%&#160;: '</a>
29441 </p><p>💩 <span id="💩"></span>
29442 </p><p><a href="#啤酒">#啤酒</a> <a href="#啤酒">#啤酒</a>
29443 </p>
29444 !! end
29445
29446 !! test
29447 HTML5 ids: legacy with a fallback to modern
29448 !! config
29449 wgFragmentMode=[ 'legacy', 'html5' ]
29450 !! wikitext
29451 == Foo bar ==
29452
29453 == foo Bar ==
29454
29455 == Тест ==
29456
29457 == Тест ==
29458
29459 == тест ==
29460
29461 == Hey < # " > % : ' ==
29462 [[#Foo bar]] [[#foo Bar]] [[#Тест]] [[#тест]] [[#Hey < # " > % : ']]
29463
29464 {{anchorencode:💩}} <span id="{{anchorencode:💩}}"></span>
29465
29466 <!-- These two links should produce identical HTML -->
29467 [[#啤酒]] [[#%E5%95%A4%E9%85%92]]
29468
29469 !! html/php
29470 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
29471 <ul>
29472 <li class="toclevel-1 tocsection-1"><a href="#Foo_bar"><span class="tocnumber">1</span> <span class="toctext">Foo bar</span></a></li>
29473 <li class="toclevel-1 tocsection-2"><a href="#foo_Bar_2"><span class="tocnumber">2</span> <span class="toctext">foo Bar</span></a></li>
29474 <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>
29475 <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>
29476 <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>
29477 <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>
29478 </ul>
29479 </div>
29480
29481 <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>
29482 <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>
29483 <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>
29484 <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>
29485 <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>
29486 <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>
29487 <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>
29488 </p><p>.F0.9F.92.A9 <span id=".F0.9F.92.A9"></span>
29489 </p><p><a href="#.E5.95.A4.E9.85.92">#啤酒</a> <a href="#.E5.95.A4.E9.85.92">#啤酒</a>
29490 </p>
29491 !! end
29492
29493 !! test
29494 HTML5 ids: no legacy
29495 !! config
29496 wgFragmentMode=[ 'html5' ]
29497 !! wikitext
29498 == Foo bar ==
29499
29500 == foo Bar ==
29501
29502 == Тест ==
29503
29504 == Тест ==
29505
29506 == тест ==
29507
29508 == Hey < # " > % : ' ==
29509 [[#Foo bar]] [[#foo Bar]] [[#Тест]] [[#тест]] [[#Hey < # " > % : ']]
29510
29511 {{anchorencode:💩}} <span id="{{anchorencode:💩}}"></span>
29512
29513 <!-- These two links should produce identical HTML -->
29514 [[#啤酒]] [[#%E5%95%A4%E9%85%92]]
29515
29516 !! html/php
29517 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
29518 <ul>
29519 <li class="toclevel-1 tocsection-1"><a href="#Foo_bar"><span class="tocnumber">1</span> <span class="toctext">Foo bar</span></a></li>
29520 <li class="toclevel-1 tocsection-2"><a href="#foo_Bar_2"><span class="tocnumber">2</span> <span class="toctext">foo Bar</span></a></li>
29521 <li class="toclevel-1 tocsection-3"><a href="#Тест"><span class="tocnumber">3</span> <span class="toctext">Тест</span></a></li>
29522 <li class="toclevel-1 tocsection-4"><a href="#Тест_2"><span class="tocnumber">4</span> <span class="toctext">Тест</span></a></li>
29523 <li class="toclevel-1 tocsection-5"><a href="#тест"><span class="tocnumber">5</span> <span class="toctext">тест</span></a></li>
29524 <li class="toclevel-1 tocsection-6"><a href="#Hey_&lt;_#_&quot;_&gt;_%_:_'"><span class="tocnumber">6</span> <span class="toctext">Hey &lt; # " &gt;&#160;%&#160;: '</span></a></li>
29525 </ul>
29526 </div>
29527
29528 <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>
29529 <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>
29530 <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>
29531 <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>
29532 <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>
29533 <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>
29534 <p><a href="#Foo_bar">#Foo bar</a> <a href="#foo_Bar">#foo Bar</a> <a href="#Тест">#Тест</a> <a href="#тест">#тест</a> <a href="#Hey_&lt;_#_&quot;_&gt;_%_:_'">#Hey &lt; # " &gt;&#160;%&#160;: '</a>
29535 </p><p>💩 <span id="💩"></span>
29536 </p><p><a href="#啤酒">#啤酒</a> <a href="#啤酒">#啤酒</a>
29537 </p>
29538 !! end