Make multiple colons escaping interlanguage links invalid, consistently
[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 !! article
113 Template:echo_with_span
114 !! text
115 <span>{{{1}}}</span>
116 !! endarticle
117
118 !! article
119 Template:echo_with_div
120 !! text
121 <div>{{{1}}}</div>
122 !! endarticle
123
124 !! article
125 Template:blank_param
126 !! text
127 {{{1}}}
128 {{{}}}
129 !! endarticle
130
131 !! article
132 Template:table_attribs
133 !! text
134 <noinclude>
135 |</noinclude>style="color:red;"|Foo
136 !! endarticle
137
138 !! article
139 Template:table_attribs_2
140 !! text
141 <noinclude>
142 |</noinclude>style="color:red;"|Foo
143 |Bar||Baz
144 !! endarticle
145
146 !! article
147 Template:table_attribs_3
148 !! text
149 <noinclude>
150 |</noinclude>style{{=}}"background:&#35;f9f9f9;"|Foo
151 !! endarticle
152
153 !! article
154 Template:table_attribs_4
155 !! text
156 | style="background-color:#DC241f;" width="10px" |
157 !! endarticle
158
159 !! article
160 Template:table_attribs_5
161 !! text
162 <noinclude>
163 |</noinclude>style="color:red;"||Bar
164 !! endarticle
165
166 !! article
167 Template:table_attribs_6
168 !! text
169 style="background: <nowiki>
170
171
172 red;</nowiki>" |
173 !! endarticle
174
175 !! article
176 Template:table_attribs_7
177 !! text
178 <noinclude>
179 |</noinclude>style{{=}}"background:&#35;f9f9f9;"|Foo<ref>foo</ref>
180 !! endarticle
181
182 !! article
183 Template:table_header_cells
184 !! text
185 {{table_attribs}}!!style='color:red;'|''Bar''||style='color:brown;'|''Foo'' and Baz
186 !! endarticle
187
188 !! article
189 Template:table_cells
190 !! text
191 {{table_attribs}}||style='color:red;'|''Bar''||style='color:brown;'|''Foo'' and Baz
192 !! endarticle
193
194 !! article
195 Template:PartialTable
196 !! text
197 {|
198 |-
199 !! endarticle
200
201 !! article
202 Template:image_attribs
203 !! text
204 <noinclude>
205 [[File:foobar.jpg|</noinclude>right|Caption text<noinclude>]]</noinclude>
206 !! endarticle
207
208 ## See T48811 for details
209 !! article
210 Template:mixed_attr_content_template
211 !! text
212 style="color:red;" title="T48811"
213 |-
214 |foo
215 !! endarticle
216
217 !! article
218 Template:definition_list
219 !! text
220 one
221 ::two
222 !! endarticle
223
224 !! article
225 A?b
226 !! text
227 Weirdo titles!
228 !! endarticle
229
230 !!article
231 Template:Bullet
232 !!text
233 * Bar
234 !!endarticle
235
236 !!article
237 Template:OpenTable
238 !!text
239 {|
240 !!endarticle
241
242 !!article
243 Template:EmptyLITest
244 !!text
245 *a
246 *
247 *
248 *b
249 !!endarticle
250
251 !!article
252 Template:EmptyTRTest
253 !!text
254 {|
255 |-
256 |-
257 |foo
258 |-
259 |-
260 |bar
261 |}
262 !!endarticle
263
264 !!article
265 Template:EmptyTRWithHTMLAttrTest
266 !!text
267 <table>
268 <tr align="center"></tr>
269 <tr><td>foo</td></tr>
270 <tr align="center"></tr>
271 <tr><td>bar</td></tr>
272 </table>
273 !!endarticle
274
275 !! article
276 Template:CircularRef
277 !! text
278 <ref>{{CircularRef}}</ref>
279 !! endarticle
280
281 ###
282 ### Basic tests
283 ###
284 !! test
285 Blank input
286 !! wikitext
287 !! html
288 !! end
289
290 !! test
291 CircularRef
292 !! wikitext
293 {{CircularRef}}
294 <references />
295 !! html/parsoid
296 <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>
297 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><a href="./Main_Page#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text" data-parsoid="{}">Error: Expansion loop detected at <a data-parsoid='{"a":{"href":null},"sa":{"href":"Template:CircularRef"}}'>Template:CircularRef</a></span></li></ol>
298 !! end
299
300 !! test
301 Simple paragraph
302 !! wikitext
303 This is a simple paragraph.
304 !! html
305 <p>This is a simple paragraph.
306 </p>
307 !! end
308
309 !! test
310 Paragraphs with extra newline spacing
311 !! wikitext
312 foo
313
314 bar
315
316
317 baz
318
319
320
321 booz
322 !! html
323 <p>foo
324 </p><p>bar
325 </p><p><br />
326 baz
327 </p><p><br />
328 </p><p>booz
329 </p>
330 !! end
331
332 !! test
333 Paragraphs with newline spacing with comment lines in between
334 !! wikitext
335 ----
336 a
337 <!--foo-->
338 b
339 ----
340 a
341 <!--foo--><!--More than 1 comment, still stripped-->
342 b
343 ----
344 a
345 <!--foo--> <!----> <!-- bar -->
346 b
347 ----
348 a
349 <!--foo-->
350
351 b
352 ----
353 a
354
355 <!--foo-->
356 b
357 ----
358 a
359 <!--foo-->
360
361
362 b
363 ----
364 a
365
366
367 <!--foo-->
368 b
369 ----
370 !! html
371 <hr />
372 <p>a
373 b
374 </p>
375 <hr />
376 <p>a
377 b
378 </p>
379 <hr />
380 <p>a
381 b
382 </p>
383 <hr />
384 <p>a
385 </p><p>b
386 </p>
387 <hr />
388 <p>a
389 </p><p>b
390 </p>
391 <hr />
392 <p>a
393 </p><p><br />
394 b
395 </p>
396 <hr />
397 <p>a
398 </p><p><br />
399 b
400 </p>
401 <hr />
402
403 !! end
404
405 !! test
406 Paragraphs with newline spacing with non-empty white-space lines in between
407 !! wikitext
408 ----
409 a
410
411 b
412 ----
413 a
414
415
416 b
417 ----
418 !! html
419 <hr />
420 <p>a
421 </p><p>b
422 </p>
423 <hr />
424 <p>a
425 </p><p><br />
426 b
427 </p>
428 <hr />
429
430 !! end
431
432 !! test
433 Paragraphs with newline spacing with non-empty mixed comment and white-space lines in between
434 !! wikitext
435 ----
436 a
437 <!--foo-->
438 b
439 ----
440 a
441 <!--foo--><!--More than 1 comment doesn't disable stripping of this line!-->
442 b
443 ----
444 a
445
446 <!--foo-->
447 <!--bar-->
448 b
449 ----
450 a
451
452 <!--foo-->
453 <!--bar-->
454
455 b
456 ----
457 !! html
458 <hr />
459 <p>a
460 b
461 </p>
462 <hr />
463 <p>a
464 b
465 </p>
466 <hr />
467 <p>a
468 </p><p>b
469 </p>
470 <hr />
471 <p>a
472 </p><p><br />
473 b
474 </p>
475 <hr />
476
477 !! end
478
479 !! test
480 Extra newlines: More paragraphs with indented comment
481 !! wikitext
482 a
483
484 <!--boo-->
485
486 b
487 !! html
488 <p>a
489 </p><p><br />
490 b
491 </p>
492 !!end
493
494 !! test
495 Extra newlines followed by heading
496 !! wikitext
497 a
498
499
500
501 =b=
502 [[a]]
503
504
505 =b=
506 !! html
507 <p>a
508 </p><p><br />
509 </p>
510 <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>
511 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
512 </p><p><br />
513 </p>
514 <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>
515
516 !! end
517
518 !! test
519 Extra newlines between heading and content are swallowed
520 !! wikitext
521 =b=
522
523
524
525 [[a]]
526 !! html
527 <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>
528 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
529 </p>
530 !! end
531
532 !! test
533 Heading with line break in nowiki
534 !! options
535 parsoid=wt2html
536 !! wikitext
537 == A <nowiki>B
538 C</nowiki> ==
539 !! html
540 <h2><span class="mw-headline" id="A_B.0AC">A B
541 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>
542
543 !! html/parsoid
544 <h2 id="A_B.0AC">A <span typeof="mw:Nowiki">B
545 C</span> </h2>
546 !! end
547
548 !! test
549 Parsing an URL
550 !! wikitext
551 http://fr.wikipedia.org/wiki/🍺
552 <!-- EasterEgg we love beer, better be able be able to link to it -->
553 !! html
554 <p><a rel="nofollow" class="external free" href="http://fr.wikipedia.org/wiki/🍺">http://fr.wikipedia.org/wiki/🍺</a>
555 </p>
556 !! end
557
558 # Note that the html+tidy output removes the spaces after the <li>,
559 # which is a bug (https://sourceforge.net/p/tidy/bugs/945/, etc).
560 # This is an issue for all tests with lists. We intentionally do
561 # *not* add html+tidy clauses for these, as we don't want to
562 # document/test the broken behavior. (Parsoid matches the non-tidy
563 # output in these cases.)
564
565 !! test
566 Simple list
567 !! wikitext
568 * Item 1
569 * Item 2
570 !! html
571 <ul><li> Item 1</li>
572 <li> Item 2</li></ul>
573
574 !! end
575
576 !! test
577 Italics and bold
578 !! wikitext
579 * plain
580 * plain''italic''plain
581 * plain''italic''plain''italic''plain
582 * plain'''bold'''plain
583 * plain'''bold'''plain'''bold'''plain
584 * plain''italic''plain'''bold'''plain
585 * plain'''bold'''plain''italic''plain
586 * plain''italic'''bold-italic'''italic''plain
587 * plain'''bold''bold-italic''bold'''plain
588 * plain'''''bold-italic'''italic''plain
589 * plain'''''bold-italic''bold'''plain
590 * plain''italic'''bold-italic'''''plain
591 * plain'''bold''bold-italic'''''plain
592 * plain l'''italic''plain
593 * plain l''''bold''' plain
594 !! html
595 <ul><li> plain</li>
596 <li> plain<i>italic</i>plain</li>
597 <li> plain<i>italic</i>plain<i>italic</i>plain</li>
598 <li> plain<b>bold</b>plain</li>
599 <li> plain<b>bold</b>plain<b>bold</b>plain</li>
600 <li> plain<i>italic</i>plain<b>bold</b>plain</li>
601 <li> plain<b>bold</b>plain<i>italic</i>plain</li>
602 <li> plain<i>italic<b>bold-italic</b>italic</i>plain</li>
603 <li> plain<b>bold<i>bold-italic</i>bold</b>plain</li>
604 <li> plain<i><b>bold-italic</b>italic</i>plain</li>
605 <li> plain<b><i>bold-italic</i>bold</b>plain</li>
606 <li> plain<i>italic<b>bold-italic</b></i>plain</li>
607 <li> plain<b>bold<i>bold-italic</i></b>plain</li>
608 <li> plain l'<i>italic</i>plain</li>
609 <li> plain l'<b>bold</b> plain</li></ul>
610
611 !! end
612
613 # this example taken from the [[simple:Moon]] article (T49326)
614 !! test
615 Italics and possessives (1)
616 !! wikitext
617 obtained by ''[[Lunar Prospector]]'''s gamma-ray spectrometer
618 !! html
619 <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
620 </p>
621 !! end
622
623 # this example taken from [[en:Flaming Pie]] (T51926)
624 !! test
625 Italics and possessives (2)
626 !! wikitext
627 '''''Flaming Pie''''' is ... released in 1997. In ''Flaming Pie'''s liner notes
628 !! html
629 <p><i><b>Flaming Pie</b></i> is ... released in 1997. In <i>Flaming Pie'</i>s liner notes
630 </p>
631 !! end
632
633 # this example taken from [[en:Dictionary]] (T51926)
634 !! test
635 Italics and possessives (3)
636 !! wikitext
637 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''.
638 !! html
639 <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>.
640 </p>
641 !! end
642
643
644 ###
645 ### 2-quote opening sequence tests
646 ###
647 !! test
648 Italics and bold: 2-quote opening sequence: (2,2)
649 !! wikitext
650 ''foo''
651 !! html
652 <p><i>foo</i>
653 </p>
654 !!end
655
656 !! test
657 Italics and bold: 2-quote opening sequence: (2,3)
658 !! wikitext
659 ''foo'''
660 !! html/*
661 <p><i>foo'</i>
662 </p>
663 !!end
664
665 !! test
666 Italics and bold: 2-quote opening sequence: (2,4)
667 !! options
668 parsoid=wt2html
669 !! wikitext
670 ''foo''''
671 !! html/*
672 <p><i>foo''</i>
673 </p>
674 !!end
675
676 # same html as previous, but wikitext adjusted to match parsoid html2wt
677 !! test
678 Italics and bold: 2-quote opening sequence: (2,4) w/ nowiki
679 !! wikitext
680 ''foo<nowiki>''</nowiki>''
681 !! html
682 <p><i>foo''</i>
683 </p>
684 !! end
685
686 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
687 !! test
688 Italics and bold: 2-quote opening sequence: (2,5)
689 !! options
690 parsoid=wt2html
691 !! wikitext
692 ''foo'''''
693 !! html/php
694 <p><i>foo</i>
695 </p>
696 !! html/parsoid
697 <p><i>foo</i><b></b>
698 </p>
699 !!end
700
701 # same html as previous, but wikitext adjusted to match parsoid html2wt
702 !! test
703 Italics and bold: 2-quote opening sequence: (2,5+3) w/ nowiki
704 !! wikitext
705 ''foo'''''<nowiki/>'''
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
715 ###
716 ### 3-quote opening sequence tests
717 ###
718
719 !! test
720 Italics and bold: 3-quote opening sequence: (3,2)
721 !! wikitext
722 '''foo''
723 !! html/*
724 <p>'<i>foo</i>
725 </p>
726 !!end
727
728 !! test
729 Italics and bold: 3-quote opening sequence: (3,3)
730 !! wikitext
731 '''foo'''
732 !! html
733 <p><b>foo</b>
734 </p>
735 !!end
736
737 !! test
738 Italics and bold: 3-quote opening sequence: (3,4)
739 !! wikitext
740 '''foo''''
741 !! html/*
742 <p><b>foo'</b>
743 </p>
744 !!end
745
746 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
747 !! test
748 Italics and bold: 3-quote opening sequence: (3,5)
749 !! options
750 parsoid=wt2html
751 !! wikitext
752 '''foo'''''
753 !! html/php
754 <p><b>foo</b>
755 </p>
756 !! html/parsoid
757 <p><b>foo</b><i></i>
758 </p>
759 !!end
760
761 # same html as previous, but wikitext adjusted to match parsoid html2wt
762 !! test
763 Italics and bold: 3-quote opening sequence: (3,5+2) w/ nowiki
764 !! wikitext
765 '''foo'''''<nowiki/>''
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
775 ###
776 ### 4-quote opening sequence tests
777 ###
778
779 !! test
780 Italics and bold: 4-quote opening sequence: (4,2)
781 !! options
782 parsoid=wt2html
783 !! wikitext
784 ''''foo''
785 !! html/*
786 <p>''<i>foo</i>
787 </p>
788 !!end
789
790 # same html as previous, but wikitext adjusted to match parsoid html2wt
791 !! test
792 Italics and bold: 4-quote opening sequence: (4,2) w/ nowiki
793 !! wikitext
794 <nowiki>''</nowiki>''foo''
795 !! html
796 <p>''<i>foo</i>
797 </p>
798 !! end
799
800 !! test
801 Italics and bold: 4-quote opening sequence: (4,3)
802 !! wikitext
803 ''''foo'''
804 !! html/*
805 <p>'<b>foo</b>
806 </p>
807 !!end
808
809 !! test
810 Italics and bold: 4-quote opening sequence: (4,4)
811 !! options
812 parsoid=wt2html
813 !! wikitext
814 ''''foo''''
815 !! html/*
816 <p>'<b>foo'</b>
817 </p>
818 !!end
819
820 # same html as previous, but wikitext adjusted to match parsoid html2wt
821 !! test
822 Italics and bold: 4-quote opening sequence: (4,4) w/ nowiki
823 !! wikitext
824 '<nowiki/>'''foo''''
825 !! html
826 <p>'<b>foo'</b>
827 </p>
828 !! end
829
830 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
831 !! test
832 Italics and bold: 4-quote opening sequence: (4,5)
833 !! options
834 parsoid=wt2html
835 !! wikitext
836 ''''foo'''''
837 !! html/php
838 <p>'<b>foo</b>
839 </p>
840 !! html/parsoid
841 <p>'<b>foo</b><i></i>
842 </p>
843 !!end
844
845 # same html as previous, but wikitext adjusted to match parsoid html2wt
846 !! test
847 Italics and bold: 4-quote opening sequence: (4,5+2) w/ nowiki
848 !! wikitext
849 '<nowiki/>'''foo'''''<nowiki/>''
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
859 ###
860 ### 5-quote opening sequence tests
861 ###
862
863 !! test
864 Italics and bold: 5-quote opening sequence: (5,2)
865 !! options
866 parsoid=wt2html
867 !! wikitext
868 '''''foo''
869 !! html/*
870 <p><b><i>foo</i></b>
871 </p>
872 !!end
873
874 # same html as previous, but wikitext adjusted to match parsoid html2wt
875 !! test
876 Italics and bold: 5-quote opening sequence: (5,2+3)
877 !! wikitext
878 '''''foo'''''
879 !! html/*
880 <p><i><b>foo</b></i>
881 </p>
882 !! end
883
884 !! test
885 Italics and bold: 5-quote opening sequence: (5,3)
886 !! options
887 parsoid=wt2html
888 !! wikitext
889 '''''foo'''
890 !! html/*
891 <p><i><b>foo</b></i>
892 </p>
893 !!end
894
895 # same html as previous, but wikitext adjusted to match parsoid html2wt
896 !! test
897 Italics and bold: 5-quote opening sequence: (5,3+2)
898 !! wikitext
899 '''''foo'''''
900 !! html
901 <p><i><b>foo</b></i>
902 </p>
903 !! end
904
905 !! test
906 Italics and bold: 5-quote opening sequence: (5,4)
907 !! options
908 parsoid=wt2html
909 !! wikitext
910 '''''foo''''
911 !! html/*
912 <p><i><b>foo'</b></i>
913 </p>
914 !!end
915
916 !! test
917 Italics and bold: 5-quote opening sequence: (5,5)
918 !! wikitext
919 '''''foo'''''
920 !! html
921 <p><i><b>foo</b></i>
922 </p>
923 !!end
924
925 !! test
926 Italics and bold: 5-quote opening sequence: (5,6)
927 !! wikitext
928 '''''foo''''''
929 !! html/*
930 <p><i><b>foo'</b></i>
931 </p>
932 !! end
933
934 ###
935 ### multiple quote sequences in a line
936 ###
937
938 !! test
939 Italics and bold: multiple quote sequences: (2,4,2)
940 !! options
941 parsoid=wt2html
942 !! wikitext
943 ''foo''''bar''
944 !! html/*
945 <p><i>foo'<b>bar</b></i>
946 </p>
947 !! end
948
949 # same html as previous, but wikitext adjusted to match parsoid html2wt
950 !! test
951 Italics and bold: multiple quote sequences: (2,4,2+3) w/ nowiki
952 !! wikitext
953 ''foo'<nowiki/>'''bar'''''
954 !! html
955 <p><i>foo'<b>bar</b></i>
956 </p>
957 !! end
958
959 !! test
960 Italics and bold: multiple quote sequences: (2,4,3)
961 !! options
962 parsoid=wt2html
963 !! wikitext
964 ''foo''''bar'''
965 !! html/*
966 <p><i>foo'<b>bar</b></i>
967 </p>
968 !! end
969
970 # same html as previous, but wikitext adjusted to match parsoid html2wt
971 !! test
972 Italics and bold: multiple quote sequences: (2,4,3+2) w/ nowiki
973 !! wikitext
974 ''foo'<nowiki/>'''bar'''''
975 !! html
976 <p><i>foo'<b>bar</b></i>
977 </p>
978 !! end
979
980 !! test
981 Italics and bold: multiple quote sequences: (2,4,4)
982 !! options
983 parsoid=wt2html
984 !! wikitext
985 ''foo''''bar''''
986 !! html/*
987 <p><i>foo'<b>bar'</b></i>
988 </p>
989 !! end
990
991 # same html as previous, but wikitext adjusted to match parsoid html2wt
992 !! test
993 Italics and bold: multiple quote sequences: (2,4,4+2) w/ nowiki
994 !! wikitext
995 ''foo'<nowiki/>'''bar'<nowiki/>'''''
996 !! html
997 <p><i>foo'<b>bar'</b></i>
998 </p>
999 !! end
1000
1001 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
1002 !! test
1003 Italics and bold: multiple quote sequences: (3,4,2)
1004 !! options
1005 parsoid=wt2html
1006 !! wikitext
1007 '''foo''''bar''
1008 !! html/php
1009 <p><b>foo'</b>bar
1010 </p>
1011 !! html/parsoid
1012 <p><b>foo'</b>bar<i></i>
1013 </p>
1014 !! end
1015
1016 # same html as previous, but wikitext adjusted to match parsoid html2wt
1017 !! test
1018 Italics and bold: multiple quote sequences: (3,4,2+2) w/ nowiki
1019 !! wikitext
1020 '''foo''''bar''<nowiki/>''
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 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
1030 !! test
1031 Italics and bold: multiple quote sequences: (3,4,3)
1032 !! options
1033 parsoid=wt2html
1034 !! wikitext
1035 '''foo''''bar'''
1036 !! html/php
1037 <p><b>foo'</b>bar
1038 </p>
1039 !! html/parsoid
1040 <p><b>foo'</b>bar<b></b>
1041 </p>
1042 !! end
1043
1044 # same html as previous, but wikitext adjusted to match parsoid html2wt
1045 !! test
1046 Italics and bold: multiple quote sequences: (3,4,3+3) w/ nowiki
1047 !! wikitext
1048 '''foo''''bar'''<nowiki/>'''
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 ###
1058 ### other quote tests
1059 ###
1060 !! test
1061 Italics and bold: other quote tests: (2,3,5)
1062 !! wikitext
1063 ''this is about '''foo's family'''''
1064 !! html
1065 <p><i>this is about <b>foo's family</b></i>
1066 </p>
1067 !!end
1068
1069
1070 !! test
1071 Italics and bold: other quote tests: (2,(3,3),2)
1072 !! wikitext
1073 ''this is about '''foo's''' family''
1074 !! html
1075 <p><i>this is about <b>foo's</b> family</i>
1076 </p>
1077 !!end
1078
1079
1080 !! test
1081 Italics and bold: other quote tests: (3,2,3,2)
1082 !! options
1083 parsoid=wt2html
1084 !! wikitext
1085 '''this is about ''foo'''s family''
1086 !! html/*
1087 <p><b>this is about <i>foo</i></b><i>s family</i>
1088 </p>
1089 !!end
1090
1091
1092 # same html as previous, but wikitext adjusted to match parsoid html2wt
1093 !! test
1094 Italics and bold: other quote tests: (3,2,3+2+2,2)
1095 !! wikitext
1096 '''this is about ''foo'''''<nowiki/>''s family''
1097 !! html
1098 <p><b>this is about <i>foo</i></b><i>s family</i>
1099 </p>
1100 !! end
1101
1102
1103 !! test
1104 Italics and bold: other quote tests: (3,2,3,3)
1105 !! wikitext
1106 '''this is about ''foo'''s family'''
1107 !! html/*
1108 <p>'<i>this is about </i>foo<b>s family</b>
1109 </p>
1110 !!end
1111
1112
1113 !! test
1114 Italics and bold: other quote tests: (3,(2,2),3)
1115 !! wikitext
1116 '''this is about ''foo's'' family'''
1117 !! html
1118 <p><b>this is about <i>foo's</i> family</b>
1119 </p>
1120 !!end
1121
1122
1123 !! test
1124 Italicized possessive
1125 !! wikitext
1126 The ''[[Main Page]]'''s talk page.
1127 !! html/php
1128 <p>The <i><a href="/wiki/Main_Page" title="Main Page">Main Page</a>'</i>s talk page.
1129 </p>
1130 !! html/parsoid
1131 <p>The <i><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a>'</i>s talk page.</p>
1132 !! end
1133
1134 !! test
1135 Parsoid only: Quote balancing context should be restricted to td/th cells on the same wikitext line
1136 (Requires tidy for PHP parser output to be fixed up)
1137 !! options
1138 parsoid=wt2html,wt2wt
1139 !! wikitext
1140 {|
1141 !''a!!''b
1142 |''a||''b
1143 |}
1144 !! html/php+tidy
1145 <table>
1146 <tr>
1147 <th><i>a</i></th>
1148 <th><i>b</i></th>
1149 <td><i>a</i></td>
1150 <td><i>b</i></td>
1151 </tr>
1152 </table>
1153 !! html/parsoid
1154 <table>
1155 <tbody><tr><th><i>a</i></th><th><i>b</i></th>
1156 <td><i>a</i></td><td><i>b</i></td></tr>
1157 </tbody></table>
1158 !! end
1159
1160 ###
1161 ### Non-html5 tags
1162 ###
1163
1164 !! test
1165 Non-html5 tags should be accepted
1166 !! wikitext
1167 <center>''foo''</center>
1168 <big>''foo''</big>
1169 <font>''foo''</font>
1170 <strike>''foo''</strike>
1171 <tt>''foo''</tt>
1172 !! html
1173 <center><i>foo</i></center>
1174 <p><big><i>foo</i></big>
1175 <font><i>foo</i></font>
1176 <strike><i>foo</i></strike>
1177 <tt><i>foo</i></tt>
1178 </p>
1179 !! end
1180
1181 !! test
1182 <wbr> is valid wikitext (T54468)
1183 !! wikitext
1184 <wbr>
1185 !! html
1186 <p><wbr />
1187 </p>
1188 !! end
1189
1190 # <strike> is HTML4, <s> is HTML4/5.
1191 !! test
1192 <s> or <strike> for strikethrough
1193 !! wikitext
1194 <strike>strike</strike>
1195
1196 <s>s</s>
1197 !! html
1198 <p><strike>strike</strike>
1199 </p><p><s>s</s>
1200 </p>
1201 !! end
1202
1203 ## a not permitted
1204 ## i,b,br omitted
1205 !! test
1206 Text-level semantic html elements in wikitext
1207 !! wikitext
1208 <em>text</em>
1209 <strong>text</strong>
1210 <small>text</small>
1211 <s>text</s>
1212 <cite>text</cite>
1213 <q>text</q>
1214 <dfn>text</dfn>
1215 <abbr>text</abbr>
1216 <data>text</data>
1217 <time>text</time>
1218 <code>text</code>
1219 <var>text</var>
1220 <samp>text</samp>
1221 <kbd>text</kbd>
1222 <sub>text</sub>
1223 <u>text</u>
1224 <mark>text</mark>
1225 <ruby><rb>明日</rb><rp>(</rp><rt>Ashita</rt><rp> </rp><rtc>あした</rtc><rp>)</rp></ruby>
1226 <bdi>text</bdi>
1227 <bdo>text</bdo>
1228 <span>text</span>
1229 <wbr />
1230 !! html
1231 <p><em>text</em>
1232 <strong>text</strong>
1233 <small>text</small>
1234 <s>text</s>
1235 <cite>text</cite>
1236 <q>text</q>
1237 <dfn>text</dfn>
1238 <abbr>text</abbr>
1239 <data>text</data>
1240 <time>text</time>
1241 <code>text</code>
1242 <var>text</var>
1243 <samp>text</samp>
1244 <kbd>text</kbd>
1245 <sub>text</sub>
1246 <u>text</u>
1247 <mark>text</mark>
1248 <ruby><rb>明日</rb><rp>(</rp><rt>Ashita</rt><rp> </rp><rtc>あした</rtc><rp>)</rp></ruby>
1249 <bdi>text</bdi>
1250 <bdo>text</bdo>
1251 <span>text</span>
1252 <wbr />
1253 </p>
1254 !! end
1255
1256 # test cases taken from
1257 # https://www.w3.org/TR/html5/text-level-semantics.html#the-ruby-element
1258 !! test
1259 Ruby markup (W3C-style)
1260 !! wikitext
1261 ; Mono-ruby for individual base characters
1262 : <ruby>日<rt>に</rt>本<rt>ほん</rt>語<rt>ご</rt></ruby>
1263 ; Group ruby
1264 : <ruby>今日<rt>きょう</rt></ruby>
1265 ; Jukugo ruby
1266 : <ruby>法<rb>華</rb><rb>経</rb><rt>ほ</rt><rt>け</rt><rt>きょう</rt></ruby>
1267 ; Inline ruby
1268 : <ruby>東<rb>京</rb><rp>(</rp><rt>とう</rt><rt>きょう</rt><rp>)</rp></ruby>
1269 ; Double-sided ruby
1270 : <ruby><rb>旧</rb><rb>金</rb><rb>山</rb><rt>jiù</rt><rt>jīn</rt><rt>shān</rt><rtc>San Francisco</rtc></ruby>
1271 <ruby>
1272 <rb>♥</rb><rtc><rt>Heart</rt></rtc><rtc lang="fr"><rt>Cœur</rt></rtc>
1273 <rb>☘</rb><rtc><rt>Shamrock</rt></rtc><rtc lang="fr"><rt>Trèfle</rt></rtc>
1274 <rb>✶</rb><rtc><rt>Star</rt></rtc><rtc lang="fr"><rt>Étoile</rt></rtc>
1275 </ruby>
1276 !! html
1277 <dl><dt> Mono-ruby for individual base characters</dt>
1278 <dd> <ruby>日<rt>に</rt>本<rt>ほん</rt>語<rt>ご</rt></ruby></dd>
1279 <dt> Group ruby</dt>
1280 <dd> <ruby>今日<rt>きょう</rt></ruby></dd>
1281 <dt> Jukugo ruby</dt>
1282 <dd> <ruby>法<rb>華</rb><rb>経</rb><rt>ほ</rt><rt>け</rt><rt>きょう</rt></ruby></dd>
1283 <dt> Inline ruby</dt>
1284 <dd> <ruby>東<rb>京</rb><rp>(</rp><rt>とう</rt><rt>きょう</rt><rp>)</rp></ruby></dd>
1285 <dt> Double-sided ruby</dt>
1286 <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>
1287 <p><ruby>
1288 <rb>♥</rb><rtc><rt>Heart</rt></rtc><rtc lang="fr"><rt>Cœur</rt></rtc>
1289 <rb>☘</rb><rtc><rt>Shamrock</rt></rtc><rtc lang="fr"><rt>Trèfle</rt></rtc>
1290 <rb>✶</rb><rtc><rt>Star</rt></rtc><rtc lang="fr"><rt>Étoile</rt></rtc>
1291 </ruby>
1292 </p>
1293 !! end
1294
1295 # The next two test different paths in the sanitizer.
1296 !! test
1297 Non-word characters don't terminate tag names (T19663, T42670, T54022)
1298 !! wikitext
1299 <blockquote|>a</blockquote>
1300
1301 <b→> doesn't terminate </b→>
1302
1303 <bä> doesn't terminate </bä>
1304
1305 <boo> doesn't terminate </boo>
1306
1307 <s.foo> doesn't terminate </s.foo>
1308
1309 <sub-ID#1>
1310 !! html
1311 <p>&lt;blockquote|&gt;a&lt;/blockquote&gt;
1312 </p><p>&lt;b→&gt; doesn't terminate &lt;/b→&gt;
1313 </p><p>&lt;bä&gt; doesn't terminate &lt;/bä&gt;
1314 </p><p>&lt;boo&gt; doesn't terminate &lt;/boo&gt;
1315 </p><p>&lt;s.foo&gt; doesn't terminate &lt;/s.foo&gt;
1316 </p><p>&lt;sub-ID#1&gt;
1317 </p>
1318 !! end
1319
1320 # There is a tidy bug here: https://sourceforge.net/p/tidy/bugs/946/
1321 # If the non-word-character tag made it through the sanitizer, tidy
1322 # would munge it up.
1323 !! test
1324 Non-word characters don't terminate tag names + tidy
1325 !! wikitext
1326 <blockquote|>a</blockquote>
1327
1328 <b→> doesn't terminate </b→>
1329
1330 <bä> doesn't terminate </bä>
1331
1332 <boo> doesn't terminate </boo>
1333
1334 <s.foo> doesn't terminate </s.foo>
1335
1336 <sub-ID#1>
1337 !! html+tidy
1338 <p>&lt;blockquote|&gt;a</p>
1339 <p>&lt;b→&gt; doesn't terminate &lt;/b→&gt;</p>
1340 <p>&lt;bä&gt; doesn't terminate &lt;/bä&gt;</p>
1341 <p>&lt;boo&gt; doesn't terminate &lt;/boo&gt;</p>
1342 <p>&lt;s.foo&gt; doesn't terminate &lt;/s.foo&gt;</p>
1343 <p>&lt;sub-ID#1&gt;</p>
1344 !! end
1345
1346 ###
1347 ### See tests/parser/parserTestsParserHook.php for the <tåg> extension)
1348 ### This checks that HTML5 tags (with non-word characters in the tag
1349 ### name) make it safely through the parser -- the Sanitizer will
1350 ### munge them later, as it should.
1351 ###
1352 !! test
1353 Non-word characters are valid in extension tags (T19663)
1354 !! wikitext
1355 <tåg>tåg</tåg>
1356 !! html/php
1357 <pre>
1358 'tåg'
1359 array (
1360 )
1361 </pre>
1362
1363 !! html/parsoid
1364 <pre typeof="mw:Extension/tåg" data-mw='{"name":"tåg","attrs":{},"body":{"extsrc":"tåg"}}' data-parsoid='{}' about="#mwt2"></pre>
1365 !! end
1366
1367 !! test
1368 Isolated close tags should be treated as literal text (T54760)
1369 !! options
1370 parsoid=wt2html
1371 !! wikitext
1372 </b>
1373
1374 <s.foo>s</s>
1375 !! html/php+tidy
1376 <p>&lt;s.foo&gt;s</p>
1377 !! html/parsoid
1378 <p>&lt;s.foo&gt;s</p>
1379 !! end
1380
1381 ###
1382 ### Special characters
1383 ###
1384
1385 !! test
1386 Bare pipe character (T54363)
1387 !! wikitext
1388 |
1389 !! html
1390 <p>|
1391 </p>
1392 !! end
1393
1394 !! test
1395 Bare pipe character from a template (T54363)
1396 !! wikitext
1397 {{pipe}}
1398 !! html
1399 <p>|
1400 </p>
1401 !! end
1402
1403 ###
1404 ### <nowiki> test cases
1405 ###
1406
1407 !! test
1408 <nowiki> unordered list
1409 !! wikitext
1410 <nowiki>* This is not an unordered list item.</nowiki>
1411 !! html/php
1412 <p>* This is not an unordered list item.
1413 </p>
1414 !! html/parsoid
1415 <p><span typeof="mw:Nowiki">* This is not an unordered list item.</span></p>
1416 !! end
1417
1418 !! test
1419 <nowiki> spacing
1420 !! wikitext
1421 <nowiki>Lorem ipsum dolor
1422
1423 sed abit.
1424 sed nullum.
1425
1426 :and a colon
1427 </nowiki>
1428 !! html/php
1429 <p>Lorem ipsum dolor
1430
1431 sed abit.
1432 sed nullum.
1433
1434 :and a colon
1435
1436 </p>
1437 !! html/parsoid
1438 <p><span typeof="mw:Nowiki">Lorem ipsum dolor
1439
1440 sed abit.
1441 sed nullum.
1442
1443 :and a colon
1444 </span></p>
1445 !! end
1446
1447 !! test
1448 Don't parse <nowiki><span class="error"></nowiki> (T149622)
1449 !! wikitext
1450 <nowiki><span class="error"></nowiki>
1451 !! html/php
1452 <p>&lt;span class="error"&gt;
1453 </p>
1454 !! html/parsoid
1455 <p><span typeof="mw:Nowiki">&lt;span class="error"></span></p>
1456 !! end
1457
1458 !! test
1459 nowiki 3
1460 !! wikitext
1461 :There is not nowiki.
1462 :There is <nowiki>nowiki</nowiki>.
1463
1464 #There is not nowiki.
1465 #There is <nowiki>nowiki</nowiki>.
1466
1467 *There is not nowiki.
1468 *There is <nowiki>nowiki</nowiki>.
1469 !! html/php
1470 <dl><dd>There is not nowiki.</dd>
1471 <dd>There is nowiki.</dd></dl>
1472 <ol><li>There is not nowiki.</li>
1473 <li>There is nowiki.</li></ol>
1474 <ul><li>There is not nowiki.</li>
1475 <li>There is nowiki.</li></ul>
1476
1477 !! html/parsoid
1478 <dl><dd data-parsoid='{}'>There is not nowiki.</dd>
1479 <dd data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</dd></dl>
1480
1481 <ol><li data-parsoid='{}'>There is not nowiki.</li>
1482 <li data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</li></ol>
1483
1484 <ul><li data-parsoid='{}'>There is not nowiki.</li>
1485 <li data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</li></ul>
1486 !! end
1487
1488 !! test
1489 Entities inside <nowiki>
1490 !! wikitext
1491 <nowiki>&lt;</nowiki>
1492 !! html/php
1493 <p>&lt;
1494 </p>
1495 !! html/parsoid
1496 <p><span typeof="mw:Nowiki"><span typeof="mw:Entity" data-parsoid='{"src":"&amp;lt;","srcContent":"&lt;"}'>&lt;</span></span></p>
1497 !! end
1498
1499 !! test
1500 Entities inside template parameters
1501 !! wikitext
1502 {{echo|&ndash;}}
1503 !! html/php+tidy
1504 <p>–</p>
1505 !! html/parsoid
1506 <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>
1507 !! end
1508
1509 !! test
1510 Properly escape nowiki when combined with other wiki markup
1511 !! options
1512 parsoid=html2wt
1513 !! html/parsoid
1514 <p>* &lt;/nowiki&gt; tag</p>
1515 !! wikitext
1516 <nowiki>*</nowiki> <nowiki>&lt;/nowiki&gt;</nowiki> tag
1517 !! end
1518
1519 !! test
1520 T93824: Put escaped HTML tags inside nowiki
1521 !! options
1522 parsoid=html2wt
1523 !! html/parsoid
1524 <p>&lt;h2&gt;foo&lt;/h2&gt;</p>
1525 !! wikitext
1526 <nowiki><h2>foo</h2></nowiki>
1527 !! end
1528
1529 !! test
1530 T71950: 1. Put nowiki as close to cause as possible, even with non-quote escapable chars
1531 !! options
1532 parsoid=html2wt
1533 !! html/parsoid
1534 <p>This text: L'<a rel="mw:WikiLink" href="./Foo">Foo</a>
1535 This text: L''<a rel="mw:WikiLink" href="./Foo">Foo</a>
1536 This text: L'''<a rel="mw:WikiLink" href="./Foo">Foo</a>''</p>
1537 !! wikitext
1538 This text: L'[[Foo]]
1539 This text: L<nowiki>''</nowiki>[[Foo]]
1540 This text: L<nowiki>'''</nowiki>[[Foo]]<nowiki>''</nowiki>
1541 !! end
1542
1543 # This test fails because wikitext whitespace is not normalized before comparing.
1544 !! test
1545 T71950: 2. Put nowiki as close to cause as possible, after ' :'
1546 !! options
1547 parsoid=html2wt
1548 !! html/parsoid
1549 <p>This text : L''<a rel="mw:WikiLink" href="./Foo">Foo</a>
1550 </p>
1551 !! wikitext
1552 This text : L<nowiki>''</nowiki>[[Foo]]
1553 !! end
1554
1555 # This test and the next one are html2wt only as they test that incorrect wikitext
1556 # passed in template arguments gets escaped or wrapped in nowikis where required.
1557 !! test
1558 T71482: Use {{!}} instead of nowiki for single pipe in template argument
1559 !! options
1560 parsoid=html2wt
1561 !! html/parsoid
1562 <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>
1563 <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>
1564 !! wikitext
1565 {{echo|foo{{!}}bar}}
1566 {{echo|<nowiki>foo|bar |[[</nowiki>}}
1567 !! end
1568
1569 !! test
1570 T53961: Output correct nowikis in template arguments
1571 !! options
1572 parsoid=html2wt
1573 !! html/parsoid
1574 <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>
1575 <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>
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;a [[ b&quot;}},&quot;i&quot;:0}}]}" about="#mwt3"></span>
1577 <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>
1578 <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>
1579 !! wikitext
1580 {{echo|a [ b}}
1581 {{echo|<nowiki>a }} b</nowiki>}}
1582 {{echo|<nowiki>a [[ b</nowiki>}}
1583 {{echo|<nowiki>a | {{ ]]</nowiki>}}
1584 {{echo|a <nowiki>}</nowiki>}}
1585 !! end
1586
1587 !! test
1588 Cases where "!!" needs nowiki protection
1589 !! options
1590 parsoid=html2wt
1591 !! html/parsoid
1592 <table>
1593 <tr><th>this needs protection !! here</th></tr>
1594 </table>
1595
1596 <table>
1597 <tr><th>this does not need
1598 protection !! here</th></tr>
1599 </table>
1600 !! wikitext
1601 {|
1602 !<nowiki>this needs protection !! here</nowiki>
1603 |}
1604
1605 {|
1606 !this does not need
1607 protection !! here
1608 |}
1609 !! end
1610
1611 ###
1612 ### Comments
1613 ###
1614 !! test
1615 Comments and Indent-Pre
1616 !! wikitext
1617 <!-- comment 1 --> asdf
1618
1619 <!-- comment 1 --> asdf
1620 <!-- comment 2 -->
1621
1622 <!-- comment 1 --> asdf
1623 <!-- comment 2 -->xyz
1624
1625 <!-- comment 1 --> asdf
1626 <!-- comment 2 --> xyz
1627 !! html
1628 <pre>asdf
1629 </pre>
1630 <pre>asdf
1631 </pre>
1632 <pre>asdf
1633 </pre>
1634 <p>xyz
1635 </p>
1636 <pre>asdf
1637 xyz
1638 </pre>
1639 !! end
1640
1641 !! test
1642 Comment test 2a
1643 !! wikitext
1644 asdf
1645 <!-- comment 1 -->
1646 jkl
1647 !! html
1648 <p>asdf
1649 jkl
1650 </p>
1651 !! end
1652
1653 !! test
1654 Comment test 2b
1655 !! wikitext
1656 asdf
1657 <!-- comment 1 -->
1658
1659 jkl
1660 !! html
1661 <p>asdf
1662 </p><p>jkl
1663 </p>
1664 !! end
1665
1666 !! test
1667 Comment test 3
1668 !! wikitext
1669 asdf
1670 <!-- comment 1 -->
1671 <!-- comment 2 -->
1672 jkl
1673 !! html
1674 <p>asdf
1675 jkl
1676 </p>
1677 !! end
1678
1679 !! test
1680 Comment test 4
1681 !! wikitext
1682 asdf<!-- comment 1 -->jkl
1683 !! html
1684 <p>asdfjkl
1685 </p>
1686 !! end
1687
1688 !! test
1689 Comment spacing
1690 !! wikitext
1691 a
1692 <!-- foo --> b <!-- bar -->
1693 c
1694 !! html
1695 <p>a
1696 </p>
1697 <pre> b
1698 </pre>
1699 <p>c
1700 </p>
1701 !! end
1702
1703 !! test
1704 Comment whitespace
1705 !! wikitext
1706 <!-- returns a single newline, not nothing, since the newline after > is not stripped -->
1707 !! html
1708
1709 !! end
1710
1711 !! test
1712 Comment semantics and delimiters
1713 !! wikitext
1714 <!-- --><!----><!-----><!------>
1715 !! html/php
1716
1717 !! html/parsoid
1718 <!-- --><!----><!--&#x2D;--><!--&#x2D;&#x2D;-->
1719 !! end
1720
1721 !! test
1722 Comment semantics and delimiters, redux
1723 !! wikitext
1724 <!-- In SGML every "foo" here would actually show up in the text -- foo -- bar
1725 -- foo -- funky huh? ... -->
1726 !! html/php
1727
1728 !! html/parsoid
1729 <!-- In SGML every "foo" here would actually show up in the text &#x2D;&#x2D; foo &#x2D;&#x2D; bar
1730 &#x2D;&#x2D; foo &#x2D;&#x2D; funky huh? ... -->
1731 !! end
1732
1733 !! test
1734 Comment semantics and delimiters: directors cut
1735 !! wikitext
1736 <!-- ... However we like to keep things simple and somewhat XML-ish so we eat
1737 everything starting with < followed by !-- until the first -- and > we see,
1738 that wouldn't be valid XML however, since in XML -- has to terminate a comment
1739 -->-->
1740 !! html/php
1741 <p>--&gt;
1742 </p>
1743 !! html/parsoid
1744 <!-- ... However we like to keep things simple and somewhat XML&#x2D;ish so we eat
1745 everything starting with < followed by !&#x2D;&#x2D; until the first &#x2D;&#x2D; and &#x3E; we see,
1746 that wouldn't be valid XML however, since in XML &#x2D;&#x2D; has to terminate a comment
1747 --><p>--></p>
1748 !! end
1749
1750 !! test
1751 Comment semantics: nesting
1752 !! wikitext
1753 <!--<!-- no, we're not going to do anything fancy here -->-->
1754 !! html/php
1755 <p>--&gt;
1756 </p>
1757 !! html/parsoid
1758 <!--<!&#x2D;&#x2D; no, we're not going to do anything fancy here --><p>--></p>
1759 !! end
1760
1761 # Parsoid closes the unclosed comment, even if it means a slight
1762 # round-trip diff.
1763 !! test
1764 Comment semantics: unclosed comment at end
1765 !! options
1766 parsoid=wt2html,html2html
1767 !! wikitext
1768 <!--This comment will run out to the end of the document
1769 !! html/php
1770
1771 !! html/parsoid
1772 <!--This comment will run out to the end of the document-->
1773 !! end
1774
1775 !! test
1776 Comment semantics: normalize comments to play nice with XML and browsers
1777 !! wikitext
1778 <!-- Browsers --!> think this is closed -->
1779 <!--> This would normally be text -->
1780 <!---> As would this -->
1781 <!-- XML doesn't like trailing dashes -------->
1782 <!-- Nor doubled hyphens -- anywhere in the data -->
1783 But this is not a comment.
1784 !! html/php
1785 <p>But this is not a comment.
1786 </p>
1787 !! html/parsoid
1788 <!-- Browsers &#x2D;&#x2D;!&#x3E; think this is closed -->
1789 <!--&#x3E; This would normally be text -->
1790 <!--&#x2D;&#x3E; As would this -->
1791 <!-- XML doesn't like trailing dashes &#x2D;&#x2D;&#x2D;&#x2D;&#x2D;&#x2D;-->
1792 <!-- Nor doubled hyphens &#x2D;&#x2D; anywhere in the data -->
1793 <p>But this is not a comment.</p>
1794 !! end
1795
1796 !! test
1797 Comment semantics: round-trip even text which contains encoded -->
1798 !! wikitext
1799 <!-- hello & goodbye - > --&gt; --&amp;gt; --&xx -->
1800 !! html/parsoid
1801 <!-- hello &#x26; goodbye &#x2D; &#x3E; &#x2D;&#x2D;&#x3E; &#x2D;&#x2D;&#x26;gt; &#x2D;&#x2D;&#x26;xx -->
1802 !! end
1803
1804 !! test
1805 Comment in template title
1806 !! wikitext
1807 {{f<!---->oo}}
1808 !! html
1809 <p>FOO
1810 </p>
1811 !! end
1812
1813 !! test
1814 Comment on its own line post-expand
1815 !! wikitext
1816 a
1817 {{blank}}<!---->
1818 b
1819 !! html
1820 <p>a
1821 </p><p>b
1822 </p>
1823 !! end
1824
1825 !! test
1826 Comment on its own line post-expand with non-significant whitespace
1827 !! wikitext
1828 a
1829 {{blank}} <!---->
1830 b
1831 !! html
1832 <p>a
1833 </p><p>b
1834 </p>
1835 !! end
1836
1837 !! test
1838 Multiple comments should still parse as SOL-transparent
1839 !! options
1840 parsoid=wt2html,wt2wt
1841 !! wikitext
1842 <!--c1-->*a
1843 <!--c2--><!--c3--><!--c4-->*b
1844 !! html/php
1845 <ul><li>a</li>
1846 <li>b</li></ul>
1847
1848 !! html/parsoid
1849 <!--c1--><ul>
1850 <li>a
1851 </li>
1852 <!--c2--><!--c3--><!--c4-->
1853 <li>b
1854 </li>
1855 </ul>
1856 !! end
1857
1858 ###
1859 ### paragraph wrapping tests
1860 ###
1861 !! test
1862 No block tags
1863 !! wikitext
1864 a
1865
1866 b
1867 !! html
1868 <p>a
1869 </p><p>b
1870 </p>
1871 !! end
1872
1873 !! test
1874 Block tag on one line (<div>)
1875 !! wikitext
1876 a <div>foo</div>
1877
1878 b
1879 !! html
1880 a <div>foo</div>
1881 <p>b
1882 </p>
1883 !! html+tidy
1884 <p>a</p>
1885 <div>foo</div>
1886 <p>b</p>
1887 !! end
1888
1889 !! test
1890 Block tag on one line (<blockquote>)
1891 !! wikitext
1892 a <blockquote>foo</blockquote>
1893
1894 b
1895 !! html
1896 a <blockquote>foo</blockquote>
1897 <p>b
1898 </p>
1899 !! html+tidy
1900 <p>a</p>
1901 <blockquote>
1902 <p>foo</p>
1903 </blockquote>
1904 <p>b</p>
1905 !! end
1906
1907 !! test
1908 Block tag on both lines (<div>)
1909 !! wikitext
1910 a <div>foo</div>
1911
1912 b <div>foo</div>
1913 !! html
1914 a <div>foo</div>
1915 b <div>foo</div>
1916
1917 !! html+tidy
1918 <p>a</p>
1919 <div>foo</div>
1920 <p>b</p>
1921 <div>foo</div>
1922 !! end
1923
1924 !! test
1925 Block tag on both lines (<blockquote>)
1926 !! wikitext
1927 a <blockquote>foo</blockquote>
1928
1929 b <blockquote>foo</blockquote>
1930 !! html
1931 a <blockquote>foo</blockquote>
1932 b <blockquote>foo</blockquote>
1933
1934 !! html+tidy
1935 <p>a</p>
1936 <blockquote>
1937 <p>foo</p>
1938 </blockquote>
1939 <p>b</p>
1940 <blockquote>
1941 <p>foo</p>
1942 </blockquote>
1943 !! end
1944
1945 !! test
1946 Multiple lines without block tags
1947 !! wikitext
1948 <div>foo</div> a
1949 b
1950 c
1951 d<!--foo--> e
1952 x <div>foo</div> z
1953 !! html
1954 <div>foo</div> a
1955 <p>b
1956 c
1957 d e
1958 </p>
1959 x <div>foo</div> z
1960
1961 !! html+tidy
1962 <div>foo</div>
1963 <p>a</p>
1964 <p>b c d e</p>
1965 <p>x</p>
1966 <div>foo</div>
1967 <p>z</p>
1968 !! end
1969
1970 # Tidy strips out the empty <div> tags. Parsoid doesn't.
1971 # So, we have a separate section for Parsoid. We don't want
1972 # to mimic this stripping behavior in Parsoid. It affects
1973 # editing experience and also requires us to maintain additional
1974 # info for RT-ing.
1975 !! test
1976 Empty lines between lines with block tags
1977 !! wikitext
1978 <div></div>
1979
1980
1981 <div></div>a
1982
1983 b
1984 <div>a</div>b
1985
1986 <div>b</div>d
1987
1988
1989 <div>e</div>
1990 !! html
1991 <div></div>
1992 <p><br />
1993 </p>
1994 <div></div>a
1995 <p>b
1996 </p>
1997 <div>a</div>b
1998 <div>b</div>d
1999 <p><br />
2000 </p>
2001 <div>e</div>
2002
2003 !! html+tidy
2004 <p><br /></p>
2005 <p>a</p>
2006 <p>b</p>
2007 <div>a</div>
2008 <p>b</p>
2009 <div>b</div>
2010 <p>d</p>
2011 <p><br /></p>
2012 <div>e</div>
2013 !! html/parsoid
2014 <div data-parsoid='{"stx":"html"}'></div>
2015
2016 <p><br /></p>
2017 <div data-parsoid='{"stx":"html"}'></div><p>a</p>
2018
2019 <p>b</p>
2020 <div data-parsoid='{"stx":"html"}'>a</div><p>b</p>
2021
2022 <div data-parsoid='{"stx":"html"}'>b</div><p>d</p>
2023
2024 <p><br /></p>
2025 <div data-parsoid='{"stx":"html"}'>e</div>
2026 !! end
2027
2028 ## PHP parser emits output which is broken
2029 !! test
2030 Unclosed HTML p-tags should be handled properly
2031 !! wikitext
2032 <div><p>foo</div>
2033 a
2034
2035 b
2036 !! html/php+tidy
2037 <div>
2038 <p>foo</p>
2039 </div>
2040 <p>a</p>
2041 <p>b</p>
2042 !! html/parsoid
2043 <div data-parsoid='{"stx":"html"}'><p data-parsoid='{"stx":"html", "autoInsertedEnd":true}'>foo</p></div>
2044 <p>a</p>
2045 <p>b</p>
2046 !! end
2047
2048 ## SSS FIXME: I can come up with other scenarios where this doesn't work because
2049 ## of eager output of buffered tokens in the p-wrapper. But, I'm going to ignore
2050 ## them for now.
2051 !! test
2052 1. P-wrapping should leave sol-transparent tags outside p-tags where possible
2053 !! options
2054 parsoid=wt2html
2055 !! wikitext
2056 a [[Category:A1]] [[Category:A2]]
2057 [[Category:A3]]
2058 [[Category:A4]]
2059 !! html/parsoid
2060 <p>a</p>
2061 <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"/>
2062 !! end
2063
2064 !! test
2065 2. P-wrapping should leave sol-transparent tags outside p-tags where possible
2066 !! options
2067 parsoid=wt2html
2068 !! wikitext
2069 [[Category:A1]]a
2070 !! html/parsoid
2071 <link rel="mw:PageProp/Category" href="./Category:A1"/><p>a</p>
2072 !! end
2073
2074 ###
2075 ### Preformatted text
2076 ###
2077 !! test
2078 Preformatted text
2079 !! wikitext
2080 This is some
2081 Preformatted text
2082 With ''italic''
2083 And '''bold'''
2084 And a [[Main Page|link]]
2085 !! html
2086 <pre>This is some
2087 Preformatted text
2088 With <i>italic</i>
2089 And <b>bold</b>
2090 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
2091 </pre>
2092 !! end
2093
2094 !! test
2095 Tabs don't trigger preformatted text
2096 !! wikitext
2097 This is not
2098 preformatted text.
2099 This is preformatted text.
2100 So is this.
2101 !! html/php
2102 <p> This is not
2103 preformatted text.
2104 </p>
2105 <pre>This is preformatted text.
2106 So is this.
2107 </pre>
2108 !! html/parsoid
2109 <p> This is not
2110 preformatted text.</p>
2111 <pre>This is preformatted text.
2112 So is this.</pre>
2113 !! end
2114
2115 !! test
2116 Space before tab needs nowiki pre protection
2117 !! options
2118 parsoid=html2wt
2119 !! html/parsoid
2120 <p> a</p>
2121 !! wikitext
2122 <nowiki> </nowiki> a
2123 !! end
2124
2125 !! test
2126 Ident preformatting with inline content
2127 !! wikitext
2128 a
2129 ''b''
2130 !! html
2131 <pre>a
2132 <i>b</i>
2133 </pre>
2134 !! end
2135
2136 !! test
2137 <pre> with <nowiki> inside (compatibility with 1.6 and earlier)
2138 !! wikitext
2139 <pre><nowiki>
2140 <b>
2141 <cite>
2142 <em>
2143 </nowiki></pre>
2144 !! html
2145 <pre>
2146 &lt;b&gt;
2147 &lt;cite&gt;
2148 &lt;em&gt;
2149 </pre>
2150
2151 !! end
2152
2153 !! test
2154 Regression with preformatted in <center>
2155 !! wikitext
2156 <center>
2157 Blah
2158 </center>
2159 !! html
2160 <center>
2161 <pre>Blah
2162 </pre>
2163 </center>
2164
2165 !! end
2166
2167 !! test
2168 T54763: Preformatted in <blockquote>
2169 !! wikitext
2170 <blockquote>
2171 Blah
2172 {|
2173 |
2174 indented cell (no pre-wrapping!)
2175 |}
2176 </blockquote>
2177 !! html
2178 <blockquote>
2179 <p> Blah
2180 </p>
2181 <table>
2182 <tr>
2183 <td>
2184 <p> indented cell (no pre-wrapping!)
2185 </p>
2186 </td></tr></table>
2187 </blockquote>
2188
2189 !! end
2190
2191 !! test
2192 T53086: Double newlines in blockquotes should be turned into paragraphs
2193 !! wikitext
2194 <blockquote>
2195 Foo
2196
2197 Bar
2198 </blockquote>
2199 !! html
2200 <blockquote>
2201 <p>Foo
2202 </p><p>Bar
2203 </p>
2204 </blockquote>
2205
2206 !! end
2207
2208 !! test
2209 T17491: <ins>/<del> in blockquote
2210 !! wikitext
2211 <blockquote>
2212 Foo <del>bar</del> <ins>baz</ins> quux
2213 </blockquote>
2214 !! html
2215 <blockquote>
2216 <p>Foo <del>bar</del> <ins>baz</ins> quux
2217 </p>
2218 </blockquote>
2219
2220 !! end
2221
2222 # Note that the p-wrapping is newline sensitive, which could be
2223 # considered a bug: tidy will wrap only the 'Foo' in the example
2224 # below in a <p> tag. (see comment 23-25 of T8200)
2225 !! test
2226 T17491: <ins>/<del> in blockquote (2)
2227 !! wikitext
2228 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
2229 </blockquote>
2230 !! html
2231 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
2232 </blockquote>
2233
2234 !! html+tidy
2235 <blockquote>
2236 <p>Foo</p>
2237 <del>bar</del> <ins>baz</ins> quux</blockquote>
2238 !! end
2239
2240 !! test
2241 <pre> with attributes (T5202)
2242 !! wikitext
2243 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
2244 !! html
2245 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
2246
2247 !! end
2248
2249 !! test
2250 <pre> with width attribute (T5202)
2251 !! wikitext
2252 <pre width="8">Narrow screen goodies</pre>
2253 !! html
2254 <pre width="8">Narrow screen goodies</pre>
2255
2256 !! end
2257
2258 !! test
2259 <pre> with forbidden attribute (T5202)
2260 !! wikitext
2261 <pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
2262 !! html
2263 <pre width="8">Narrow screen goodies</pre>
2264
2265 !! end
2266
2267 !! test
2268 Entities inside <pre>
2269 !! wikitext
2270 <pre>&lt;</pre>
2271 !! html
2272 <pre>&lt;</pre>
2273
2274 !! end
2275
2276 !! test
2277 <pre> with forbidden attribute values (T5202)
2278 !! wikitext
2279 <pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
2280 !! html
2281 <pre width="8" style="/* insecure input */">Narrow screen goodies</pre>
2282
2283 !! end
2284
2285 !! test
2286 <nowiki> inside <pre> (T15238)
2287 !! wikitext
2288 <pre>
2289 <nowiki>
2290 </pre>
2291 <pre>
2292 <nowiki></nowiki>
2293 </pre>
2294 <pre><nowiki><nowiki></nowiki>Foo<nowiki></nowiki></nowiki></pre>
2295 !! html
2296 <pre>
2297 &lt;nowiki&gt;
2298 </pre>
2299 <pre>
2300
2301 </pre>
2302 <pre>&lt;nowiki&gt;Foo&lt;/nowiki&gt;</pre>
2303
2304 !! end
2305
2306 !! test
2307 <nowiki> inside of #tag:pre
2308 !! wikitext
2309 {{#tag:pre|Foo <nowiki>&rarr;bar</nowiki>}}
2310 !! html/php
2311 <pre>Foo &#8594;bar</pre>
2312
2313 !! html/parsoid
2314 <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>
2315 !! end
2316
2317 ## Don't expect this to rt, Parsoid drops the unmatched closing pre tags that
2318 ## aren't enclosed in nowikis.
2319 !! test
2320 <nowiki> and <pre> preference (first one wins)
2321 !! options
2322 parsoid=wt2html
2323 !! wikitext
2324 <pre>
2325 <nowiki>
2326 </pre>
2327 </nowiki>
2328 </pre>
2329
2330 <nowiki>
2331 <pre>
2332 <nowiki>
2333 </pre>
2334 </nowiki>
2335 </pre>
2336
2337 !! html/php
2338 <pre>
2339 &lt;nowiki&gt;
2340 </pre>
2341 <p>&lt;/nowiki&gt;
2342 &lt;/pre&gt;
2343 </p><p>
2344 &lt;pre&gt;
2345 &lt;nowiki&gt;
2346 &lt;/pre&gt;
2347
2348 &lt;/pre&gt;
2349 </p>
2350 !! html/parsoid
2351 <pre typeof="mw:Extension/pre" about="#mwt2" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\n&lt;nowiki>\n"}}'>&lt;nowiki>
2352 </pre>
2353 <p>&lt;/nowiki></p>
2354
2355
2356 <p><span typeof="mw:Nowiki">
2357 &lt;pre>
2358 &lt;nowiki>
2359 &lt;/pre>
2360 </span></p>
2361 !! end
2362
2363 !! test
2364 </pre> inside nowiki
2365 !! wikitext
2366 <nowiki></pre></nowiki>
2367 !! html
2368 <p>&lt;/pre&gt;
2369 </p>
2370 !! end
2371
2372 # Parsoid doesn't strip empty tags, like Tidy does.
2373 !! test
2374 Empty pre; pre inside other HTML tags (T56946)
2375 !! wikitext
2376 a
2377
2378 <div><pre>
2379 foo
2380 </pre></div>
2381 <pre></pre>
2382 !! html/php
2383 <p>a
2384 </p>
2385 <div><pre>
2386 foo
2387 </pre></div>
2388 <pre></pre>
2389
2390 !! html/php+tidy
2391 <p>a</p>
2392 <div>
2393 <pre>
2394 foo
2395 </pre></div>
2396 !! html/parsoid
2397 <p>a</p>
2398
2399 <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
2400 </pre></div>
2401 <pre typeof="mw:Extension/pre" about="#mwt4" data-parsoid='{"stx":"html"}' data-mw='{"name":"pre","attrs":{},"body":{"extsrc":""}}'></pre>
2402 !! end
2403
2404 !! test
2405 HTML pre followed by indent-pre
2406 !! wikitext
2407 <pre>foo</pre>
2408 bar
2409 !! html
2410 <pre>foo</pre>
2411 <pre>bar
2412 </pre>
2413 !! end
2414
2415 # Note that tidy removes the empty <p> tags from the start and end.
2416 # Parsoid does not, by design.
2417 !! test
2418 Block tag pre
2419 !! wikitext
2420 <p><pre>foo</pre></p>
2421 !! html/php+tidy
2422 <pre>
2423 foo
2424 </pre>
2425 !! html/parsoid
2426 <p data-parsoid='{"stx":"html","autoInsertedEnd":true}'></p><pre typeof="mw:Extension/pre" about="#mwt2" data-parsoid='{"stx":"html"}' data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"foo"}}'>foo</pre><p data-parsoid='{"autoInsertedStart":true,"stx":"html"}'></p>
2427 !! end
2428
2429 !!test
2430 Templates: Indent-Pre: 1a. Templates that break a line should suppress <pre>
2431 !! wikitext
2432 {{echo|}}
2433 !! html
2434
2435 !!end
2436
2437 !!test
2438 Templates: Indent-Pre: 1b. Templates that break a line should suppress <pre>
2439 !! wikitext
2440 {{echo|
2441 foo}}
2442 !! html
2443 <p>foo
2444 </p>
2445 !!end
2446
2447 !! test
2448 Templates: Indent-Pre: 1c: Wrapping should be based on expanded content
2449 !! wikitext
2450 {{echo|a
2451 b}}
2452 !! html
2453 <pre>a
2454 </pre>
2455 <p>b
2456 </p>
2457 !!end
2458
2459 !! test
2460 Templates: Indent-Pre: 1d: Wrapping should be based on expanded content
2461 !! wikitext
2462 {{echo|a
2463 b
2464 c
2465 d
2466 e
2467 }}
2468 !! html
2469 <pre>a
2470 </pre>
2471 <p>b
2472 c
2473 </p>
2474 <pre>d
2475 </pre>
2476 <p>e
2477 </p>
2478 !!end
2479
2480 !!test
2481 Templates: Indent-Pre: 1e. Wrapping should be based on expanded content
2482 !! wikitext
2483 {{echo| foo}}
2484
2485 {{echo| foo}}{{echo| bar}}
2486
2487 {{echo| foo}}
2488 {{echo| bar}}
2489
2490 {{echo|<!--cmt--> foo}}
2491
2492 <!--cmt-->{{echo| foo}}
2493
2494 {{echo|{{echo| }}bar}}
2495 !! html
2496 <pre>foo
2497 </pre>
2498 <pre>foo bar
2499 </pre>
2500 <pre>foo
2501 bar
2502 </pre>
2503 <pre>foo
2504 </pre>
2505 <pre>foo
2506 </pre>
2507 <pre>bar
2508 </pre>
2509 !!end
2510
2511 !! test
2512 Templates: Indent-Pre: 1f: Wrapping should be based on expanded content
2513 !! wikitext
2514 {{echo| }}a
2515
2516 {{echo|
2517 }}a
2518
2519 {{echo|
2520 b}}
2521
2522 {{echo|a
2523 }}b
2524
2525 {{echo|a
2526 }} b
2527 !! html
2528 <pre>a
2529 </pre>
2530 <p><br />
2531 </p>
2532 <pre>a
2533 </pre>
2534 <p><br />
2535 </p>
2536 <pre>b
2537 </pre>
2538 <p>a
2539 </p>
2540 <pre>b
2541 </pre>
2542 <p>a
2543 </p>
2544 <pre>b
2545 </pre>
2546 !!end
2547
2548 ## Hmm, should Parsoid rt this?
2549 !! test
2550 Pres with newline attributes
2551 !! options
2552 parsoid=wt2html,html2html
2553 !! wikitext
2554 <pre class="one
2555 two">hi</pre>
2556 !! html/php
2557 <pre class="one two">hi</pre>
2558
2559 !! html/parsoid
2560 <pre typeof="mw:Extension/pre" about="#mwt2" class="one two" data-mw='{"name":"pre","attrs":{"class":"one two"},"body":{"extsrc":"hi"}}'>hi</pre>
2561 !! end
2562
2563 !! test
2564 Things that look like <pre> tags aren't treated as such
2565 !! wikitext
2566 Barack Obama <President> of the United States
2567 <President></President>
2568 !! html
2569 <p>Barack Obama &lt;President&gt; of the United States
2570 &lt;President&gt;&lt;/President&gt;
2571 </p>
2572 !! end
2573
2574 !! test
2575 Handle broken pre-like tags (T66025)
2576 !! options
2577 parsoid=wt2html
2578 !! wikitext
2579 {{echo|<pre <pre>x</pre>}}
2580
2581 <table><pre </table>
2582 !! html/php
2583 <pre>x</pre>
2584 <table>&lt;pre </table>
2585
2586 !! html/php+tidy
2587 <pre>
2588 x
2589 </pre>
2590 <p>&lt;pre</p>
2591 !! html/parsoid
2592 <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>
2593
2594
2595 <p>&lt;pre </p>
2596
2597 <table></table>
2598 !! end
2599
2600 !! test
2601 Parsoid: handle pre with space after attribute
2602 !! options
2603 parsoid=wt2html
2604 !! wikitext
2605 <pre style="width:50%;" >{{echo|foo}}</pre>
2606 !! html/php
2607 <pre style="width:50%;">{{echo|foo}}</pre>
2608
2609 !! html/parsoid
2610 <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>
2611 !! end
2612
2613 # TODO / maybe: fix wt2wt for this
2614 !! test
2615 Parsoid: Don't paragraph-wrap fosterable content
2616 !! options
2617 parsoid=wt2html
2618 !! wikitext
2619 {|
2620 <td></td>
2621 <td></td>
2622
2623
2624
2625 |}
2626 !! html
2627 <table>
2628
2629 <tbody>
2630 <tr>
2631 <td></td>
2632
2633 <td></td></tr>
2634
2635
2636
2637 </tbody></table>
2638 !! end
2639
2640 !! test
2641 Parsoid: Don't paragraph-wrap fosterable content even if table syntax is unbalanced
2642 !! options
2643 parsoid=wt2html
2644 !! wikitext
2645 {|
2646 <td>
2647 <td>
2648 </td>
2649
2650
2651
2652 |}
2653 !! html
2654 <table>
2655
2656 <tbody>
2657 <tr>
2658 <td></td>
2659
2660 <td>
2661 </td></tr>
2662
2663
2664
2665 </tbody></table>
2666 !! end
2667
2668
2669 #--------------------------------------------------------------------
2670 # Transclusion parameter whitespace stripping tests
2671 # Behavior is different for positional and named parameters
2672 #--------------------------------------------------------------------
2673 !! test
2674 Templates: Strip leading and trailing whitespace from named-param values
2675 !! wikitext
2676 {{echo|1= a }}
2677
2678 {{echo|1= {{echo|b}} }}
2679
2680 {{echo| 1 =
2681 c }}
2682
2683 {{echo| 1 =
2684 * d
2685 }}
2686 !! html
2687 <p>a
2688 </p><p>b
2689 </p><p>c
2690 </p>
2691 <ul><li> d</li></ul>
2692
2693 !! end
2694
2695 !! test
2696 Templates: Don't strip whitespace from positional-param values
2697 !! wikitext
2698 {{echo|a }}
2699
2700 {{echo|{{echo|b}} }}
2701
2702 {{echo| c
2703 }}
2704
2705 {{echo| {{echo|d}}
2706 }}
2707
2708 {{echo|
2709 e}}
2710
2711 {{echo|
2712 * f}}
2713
2714 {{echo|
2715 }}g
2716 !! html
2717 <p>a
2718 </p><p>b
2719 </p>
2720 <pre>c
2721 </pre>
2722 <p><br />
2723 </p>
2724 <pre>d
2725 </pre>
2726 <p><br />
2727 </p>
2728 <pre>e
2729 </pre>
2730 <p><br />
2731 </p>
2732 <ul><li> f</li></ul>
2733 <p><br />
2734 </p>
2735 <pre>g
2736 </pre>
2737 !! end
2738
2739 !! test
2740 Templates: Don't recognize targets split by newlines
2741 !! options
2742 parsoid=wt2html
2743 !! wikitext
2744 {{ech
2745 o|foo}}
2746 !! html/php
2747 <p>{{ech
2748 o|foo}}
2749 </p>
2750 !! html/parsoid
2751 <p>{{ech
2752 o|foo}}</p>
2753 !! end
2754
2755 !! test
2756 Templates: Recognize targets when newlines and comments don't split the target
2757 !! options
2758 parsoid=wt2html
2759 !! wikitext
2760 {{
2761 <!--X--> ech<!--X-->o<!--X-->
2762 <!--X--> <!--X-->
2763
2764 |foo}}
2765 !! html/php
2766 <p>foo
2767 </p>
2768 !! html/parsoid
2769 <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>
2770 !! end
2771
2772 !! test
2773 Templates: Handle empty comment-and-ws-only lines correctly
2774 !! wikitext
2775 {{echo|foo
2776 <!--should be ignored-->
2777 <!--should be ignored as well-->
2778 bar}}
2779 !! html/php
2780 <p>foo
2781 bar
2782 </p>
2783 !! html/parsoid
2784 <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>
2785 !! end
2786
2787 !! test
2788 Templates: Handle comments in the target
2789 !! wikitext
2790 {{echo
2791 <!-- should be ignored -->
2792 |foo}}
2793
2794 {{echo
2795 <!-- should be ignored and spaces on next line should not trip us up (T147742) -->
2796 |foo}}
2797
2798 {{echo<!-- should be ignored -->
2799 |foo}}
2800
2801 {{echo<!-- should be ignored -->|foo}}
2802
2803 {{<!-- should be ignored -->echo|foo}}
2804 !! html/php
2805 <p>foo
2806 </p><p>foo
2807 </p><p>foo
2808 </p><p>foo
2809 </p><p>foo
2810 </p>
2811 !! html/parsoid
2812 <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>
2813
2814 <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>
2815
2816 <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>
2817
2818 <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>
2819
2820 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2821 !!end
2822
2823 !! test
2824 Templates: Handle comments in parameter names (T69657)
2825 !! wikitext
2826 {{echo|1
2827 <!-- should be ignored -->
2828 =foo}}
2829
2830 {{echo|
2831 <!-- should be ignored -->
2832 1 = foo}}
2833
2834 {{echo|1<!-- should be ignored -->=foo}}
2835
2836 {{echo|<!-- should be ignored -->1=foo}}
2837 !! html/php
2838 <p>foo
2839 </p><p>foo
2840 </p><p>foo
2841 </p><p>foo
2842 </p>
2843 !! html/parsoid
2844 <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>
2845
2846 <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>
2847
2848 <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>
2849
2850 <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>
2851 !!end
2852
2853 !! test
2854 Templates: Other wikitext in parameter names (T69657)
2855 !! wikitext
2856 {{echo|''1''=foo}}
2857 !! html/php
2858 <p>{{{1}}}
2859 </p>
2860 !! html/parsoid
2861 <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>
2862 !!end
2863
2864 #--------------------------------------------------------------------
2865 # Transclusion parameter escaping tests
2866 #--------------------------------------------------------------------
2867 !! test
2868 Templates: Parsoid parameter escaping test 1
2869 !! wikitext
2870 {{echo|[foo]|{{echo|[bar]}}}}
2871 !! html/php+tidy
2872 <p>[foo]</p>
2873 !! html/parsoid
2874 <p about="#mwt1" typeof="mw:Transclusion"
2875 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[foo]"},"2":{"wt":"{{echo|[bar]}}"}},"i":0}}]}'>[foo]</p>
2876 !! end
2877
2878 !! test
2879 Parsoid: Pipes in external links in template parameter
2880 !! wikitext
2881 {{echo|[{{echo|http://example.com}} link]}}
2882 !! html/php+tidy
2883 <p><a rel="nofollow" class="external text" href="http://example.com">link</a></p>
2884 !! html/parsoid
2885 <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>
2886 !! end
2887
2888 !! test
2889 Parsoid: pipe in transclusion parameter
2890 !! wikitext
2891 {{echo|http://foo.com/a&#124;b}}
2892 !! html/php+tidy
2893 <p><a rel="nofollow" class="external free" href="http://foo.com/a%7Cb">http://foo.com/a%7Cb</a></p>
2894 !! html/parsoid
2895 <p><a rel="mw:ExtLink" href="http://foo.com/a%7Cb" about="#mwt1"
2896 typeof="mw:Transclusion"
2897 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>
2898 !! end
2899
2900 !! test
2901 Parsoid: Pipe in external link target and content in template parameter
2902 !! options
2903 parsoid=html2wt,wt2wt
2904 !! wikitext
2905 {{echo|[http://foo.com/a&#124;b a&#124;b]}}
2906 !! html/php+tidy
2907 <p><a rel="nofollow" class="external text" href="http://foo.com/a%7Cb">a|b</a></p>
2908 !! html/parsoid
2909 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2910 typeof="mw:Transclusion"
2911 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},
2912 "params":{"1":{"wt":"[http://foo.com/a|b a|b]"}},"i":0}}]}'>a|b</a></p>
2913 !! end
2914
2915 !! test
2916 Parsoid: Pipe in template with nested template in external link target in template parameter (seriously)
2917 !! options
2918 parsoid
2919 !! wikitext
2920 {{echo|[{{fullurl:{{FULLPAGENAME}}|action=edit}} bar]}}
2921 !! html
2922 <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>
2923 !! end
2924
2925 !! test
2926 Templates: Don't escape already nowiki-escaped text in template parameters
2927 !! options
2928 parsoid=html2wt,wt2wt
2929 !! wikitext
2930 {{echo|foo<nowiki>|</nowiki>bar}}
2931 {{echo|<nowiki>&lt;div&gt;</nowiki>}}
2932 {{echo|<nowiki></nowiki>}}
2933 !! html/php+tidy
2934 <p>foo|bar &lt;div&gt;</p>
2935 !! html/parsoid
2936 <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>
2937 <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>
2938 <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>
2939 </p>
2940 !! end
2941
2942 ## T54824
2943 !! test
2944 Templates: '=' char in nested transclusions should not trigger nowiki escapes or conversion to named param
2945 !! options
2946 parsoid=html2wt,wt2wt
2947 !! wikitext
2948 {{echo|{{echo|1=bar}}}}
2949 !! html/php+tidy
2950 <p>bar</p>
2951 !! html/parsoid
2952 <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>
2953 !! end
2954
2955 ## T58733
2956 !! test
2957 Templates parameters with special tokenizing behavior dont get modified because of arg escaping
2958 !! wikitext
2959 {{echo|a : b}}
2960 !! html/php+tidy
2961 <p>a&#160;: b</p>
2962 !! html/parsoid
2963 <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>
2964 !! end
2965
2966 ## T73412
2967 !! test
2968 Templates: Preserve blank parameter names
2969 !! wikitext
2970 {{echo|=foo}}
2971 !! html/php+tidy
2972 <p>{{{1}}}</p>
2973 !! html/parsoid
2974 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"":{"wt":"foo"}},"i":0}}]}'>{{{1}}}</p>
2975 !! end
2976
2977 !! test
2978 Templates: Preserve blank parameter names in other positions
2979 !! wikitext
2980 {{blank_param|bar|=foo}}
2981 !! html/php+tidy
2982 <p>bar foo</p>
2983 !! html/parsoid
2984 <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
2985 foo</p>
2986 !! end
2987
2988 ###
2989 ### Parsoid-centric tests for testing RT edge cases for pre
2990 ###
2991
2992 !!test
2993 1a. Indent-Pre and Comments
2994 !! wikitext
2995 a
2996 <!--a-->
2997 c
2998 !! html
2999 <pre>a
3000 </pre>
3001 <p>c
3002 </p>
3003 !!end
3004
3005 !!test
3006 1b. Indent-Pre and Comments
3007 !! wikitext
3008 a
3009 <!--a-->
3010 c
3011 !! html
3012 <pre>a
3013 </pre>
3014 <p>c
3015 </p>
3016 !!end
3017
3018 !!test
3019 1c. Indent-Pre and Comments
3020 !! wikitext
3021 <!--a--> a
3022
3023 <!--a--> a
3024 !! html
3025 <pre> a
3026 </pre>
3027 <pre> a
3028 </pre>
3029 !!end
3030
3031 !!test
3032 1d. Indent-Pre and Comments
3033 (Pre-handler currently cannot distinguish between comment/ws order and normalizes them to [comment,ws] order)
3034 !! wikitext
3035 <!--a--> a
3036
3037 <!--b-->b
3038 !! html
3039 <pre>a
3040 </pre>
3041 <pre>b
3042 </pre>
3043 !!end
3044
3045 !!test
3046 2a. Indent-Pre and tables
3047 !! wikitext
3048 {|
3049 |-
3050 !h1!!h2
3051 |foo||bar
3052 |}
3053 !! html
3054 <table>
3055
3056 <tr>
3057 <th>h1</th>
3058 <th>h2
3059 </th>
3060 <td>foo</td>
3061 <td>bar
3062 </td></tr></table>
3063
3064 !!end
3065
3066 !!test
3067 2b. Indent-Pre and tables
3068 !! wikitext
3069 {|
3070 |-
3071 |foo
3072 |}
3073 !! html
3074 <table>
3075
3076 <tr>
3077 <td>foo
3078 </td></tr></table>
3079
3080 !!end
3081
3082 !!test
3083 2c. Indent-Pre and tables (T44252)
3084 !! wikitext
3085 {|
3086 |+ foo
3087 ! | bar
3088 |}
3089 !! html
3090 <table>
3091 <caption> foo
3092 </caption>
3093 <tr>
3094 <th> bar
3095 </th></tr></table>
3096
3097 !!end
3098
3099 !!test
3100 2d. Indent-Pre and tables
3101 !! wikitext
3102 a
3103 {|
3104 | b
3105 |}
3106 !! html/php
3107 <pre>a
3108 </pre>
3109 <table>
3110 <tr>
3111 <td> b
3112 </td></tr></table>
3113
3114 !! html/parsoid
3115 <pre>a</pre>
3116 <table>
3117 <tbody><tr><td> b</td></tr>
3118 </tbody></table>
3119 !!end
3120
3121 !!test
3122 2e. Indent-Pre and table-line syntax
3123 !! wikitext
3124 a
3125 | b
3126 | c
3127 !! html/php
3128 <pre>a
3129 | b
3130 | c
3131 </pre>
3132 !!end
3133
3134 !!test
3135 2f. Indent-pre started by table-line syntax
3136 !! wikitext
3137 a
3138 | b
3139 | c
3140 !! html/php
3141 <p>a
3142 </p>
3143 <pre>| b
3144 | c
3145 </pre>
3146 !! html/parsoid
3147 <p>a</p>
3148 <pre>
3149 | b
3150 | c</pre>
3151 !!end
3152
3153 !! test
3154 2g. Indented table markup mixed with indented pre content (proposed in T8200)
3155 !! wikitext
3156 <table>
3157 <tr>
3158 <td>
3159 Text that should be rendered preformatted
3160 </td>
3161 </tr>
3162 </table>
3163 !! html
3164 <table>
3165 <tr>
3166 <td>
3167 <pre>Text that should be rendered preformatted
3168 </pre>
3169 </td>
3170 </tr>
3171 </table>
3172
3173 !! end
3174
3175 !!test
3176 3a. Indent-Pre and block tags (single-line html)
3177 !! wikitext
3178 a <p> foo </p>
3179 b <div> foo </div>
3180 c <blockquote> foo </blockquote>
3181 <span> foo </span>
3182 !! html
3183 a <p> foo </p>
3184 b <div> foo </div>
3185 c <blockquote> foo </blockquote>
3186 <pre><span> foo </span>
3187 </pre>
3188 !! html/parsoid
3189 <p>a </p><p data-parsoid='{"stx":"html"}'> foo </p>
3190 <p>b </p><div data-parsoid='{"stx":"html"}'> foo </div>
3191 <p>c </p><blockquote data-parsoid='{"stx":"html"}'> foo </blockquote>
3192 <pre><span> foo </span>
3193 </pre>
3194 !! html+tidy
3195 <p>a</p>
3196 <p>foo</p>
3197 <p>b</p>
3198 <div>foo</div>
3199 <p>c</p>
3200 <blockquote>
3201 <p>foo</p>
3202 </blockquote>
3203 <pre>
3204 <span> foo </span>
3205 </pre>
3206 !! end
3207
3208 !!test
3209 3b. Indent-Pre and block tags (multi-line html)
3210 !! wikitext
3211 a <span>foo</span>
3212 b <div> foo </div>
3213 !! html
3214 <pre>a <span>foo</span>
3215 </pre>
3216 b <div> foo </div>
3217
3218 !! html/parsoid
3219 <pre>a <span data-parsoid='{"stx":"html"}'>foo</span></pre>
3220 b <div data-parsoid='{"stx":"html"}'> foo </div>
3221 !! html+tidy
3222 <pre>
3223 a <span>foo</span>
3224 </pre>
3225 <p>b</p>
3226 <div>foo</div>
3227 !!end
3228
3229 !!test
3230 3c. Indent-Pre and block tags (pre-content on separate line)
3231 !! wikitext
3232 <p>
3233 foo
3234 </p>
3235
3236 <div>
3237 foo
3238 </div>
3239
3240 <center>
3241 foo
3242 </center>
3243
3244 <blockquote>
3245 foo
3246 </blockquote>
3247
3248 <blockquote>
3249 <pre>
3250 foo
3251 </pre>
3252 </blockquote>
3253
3254 <table><tr><td>
3255 foo
3256 </td></tr></table>
3257
3258 <ul><li>
3259 foo
3260 </li></ul>
3261
3262 !! html
3263 <p>
3264 foo
3265 </p>
3266 <div>
3267 <pre>foo
3268 </pre>
3269 </div>
3270 <center>
3271 <pre>foo
3272 </pre>
3273 </center>
3274 <blockquote>
3275 <p> foo
3276 </p>
3277 </blockquote>
3278 <blockquote>
3279 <pre>
3280 foo
3281 </pre>
3282 </blockquote>
3283 <table><tr><td>
3284 <pre>foo
3285 </pre>
3286 </td></tr></table>
3287 <ul><li>
3288 foo
3289 </li></ul>
3290
3291 !!end
3292
3293 !! test
3294 4. Indent-Pre and extension tags
3295 !! wikitext
3296 a <tag />
3297 !! html/php
3298 a <pre>
3299 NULL
3300 array (
3301 )
3302 </pre>
3303
3304 !! html/parsoid
3305 a <pre typeof="mw:Extension/tag" about="#mwt2" data-parsoid='{}' data-mw='{"name":"tag","attrs":{},"body":null}'></pre>
3306 !! end
3307
3308 !! test
3309 5. Indent-Pre and html pre
3310 !! wikitext
3311 <pre class="123">hi</pre>
3312 !! html/php
3313 <pre class="123">hi</pre>
3314
3315 !! html/parsoid
3316 <pre typeof="mw:Extension/pre" about="#mwt2" class="123" data-mw='{"name":"pre","attrs":{"class":"123"},"body":{"extsrc":"hi"}}'>hi</pre>
3317 !! end
3318
3319 !!test
3320 Render paragraphs when indent-pre is suppressed in blocklevels
3321 !! wikitext
3322 <blockquote>
3323 foo
3324
3325 bar
3326 </blockquote>
3327 !! html
3328 <blockquote>
3329 <p> foo
3330 </p><p> bar
3331 </p>
3332 </blockquote>
3333
3334 !!end
3335
3336 !!test
3337 4. Multiple spaces at start-of-line
3338 !! wikitext
3339 <p> foo </p>
3340 foo
3341 {|
3342 |foo
3343 |}
3344 !! html
3345 <p> foo </p>
3346 <pre> foo
3347 </pre>
3348 <table>
3349 <tr>
3350 <td>foo
3351 </td></tr></table>
3352
3353 !!end
3354
3355 ## NOTE: the leading white-space chars on empty line are significant
3356 !! test
3357 5a. White-space in indent-pre
3358 !! wikitext
3359 a<br />
3360
3361 b
3362 !! html
3363 <pre>a<br />
3364
3365 b
3366 </pre>
3367 !! end
3368
3369 ## NOTE: the leading white-space chars on empty line are significant
3370 !! test
3371 5b. White-space in indent-pre
3372 !! wikitext
3373 a
3374
3375 b
3376
3377
3378 c
3379 !! html
3380 <pre>a
3381
3382 b
3383
3384
3385 c
3386 </pre>
3387 !! end
3388
3389 !! test
3390 5c. White-space in indent-pre
3391 !! wikitext
3392 ''a''
3393 ''b''
3394 ''c''
3395 !! html
3396 <pre><i>a</i>
3397 <i>b</i>
3398 <i>c</i>
3399 </pre>
3400 !! end
3401
3402 !! test
3403 6. Pre-blocks should extend across lines with leading WS even when there is no wrappable content
3404 !! wikitext
3405 a
3406
3407 <!-- continue -->
3408 b
3409
3410 c
3411
3412 d
3413 !! html
3414 <pre>a
3415
3416 b
3417 </pre>
3418 <pre>c
3419
3420 </pre>
3421 <p>d
3422 </p>
3423 !! end
3424
3425 !! test
3426 7a. Indent-pre and category links
3427 !! options
3428 parsoid=wt2html,wt2wt
3429 !! wikitext
3430 [[Category:foo]] <!-- No pre-wrapping -->
3431 {{echo| [[Category:foo]]}} <!-- No pre-wrapping -->
3432 !! html/php+tidy
3433 !! html/parsoid
3434 <link rel="mw:PageProp/Category" href="./Category:Foo"> <!-- No pre&#x2D;wrapping -->
3435 <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 -->
3436 !! end
3437
3438 ## We used to, but no longer wt2wt this test since the default serializer
3439 ## will normalize all categories to serialize on their own line.
3440 ## This wikitext usage is going to be fairly uncommon in production and
3441 ## selser will take care of preserving formatting in those scenarios.
3442 !! test
3443 7b. Indent-pre and category links
3444 !! options
3445 parsoid=wt2html
3446 !! wikitext
3447 [[Category:foo]] a
3448 [[Category:foo]] {{echo|b}}
3449 !! html/parsoid
3450 <pre><link rel="mw:PageProp/Category" href="./Category:Foo"> a
3451 <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>
3452 !! end
3453
3454 !! test
3455 Indent-Pre: Newlines in comments shouldn't affect sol state
3456 !! wikitext
3457 a <!--
3458 foo
3459 --> b
3460 !! html/php+tidy
3461 <p>a b</p>
3462 !! html/parsoid
3463 <p>a <!--
3464 foo
3465 --> b</p>
3466 !! end
3467
3468 ###
3469 ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
3470 ###
3471
3472 !!test
3473 HTML-pre: 1. embedded newlines
3474 !! wikitext
3475 <pre>foo</pre>
3476
3477 <pre>
3478 foo
3479 </pre>
3480
3481 <pre>
3482
3483 foo
3484 </pre>
3485
3486 <pre>
3487
3488
3489 foo
3490 </pre>
3491 !! html/php+tidy
3492 <pre>
3493 foo
3494 </pre>
3495 <pre>
3496 foo
3497 </pre>
3498 <pre>
3499
3500 foo
3501 </pre>
3502 <pre>
3503
3504
3505 foo
3506 </pre>
3507 !! html/parsoid
3508 <pre typeof="mw:Extension/pre" about="#mwt2" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"foo"}}'>foo</pre>
3509
3510 <pre typeof="mw:Extension/pre" about="#mwt4" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\nfoo\n"}}'>foo
3511 </pre>
3512
3513 <pre typeof="mw:Extension/pre" about="#mwt6" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\n\nfoo\n"}}'>
3514
3515 foo
3516 </pre>
3517
3518 <pre typeof="mw:Extension/pre" about="#mwt8" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\n\n\nfoo\n"}}'>
3519
3520
3521 foo
3522 </pre>
3523 !!end
3524
3525 !! test
3526 HTML-pre: big spaces
3527 !! wikitext
3528 <pre>
3529
3530
3531
3532
3533 haha
3534
3535
3536
3537
3538 haha
3539
3540
3541
3542
3543 </pre>
3544 !! html/php+tidy
3545 <pre>
3546
3547
3548
3549
3550 haha
3551
3552
3553
3554
3555 haha
3556
3557
3558
3559
3560 </pre>
3561 !! html/parsoid
3562 <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"}}'>
3563
3564
3565
3566
3567 haha
3568
3569
3570
3571
3572 haha
3573
3574
3575
3576
3577 </pre>
3578 !! end
3579
3580 !!test
3581 HTML-pre: 2: indented text
3582 !! wikitext
3583 <pre>
3584 foo
3585 </pre>
3586 !! html
3587 <pre>
3588 foo
3589 </pre>
3590
3591 !!end
3592
3593 !!test
3594 HTML-pre: 3: other wikitext
3595 !! wikitext
3596 <pre>
3597 * foo
3598 # bar
3599 = no-h =
3600 '' no-italic ''
3601 [[ NoLink ]]
3602 </pre>
3603 !! html/php
3604 <pre>
3605 * foo
3606 # bar
3607 = no-h =
3608 '' no-italic ''
3609 [[ NoLink ]]
3610 </pre>
3611
3612 !! html/parsoid
3613 <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
3614 # bar
3615 = no-h =
3616 '' no-italic ''
3617 [[ NoLink ]]
3618 </pre>
3619 !!end
3620
3621 ###
3622 ### Definition lists
3623 ###
3624 !! test
3625 Simple definition
3626 !! wikitext
3627 ; name : Definition
3628 !! html
3629 <dl><dt> name&#160;</dt>
3630 <dd> Definition</dd></dl>
3631
3632 !! end
3633
3634 !! test
3635 Definition list for indentation only
3636 !! wikitext
3637 : Indented text
3638 !! html
3639 <dl><dd> Indented text</dd></dl>
3640
3641 !! end
3642
3643 !! test
3644 Definition list with no space
3645 !! wikitext
3646 ;name:Definition
3647 !! html
3648 <dl><dt>name</dt>
3649 <dd>Definition</dd></dl>
3650
3651 !!end
3652
3653 !! test
3654 Definition list with URL link
3655 !! wikitext
3656 ; http://example.com/ : definition
3657 !! html
3658 <dl><dt> <a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&#160;</dt>
3659 <dd> definition</dd></dl>
3660
3661 !! end
3662
3663 !! test
3664 Definition list with bracketed URL link
3665 !! wikitext
3666 ;[http://www.example.com/ Example]:Something about it
3667 !! html
3668 <dl><dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt>
3669 <dd>Something about it</dd></dl>
3670
3671 !! end
3672
3673 !! test
3674 Definition list with wikilink containing colon
3675 !! wikitext
3676 ; [[Help:FAQ]]: The least-read page on Wikipedia
3677 !! html
3678 <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>
3679 <dd> The least-read page on Wikipedia</dd></dl>
3680
3681 !! end
3682
3683 # At Brion's and JeLuF's insistence... :)
3684 !! test
3685 Definition list with news link containing colon
3686 !! wikitext
3687 ; news:alt.wikipedia.rox: This isn't even a real newsgroup!
3688 !! html/php
3689 <dl><dt> <a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a></dt>
3690 <dd> This isn't even a real newsgroup!</dd></dl>
3691
3692 !! html/parsoid
3693 <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>
3694 !! end
3695
3696 !! test
3697 Malformed definition list with colon
3698 !! wikitext
3699 ; news:alt.wikipedia.rox -- don't crash or enter an infinite loop
3700 !! html
3701 <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>
3702
3703 !! end
3704
3705 !! test
3706 Definition lists: colon in external link text
3707 !! wikitext
3708 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
3709 !! html
3710 <dl><dt> <a rel="nofollow" class="external text" href="http://www.wikipedia2.org/">Wikipedia&#160;: The Next Generation</a></dt>
3711 <dd> OK, I made that up</dd></dl>
3712
3713 !! end
3714
3715 !! test
3716 Definition lists: colon in HTML attribute
3717 !! wikitext
3718 ;<b style="display: inline">bold</b>
3719 !! html
3720 <dl><dt><b style="display: inline">bold</b></dt></dl>
3721
3722 !! end
3723
3724 !! test
3725 Definition lists: self-closed tag
3726 !! wikitext
3727 ;one<br/>two : two-line fun
3728 !! html
3729 <dl><dt>one<br />two&#160;</dt>
3730 <dd> two-line fun</dd></dl>
3731
3732 !! end
3733
3734 !! test
3735 Definition lists: ignore colons inside tags
3736 !! wikitext
3737 ;one <b>two : tag <i>fun:</i>:</b>: def
3738 !! html
3739 <dl><dt>one <b>two&#160;: tag <i>fun:</i>:</b></dt>
3740 <dd> def</dd></dl>
3741
3742 !! end
3743
3744 !! test
3745 Definition lists: excess closed tags
3746 !! wikitext
3747 ;one</b>two : bad tag fun
3748 !! html/php+tidy
3749 <dl>
3750 <dt>onetwo&#160;</dt>
3751 <dd>bad tag fun</dd>
3752 </dl>
3753 !! html/parsoid
3754 <dl>
3755 <dt>onetwo</dt>
3756 <dd>bad tag fun</dd>
3757 </dl>
3758 !! end
3759
3760 !! test
3761 T13748: Literal closing tags
3762 !! wikitext
3763 <dl>
3764 <dt>test 1</dt>
3765 <dd>test test test test test</dd>
3766 <dt>test 2</dt>
3767 <dd>test test test test test</dd>
3768 </dl>
3769 !! html
3770 <dl>
3771 <dt>test 1</dt>
3772 <dd>test test test test test</dd>
3773 <dt>test 2</dt>
3774 <dd>test test test test test</dd>
3775 </dl>
3776
3777 !! end
3778
3779 !! test
3780 Definition and unordered list using wiki syntax nested in unordered list using html tags.
3781 !! wikitext
3782 <ul><li>
3783 ; term : description
3784 * unordered
3785 </li></ul>
3786 !! html
3787 <ul><li>
3788 <dl><dt> term&#160;</dt>
3789 <dd> description</dd></dl>
3790 <ul><li> unordered</li></ul>
3791 </li></ul>
3792
3793 !! end
3794
3795 !! test
3796 Definition list with empty definition and following paragraph
3797 !! wikitext
3798 ; term:
3799 Paragraph text
3800 !! html
3801 <dl><dt> term</dt>
3802 <dd></dd></dl>
3803 <p>Paragraph text
3804 </p>
3805 !! end
3806
3807 !! test
3808 Nested definition lists using html syntax
3809 !! wikitext
3810 <dl><dt>x</dt>
3811 <dd>a</dd>
3812 <dd>b</dd></dl>
3813 !! html
3814 <dl><dt>x</dt>
3815 <dd>a</dd>
3816 <dd>b</dd></dl>
3817
3818 !! end
3819
3820 !! test
3821 Definition Lists: No nesting: Multiple dd's
3822 !! wikitext
3823 ;x
3824 :a
3825 :b
3826 !! html
3827 <dl><dt>x</dt>
3828 <dd>a</dd>
3829 <dd>b</dd></dl>
3830
3831 !! end
3832
3833 !! test
3834 Definition Lists: Indentation: Regular
3835 !! wikitext
3836 :i1
3837 ::i2
3838 :::i3
3839 !! html
3840 <dl><dd>i1
3841 <dl><dd>i2
3842 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3843
3844 !! end
3845
3846 !! test
3847 Definition Lists: Indentation: Missing 1st level
3848 !! wikitext
3849 ::i2
3850 :::i3
3851 !! html
3852 <dl><dd><dl><dd>i2
3853 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3854
3855 !! end
3856
3857 !! test
3858 Definition Lists: Indentation: Multi-level indent
3859 !! wikitext
3860 :::i3
3861 !! html
3862 <dl><dd><dl><dd><dl><dd>i3</dd></dl></dd></dl></dd></dl>
3863
3864 !! end
3865
3866 !! test
3867 Definition Lists: Hacky use to indent tables
3868 !! wikitext
3869 ::{|
3870 |foo
3871 |bar
3872 |}
3873 this text
3874 should be left alone
3875 !! html
3876 <dl><dd><dl><dd><table>
3877 <tr>
3878 <td>foo
3879 </td>
3880 <td>bar
3881 </td></tr></table></dd></dl></dd></dl>
3882 <p>this text
3883 should be left alone
3884 </p>
3885 !! end
3886
3887 !! test
3888 Definition Lists: Hacky use to indent tables, with comments (T65979)
3889 !! wikitext
3890 <!-- foo -->
3891 ::{|
3892 |foo
3893 |bar
3894 |}<!-- bar -->
3895 this text
3896 should be left alone
3897 !! html/parsoid
3898 <!-- foo -->
3899 <dl><dd><dl><dd><table><tr>
3900 <td>foo</td>
3901 <td>bar</td>
3902 </tr></table><!-- bar --></dd></dl></dd></dl>
3903 <p>this text
3904 should be left alone</p>
3905 !! end
3906
3907 !! test
3908 Definition Lists: Hacky use to indent tables, with comment before table
3909 !! wikitext
3910 ::<!-- foo -->{|
3911 |foo
3912 |}
3913 !! html/parsoid
3914 <dl><dd><dl><dd><!-- foo --><table><tr>
3915 <td>foo</td>
3916 </tr></table></dd></dl></dd></dl>
3917 !! end
3918
3919 # The trailing whitespace in this test is to catch a regression in
3920 # Parsoid after T54473.
3921 !! test
3922 Definition Lists: Hacky use to indent tables (WS-insensitive)
3923 !! wikitext
3924 : {|
3925 |a
3926 |}
3927 !! html/php
3928 <dl><dd><table>
3929 <tr>
3930 <td>a
3931 </td></tr></table></dd></dl>
3932
3933 !! html/parsoid
3934 <dl><dd> <table>
3935 <tbody><tr><td>a</td></tr>
3936 </tbody></table> </dd></dl>
3937 !! end
3938
3939 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
3940 ## as an empty dt item. It also ignores all but the last ";" when followed
3941 ## by ":" later on. So, ";" are not ignored in ";;;t3" but are ignored in
3942 ## ";;;t3 :d1". So, PHP parser behavior is a little inconsistent wrt multiple
3943 ## ";"s.
3944 ##
3945 ## Ex: ";;t2 ::d2" is transformed into:
3946 ##
3947 ## <dl>
3948 ## <dt>t2 </dt>
3949 ## <dd>
3950 ## <dl>
3951 ## <dt></dt>
3952 ## <dd>d2</dd>
3953 ## </dl>
3954 ## </dd>
3955 ## </dl>
3956 ##
3957 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
3958 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
3959 ##
3960 ## <dl>
3961 ## <dt>
3962 ## <dl>
3963 ## <dt>t2 </dt>
3964 ## <dd>:d2</dd>
3965 ## </dl>
3966 ## </dt>
3967 ## </dl>
3968 ##
3969 ## All Parsoid only definition list tests have this difference.
3970 ##
3971 ## See also: https://phabricator.wikimedia.org/T8569
3972 ## and https://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
3973
3974 !! test
3975 Table / list interaction: indented table with lists in table contents
3976 !! wikitext
3977 :{|
3978 |-
3979 | a
3980 * b
3981 |-
3982 | c
3983 * d
3984 |}
3985 !! html
3986 <dl><dd><table>
3987
3988 <tr>
3989 <td> a
3990 <ul><li> b</li></ul>
3991 </td></tr>
3992 <tr>
3993 <td> c
3994 <ul><li> d</li></ul>
3995 </td></tr></table></dd></dl>
3996
3997 !! end
3998
3999 !!test
4000 Table / list interaction: lists nested in tables nested in indented lists
4001 !! wikitext
4002 :{|
4003 |
4004 :a
4005 :b
4006 |
4007 *c
4008 *d
4009 |}
4010
4011 *e
4012 *f
4013 !! html
4014 <dl><dd><table>
4015 <tr>
4016 <td>
4017 <dl><dd>a</dd>
4018 <dd>b</dd></dl>
4019 </td>
4020 <td>
4021 <ul><li>c</li>
4022 <li>d</li></ul>
4023 </td></tr></table></dd></dl>
4024 <ul><li>e</li>
4025 <li>f</li></ul>
4026
4027 !!end
4028
4029 !! test
4030 Definition Lists: Nesting: Multi-level (Parsoid only)
4031 !! options
4032 parsoid
4033 !! wikitext
4034 ;t1 :d1
4035 ;;t2 ::d2
4036 ;;;t3 :::d3
4037 !! html
4038 <dl>
4039 <dt>t1 </dt>
4040 <dd>d1</dd>
4041 <dt>
4042 <dl>
4043 <dt>t2 </dt>
4044 <dd>:d2</dd>
4045 <dt>
4046 <dl>
4047 <dt>t3 </dt>
4048 <dd>::d3</dd>
4049 </dl>
4050 </dt>
4051 </dl>
4052 </dt>
4053 </dl>
4054
4055
4056 !! end
4057
4058
4059 !! test
4060 Definition Lists: Nesting: Test 2 (Parsoid only)
4061 !! wikitext
4062 ;t1
4063 ::d2
4064 !! html/php+tidy
4065 <dl>
4066 <dt>t1</dt>
4067 <dd>
4068 <dl>
4069 <dd>d2</dd>
4070 </dl>
4071 </dd>
4072 </dl>
4073 !! html/parsoid
4074 <dl>
4075 <dt>t1</dt>
4076 <dd>
4077 <dl>
4078 <dd>d2</dd>
4079 </dl>
4080 </dd>
4081 </dl>
4082
4083 !! end
4084
4085
4086 !! test
4087 Definition Lists: Nesting: Test 3 (Parsoid only)
4088 !! wikitext
4089 :;t1
4090 ::::d2
4091 !! html/php+tidy
4092 <dl>
4093 <dd>
4094 <dl>
4095 <dt>t1</dt>
4096 <dd>
4097 <dl>
4098 <dd>
4099 <dl>
4100 <dd>d2</dd>
4101 </dl>
4102 </dd>
4103 </dl>
4104 </dd>
4105 </dl>
4106 </dd>
4107 </dl>
4108 !! html/parsoid
4109 <dl>
4110 <dd>
4111 <dl>
4112 <dt>t1</dt>
4113 <dd>
4114 <dl>
4115 <dd>
4116 <dl>
4117 <dd>d2</dd>
4118 </dl>
4119 </dd>
4120 </dl>
4121 </dd>
4122 </dl>
4123 </dd>
4124 </dl>
4125
4126 !! end
4127
4128
4129 !! test
4130 Definition Lists: Nesting: Test 4
4131 !! wikitext
4132 ::;t3
4133 :::d3
4134 !! html
4135 <dl><dd><dl><dd><dl><dt>t3</dt>
4136 <dd>d3</dd></dl></dd></dl></dd></dl>
4137
4138 !! end
4139
4140
4141 ## The Parsoid team believes the following three test exposes a
4142 ## bug in the PHP parser. (Parsoid team thinks the PHP parser is
4143 ## wrong to close the <dl> after the <dt> containing the <ul>.)
4144 ## It also exposes a "misfeature" in tidy, which doesn't like
4145 ## <dl> tags with a single <dt> child; it converts the <dt> into
4146 ## a <dd> in that case. (Parsoid leaves the <dt> alone!)
4147 !! test
4148 Definition Lists: Mixed Lists: Test 1
4149 !! wikitext
4150 :;* foo
4151 ::* bar
4152 :; baz
4153 !! html/php
4154 <dl><dd><dl><dt><ul><li> foo</li>
4155 <li> bar</li></ul></dt></dl>
4156 <dl><dt> baz</dt></dl></dd></dl>
4157
4158 !! html/php+tidy
4159 <dl>
4160 <dd>
4161 <dl>
4162 <dd>
4163 <ul>
4164 <li>foo</li>
4165 <li>bar</li>
4166 </ul>
4167 </dd>
4168 </dl>
4169 <dl>
4170 <dt>baz</dt>
4171 </dl>
4172 </dd>
4173 </dl>
4174 !! html/parsoid
4175 <dl>
4176 <dd><dl>
4177 <dt><ul>
4178 <li> foo
4179 </li>
4180 </ul></dt>
4181 <dd><ul>
4182 <li> bar
4183 </li>
4184 </ul></dd>
4185 <dt> baz</dt>
4186 </dl></dd>
4187 </dl>
4188 !! end
4189
4190 !! test
4191 Definition Lists: Mixed Lists: Test 2
4192 !! wikitext
4193 *: d1
4194 *: d2
4195 !! html
4196 <ul><li><dl><dd> d1</dd>
4197 <dd> d2</dd></dl></li></ul>
4198
4199 !! end
4200
4201
4202 !! test
4203 Definition Lists: Mixed Lists: Test 3
4204 !! wikitext
4205 *::: d1
4206 *::: d2
4207 !! html
4208 <ul><li><dl><dd><dl><dd><dl><dd> d1</dd>
4209 <dd> d2</dd></dl></dd></dl></dd></dl></li></ul>
4210
4211 !! end
4212
4213
4214 !! test
4215 Definition Lists: Mixed Lists: Test 4
4216 !! wikitext
4217 *;d1 :d2
4218 *;d3 :d4
4219 !! html
4220 <ul><li><dl><dt>d1&#160;</dt>
4221 <dd>d2</dd>
4222 <dt>d3&#160;</dt>
4223 <dd>d4</dd></dl></li></ul>
4224
4225 !! end
4226
4227
4228 !! test
4229 Definition Lists: Mixed Lists: Test 5
4230 !! wikitext
4231 *:d1
4232 *:: d2
4233 !! html
4234 <ul><li><dl><dd>d1
4235 <dl><dd> d2</dd></dl></dd></dl></li></ul>
4236
4237 !! end
4238
4239
4240 !! test
4241 Definition Lists: Mixed Lists: Test 6
4242 !! wikitext
4243 #*:d1
4244 #*::: d3
4245 !! html
4246 <ol><li><ul><li><dl><dd>d1
4247 <dl><dd><dl><dd> d3</dd></dl></dd></dl></dd></dl></li></ul></li></ol>
4248
4249 !! end
4250
4251
4252 !! test
4253 Definition Lists: Mixed Lists: Test 7
4254 !! wikitext
4255 :* d1
4256 :* d2
4257 !! html
4258 <dl><dd><ul><li> d1</li>
4259 <li> d2</li></ul></dd></dl>
4260
4261 !! end
4262
4263
4264 !! test
4265 Definition Lists: Mixed Lists: Test 8
4266 !! wikitext
4267 :* d1
4268 ::* d2
4269 !! html
4270 <dl><dd><ul><li> d1</li></ul>
4271 <dl><dd><ul><li> d2</li></ul></dd></dl></dd></dl>
4272
4273 !! end
4274
4275
4276 !! test
4277 Definition Lists: Mixed Lists: Test 9
4278 !! wikitext
4279 *;foo :bar
4280 !! html
4281 <ul><li><dl><dt>foo&#160;</dt>
4282 <dd>bar</dd></dl></li></ul>
4283
4284 !! end
4285
4286
4287 !! test
4288 Definition Lists: Mixed Lists: Test 10
4289 !! wikitext
4290 *#;foo :bar
4291 !! html
4292 <ul><li><ol><li><dl><dt>foo&#160;</dt>
4293 <dd>bar</dd></dl></li></ol></li></ul>
4294
4295 !! end
4296
4297 # The Parsoid team disagrees with the PHP parser's seemingly-random
4298 # rules regarding dd/dt on the next two tests. Parsoid is more
4299 # consistent, and recognizes the shared nesting and keeps the
4300 # still-open tags around until the nesting is complete.
4301 # (And tidy again converts <dt> to <dd> before 'bar'.)
4302
4303 !! test
4304 Definition Lists: Mixed Lists: Test 11
4305 !! wikitext
4306 *#*#;*;;foo :bar
4307 *#*#;boo :baz
4308 !! html/php
4309 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt>
4310 <dd><ul><li><dl><dt><dl><dt>bar</dt></dl></dd></dl></li></ul></dd></dl>
4311 <dl><dt>boo&#160;</dt>
4312 <dd>baz</dd></dl></li></ol></li></ul></li></ol></li></ul>
4313
4314 !! html/php+tidy
4315 <ul>
4316 <li>
4317 <ol>
4318 <li>
4319 <ul>
4320 <li>
4321 <ol>
4322 <li>
4323 <dl>
4324 <dt>foo&#160;</dt>
4325 <dd>
4326 <ul>
4327 <li>
4328 <dl>
4329 <dd>
4330 <dl>
4331 <dt>bar</dt>
4332 </dl>
4333 </dd>
4334 </dl>
4335 </li>
4336 </ul>
4337 </dd>
4338 </dl>
4339 <dl>
4340 <dt>boo&#160;</dt>
4341 <dd>baz</dd>
4342 </dl>
4343 </li>
4344 </ol>
4345 </li>
4346 </ul>
4347 </li>
4348 </ol>
4349 </li>
4350 </ul>
4351 !! html/parsoid
4352 <ul>
4353 <li>
4354 <ol>
4355 <li>
4356 <ul>
4357 <li>
4358 <ol>
4359 <li>
4360 <dl>
4361 <dt>
4362 <ul>
4363 <li>
4364 <dl>
4365 <dt>
4366 <dl>
4367 <dt>foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
4368 <dd data-parsoid='{"stx":"row"}'>bar</dd>
4369 </dl></dt>
4370 </dl></li>
4371 </ul></dt>
4372 <dt>boo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
4373 <dd data-parsoid='{"stx":"row"}'>baz</dd>
4374 </dl></li>
4375 </ol></li>
4376 </ul></li>
4377 </ol></li>
4378 </ul>
4379 !! end
4380
4381
4382 # Another case where tidy converts a <dt> to a <dd> (but Parsoid doesn't).
4383 # From whitelist:
4384 # * The test is wrong, there are two colons where there should be :;
4385 # * The PHP parser is wrong to close the <dl> after the <dt> containing the <ul>.
4386 !! test
4387 Definition Lists: Weird Ones: Test 1
4388 !! wikitext
4389 *#;*::;; foo : bar (who uses this?)
4390 !! html/php
4391 <ul><li><ol><li><dl><dt> foo&#160;</dt>
4392 <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>
4393
4394 !! html/php+tidy
4395 <ul>
4396 <li>
4397 <ol>
4398 <li>
4399 <dl>
4400 <dt>foo&#160;</dt>
4401 <dd>
4402 <ul>
4403 <li>
4404 <dl>
4405 <dd>
4406 <dl>
4407 <dd>
4408 <dl>
4409 <dd>
4410 <dl>
4411 <dt>bar (who uses this?)</dt>
4412 </dl>
4413 </dd>
4414 </dl>
4415 </dd>
4416 </dl>
4417 </dd>
4418 </dl>
4419 </li>
4420 </ul>
4421 </dd>
4422 </dl>
4423 </li>
4424 </ol>
4425 </li>
4426 </ul>
4427 !! html/parsoid
4428 <ul>
4429 <li>
4430 <ol>
4431 <li>
4432 <dl>
4433 <dt>
4434 <ul>
4435 <li>
4436 <dl>
4437 <dd>
4438 <dl>
4439 <dd>
4440 <dl>
4441 <dt>
4442 <dl>
4443 <dt> foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span></dt>
4444 <dd data-parsoid='{"stx":"row"}'> bar (who uses this?)</dd>
4445 </dl></dt>
4446 </dl></dd>
4447 </dl></dd>
4448 </dl></li>
4449 </ul></dt>
4450 </dl></li>
4451 </ol></li>
4452 </ul>
4453 !! end
4454
4455 !! test
4456 Definition Lists: colons occurring in tags
4457 !! wikitext
4458 ;a:b
4459 ;'''a:b'''
4460 ;<i>a:b</i>
4461 ;<span>a:b</span>
4462 ;<div>a:b</div>
4463 ;<div>a
4464 :b</div>
4465 ;{{echo|a:b}}
4466 ;{{echo|''a:b''}}
4467 ;;;''a:b''
4468 !! html+tidy
4469 <dl>
4470 <dt>a</dt>
4471 <dd>b</dd>
4472 <dt><b>a:b</b></dt>
4473 <dt><i>a:b</i></dt>
4474 <dt><span>a:b</span></dt>
4475 <dd>
4476 <div>a:b</div>
4477 </dd>
4478 <dd>
4479 <div>a
4480 <dl>
4481 <dd>b</dd>
4482 </dl>
4483 </div>
4484 </dd>
4485 <dt>a</dt>
4486 <dd>b</dd>
4487 <dt><i>a:b</i></dt>
4488 </dl>
4489 <dl>
4490 <dd>
4491 <dl>
4492 <dd>
4493 <dl>
4494 <dt><i>a:b</i></dt>
4495 </dl>
4496 </dd>
4497 </dl>
4498 </dd>
4499 </dl>
4500 !! html/parsoid
4501 <dl><dt>a</dt><dd data-parsoid='{"stx":"row"}'>b</dd>
4502 <dt><b>a:b</b></dt>
4503 <dt><i data-parsoid='{"stx":"html"}'>a:b</i></dt>
4504 <dt><span data-parsoid='{"stx":"html"}'>a:b</span></dt>
4505 <dt><div data-parsoid='{"stx":"html"}'>a:b</div></dt>
4506 <dt><div data-parsoid='{"stx":"html","autoInsertedEnd":true}'>a</div></dt>
4507 <dd>b</dd>
4508 <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>
4509 <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>
4510 <dl><dt><dl><dt><i>a:b</i></dt></dl></dt></dl></dt></dl>
4511 !! end
4512
4513 !! test
4514 Definition Lists: colons and tables 1
4515 !! wikitext
4516 :{|
4517 | x
4518 |}
4519 :{|
4520 | y
4521 |}
4522 !! html
4523 <dl><dd><table>
4524 <tr>
4525 <td> x
4526 </td></tr></table></dd></dl>
4527 <dl><dd><table>
4528 <tr>
4529 <td> y
4530 </td></tr></table></dd></dl>
4531
4532 !! end
4533
4534 # Parsoid's output (as documented below) differs from php's in this case.
4535 # This is probably a bug. If we fixup parsoid to match php's output, the
4536 # above test should pass and the below test case can be removed. It is
4537 # unclear which output is more desirable.
4538
4539 !! test
4540 Definition Lists: colons and tables 2
4541 !! wikitext
4542 :{|
4543 | x
4544 |}
4545 :{|
4546 | y
4547 |}
4548 !! html/parsoid
4549 <dl><dd><table>
4550 <tr>
4551 <td> x
4552 </td></tr></table></dd>
4553 <dd><table>
4554 <tr>
4555 <td> y
4556 </td></tr></table></dd></dl>
4557 !! end
4558
4559 !! test
4560 Definition Lists: template interaction
4561 !! wikitext
4562 ::{{definition_list}}
4563
4564 :one
4565 ::{{definition_list}}
4566 :::two
4567 :::three
4568 ::four
4569 !! html/parsoid
4570 <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">
4571 </span><dd about="#mwt1">two</dd></dl></dd></dl>
4572
4573 <dl><dd data-parsoid='{}'>one
4574 <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">
4575 </span><dd about="#mwt2">two
4576 <dl><dd>two</dd>
4577 <dd>three</dd></dl></dd>
4578 <dd data-parsoid='{}'>four</dd></dl></dd></dl>
4579 !! end
4580
4581
4582 ###
4583 ### External links
4584 ###
4585 !! test
4586 External links: non-bracketed
4587 !! wikitext
4588 Non-bracketed: http://example.com
4589 !! html
4590 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4591 </p>
4592 !! end
4593
4594 # parsoid doesn't explicitly mark autonumbered links, see T55505
4595 !! test
4596 External links: numbered
4597 !! wikitext
4598 Numbered: [http://example.com]
4599 Numbered: [http://example.net]
4600 Numbered: [http://example.com]
4601 !! html/php
4602 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
4603 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
4604 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
4605 </p>
4606 !! html/parsoid
4607 <p>Numbered: <a rel="mw:ExtLink" href="http://example.com"></a>
4608 Numbered: <a rel="mw:ExtLink" href="http://example.net"></a>
4609 Numbered: <a rel="mw:ExtLink" href="http://example.com"></a></p>
4610 !!end
4611
4612 !! test
4613 External links: specified text
4614 !! wikitext
4615 Specified text: [http://example.com link]
4616 !! html
4617 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
4618 </p>
4619 !!end
4620
4621 !! test
4622 External links: trail
4623 !! wikitext
4624 Linktrails should not work for external links: [http://example.com link]s
4625 !! html
4626 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
4627 </p>
4628 !! end
4629
4630 !! test
4631 External links: dollar sign in URL
4632 !! wikitext
4633 http://example.com/1$2345
4634 !! html
4635 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
4636 </p>
4637 !! end
4638
4639 # parsoid doesn't explicitly mark autonumbered links, see T55505
4640 !! test
4641 External links: dollar sign in URL (autonumber)
4642 !! wikitext
4643 [http://example.com/1$2345]
4644 !! html/php
4645 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
4646 </p>
4647 !! html/parsoid
4648 <p><a rel="mw:ExtLink" href="http://example.com/1$2345"></a></p>
4649 !!end
4650
4651 !! test
4652 External links: open square bracket forbidden in URL (T6377)
4653 !! options
4654 parsoid=wt2html,wt2wt,html2html
4655 !! wikitext
4656 http://example.com/1[2345
4657 !! html/php
4658 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
4659 </p>
4660 !! html/parsoid
4661 <p><a rel="mw:ExtLink" href="http://example.com/1">http://example.com/1</a>[2345</p>
4662 !! end
4663
4664 !! test
4665 External links: open square bracket forbidden in URL (named) (T6377)
4666 !! options
4667 parsoid=wt2html,html2html
4668 !! wikitext
4669 [http://example.com/1[2345]
4670 !! html/php
4671 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4672 </p>
4673 !! html/parsoid
4674 <p><a rel="mw:ExtLink" href="http://example.com/1">[2345</a></p>
4675 !!end
4676
4677 # parsoid adds a space before the link name
4678 !! test
4679 External links: open square bracket forbidden in URL (named) (T6377)
4680 Parsoid variant.
4681 !! wikitext
4682 [http://example.com/1 [2345]
4683 !! html
4684 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4685 </p>
4686 !!end
4687
4688 !! test
4689 External links: nowiki in URL link text (T8230)
4690 !! wikitext
4691 [http://example.com/ <nowiki>''example site''</nowiki>]
4692 !! html
4693 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
4694 </p>
4695 !! end
4696
4697 !! test
4698 External links: newline forbidden in text (T8230 regression check)
4699 !! wikitext
4700 [http://example.com/ first
4701 second]
4702 !! html
4703 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
4704 second]
4705 </p>
4706 !!end
4707
4708 !! test
4709 External links: Pipe char between url and text
4710 !! wikitext
4711 [http://example.com | link]
4712 !! html
4713 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
4714 </p>
4715 !!end
4716
4717 !! test
4718 External links: protocol-relative URL in brackets
4719 !! wikitext
4720 [//example.com/ Test]
4721 !! html
4722 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
4723 </p>
4724 !! end
4725
4726 # parsoid doesn't explicitly mark autonumbered links, see T55505
4727 !! test
4728 External links: protocol-relative URL in brackets without text
4729 !! wikitext
4730 [//example.com]
4731 !! html/php
4732 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
4733 </p>
4734 !! html/parsoid
4735 <p><a rel="mw:ExtLink" href="//example.com"></a></p>
4736 !! end
4737
4738 !! test
4739 External links: protocol-relative URL in free text is left alone
4740 !! wikitext
4741 //example.com/Foo
4742 !! html
4743 <p>//example.com/Foo
4744 </p>
4745 !!end
4746
4747 !! test
4748 External links: protocol-relative URL in the middle of a word is left alone (T32269)
4749 !! wikitext
4750 foo//example.com/Foo
4751 !! html
4752 <p>foo//example.com/Foo
4753 </p>
4754 !! end
4755
4756 !! test
4757 External links: with no contents
4758 !! wikitext
4759 [http://en.wikipedia.org/wiki/Foo]
4760
4761 [[wikipedia:Foo|Bar]]
4762
4763 [[wikipedia:Foo|<span>Bar</span>]]
4764 !! html/php
4765 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/wiki/Foo">[1]</a>
4766 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
4767 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo"><span>Bar</span></a>
4768 </p>
4769 !! html/parsoid
4770 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo"></a></p>
4771 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo">Bar</a></p>
4772 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo"><span>Bar</span></a></p>
4773 !! end
4774
4775 !! test
4776 External links: Free with trailing punctuation
4777 !! wikitext
4778 http://example.com,
4779 http://example.com;
4780 http://example.com\
4781 http://example.com.
4782 http://example.com:
4783 http://example.com!
4784 http://example.com?
4785 http://example.com)
4786 http://example.com/url_with_(brackets)
4787 (http://example.com/url_without_brackets)
4788 http://example.com/url_with_entity&amp;
4789 http://example.com/url_with_entity&#x26;
4790 http://example.com/url_with_entity&#038;
4791 http://example.com/url_with_entity&nbsp;
4792 http://example.com/url_with_entity&#xA0;
4793 http://example.com/url_with_entity&#160;
4794 http://example.com/url_with_entity&lt;
4795 http://example.com/url_with_entity&#x3C;
4796 http://example.com/url_with_entity&#60;
4797 !! html/php
4798 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
4799 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>;
4800 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>\
4801 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.
4802 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
4803 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>!
4804 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>?
4805 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
4806 <a rel="nofollow" class="external free" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
4807 (<a rel="nofollow" class="external free" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
4808 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4809 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4810 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4811 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#160;
4812 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#xa0;
4813 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#160;
4814 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&lt;
4815 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#x3c;
4816 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#60;
4817 </p>
4818 !! html/parsoid
4819 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>,
4820 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>;
4821 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>\
4822 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>.
4823 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:
4824 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>!
4825 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>?
4826 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)
4827 <a rel="mw:ExtLink" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
4828 (<a rel="mw:ExtLink" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
4829 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4830 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4831 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4832 <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>
4833 <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>
4834 <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>
4835 <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>
4836 <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>
4837 <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>
4838 !! end
4839
4840 !! test
4841 External links: tricky Parsoid html2html case
4842 !! options
4843 parsoid=wt2html,wt2wt,html2html
4844 !! wikitext
4845 http://example.com/url_with_entity&amp;amp;
4846 !! html/php
4847 <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>;
4848 </p>
4849 !! html/parsoid
4850 <p><a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;amp">http://example.com/url_with_entity&amp;amp</a>;</p>
4851 !! end
4852
4853 !! test
4854 External links: Free with trailing quotes (T113666)
4855 !! wikitext
4856 '''News:''' Stuff here
4857
4858 news:'a'b''c''d e
4859 !! html/php
4860 <p><b>News:</b> Stuff here
4861 </p><p><a rel="nofollow" class="external free" href="news:'a'b">news:'a'b</a><i>c</i>d e
4862 </p>
4863 !! html/parsoid
4864 <p><b>News:</b> Stuff here</p>
4865 <p><a rel="mw:ExtLink" href="news:'a'b">news:'a'b</a><i>c</i>d e</p>
4866 !! end
4867
4868 !! test
4869 External links: with entity
4870 !! wikitext
4871 [http://&#x20;www.librarieswithoutborders.org Libraries without borders]
4872 !! html/php
4873 <p><a rel="nofollow" class="external text" href="http://+www.librarieswithoutborders.org">Libraries without borders</a>
4874 </p>
4875 !! html/parsoid
4876 <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>
4877 !! end
4878
4879 !! test
4880 External links: Lone protocols are never linked (T105697)
4881 !! wikitext
4882 http://
4883 http://;
4884 (http://)
4885 bitcoin:
4886 bitcoin:;
4887 (bitcoin:)
4888 !! html
4889 <p>http://
4890 http://;
4891 (http://)
4892 bitcoin:
4893 bitcoin:;
4894 (bitcoin:)
4895 </p>
4896 !! end
4897
4898 !! test
4899 External links: No preceding word characters allowed (T67278)
4900 !! wikitext
4901 NOPEhttp://example.com
4902 N0http://example.com
4903 ok:http://example.com
4904 ok-http://example.com
4905 !! html
4906 <p>NOPEhttp://example.com
4907 N0http://example.com
4908 ok:<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4909 ok-<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4910 </p>
4911 !! end
4912
4913 !! test
4914 External links: nofollow domain exception
4915 !! wikitext
4916 A [https://no-nofollow.org/foobar link], and another [https://example.org link].
4917 !! html
4918 <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>.
4919 </p>
4920 !!end
4921
4922 !! test
4923 External image
4924 !! wikitext
4925 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4926 !! html
4927 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png"/>
4928 </p>
4929 !! end
4930
4931 !! test
4932 External image from https
4933 !! wikitext
4934 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4935 !! html
4936 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png"/>
4937 </p>
4938 !! end
4939
4940 !! test
4941 External image (when not allowed)
4942 !! options
4943 wgAllowExternalImages=0
4944 !! wikitext
4945 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4946 !! html
4947 <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>
4948 </p>
4949 !! end
4950
4951 !! test
4952 Link to non-http image, no img tag
4953 !! wikitext
4954 Link to non-http image, no img tag: ftp://example.com/test.jpg
4955 !! html
4956 <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>
4957 </p>
4958 !! end
4959
4960 !! test
4961 External links: terminating separator
4962 !! wikitext
4963 Terminating separator: http://example.com/thing,
4964 !! html
4965 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
4966 </p>
4967 !! end
4968
4969 !! test
4970 External links: intervening separator
4971 !! wikitext
4972 Intervening separator: http://example.com/1,2,3
4973 !! html
4974 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
4975 </p>
4976 !! end
4977
4978 !! test
4979 External links: old bug with URL in query
4980 !! wikitext
4981 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
4982 !! html
4983 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
4984 </p>
4985 !! end
4986
4987 !! test
4988 External links: old URL-in-URL bug, mixed protocols
4989 !! wikitext
4990 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
4991 !! html
4992 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
4993 </p>
4994 !!end
4995
4996 # Since Parsoid is starting to emit canonical wikitext for links,
4997 # [http://example.com http://example.com] will not RT back to that
4998 # form anymore.
4999 !! test
5000 External links: URL in text
5001 !! options
5002 parsoid=wt2html
5003 !! wikitext
5004 URL in text: [http://example.com http://example.com]
5005 !! html/php
5006 <p>URL in text: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
5007 </p>
5008 !! html/parsoid
5009 <p>URL in text: <a rel="mw:ExtLink" href="http://example.com">http://example.com</a></p>
5010 !! end
5011
5012 !! test
5013 External links: Clickable images
5014 !! wikitext
5015 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
5016 !! html/php
5017 <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>
5018 </p>
5019 !! html/parsoid
5020 <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>
5021 !! end
5022
5023 !! test
5024 External links: raw ampersand
5025 !! wikitext
5026 Old &amp; use: http://x&y
5027 !! html
5028 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
5029 </p>
5030 !! end
5031
5032 !! test
5033 External links: encoded ampersand
5034 !! wikitext
5035 Old &amp; use: http://x&amp;y
5036 !! html/php
5037 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
5038 </p>
5039 !! html/parsoid
5040 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y">http://x&amp;y</a></p>
5041 !! end
5042
5043 !! test
5044 External links: encoded equals (T8102)
5045 !! wikitext
5046 http://example.com/?foo&#61;bar
5047 !! html/php
5048 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
5049 </p>
5050 !! html/parsoid
5051 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a></p>
5052 !! end
5053
5054 ##
5055 ## Note that parsoid doesn't explicit mark autonumbered links, nor
5056 ## does it number them. As discussed in T55505, we can identify
5057 ## autonumbered links via CSS.
5058 ##
5059
5060 !! test
5061 External links: [raw ampersand]
5062 !! wikitext
5063 Old &amp; use: [http://x&y]
5064 !! html/php
5065 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
5066 </p>
5067 !! html/parsoid
5068 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
5069 !! end
5070
5071 # note that parsoid html is identical to [raw ampersand] case; so html2wt
5072 # mode will return the [raw ampersand] wikitext
5073 !! test
5074 External links: [encoded ampersand]
5075 !! options
5076 parsoid=wt2html,wt2wt,html2html
5077 !! wikitext
5078 Old &amp; use: [http://x&amp;y]
5079 !! html/php
5080 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
5081 </p>
5082 !! html/parsoid
5083 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
5084 !! end
5085
5086 !! test
5087 External links: [raw equals]
5088 !! wikitext
5089 [http://example.com/?foo=bar]
5090 !! html/php
5091 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
5092 </p>
5093 !! html/parsoid
5094 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
5095 !! end
5096
5097 # note that parsoid html is identical to [raw equals] case; so html2wt
5098 # mode will return the [raw equals] wikitext
5099 !! test
5100 External links: [encoded equals] (T8102)
5101 !! options
5102 parsoid=wt2html,wt2wt,html2html
5103 !! wikitext
5104 [http://example.com/?foo&#61;bar]
5105 !! html/php
5106 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
5107 </p>
5108 !! html/parsoid
5109 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
5110 !! end
5111
5112 # xxx parsoid strips the IDN character, so the round-trip tests will
5113 # obviously fail and are disabled. --cscott
5114 !! test
5115 External links: [IDN ignored character reference in hostname; strip it right off]
5116 !! options
5117 parsoid=wt2html,wt2wt,html2html
5118 !! wikitext
5119 [http://e&zwnj;xample.com/]
5120 !! html/php
5121 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
5122 </p>
5123 !! html/parsoid
5124 <p><a rel="mw:ExtLink" href="http://example.com/"></a></p>
5125 !! end
5126
5127 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
5128 # Where an external link could easily circumvent the sanitization of the text of
5129 # a link like this (where an IDN-ignore character is in the URL somewhere), this
5130 # test demands a higher standard. That's a bit strange.
5131 #
5132 # Example:
5133 #
5134 # http://e‌xample.com -> [http://example.com|http://example.com]
5135 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
5136 #
5137 # The first example is sanitized, but the second is not. Any security benefits
5138 # from this production are trivial to circumvent. Either remove this test and
5139 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
5140 # the test accordingly.
5141 #
5142 # All our love,
5143 # The Parsoid team.
5144 # xxx parsoid strips the IDN character, so the round-trip tests will
5145 # obviously fail and are disabled. --cscott
5146 !! test
5147 External links: IDN ignored character reference in hostname; strip it right off
5148 !! options
5149 parsoid=wt2html,html2html
5150 !! wikitext
5151 http://e&zwnj;xample.com/
5152 !! html/php
5153 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
5154 </p>
5155 !! html/parsoid
5156 <p><a rel="mw:ExtLink" href="http://example.com/">http://example.com/</a></p>
5157 !! end
5158
5159 !! test
5160 External links: www.jpeg.org (T2554)
5161 !! wikitext
5162 http://www.jpeg.org
5163 !! html
5164 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
5165 </p>
5166 !! end
5167
5168 # parsoid doesn't explicitly mark autonumbered links, see T55505
5169 !! test
5170 External links: URL within URL (T2002)
5171 !! wikitext
5172 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
5173 !! html/php
5174 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
5175 </p>
5176 !! html/parsoid
5177 <p><a rel="mw:ExtLink" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp"></a></p>
5178 !! end
5179
5180 !! test
5181 T2361: URL inside bracketed URL
5182 !! wikitext
5183 [http://www.example.com/foo http://www.example.com/bar]
5184 !! html
5185 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
5186 </p>
5187 !! end
5188
5189 !! test
5190 T2361: URL within URL, not bracketed
5191 !! wikitext
5192 http://www.example.com/foo?=http://www.example.com/bar
5193 !! html
5194 <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>
5195 </p>
5196 !! end
5197
5198 !! test
5199 T2289: ">"-token in URL-tail
5200 !! wikitext
5201 http://www.example.com/<hello>
5202 !! html
5203 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
5204 </p>
5205 !!end
5206
5207 !! test
5208 T2289: literal ">"-token in URL-tail
5209 !! wikitext
5210 http://www.example.com/<b>html</b>
5211 !! html/php
5212 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
5213 </p>
5214 !! html/parsoid
5215 <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>
5216 !! end
5217
5218 !! test
5219 T2289: ">"-token in bracketed URL
5220 !! wikitext
5221 [http://www.example.com/<hello> stuff]
5222 !! html
5223 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
5224 </p>
5225 !!end
5226
5227 !! test
5228 T2289: literal ">"-token in bracketed URL
5229 !! wikitext
5230 [http://www.example.com/<b>html</b> stuff]
5231 !! html
5232 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
5233 </p>
5234 !!end
5235
5236 !! test
5237 T2289: literal double quote at end of URL
5238 !! wikitext
5239 http://www.example.com/"hello"
5240 !! html
5241 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
5242 </p>
5243 !!end
5244
5245 !! test
5246 T2289: literal double quote in bracketed URL
5247 !! wikitext
5248 [http://www.example.com/"hello" stuff]
5249 !! html
5250 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
5251 </p>
5252 !!end
5253
5254 !! test
5255 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (T7081)
5256 !! wikitext
5257 [http://www.example.com test]
5258 !! html
5259 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
5260 </p>
5261 !! end
5262
5263 !! test
5264 External links: link text with spaces
5265 !! wikitext
5266 [http://www.example.com a b c]
5267 [http://www.example.com ''a'' ''b'']
5268 !! html
5269 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
5270 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
5271 </p>
5272 !! end
5273
5274 !! test
5275 External links: wiki links within external link (T5695)
5276 !! options
5277 parsoid=wt2html,html2html
5278 !! wikitext
5279 [http://example.com [[wikilink]] embedded in ext link]
5280 !! html/php
5281 <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>
5282 </p>
5283 !! html/parsoid
5284 <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>
5285 !! end
5286
5287 !! test
5288 T2787: Links with one slash after the url protocol are invalid
5289 !! wikitext
5290 http:/example.com
5291
5292 [http:/example.com title]
5293 !! html
5294 <p>http:/example.com
5295 </p><p>[http:/example.com title]
5296 </p>
5297 !! end
5298
5299 !! test
5300 Bracketed external links with template-generated invalid target
5301 !! wikitext
5302 [{{echo|http:/example.com}} title]
5303 !! html
5304 <p>[http:/example.com title]
5305 </p>
5306 !! end
5307
5308 # wt2html only because Parsoid would want to add <nowiki>s coming from html
5309 !! test
5310 Broken wikilinks (but not external links) prevent templates from closing
5311 !! options
5312 parsoid=wt2html
5313 !! wikitext
5314 [http://example.com x
5315
5316 {{echo|[http://example.com x}}
5317
5318 [[Foo
5319
5320 {{echo|[[Foo}}
5321 !! html/php
5322 <p>[<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> x
5323 </p><p>[<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> x
5324 </p><p>[[Foo
5325 </p><p>{{echo|[[Foo}}
5326 </p>
5327 !! html/parsoid
5328 <p>[<a rel="mw:ExtLink" href="http://example.com">http://example.com</a> x</p>
5329 <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>
5330 <p>[[Foo</p>
5331 <p>{{echo|[[Foo}}</p>
5332 !! end
5333
5334 !! test
5335 Wikilinks with embedded newlines are not broken
5336 !! wikitext
5337 {{echo|[[ Foo
5338 B
5339 C]]}}
5340 !! html/php
5341 <p>[[ Foo
5342 B
5343 C]]
5344 </p>
5345 !! html/parsoid
5346 <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>
5347 !! end
5348
5349 !! test
5350 Broken templates
5351 !! options
5352 parsoid=wt2html
5353 !! wikitext
5354 {{echo|[[Foo|}}]]
5355
5356 [[Foo|{{echo|]]}}
5357 !! html/php
5358 <p>{{echo|<a href="/wiki/Foo" title="Foo">}}</a>
5359 </p><p>[[Foo|]]
5360 </p>
5361 !! html/parsoid
5362 <p>{{echo|<a rel="mw:WikiLink" href="./Foo" title="Foo">}}</a></p>
5363 <p>[[Foo|<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"]]"}},"i":0}}]}'>]]</span></p>
5364 !! end
5365
5366 !! test
5367 T4702: Mismatched <i>, <b> and <a> tags are invalid
5368 !! wikitext
5369 ''[http://example.com text'']
5370 [http://example.com '''text]'''
5371 ''Something [http://example.com in italic'']
5372 ''Something [http://example.com mixed''''', even bold]'''
5373 '''''Now [http://example.com both''''']
5374 !! html
5375 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
5376 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
5377 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
5378 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
5379 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
5380 </p>
5381 !! end
5382
5383
5384 !! test
5385 T6781: %26 in URL
5386 !! wikitext
5387 http://www.example.com/?title=AT%26T
5388 !! html/php
5389 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
5390 </p>
5391 !! html/parsoid
5392 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a></p>
5393 !! end
5394
5395 # According to https://www.w3.org/TR/2011/WD-html5-20110525/Overview.html#parsing-urls a plain
5396 # % is actually legal in HTML5. Any change in output would need testing though.
5397 !! test
5398 T6781, T7267: %25 in URL
5399 !! wikitext
5400 http://www.example.com/?title=100%25_Bran
5401 !! html/php
5402 <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>
5403 </p>
5404 !! html/parsoid
5405 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran">http://www.example.com/?title=100%25_Bran</a></p>
5406 !! end
5407
5408 !! test
5409 T6781, T7267: %28, %29 in URL
5410 !! wikitext
5411 http://www.example.com/?title=Ben-Hur_%281959_film%29
5412 !! html/php
5413 <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>
5414 </p>
5415 !! html/parsoid
5416 <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>
5417 !! end
5418
5419
5420 !! test
5421 T6781: %26 in autonumber URL
5422 !! wikitext
5423 [http://www.example.com/?title=AT%26T]
5424 !! html/php
5425 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
5426 </p>
5427 !! html/parsoid
5428 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T"></a></p>
5429 !! end
5430
5431 !! test
5432 T6781, T7267: %26 in autonumber URL
5433 !! wikitext
5434 [http://www.example.com/?title=100%25_Bran]
5435 !! html/php
5436 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
5437 </p>
5438 !! html/parsoid
5439 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran"></a></p>
5440 !! end
5441
5442 !! test
5443 T6781, T7267: %28, %29 in autonumber URL
5444 !! wikitext
5445 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
5446 !! html/php
5447 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
5448 </p>
5449 !! html/parsoid
5450 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29"></a></p>
5451 !! end
5452
5453
5454 !! test
5455 T6781: %26 in bracketed URL
5456 !! wikitext
5457 [http://www.example.com/?title=AT%26T link]
5458 !! html/php
5459 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
5460 </p>
5461 !! html/parsoid
5462 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">link</a></p>
5463 !! end
5464
5465 !! test
5466 T6781, T7267: %25 in bracketed URL
5467 !! wikitext
5468 [http://www.example.com/?title=100%25_Bran link]
5469 !! html
5470 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
5471 </p>
5472 !! end
5473
5474 !! test
5475 T6781, T7267: %28, %29 in bracketed URL
5476 !! wikitext
5477 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
5478 !! html/php
5479 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
5480 </p>
5481 !! html/parsoid
5482 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a></p>
5483 !! end
5484
5485 !! test
5486 External link containing a period in the anchor. (T65947)
5487 !! wikitext
5488 [//foo.org/bar#baz. bang]
5489
5490 [//foo.org/bar. bang]
5491 !! html/php
5492 <p><a rel="nofollow" class="external text" href="//foo.org/bar#baz.">bang</a>
5493 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar.">bang</a>
5494 </p>
5495 !! html/parsoid
5496 <p><a rel="mw:ExtLink" href="//foo.org/bar#baz.">bang</a></p>
5497 <p><a rel="mw:ExtLink" href="//foo.org/bar.">bang</a></p>
5498 !! end
5499
5500 !! test
5501 External link containing a single quote. (T65947)
5502 !! wikitext
5503 [//foo.org/bar'baz]
5504
5505 [//foo.org/bar'baz bang]
5506 !! html/php
5507 <p><a rel="nofollow" class="external autonumber" href="//foo.org/bar'baz">[1]</a>
5508 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar'baz">bang</a>
5509 </p>
5510 !! html/parsoid
5511 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz"></a></p>
5512 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz">bang</a></p>
5513 !! end
5514
5515 !! test
5516 External link containing double-single-quotes in text '' (T6598 sanity check)
5517 !! wikitext
5518 Some [http://example.com/ pretty ''italics'' and stuff]!
5519 !! html
5520 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
5521 </p>
5522 !! end
5523
5524 !! test
5525 External link containing double-single-quotes in text embedded in italics (T6598 sanity check)
5526 !! wikitext
5527 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
5528 !! html
5529 <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>
5530 </p>
5531 !! end
5532
5533 !! test
5534 External link containing double-single-quotes with no space separating the url from text in italics
5535 !! wikitext
5536 [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]].]
5537 !! html/php
5538 <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>
5539 </p>
5540 !! html/php+tidy
5541 <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>
5542 !! html/parsoid
5543 <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>
5544 !! end
5545
5546 !! test
5547 External link with comments in link text
5548 !! wikitext
5549 [http://www.google.com Google <!-- comment -->]
5550 !! html/php
5551 <p><a rel="nofollow" class="external text" href="http://www.google.com">Google </a>
5552 </p>
5553 !! html/parsoid
5554 <p><a rel="mw:ExtLink" href="http://www.google.com">Google <!-- comment --></a></p>
5555 !! end
5556
5557 !! test
5558 External link to bare IPv4 address
5559 !! wikitext
5560 [http://192.168.0.1 Link]
5561 !! html/php
5562 <p><a rel="nofollow" class="external text" href="http://192.168.0.1">Link</a>
5563 </p>
5564 !! html/parsoid
5565 <p><a rel="mw:ExtLink" href="http://192.168.0.1">Link</a></p>
5566 !! end
5567
5568 !! test
5569 URL-encoding in URL functions (single parameter)
5570 !! wikitext
5571 {{localurl:Some page|amp=&}}
5572 !! html
5573 <p>/index.php?title=Some_page&amp;amp=&amp;
5574 </p>
5575 !! end
5576
5577 !! test
5578 URL-encoding in URL functions (multiple parameters)
5579 !! wikitext
5580 {{localurl:Some page|q=?&amp=&}}
5581 !! html
5582 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
5583 </p>
5584 !! end
5585
5586 !! test
5587 Brackets in urls
5588 !! wikitext
5589 http://example.com/index.php?foozoid%5B%5D=bar
5590
5591 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
5592 !! html/php
5593 <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>
5594 </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>
5595 </p>
5596 !! html/parsoid
5597 <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>
5598
5599 <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>
5600 !! end
5601
5602 !! test
5603 IPv6 urls, autolink format (T23261)
5604 !! wikitext
5605 http://[2404:130:0:1000::187:2]/index.php
5606
5607 Examples from RFC 2373, section 2.2:
5608 * http://[1080::8:800:200C:417A]/unicast
5609 * http://[FF01::101]/multicast
5610 * http://[::1]/loopback
5611 * http://[::]/unspecified
5612 * http://[::13.1.68.3]/ipv4compat
5613 * http://[::FFFF:129.144.52.38]/ipv4compat
5614
5615 Examples from RFC 2732, section 2:
5616 * http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html
5617 * http://[1080:0:0:0:8:800:200C:417A]/index.html
5618 * http://[3ffe:2a00:100:7031::1]
5619 * http://[1080::8:800:200C:417A]/foo
5620 * http://[::192.9.5.5]/ipng
5621 * http://[::FFFF:129.144.52.38]:80/index.html
5622 * http://[2010:836B:4179::836B:4179]
5623
5624 !! html/php
5625 <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>
5626 </p><p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2373">RFC 2373</a>, section 2.2:
5627 </p>
5628 <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>
5629 <li> <a rel="nofollow" class="external free" href="http://[FF01::101]/multicast">http://[FF01::101]/multicast</a></li>
5630 <li> <a rel="nofollow" class="external free" href="http://[::1]/loopback">http://[::1]/loopback</a></li>
5631 <li> <a rel="nofollow" class="external free" href="http://[::]/unspecified">http://[::]/unspecified</a></li>
5632 <li> <a rel="nofollow" class="external free" href="http://[::13.1.68.3]/ipv4compat">http://[::13.1.68.3]/ipv4compat</a></li>
5633 <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>
5634 <p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2732">RFC 2732</a>, section 2:
5635 </p>
5636 <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>
5637 <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>
5638 <li> <a rel="nofollow" class="external free" href="http://[3ffe:2a00:100:7031::1]">http://[3ffe:2a00:100:7031::1]</a></li>
5639 <li> <a rel="nofollow" class="external free" href="http://[1080::8:800:200C:417A]/foo">http://[1080::8:800:200C:417A]/foo</a></li>
5640 <li> <a rel="nofollow" class="external free" href="http://[::192.9.5.5]/ipng">http://[::192.9.5.5]/ipng</a></li>
5641 <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>
5642 <li> <a rel="nofollow" class="external free" href="http://[2010:836B:4179::836B:4179]">http://[2010:836B:4179::836B:4179]</a></li></ul>
5643
5644 !! html/parsoid
5645 <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>
5646
5647 <p>Examples from <a href="//tools.ietf.org/html/rfc2373" rel="mw:ExtLink">RFC 2373</a>, section 2.2:</p>
5648 <ul><li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/unicast">http://[1080::8:800:200C:417A]/unicast</a></li>
5649 <li> <a rel="mw:ExtLink" href="http://[FF01::101]/multicast">http://[FF01::101]/multicast</a></li>
5650 <li> <a rel="mw:ExtLink" href="http://[::1]/loopback">http://[::1]/loopback</a></li>
5651 <li> <a rel="mw:ExtLink" href="http://[::]/unspecified">http://[::]/unspecified</a></li>
5652 <li> <a rel="mw:ExtLink" href="http://[::13.1.68.3]/ipv4compat">http://[::13.1.68.3]/ipv4compat</a></li>
5653 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]/ipv4compat">http://[::FFFF:129.144.52.38]/ipv4compat</a></li></ul>
5654
5655 <p>Examples from <a href="//tools.ietf.org/html/rfc2732" rel="mw:ExtLink">RFC 2732</a>, section 2:</p>
5656 <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>
5657 <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>
5658 <li> <a rel="mw:ExtLink" href="http://[3ffe:2a00:100:7031::1]">http://[3ffe:2a00:100:7031::1]</a></li>
5659 <li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/foo">http://[1080::8:800:200C:417A]/foo</a></li>
5660 <li> <a rel="mw:ExtLink" href="http://[::192.9.5.5]/ipng">http://[::192.9.5.5]/ipng</a></li>
5661 <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>
5662 <li> <a rel="mw:ExtLink" href="http://[2010:836B:4179::836B:4179]">http://[2010:836B:4179::836B:4179]</a></li></ul>
5663 !! end
5664
5665 !! test
5666 IPv6 urls, bracketed format (T23261)
5667 !! wikitext
5668 [http://[2404:130:0:1000::187:2]/index.php test]
5669
5670 Examples from RFC 2373, section 2.2:
5671 * [http://[1080::8:800:200C:417A] unicast]
5672 * [http://[FF01::101] multicast]
5673 * [http://[::1]/ loopback]
5674 * [http://[::] unspecified]
5675 * [http://[::13.1.68.3] ipv4compat]
5676 * [http://[::FFFF:129.144.52.38] ipv4compat]
5677
5678 Examples from RFC 2732, section 2:
5679 * [http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html 1]
5680 * [http://[1080:0:0:0:8:800:200C:417A]/index.html 2]
5681 * [http://[3ffe:2a00:100:7031::1] 3]
5682 * [http://[1080::8:800:200C:417A]/foo 4]
5683 * [http://[::192.9.5.5]/ipng 5]
5684 * [http://[::FFFF:129.144.52.38]:80/index.html 6]
5685 * [http://[2010:836B:4179::836B:4179] 7]
5686
5687 !! html/php
5688 <p><a rel="nofollow" class="external text" href="http://[2404:130:0:1000::187:2]/index.php">test</a>
5689 </p><p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2373">RFC 2373</a>, section 2.2:
5690 </p>
5691 <ul><li> <a rel="nofollow" class="external text" href="http://[1080::8:800:200C:417A]">unicast</a></li>
5692 <li> <a rel="nofollow" class="external text" href="http://[FF01::101]">multicast</a></li>
5693 <li> <a rel="nofollow" class="external text" href="http://[::1]/">loopback</a></li>
5694 <li> <a rel="nofollow" class="external text" href="http://[::]">unspecified</a></li>
5695 <li> <a rel="nofollow" class="external text" href="http://[::13.1.68.3]">ipv4compat</a></li>
5696 <li> <a rel="nofollow" class="external text" href="http://[::FFFF:129.144.52.38]">ipv4compat</a></li></ul>
5697 <p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2732">RFC 2732</a>, section 2:
5698 </p>
5699 <ul><li> <a rel="nofollow" class="external text" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">1</a></li>
5700 <li> <a rel="nofollow" class="external text" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">2</a></li>
5701 <li> <a rel="nofollow" class="external text" href="http://[3ffe:2a00:100:7031::1]">3</a></li>
5702 <li> <a rel="nofollow" class="external text" href="http://[1080::8:800:200C:417A]/foo">4</a></li>
5703 <li> <a rel="nofollow" class="external text" href="http://[::192.9.5.5]/ipng">5</a></li>
5704 <li> <a rel="nofollow" class="external text" href="http://[::FFFF:129.144.52.38]:80/index.html">6</a></li>
5705 <li> <a rel="nofollow" class="external text" href="http://[2010:836B:4179::836B:4179]">7</a></li></ul>
5706
5707 !! html/parsoid
5708 <p><a rel="mw:ExtLink" href="http://[2404:130:0:1000::187:2]/index.php">test</a></p>
5709
5710 <p>Examples from <a href="//tools.ietf.org/html/rfc2373" rel="mw:ExtLink">RFC 2373</a>, section 2.2:</p>
5711 <ul><li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]">unicast</a></li>
5712 <li> <a rel="mw:ExtLink" href="http://[FF01::101]">multicast</a></li>
5713 <li> <a rel="mw:ExtLink" href="http://[::1]/">loopback</a></li>
5714 <li> <a rel="mw:ExtLink" href="http://[::]">unspecified</a></li>
5715 <li> <a rel="mw:ExtLink" href="http://[::13.1.68.3]">ipv4compat</a></li>
5716 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]">ipv4compat</a></li></ul>
5717
5718 <p>Examples from <a href="//tools.ietf.org/html/rfc2732" rel="mw:ExtLink">RFC 2732</a>, section 2:</p>
5719 <ul><li> <a rel="mw:ExtLink" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">1</a></li>
5720 <li> <a rel="mw:ExtLink" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">2</a></li>
5721 <li> <a rel="mw:ExtLink" href="http://[3ffe:2a00:100:7031::1]">3</a></li>
5722 <li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/foo">4</a></li>
5723 <li> <a rel="mw:ExtLink" href="http://[::192.9.5.5]/ipng">5</a></li>
5724 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]:80/index.html">6</a></li>
5725 <li> <a rel="mw:ExtLink" href="http://[2010:836B:4179::836B:4179]">7</a></li></ul>
5726 !! end
5727
5728 !! test
5729 Non-extlinks in brackets
5730 !! wikitext
5731 [foo]
5732 [foo bar]
5733 [foo ''bar'']
5734 [fool's] errand
5735 [fool's errand]
5736 [{{echo|foo}}]
5737 [{{echo|foo}} bar]
5738 [{{echo|foo}} ''bar'']
5739 [{{echo|foo}}l's] errand
5740 [{{echo|foo}}l's errand]
5741 [url={{echo|foo}}]
5742 [url=http://example.com]
5743 [http:// bare protocols don't count]
5744 !! html/php
5745 <p>[foo]
5746 [foo bar]
5747 [foo <i>bar</i>]
5748 [fool's] errand
5749 [fool's errand]
5750 [foo]
5751 [foo bar]
5752 [foo <i>bar</i>]
5753 [fool's] errand
5754 [fool's errand]
5755 [url=foo]
5756 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
5757 [http:// bare protocols don't count]
5758 </p>
5759 !! html/parsoid
5760 <p>[foo]
5761 [foo bar]
5762 [foo <i>bar</i>]
5763 [fool's] errand
5764 [fool's errand]
5765 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}"}'>foo</span>]
5766 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}"}'>foo</span> bar]
5767 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}"}'>foo</span> <i>bar</i>]
5768 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}l&#39;s"}'>fool's</span>] errand
5769 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}l&#39;s"}'>fool's</span> errand]
5770 [<span typeof="mw:Placeholder" data-parsoid='{"src":"url={{echo|foo}}"}'>url=foo</span>]
5771 [url=<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>]
5772 [http:// bare protocols don't count]</p>
5773 !! end
5774
5775 !! test
5776 Percent encoding in external links
5777 !! wikitext
5778 [https://github.com/search?l=&q=ResourceLoader+%40wikimedia Search]
5779 !! html/php
5780 <p><a rel="nofollow" class="external text" href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a>
5781 </p>
5782 !! html/parsoid
5783 <p><a rel="mw:ExtLink"
5784 href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a></p>
5785 !! end
5786
5787 !! test
5788 Use url link syntax for links where the content is equal the link target
5789 !! wikitext
5790 http://example.com
5791 !! html/php
5792 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
5793 </p>
5794 !! html/parsoid
5795 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></p>
5796 !! end
5797
5798 !! test
5799 Parenthesis in external links, especially URL links
5800 !! wikitext
5801 http://example.com)
5802
5803 http://example.com/test)
5804
5805 http://example.com/(test)
5806
5807 http://example.com/((test)
5808
5809 (http://example.com/(test))
5810
5811 (http://example.com/(test)))))
5812
5813 http://example.com/a)b
5814
5815 [http://example.com) foo]
5816 !! html/php
5817 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5818 </p><p><a rel="nofollow" class="external free" href="http://example.com/test">http://example.com/test</a>)
5819 </p><p><a rel="nofollow" class="external free" href="http://example.com/(test)">http://example.com/(test)</a>
5820 </p><p><a rel="nofollow" class="external free" href="http://example.com/((test)">http://example.com/((test)</a>
5821 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test))">http://example.com/(test))</a>
5822 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test)))))">http://example.com/(test)))))</a>
5823 </p><p><a rel="nofollow" class="external free" href="http://example.com/a)b">http://example.com/a)b</a>
5824 </p><p><a rel="nofollow" class="external text" href="http://example.com)">foo</a>
5825 </p>
5826 !! html/parsoid
5827 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)</p>
5828 <p><a rel="mw:ExtLink" href="http://example.com/test">http://example.com/test</a>)</p>
5829 <p><a rel="mw:ExtLink" href="http://example.com/(test)">http://example.com/(test)</a></p>
5830 <p><a rel="mw:ExtLink" href="http://example.com/((test)">http://example.com/((test)</a></p>
5831 <p>(<a rel="mw:ExtLink" href="http://example.com/(test))">http://example.com/(test))</a></p>
5832 <p>(<a rel="mw:ExtLink" href="http://example.com/(test)))))">http://example.com/(test)))))</a></p>
5833 <p><a rel="mw:ExtLink" href="http://example.com/a)b">http://example.com/a)b</a></p>
5834 <p><a rel="mw:ExtLink" href="http://example.com)">foo</a></p>
5835 !! end
5836
5837 !! test
5838 Parenthesis in external links, w/ transclusion or comment
5839 !! wikitext
5840 (http://example.com/{{echo|hi}})
5841
5842 (http://example.com<!-- hi -->)
5843 !! html/php
5844 <p>(<a rel="nofollow" class="external free" href="http://example.com/hi">http://example.com/hi</a>)
5845 </p><p>(<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5846 </p>
5847 !! html/parsoid
5848 <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>
5849
5850 <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>
5851 !! end
5852
5853 !! test
5854 Serialize <a> tags with invalid link targets as plain text
5855 !! options
5856 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
5857 !! html/parsoid
5858 <a rel="mw:WikiLink" href="[[foo]]">text</a>
5859 <a rel="mw:WikiLink" href="[[foo]]">*text</a>
5860 <a rel="mw:WikiLink" href="[[foo]]">[[foo]]</a>
5861 <a rel="mw:WikiLink" href="[[foo]]">*a [[foo]]</a>
5862 !! wikitext
5863 text
5864 <nowiki>*</nowiki>text
5865 <nowiki>[[foo]]</nowiki>
5866 <nowiki>*</nowiki>a <nowiki>[[foo]]</nowiki>
5867 !! end
5868
5869 !! test
5870 mw:ExtLink -vs- mw:WikiLink (T94723)
5871 !! options
5872 parsoid=html2wt
5873 !! html/parsoid
5874 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"piped","a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>Bar</a>
5875 <a rel="mw:WikiLink" href="./Foo" title="Foo">Bar</a>
5876 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
5877 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
5878 <p>
5879 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
5880 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
5881 </p>
5882 !! wikitext
5883 [[Foo|Bar]]
5884 [[Foo|Bar]]
5885 [[wikipedia:Foo|Bar]]
5886 [[wikipedia:Foo|Bar]]
5887
5888 [[wikipedia:European_Robin|European Robin]]
5889 [[wikipedia:European_Robin|European Robin]]
5890 !! end
5891
5892 !! test
5893 mw:ExtLink linking to a interwiki URL can be round-tripped losslessly (T94723)
5894 !! options
5895 parsoid=wt2wt
5896 !! wikitext
5897 [http://en.wikipedia.org/wiki/European_Robin European Robin]
5898 !! html/parsoid
5899 THIS SECTION IS NOT USED (but Parsoid won't run the test without it)
5900 !! end
5901
5902
5903 ###
5904 ### Quotes
5905 ###
5906
5907 !! test
5908 Quotes
5909 !! wikitext
5910 Normal text. '''Bold text.''' Normal text. ''Italic text.''
5911
5912 Normal text. '''''Bold italic text.''''' Normal text.
5913 !! html
5914 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
5915 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
5916 </p>
5917 !! end
5918
5919
5920 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
5921 # parser strips. The wikitext contains just the first half of the bold
5922 # quote pair.
5923 !! test
5924 Unclosed and unmatched quotes
5925 !! wikitext
5926 '''''Bold italic text '''with bold deactivated''' in between.'''''
5927
5928 '''''Bold italic text ''with italic deactivated'' in between.'''''
5929
5930 '''Bold text..
5931
5932 ..spanning two paragraphs (should not work).'''
5933
5934 '''Bold tag left open
5935
5936 ''Italic tag left open
5937
5938 Normal text.
5939
5940 <!-- Unmatching number of opening, closing tags: -->
5941 '''This year''''s election ''should'' beat '''last year''''s.
5942
5943 ''Tom'''s car is bigger than ''Susan'''s.
5944
5945 Plain ''italic'''s plain
5946 !! html/php
5947 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
5948 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
5949 </p><p><b>Bold text..</b>
5950 </p><p>..spanning two paragraphs (should not work).
5951 </p><p><b>Bold tag left open</b>
5952 </p><p><i>Italic tag left open</i>
5953 </p><p>Normal text.
5954 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
5955 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
5956 </p><p>Plain <i>italic'</i>s plain
5957 </p>
5958 !! html/parsoid
5959 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
5960 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
5961 </p><p><b>Bold text..</b>
5962 </p><p>..spanning two paragraphs (should not work).<b></b>
5963 </p><p><b>Bold tag left open</b>
5964 </p><p><i>Italic tag left open</i>
5965 </p><p>Normal text.
5966 </p>
5967 <!-- Unmatching number of opening, closing tags: -->
5968 <p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
5969 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
5970 </p><p>Plain <i>italic'</i>s plain
5971 </p>
5972 !! end
5973
5974 ###
5975 ### Tables
5976 ###
5977 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
5978 ###
5979
5980 # This should not produce <table></table> as <table><tr><td></td></tr></table>
5981 # is the bare minimum required by the spec, see:
5982 # https://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
5983 # Parsoid team replies: empty table tags are legal in HTML5
5984 !! test
5985 A table with no data.
5986 !! options
5987 parsoid=wt2html
5988 !! wikitext
5989 {||}
5990 !! html/php
5991
5992 !! html/parsoid
5993 <table></table>
5994
5995 !! end
5996
5997 !! test
5998 A table with stray table end tags on start tag line (wt2html)
5999 !! options
6000 parsoid=wt2html
6001 !! wikitext
6002 {|style="color: red;"|}
6003
6004 {|style="color: red;" |}
6005 |foo
6006 |}
6007
6008 {|style="color: red;"|} id="foo"
6009 |foo
6010 |}
6011
6012 {|style="color: red;" |} id="foo"
6013 |foo
6014 |}
6015 !! html
6016 <table style="color: red;"></table>
6017
6018 <table style="color: red;">
6019 <tbody><tr>
6020 <td>foo</td>
6021 </tr></tbody>
6022 </table>
6023
6024 <table style="color: red;" id="foo">
6025 <tbody><tr>
6026 <td>foo</td>
6027 </tr></tbody>
6028 </table>
6029
6030 <table style="color: red;" id="foo">
6031 <tbody><tr>
6032 <td>foo</td>
6033 </tr></tbody>
6034 </table>
6035
6036 !! end
6037
6038 !! test
6039 A table with no data (take 2)
6040 !! wikitext
6041 {|
6042 |}
6043 !! html/parsoid
6044 <table></table>
6045 !! end
6046
6047 # A table with nothing but a caption is invalid XHTML, we might want to render
6048 # this as <p>caption</p>
6049 # Parsoid team replies: table with only a caption is legal in HTML5
6050 !! test
6051 A table with nothing but a caption
6052 !! wikitext
6053 {|
6054 |+ caption
6055 |}
6056 !! html/php
6057 <table>
6058 <caption> caption
6059 </caption><tr><td></td></tr></table>
6060
6061 !! html/parsoid
6062 <table><caption> caption</caption></table>
6063 !! end
6064
6065 !! test
6066 A table with caption with default-spaced attributes and a table row
6067 !! wikitext
6068 {|
6069 |+ style="color: red;" | caption1
6070 |-
6071 | foo
6072 |}
6073 !! html
6074 <table>
6075 <caption style="color: red;"> caption1
6076 </caption>
6077 <tr>
6078 <td> foo
6079 </td></tr></table>
6080
6081 !! end
6082
6083 !! test
6084 A table with captions with non-default spaced attributes and a table row
6085 !! wikitext
6086 {|
6087 |+style="color: red;"|caption2
6088 |+ style="color: red;"| caption3
6089 |-
6090 | foo
6091 |}
6092 !! html
6093 <table>
6094 <caption style="color: red;">caption2
6095 </caption>
6096 <caption style="color: red;"> caption3
6097 </caption>
6098 <tr>
6099 <td> foo
6100 </td></tr></table>
6101
6102 !! end
6103
6104 !! test
6105 Table td-cell syntax variations
6106 !! wikitext
6107 {|
6108 | foo bar foo | baz
6109 | foo bar foo || baz
6110 | style='color:red;' | baz
6111 | style='color:red;' || baz
6112 |}
6113 !! html
6114 <table>
6115 <tr>
6116 <td> baz
6117 </td>
6118 <td> foo bar foo </td>
6119 <td> baz
6120 </td>
6121 <td style="color:red;"> baz
6122 </td>
6123 <td> style='color:red;' </td>
6124 <td> baz
6125 </td></tr></table>
6126
6127 !! end
6128
6129 !! test
6130 Simple table
6131 !! wikitext
6132 {|
6133 | 1 || 2
6134 |-
6135 | 3 || 4
6136 |}
6137 !! html
6138 <table>
6139 <tr>
6140 <td> 1 </td>
6141 <td> 2
6142 </td></tr>
6143 <tr>
6144 <td> 3 </td>
6145 <td> 4
6146 </td></tr></table>
6147
6148 !! end
6149
6150 !! test
6151 Simple table but with multiple dashes for row wikitext
6152 !! wikitext
6153 {|
6154 | foo
6155 |-----
6156 | bar
6157 |}
6158 !! html
6159 <table>
6160 <tr>
6161 <td> foo
6162 </td></tr>
6163 <tr>
6164 <td> bar
6165 </td></tr></table>
6166
6167 !! end
6168
6169 !! test
6170 Multiplication table
6171 !! wikitext
6172 {| border="1" cellpadding="2"
6173 |+Multiplication table
6174 |-
6175 ! &times; !! 1 !! 2 !! 3
6176 |-
6177 ! 1
6178 | 1 || 2 || 3
6179 |-
6180 ! 2
6181 | 2 || 4 || 6
6182 |-
6183 ! 3
6184 | 3 || 6 || 9
6185 |-
6186 ! 4
6187 | 4 || 8 || 12
6188 |-
6189 ! 5
6190 | 5 || 10 || 15
6191 |}
6192 !! html
6193 <table border="1" cellpadding="2">
6194 <caption>Multiplication table
6195 </caption>
6196 <tr>
6197 <th> &#215; </th>
6198 <th> 1 </th>
6199 <th> 2 </th>
6200 <th> 3
6201 </th></tr>
6202 <tr>
6203 <th> 1
6204 </th>
6205 <td> 1 </td>
6206 <td> 2 </td>
6207 <td> 3
6208 </td></tr>
6209 <tr>
6210 <th> 2
6211 </th>
6212 <td> 2 </td>
6213 <td> 4 </td>
6214 <td> 6
6215 </td></tr>
6216 <tr>
6217 <th> 3
6218 </th>
6219 <td> 3 </td>
6220 <td> 6 </td>
6221 <td> 9
6222 </td></tr>
6223 <tr>
6224 <th> 4
6225 </th>
6226 <td> 4 </td>
6227 <td> 8 </td>
6228 <td> 12
6229 </td></tr>
6230 <tr>
6231 <th> 5
6232 </th>
6233 <td> 5 </td>
6234 <td> 10 </td>
6235 <td> 15
6236 </td></tr></table>
6237
6238 !! end
6239
6240 !! test
6241 Accept "||" in table headings
6242 !! wikitext
6243 {|
6244 !h1 || h2
6245 |}
6246 !! html
6247 <table>
6248 <tr>
6249 <th>h1 </th>
6250 <th> h2
6251 </th></tr></table>
6252
6253 !! end
6254
6255 !! test
6256 Accept "!!" in table data
6257 !! wikitext
6258 {|
6259 | Foo!! ||
6260 |}
6261 !! html
6262 <table>
6263 <tr>
6264 <td> Foo!! </td>
6265 <td>
6266 </td></tr></table>
6267
6268 !! html/parsoid
6269 <table>
6270 <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>
6271 </tbody></table>
6272 !! end
6273
6274 !! test
6275 Accept "||" in indented table headings
6276 !! wikitext
6277 :{|
6278 !h1 || h2
6279 |}
6280 !! html
6281 <dl><dd><table>
6282 <tr>
6283 <th>h1 </th>
6284 <th> h2
6285 </th></tr></table></dd></dl>
6286
6287 !! end
6288
6289 !! test
6290 Accept "!!" in templates
6291 !! wikitext
6292 {|
6293 !a {{echo|b!!c}}
6294 |}
6295 !! html/php
6296 <table>
6297 <tr>
6298 <th>a b</th>
6299 <th>c
6300 </th></tr></table>
6301
6302 !! html/parsoid
6303 <table>
6304 <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>
6305 !! end
6306
6307 !! test
6308 Accept "!!" in table headings after newline
6309 !! wikitext
6310 {|
6311 !a
6312 b!!c
6313 |}
6314 !! html/php
6315 <table>
6316 <tr>
6317 <th>a
6318 <p>b!!c
6319 </p>
6320 </th></tr></table>
6321
6322 !! html/parsoid
6323 <table>
6324 <tbody><tr><th>a
6325 <p>b!!c</p></th></tr>
6326 </tbody></table>
6327 !! end
6328
6329 !! test
6330 Accept "!!" in table data of mixed wikitext / html syntax
6331 !! wikitext
6332 {|
6333 !a
6334 <tr><td>b!!c</td></tr>
6335 |}
6336 !! html+tidy
6337 <table>
6338 <tr>
6339 <th>a</th>
6340 </tr>
6341 <tr>
6342 <td>b!!c</td>
6343 </tr>
6344 </table>
6345 !! html/parsoid
6346 <table>
6347 <tbody><tr><th>a</th></tr>
6348 <tr data-parsoid='{"stx":"html"}'><td data-parsoid='{"stx":"html"}'>b!!c</td></tr>
6349 </tbody></table>
6350 !! end
6351
6352 !! test
6353 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
6354 !! wikitext
6355 {|
6356 !| h1
6357 || a
6358 |}
6359 !! html
6360 <table>
6361 <tr>
6362 <th> h1
6363 </th>
6364 <td> a
6365 </td></tr></table>
6366
6367 !! end
6368
6369 !!test
6370 Accept "| !" at start of line in tables (ignore !-attribute)
6371 !! wikitext
6372 {|
6373 |-
6374 | !style="color:red" | bar
6375 |}
6376 !! html
6377 <table>
6378
6379 <tr>
6380 <td> bar
6381 </td></tr></table>
6382
6383 !!end
6384
6385 !!test
6386 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 +/-
6387 !! wikitext
6388 {|
6389 |-
6390 |style='color:red;'|+1
6391 |style='color:blue;'|-1
6392 |-
6393 | 1 || 2 || 3
6394 | 1 ||+2 ||-3
6395 |-
6396 | +1
6397 | -1
6398 |}
6399 !! html
6400 <table>
6401
6402 <tr>
6403 <td style="color:red;">+1
6404 </td>
6405 <td style="color:blue;">-1
6406 </td></tr>
6407 <tr>
6408 <td> 1 </td>
6409 <td> 2 </td>
6410 <td> 3
6411 </td>
6412 <td> 1 </td>
6413 <td>+2 </td>
6414 <td>-3
6415 </td></tr>
6416 <tr>
6417 <td> +1
6418 </td>
6419 <td> -1
6420 </td></tr></table>
6421
6422 !!end
6423
6424 !! test
6425 Table rowspan
6426 !! wikitext
6427 {| border=1
6428 | Cell 1, row 1
6429 |rowspan=2| Cell 2, row 1 (and 2)
6430 | Cell 3, row 1
6431 |-
6432 | Cell 1, row 2
6433 | Cell 3, row 2
6434 |}
6435 !! html
6436 <table border="1">
6437 <tr>
6438 <td> Cell 1, row 1
6439 </td>
6440 <td rowspan="2"> Cell 2, row 1 (and 2)
6441 </td>
6442 <td> Cell 3, row 1
6443 </td></tr>
6444 <tr>
6445 <td> Cell 1, row 2
6446 </td>
6447 <td> Cell 3, row 2
6448 </td></tr></table>
6449
6450 !! end
6451
6452 !! test
6453 Nested table
6454 !! wikitext
6455 {| border=1
6456 | &alpha;
6457 |
6458 {| bgcolor=#ABCDEF border=2
6459 |nested
6460 |-
6461 |table
6462 |}
6463 |the original table again
6464 |}
6465 !! html
6466 <table border="1">
6467 <tr>
6468 <td> &#945;
6469 </td>
6470 <td>
6471 <table bgcolor="#ABCDEF" border="2">
6472 <tr>
6473 <td>nested
6474 </td></tr>
6475 <tr>
6476 <td>table
6477 </td></tr></table>
6478 </td>
6479 <td>the original table again
6480 </td></tr></table>
6481
6482 !! end
6483
6484 !! test
6485 Invalid attributes in table cell (T3830)
6486 !! wikitext
6487 {|
6488 |Cell:|broken
6489 |}
6490 !! html
6491 <table>
6492 <tr>
6493 <td>broken
6494 </td></tr></table>
6495
6496 !! end
6497
6498 !! test
6499 Table cell attributes: Pipes protected by nowikis should be treated as a plain character
6500 !! wikitext
6501 {|
6502 | title="foo" |bar
6503 | title="foo<nowiki>|</nowiki>" |bar
6504 | title="foo<nowiki>|</nowiki>" bar
6505 |}
6506 !! html/php
6507 <table>
6508 <tr>
6509 <td title="foo">bar
6510 </td>
6511 <td title="foo&#124;">bar
6512 </td>
6513 <td> title="foo|" bar
6514 </td></tr></table>
6515
6516 !! html/parsoid
6517 <table>
6518 <tbody><tr><td title="foo">bar</td>
6519 <td title="foo|" data-parsoid='{"a":{"title":"foo|"},"sa":{"title":"foo&lt;nowiki>|&lt;/nowiki>"},"autoInsertedEnd":true}'>bar</td>
6520 <td> title="foo<span typeof="mw:Nowiki">|</span>" bar</td></tr>
6521 </tbody></table>
6522 !! end
6523
6524 # See: http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html
6525 # N.B. The "|}" to close the table is missing from the input, so parsoid's
6526 # *2wt modes will fail.
6527 !! test
6528 Table security: embedded pipes
6529 !! options
6530 parsoid=wt2html,html2html
6531 !! wikitext
6532 {|
6533 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
6534 !! html/php
6535 <table>
6536 <tr>
6537 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
6538 <td>]" onmouseover="alert(document.cookie)"&gt;test
6539 </td>
6540 </tr>
6541 </table>
6542
6543 !! html/parsoid
6544 <table><tbody>
6545 <tr>
6546 <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>
6547 !! end
6548
6549 !! test
6550 Element attributes with double ! should not be broken up by <th>
6551 !! wikitext
6552 {|
6553 ! hi <div class="!!">ha</div> ho
6554 |}
6555 !! html/php
6556 <table>
6557 <tr>
6558 <th> hi <div class="!!">ha</div> ho
6559 </th></tr></table>
6560
6561 !! html/parsoid
6562 <table>
6563 <tbody><tr><th> hi <div class="!!" data-parsoid='{"stx":"html"}'>ha</div> ho</th></tr>
6564 </tbody></table>
6565 !! end
6566
6567 !! test
6568 ! and || in element attributes should not be parsed as <th>/<td>
6569 !! wikitext
6570 {|
6571 | <div style="color: red !important;" data-contrived="put this here ||">hi</div>
6572 |}
6573 !! html/php
6574 <table>
6575 <tr>
6576 <td> <div style="color: red !important;" data-contrived="put this here &#124;&#124;">hi</div>
6577 </td></tr></table>
6578
6579 !! html/parsoid
6580 <table>
6581 <tbody><tr><td> <div style="color: red !important;" data-contrived="put this here ||" data-parsoid='{"stx":"html"}'>hi</div></td></tr>
6582 </tbody></table>
6583 !! end
6584
6585 # FIXME: The output seems broken. Filed as T110268.
6586 !! test
6587 ! and || in td attributes should not be parsed as <th>/<td>
6588 !! options
6589 parsoid=wt2html
6590 !! wikitext
6591 {|
6592 | style="color: red !important;" data-contrived="put this here ||" | foo
6593 |}
6594 !! html/php
6595 <table>
6596 <tr>
6597 <td> style="color: red !important;" data-contrived="put this here </td>
6598 <td> foo
6599 </td></tr></table>
6600
6601 !! html/parsoid
6602 <table>
6603 <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>
6604 </tbody></table>
6605 !! end
6606
6607 !! test
6608 Break on | in element attribute in template
6609 !! options
6610 parsoid=wt2html,html2html
6611 !! wikitext
6612 {{echo|1=<div class="hi|ho">ha</div>}}
6613 !! html/php
6614 <p>ho"&gt;ha&lt;/div&gt;
6615 </p>
6616 !! html/parsoid
6617 <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>
6618 !! end
6619
6620 !! test
6621 Break on | in element attribute name in template
6622 !! wikitext
6623 {{echo|<div cla|ss="hiho">ha</div>}}
6624 !! html/parsoid
6625 <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>
6626 !! end
6627
6628 !! test
6629 Don't break on | in extension attribute in template
6630 !! wikitext
6631 {{echo|<ref name="hi|ho">ha</ref>}}
6632
6633 <references />
6634 !! html/parsoid
6635 <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>
6636
6637 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-hi.7Cho-1" id="cite_note-hi.7Cho-1"><a href="./Main_Page#cite_ref-hi.7Cho_1-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-hi.7Cho-1" class="mw-reference-text">ha</span></li></ol>
6638 !! end
6639
6640 ## We don't support roundtripping of these attributes in Parsoid.
6641 ## Selective serialization takes care of preventing dirty diffs.
6642 ## But, on edits, we dirty-diff the invalid attribute text.
6643 !! test
6644 Invalid text in table attributes should be discarded
6645 !! options
6646 parsoid=wt2html
6647 !! wikitext
6648 {| <span>boo</span> style='border:1px solid black'
6649 | <span>boo</span> style='color:blue' | 1
6650 |<span>boo</span> style='color:blue'| 2
6651 |}
6652 !! html/php
6653 <table style="border:1px solid black">
6654 <tr>
6655 <td style="color:blue"> 1
6656 </td>
6657 <td style="color:blue"> 2
6658 </td></tr></table>
6659
6660 !! html/parsoid
6661 <table style="border:1px solid black">
6662 <tr>
6663 <td style="color:blue"> 1</td>
6664 <td style="color:blue"> 2</td>
6665 </tr>
6666 </table>
6667 !! end
6668
6669 !! test
6670 Invalid text in table attributes should be preserved by selective serializer
6671 !! options
6672 parsoid={
6673 "modes": ["selser"],
6674 "changes": [
6675 ["td:first-child", "text", "abc"],
6676 ["td + td", "text", "xyz"]
6677 ]
6678 }
6679 !! wikitext
6680 {| <span>boo</span> style='border:1px solid black'
6681 | <span>boo</span> style='color:blue' | 1
6682 |<span>boo</span> style='color:blue'| 2
6683 |}
6684 !! wikitext/edited
6685 {| <span>boo</span> style='border:1px solid black'
6686 | <span>boo</span> style='color:blue' |abc
6687 |<span>boo</span> style='color:blue'|xyz
6688 |}
6689 !! end
6690
6691 !! test
6692 1. Template-generated table cell attributes and cell content
6693 !! wikitext
6694 {|
6695 |{{table_attribs}}
6696 | {{table_attribs}}
6697 || {{table_attribs_5}}
6698 | <!--foo--> <!--bar--> <!--baz--> {{table_attribs}}
6699 |align=center {{table_attribs}}
6700 | <!--foo--> align=center <!--bar--> {{table_attribs}}
6701 |}
6702 !! html
6703 <table>
6704 <tr>
6705 <td style="color:red;">Foo
6706 </td>
6707 <td style="color:red;">Foo
6708 </td>
6709 <td> style="color:red;"</td>
6710 <td>Bar
6711 </td>
6712 <td style="color:red;">Foo
6713 </td>
6714 <td align="center" style="color:red;">Foo
6715 </td>
6716 <td align="center" style="color:red;">Foo
6717 </td></tr></table>
6718
6719 !! end
6720
6721 !! test
6722 2. Template-generated table cell attributes and cell content
6723 !! wikitext
6724 {|
6725 |{{table_attribs_2}}
6726 |}
6727 !! html/php
6728 <table>
6729 <tr>
6730 <td style="color:red;">Foo
6731 </td>
6732 <td>Bar</td>
6733 <td>Baz
6734 </td></tr></table>
6735
6736 !! html/parsoid
6737 <table>
6738 <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>
6739 <td about="#mwt1">Bar</td><td about="#mwt1">Baz</td></tr>
6740 </tbody></table>
6741 !! end
6742
6743 !! test
6744 3. Template-generated table cell attributes and cell content
6745 !! wikitext
6746 {|
6747 !align=center {{table_header_cells}}
6748 |-
6749 |align=center {{table_cells}}
6750 |}
6751 !! html/php
6752 <table>
6753 <tr>
6754 <th align="center" style="color:red;">Foo</th>
6755 <th style="color:red;"><i>Bar</i></th>
6756 <th style="color:brown;"><i>Foo</i> and Baz
6757 </th></tr>
6758 <tr>
6759 <td align="center" style="color:red;">Foo</td>
6760 <td style="color:red;"><i>Bar</i></td>
6761 <td style="color:brown;"><i>Foo</i> and Baz
6762 </td></tr></table>
6763
6764 !! html/parsoid
6765 <table>
6766 <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>
6767 <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>
6768 </tbody></table>
6769 !! end
6770
6771 !! test
6772 4. Template-generated table cell attributes and cell content inside a templated table
6773 !! wikitext
6774 {{tbl-start}}
6775 !align=center {{table_header_cells}}
6776 |-
6777 |align=center {{table_cells}}
6778 {{tbl-end}}
6779 !! html/php
6780 <table>
6781 <tr>
6782 <th align="center" style="color:red;">Foo</th>
6783 <th style="color:red;"><i>Bar</i></th>
6784 <th style="color:brown;"><i>Foo</i> and Baz
6785 </th></tr>
6786 <tr>
6787 <td align="center" style="color:red;">Foo</td>
6788 <td style="color:red;"><i>Bar</i></td>
6789 <td style="color:brown;"><i>Foo</i> and Baz
6790 </td></tr></table>
6791
6792 !! html/parsoid
6793 <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}}]}'>
6794 <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>
6795 <tr>
6796 <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>
6797 </tbody></table>
6798 !! end
6799
6800 ## Edge case fix to prevent future regressions
6801 !! test
6802 T107652: <ref>s in templates that also generate table cell attributes should be rendered properly
6803 !! wikitext
6804 {|
6805 |{{table_attribs_7}}
6806 |}
6807 <references />
6808 !! html/parsoid
6809 <table>
6810 <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>
6811 </tbody></table>
6812 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><a href="./Main_Page#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text" data-parsoid="{}">foo</span></li></ol>
6813 !! end
6814
6815 !! test
6816 Table with row followed by newlines and table heading
6817 !! options
6818 parsoid=wt2html,html2html
6819 !! wikitext
6820 {|
6821 |-
6822
6823 ! foo
6824 |}
6825 !! html/*
6826 <table>
6827
6828
6829 <tr>
6830 <th> foo
6831 </th></tr></table>
6832
6833 !! end
6834
6835 !! test
6836 Table with empty line following the start tag
6837 !! options
6838 parsoid=wt2html,html2html
6839 !! wikitext
6840 {|
6841
6842 |-
6843 | foo
6844 |}
6845 !! html/*
6846 <table>
6847
6848
6849 <tr>
6850 <td> foo
6851 </td></tr></table>
6852
6853 !! end
6854
6855 !! test
6856 Table attributes with empty value
6857 !! options
6858 parsoid=wt2html,html2html
6859 !! wikitext
6860 {|
6861 | style=| hello
6862 |}
6863 !! html/php
6864 <table>
6865 <tr>
6866 <td style=""> hello
6867 </td></tr></table>
6868
6869 !! html/parsoid
6870 <table>
6871 <tbody><tr><td style=""> hello</td></tr>
6872 </tbody></table>
6873 !! end
6874
6875 !! test
6876 Wikitext table with a lot of comments
6877 !! wikitext
6878 {|
6879 <!-- c0 -->
6880 | foo
6881 <!-- c1 -->
6882 |-<!-- c2 -->
6883 <!-- c3 -->
6884 |<!-- c4 -->
6885 <!-- c5 -->
6886 |}
6887 !! html
6888 <table>
6889 <tr>
6890 <td> foo
6891 </td></tr>
6892 <tr>
6893 <td>
6894 </td></tr></table>
6895
6896 !! end
6897
6898 !! test
6899 Wikitext table comments represented in parsoid dom
6900 !! wikitext
6901 {|<!--c1--><!--c2-->
6902 |-<!--c3-->
6903 | x
6904 |}
6905 !! html/php+tidy
6906 <table>
6907 <tr>
6908 <td>x</td>
6909 </tr>
6910 </table>
6911 !! html/parsoid
6912 <table><!--c1--><!--c2-->
6913 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'><!--c3-->
6914 <td data-parsoid='{"autoInsertedEnd":true}'> x</td></tr>
6915 </tbody></table>
6916 !! end
6917
6918 !! test
6919 Wikitext table with double-line table cell
6920 !! wikitext
6921 {|
6922 |a
6923 b
6924 |}
6925 !! html
6926 <table>
6927 <tr>
6928 <td>a
6929 <p>b
6930 </p>
6931 </td></tr></table>
6932
6933 !! end
6934
6935 !! test
6936 Table cell with a single comment
6937 !! wikitext
6938 {|
6939 | <!-- c1 -->
6940 | a
6941 |}
6942 !! html
6943 <table>
6944 <tr>
6945 <td>
6946 </td>
6947 <td> a
6948 </td></tr></table>
6949
6950 !! end
6951
6952 !! test
6953 Table-cell after a comment-only-empty-line
6954 !! wikitext
6955 {|
6956 |a
6957 <!--c1-->
6958 <!--c2-->| b
6959 |}
6960 !! html
6961 <table>
6962 <tr>
6963 <td>a
6964 </td>
6965 <td> b
6966 </td></tr></table>
6967
6968 !! html/parsoid
6969 <table>
6970 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>a</td>
6971 <!--c1-->
6972 <!--c2--><td data-parsoid='{"autoInsertedEnd":true}'> b</td></tr>
6973 </tbody></table>
6974
6975 !! end
6976
6977 !! test
6978 Build table with {{!}}
6979 !! wikitext
6980 {{{!}} class="wikitable"
6981 ! header
6982 ! second header
6983 {{!}}- style="color:red;"
6984 {{!}} data {{!}}{{!}} style="color:red;" {{!}} second data
6985 {{!}}}
6986 !! html
6987 <table class="wikitable">
6988 <tr>
6989 <th> header
6990 </th>
6991 <th> second header
6992 </th></tr>
6993 <tr style="color:red;">
6994 <td> data </td>
6995 <td style="color:red;"> second data
6996 </td></tr></table>
6997
6998 !! end
6999
7000 !! test
7001 Build table with pipe as data
7002 !! wikitext
7003 {| class="wikitable"
7004 ! header
7005 ! second header
7006 |- style="color:red;"
7007 | data || style="color:red;" | second data
7008 |-
7009 | style="color:red;" | data with | || style="color:red;" | second data with |
7010 |-
7011 || data with | ||| second data with |
7012 |}
7013 !! html
7014 <table class="wikitable">
7015 <tr>
7016 <th> header
7017 </th>
7018 <th> second header
7019 </th></tr>
7020 <tr style="color:red;">
7021 <td> data </td>
7022 <td style="color:red;"> second data
7023 </td></tr>
7024 <tr>
7025 <td style="color:red;"> data with | </td>
7026 <td style="color:red;"> second data with |
7027 </td></tr>
7028 <tr>
7029 <td> data with | </td>
7030 <td> second data with |
7031 </td></tr></table>
7032
7033 !! end
7034
7035 !! test
7036 Build table with wikilink
7037 !! wikitext
7038 {| class="wikitable"
7039 ! header || second header
7040 |- style="color:red;"
7041 | data [[Main Page|linktext]] || second data [[Main Page|linktext]]
7042 |-
7043 | data || second data [[Main Page|link|text with pipe]]
7044 |}
7045 !! html
7046 <table class="wikitable">
7047 <tr>
7048 <th> header </th>
7049 <th> second header
7050 </th></tr>
7051 <tr style="color:red;">
7052 <td> data <a href="/wiki/Main_Page" title="Main Page">linktext</a> </td>
7053 <td> second data <a href="/wiki/Main_Page" title="Main Page">linktext</a>
7054 </td></tr>
7055 <tr>
7056 <td> data </td>
7057 <td> second data <a href="/wiki/Main_Page" title="Main Page">link|text with pipe</a>
7058 </td></tr></table>
7059
7060 !! end
7061
7062 # The expected HTML structure in this test is debatable. The PHP parser does
7063 # not parse this kind of table at all. The main focus for Parsoid is on
7064 # round-tripping, so this output is ok for now. TODO: revisit!
7065 !! test
7066 Wikitext table with html-syntax row
7067 !! wikitext
7068 {|
7069 |-
7070 <td>foo</td>
7071 |}
7072 !! html/parsoid
7073 <table>
7074 <tbody>
7075 <tr>
7076 <td>foo</td></tr></tbody></table>
7077 !! end
7078
7079 !! test
7080 Implicit <td> after a |-
7081 !! options
7082 parsoid=wt2html,html2html
7083 !! wikitext
7084 {|
7085 |-
7086 a
7087 |}
7088 !! html/php
7089 <table>
7090
7091 a
7092 </table>
7093
7094 !! html/php+tidy
7095 <p>a</p>
7096 !! html/parsoid
7097 <p data-parsoid='{"fostered":true,"autoInsertedEnd":true}'>a</p><table>
7098 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
7099
7100 </tr></tbody></table>
7101 !! end
7102
7103 !! test
7104 Lists should be recognized in an implicit <td> context
7105 !! options
7106 parsoid=wt2html,html2html
7107 !! wikitext
7108 {|
7109 |-
7110 *a
7111 |}
7112 !! html/php
7113 <table>
7114
7115 <ul><li>a</li></ul>
7116 </table>
7117
7118 !! html/php+tidy
7119 <ul>
7120 <li>a</li>
7121 </ul>
7122 !! html/parsoid
7123 <ul data-parsoid='{"fostered":true,"autoInsertedEnd":true}'><li>a</li></ul><table>
7124 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
7125
7126 </tr></tbody></table>
7127 !! end
7128
7129 !! test
7130 Table cells not properly parsed in an implicit-td context
7131 !! wikitext
7132 {|
7133 |-
7134 {{table_attribs_4}} || a || b
7135 |}
7136 !! html/php+tidy
7137 <table>
7138 <tr>
7139 <td style="background-color:#DC241f;" width="10px"></td>
7140 <td>a</td>
7141 <td>b</td>
7142 </tr>
7143 </table>
7144 !! html/parsoid
7145 <table>
7146 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
7147 <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>
7148 !! end
7149
7150 !! test
7151 Parsoid: Round-trip tables directly followed by content (T53219)
7152 !! options
7153 parsoid=wt2html,wt2wt
7154 !! wikitext
7155 {|
7156 |foo
7157 |} bar
7158
7159 {|
7160 |baz
7161 |}<b>quux</b>
7162 !! html+tidy
7163 <table>
7164 <tr>
7165 <td>foo</td>
7166 </tr>
7167 </table>
7168 <p>bar</p>
7169 <table>
7170 <tr>
7171 <td>baz</td>
7172 </tr>
7173 </table>
7174 <p><b>quux</b></p>
7175 !! end
7176
7177 !! test
7178 Parsoid: Default to a newline after tables in new content (T53219)
7179 !! options
7180 parsoid=html2wt
7181 !! html/parsoid
7182 <table><tbody>
7183 <tr><td>foo</td></tr></tbody></table> bar
7184 <table><tbody>
7185 <tr><td>baz</td></tr></tbody></table><b>quux</b>
7186 !! wikitext
7187 {|
7188 |foo
7189 |}
7190 <nowiki> </nowiki>bar
7191 {|
7192 |baz
7193 |}
7194 '''quux'''
7195 !! end
7196
7197 !! test
7198 Parsoid: newline inducing block nodes don't suppress <nowiki>
7199 !! options
7200 parsoid=html2wt
7201 !! html/parsoid
7202 a<h1>foo</h1>
7203 !! wikitext
7204 <nowiki> </nowiki>a
7205
7206 = foo =
7207 !! end
7208
7209 !! test
7210 Parsoid: Row-syntax table headings followed by comment & table cells
7211 !! options
7212 parsoid=wt2html,wt2wt
7213 !! wikitext
7214 {|
7215 ! foo || bar
7216 <!-- foo --> || baz || quux
7217 |}
7218 !! html/php
7219 <table>
7220 <tr>
7221 <th> foo </th>
7222 <th> bar
7223 </th>
7224 <td> baz </td>
7225 <td> quux
7226 </td></tr></table>
7227
7228 !! html/parsoid
7229 <table>
7230 <tbody><tr><th> foo </th><th> bar
7231 <!-- foo --> </th><td> baz </td><td> quux</td></tr>
7232 </tbody></table>
7233 !! end
7234
7235 !!test
7236 Parsoid: Recover better from broken table attributes
7237 !!options
7238 parsoid=wt2html
7239 !!wikitext
7240 {| class="foo
7241 | class="bar" |
7242 foo
7243 |}
7244 !!html/php+tidy
7245 <table class="foo">
7246 <tr>
7247 <td class="bar">
7248 <p>foo</p>
7249 </td>
7250 </tr>
7251 </table>
7252 !!html/parsoid
7253 <table class="foo">
7254 <tr>
7255 <td class="bar">
7256 <p>foo</p></td></tr>
7257 </tbody></table>
7258 !!end
7259
7260 !! test
7261 Tables: Digest broken attributes on table and tr tag
7262 !! options
7263 parsoid=wt2html
7264 !! wikitext
7265 {| || |} ++
7266 |- || || ++ --
7267 |- > [
7268 |}
7269 !! html
7270 <table>
7271 <tbody>
7272 <tr></tr>
7273 <tr></tr>
7274 </tbody></table>
7275 !! end
7276
7277 # T137406: Whitespace in the HTML
7278 !! test
7279 1. Generate correct wikitext for tables with thead/tbody/tfoot
7280 !! options
7281 parsoid=html2wt
7282 !! html/parsoid
7283 <table>
7284 <caption>Test</caption>
7285 <thead>
7286 <tr>
7287 <th>Month</th>
7288 <th>Savings</th>
7289 </tr>
7290 </thead>
7291 <tbody>
7292 <tr>
7293 <td>January</td>
7294 <td>$100</td>
7295 </tr>
7296 <tr>
7297 <td>February</td>
7298 <td>$80</td>
7299 </tr>
7300 </tbody>
7301 <tfoot>
7302 <tr>
7303 <td>Sum</td>
7304 <td>$180</td>
7305 </tr>
7306 </tfoot>
7307 </table>
7308 !! wikitext
7309 {|
7310 |+Test
7311 !Month
7312 !Savings
7313 |-
7314 |January
7315 |$100
7316 |-
7317 |February
7318 |$80
7319 |-
7320 |Sum
7321 |$180
7322 |}
7323 !! html/php+tidy
7324 <table>
7325 <caption>Test</caption>
7326 <tr>
7327 <th>Month</th>
7328 <th>Savings</th>
7329 </tr>
7330 <tr>
7331 <td>January</td>
7332 <td>$100</td>
7333 </tr>
7334 <tr>
7335 <td>February</td>
7336 <td>$80</td>
7337 </tr>
7338 <tr>
7339 <td>Sum</td>
7340 <td>$180</td>
7341 </tr>
7342 </table>
7343 !! end
7344
7345 # T137406: No whitespace in the HTML
7346 !! test
7347 2. Generate correct wikitext for tables with thead/tbody/tfoot
7348 !! options
7349 parsoid=html2wt
7350 !! html/parsoid
7351 <table><thead><tr><th>heading</th></tr></thead><tbody><tr><td>foo</td></tr></tbody></table>
7352 !! wikitext
7353 {|
7354 !heading
7355 |-
7356 |foo
7357 |}
7358 !! end
7359
7360 !! test
7361 Testing serialization after deletion in references
7362 !! options
7363 parsoid={
7364 "modes": ["wt2wt"],
7365 "changes": [
7366 ["#x", "remove"]
7367 ]
7368 }
7369 !! wikitext
7370 hi <ref><div id="x">ho</div></ref>
7371
7372 <references />
7373 !! wikitext/edited
7374 hi <ref></ref>
7375
7376 <references />
7377 !! end
7378
7379 !!test
7380 Testing serialization after deletion of table cells
7381 !!options
7382 parsoid={
7383 "modes": ["wt2wt", "selser"],
7384 "changes": [
7385 ["#x", "remove"]
7386 ]
7387 }
7388 !!wikitext
7389 {|
7390 !h1 !!h2 !!h3
7391 | id="x" |c1 {{!}}{{!}}{{!}}c2 |||c3
7392 |}
7393 !! wikitext/edited
7394 {|
7395 !h1 !!h2 !!h3
7396 |c2 |||c3
7397 |}
7398 !!end
7399
7400 !! test
7401 Testing selser after addition of new row before first row (T125419)
7402 !! options
7403 parsoid={
7404 "modes": ["wt2wt", "selser"],
7405 "changes": [
7406 [ "tr", "before", "<tr><td>X</td></tr>" ]
7407 ]
7408 }
7409 !! wikitext
7410 {|
7411 |a
7412 |}
7413 !! wikitext/edited
7414 {|
7415 |X
7416 |-
7417 |a
7418 |}
7419 !! end
7420
7421 !! test
7422 Serialize new table rows in a HTML table using HTML tags
7423 !! options
7424 parsoid={
7425 "modes": ["wt2wt", "selser"],
7426 "changes": [
7427 [ "tr", "before", "<tr><td>X</td></tr>" ]
7428 ]
7429 }
7430 !! wikitext
7431 <table><tr><td>a</td></tr></table>
7432 !! wikitext/edited
7433 <table><tr><td>X</td></tr><tr><td>a</td></tr></table>
7434 !! end
7435
7436 !! test
7437 Serialize new table cells in a HTML row using HTML tags
7438 !! options
7439 parsoid={
7440 "modes": ["wt2wt", "selser"],
7441 "changes": [
7442 [ "td", "before", "<td>X</td>" ]
7443 ]
7444 }
7445 !! wikitext
7446 <table><tr><td>a</td></tr></table>
7447 !! wikitext/edited
7448 <table><tr><td>X</td><td>a</td></tr></table>
7449 !! end
7450
7451 !! test
7452 Wikitext tables can be nested inside HTML tables
7453 !! options
7454 parsoid=html2wt
7455 !! html
7456 <table data-parsoid='{"stx":"html"}'>
7457 <tr><td>
7458 <table>
7459 <tr><td>foo</td></tr>
7460 </table>
7461 </td></tr>
7462 </table>
7463 !! wikitext
7464 <table>
7465 <tr><td>
7466 {|
7467 |foo
7468 |}
7469 </td></tr>
7470 </table>
7471 !! end
7472
7473 !! test
7474 Serialize wikitext list items as HTML list items when embedded in a HTML list
7475 !! options
7476 parsoid=html2wt
7477 !! html
7478 <ul data-parsoid='{"stx": "html"}'>
7479 <li data-parsoid='{}'>a</li>
7480 <li>b</li>
7481 </ul>
7482 !! wikitext
7483 <ul>
7484 <li>a</li>
7485 <li>b</li>
7486 </ul>
7487 !! end
7488
7489 # SSS FIXME: Is this actually a good thing given the
7490 # odd nested list output that is generated by MW?
7491 # <ul><li>foo<ul>..</ul></li></ul> instead of
7492 # <ul><li>foo</li><ul>..</ul></ul>
7493 !! test
7494 Wikitext lists can be nested inside HTML lists
7495 !! options
7496 parsoid=html2wt
7497 !! html
7498 <ul data-parsoid='{"stx": "html"}'>
7499 <li data-parsoid='{"stx": "html"}'>a
7500 <ul><li>b</li></ul>
7501 </li>
7502 </ul>
7503
7504 <ul data-parsoid='{"stx": "html"}'>
7505 <li>x
7506 <ul><li>y</li></ul>
7507 </li>
7508 </ul>
7509 !! wikitext
7510 <ul>
7511 <li>a
7512 * b
7513 </li>
7514 </ul>
7515
7516 <ul>
7517 <li>x
7518 * y
7519 </li>
7520 </ul>
7521 !! end
7522
7523 ###
7524 ### Internal links
7525 ###
7526 !! test
7527 Plain link, capitalized
7528 !! wikitext
7529 [[Main Page]]
7530 !! html
7531 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
7532 </p>
7533 !! end
7534
7535 !! test
7536 Plain link, uncapitalized
7537 !! wikitext
7538 [[main Page]]
7539 !! html
7540 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
7541 </p>
7542 !! end
7543
7544 !! test
7545 Piped link
7546 !! wikitext
7547 [[Main Page|The Main Page]]
7548 !! html
7549 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
7550 </p>
7551 !! end
7552
7553 !! test
7554 Piped link with comment in link text
7555 !! wikitext
7556 [[Main Page|The Main<!--front--> Page]]
7557 !! html
7558 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
7559 </p>
7560 !! end
7561
7562 !! test
7563 Piped link with multiple pipe characters in link text
7564 !! wikitext
7565 [[Main Page||The|Main|Page|]]
7566 !! html/php
7567 <p><a href="/wiki/Main_Page" title="Main Page">|The|Main|Page|</a>
7568 </p>
7569 !! html/parsoid
7570 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">|The|Main|Page|</a></p>
7571 !! end
7572
7573 !! test
7574 Piped link with no link text
7575 !! wikitext
7576 [[Thomas Bek (bishop of St David's)|]]
7577 !! html/php
7578 <p>[[Thomas Bek (bishop of St David's)|]]
7579 </p>
7580 !! html/parsoid
7581 <p>[[Thomas Bek (bishop of St David's)|]]</p>
7582 !! end
7583
7584 !! test
7585 Piped link with empty link text
7586 !! wikitext
7587 [[Main Page|<nowiki/>]] - empty nowiki
7588 [[Main Page| ]] - empty space
7589 [[Main Page|&nbsp;]] - empty non breaking space
7590 !! html/php
7591 <p><a href="/wiki/Main_Page" title="Main Page"></a> - empty nowiki
7592 <a href="/wiki/Main_Page" title="Main Page"> </a> - empty space
7593 <a href="/wiki/Main_Page" title="Main Page">&#160;</a> - empty non breaking space
7594 </p>
7595 !! html/parsoid
7596 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page"><span typeof="mw:Nowiki"></span></a> - empty nowiki
7597 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page"> </a> - empty space
7598 <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>
7599 !! end
7600
7601 !! test
7602 Broken link
7603 !! wikitext
7604 [[Zigzagzogzagzig]]
7605 !! html
7606 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
7607 </p>
7608 !! end
7609
7610 !! test
7611 Broken link with fragment
7612 !! wikitext
7613 [[Zigzagzogzagzig#zug]]
7614 !! html
7615 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
7616 </p>
7617 !! end
7618
7619 !! test
7620 Special page link with fragment
7621 !! wikitext
7622 [[Special:Version#anchor]]
7623 !! html
7624 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
7625 </p>
7626 !! end
7627
7628 !! test
7629 Nonexistent special page link with fragment
7630 !! wikitext
7631 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
7632 !! html
7633 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
7634 </p>
7635 !! end
7636
7637 !! test
7638 Link with prefix
7639 !! wikitext
7640 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
7641 !! html
7642 <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>
7643 </p>
7644 !! end
7645
7646 !! test
7647 Link with suffix
7648 !! wikitext
7649 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
7650 !! html
7651 <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>!!!
7652 </p>
7653 !! end
7654
7655 !! article
7656 prefixed article
7657 !! text
7658 Some text
7659 !! endarticle
7660
7661 !! test
7662 T45661: Piped links with identical prefixes
7663 !! wikitext
7664 [[prefixed article|prefixed articles with spaces]]
7665
7666 [[prefixed article|prefixed articlesaoeu]]
7667
7668 [[Main Page|Main Page test]]
7669 !! html
7670 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
7671 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
7672 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
7673 </p>
7674 !! end
7675
7676
7677 !! test
7678 Link with HTML entity in suffix / tail
7679 !! wikitext
7680 [[Main Page]]&quot;, [[Main Page]]&#97;
7681 !! html/php
7682 <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;
7683 </p>
7684 !! html/parsoid
7685 <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>
7686 !! end
7687
7688 !! test
7689 Link with 3 brackets
7690 !! wikitext
7691 [[[Main Page]]]
7692 Foo [[[Main Page]]]
7693 !! html
7694 <p>[[[Main Page]]]
7695 Foo [[[Main Page]]]
7696 </p>
7697 !! end
7698
7699 !! test
7700 Link with 4 brackets
7701 !! wikitext
7702 [[[[Main Page]]]]
7703 !! html
7704 <p>[[<a href="/wiki/Main_Page" title="Main Page">Main Page</a>]]
7705 </p>
7706 !! end
7707
7708 !! test
7709 Piped link with 3 brackets
7710 !! wikitext
7711 [[[main page|the main page]]]
7712 !! html
7713 <p>[[[main page|the main page]]]
7714 </p>
7715 !! end
7716
7717 !! test
7718 Piped link with extlink-like text
7719 !! wikitext
7720 [[Main Page|[bar]]]
7721 [[Main Page|This is a [bar]]]
7722 !! html/php
7723 <p><a href="/wiki/Main_Page" title="Main Page">[bar]</a>
7724 <a href="/wiki/Main_Page" title="Main Page">This is a [bar]</a>
7725 </p>
7726 !! html/parsoid
7727 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>[bar]</a>
7728 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>This is a [bar]</a></p>
7729 !! end
7730
7731 !! test
7732 Link with multiple pipes
7733 !! wikitext
7734 [[Main Page|The|Main|Page]]
7735 !! html
7736 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
7737 </p>
7738 !! end
7739
7740 !! test
7741 Anchor containing a #. (T65430)
7742 !! wikitext
7743 [[Main Page#And#Link]]
7744 !! html/php
7745 <p><a href="/wiki/Main_Page#And.23Link" title="Main Page">Main Page#And#Link</a>
7746 </p>
7747 !! html/parsoid
7748 <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>
7749 !! end
7750
7751 !! test
7752 Link to namespaces
7753 !! wikitext
7754 [[Talk:Parser testing]], [[Meta:Disclaimers]]
7755 !! html
7756 <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>
7757 </p>
7758 !! end
7759
7760 !! test
7761 Link with space in namespace
7762 !! wikitext
7763 [[User talk:Foo bar]]
7764 !! html
7765 <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>
7766 </p>
7767 !! end
7768
7769 !! article
7770 MemoryAlpha:AlphaTest
7771 !! text
7772 This is an article in the MemoryAlpha namespace
7773 (which shadows the memoryalpha interwiki link).
7774 !! endarticle
7775
7776 !! test
7777 Namespace takes precedence over interwiki link (T53680)
7778 !! wikitext
7779 [[MemoryAlpha:AlphaTest]]
7780 !! html
7781 <p><a href="/wiki/MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
7782 </p>
7783 !! end
7784
7785 # The previous test doesn't work correctly in html2*, due to not recognizing the
7786 # link as an internal one. This one checks for the correct behavior.
7787 !! test
7788 Link to namespace preferred over interwiki with correct rel attribute
7789 !! options
7790 parsoid=html2wt,html2html
7791 !! html/parsoid
7792 <p><a rel="mw:WikiLink" href="./MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a></p>
7793 !! wikitext
7794 [[MemoryAlpha:AlphaTest]]
7795 !! end
7796
7797 !! test
7798 Piped link to namespace
7799 !! wikitext
7800 [[Meta:Disclaimers|The disclaimers]]
7801 !! html
7802 <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>
7803 </p>
7804 !! end
7805
7806 !! test
7807 Link containing }
7808 !! wikitext
7809 [[Usually caused by a typo (oops}]]
7810 !! html
7811 <p>[[Usually caused by a typo (oops}]]
7812 </p>
7813 !! end
7814
7815 !! article
7816 7% Solution
7817 !! text
7818 Just a test of an article title containing a percent.
7819 !! endarticle
7820
7821 !! test
7822 Link containing % (not as a hex sequence)
7823 !! wikitext
7824 [[7% Solution]]
7825 [[7% Solution|7%25 Solution]]
7826 !! html/php
7827 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
7828 <a href="/wiki/7%25_Solution" title="7% Solution">7%25 Solution</a>
7829 </p>
7830 !! html/parsoid
7831 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a>
7832 <a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7%25 Solution</a></p>
7833 !! end
7834
7835 # note that the parsoid HTML is identical to the previous test output,
7836 # so the previous test ensures that the html2wt mode will generate the
7837 # "not as a hex sequence" wikitext.
7838 !! test
7839 Link containing % as a single hex sequence interpreted to char
7840 !! options
7841 parsoid=wt2wt,wt2html,html2html
7842 !! wikitext
7843 [[7%25 Solution]]
7844 [[7%25 Solution|7%25 Solution]]
7845 !! html/php
7846 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
7847 <a href="/wiki/7%25_Solution" title="7% Solution">7%25 Solution</a>
7848 </p>
7849 !! html/parsoid
7850 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a>
7851 <a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7%25 Solution</a></p>
7852 !!end
7853
7854 !! test
7855 Link containing % as a double hex sequence interpreted to hex sequence
7856 !! wikitext
7857 [[7%2525 Solution]]
7858 !! html
7859 <p>[[7%2525 Solution]]
7860 </p>
7861 !!end
7862
7863 ## Example for such a section: == < ==
7864 !! test
7865 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
7866 !! wikitext
7867 [[%23%3c]][[%23%3e]]
7868 !! html/php
7869 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
7870 </p>
7871 !! html/parsoid
7872 <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>
7873 !! end
7874
7875 !! test
7876 Link containing "<#" and ">#" as a hex sequences
7877 !! wikitext
7878 [[%3c%23]][[%3e%23]]
7879 !! html
7880 <p>[[%3c%23]][[%3e%23]]
7881 </p>
7882 !! end
7883
7884 !! test
7885 Link containing an equals sign
7886 !! wikitext
7887 [[Special:BookSources/isbn=4-00-026157-6]]
7888 !! html/php
7889 <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>
7890 </p>
7891 !! html/parsoid
7892 <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>
7893 !! end
7894
7895 !! article
7896 Foo~bar
7897 !! text
7898 Just a test of an article title containing a tilde.
7899 !! endarticle
7900
7901 # note that links containing signatures, like [[Foo~~~~]], are
7902 # massaged by the pre-save transform (PST) and so the tildes are never
7903 # seen by the parser.
7904 !! test
7905 Link containing a tilde
7906 !! wikitext
7907 [[Foo~bar]]
7908 !! html/php
7909 <p><a href="/wiki/Foo~bar" title="Foo~bar">Foo~bar</a>
7910 </p>
7911 !! html/parsoid
7912 <p><a rel="mw:WikiLink" href="./Foo~bar" title="Foo~bar">Foo~bar</a></p>
7913 !! end
7914
7915 !! test
7916 Link containing double-single-quotes '' (T6598)
7917 !! wikitext
7918 [[Lista d''e paise d''o munno]]
7919 !! html/php
7920 <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>
7921 </p>
7922 !! html/parsoid
7923 <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>
7924 !! end
7925
7926 !! test
7927 Link containing double quotes and spaces
7928 !! wikitext
7929 [[Cool "Gator"]]
7930 !! html/php
7931 <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>
7932 </p>
7933 !! html/parsoid
7934 <p><a rel="mw:WikiLink" href="./Cool_%22Gator%22" title='Cool "Gator"'>Cool "Gator"</a></p>
7935 !! end
7936
7937 !! test
7938 File containing double quotes and spaces
7939 !! wikitext
7940 [[File:Cool "Gator".png]]
7941 !! html/parsoid
7942 <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>
7943 !! end
7944
7945 !! test
7946 Redirect containing double quotes and spaces
7947 !! wikitext
7948 #REDIRECT [[Cool "Gator"]]
7949 !! html/parsoid
7950 <link rel="mw:PageProp/redirect" href="./Cool_%22Gator%22" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Cool_%22Gator%22"},"sa":{"href":"Cool \"Gator\""}}'/>
7951 !! end
7952
7953 !! test
7954 Link containing double-single-quotes '' in text (T6598 sanity check)
7955 !! wikitext
7956 Some [[Link|pretty ''italics'' and stuff]]!
7957 !! html/php
7958 <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>!
7959 </p>
7960 !! html/parsoid
7961 <p>Some <a rel="mw:WikiLink" href="./Link" title="Link">pretty <i>italics</i> and stuff</a>!</p>
7962 !! end
7963
7964 !! test
7965 Link containing double-single-quotes '' in text embedded in italics (T6598 sanity check)
7966 !! wikitext
7967 ''Some [[Link|pretty ''italics'' and stuff]]!''
7968 !! html
7969 <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>
7970 </p>
7971 !! end
7972
7973 !! test
7974 Link with double quotes in title part (literal) and alternate part (interpreted)
7975 !! wikitext
7976 [[File:Denys_Savchenko_''Pentecoste''.jpg]]
7977
7978 [[''Pentecoste'']]
7979
7980 [[''Pentecoste''|Pentecoste]]
7981
7982 [[''Pentecoste''|''Pentecoste'']]
7983 !! html/php
7984 <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>
7985 </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>
7986 </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>
7987 </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>
7988 </p>
7989 !! html/parsoid
7990 <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>
7991 <p><a rel="mw:WikiLink" href="./''Pentecoste''" title="''Pentecoste''">''Pentecoste''</a></p>
7992 <p><a rel="mw:WikiLink" href="./''Pentecoste''" title="''Pentecoste''">Pentecoste</a></p>
7993 <p><a rel="mw:WikiLink" href="./''Pentecoste''" title="''Pentecoste''"><i>Pentecoste</i></a></p>
7994 !! end
7995
7996 !! test
7997 Broken image links with HTML captions (T41700)
7998 !! wikitext
7999 [[File:Nonexistent|<script></script>]]
8000 [[File:Nonexistent|100x100px|<script></script>]]
8001 [[File:Nonexistent|&lt;]]
8002 [[File:Nonexistent|a<i>b</i>c]]
8003 !! html/php
8004 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
8005 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
8006 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
8007 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
8008 </p>
8009 !! html/parsoid
8010 <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>
8011 <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>
8012 <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>
8013 <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>
8014 !! end
8015
8016 !! test
8017 Plain link to URL
8018 !! wikitext
8019 [[http://www.example.com]]
8020 !! html/php
8021 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
8022 </p>
8023 !! html/parsoid
8024 <p>[<a rel="mw:ExtLink" href="http://www.example.com"></a>]</p>
8025 !! end
8026
8027 !! test
8028 Plain link to URL with link text
8029 !! wikitext
8030 [[http://www.example.com Link text]]
8031 !! html
8032 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
8033 </p>
8034 !! end
8035
8036 !! test
8037 Plain link to protocol-relative URL
8038 !! wikitext
8039 [[//www.example.com]]
8040 !! html/php
8041 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
8042 </p>
8043 !! html/parsoid
8044 <p>[<a rel="mw:ExtLink" href="//www.example.com"></a>]</p>
8045 !! end
8046
8047 !! test
8048 Plain link to protocol-relative URL with link text
8049 !! wikitext
8050 [[//www.example.com Link text]]
8051 !! html
8052 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
8053 </p>
8054 !! end
8055
8056 !! test
8057 Plain link to page with question mark in title
8058 !! wikitext
8059 [[A?b]]
8060
8061 [[A?b|Baz]]
8062 !! html
8063 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
8064 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
8065 </p>
8066 !! end
8067
8068
8069 # I'm fairly sure the expected result here is wrong.
8070 # We want these to be URL links, not pseudo-pages with URLs for titles....
8071 # However the current output is also pretty screwy.
8072 #
8073 # ----
8074 # I'm changing it to match the current output--it arguably makes more
8075 # sense in the light of the test above. Old expected result was:
8076 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
8077 #</p>
8078 # But I think this test is bordering on "garbage in, garbage out" anyway.
8079 # -- wtm
8080 !! test
8081 Piped link to URL
8082 !! wikitext
8083 Piped link to URL: [[http://www.example.com|an example URL]]
8084 !! html/php
8085 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
8086 </p>
8087 !! html/parsoid
8088 <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>
8089 !! end
8090
8091 !! test
8092 T2002: [[page|http://url/]] should link to page, not http://url/
8093 !! wikitext
8094 [[Main Page|http://url/]]
8095 !! html/php
8096 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
8097 </p>
8098 !! html/parsoid
8099 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">http://url/</a></p>
8100 !! end
8101
8102 # Parsoid does not mark self-links, by design.
8103 !! test
8104 T2337: Escaped self-links should be bold
8105 !! options
8106 title=[[Bug462]]
8107 !! wikitext
8108 [[Bu&#103;462]] [[Bug462]]
8109 !! html/php
8110 <p><a class="mw-selflink selflink">Bu&#103;462</a> <a class="mw-selflink selflink">Bug462</a>
8111 </p>
8112 !! html/php+tidy
8113 <p><a class="mw-selflink selflink">Bug462</a> <a class="mw-selflink selflink">Bug462</a></p>
8114 !! html/parsoid
8115 <p><a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a> <a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a></p>
8116 !! end
8117
8118 !! test
8119 Self-link to section should not be bold
8120 !! options
8121 title=[[Main Page]]
8122 !! wikitext
8123 [[Main Page#section]]
8124 !! html
8125 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
8126 </p>
8127 !! end
8128
8129 !! article
8130 00
8131 !! text
8132 This is 00.
8133 !! endarticle
8134
8135 !!test
8136 Self-link to numeric title
8137 !!options
8138 title=[[0]]
8139 !! wikitext
8140 [[0]]
8141 !! html
8142 <p><a class="mw-selflink selflink">0</a>
8143 </p>
8144 !!end
8145
8146 !!test
8147 Link to numeric-equivalent title
8148 !!options
8149 title=[[0]]
8150 !! wikitext
8151 [[00]]
8152 !! html
8153 <p><a href="/wiki/00" title="00">00</a>
8154 </p>
8155 !!end
8156
8157 !! test
8158 <nowiki> inside a link
8159 !! wikitext
8160 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
8161 !! html
8162 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
8163 </p>
8164 !! end
8165
8166 !! test
8167 Non-breaking spaces in title
8168 !! wikitext
8169 [[&nbsp; Main &nbsp; Page &nbsp;]]
8170 !! html
8171 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
8172 </p>
8173 !!end
8174
8175 !! test
8176 Internal link with ca linktrail, surrounded by bold apostrophes (T29473 primary issue)
8177 !! options
8178 language=ca
8179 !! wikitext
8180 '''[[Main Page]]'''
8181 !! html
8182 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
8183 </p>
8184 !! end
8185
8186 !! test
8187 Internal link with ca linktrail, surrounded by italic apostrophes (T29473 primary issue)
8188 !! options
8189 language=ca
8190 !! wikitext
8191 ''[[Main Page]]''
8192 !! html
8193 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
8194 </p>
8195 !! end
8196
8197 !! test
8198 Internal link with en linktrail: no apostrophes (T29473)
8199 !! options
8200 language=en
8201 !! wikitext
8202 [[Something]]'nice
8203 !! html
8204 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
8205 </p>
8206 !! end
8207
8208 !! test
8209 Internal link with ca linktrail with apostrophes (T29473)
8210 !! options
8211 language=ca
8212 !! wikitext
8213 [[Something]]'nice
8214 !! html
8215 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
8216 </p>
8217 !! end
8218
8219 !! test
8220 Internal link with kaa linktrail with apostrophes (T29473)
8221 !! options
8222 language=kaa
8223 !! wikitext
8224 [[Something]]'nice
8225 !! html
8226 <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>
8227 </p>
8228 !! end
8229
8230 !! test
8231 Link with multiple ":" in a subpage-supporting namespace (T65636)
8232 !! wikitext
8233 [[User:Foo/Test/63636:Bar|Test]]
8234 !! html/php
8235 <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>
8236 </p>
8237 !! html/parsoid
8238 <p><a rel="mw:WikiLink" href="./User:Foo/Test/63636:Bar" title="User:Foo/Test/63636:Bar">Test</a></p>
8239 !! end
8240
8241 ## Mainly a sanity check for Parsoid
8242 !! test
8243 Handle title parsing for subpages
8244 !! options
8245 title=[[/123123]]
8246 subpage
8247 !! wikitext
8248 123
8249 !! html/php
8250 <p>123
8251 </p>
8252 !! html/parsoid
8253 <p>123</p>
8254 !! end
8255
8256 !! article
8257 User:Test/123
8258 !! text
8259 test 123
8260 !! endarticle
8261
8262 !! test
8263 Link to a subpage from a namespace other than main
8264 !! options
8265 title=[[User:Test]]
8266 subpage
8267 !! wikitext
8268 [[/123]]
8269 !! html/php
8270 <p><a href="/wiki/User:Test/123" title="User:Test/123">/123</a>
8271 </p>
8272 !! html/parsoid
8273 <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>
8274 !! end
8275
8276 !! test
8277 Ensure that transclusion titles are not url-decoded
8278 !! options
8279 subpage title=[[Test]]
8280 parsoid=wt2html
8281 !! wikitext
8282 {{Bar%C3%A9}} {{/Bar%C3%A9}}
8283 !! html/php
8284 <p>{{Bar%C3%A9}} {{/Bar%C3%A9}}
8285 </p>
8286 !! html/parsoid
8287 <p>{{Bar%C3%A9}} {{/Bar%C3%A9}}</p>
8288 !! end
8289
8290 !! test
8291 Purely hash wikilink
8292 !! options
8293 title=[[User:Test/123]]
8294 subpage
8295 !! wikitext
8296 [[#a|b]]
8297 !! html/php
8298 <p><a href="#a">b</a>
8299 </p>
8300 !! html/parsoid
8301 <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>
8302 !! end
8303
8304 !! test
8305 Serialization of purely hash wikilink
8306 !! options
8307 title=[[User:Test/123]]
8308 subpage
8309 parsoid=html2wt
8310 !! html/parsoid
8311 <p><a href="#a">[[</a></p>
8312 !! wikitext
8313 [[#a|<nowiki>[[</nowiki>]]
8314 !! html/php
8315 <p><a href="#a">[[</a>
8316 </p>
8317 !! end
8318
8319 !! test
8320 1. Interaction of linktrail and template encapsulation
8321 !! wikitext
8322 {{echo|[[Foo]]}}l
8323 !! html/parsoid
8324 <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>
8325 !! end
8326
8327 !! test
8328 2. Interaction of linktrail and template encapsulation
8329 !! options
8330 parsoid
8331 !! wikitext
8332 {{echo|Some [[Fool]]}}s
8333 !! html
8334 <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>
8335 !! end
8336
8337 !! test
8338 3. Interaction of linktrail and template encapsulation
8339 !! options
8340 parsoid
8341 !! wikitext
8342 {{echo|Some [[Fool]]s are '''bold and foolish'''}}
8343 !! html
8344 <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>
8345 !! end
8346
8347 !! article
8348 Söfnuður
8349 !! text
8350 Test.
8351 !! endarticle
8352
8353 !! test
8354 Internal link with is link prefix
8355 !! options
8356 language=is
8357 !! wikitext
8358 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
8359 !! html
8360 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
8361 </p>
8362 !! end
8363
8364 !! article
8365 Mótmælendatrú
8366 !! text
8367 Test.
8368 !! endarticle
8369
8370 !! test
8371 Internal link with is link trail and link prefix
8372 !! options
8373 language=is
8374 !! wikitext
8375 [[mótmælendatrú|xxx]]ar
8376 [[mótmælendatrú]]ar
8377 mótmælenda[[söfnuður]]
8378 mótmælenda[[söfnuður|söfnuðir]]
8379 mótmælenda[[söfnuður|söfnuðir]]xxx
8380 !! html
8381 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
8382 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
8383 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
8384 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
8385 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
8386 </p>
8387 !! end
8388
8389 !! test
8390 Parsoid link trail escaping
8391 !! options
8392 parsoid=html2wt,html2html
8393 !! html/parsoid
8394 <p><a rel="mw:WikiLink" href="./Apple" title="Apple">apple</a>s</p>
8395 !! wikitext
8396 [[apple]]<nowiki/>s
8397 !! end
8398
8399 !! test
8400 Parsoid link prefix escaping
8401 !! options
8402 language=is
8403 parsoid=html2wt,html2html
8404 !! html/parsoid
8405 <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="./Söfnuður" title="Söfnuður">söfnuður</a></p>
8406 !! wikitext
8407 Aðrir mótmælenda<nowiki/>[[söfnuður]]
8408 !! end
8409
8410 !! test
8411 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
8412 !! wikitext
8413 [[Foo| bar]]
8414
8415 [[Foo| ''bar'']]
8416
8417 [http://wp.org foo]
8418
8419 [http://wp.org ''foo'']
8420 !! html
8421 <p><a href="/wiki/Foo" title="Foo"> bar</a>
8422 </p><p><a href="/wiki/Foo" title="Foo"> <i>bar</i></a>
8423 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
8424 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
8425 </p>
8426 !! end
8427
8428 !! test
8429 Parsoid: Scoped parsing should handle mixed transclusions and plain text
8430 !! wikitext
8431 [[Foo|{{echo|a}} b {{echo|c}}]]
8432 !! html/parsoid
8433 <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>
8434 !! end
8435
8436 !! test
8437 Link with angle bracket after anchor
8438 !! wikitext
8439 [[Foo#<bar>]]
8440 !! html/php
8441 <p><a href="/wiki/Foo#.3Cbar.3E" title="Foo">Foo#&lt;bar&gt;</a>
8442 </p>
8443 !! html/parsoid
8444 <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>
8445 !! end
8446
8447 ###
8448 ### Interwiki links (see maintenance/interwiki.sql)
8449 ###
8450
8451 !! test
8452 Inline interwiki link
8453 !! options
8454 parsoid=wt2html,wt2wt,html2html
8455 !! wikitext
8456 [[MeatBall:SoftSecurity]]
8457 !! html/php
8458 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
8459 </p>
8460 !! html/parsoid
8461 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a></p>
8462 !! end
8463
8464 !! test
8465 Inline interwiki link with empty title (T4372)
8466 !! options
8467 parsoid=wt2html,wt2wt,html2html
8468 !! wikitext
8469 [[MeatBall:]]
8470 !! html/php
8471 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
8472 </p>
8473 !! html/parsoid
8474 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?" title="meatball:">MeatBall:</a></p>
8475 !! end
8476
8477 !! test
8478 Interwiki link encoding conversion (T3636)
8479 !! wikitext
8480 *[[Wikipedia:ro:Olteni&#0355;a]]
8481 *[[Wikipedia:ro:Olteni&#355;a]]
8482 !! html
8483 <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>
8484 <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>
8485
8486 !! html+tidy
8487 <ul>
8488 <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>
8489 <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>
8490 </ul>
8491 !! end
8492
8493 !! test
8494 Interwiki link with fragment (T4130)
8495 !! wikitext
8496 [[MeatBall:SoftSecurity#foo]]
8497 !! html
8498 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
8499 </p>
8500 !! end
8501
8502 !! test
8503 Link scenarios with escaped fragments
8504 !! wikitext
8505 [[#Is this great?]]
8506 [[Foo#Is this great?]]
8507 [[meatball:Foo#Is this great?]]
8508 !! html/php
8509 <p><a href="#Is_this_great.3F">#Is this great?</a>
8510 <a href="/wiki/Foo#Is_this_great.3F" title="Foo">Foo#Is this great?</a>
8511 <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>
8512 </p>
8513 !! html/parsoid
8514 <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>
8515 <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>
8516 <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>
8517 !! end
8518
8519 # Ideally the wikipedia: prefix here should be proto-relative too
8520 # [CSA]: this is kind of a bogus test, as the PHP parser test doesn't
8521 # define the 'en' prefix, and originally the test used 'wikipedia',
8522 # which isn't a localinterwiki prefix hence the links to the 'en:Foo'
8523 # article.
8524 !! test
8525 Different interwiki prefixes mapping to the same URL
8526 !! wikitext
8527 [[:en:Foo]]
8528
8529 [[:en:Foo|Foo]]
8530
8531 [[wikipedia:Foo]]
8532
8533 [[:wikipedia:Foo|Foo]]
8534
8535 [[wikipedia:en:Foo]]
8536
8537 [[:wikipedia:en:Foo]]
8538
8539 [[ wikiPEdia :Foo]]
8540 !! html/parsoid
8541 <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>
8542
8543 <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>
8544
8545 <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>
8546
8547 <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>
8548
8549 <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>
8550
8551 <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>
8552
8553 <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>
8554 !! end
8555
8556 !! test
8557 Interwiki links that cannot be represented in wiki syntax
8558 !! wikitext
8559 [[meatball:ok]]
8560 [[meatball:ok#foo|ok with fragment]]
8561 [[meatball:ok_as_well?|ok ending with ? mark]]
8562 [http://de.wikipedia.org/wiki/Foo?action=history has query]
8563 [http://de.wikipedia.org/wiki/#foo is just fragment]
8564
8565 !! html/php
8566 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?ok" class="extiw" title="meatball:ok">meatball:ok</a>
8567 <a href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" class="extiw" title="meatball:ok">ok with fragment</a>
8568 <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>
8569 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
8570 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a>
8571 </p>
8572 !! html/parsoid
8573 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok" title="meatball:ok">meatball:ok</a>
8574 <a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" title="meatball:ok">ok with fragment</a>
8575 <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>
8576 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
8577 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a></p>
8578 !! end
8579
8580 !! test
8581 Interwiki links: trail
8582 !! wikitext
8583 [[wikipedia:Foo|Ba]]r
8584 !! html/php
8585 <p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
8586 </p>
8587 !! html/parsoid
8588 <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>
8589 !! end
8590
8591 !! test
8592 Local interwiki link
8593 !! options
8594 parsoid=wt2html,wt2wt,html2html
8595 !! wikitext
8596 [[local:Template:Foo]]
8597 !! html/php
8598 <p><a href="/wiki/Template:Foo" title="Template:Foo">local:Template:Foo</a>
8599 </p>
8600 !! html/parsoid
8601 <p><a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">local:Template:Foo</a></p>
8602 !! end
8603
8604 # Parsoid does not mark self-links, by design.
8605 !! test
8606 Local interwiki link: self-link to current page
8607 !! options
8608 title=[[Main Page]]
8609 parsoid=wt2html,wt2wt,html2html
8610 !! wikitext
8611 [[local:Main Page]]
8612 !! html/php
8613 <p><a class="mw-selflink selflink">local:Main Page</a>
8614 </p>
8615 !! html/parsoid
8616 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:Main Page</a></p>
8617 !! end
8618
8619 !! test
8620 Local interwiki link: prefix only (T66167)
8621 !! options
8622 parsoid=wt2html,wt2wt,html2html
8623 !! wikitext
8624 [[local:]]
8625 !! html/php
8626 <p><a href="/wiki/Main_Page" title="Main Page">local:</a>
8627 </p>
8628 !! html/parsoid
8629 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:</a></p>
8630 !! end
8631
8632 !! test
8633 Local interwiki link: with additional interwiki prefix (T63357)
8634 !! options
8635 parsoid=wt2html,wt2wt,html2html
8636 !! wikitext
8637 [[local:meatball:Hello]]
8638 !! html/php
8639 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?Hello" class="extiw" title="meatball:Hello">local:meatball:Hello</a>
8640 </p>
8641 !! html/parsoid
8642 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?Hello" title="meatball:Hello">local:meatball:Hello</a></p>
8643 !! end
8644
8645 !! test
8646 Multiple local interwiki link prefixes
8647 !! wikitext
8648 [[local:local:local:local:mi:local:Foo]]
8649 !! options
8650 parsoid=wt2html,wt2wt,html2html
8651 !! html/php
8652 <p><a href="/wiki/Foo" title="Foo">local:local:local:local:mi:local:Foo</a>
8653 </p>
8654 !! html/parsoid
8655 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">local:local:local:local:mi:local:Foo</a></p>
8656 !! end
8657
8658 ###
8659 ### Interlanguage links
8660 ### Language links (so that searching for '### language' matches..)
8661 ###
8662
8663 !! test
8664 Interlanguage link
8665 !! wikitext
8666 Blah blah blah
8667 [[zh:Chinese]]
8668 !! html/php
8669 <p>Blah blah blah
8670 </p>
8671 !! html/parsoid
8672 <p>Blah blah blah</p>
8673 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8674 !! end
8675
8676 ## parsoid html2wt will lose the space variations
8677 !! test
8678 Interlanguage link with spacing
8679 !! options
8680 parsoid=wt2html,wt2wt,html2html
8681 !! wikitext
8682 Blah blah blah
8683 [[ zh : Chinese ]]
8684 !! html/php
8685 <p>Blah blah blah
8686 </p>
8687 !! html/parsoid
8688 <p>Blah blah blah</p>
8689 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8690 !! end
8691
8692 !! test
8693 Double interlanguage link
8694 !! wikitext
8695 Blah blah blah
8696 [[es:Spanish]]
8697 [[zh:Chinese]]
8698 !! html/php
8699 <p>Blah blah blah
8700 </p>
8701 !! html/parsoid
8702 <p>Blah blah blah</p>
8703 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
8704 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8705 !! end
8706
8707 ## parsoid html2wt will lose the space variations
8708 !! test
8709 Interlanguage link variations
8710 !! options
8711 parsoid=wt2html,wt2wt,html2html
8712 !! wikitext
8713 Blah blah blah
8714 [[ es :Spanish]]
8715 [[ ZH :Chinese]]
8716 [[es:Foo_bar]]
8717 !! html/php
8718 <p>Blah blah blah
8719 </p>
8720 !! html/parsoid
8721 <p>Blah blah blah</p>
8722 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish" />
8723 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese" />
8724 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar" />
8725 !! end
8726
8727 !! test
8728 Escaping of interlanguage links (T129218, T156308)
8729 !! wikitext
8730 Blah blah blah
8731 [[:es:Spanish]]
8732 [[ : zh : Chinese ]]
8733 !! html/php
8734 <p>Blah blah blah
8735 <a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">es:Spanish</a>
8736 <a href="http://zh.wikipedia.org/wiki/Chinese" class="extiw" title="zh:Chinese"> zh : Chinese </a>
8737 </p>
8738 !! html/parsoid
8739 <p>Blah blah blah
8740 <a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">es:Spanish</a>
8741 <a rel="mw:ExtLink" href="http://zh.wikipedia.org/wiki/Chinese" title="zh:Chinese"> zh : Chinese </a></p>
8742 !! end
8743
8744 !! test
8745 Multiple colons escaping interlanguage links
8746 !! wikitext
8747 [[:es:Spanish]]
8748 [[::es:Spanish]]
8749 [[:::es:Spanish]]
8750 !! html/php
8751 <p><a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">es:Spanish</a>
8752 [[::es:Spanish]]
8753 [[:::es:Spanish]]
8754 </p>
8755 !! end
8756
8757 ## parsoid html2wt will normalize the space to _
8758 !! test
8759 Space and question mark encoding in interlanguage links (T95473)
8760 !! options
8761 parsoid=wt2html,wt2wt,html2html
8762 !! wikitext
8763 Blah blah blah
8764 [[es:Foo bar?]]
8765 !! html/php
8766 <p>Blah blah blah
8767 </p>
8768 !! html/parsoid
8769 <p>Blah blah blah</p>
8770 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar%3F" />
8771 !! end
8772
8773 !! test
8774 Interlanguage link, with prefix links
8775 !! options
8776 language=ln
8777 !! wikitext
8778 Blah blah blah
8779 [[zh:Chinese]]
8780 !! html/php
8781 <p>Blah blah blah
8782 </p>
8783 !! html/parsoid
8784 <p>Blah blah blah</p>
8785 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8786 !! end
8787
8788 !! test
8789 Double interlanguage link, with prefix links (T10897)
8790 !! options
8791 language=ln
8792 !! wikitext
8793 Blah blah blah
8794 [[es:Spanish]]
8795 [[zh:Chinese]]
8796 !! html/php
8797 <p>Blah blah blah
8798 </p>
8799 !! html/parsoid
8800 <p>Blah blah blah</p>
8801 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
8802 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8803 !! end
8804
8805 !! test
8806 "Extra" interlanguage links (T34189 / gerrit 111390)
8807 !! wikitext
8808 Blah blah blah
8809 [[mul:Article]]
8810 !! html/php
8811 <p>Blah blah blah
8812 </p>
8813 !! html/parsoid
8814 <p>Blah blah blah</p>
8815 <link rel="mw:PageProp/Language" title="Multilingual" href="http://wikisource.org/wiki/Article"/>
8816 !! end
8817
8818 ## PHP parser tests script needs an update
8819 ## Parsoid html2wt will normalize output to [[:zh:Chinese]]
8820 !! test
8821 Language links render as inline links if $wgInterwikiMagic=false
8822 !! options
8823 wgInterwikiMagic=false
8824 parsoid=wt2html,wt2wt,html2html
8825 !! wikitext
8826 Blah blah blah
8827 [[zh:Chinese]]
8828 !! html/parsoid
8829 <p>Blah blah blah <a rel="mw:ExtLink" href="http://zh.wikipedia.org/wiki/Chinese" title="zh:Chinese">zh:Chinese</a></p>
8830 !! end
8831
8832 ## PHP parser tests script needs an update
8833 ## Parsoid html2wt will normalize output to [[:zh:Chinese]]
8834 !! test
8835 Language links render as inline links in the Talk namespace
8836 !! options
8837 title=Talk:Foo
8838 parsoid=wt2html,wt2wt,html2html
8839 !! wikitext
8840 Blah blah blah
8841 [[zh:Chinese]]
8842 !! html/parsoid
8843 <p>Blah blah blah <a rel="mw:ExtLink" href="http://zh.wikipedia.org/wiki/Chinese" title="zh:Chinese">zh:Chinese</a></p>
8844 !! end
8845
8846 !! test
8847 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
8848 !! options
8849 language=ln
8850 !! wikitext
8851 [[WW&nbsp;II]]
8852 !! html
8853 <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>
8854 </p>
8855 !! end
8856
8857 !! test
8858 Parsoid T55221: Wikilinks should be properly entity-escaped
8859 !! options
8860 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
8861 !! html/parsoid
8862 <p>He&amp;nbsp;llo <a href="./Foo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
8863 <p>He&amp;nbsp;llo <a href="./He&amp;nbsp;llo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
8864 !! wikitext
8865 He&amp;nbsp;llo [[Foo|He&amp;nbsp;llo]]
8866
8867 He&amp;nbsp;llo He&amp;nbsp;llo
8868 !! html/php
8869 <p>He&amp;nbsp;llo <a href="/wiki/Foo" title="Foo">He&amp;nbsp;llo</a>
8870 </p><p>He&amp;nbsp;llo He&amp;nbsp;llo
8871 </p>
8872 !! end
8873
8874 # html2wt will fail because of title normalization without data-parsoid
8875 !! test
8876 Parsoid: handle constructor well
8877 !! options
8878 parsoid=wt2html,wt2wt
8879 !! wikitext
8880 [[constructor]]
8881
8882 [[constructor:foo]]
8883 !! html/php
8884 <p><a href="/index.php?title=Constructor&amp;action=edit&amp;redlink=1" class="new" title="Constructor (page does not exist)">constructor</a>
8885 </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>
8886 </p>
8887 !! html/parsoid
8888 <p><a rel="mw:WikiLink" href="./Constructor" title="Constructor" data-parsoid='{"stx":"simple","a":{"href":"./Constructor"},"sa":{"href":"constructor"}}'>constructor</a></p>
8889
8890 <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>
8891 !! end
8892
8893 !! article
8894 ko:
8895 !! text
8896 Test.
8897 !! endarticle
8898
8899 # Note that `ko` isn't a known interlanguage prefix
8900 !! test
8901 Parsoid: recognize interlanguage links without a target page
8902 !! options
8903 ill
8904 !! wikitext
8905 [[es:]]
8906
8907 [[ko:]]
8908 !! html/php
8909 es:
8910 !! html/parsoid
8911 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/"/>
8912
8913 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
8914 !! end
8915
8916 # Note that `ko` isn't a known interwiki prefix
8917 !! test
8918 Parsoid: recognize interwiki links without a target page
8919 !! options
8920 parsoid=wt2html,wt2wt,html2html
8921 !! wikitext
8922 [[:es:]]
8923
8924 [[:ko:]]
8925 !! html/php
8926 <p><a href="http://es.wikipedia.org/wiki/" class="extiw" title="es:">es:</a>
8927 </p><p><a href="/wiki/Ko:" title="Ko:">ko:</a>
8928 </p>
8929 !! html/parsoid
8930 <p><a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/" title="es:">es:</a></p>
8931 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
8932 !! end
8933
8934 !! test
8935 Handle interwiki links pointing to the current wiki as plain wiki links (T47209)
8936 !! wikitext
8937 [[mi:Foo]]
8938 !! html/php
8939 <p><a href="/wiki/Foo" title="Foo">mi:Foo</a>
8940 </p>
8941 !! html/parsoid
8942 <p><a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo"},"sa":{"href":"mi:Foo"}}'>mi:Foo</a></p>
8943 !! end
8944
8945 !! test
8946 Interlanguage link with preceding local interwiki link (T70085)
8947 !! options
8948 parsoid=wt2html,wt2wt,html2html
8949 !! wikitext
8950 Blah blah blah
8951 [[local:es:Spanish]]
8952 !! html/php
8953 <p>Blah blah blah
8954 <a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">local:es:Spanish</a>
8955 </p>
8956 !! html/parsoid
8957 <p>Blah blah blah
8958 <a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">local:es:Spanish</a></p>
8959 !! end
8960
8961 !! test
8962 Looks like an interlanguage link, but is actually a local interwiki
8963 !! options
8964 parsoid=wt2html,wt2wt,html2html
8965 !! wikitext
8966 Blah blah blah
8967 [[mi:Template:Foo]]
8968 !! html/php
8969 <p>Blah blah blah
8970 <a href="/wiki/Template:Foo" title="Template:Foo">mi:Template:Foo</a>
8971 </p>
8972 !! html/parsoid
8973 <p>Blah blah blah
8974 <a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">mi:Template:Foo</a></p>
8975 !! end
8976
8977 ###
8978 ### Redirects, Parsoid-only
8979 ###
8980
8981 !! test
8982 1. Simple redirect to page
8983 !! wikitext
8984 #REDIRECT [[Main Page]]
8985 !! html/parsoid
8986 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8987 !! end
8988
8989 !! test
8990 2. Other redirect variants
8991 !! wikitext
8992 #REDIRECT [[Main_Page]]
8993 !! html/parsoid
8994 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Main_Page"},"sa":{"href":"Main_Page"}}'/>
8995 !! end
8996
8997 # Not a valid redirect in PHP (although perhaps it was, once upon a time)
8998 # This tests the Parsoid bail-out code.
8999 !! test
9000 3. Other redirect variants
9001 !! wikitext
9002 #REDIRECT [[<nowiki>[[Bar]]</nowiki>]]
9003 !! html/parsoid
9004 <ol><li data-parsoid>REDIRECT [[[[Bar]]]]</li></ol>
9005 !! end
9006
9007 !! test
9008 4. Redirect to a templated destination
9009 !! wikitext
9010 #REDIRECT [[{{echo|Foo}}bar]]
9011 !! html/parsoid
9012 <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"}]]}'/>
9013 !! end
9014
9015 !! test
9016 Empty redirect
9017 !! options
9018 parsoid=wt2html,wt2wt
9019 !! wikitext
9020 #REDIRECT [[]]
9021 !! html/parsoid
9022 <ol>
9023 <li>REDIRECT [[]]</li></ol>
9024 !! end
9025
9026 !! test
9027 Optional colon in #REDIRECT
9028 !! options
9029 # the colon is archaic syntax. we support it for wt2html, but we
9030 # don't care that it roundtrips back to the modern syntax.
9031 parsoid=wt2html,html2html
9032 !! wikitext
9033 #REDIRECT:[[Main Page]]
9034 !! html/parsoid
9035 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
9036 !! end
9037
9038 !! test
9039 Whitespace in #REDIRECT with optional colon
9040 !! options
9041 # the colon and gratuitous whitespace is archaic syntax. we support
9042 # it for wt2html, but we don't care that it roundtrips back to the
9043 # modern syntax (without extra whitespace)
9044 parsoid=wt2html,html2html
9045 !! wikitext
9046
9047 #REDIRECT
9048 :
9049 [[Main Page]]
9050 !! html/parsoid
9051 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
9052 !! end
9053
9054 !! test
9055 Piped link in #REDIRECT
9056 !! options
9057 # content after piped link is ignored. we support this syntax,
9058 # but don't care that the piped link is lost when we roundtrip this.
9059 parsoid=wt2html
9060 !! wikitext
9061 #REDIRECT [[Main Page|bar]]
9062 !! html/parsoid
9063 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
9064 !! end
9065
9066 !! test
9067 Redirect to category (T104502)
9068 !! options
9069 parsoid=wt2html,wt2wt
9070 !! wikitext
9071 #REDIRECT [[Category:Foo]]
9072 !! html/parsoid
9073 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
9074 !! end
9075
9076 !! test
9077 Redirect to category with URL encoding (T104502)
9078 !! options
9079 parsoid=wt2html
9080 !! wikitext
9081 #REDIRECT [[Category%3AFoo]]
9082 !! html/parsoid
9083 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
9084 !! end
9085
9086 !! test
9087 Redirect to category page
9088 !! wikitext
9089 #REDIRECT [[:Category:Foo]]
9090 !! html/parsoid
9091 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
9092 !! end
9093
9094 !! test
9095 Redirect to image page (1)
9096 !! wikitext
9097 #REDIRECT [[File:Wiki.png]]
9098 !! html/parsoid
9099 <link rel="mw:PageProp/redirect" href="./File:Wiki.png"/>
9100 !! end
9101
9102 !! test
9103 Redirect to image page (2)
9104 !! wikitext
9105 #REDIRECT [[Image:Wiki.png]]
9106 !! html/parsoid
9107 <link rel="mw:PageProp/redirect" href="./File:Wiki.png" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./File:Wiki.png"},"sa":{"href":"Image:Wiki.png"}}'/>
9108 !! end
9109
9110 # html2wt disabled because wts serializes as "#REDIRECT [[:en:File:Wiki.png]]"
9111 # Next test confirms this.
9112 !! test
9113 Redirect to language (1) (T104918)
9114 !! options
9115 parsoid=wt2html,wt2wt,html2html
9116 !! wikitext
9117 #REDIRECT [[en:File:Wiki.png]]
9118 !! html/parsoid
9119 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
9120 !! end
9121
9122 !! test
9123 Redirect to language (2) (T104918)
9124 !! wikitext
9125 #REDIRECT [[:en:File:Wiki.png]]
9126 !! html/parsoid
9127 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
9128 !! end
9129
9130 !! test
9131 Redirect to interwiki (T104918)
9132 !! wikitext
9133 #REDIRECT [[meatball:File:Wiki.png]]
9134 !! html/parsoid
9135 <link rel="mw:PageProp/redirect" href="http://www.usemod.com/cgi-bin/mb.pl?File:Wiki.png"/>
9136 !! end
9137
9138 !! test
9139 Non-English #REDIRECT
9140 !! options
9141 language=is
9142 !! wikitext
9143 #TILVÍSUN [[Main Page]]
9144 !! html/parsoid
9145 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#TILVÍSUN ","a":{"href":"./Main_Page"},"sa":{"href":"Main Page"}}'/>
9146 !! end
9147
9148 !! test
9149 Redirect syntax under text isn't considered a redirect
9150 !! wikitext
9151 some text
9152 #redirect [[Main Page]]
9153 !! html/parsoid
9154 <p>some text</p>
9155 <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>
9156 !! end
9157
9158 # FIXME: Should hoist the redirect to the top of the page and ensure there
9159 # is only one.
9160 !! test
9161 New redirect
9162 !! options
9163 parsoid=html2wt
9164 !! html/parsoid
9165 <p>Foo<link rel="mw:PageProp/redirect" href="./Foo"/></p>
9166 !! wikitext
9167 Foo
9168 #REDIRECT [[Foo]]
9169 !! end
9170
9171 ##
9172 ## XHTML tidiness
9173 ###
9174
9175 !! test
9176 <br> to <br />
9177 !! wikitext
9178 1<br>2<br />3
9179 !! html
9180 <p>1<br />2<br />3
9181 </p>
9182 !! end
9183
9184 !! test
9185 Broken br tag sanitization
9186 !! wikitext
9187 </br>
9188 !! html/php
9189 <p>&lt;/br&gt;
9190 </p>
9191 !! end
9192
9193 # TODO: Fix html2html mode (T53055)!
9194 !! test
9195 Parsoid: Broken br tag recognition
9196 !! options
9197 parsoid=wt2html
9198 !! wikitext
9199 </br>
9200
9201 <br/ >
9202 !! html+tidy
9203 <p><br /></p>
9204 <p><br /></p>
9205 !! end
9206
9207 !! test
9208 Incorrecly removing closing slashes from correctly formed XHTML
9209 !! wikitext
9210 <br style="clear:both;" />
9211 !! html
9212 <p><br style="clear:both;" />
9213 </p>
9214 !! end
9215
9216 !! test
9217 Failing to transform badly formed HTML into correct XHTML
9218 !! wikitext
9219 <br style="clear: left;">
9220 <br style="clear: right;">
9221 <br style="clear: both;">
9222 !! html
9223 <p><br style="clear: left;" />
9224 <br style="clear: right;" />
9225 <br style="clear: both;" />
9226 </p>
9227 !!end
9228
9229 ## FIXME: Is Parsoid's acceptance of self-closing html-tags
9230 ## a feature or a bug? See https://phabricator.wikimedia.org/T76962
9231 !! test
9232 Handling html with a div self-closing tag
9233 !! wikitext
9234 <div title />
9235 <div title/>
9236 <div title/ >
9237 <div title=bar />
9238 <div title=bar/>
9239 <div title=bar/ >
9240 !! html/php
9241 <p>&lt;div title /&gt;
9242 &lt;div title/&gt;
9243 </p>
9244 <div>
9245 <p>&lt;div title=bar /&gt;
9246 &lt;div title=bar/&gt;
9247 </p>
9248 <div title="bar/"></div>
9249 </div>
9250
9251 !! html/parsoid
9252 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
9253 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
9254 <div title="" data-parsoid='{"stx":"html","selfClose":true,"brokenHTMLTag":true}'></div>
9255 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
9256 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
9257 <div title="bar/" data-parsoid='{"stx":"html","autoInsertedEnd":true}'></div>
9258 !! end
9259
9260 !! test
9261 Handling html with a br self-closing tag
9262 !! wikitext
9263 <br title />
9264 <br title/>
9265 <br title/ >
9266 <br title=bar />
9267 <br title=bar/>
9268 <br title=bar/ >
9269 !! html/php
9270 <p><br title="" />
9271 <br title="" />
9272 <br />
9273 <br title="bar" />
9274 <br title="bar" />
9275 <br title="bar/" />
9276 </p>
9277 !! html/parsoid
9278 <p><br title="" />
9279 <br title="" />
9280 <br title="" />
9281 <br title="bar" />
9282 <br title="bar" />
9283 <br title="bar/" />
9284 </p>
9285 !! end
9286
9287 !! test
9288 Horizontal ruler (should it add that extra space?)
9289 !! wikitext
9290 <hr>
9291 <hr >
9292 foo <hr
9293 > bar
9294 !! html+tidy
9295 <hr />
9296 <hr />
9297 <p>foo</p>
9298 <hr />
9299 <p>bar</p>
9300 !! end
9301
9302 !! test
9303 Horizontal ruler -- 4+ dashes render hr
9304 !! wikitext
9305 ----
9306 !! html
9307 <hr />
9308
9309 !! end
9310
9311 !! test
9312 Horizontal ruler -- eats additional dashes on the same line
9313 !! wikitext
9314 ---------
9315 !! html
9316 <hr />
9317
9318 !! end
9319
9320 !! test
9321 Horizontal ruler -- does not collapse dashes on consecutive lines
9322 !! wikitext
9323 ----
9324 ----
9325 !! html
9326 <hr />
9327 <hr />
9328
9329 !! end
9330
9331 !! test
9332 Horizontal ruler -- <4 dashes render as plain text
9333 !! wikitext
9334 ---
9335 !! html
9336 <p>---
9337 </p>
9338 !! end
9339
9340 !! test
9341 Horizontal ruler -- Supports content following dashes on same line
9342 !! wikitext
9343 ---- Foo
9344 !! html
9345 <hr /> Foo
9346
9347 !! html+tidy
9348 <hr />
9349 <p>Foo</p>
9350 !! end
9351
9352 ###
9353 ### Block-level elements
9354 ###
9355 !! test
9356 Common list
9357 !! wikitext
9358 *Common list
9359 * item 2
9360 *item 3
9361 !! html
9362 <ul><li>Common list</li>
9363 <li> item 2</li>
9364 <li>item 3</li></ul>
9365
9366 !! end
9367
9368 !! test
9369 Numbered list
9370 !! wikitext
9371 #Numbered list
9372 #item 2
9373 # item 3
9374 !! html
9375 <ol><li>Numbered list</li>
9376 <li>item 2</li>
9377 <li> item 3</li></ol>
9378
9379 !! end
9380
9381 !! test
9382 Mixed list
9383 !! wikitext
9384 *Mixed list
9385 *# with numbers
9386 ** and bullets
9387 *# and numbers
9388 *bullets again
9389 **bullet level 2
9390 ***bullet level 3
9391 ***#Number on level 4
9392 **bullet level 2
9393 **#Number on level 3
9394 **#Number on level 3
9395 *#number level 2
9396 *Level 1
9397 *** Level 3
9398 #** Level 3, but ordered
9399 !! html
9400 <ul><li>Mixed list
9401 <ol><li> with numbers</li></ol>
9402 <ul><li> and bullets</li></ul>
9403 <ol><li> and numbers</li></ol></li>
9404 <li>bullets again
9405 <ul><li>bullet level 2
9406 <ul><li>bullet level 3
9407 <ol><li>Number on level 4</li></ol></li></ul></li>
9408 <li>bullet level 2
9409 <ol><li>Number on level 3</li>
9410 <li>Number on level 3</li></ol></li></ul>
9411 <ol><li>number level 2</li></ol></li>
9412 <li>Level 1
9413 <ul><li><ul><li> Level 3</li></ul></li></ul></li></ul>
9414 <ol><li><ul><li><ul><li> Level 3, but ordered</li></ul></li></ul></li></ol>
9415
9416 !! end
9417
9418 !! test
9419 1. Nested mixed wikitext and html list
9420 !! wikitext
9421 * hi
9422 * <ul><li>ho</li></ul>
9423 * hi
9424 ** ho
9425 !! html/php
9426 <ul><li> hi</li>
9427 <li> <ul><li>ho</li></ul></li>
9428 <li> hi
9429 <ul><li> ho</li></ul></li></ul>
9430
9431 !! html/parsoid
9432 <ul><li> hi</li>
9433 <li> <ul data-parsoid='{"stx":"html"}'><li data-parsoid='{"stx":"html"}'>ho</li></ul></li>
9434 <li> hi
9435 <ul><li> ho</li></ul></li></ul>
9436 !! end
9437
9438 !! test
9439 2. Nested mixed wikitext and html list (incompatible)
9440 !! wikitext
9441 ; hi
9442 : {{echo|<li>ho</li>}}
9443 !! html/php
9444 <dl><dt> hi</dt>
9445 <dd> <li>ho</li></dd></dl>
9446
9447 !! html/parsoid
9448 <dl><dt> hi</dt>
9449 <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>
9450 !! end
9451
9452 !! test
9453 Nested lists 1
9454 !! wikitext
9455 *foo
9456 **bar
9457 !! html
9458 <ul><li>foo
9459 <ul><li>bar</li></ul></li></ul>
9460
9461 !! end
9462
9463 !! test
9464 Nested lists 2
9465 !! wikitext
9466 **foo
9467 *bar
9468 !! html
9469 <ul><li><ul><li>foo</li></ul></li>
9470 <li>bar</li></ul>
9471
9472 !! end
9473
9474 !! test
9475 Nested lists 3 (first element empty)
9476 !! wikitext
9477 *
9478 **bar
9479 !! html
9480 <ul><li>
9481 <ul><li>bar</li></ul></li></ul>
9482
9483 !! end
9484
9485 !! test
9486 Nested lists 4 (first element empty)
9487 !! wikitext
9488 **
9489 *bar
9490 !! html
9491 <ul><li><ul><li></li></ul></li>
9492 <li>bar</li></ul>
9493
9494 !! end
9495
9496 !! test
9497 Nested lists 5 (both elements empty)
9498 !! wikitext
9499 **
9500 *
9501 !! html
9502 <ul><li><ul><li></li></ul></li>
9503 <li></li></ul>
9504
9505 !! end
9506
9507 !! test
9508 Nested lists 6 (both elements empty)
9509 !! wikitext
9510 *
9511 **
9512 !! html
9513 <ul><li>
9514 <ul><li></li></ul></li></ul>
9515
9516 !! end
9517
9518 !! test
9519 Nested lists 7 (skip initial nesting levels)
9520 !! wikitext
9521 *** foo
9522 !! html
9523 <ul><li><ul><li><ul><li> foo</li></ul></li></ul></li></ul>
9524
9525 !! end
9526
9527 !! test
9528 Nested lists 8 (multiple nesting transitions)
9529 !! wikitext
9530 * foo
9531 *** bar
9532 ** baz
9533 * boo
9534 !! html
9535 <ul><li> foo
9536 <ul><li><ul><li> bar</li></ul></li>
9537 <li> baz</li></ul></li>
9538 <li> boo</li></ul>
9539
9540 !! end
9541
9542 !! test
9543 Nested lists 9 (extension interaction)
9544 !! options
9545 parsoid
9546 !! wikitext
9547 *<references />
9548 !! html/parsoid
9549 <ul><li data-parsoid='{}'><ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-parsoid='{}' data-mw='{"name":"references","attrs":{}}'></ol></li></ul>
9550 !! end
9551
9552 !! test
9553 1. Lists with start-of-line-transparent tokens before bullets: Comments
9554 !! wikitext
9555 *foo
9556 *<!--cmt-->bar
9557 <!--cmt-->*baz
9558 !! html
9559 <ul><li>foo</li>
9560 <li>bar</li>
9561 <li>baz</li></ul>
9562
9563 !! end
9564
9565 !! test
9566 2. Lists with start-of-line-transparent tokens before bullets: Template close
9567 !! wikitext
9568 *foo {{echo|bar
9569 }}*baz
9570 !! html
9571 <ul><li>foo bar</li>
9572 <li>baz</li></ul>
9573
9574 !! end
9575
9576 !! test
9577 List items are not parsed correctly following a <pre> block (T2785)
9578 !! wikitext
9579 * <pre>foo</pre>
9580 * <pre>bar</pre>
9581 * zar
9582 !! html/php
9583 <ul><li> <pre>foo</pre></li>
9584 <li> <pre>bar</pre></li>
9585 <li> zar</li></ul>
9586
9587 !! html/parsoid
9588 <ul><li> <pre typeof="mw:Extension/pre" about="#mwt2" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"foo"}}'>foo</pre></li>
9589 <li> <pre typeof="mw:Extension/pre" about="#mwt4" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"bar"}}'>bar</pre></li>
9590 <li> zar</li></ul>
9591 !! end
9592
9593 !! test
9594 List items from template
9595 !! wikitext
9596
9597 {{inner list}}
9598 * item 2
9599
9600 * item 0
9601 {{inner list}}
9602 * item 2
9603
9604 * item 0
9605 * notSOL{{inner list}}
9606 * item 2
9607 !! html
9608 <ul><li> item 1</li>
9609 <li> item 2</li></ul>
9610 <ul><li> item 0</li>
9611 <li> item 1</li>
9612 <li> item 2</li></ul>
9613 <ul><li> item 0</li>
9614 <li> notSOL</li>
9615 <li> item 1</li>
9616 <li> item 2</li></ul>
9617
9618 !! end
9619
9620 !! test
9621 List interrupted by empty line or heading
9622 !! wikitext
9623 * foo
9624
9625 ** bar
9626 == A heading ==
9627 * Another list item
9628 !! html
9629 <ul><li> foo</li></ul>
9630 <ul><li><ul><li> bar</li></ul></li></ul>
9631 <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>
9632 <ul><li> Another list item</li></ul>
9633
9634 !!end
9635
9636 !!test
9637 Multiple list tags generated by templates
9638 !! wikitext
9639 {{echo|<li>}}a
9640 {{echo|<li>}}b
9641 {{echo|<li>}}c
9642 !! html
9643 <li>a
9644 <li>b
9645 <li>c</li>
9646 </li>
9647 </li>
9648
9649 !! html+tidy
9650 <ul>
9651 <li>a</li>
9652 <li>b</li>
9653 <li>c</li>
9654 </ul>
9655 !!end
9656
9657 !!test
9658 Single-comment whitespace lines dont break lists, and neither do multi-comment whitespace lines
9659 !! wikitext
9660 *a
9661 <!--This line will NOT split the list-->
9662 *b
9663 <!--This line will NOT split the list either-->
9664 *c
9665 <!--foo--> <!----> <!--This line NOT split the list either-->
9666 *d
9667 !! html
9668 <ul><li>a</li>
9669 <li>b</li>
9670 <li>c</li>
9671 <li>d</li></ul>
9672
9673 !!end
9674
9675 !!test
9676 Replacing whitespace with tabs still doesn't break the list (gerrit 78327)
9677 !! wikitext
9678 *a
9679 <!--This line will NOT split the list-->
9680 *b
9681 <!--This line will NOT split the list either-->
9682 *c
9683 <!--foo--> <!----> <!--This line NOT split the list
9684 either-->
9685 *d
9686 !! html
9687 <ul><li>a</li>
9688 <li>b</li>
9689 <li>c</li>
9690 <li>d</li></ul>
9691
9692 !!end
9693
9694 !!test
9695 Test the li-hack
9696 (The PHP parser relies on Tidy for the hack)
9697 !!options
9698 parsoid=wt2html,wt2wt
9699 !! wikitext
9700 * foo
9701 * <li>li-hack
9702 * {{echo|<li>templated li-hack}}
9703 * <!--foo--> <li> unsupported li-hack with preceding comments
9704
9705 <ul>
9706 <li><li>not a li-hack
9707 </li>
9708 </ul>
9709 !! html+tidy
9710 <ul>
9711 <li>foo</li>
9712 <li>li-hack</li>
9713 <li>templated li-hack</li>
9714 <li>unsupported li-hack with preceding comments</li>
9715 </ul>
9716 <ul>
9717 <li>not a li-hack</li>
9718 </ul>
9719 !!end
9720
9721 !! test
9722 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
9723 !! options
9724 parsoid
9725 !! wikitext
9726 # foo
9727 ## bar
9728 * foo
9729 ** bar
9730 : foo
9731 :: bar
9732 !! html
9733 <ol>
9734 <li> foo<ol>
9735 <li> bar</li>
9736 </ol></li>
9737 </ol><ul>
9738 <li> foo<ul>
9739 <li> bar</li>
9740 </ul></li>
9741 </ul><dl>
9742 <dd> foo<dl>
9743 <dd> bar</dd>
9744 </dl></dd>
9745 </dl>
9746 !! end
9747
9748 !! test
9749 Parsoid: Test of whitespace serialization with Templated bullets
9750 !! options
9751 parsoid
9752 !! wikitext
9753 * {{bullet}}
9754 !! html
9755 <ul>
9756 <li> </li><li about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"bullet","href":"./Template:Bullet"},"params":{},"i":0}}]}'> Bar</li>
9757 </ul>
9758 !! end
9759
9760 # ------------------------------------------------------------------------
9761 # The next set of tests are about Parsoid's ability to handle badly nested
9762 # tags (parse, minimize scope of fixup, and roundtrip back)
9763 # ------------------------------------------------------------------------
9764
9765 !! test
9766 Unbalanced closing block tags break a list
9767 (php parser relies on Tidy to fix up)
9768 !! wikitext
9769 <div>
9770 *a</div><div>
9771 *b</div>
9772 !! html+tidy
9773 <div>
9774 <ul>
9775 <li>a</li>
9776 </ul>
9777 </div>
9778 <div>
9779 <ul>
9780 <li>b</li>
9781 </ul>
9782 </div>
9783 !! end
9784
9785 # Parsoid fails this test, but it might be tricky to support properly.
9786 # See T70395.
9787 !! test
9788 Unbalanced closing non-block tags don't break a list
9789 (php parser relies on Tidy to fix up)
9790 !! wikitext
9791 <span>
9792 *a</span><span>
9793 *b</span>
9794 !! html/php+tidy
9795 <ul>
9796 <li><span>a</span></li>
9797 <li><span>b</span></li>
9798 </ul>
9799 !! html/parsoid
9800 <span>
9801 <ul>
9802 <li>a<span></span>
9803 </li>
9804 <li>b
9805 </li>
9806 </ul>
9807 </span>
9808 !! end
9809
9810 !! test
9811 Unclosed formatting tags that straddle lists are closed and reopened
9812 (php parser relies on Tidy to fix up)
9813 !! options
9814 parsoid=wt2html,wt2wt,html2html
9815 !! wikitext
9816 # <s> a
9817 # b </s>
9818 !! html/php+tidy
9819 <ol>
9820 <li><s>a</s></li>
9821 <li><s>b</s></li>
9822 </ol>
9823 !! html/parsoid
9824 <ol><li> <s> a</s></li>
9825 <li><s> b </s></li></ol>
9826 !! end
9827
9828 # See T70395.
9829 !!test
9830 1. List embedded in a formatting tag
9831 !! wikitext
9832 <small>
9833 * foo
9834 </small>
9835 !! html/php+tidy
9836 <ul>
9837 <li><small>foo</small></li>
9838 </ul>
9839 !! html/parsoid
9840 <small>
9841 <ul>
9842 <li> foo</li>
9843 </ul>
9844 </small>
9845 !!end
9846
9847 ## Ugly Parsoid output here
9848 ## Not sure what the right output is.
9849 !!test
9850 2. List embedded in a formatting tag
9851 !! wikitext
9852 <small>
9853 *a
9854 *b</small>
9855 !! html/php+tidy
9856 <ul>
9857 <li><small>a</small></li>
9858 <li><small>b</small></li>
9859 </ul>
9860 !! html/parsoid
9861 <small></small>
9862 <ul><small>
9863 <li>a</li>
9864 </small>
9865 <li><small>b</small></li>
9866 </ul>
9867 !!end
9868
9869 # Ugly Parsoid and PHP parser output here
9870 # Not sure if we want to make this a test!
9871 #
9872 ## !!test
9873 ## 3. Unclosed formatting tags in list elements
9874 ## !! wikitext
9875 ## *<small>a
9876 ## *<small>b
9877 ## !! html/php+tidy
9878 ## <ul>
9879 ## <li><small>a</small></li>
9880 ## <li><small><small>b</small></small></li>
9881 ## </ul>
9882 ## !! html/parsoid
9883 ## <ul>
9884 ## <li><small>a</small></li>
9885 ## <small>
9886 ## <li><small>b</small></li>
9887 ## </small></ul>
9888 ## !!end
9889
9890 # This is a bug in the PHP parser + tidy combination.
9891 # (The </tr> tag gets parsed as text and html-escaped by PHP,
9892 # and then fostered out of the table by tidy.)
9893 # We believe the Parsoid output to be correct.
9894 !! test
9895 Table with missing opening <tr> tag
9896 !! options
9897 parsoid=wt2html,wt2wt
9898 !! wikitext
9899 <table>
9900 <td>foo</td>
9901 </tr>
9902 </table>
9903 !! html+tidy
9904 <table>
9905 <tr>
9906 <td>foo</td>
9907 </tr>
9908 </table>
9909 !! end
9910
9911 ###
9912 ### Magic Words
9913 ###
9914
9915 # Note that the current date is hard-coded as
9916 # 1970-01-01T00:02:03Z (a Thursday)
9917 # when running parser tests. The timezone is also fixed to GMT, so
9918 # local date will be identical to current date.
9919
9920 !! test
9921 Magic Word: {{CURRENTDAY}}
9922 !! wikitext
9923 {{CURRENTDAY}}
9924 !! html
9925 <p>1
9926 </p>
9927 !! end
9928
9929 !! test
9930 Magic Word: {{CURRENTDAY2}}
9931 !! wikitext
9932 {{CURRENTDAY2}}
9933 !! html
9934 <p>01
9935 </p>
9936 !! end
9937
9938 !! test
9939 Magic Word: {{CURRENTDAYNAME}}
9940 !! wikitext
9941 {{CURRENTDAYNAME}}
9942 !! html
9943 <p>Thursday
9944 </p>
9945 !! end
9946
9947 !! test
9948 Magic Word: {{CURRENTDOW}}
9949 !! wikitext
9950 {{CURRENTDOW}}
9951 !! html
9952 <p>4
9953 </p>
9954 !! end
9955
9956 !! test
9957 Magic Word: {{CURRENTMONTH}}
9958 !! wikitext
9959 {{CURRENTMONTH}}
9960 !! html
9961 <p>01
9962 </p>
9963 !! end
9964
9965 !! test
9966 Magic Word: {{CURRENTMONTH1}}
9967 !! wikitext
9968 {{CURRENTMONTH1}}
9969 !! html
9970 <p>1
9971 </p>
9972 !! end
9973
9974 !! test
9975 Magic Word: {{CURRENTMONTHABBREV}}
9976 !! wikitext
9977 {{CURRENTMONTHABBREV}}
9978 !! html
9979 <p>Jan
9980 </p>
9981 !! end
9982
9983 !! test
9984 Magic Word: {{CURRENTMONTHNAME}}
9985 !! wikitext
9986 {{CURRENTMONTHNAME}}
9987 !! html
9988 <p>January
9989 </p>
9990 !! end
9991
9992 !! test
9993 Magic Word: {{CURRENTMONTHNAMEGEN}}
9994 !! wikitext
9995 {{CURRENTMONTHNAMEGEN}}
9996 !! html
9997 <p>January
9998 </p>
9999 !! end
10000
10001 !! test
10002 Magic Word: {{CURRENTTIME}}
10003 !! wikitext
10004 {{CURRENTTIME}}
10005 !! html
10006 <p>00:02
10007 </p>
10008 !! end
10009
10010 !! test
10011 Magic Word: {{CURRENTHOUR}}
10012 !! wikitext
10013 {{CURRENTHOUR}}
10014 !! html
10015 <p>00
10016 </p>
10017 !! end
10018
10019 !! test
10020 Magic Word: {{CURRENTWEEK}} (T6594)
10021 !! wikitext
10022 {{CURRENTWEEK}}
10023 !! html
10024 <p>1
10025 </p>
10026 !! end
10027
10028 !! test
10029 Magic Word: {{CURRENTYEAR}}
10030 !! wikitext
10031 {{CURRENTYEAR}}
10032 !! html
10033 <p>1970
10034 </p>
10035 !! end
10036
10037 !! test
10038 Magic Word: {{CURRENTTIMESTAMP}}
10039 !! wikitext
10040 {{CURRENTTIMESTAMP}}
10041 !! html
10042 <p>19700101000203
10043 </p>
10044 !! end
10045
10046 !! test
10047 Magic Words LOCAL (UTC)
10048 !! wikitext
10049 * {{LOCALMONTH}}
10050 * {{LOCALMONTH1}}
10051 * {{LOCALMONTHNAME}}
10052 * {{LOCALMONTHNAMEGEN}}
10053 * {{LOCALMONTHABBREV}}
10054 * {{LOCALDAY}}
10055 * {{LOCALDAY2}}
10056 * {{LOCALDAYNAME}}
10057 * {{LOCALYEAR}}
10058 * {{LOCALTIME}}
10059 * {{LOCALHOUR}}
10060 * {{LOCALWEEK}}
10061 * {{LOCALDOW}}
10062 * {{LOCALTIMESTAMP}}
10063 !! html
10064 <ul><li> 01</li>
10065 <li> 1</li>
10066 <li> January</li>
10067 <li> January</li>
10068 <li> Jan</li>
10069 <li> 1</li>
10070 <li> 01</li>
10071 <li> Thursday</li>
10072 <li> 1970</li>
10073 <li> 00:02</li>
10074 <li> 00</li>
10075 <li> 1</li>
10076 <li> 4</li>
10077 <li> 19700101000203</li></ul>
10078
10079 !! end
10080
10081 !! test
10082 Magic Word: {{FULLPAGENAME}}
10083 !! options
10084 title=[[User:Ævar Arnfjörð Bjarmason]]
10085 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10086 !! wikitext
10087 {{FULLPAGENAME}}
10088 !! html/*
10089 <p>User:Ævar Arnfjörð Bjarmason
10090 </p>
10091 !! end
10092
10093 !! test
10094 Magic Word: {{FULLPAGENAMEE}}
10095 !! options
10096 title=[[User:Ævar Arnfjörð Bjarmason]]
10097 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10098 !! wikitext
10099 {{FULLPAGENAMEE}}
10100 !! html/*
10101 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10102 </p>
10103 !! end
10104
10105 !! test
10106 Magic Word: {{TALKSPACE}}
10107 !! options
10108 title=[[User:Ævar Arnfjörð Bjarmason]]
10109 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10110 !! wikitext
10111 {{TALKSPACE}}
10112 !! html/*
10113 <p>User talk
10114 </p>
10115 !! end
10116
10117 !! test
10118 Magic Word: {{TALKSPACE}}, same namespace
10119 !! options
10120 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10121 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10122 !! wikitext
10123 {{TALKSPACE}}
10124 !! html/*
10125 <p>User talk
10126 </p>
10127 !! end
10128
10129 !! test
10130 Magic Word: {{TALKSPACE}}, main namespace
10131 !! options
10132 title=[[Parser Test]]
10133 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10134 !! wikitext
10135 {{TALKSPACE}}
10136 !! html/*
10137 <p>Talk
10138 </p>
10139 !! end
10140
10141 !! test
10142 Magic Word: {{TALKSPACEE}}
10143 !! options
10144 title=[[User:Ævar Arnfjörð Bjarmason]]
10145 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10146 !! wikitext
10147 {{TALKSPACEE}}
10148 !! html/*
10149 <p>User_talk
10150 </p>
10151 !! end
10152
10153 !! test
10154 Magic Word: {{SUBJECTSPACE}}
10155 !! options
10156 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10157 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10158 !! wikitext
10159 {{SUBJECTSPACE}}
10160 !! html/*
10161 <p>User
10162 </p>
10163 !! end
10164
10165 !! test
10166 Magic Word: {{SUBJECTSPACE}}, same namespace
10167 !! options
10168 title=[[User:Ævar Arnfjörð Bjarmason]]
10169 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10170 !! wikitext
10171 {{SUBJECTSPACE}}
10172 !! html/*
10173 <p>User
10174 </p>
10175 !! end
10176
10177 !! test
10178 Magic Word: {{SUBJECTSPACE}}, main namespace
10179 !! options
10180 title=[[Parser Test]]
10181 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10182 !! wikitext
10183 {{SUBJECTSPACE}}
10184 !! html/*
10185
10186 !! end
10187
10188 !! test
10189 Magic Word: {{SUBJECTSPACEE}}
10190 !! options
10191 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10192 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10193 !! wikitext
10194 {{SUBJECTSPACEE}}
10195 !! html/*
10196 <p>User
10197 </p>
10198 !! end
10199
10200 !! test
10201 Magic Word: {{NAMESPACE}}
10202 !! options
10203 title=[[User:Ævar Arnfjörð Bjarmason]]
10204 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10205 !! wikitext
10206 {{NAMESPACE}}
10207 !! html/*
10208 <p>User
10209 </p>
10210 !! end
10211
10212 !! test
10213 Magic Word: {{NAMESPACEE}}
10214 !! options
10215 title=[[User:Ævar Arnfjörð Bjarmason]]
10216 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10217 !! wikitext
10218 {{NAMESPACEE}}
10219 !! html/*
10220 <p>User
10221 </p>
10222 !! end
10223
10224 !! test
10225 Magic Word: {{NAMESPACENUMBER}}
10226 !! options
10227 title=[[User:Ævar Arnfjörð Bjarmason]]
10228 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10229 !! wikitext
10230 {{NAMESPACENUMBER}}
10231 !! html/*
10232 <p>2
10233 </p>
10234 !! end
10235
10236 !! test
10237 Magic Word: {{SUBPAGENAME}}
10238 !! options
10239 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
10240 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10241 !! wikitext
10242 {{SUBPAGENAME}}
10243 !! html/*
10244 <p>sub ö
10245 </p>
10246 !! end
10247
10248 !! test
10249 Magic Word: {{SUBPAGENAMEE}}
10250 !! options
10251 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
10252 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10253 !! wikitext
10254 {{SUBPAGENAMEE}}
10255 !! html/*
10256 <p>sub_%C3%B6
10257 </p>
10258 !! end
10259
10260 !! test
10261 Magic Word: {{ROOTPAGENAME}}
10262 !! options
10263 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
10264 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10265 !! wikitext
10266 {{ROOTPAGENAME}}
10267 !! html/*
10268 <p>Ævar Arnfjörð Bjarmason
10269 </p>
10270 !! end
10271
10272 !! test
10273 Magic Word: {{ROOTPAGENAMEE}}
10274 !! options
10275 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
10276 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10277 !! wikitext
10278 {{ROOTPAGENAMEE}}
10279 !! html/*
10280 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10281 </p>
10282 !! end
10283
10284 !! test
10285 Magic Word: {{BASEPAGENAME}}
10286 !! options
10287 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
10288 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10289 !! wikitext
10290 {{BASEPAGENAME}}
10291 !! html/*
10292 <p>Ævar Arnfjörð Bjarmason
10293 </p>
10294 !! end
10295
10296 !! test
10297 Magic Word: {{BASEPAGENAMEE}}
10298 !! options
10299 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
10300 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10301 !! wikitext
10302 {{BASEPAGENAMEE}}
10303 !! html/*
10304 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10305 </p>
10306 !! end
10307
10308 !! test
10309 Magic Word: {{TALKPAGENAME}}
10310 !! options
10311 title=[[User:Ævar Arnfjörð Bjarmason]]
10312 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10313 !! wikitext
10314 {{TALKPAGENAME}}
10315 !! html/*
10316 <p>User talk:Ævar Arnfjörð Bjarmason
10317 </p>
10318 !! end
10319
10320 !! test
10321 Magic Word: {{TALKPAGENAMEE}}
10322 !! options
10323 title=[[User:Ævar Arnfjörð Bjarmason]]
10324 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10325 !! wikitext
10326 {{TALKPAGENAMEE}}
10327 !! html/*
10328 <p>User_talk:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10329 </p>
10330 !! end
10331
10332 !! test
10333 Magic Word: {{SUBJECTPAGENAME}}
10334 !! options
10335 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10336 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10337 !! wikitext
10338 {{SUBJECTPAGENAME}}
10339 !! html/*
10340 <p>User:Ævar Arnfjörð Bjarmason
10341 </p>
10342 !! end
10343
10344 !! test
10345 Magic Word: {{SUBJECTPAGENAMEE}}
10346 !! options
10347 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10348 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10349 !! wikitext
10350 {{SUBJECTPAGENAMEE}}
10351 !! html/*
10352 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10353 </p>
10354 !! end
10355
10356 !! test
10357 Magic Word: {{NUMBEROFFILES}}
10358 !! options
10359 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10360 !! wikitext
10361 {{NUMBEROFFILES}}
10362 !! html/*
10363 <p>7
10364 </p>
10365 !! end
10366
10367 !! test
10368 Magic Word: {{PAGENAME}}
10369 !! options
10370 title=[[User:Ævar Arnfjörð Bjarmason]]
10371 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10372 !! wikitext
10373 {{PAGENAME}}
10374 !! html/*
10375 <p>Ævar Arnfjörð Bjarmason
10376 </p>
10377 !! end
10378
10379 !! test
10380 Magic Word: {{PAGENAME}} with metacharacters
10381 !! options
10382 title=[['foo & bar = baz']]
10383 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10384 !! wikitext
10385 ''{{PAGENAME}}''
10386 !! html/php
10387 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
10388 </p>
10389 !! html+tidy
10390 <p><i>'foo &amp; bar = baz'</i></p>
10391 !! end
10392
10393 !! test
10394 Magic Word: {{PAGENAME}} with metacharacters (T28781)
10395 !! options
10396 title=[[*RFC 1234 http://example.com/]]
10397 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10398 !! wikitext
10399 {{PAGENAME}}
10400 !! html/php
10401 <p>&#42;RFC&#32;1234 http&#58;//example.com/
10402 </p>
10403 !! html+tidy
10404 <p>*RFC 1234 http://example.com/</p>
10405 !! end
10406
10407 !! test
10408 Magic Word: {{PAGENAMEE}}
10409 !! options
10410 title=[[User:Ævar Arnfjörð Bjarmason]]
10411 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10412 !! wikitext
10413 {{PAGENAMEE}}
10414 !! html/*
10415 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10416 </p>
10417 !! end
10418
10419 !! test
10420 Magic Word: {{PAGENAMEE}} with metacharacters (T28781)
10421 !! options
10422 title=[[*RFC 1234 http://example.com/]]
10423 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10424 !! wikitext
10425 {{PAGENAMEE}}
10426 !! html/php
10427 <p>&#42;RFC_1234_http&#58;//example.com/
10428 </p>
10429 !! html+tidy
10430 <p>*RFC_1234_http://example.com/</p>
10431 !! end
10432
10433 !! test
10434 Magic Word: {{REVISIONID}}
10435 !! options
10436 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10437 !! wikitext
10438 {{REVISIONID}}
10439 !! html/*
10440 <p>1337
10441 </p>
10442 !! end
10443
10444 !! test
10445 Magic Word: {{SCRIPTPATH}}
10446 !! options
10447 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10448 !! wikitext
10449 {{SCRIPTPATH}}
10450 !! html/*
10451
10452 !! end
10453
10454 !! test
10455 Magic Word: {{STYLEPATH}}
10456 !! options
10457 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10458 !! wikitext
10459 {{STYLEPATH}}
10460 !! html/*
10461 <p>/skins
10462 </p>
10463 !! end
10464
10465 !! test
10466 Magic Word: {{SERVER}}
10467 !! options
10468 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10469 !! wikitext
10470 {{SERVER}}
10471 !! html/*
10472 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
10473 </p>
10474 !! end
10475
10476 !! test
10477 Magic Word: {{SERVERNAME}}
10478 !! options
10479 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10480 !! wikitext
10481 {{SERVERNAME}}
10482 !! html/*
10483 <p>example.org
10484 </p>
10485 !! end
10486
10487 !! test
10488 Magic Word: {{SITENAME}}
10489 !! options
10490 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10491 !! wikitext
10492 {{SITENAME}}
10493 !! html/*
10494 <p>MediaWiki
10495 </p>
10496 !! end
10497
10498 !! test
10499 Magic Word: {{PAGELANGUAGE}}
10500 !! options
10501 language=fr
10502 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10503 !! wikitext
10504 {{PAGELANGUAGE}}
10505 !! html/*
10506 <p>fr
10507 </p>
10508 !! end
10509
10510 !! test
10511 Magic Word: {{PAGELANGUAGE}} on a page with no explicitly set language
10512 !! options
10513 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10514 !! wikitext
10515 {{PAGELANGUAGE}}
10516 !! html/*
10517 <p>en
10518 </p>
10519 !! end
10520
10521 !! test
10522 Case-sensitive magic words, when cased differently, should just be template transclusions
10523 !! wikitext
10524 {{CurrentMonth}}
10525 {{currentday}}
10526 {{cURreNTweEK}}
10527 {{currentHour}}
10528 !! html
10529 <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>
10530 <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>
10531 <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>
10532 <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>
10533 </p>
10534 !! end
10535
10536 !! test
10537 Case-insensitive magic words should still work with weird casing.
10538 !! wikitext
10539 {{sErVeRNaMe}}
10540 {{LCFirst:AOEU}}
10541 {{ucFIRST:aoeu}}
10542 {{SERver}}
10543 !! html
10544 <p>example.org
10545 aOEU
10546 Aoeu
10547 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
10548 </p>
10549 !! end
10550
10551 # From plwiki:PLOS_ONE
10552 !! test
10553 Parsoid: Page property magic word with magic word contents
10554 !! wikitext
10555 {{DISPLAYTITLE:''{{PAGENAME}}''}}
10556 !! html/parsoid
10557 <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>"}]]}'/>
10558 !! end
10559
10560 # NOTE: mw:ExpandedAttrs is not the best typeof here. mw:Transclusion is better.
10561 # But, this is a limitation of our representation and is documented in
10562 # TemplateHandler.js in processSpecialMagicWord
10563 !! test
10564 Parsoid: Template-generated DISPLAYTITLE
10565 !! wikitext
10566 {{{{echo|DISPLAYTITLE}}:Foo}}
10567 !! options
10568 showtitle
10569 !! config
10570 wgAllowDisplayTitle=true
10571 wgRestrictDisplayTitle=false
10572 !! html/php
10573 Foo
10574
10575 !! html/parsoid
10576 <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"}]]}'/>
10577 !! end
10578
10579 !! test
10580 Namespace 1 {{ns:1}}
10581 !! wikitext
10582 {{ns:1}}
10583 !! html
10584 <p>Talk
10585 </p>
10586 !! end
10587
10588 !! test
10589 Namespace 1 {{ns:01}}
10590 !! wikitext
10591 {{ns:01}}
10592 !! html
10593 <p>Talk
10594 </p>
10595 !! end
10596
10597 !! test
10598 Namespace 0 {{ns:0}} (T6783)
10599 !! wikitext
10600 {{ns:0}}
10601 !! html
10602
10603 !! end
10604
10605 !! test
10606 Namespace 0 {{ns:00}} (T6783)
10607 !! wikitext
10608 {{ns:00}}
10609 !! html
10610
10611 !! end
10612
10613 !! test
10614 Namespace -1 {{ns:-1}}
10615 !! wikitext
10616 {{ns:-1}}
10617 !! html
10618 <p>Special
10619 </p>
10620 !! end
10621
10622 !! test
10623 Namespace User {{ns:User}}
10624 !! wikitext
10625 {{ns:User}}
10626 !! html
10627 <p>User
10628 </p>
10629 !! end
10630
10631 !! test
10632 Namespace User talk {{ns:User_talk}}
10633 !! wikitext
10634 {{ns:User_talk}}
10635 !! html
10636 <p>User talk
10637 </p>
10638 !! end
10639
10640 !! test
10641 Namespace User talk {{ns:uSeR tAlK}}
10642 !! wikitext
10643 {{ns:uSeR tAlK}}
10644 !! html
10645 <p>User talk
10646 </p>
10647 !! end
10648
10649 !! test
10650 Namespace File {{ns:File}}
10651 !! wikitext
10652 {{ns:File}}
10653 !! html
10654 <p>File
10655 </p>
10656 !! end
10657
10658 !! test
10659 Namespace File {{ns:Image}}
10660 !! wikitext
10661 {{ns:Image}}
10662 !! html
10663 <p>File
10664 </p>
10665 !! end
10666
10667 !! test
10668 Namespace (lang=de) Benutzer {{ns:User}}
10669 !! options
10670 language=de
10671 !! wikitext
10672 {{ns:User}}
10673 !! html
10674 <p>Benutzer
10675 </p>
10676 !! end
10677
10678 !! test
10679 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
10680 !! options
10681 language=de
10682 !! wikitext
10683 {{ns:3}}
10684 !! html
10685 <p>Benutzer Diskussion
10686 </p>
10687 !! end
10688
10689 !! test
10690 Urlencode
10691 !! wikitext
10692 {{urlencode:hi world?!}}
10693 {{urlencode:hi world?!|WIKI}}
10694 {{urlencode:hi world?!|PATH}}
10695 {{urlencode:hi world?!|QUERY}}
10696 !! html/php
10697 <p>hi+world%3F%21
10698 hi_world%3F!
10699 hi%20world%3F%21
10700 hi+world%3F%21
10701 </p>
10702 !! end
10703
10704 !! test
10705 Magic Word: prioritize type info over data-parsoid
10706 !! options
10707 parsoid=html2wt
10708 !! html/parsoid
10709 <meta property="mw:PageProp/forcetoc" data-parsoid='{"magicSrc":"__NOTOC__"}'/>
10710 !! wikitext
10711 __FORCETOC__
10712 !! end
10713
10714 !! test
10715 Magic Word: serialize on separate line (parsoid)
10716 !! options
10717 parsoid=wt2wt,html2wt
10718 !! wikitext
10719 foo
10720 __NOTOC__
10721 bar
10722 !! html/parsoid
10723 foo<meta property="mw:PageProp/notoc"/>bar
10724 !! end
10725
10726 !! test
10727 Magic Word: rt non-english wikis
10728 !! options
10729 parsoid=wt2wt
10730 language=de
10731 !! wikitext
10732 __NOEDITSECTION__
10733 !! html/parsoid
10734 <meta property="mw:PageProp/noeditsection" data-parsoid='{"magicSrc":"__NOEDITSECTION__"}'/>
10735 !! end
10736
10737 !!test
10738 __proto__ is treated as normal wikitext (T105997)
10739 !!wikitext
10740 __proto__
10741 !!html
10742 <p>__proto__
10743 </p>
10744 !!end
10745
10746 ###
10747 ### Magic links
10748 ###
10749 !! test
10750 Magic links: internal link to RFC (T2479)
10751 !! wikitext
10752 [[RFC 123]]
10753 !! html/php
10754 <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>
10755 </p>
10756 !! html/parsoid
10757 <p><a rel="mw:WikiLink" href="./RFC_123" title="RFC 123">RFC 123</a></p>
10758 !! end
10759
10760 !! test
10761 Magic links: RFC (T2479)
10762 !! wikitext
10763 RFC 822
10764 !! html/php
10765 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
10766 </p>
10767 !! html/parsoid
10768 <p><a href="//tools.ietf.org/html/rfc822" rel="mw:ExtLink">RFC 822</a></p>
10769 !! end
10770
10771 !! test
10772 Magic links: RFC (T67278)
10773 !! wikitext
10774 This is RFC 822 but thisRFC 822 is not RFC 822linked.
10775 !! html/php
10776 <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.
10777 </p>
10778 !! html/parsoid
10779 <p>This is <a href="//tools.ietf.org/html/rfc822" rel="mw:ExtLink">RFC 822</a> but thisRFC 822 is not RFC 822linked.</p>
10780 !! end
10781
10782 !! test
10783 Magic links: RFC (w/ non-newline whitespace, T30950/T31025)
10784 !! wikitext
10785 RFC &nbsp;&#160;&#0160;&#xA0;&#Xa0; 822
10786 RFC
10787 822
10788 !! html/php
10789 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
10790 RFC
10791 822
10792 </p>
10793 !! html/parsoid
10794 <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>
10795 RFC
10796 822</p>
10797 !! end
10798
10799 !! test
10800 Magic links: ISBN (T3937)
10801 !! wikitext
10802 ISBN 0-306-40615-2
10803 !! html/php
10804 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
10805 </p>
10806 !! html/parsoid
10807 <p><a href="./Special:BookSources/0306406152" rel="mw:WikiLink">ISBN 0-306-40615-2</a></p>
10808 !! end
10809
10810 !! test
10811 Magic links: ISBN (T67278)
10812 !! wikitext
10813 This is ISBN 978-0-316-09811-3 but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.
10814 !! html/php
10815 <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.
10816 </p>
10817 !! html/parsoid
10818 <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>
10819 !! end
10820
10821 !! test
10822 Magic links: ISBN (w/ non-newline whitespace, T30950/T31025)
10823 !! wikitext
10824 ISBN &nbsp;&#160;&#0160;&#xA0;&#Xa0; 978&nbsp;0&#160;316&#0160;09811&#xA0;3
10825 ISBN
10826 9780316098113
10827 ISBN 978
10828 0316098113
10829 !! html/php
10830 <p><a href="/wiki/Special:BookSources/9780316098113" class="internal mw-magiclink-isbn">ISBN 978 0 316 09811 3</a>
10831 ISBN
10832 9780316098113
10833 ISBN 978
10834 0316098113
10835 </p>
10836 !! html/parsoid
10837 <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>
10838 ISBN
10839 9780316098113
10840 ISBN 978
10841 0316098113</p>
10842 !! end
10843
10844 !! test
10845 Magic links: PMID incorrectly converts space to underscore
10846 !! wikitext
10847 PMID 1234
10848 !! html/php
10849 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
10850 </p>
10851 !! html/parsoid
10852 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract" rel="mw:ExtLink">PMID 1234</a></p>
10853 !! end
10854
10855 !! test
10856 Magic links: PMID (T67278)
10857 !! wikitext
10858 This is PMID 1234 but thisPMID 1234 is not PMID 1234linked.
10859 !! html/php
10860 <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.
10861 </p>
10862 !! html/parsoid
10863 <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>
10864 !! end
10865
10866 !! test
10867 Magic links: PMID (w/ non-newline whitespace, T30950/T31025)
10868 !! wikitext
10869 PMID &nbsp;&#160;&#0160;&#xA0;&#Xa0; 1234
10870 PMID
10871 1234
10872 !! html/php
10873 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
10874 PMID
10875 1234
10876 </p>
10877 !! html/parsoid
10878 <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>
10879 PMID
10880 1234</p>
10881 !! end
10882
10883 # <nowiki> nodes shouldn't be inserted during html2wt by Parsoid,
10884 # since these are ExtLinkText, not MagicLinkText
10885 !! test
10886 Magic links: use appropriate serialization for "almost" magic links.
10887 !! wikitext
10888 X[[Special:BookSources/0978739256|foo]]
10889
10890 X[//tools.ietf.org/html/rfc1234 foo]
10891 !! html/php
10892 <p>X<a href="/wiki/Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a>
10893 </p><p>X<a rel="nofollow" class="external text" href="//tools.ietf.org/html/rfc1234">foo</a>
10894 </p>
10895 !! html/parsoid
10896 <p>X<a rel="mw:WikiLink" href="./Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a></p>
10897 <p>X<a rel="mw:ExtLink" href="//tools.ietf.org/html/rfc1234">foo</a></p>
10898 !! end
10899
10900 !! test
10901 Magic links: All disabled (T47942)
10902 !! options
10903 wgEnableMagicLinks={"ISBN":false, "PMID":false, "RFC":false}
10904 !! wikitext
10905 ISBN 0-306-40615-2
10906 PMID 1234
10907 RFC 4321
10908 !! html/php
10909 <p>ISBN 0-306-40615-2
10910 PMID 1234
10911 RFC 4321
10912 </p>
10913 !! end
10914
10915 ###
10916 ### Templates
10917 ####
10918
10919 !! test
10920 Nonexistent template
10921 !! wikitext
10922 {{thistemplatedoesnotexist}}
10923 !! html
10924 <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>
10925 </p>
10926 !! end
10927
10928 !! test
10929 Template with invalid target containing tags
10930 !! wikitext
10931 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
10932 !! html
10933 <p>{{a<b>b</b>|foo|a=b|a = b}}
10934 </p>
10935 !! end
10936
10937 !! test
10938 Template with invalid target containing unclosed tag
10939 !! wikitext
10940 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
10941 !! html
10942 <p>{{a<b>|foo|a=b|a = b}}</b>
10943 </p>
10944 !! end
10945
10946 !! test
10947 Template with invalid target containing wikilink
10948 !! wikitext
10949 {{[[Main Page]]}}
10950 !! html/php
10951 <p>{{<a href="/wiki/Main_Page" title="Main Page">Main Page</a>}}
10952 </p>
10953 !! html/parsoid
10954 <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>
10955 !! end
10956
10957 !! test
10958 Template with just whitespace in it, T70421
10959 !! wikitext
10960 {{echo|{{ }}}}
10961 !! html/parsoid
10962 <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>
10963 !! end
10964
10965 !! article
10966 Template:test
10967 !! text
10968 This is a test template
10969 !! endarticle
10970
10971 !! test
10972 Simple template
10973 !! wikitext
10974 {{test}}
10975 !! html
10976 <p>This is a test template
10977 </p>
10978 !! end
10979
10980 !! test
10981 Template with explicit namespace
10982 !! wikitext
10983 {{Template:test}}
10984 !! html
10985 <p>This is a test template
10986 </p>
10987 !! end
10988
10989
10990 !! article
10991 Template:paramtest
10992 !! text
10993 This is a test template with parameter {{{param}}}
10994 !! endarticle
10995
10996 !! test
10997 Template parameter
10998 !! wikitext
10999 {{paramtest|param=foo}}
11000 !! html
11001 <p>This is a test template with parameter foo
11002 </p>
11003 !! end
11004
11005 !! article
11006 Template:paramtestnum
11007 !! text
11008 [[{{{1}}}|{{{2}}}]]
11009 !! endarticle
11010
11011 !! test
11012 Template unnamed parameter
11013 !! wikitext
11014 {{paramtestnum|Main Page|the main page}}
11015 !! html
11016 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
11017 </p>
11018 !! end
11019
11020 !! article
11021 Template:templatesimple
11022 !! text
11023 (test)
11024 !! endarticle
11025
11026 !! article
11027 Template:templateredirect
11028 !! text
11029 #redirect [[Template:templatesimple]]
11030 !! endarticle
11031
11032 !! article
11033 Template:templateasargtestnum
11034 !! text
11035 {{{{{1}}}}}
11036 !! endarticle
11037
11038 !! article
11039 Template:templateasargtest
11040 !! text
11041 {{template{{{templ}}}}}
11042 !! endarticle
11043
11044 !! article
11045 Template:templateasargtest2
11046 !! text
11047 {{{{{templ}}}}}
11048 !! endarticle
11049
11050 !! test
11051 Template with template name as unnamed argument
11052 !! wikitext
11053 {{templateasargtestnum|templatesimple}}
11054 !! html
11055 <p>(test)
11056 </p>
11057 !! end
11058
11059 !! test
11060 Template with template name as argument
11061 !! wikitext
11062 {{templateasargtest|templ=simple}}
11063 !! html
11064 <p>(test)
11065 </p>
11066 !! end
11067
11068 !! test
11069 Template with template name as argument (2)
11070 !! wikitext
11071 {{templateasargtest2|templ=templatesimple}}
11072 !! html
11073 <p>(test)
11074 </p>
11075 !! end
11076
11077 !! article
11078 Template:templateasargtestdefault
11079 !! text
11080 {{{{{templ|templatesimple}}}}}
11081 !! endarticle
11082
11083 !! article
11084 Template:templa
11085 !! text
11086 '''templ'''
11087 !! endarticle
11088
11089 !! test
11090 Template with default value
11091 !! wikitext
11092 {{templateasargtestdefault}}
11093 !! html
11094 <p>(test)
11095 </p>
11096 !! end
11097
11098 !! test
11099 Template with default value (value set)
11100 !! wikitext
11101 {{templateasargtestdefault|templ=templa}}
11102 !! html
11103 <p><b>templ</b>
11104 </p>
11105 !! end
11106
11107 !! test
11108 Template redirect
11109 !! wikitext
11110 {{templateredirect}}
11111 !! html/php
11112 <p>(test)
11113 </p>
11114 !! html/parsoid
11115 <link rel="mw:PageProp/redirect" href="./Template:Templatesimple" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"templateredirect","href":"./Template:Templateredirect"},"params":{},"i":0}}]}'/>
11116 !! end
11117
11118 !! test
11119 Template with argument in separate line
11120 !! wikitext
11121 {{ templateasargtest |
11122 templ = simple }}
11123 !! html
11124 <p>(test)
11125 </p>
11126 !! end
11127
11128 !! test
11129 Template with complex template as argument
11130 !! wikitext
11131 {{paramtest|
11132 param ={{ templateasargtest |
11133 templ = simple }}}}
11134 !! html
11135 <p>This is a test template with parameter (test)
11136 </p>
11137 !! end
11138
11139 !! test
11140 Templates with templated name
11141 !! wikitext
11142 {{{{echo|echo}}|foo}}
11143 {{{{echo|inner list}} }}
11144 !! html
11145 <p>foo
11146 </p>
11147 <ul><li> item 1</li></ul>
11148
11149 !! html/parsoid
11150 <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>
11151 <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>
11152 !! end
11153
11154 # Parsoid markup is deliberate "broken". This is an edge case.
11155 # See long comment in TemplateHandler.js:convertAttribsToString.
11156 !! test
11157 Templates with invalid templated targets
11158 !! wikitext
11159 {{echo
11160 {{echo|foo}}
11161 }}
11162 !! html/php
11163 <p>{{echo
11164 foo
11165 }}
11166 </p>
11167 !! html/parsoid
11168 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo\n{{echo|foo}}\n"},"params":{},"i":0}}]}'>{{echo
11169 foo }}</p>
11170 !! end
11171
11172 !! test
11173 Template with thumb image (with link in description)
11174 !! wikitext
11175 {{paramtest|param=[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
11176 !! html/php
11177 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>
11178
11179 !! html+tidy
11180 <p>This is a test template with parameter</p>
11181 <div class="thumb tright">
11182 <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>
11183 <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>
11184 </div>
11185 </div>
11186 !! html/parsoid
11187 <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>
11188 !! end
11189
11190 !! article
11191 Template:complextemplate
11192 !! text
11193 {{{1}}} {{paramtest|
11194 param ={{{param}}}}}
11195 !! endarticle
11196
11197 !! test
11198 Template with complex arguments
11199 !! wikitext
11200 {{complextemplate|
11201 param ={{ templateasargtest |
11202 templ = simple }}|[[Template:complextemplate|link]]}}
11203 !! html
11204 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
11205 </p>
11206 !! end
11207
11208 !! test
11209 T2553: link with two variables in a piped link
11210 !! wikitext
11211 {|
11212 |[[{{{1}}}|{{{2}}}]]
11213 |}
11214 !! html/php
11215 <table>
11216 <tr>
11217 <td>[[{{{1}}}|{{{2}}}]]
11218 </td></tr></table>
11219
11220 !! html/parsoid
11221 <table>
11222 <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>
11223 </tbody></table>
11224 !! end
11225
11226 # See: T2553
11227 !! test
11228 Abort table cell attribute parsing on wikilink
11229 !! wikitext
11230 {|
11231 | testing [[one|two]] | three || four
11232 | testing one two | three || four
11233 | testing="[[one|two]]" | three || four
11234 |}
11235 !! html/php
11236 <table>
11237 <tr>
11238 <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>
11239 <td> four
11240 </td>
11241 <td> three </td>
11242 <td> four
11243 </td>
11244 <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>
11245 <td> four
11246 </td></tr></table>
11247
11248 !! html/parsoid
11249 <table>
11250 <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>
11251 <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>
11252 <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>
11253 </tbody></table>
11254 !! end
11255
11256 !! test
11257 Don't abort table cell attribute parsing if wikilink is found in template arg
11258 !! wikitext
11259 {|
11260 | Test {{#tag:ref|One two "[[three]]" four}}
11261 |}
11262 !! html/parsoid
11263 <table>
11264 <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>
11265 </tbody></table>
11266 !! end
11267
11268 !! test
11269 Magic variable as template parameter
11270 !! wikitext
11271 {{paramtest|param={{SITENAME}}}}
11272 !! html
11273 <p>This is a test template with parameter MediaWiki
11274 </p>
11275 !! end
11276
11277 !! article
11278 Template:linktest
11279 !! text
11280 [[{{{param}}}|link]]
11281 !! endarticle
11282
11283 !! test
11284 Template parameter as link source
11285 !! wikitext
11286 {{linktest|param=Main Page}}
11287 !! html
11288 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
11289 </p>
11290 !! end
11291
11292 !!article
11293 Template:paramtest2
11294 !! text
11295 including another template, {{paramtest|param={{{arg}}}}}
11296 !! endarticle
11297
11298 !! test
11299 Template passing argument to another template
11300 !! wikitext
11301 {{paramtest2|arg='hmm'}}
11302 !! html
11303 <p>including another template, This is a test template with parameter 'hmm'
11304 </p>
11305 !! end
11306
11307 !! article
11308 Template:Linktest2
11309 !! text
11310 Main Page
11311 !! endarticle
11312
11313 !! test
11314 Template as link source
11315 !! wikitext
11316 [[{{linktest2}}]]
11317
11318 [[{{linktest2}}|Main Page]]
11319
11320 [[{{linktest2}}]]Page
11321 !! html
11322 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
11323 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
11324 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
11325 </p>
11326 !! end
11327
11328
11329 !! article
11330 Template:loop1
11331 !! text
11332 {{loop2}}
11333 !! endarticle
11334
11335 !! article
11336 Template:loop2
11337 !! text
11338 {{loop1}}
11339 !! endarticle
11340
11341 !! test
11342 Template infinite loop
11343 !! wikitext
11344 {{loop1}}
11345 !! html
11346 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
11347 </p>
11348 !! end
11349
11350 !! test
11351 Template from main namespace
11352 !! wikitext
11353 {{:Main Page}}
11354 !! html
11355 <p>blah blah
11356 </p>
11357 !! end
11358
11359 !! article
11360 Template:table
11361 !! text
11362 {|
11363 | 1 || 2
11364 |-
11365 | 3 || 4
11366 |}
11367 !! endarticle
11368
11369 !! test
11370 T2529: Template with table, not included at beginning of line
11371 !! wikitext
11372 foo {{table}}
11373 !! html
11374 <p>foo
11375 </p>
11376 <table>
11377 <tr>
11378 <td> 1 </td>
11379 <td> 2
11380 </td></tr>
11381 <tr>
11382 <td> 3 </td>
11383 <td> 4
11384 </td></tr></table>
11385
11386 !! end
11387
11388 !! test
11389 T2523: Template shouldn't eat newline (or add an extra one before table)
11390 !! wikitext
11391 foo
11392 {{table}}
11393 !! html
11394 <p>foo
11395 </p>
11396 <table>
11397 <tr>
11398 <td> 1 </td>
11399 <td> 2
11400 </td></tr>
11401 <tr>
11402 <td> 3 </td>
11403 <td> 4
11404 </td></tr></table>
11405
11406 !! end
11407
11408 !! test
11409 T2041: Template parameters shown as broken links
11410 !! wikitext
11411 {{{parameter}}}
11412 !! html
11413 <p>{{{parameter}}}
11414 </p>
11415 !! end
11416
11417 !! test
11418 Template with targets containing wikilinks
11419 !! options
11420 parsoid=wt2html
11421 !! wikitext
11422 {{[[foo]]}}
11423
11424 {{[[{{echo|foo}}]]}}
11425
11426 {{{{echo|[[foo}}]]}}
11427 !! html/php
11428 <p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
11429 </p><p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
11430 </p><p>{{[[foo}}]]
11431 </p>
11432 !! html/parsoid
11433 <p>{{<a rel="mw:WikiLink" href="./Foo" title="Foo">foo</a>}}</p>
11434 <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>
11435 <p>{{<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[foo}}]]"}},"i":0}}]}'>[[foo}}]]</span></p>
11436 !! end
11437
11438 !! article
11439 Template:''
11440 !! text
11441 bar
11442 !! endarticle
11443
11444 !! test
11445 Templates: Double quotes as template target
11446 !! wikitext
11447 foo {{''}} baz
11448 !! html/php
11449 <p>foo bar baz
11450 </p>
11451 !! html/parsoid
11452 <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
11453 </p>
11454 !! end
11455
11456 ## This test is about making sure Parsoid's data-mw is well formed in the
11457 ## face of multiple templates with intersecting and overlapping ranges. The
11458 ## wikitext itself is wretched.
11459 !! test
11460 Templates with intersecting and overlapping ranges
11461 !! wikitext
11462 {|{{echo|
11463 <p>ha</p>}}
11464 {|{{echo|
11465 <p>ho</p>}}
11466 {{echo|{{!}}hi}}
11467 |}
11468 !! html/php+tidy
11469 <p>ha</p>
11470 <p>ho</p>
11471 <table>
11472 <tr>
11473 <td></td>
11474 </tr>
11475 <tr>
11476 <td>hi</td>
11477 </tr>
11478 </table>
11479 <table>
11480 <tr>
11481 <td></td>
11482 </tr>
11483 </table>
11484 !! html/parsoid
11485 <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":""}]]}'>
11486
11487 </table><p about="#mwt1">ho</p><table about="#mwt1" typeof="mw:ExpandedAttrs" data-mw='{"attribs":[[{"txt":"","html":""},{"html":""}]]}'>
11488
11489 <tbody><tr><td>hi</td></tr>
11490 </tbody></table>
11491 !! end
11492
11493 !! article
11494 Template:MSGNW test
11495 !! text
11496 ''None'' of '''this''' should be
11497 * interpreted
11498 but rather passed unmodified
11499 {{test}}
11500 <gallery>
11501 File:Foobar.jpg
11502 </gallery>
11503 <!-- comment -->
11504 !! endarticle
11505
11506 # hmm, fix this or just deprecate msgnw and document its behavior?
11507 !! test
11508 msgnw keyword
11509 !! wikitext
11510 {{msgnw:MSGNW test}}
11511 !! html/php
11512 <p>&#39;&#39;None&#39;&#39; of &#39;&#39;&#39;this&#39;&#39;&#39; should be
11513 &#42; interpreted
11514 &#32;but rather passed unmodified
11515 &#123;&#123;test&#125;&#125;
11516 &#60;gallery&#62;
11517 File:Foobar.jpg
11518 &#60;/gallery&#62;
11519 &#60;!-- comment --&#62;
11520 </p>
11521 !! end
11522
11523 !! test
11524 int keyword
11525 !! wikitext
11526 {{int:youhavenewmessages|lots of money|not!}}
11527 !! html
11528 <p>You have lots of money (not!).
11529 </p>
11530 !! end
11531
11532 !! test
11533 int keyword - non-existing message
11534 !! wikitext
11535 {{int:var}}
11536 !! html
11537 <p>⧼var⧽
11538 </p>
11539 !! end
11540
11541 !! article
11542 Template:Includes
11543 !! text
11544 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
11545 !! endarticle
11546
11547 !! test
11548 <includeonly> and <noinclude> being included
11549 !! wikitext
11550 {{Includes}}
11551 !! html
11552 <p>Foobar
11553 </p>
11554 !! end
11555
11556 !! article
11557 Template:Includes2
11558 !! text
11559 <onlyinclude>Foo</onlyinclude>bar
11560 !! endarticle
11561
11562 !! test
11563 <onlyinclude> being included
11564 !! wikitext
11565 {{Includes2}}
11566 !! html
11567 <p>Foo
11568 </p>
11569 !! end
11570
11571
11572 !! article
11573 Template:Includes3
11574 !! text
11575 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
11576 !! endarticle
11577
11578 !! test
11579 <onlyinclude> and <includeonly> being included
11580 !! wikitext
11581 {{Includes3}}
11582 !! html
11583 <p>Foo
11584 </p>
11585 !! end
11586
11587 !! test
11588 <includeonly> and <noinclude> on a page
11589 !! wikitext
11590 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
11591 !! html
11592 <p>Foozar
11593 </p>
11594 !! end
11595
11596 !! test
11597 Un-closed <noinclude>
11598 !! wikitext
11599 <noinclude>
11600 !! html
11601 !! end
11602
11603 !! test
11604 <onlyinclude> on a page
11605 !! wikitext
11606 <onlyinclude>Foo</onlyinclude>bar
11607 !! html
11608 <p>Foobar
11609 </p>
11610 !! end
11611
11612 !! test
11613 Un-closed <onlyinclude>
11614 !! wikitext
11615 <onlyinclude>
11616 !! html
11617 !! end
11618
11619 !!test
11620 Self-closed noinclude, includeonly, onlyinclude tags
11621 !! wikitext
11622 <noinclude />
11623 <includeonly />
11624 <onlyinclude />
11625 !! html
11626 <p><br />
11627 </p>
11628 !!end
11629
11630 !!test
11631 Unbalanced includeonly and noinclude tags
11632 !! wikitext
11633 {|
11634 |a</noinclude>
11635 |b</noinclude></noinclude>
11636 |c</noinclude></includeonly>
11637 |d</includeonly></includeonly>
11638 |}
11639 !! html
11640 <table>
11641 <tr>
11642 <td>a
11643 </td>
11644 <td>b
11645 </td>
11646 <td>c&lt;/includeonly&gt;
11647 </td>
11648 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
11649 </td></tr></table>
11650
11651 !!end
11652
11653 !! article
11654 Template:Includeonly section
11655 !! text
11656 <includeonly>
11657 ==Includeonly section==
11658 </includeonly>
11659 ==Section T-1==
11660 !!endarticle
11661
11662 !! test
11663 T8563: Edit link generation for section shown by <includeonly>
11664 !! wikitext
11665 {{includeonly section}}
11666 !! html
11667 <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>
11668 <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>
11669
11670 !! end
11671
11672 # Uses same input as the contents of [[Template:Includeonly section]]
11673 !! test
11674 T8563: Section extraction for section shown by <includeonly>
11675 !! options
11676 section=T-2
11677 !! wikitext
11678 <includeonly>
11679 ==Includeonly section==
11680 </includeonly>
11681 ==Section T-2==
11682 !! html
11683 ==Section T-2==
11684 !! end
11685
11686 !! test
11687 T8563: Edit link generation for section suppressed by <includeonly>
11688 !! wikitext
11689 <includeonly>
11690 ==Includeonly section==
11691 </includeonly>
11692 ==Section 1==
11693 !! html
11694 <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>
11695
11696 !! end
11697
11698 !! test
11699 T8563: Section extraction for section suppressed by <includeonly>
11700 !! options
11701 section=1
11702 !! wikitext
11703 <includeonly>
11704 ==Includeonly section==
11705 </includeonly>
11706 ==Section 1==
11707 !! html
11708 ==Section 1==
11709 !! end
11710
11711 !! test
11712 Un-closed <includeonly>
11713 !! wikitext
11714 <includeonly>
11715 !! html/php
11716 !! html/parsoid
11717 <meta typeof="mw:Includes/IncludeOnly" data-parsoid='{"src":"&lt;includeonly>"}'/>
11718 !! end
11719
11720 ## We used to, but no longer wt2wt this test since the default serializer
11721 ## will normalize the include directives to serialize on their own line.
11722 ## Selser will take care of preserving formatting in scenarios where they
11723 ## intermingled with other wikitext.
11724 !! test
11725 Includes and comments at SOL
11726 !! options
11727 parsoid=wt2html,html2html
11728 !! wikitext
11729 <!-- comment --><noinclude><!-- comment --></noinclude><!-- comment -->== hu ==
11730
11731 <noinclude>
11732 some
11733 </noinclude>* stuff
11734 * here
11735
11736 <includeonly>can have stuff</includeonly>=== here ===
11737
11738 !! html/php
11739 <h2><span class="mw-headline" id="hu">hu</span></h2>
11740 <p>some
11741 </p>
11742 <ul><li> stuff</li>
11743 <li> here</li></ul>
11744 <h3><span class="mw-headline" id="here">here</span></h3>
11745
11746 !! html/parsoid
11747 <!-- 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>
11748
11749 <meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/>
11750 <p>some</p>
11751 <meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"&lt;/noinclude>"}'/><ul><li> stuff</li>
11752 <li> here</li></ul>
11753
11754 <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>
11755
11756 !! end
11757
11758 # TODO: test with DOM fragment reuse!
11759 !! test
11760 Parsoid: DOM fragment reuse
11761 !! options
11762 parsoid=wt2wt,wt2html
11763 !! wikitext
11764 a{{echo|b<table></table>c}}d
11765
11766 a{{echo|b
11767 <table></table>
11768 c}}d
11769
11770 {{echo|a
11771
11772 <table></table>
11773
11774 b}}
11775 !! html
11776 <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>
11777
11778 <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">
11779 </span><table about="#mwt2" data-parsoid='{"stx":"html"}'></table><span about="#mwt2">
11780 </span><p about="#mwt2">cd</p>
11781
11782 <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">
11783
11784 </span><table about="#mwt3" data-parsoid='{"stx":"html"}'></table><span about="#mwt3">
11785
11786 </span><p about="#mwt3">b</p>
11787 !! end
11788
11789 !! test
11790 Parsoid: Merge double tds (T52603)
11791 !! options
11792 parsoid
11793 !! wikitext
11794 {|
11795 |{{echo|{{!}} foo}}
11796 |}
11797 !! html
11798 <table><tbody>
11799 <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>
11800 </tbody></table>
11801 !! end
11802
11803 !! test
11804 Parsoid: Merge double tds in nested transclusion content (T52603)
11805 !! options
11806 parsoid
11807 !! wikitext
11808 {{echo|<div>}}
11809 {|
11810 |{{echo|{{!}} foo}}
11811 |}
11812 {{echo|</div>}}
11813 !! html
11814 <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}}]}'>
11815 <table><tbody>
11816 <tr><td data-mw='{"parts":["|"]}'> foo</td></tr>
11817 </tbody></table>
11818 </div>
11819 !! end
11820
11821 ###
11822 ### <includeonly> and <noinclude> in attributes
11823 ###
11824 !!test
11825 0. includeonly around the entire attribute
11826 !! wikitext
11827 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
11828 !! html
11829 <p><span id="v2">bar</span>
11830 </p>
11831 !!end
11832
11833 !!test
11834 1. includeonly in html attr key
11835 !! wikitext
11836 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
11837 !! html
11838 <p><span id="foo">bar</span>
11839 </p>
11840 !!end
11841
11842 !!test
11843 2. includeonly in html attr value
11844 !! wikitext
11845 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
11846 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
11847 !! html
11848 <p><span id="v1">bar</span>
11849 <span id="v1">bar</span>
11850 </p>
11851 !!end
11852
11853 !!test
11854 3. includeonly in part of an attr value
11855 !! wikitext
11856 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
11857 !! html
11858 <p><span style="color:red;">bar</span>
11859 </p>
11860 !!end
11861
11862 !!test
11863 4. includeonly in table attributes
11864 !! wikitext
11865 {|
11866 |- <noinclude>
11867 |-
11868 |a
11869 </noinclude>
11870 |- <includeonly>
11871 |-
11872 |b
11873 </includeonly>
11874 |}
11875 !! html
11876 <table>
11877
11878
11879 <tr>
11880 <td>a
11881 </td></tr>
11882 </table>
11883
11884 !!end
11885
11886 ###
11887 ### Preprocessor precedence tests
11888 ### See: https://www.mediawiki.org/wiki/Preprocessor_ABNF
11889 ###
11890 ##{{[[-{{{{{{[[Foo|bar}}]]}-}}}}}]]
11891 !! test
11892 Preprocessor precedence 1: link is rightmost opening
11893 !! wikitext
11894 {{[[Foo|bar}}]]
11895
11896 But close-brace is not a valid character in a link title:
11897 {{[[Foo}}|bar]]
11898
11899 However, we can still tell this was handled as a link in the preprocessor:
11900 {{echo|[[Foo}}|bar]]|bat}}
11901 !! html
11902 <p>{{<a href="/wiki/Foo" title="Foo">bar}}</a>
11903 </p><p>But close-brace is not a valid character in a link title:
11904 {{[[Foo}}|bar]]
11905 </p><p>However, we can still tell this was handled as a link in the preprocessor:
11906 [[Foo}}|bar]]
11907 </p>
11908 !! end
11909
11910 !! test
11911 Preprocessor precedence 2: template is rightmost opening
11912 !! options
11913 language=zh
11914 !! wikitext
11915 -{{echo|foo}-}}-
11916 !! html
11917 <p>-foo}--
11918 </p>
11919 !! end
11920
11921 !! test
11922 Preprocessor precedence 3: language converter is rightmost opening
11923 !! options
11924 language=zh
11925 !! wikitext
11926 {{echo|hi}}
11927
11928 {{-{R|echo|hi}}}-
11929
11930 [[-{R|raw]]}-
11931 !! html
11932 <p>hi
11933 </p><p>{{echo|hi}}
11934 </p><p>[[raw]]
11935 </p>
11936 !! end
11937
11938 !! test
11939 Preprocessor precedence 4: left-most angle bracket
11940 !! options
11941 language=zh
11942 !! wikitext
11943 <!--{raw}-->
11944 !! html
11945 !! end
11946
11947 !! article
11948 Template:Precedence5
11949 !! text
11950 {{{{{1}}}}}
11951 !! endarticle
11952
11953 !! test
11954 Preprocessor precedence 5: tplarg takes precedence over template
11955 !! wikitext
11956 {{Precedence5|Bullet}}
11957 !! html
11958 <ul><li> Bar</li></ul>
11959
11960 !! end
11961
11962 !! test
11963 Preprocessor precedence 6: broken link is rightmost opening
11964 !! wikitext
11965 {{echo|[[Foo}}
11966
11967 {{echo|[[Foo|bar|bat=baz}}
11968 !! html
11969 <p>{{echo|[[Foo}}
11970 </p><p>{{echo|[[Foo|bar|bat=baz}}
11971 </p>
11972 !! end
11973
11974 # This next test exposes a difference between PHP and Parsoid:
11975 # Given [[Foo|{{echo|Bar]]x}}y]]z:
11976 # 1) Both PHP and Parsoid ignore the `]]` inside the `echo` in the
11977 # "preprocessor" stage. The `{{echo` extends until the `x}}`, and the
11978 # outer `[[Foo` extends until the `y]]`
11979 # 2a) But then the PHP preprocessor emits `[[Foo|Bar]]xy]]z` as an
11980 # intermediate result (after template expansion), and link processing
11981 # happens on this intermediate result, which moves the wikilink
11982 # boundary leftward to `[[Foo|Bar]]`
11983 # 2b) Parsoid works in a single step, so it's going to keep the
11984 # wikilink as extending to the `y]]`
11985 # 3a) Then PHP does linktrail processing which slurps up the trailing
11986 # `xy` inside the link.
11987 # 3b) Parsoid will do linktrail processing to slurp up the trailing
11988 # `z` inside the link.
11989 # This is "correct" behavior. Parsoid's basic worldview is that the
11990 # `]]` inside the template shouldn't be allowed to leak out to affect
11991 # the surrounding wikilink. PHP may match Parsoid (in the future)
11992 # if you use {{#balance}} (T114445).
11993
11994 !! test
11995 Preprocessor precedence 7: broken template is rightmost opening
11996 !! wikitext
11997 [[Foo|{{echo|Bar]]
11998
11999 [[Foo|{{echo|Bar]]-x}}-y]]-z
12000
12001 Careful: linktrails can move the end of the wikilink:
12002 [[Foo|{{echo|y']]a}}l]]l
12003 !! html
12004 <p><a href="/wiki/Foo" title="Foo">{{echo|Bar</a>
12005 </p><p><a href="/wiki/Foo" title="Foo">Bar</a>-x-y]]-z
12006 </p><p>Careful: linktrails can move the end of the wikilink:
12007 <a href="/wiki/Foo" title="Foo">y'al</a>]]l
12008 </p>
12009 !! end
12010
12011 !! test
12012 Preprocessor precedence 8: broken language converter is rightmost opening
12013 !! options
12014 language=zh
12015 !! wikitext
12016 [[Foo-{R|raw]]
12017 !! html
12018 <p>[[Foo-{R|raw]]
12019 </p>
12020 !! end
12021
12022 !! article
12023 Template:Preprocessor_precedence_9
12024 !! text
12025 ;4: {{{{1}}}}
12026 ;5: {{{{{2}}}}}
12027 ;6: {{{{{{3}}}}}}
12028 ;7: {{{{{{{4}}}}}}}
12029 !! endarticle
12030
12031 !! test
12032 Preprocessor precedence 9: groups of braces
12033 !! wikitext
12034 {{Preprocessor precedence 9|Four|Bullet|1|2}}
12035 !! html
12036 <dl><dt>4</dt>
12037 <dd> {Four}</dd>
12038 <dt>5</dt>
12039 <dd> </dd></dl>
12040 <ul><li> Bar</li></ul>
12041 <dl><dt>6</dt>
12042 <dd> Four</dd>
12043 <dt>7</dt>
12044 <dd> {Bullet}</dd></dl>
12045
12046 !! end
12047
12048 !! article
12049 Template:Preprocessor_precedence_10
12050 !! text
12051 ;1: -{R|raw}-
12052 ;2: -{{Bullet}}-
12053 ;3: -{{{1}}}-
12054 ;4: -{{{{2}}}}-
12055 ;5: -{{{{{3}}}}}-
12056 ;6: -{{{{{{4}}}}}}-
12057 ;7: -{{{{{{{5}}}}}}}-
12058 !! endarticle
12059
12060 !! test
12061 Preprocessor precedence 10: groups of braces with leading dash
12062 !! options
12063 language=zh
12064 !! wikitext
12065 {{Preprocessor precedence 10|Three|raw2|Bullet|1|2}}
12066 !! html
12067 <dl><dt>1</dt>
12068 <dd> raw</dd>
12069 <dt>2</dt>
12070 <dd> -</dd></dl>
12071 <ul><li> Bar-</li></ul>
12072 <dl><dt>3</dt>
12073 <dd> -Three-</dd>
12074 <dt>4</dt>
12075 <dd> raw2</dd>
12076 <dt>5</dt>
12077 <dd> -</dd></dl>
12078 <ul><li> Bar-</li></ul>
12079 <dl><dt>6</dt>
12080 <dd> -Three-</dd>
12081 <dt>7</dt>
12082 <dd> raw2</dd></dl>
12083
12084 !! end
12085
12086 !! test
12087 Preprocessor precedence 11: found during visual diff testing
12088 !! wikitext
12089 {{#tag:span|-{{#tag:span|-{{echo|x}}}}}}
12090
12091 {{echo|-{{echo|-{{echo|x}}}}}}
12092
12093 {{echo|-{{echo|x}}}}
12094 !! html
12095 <p><span>-<span>-x</span></span>
12096 </p><p>--x
12097 </p><p>-x
12098 </p>
12099 !! end
12100
12101 !! test
12102 Preprocessor precedence 12: broken language converter closed by brace.
12103 !! wikitext
12104 This form breaks the template, which is unfortunate:
12105 * {{echo|foo-{bar}bat}}
12106
12107 But if the broken language converter markup is inside an extension
12108 tag, nothing bad happens:
12109 * <nowiki>foo-{bar}bat</nowiki>
12110 * {{echo|<nowiki>foo-{bar}bat</nowiki>}}
12111 * <pre>foo-{bar}bat</pre>
12112 * {{echo|<pre>foo-{bar}bat</pre>}}
12113
12114 <tag>foo-{bar}bat</tag>
12115 {{echo|<tag>foo-{bar}bat</tag>}}
12116
12117 !! html+tidy
12118 <p>This form breaks the template, which is unfortunate:</p>
12119 <ul>
12120 <li>{{echo|foo-{bar}bat}}</li>
12121 </ul>
12122 <p>But if the broken language converter markup is inside an extension tag, nothing bad happens:</p>
12123 <ul>
12124 <li>foo-{bar}bat</li>
12125 <li>foo-{bar}bat</li>
12126 <li>
12127 <pre>
12128 foo-{bar}bat
12129 </pre></li>
12130 <li>
12131 <pre>
12132 foo-{bar}bat
12133 </pre></li>
12134 </ul>
12135 <pre>
12136 'foo-{bar}bat'
12137 array (
12138 )
12139 </pre>
12140 <pre>
12141 'foo-{bar}bat'
12142 array (
12143 )
12144 </pre>
12145 !! end
12146
12147 !! test
12148 Preprocessor precedence, 13: broken language converter in external link
12149 !! wikitext
12150 * [http://example.com/-{foo Example in URL]
12151 * [http://example.com Example in -{link} description]
12152 * {{echo|[http://example.com/-{foo Breaks template, however]}}
12153 !! html+tidy
12154 <ul>
12155 <li><a rel="nofollow" class="external text" href="http://example.com/-{foo">Example in URL</a></li>
12156 <li><a rel="nofollow" class="external text" href="http://example.com">Example in -{link} description</a></li>
12157 <li>{{echo|<a rel="nofollow" class="external text" href="http://example.com/-{foo">Breaks template, however</a>}}</li>
12158 </ul>
12159 !! end
12160
12161 !! test
12162 Preprocessor precedence, 14: broken language converter in comment
12163 !! wikitext
12164 * <!--{{foo}}--> ...should be ok
12165 * <!---{{foo}}--> ...extra dashes
12166 * {{echo|foo<!-- -{bar} -->bat}} ...should be ok
12167 !! html+tidy
12168 <ul>
12169 <li>...should be ok</li>
12170 <li>...extra dashes</li>
12171 <li>foobat ...should be ok</li>
12172 </ul>
12173 !! end
12174
12175 !! test
12176 Preprocessor precedence, 15: broken brace markup in headings
12177 !! wikitext
12178 __NOTOC__ __NOEDITSECTION__
12179 ===1 foo[bar 1===
12180 1
12181 ===2 foo[[bar 2===
12182 2
12183 ===3 foo{bar 3===
12184 3
12185 ===4 foo{{bar 4===
12186 4
12187 ===5 foo{{{bar 5===
12188 5
12189 ===6 foo-{bar 6===
12190 6
12191 !! html+tidy
12192 <h3><span class="mw-headline" id="1_foo.5Bbar_1">1 foo[bar 1</span></h3>
12193 <p>1</p>
12194 <h3><span class="mw-headline" id="2_foo.5B.5Bbar_2">2 foo[[bar 2</span></h3>
12195 <p>2</p>
12196 <h3><span class="mw-headline" id="3_foo.7Bbar_3">3 foo{bar 3</span></h3>
12197 <p>3</p>
12198 <h3><span class="mw-headline" id="4_foo.7B.7Bbar_4">4 foo{{bar 4</span></h3>
12199 <p>4</p>
12200 <h3><span class="mw-headline" id="5_foo.7B.7B.7Bbar_5">5 foo{{{bar 5</span></h3>
12201 <p>5</p>
12202 <h3><span class="mw-headline" id="6_foo-.7Bbar_6">6 foo-{bar 6</span></h3>
12203 <p>6</p>
12204 !! end
12205
12206 ###
12207 ### Token Stream Patcher tests
12208 ###
12209 ### These tests won't always pass wt2wt and other modes because
12210 ### on serialization, the table will be output on a new line.
12211 ### For now, we are blacklisting them, and using this to test selser.
12212 ###
12213
12214 !!test
12215 1. Table tag in SOL posn. should get reparsed correctly with valid TSR
12216 !!options
12217 parsoid=wt2html,wt2wt
12218 !!wikitext
12219 {{echo|}}{| width = '100%'
12220 |foo
12221 |}
12222 !!html/parsoid
12223 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":""}},"i":0}}]}'></span><table width="100%">
12224 <tbody><tr><td>foo</td></tr>
12225 </tbody></table>
12226 !!end
12227
12228 ## We used to, but no longer wt2wt this test since the default serializer
12229 ## will normalize the include directives to serialize on their own line.
12230 ## Selser will take care of preserving formatting in scenarios where they
12231 ## intermingled with other wikitext.
12232 !!test
12233 2. Table tag in SOL posn. should get reparsed correctly with valid TSR
12234 !!options
12235 parsoid=wt2html
12236 !!wikitext
12237 <includeonly>a</includeonly>{| {{{b}}}
12238 |c
12239 |}
12240 !!html/parsoid
12241 <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":""}]]}'>
12242 <tbody><tr><td>c</td></tr>
12243 </tbody></table>
12244 !!end
12245
12246 !! test
12247 Table wikitext syntax outside wiki-tables
12248 !! wikitext
12249 a
12250 |+ not a caption
12251 ! not a table heading
12252 |- not a table row
12253 | not a table cell
12254 | class="foo bar" | baz
12255 b
12256 |}
12257 |-
12258 c
12259 !! html
12260 <p>a
12261 |+ not a caption
12262 ! not a table heading
12263 |- not a table row
12264 | not a table cell
12265 | class="foo bar" | baz
12266 b
12267 |}
12268 |-
12269 c
12270 </p>
12271 !! end
12272
12273 ###
12274 ### Testing parsing of templates where a template arg
12275 ### has the same name as the template itself.
12276 ###
12277
12278 !! article
12279 Template:quote
12280 !! text
12281 {{{quote|{{{1}}}}}}
12282 !! endarticle
12283
12284 !!test
12285 Templates: Template Name/Arg clash: 1. Use of positional param
12286 !! wikitext
12287 {{quote|foo}}
12288 !! html
12289 <p>foo
12290 </p>
12291 !!end
12292
12293 !!test
12294 Templates: Template Name/Arg clash: 2. Use of named param
12295 !! wikitext
12296 {{quote|quote=foo}}
12297 !! html
12298 <p>foo
12299 </p>
12300 !!end
12301
12302 !!test
12303 Templates: Template Name/Arg clash: 3. Use of named param with empty input
12304 !! wikitext
12305 {{quote|quote}}
12306 !! html
12307 <p>quote
12308 </p>
12309 !!end
12310
12311 ###
12312 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
12313 ###
12314
12315 !!test
12316 Templates: 1. Simple use
12317 !! wikitext
12318 {{echo|Foo}}
12319 !! html
12320 <p>Foo
12321 </p>
12322 !!end
12323
12324 !!test
12325 Templates: 2. Inside a block tag
12326 !! wikitext
12327 <div>{{echo|Foo}}</div>
12328 <blockquote>{{echo|Foo}}</blockquote>
12329 !! html
12330 <div>Foo</div>
12331 <blockquote>Foo</blockquote>
12332
12333 !! html+tidy
12334 <div>Foo</div>
12335 <blockquote>
12336 <p>Foo</p>
12337 </blockquote>
12338 !!end
12339
12340 !!test
12341 Templates: P-wrapping: 1a. Templates on consecutive lines
12342 !! wikitext
12343 {{echo|Foo}}
12344 {{echo|bar}}
12345 !! html
12346 <p>Foo
12347 bar
12348 </p>
12349 !!end
12350
12351 !!test
12352 Templates: P-wrapping: 1b. Templates on consecutive lines
12353 !! wikitext
12354 Foo
12355
12356 {{echo|bar}}
12357 {{echo|baz}}
12358 !! html
12359 <p>Foo
12360 </p><p>bar
12361 baz
12362 </p>
12363 !!end
12364
12365 !!test
12366 Templates: P-wrapping: 1c. Templates on consecutive lines
12367 !! wikitext
12368 {{echo|Foo}}
12369 {{echo|bar}} <div>baz</div>
12370 !! html
12371 <p>Foo
12372 </p>
12373 bar <div>baz</div>
12374
12375 !! html+tidy
12376 <p>Foo</p>
12377 <p>bar</p>
12378 <div>baz</div>
12379 !! end
12380
12381 !!test
12382 Templates: P-wrapping: 1d. Template preceded by comment-only line
12383 !!options
12384 parsoid
12385 !! wikitext
12386 <!-- foo -->
12387 {{echo|Bar}}
12388 !! html
12389 <!-- foo -->
12390
12391 <p about="#mwt223" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Bar"}},"i":0}}]}'>Bar</p>
12392 !!end
12393
12394 !!test
12395 Templates: Inline Text: 1. Multiple template uses
12396 !! wikitext
12397 {{echo|Foo}}bar{{echo|baz}}
12398 !! html
12399 <p>Foobarbaz
12400 </p>
12401 !!end
12402
12403 !!test
12404 Templates: Inline Text: 2. Back-to-back template uses
12405 !! wikitext
12406 {{echo|Foo}}{{echo|bar}}
12407 !! html
12408 <p>Foobar
12409 </p>
12410 !!end
12411
12412 !!test
12413 Templates: Block Tags: 1. Multiple template uses
12414 !! wikitext
12415 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
12416 !! html
12417 <div>Foo</div><div>bar</div><div>baz</div>
12418
12419 !!end
12420
12421 !!test
12422 Templates: Block Tags: 2. Back-to-back template uses
12423 !! wikitext
12424 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
12425 !! html
12426 <div>Foo</div><div>bar</div>
12427
12428 !!end
12429
12430 # This is an edge case relating to paragraph wrapping.
12431 !!test
12432 Templates: Correctly encapsulate templates producing </p> tag without a corresponding <p> tag
12433 !! wikitext
12434 {{echo|a
12435 b</p>}}
12436 !! html/parsoid
12437 <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
12438 b</p>
12439 !!end
12440
12441 !!test
12442 Templates: Links: 1. Simple example
12443 !! wikitext
12444 {{echo|[[Foo|bar]]}}
12445 !! html
12446 <p><a href="/wiki/Foo" title="Foo">bar</a>
12447 </p>
12448 !!end
12449
12450 !!test
12451 Templates: Links: 2. Generation of link href
12452 !! wikitext
12453 [[{{echo|Foo}}|bar]]
12454 !! html
12455 <p><a href="/wiki/Foo" title="Foo">bar</a>
12456 </p>
12457 !!end
12458
12459 !!test
12460 Templates: Links: 3. Generation of part of a link href
12461 !! wikitext
12462 [[Fo{{echo|o}}|bar]]
12463
12464 [[Foo{{echo|bar}}]]
12465
12466 [[Foo{{echo|bar}}baz]]
12467
12468 [[Foo{{echo|bar}}|bar]]
12469
12470 [[:Foo{{echo|bar}}]]
12471
12472 [[:Foo{{echo|bar}}|bar]]
12473 !! html
12474 <p><a href="/wiki/Foo" title="Foo">bar</a>
12475 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
12476 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
12477 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
12478 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
12479 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
12480 </p>
12481 !!end
12482
12483 !!test
12484 Templates: Links: 4. Multiple templates generating link href
12485 !! wikitext
12486 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
12487 !! html
12488 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
12489 </p>
12490 !!end
12491
12492 !!test
12493 Templates: Links: 5. Generation of link text
12494 !! wikitext
12495 [[Foo|{{echo|bar}}]]
12496 !! html
12497 <p><a href="/wiki/Foo" title="Foo">bar</a>
12498 </p>
12499 !!end
12500
12501 !!test
12502 Templates: Links: 5. Nested templates (only outermost template should be marked)
12503 !! wikitext
12504 {{echo|[[{{echo|Foo}}|bar]]}}
12505 !! html
12506 <p><a href="/wiki/Foo" title="Foo">bar</a>
12507 </p>
12508 !!end
12509
12510 !!test
12511 Templates: HTML Tag: 1. Generation of HTML attr. key
12512 !! wikitext
12513 <div {{echo|style}}="color:red;">foo</div>
12514 !! html
12515 <div style="color:red;">foo</div>
12516
12517 !!end
12518
12519 !!test
12520 Templates: HTML Tag: 2. Generation of HTML attr. value
12521 !! wikitext
12522 <div style={{echo|'color:red;'}}>foo</div>
12523 !! html
12524 <div style="color:red;">foo</div>
12525
12526 !!end
12527
12528 !!test
12529 Templates: HTML Tag: 3. Generation of HTML attr key and value
12530 !! wikitext
12531 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
12532 !! html
12533 <div style="color:red;">foo</div>
12534
12535 !!end
12536
12537 !!test
12538 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
12539 !! wikitext
12540 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
12541 !! html
12542 <div title="This is a long title with just one piece templated">foo</div>
12543
12544 !!end
12545
12546 !!test
12547 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
12548 !! wikitext
12549 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
12550 !! html
12551 <div title="This is a long title with just one piece templated">foo</div>
12552
12553 !!end
12554
12555 !!test
12556 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
12557 !! wikitext
12558 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
12559 !! html
12560 <div title="This is a long title with just one piece templated">foo</div>
12561
12562 !!end
12563
12564 # SSS FIXME: While it is great we added support for all this,
12565 # do we want to make this part of the spec? Maybe we want to
12566 # deprecate this kind of usage in the future?
12567 !!test
12568 Templates: HTML Tag: 7. Generation of partial attribute key string
12569 !! wikitext
12570 <div st{{echo|yle}}="color:red;">foo</div>
12571 !! html
12572 <div style="color:red;">foo</div>
12573
12574 !!end
12575
12576 !! test
12577 Templates: HTML Tag: 8. Template-generated attribute (k=v)
12578 !! wikitext
12579 <div {{echo|1=id="v1"}}>bar</div>
12580 !! html
12581 <div id="v1">bar</div>
12582
12583 !!end
12584
12585 !! test
12586 Templates: HTML Tag: 9. Multiple template-generated attributes
12587 !! wikitext
12588 <div {{echo|1=id="v1" title="foo"}}>bar</div>
12589 !! html
12590 <div id="v1" title="foo">bar</div>
12591
12592 !!end
12593
12594 !! test
12595 Templates: Support for templates generating attributes and content
12596 !! wikitext
12597 {| {{mixed_attr_content_template}}
12598 |-
12599 |bar
12600 |}
12601 !! html/php
12602 <table style="color:red;" title="T48811">
12603
12604 <tr>
12605 <td>foo
12606 </td></tr>
12607 <tr>
12608 <td>bar
12609 </td></tr></table>
12610
12611 !! html/parsoid
12612 <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|}"]}'>
12613 <tbody><tr>
12614 <td>foo</td></tr>
12615 <tr>
12616 <td>bar</td></tr>
12617 </tbody></table>
12618 !!end
12619
12620 !! test
12621 1. Entities and nowikis inside templated attributes should be handled correctly
12622 !! wikitext
12623 <div {{echo|style{{=}}"background:&#35;f9f9f9;"}}>foo</div>
12624 !! html/php
12625 <div style="background:#f9f9f9;">foo</div>
12626
12627 !! html/parsoid
12628 <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>
12629 !! end
12630
12631 !! test
12632 2. Entities and nowikis inside templated attributes should be handled correctly
12633 !! wikitext
12634 {|
12635 |{{table_attribs_3}}
12636 |}
12637 !! html/php
12638 <table>
12639 <tr>
12640 <td style="background:#f9f9f9;">Foo
12641 </td></tr></table>
12642
12643 !! html/parsoid
12644 <table>
12645 <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>
12646 </tbody></table>
12647 !! end
12648
12649 !! test
12650 3. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
12651 !! wikitext
12652 {{tbl-start}}
12653 |{{table_attribs_3}}
12654 {{tbl-end}}
12655 !! html/php
12656 <table>
12657 <tr>
12658 <td style="background:#f9f9f9;">Foo
12659 </td></tr></table>
12660
12661 !! html/parsoid
12662 <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}}]}'>
12663 <tbody><tr><td style="background:#f9f9f9;">Foo</td></tr>
12664 </tbody></table>
12665 !! end
12666
12667 # T107622
12668 !! test
12669 4. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
12670 !! wikitext
12671 {|
12672 | {{table_attribs_6}} hi
12673 |}
12674 !! html/php
12675 <table>
12676 <tr>
12677 <td style="background: red;"> hi
12678 </td></tr></table>
12679
12680 !! html/parsoid
12681 <table>
12682 <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>
12683 </tbody></table>
12684 !! end
12685
12686 !!test
12687 Templates: HTML Tables: 1. Generating start of a HTML table
12688 !! wikitext
12689 {{echo|<table><tr><td>foo</td>}}</tr></table>
12690 !! html
12691 <table><tr><td>foo</td></tr></table>
12692
12693 !!end
12694
12695 !!test
12696 Templates: HTML Tables: 2a. Generating middle of a HTML table
12697 !! wikitext
12698 <table><tr>{{echo|<td>foo</td>}}</tr></table>
12699 !! html
12700 <table><tr><td>foo</td></tr></table>
12701
12702 !!end
12703
12704 !!test
12705 Templates: HTML Tables: 2b. Generating middle of a HTML table
12706 !! wikitext
12707 <table>{{echo|<tr><td>foo</td></tr>}}</table>
12708 !! html
12709 <table><tr><td>foo</td></tr></table>
12710
12711 !!end
12712
12713 !!test
12714 Templates: HTML Tables: 3. Generating end of a HTML table
12715 !! wikitext
12716 <table><tr>{{echo|<td>foo</td></tr></table>}}
12717 !! html
12718 <table><tr><td>foo</td></tr></table>
12719
12720 !!end
12721
12722 !!test
12723 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
12724 !! wikitext
12725 {{echo|<table>}}<tr><td>foo</td></tr></table>
12726 !! html
12727 <table><tr><td>foo</td></tr></table>
12728
12729 !!end
12730
12731 !!test
12732 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
12733 !! wikitext
12734 <table>{{echo|<tr>}}<td>foo</td></tr></table>
12735 !! html
12736 <table><tr><td>foo</td></tr></table>
12737
12738 !!end
12739
12740 !!test
12741 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
12742 !! wikitext
12743 <table><tr>{{echo|<td>}}foo</td></tr></table>
12744 !! html
12745 <table><tr><td>foo</td></tr></table>
12746
12747 !!end
12748
12749 !!test
12750 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
12751 !! wikitext
12752 <table><tr><td>foo{{echo|</td>}}</tr></table>
12753 !! html
12754 <table><tr><td>foo</td></tr></table>
12755
12756 !!end
12757
12758 !!test
12759 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
12760 !! wikitext
12761 <table><tr><td>foo</td>{{echo|</tr>}}</table>
12762 !! html
12763 <table><tr><td>foo</td></tr></table>
12764
12765 !!end
12766
12767 !!test
12768 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
12769 !! wikitext
12770 <table><tr><td>foo</td></tr>{{echo|</table>}}
12771 !! html
12772 <table><tr><td>foo</td></tr></table>
12773
12774 !!end
12775
12776 !!test
12777 Templates: HTML Tables: 5. Proper fostering of categories from inside
12778 !!options
12779 parsoid=wt2html,wt2wt
12780 !! wikitext
12781 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
12782 <!--Two categories (T52330)-->
12783 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
12784 !! html
12785 <link rel="mw:PageProp/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
12786 <!--Two categories (T52330)-->
12787 <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>
12788 !!end
12789
12790 !!test
12791 Templates: Wiki Tables: 1a. Fostering of entire template content
12792 !! wikitext
12793 {|
12794 {{echo|a}}
12795 |}
12796 !! html
12797 <table>
12798 a
12799 <tr><td></td></tr></table>
12800
12801 !! html+tidy
12802 <p>a</p>
12803 <table>
12804 <tr>
12805 <td></td>
12806 </tr>
12807 </table>
12808 !! end
12809
12810 !!test
12811 Templates: Wiki Tables: 1b. Fostering of entire template content
12812 !! wikitext
12813 {|
12814 {{echo|<div>}}
12815 foo
12816 {{echo|</div>}}
12817 |}
12818 !! html
12819 <table>
12820 <div>
12821 <p>foo
12822 </p>
12823 </div>
12824 <tr><td></td></tr></table>
12825
12826 !! html+tidy
12827 <div>
12828 <p>foo</p>
12829 </div>
12830 <table>
12831 <tr>
12832 <td></td>
12833 </tr>
12834 </table>
12835 !! end
12836
12837 !!test
12838 Templates: Wiki Tables: 2. Fostering of partial template content
12839 !! wikitext
12840 {|
12841 {{echo|a
12842 <div>b</div>}}
12843 |}
12844 !! html
12845 <table>
12846 a
12847 <div>b</div>
12848 <tr><td></td></tr></table>
12849
12850 !! html+tidy
12851 <p>a</p>
12852 <div>b</div>
12853 <table>
12854 <tr>
12855 <td></td>
12856 </tr>
12857 </table>
12858 !! end
12859
12860 !!test
12861 Templates: Wiki Tables: 3. td-content via multiple templates
12862 !! wikitext
12863 {|
12864 {{echo|{{pipe}}a}}{{echo|b}}
12865 |}
12866 !! html
12867 <table>
12868 <tr>
12869 <td>ab
12870 </td></tr></table>
12871
12872 !!end
12873
12874 !!test
12875 Templates: Wiki Tables: 4. Templated tags, no content
12876 !! wikitext
12877 {{tbl-start}}
12878 {{tbl-end}}
12879 !! html
12880 <table>
12881 <tr><td></td></tr></table>
12882
12883 !!end
12884
12885 !!test
12886 Templates: Wiki Tables: 5. Templated tags, regular td-tags
12887 !! wikitext
12888 {{tbl-start}}
12889 |foo
12890 {{tbl-end}}
12891 !! html
12892 <table>
12893 <tr>
12894 <td>foo
12895 </td></tr></table>
12896
12897 !!end
12898
12899 !!test
12900 Templates: Wiki Tables: 6. Templated tags, templated td-tags
12901 !! wikitext
12902 {{tbl-start}}
12903 {{!}}foo
12904 {{tbl-end}}
12905 !! html
12906 <table>
12907 <tr>
12908 <td>foo
12909 </td></tr></table>
12910
12911 !!end
12912
12913 ## This test case is very specific to Parsoid's internals
12914 ## and is hence only tested for Parsoid's code. Parsoid uses
12915 ## a <meta> marker tag for <ref> tags and they are expanded
12916 ## much later. We are verifying that this <meta> tag usage
12917 ## doesn't prevent foster parenting.
12918 !!test
12919 Templates: Wiki Tables: 7. Fosterable <ref>s should get fostered
12920 !!wikitext
12921 {{PartialTable}}<ref>foo</ref>
12922 |}
12923
12924 <references />
12925 !!html/parsoid
12926 <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">
12927 <tbody>
12928 </tbody></table>
12929
12930 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><a href="./Main_Page#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo</span></li></ol>
12931 !!end
12932
12933 !! test
12934 Templates: Wiki Tables: 8. Fosterable meta-tags should get fostered
12935 !! wikitext
12936 {{echo|
12937 {{{!}}
12938 {{!}}-}}
12939 <onlyinclude>
12940 |foo
12941 </onlyinclude>
12942 {{!}}}
12943 !! html/parsoid
12944 <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{{!}}}"]}'>
12945 </span><meta typeof="mw:Includes/OnlyInclude" about="#mwt1"/><table about="#mwt1">
12946 <tbody><tr>
12947
12948 <td>foo
12949 <meta typeof="mw:Includes/OnlyInclude/End"/></td></tr>
12950 </tbody></table>
12951 !! end
12952
12953 !!test
12954 Templates: Lists: Multi-line list-items via templates
12955 !! wikitext
12956 *{{echo|a {{nonexistent|
12957 unused}}}}
12958 *{{echo|b {{nonexistent|
12959 unused}}}}
12960 !! html
12961 <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>
12962 <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>
12963
12964 !!end
12965
12966 !!test
12967 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
12968 !! wikitext
12969 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
12970 !! html
12971 <p><i>ab</i>c<i>d</i>e
12972 </p>
12973 !!end
12974
12975 !!test
12976 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
12977 (PHP parser generates misnested html)
12978 !! wikitext
12979 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
12980 !! html/parsoid
12981 <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>
12982 !!end
12983
12984 !!test
12985 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
12986 (PHP parser generates misnested html; Parsoid html2wt mode adds newlines between {{echo}}s)
12987 !! options
12988 parsoid=wt2html,wt2wt
12989 !! wikitext
12990 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
12991 !! html
12992 <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>
12993 <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>
12994 <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>
12995 !!end
12996
12997 !!test
12998 Templates: Ugly nesting: 4. Divs opened/closed across templates
12999 !! wikitext
13000 a<div>b{{echo|c</div>d}}e
13001 !! html
13002 a<div>bc</div>de
13003
13004 !! html+tidy
13005 <p>a</p>
13006 <div>bc</div>
13007 <p>de</p>
13008 !! end
13009
13010 !!test
13011 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
13012 (Parsoid-centric)
13013 !! options
13014 parsoid
13015 !! wikitext
13016 {|
13017 |{{echo|foo</table>}}
13018 |bar
13019 |}
13020 !! html
13021 <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|}"]}'>
13022
13023 <tbody>
13024 <tr>
13025 <td>foo</td></tr></tbody></table><span about="#mwt1">
13026 </span><span about="#mwt1">|bar</span><span about="#mwt1">
13027 |}</span>
13028 !!end
13029
13030 !!test
13031 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
13032 (Parsoid-centric)
13033 !! options
13034 parsoid
13035 !! wikitext
13036 <table>
13037 <tr>
13038 <td>
13039 <table>
13040 <tr>
13041 <td>1. {{echo|foo </table>}}</td>
13042 <td> bar </td>
13043 <td>2. {{echo|baz </table>}}</td>
13044 </tr>
13045 <tr>
13046 <td>abc</td>
13047 </tr>
13048 </table>
13049 </td>
13050 </tr>
13051 <tr>
13052 <td>xyz</td>
13053 </tr>
13054 </table>
13055 !! html
13056 <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>"]}'>
13057 <tbody><tr>
13058 <td>
13059 <table>
13060 <tbody><tr>
13061 <td>1. foo </td></tr></tbody></table></td>
13062 <td> bar </td>
13063 <td>2. baz </td></tr></tbody></table><span about="#mwt2">
13064 </span><span about="#mwt2">
13065 </span><span about="#mwt2">
13066 </span><span about="#mwt2">abc</span><span about="#mwt2">
13067 </span><span about="#mwt2">
13068 </span><span about="#mwt2">
13069 </span><span about="#mwt2">
13070 </span><span about="#mwt2">
13071 </span><span about="#mwt2">
13072 </span><span about="#mwt2">xyz</span><span about="#mwt2">
13073 </span><span about="#mwt2">
13074 </span>
13075 !!end
13076
13077 !! test
13078 Templates: Ugly templates: 3. newline-only template parameter
13079 !! wikitext
13080 foo {{echo|
13081 }}
13082 !! html
13083 <p>foo
13084 </p>
13085 !! end
13086
13087 # This looks like a bug: a single newline triggers p/br for some reason.
13088 !! test
13089 Templates: Ugly templates: 4. newline-only template parameter inconsistency
13090 !! wikitext
13091 {{echo|
13092 }}
13093 !! html
13094 <p><br />
13095 </p>
13096 !! end
13097
13098 # T66017 -- ugly wikitext with fostered content generates two template ranges that
13099 # have a true overlap (T1-start - T2-start - T1-end - T2-end).
13100 !! test
13101 Templates: Ugly templates: 5. Template encapsulation test: Non-trivial overlap of template ranges is properly handled
13102 !! wikitext
13103 {{echo|<table>}}
13104 {{echo|<div>foo}}
13105 {{echo|</table>}}
13106 !! html/parsoid
13107 <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
13108 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
13109 </table>
13110 !! end
13111
13112 # T66017 -- ugly wikitext with fostered content generates two template ranges
13113 # that are "identical" and generate nesting cycles in the algorithm
13114 !! test
13115 Templates: Ugly templates: 6. Template encapsulation test: Cyclical nesting of template ranges is properly handled
13116 !! wikitext
13117 {{echo|<table><tr><td><table>}}
13118 {{echo|<div>}}
13119 {{echo|</div>}}
13120 !! html/parsoid
13121 <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"}'>
13122 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
13123 </table></td></tr></tbody></table>
13124 !! end
13125
13126 !! test
13127 Templates: Parameters substituted at the top-level
13128 !! wikitext
13129 {{{foo|''who'' {{echo|me}}? '''never!'''}}}
13130
13131 {{{foo|bar|baz}}}
13132 !! html/php
13133 <p><i>who</i> me? <b>never!</b>
13134 </p><p>bar
13135 </p>
13136 !! html/parsoid
13137 <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>
13138
13139 <p about="#mwt3" typeof="mw:Param" data-mw='{"parts":[{"templatearg":{"target":{"wt":"foo"},"params":{"1":{"wt":"bar"},"2":{"wt":"baz"}},"i":0}}]}'>bar</p>
13140 !! end
13141
13142 !!test
13143 Parser Functions: 1. Simple example
13144 !! wikitext
13145 {{uc:foo}}
13146 !! html
13147 <p>FOO
13148 </p>
13149 !!end
13150
13151 !!test
13152 Parser Functions: 2. Nested use (only outermost should be marked up)
13153 !! wikitext
13154 {{uc:{{lc:FOO}}}}
13155 !! html
13156 <p>FOO
13157 </p>
13158 !!end
13159
13160 ###
13161 ### Pre-save transform tests
13162 ###
13163 !! test
13164 pre-save transform: subst:
13165 !! options
13166 pst
13167 !! wikitext
13168 {{subst:test}}
13169 !! html/php
13170 This is a test template
13171 !! end
13172
13173 !! test
13174 pre-save transform: normal template
13175 !! options
13176 pst
13177 !! wikitext
13178 {{test}}
13179 !! html/php
13180 {{test}}
13181 !! end
13182
13183 !! test
13184 pre-save transform: nonexistent template
13185 !! options
13186 pst
13187 !! wikitext
13188 {{thistemplatedoesnotexist}}
13189 !! html/php
13190 {{thistemplatedoesnotexist}}
13191 !! end
13192
13193 !! test
13194 pre-save transform: subst magic variables
13195 !! options
13196 pst
13197 !! wikitext
13198 {{subst:SITENAME}}
13199 !! html/php
13200 MediaWiki
13201 !! end
13202
13203 # This is T2089, which I fixed. -- wtm
13204 !! test
13205 pre-save transform: subst: templates with parameters
13206 !! options
13207 pst
13208 !! wikitext
13209 {{subst:paramtest|param="something else"}}
13210 !! html/php
13211 This is a test template with parameter "something else"
13212 !! end
13213
13214 !! article
13215 Template:nowikitest
13216 !! text
13217 <nowiki>'''not wiki'''</nowiki>
13218 !! endarticle
13219
13220 !! test
13221 pre-save transform: nowiki in subst (T3188)
13222 !! options
13223 pst
13224 !! wikitext
13225 {{subst:nowikitest}}
13226 !! html/php
13227 <nowiki>'''not wiki'''</nowiki>
13228 !! end
13229
13230 !! article
13231 Template:commenttest
13232 !! text
13233 This template has <!-- a comment --> in it.
13234 !! endarticle
13235
13236 !! test
13237 pre-save transform: comment in subst (T3936)
13238 !! options
13239 pst
13240 !! wikitext
13241 {{subst:commenttest}}
13242 !! html/php
13243 This template has <!-- a comment --> in it.
13244 !! end
13245
13246 !! test
13247 pre-save transform: unclosed tag
13248 !! options
13249 pst
13250 !! wikitext
13251 <nowiki>'''not wiki'''
13252 !! html/php
13253 <nowiki>'''not wiki'''
13254 !! end
13255
13256 !! test
13257 pre-save transform: mixed tag case
13258 !! options
13259 pst
13260 !! wikitext
13261 <NOwiki>'''not wiki'''</noWIKI>
13262 !! html/php
13263 <NOwiki>'''not wiki'''</noWIKI>
13264 !! end
13265
13266 !! test
13267 pre-save transform: unclosed comment in <nowiki>
13268 !! options
13269 pst
13270 !! wikitext
13271 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
13272 !! html/php
13273 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
13274 !!end
13275
13276 # Leading @ in this template definition works around a limitation
13277 # in parsoid's parserTests which otherwise strips the <span> from the
13278 # result (confusing it for a template wrapper)
13279 !! article
13280 Template:dangerous
13281 !!text
13282 @<span onmouseover="alert('crap')">Oh no</span>
13283 !!endarticle
13284
13285 !!test
13286 (confirming safety of fix for subst T3936)
13287 !! wikitext
13288 {{Template:dangerous}}
13289 !! html
13290 <p>@<span>Oh no</span>
13291 </p>
13292 !! end
13293
13294 !! test
13295 pre-save transform: comment containing gallery (T7024)
13296 !! options
13297 pst
13298 !! wikitext
13299 <!-- <gallery>data</gallery> -->
13300 !! html/php
13301 <!-- <gallery>data</gallery> -->
13302 !!end
13303
13304 !! test
13305 pre-save transform: comment containing extension
13306 !! options
13307 pst
13308 !! wikitext
13309 <!-- <tag>data</tag> -->
13310 !! html/php
13311 <!-- <tag>data</tag> -->
13312 !!end
13313
13314 !! test
13315 pre-save transform: comment containing nowiki
13316 !! options
13317 pst
13318 !! wikitext
13319 <!-- <nowiki>data</nowiki> -->
13320 !! html/php
13321 <!-- <nowiki>data</nowiki> -->
13322 !!end
13323
13324 !! test
13325 pre-save transform: <noinclude> in subst (T5298)
13326 !! options
13327 pst
13328 !! wikitext
13329 {{subst:Includes}}
13330 !! html/php
13331 Foobar
13332 !! end
13333
13334 !! test
13335 pre-save transform: <onlyinclude> in subst (T5298)
13336 !! options
13337 pst
13338 !! wikitext
13339 {{subst:Includes2}}
13340 !! html/php
13341 Foo
13342 !! end
13343
13344 !! article
13345 Template:SubstTest
13346 !!text
13347 {{<includeonly>subst:</includeonly>Includes}}
13348 !! endarticle
13349
13350 !! article
13351 Template:SafeSubstTest
13352 !! text
13353 {{<includeonly>safesubst:</includeonly>Includes}}
13354 !! endarticle
13355
13356 !! test
13357 T24297: safesubst: works during PST
13358 !! options
13359 pst
13360 !! wikitext
13361 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
13362 !! html/php
13363 FoobarFoobar
13364 !! end
13365
13366 !! test
13367 T24297: safesubst: works during normal parse
13368 !! wikitext
13369 {{SafeSubstTest}}
13370 !! html
13371 <p>Foobar
13372 </p>
13373 !! end
13374
13375 !! test
13376 subst: does not work during normal parse
13377 !! wikitext
13378 {{SubstTest}}
13379 !! html
13380 <p>{{subst:Includes}}
13381 </p>
13382 !! end
13383
13384 !! test
13385 pre-save transform: context links ("pipe trick")
13386 !! options
13387 pst
13388 !! wikitext
13389 [[Article (context)|]]
13390 [[Bar:Article|]]
13391 [[:Bar:Article|]]
13392 [[Bar:Article (context)|]]
13393 [[:Bar:Article (context)|]]
13394 [[|Article]]
13395 [[|Article (context)]]
13396 [[Bar:X (Y) Z|]]
13397 [[:Bar:X (Y) Z|]]
13398 !! html/php
13399 [[Article (context)|Article]]
13400 [[Bar:Article|Article]]
13401 [[:Bar:Article|Article]]
13402 [[Bar:Article (context)|Article]]
13403 [[:Bar:Article (context)|Article]]
13404 [[Article]]
13405 [[Article (context)]]
13406 [[Bar:X (Y) Z|X (Y) Z]]
13407 [[:Bar:X (Y) Z|X (Y) Z]]
13408 !! end
13409
13410 !! test
13411 pre-save transform: context links ("pipe trick") with interwiki prefix
13412 !! options
13413 pst
13414 !! wikitext
13415 [[interwiki:Article|]]
13416 [[:interwiki:Article|]]
13417 [[interwiki:Bar:Article|]]
13418 [[:interwiki:Bar:Article|]]
13419 !! html/php
13420 [[interwiki:Article|Article]]
13421 [[:interwiki:Article|Article]]
13422 [[interwiki:Bar:Article|Bar:Article]]
13423 [[:interwiki:Bar:Article|Bar:Article]]
13424 !! end
13425
13426 !! test
13427 pre-save transform: context links ("pipe trick") with parens in title
13428 !! options
13429 pst title=[[Somearticle (context)]]
13430 !! wikitext
13431 [[|Article]]
13432 !! html/php
13433 [[Article (context)|Article]]
13434 !! end
13435
13436 !! test
13437 pre-save transform: context links ("pipe trick") with comma in title
13438 !! options
13439 pst title=[[Someplace, Somewhere]]
13440 !! wikitext
13441 [[|Otherplace]]
13442 [[Otherplace, Elsewhere|]]
13443 [[Otherplace, Elsewhere, Anywhere|]]
13444 !! html/php
13445 [[Otherplace, Somewhere|Otherplace]]
13446 [[Otherplace, Elsewhere|Otherplace]]
13447 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
13448 !! end
13449
13450 !! test
13451 pre-save transform: context links ("pipe trick") with parens and comma
13452 !! options
13453 pst title=[[Someplace (IGNORED), Somewhere]]
13454 !! wikitext
13455 [[|Otherplace]]
13456 [[Otherplace (place), Elsewhere|]]
13457 !! html/php
13458 [[Otherplace, Somewhere|Otherplace]]
13459 [[Otherplace (place), Elsewhere|Otherplace]]
13460 !! end
13461
13462 !! test
13463 pre-save transform: context links ("pipe trick") with comma and parens
13464 !! options
13465 pst title=[[Who, me? (context)]]
13466 !! wikitext
13467 [[|Yes, you.]]
13468 [[Me, Myself, and I (1937 song)|]]
13469 !! html/php
13470 [[Yes, you. (context)|Yes, you.]]
13471 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
13472 !! end
13473
13474 !! test
13475 pre-save transform: context links ("pipe trick") with namespace
13476 !! options
13477 pst title=[[Ns:Somearticle]]
13478 !! wikitext
13479 [[|Article]]
13480 !! html/php
13481 [[Ns:Article|Article]]
13482 !! end
13483
13484 !! test
13485 pre-save transform: context links ("pipe trick") with namespace and parens
13486 !! options
13487 pst title=[[Ns:Somearticle (context)]]
13488 !! wikitext
13489 [[|Article]]
13490 !! html/php
13491 [[Ns:Article (context)|Article]]
13492 !! end
13493
13494 !! test
13495 pre-save transform: context links ("pipe trick") with namespace and comma
13496 !! options
13497 pst title=[[Ns:Somearticle, Context, Whatever]]
13498 !! wikitext
13499 [[|Article]]
13500 !! html/php
13501 [[Ns:Article, Context, Whatever|Article]]
13502 !! end
13503
13504 !! test
13505 pre-save transform: context links ("pipe trick") with namespace, comma and parens
13506 !! options
13507 pst title=[[Ns:Somearticle, Context (context)]]
13508 !! wikitext
13509 [[|Article]]
13510 !! html/php
13511 [[Ns:Article (context)|Article]]
13512 !! end
13513
13514 !! test
13515 pre-save transform: context links ("pipe trick") with namespace, parens and comma
13516 !! options
13517 pst title=[[Ns:Somearticle (IGNORED), Context]]
13518 !! wikitext
13519 [[|Article]]
13520 !! html/php
13521 [[Ns:Article, Context|Article]]
13522 !! end
13523
13524 !! test
13525 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, T32149)
13526 !! options
13527 pst
13528 !! wikitext
13529 [[Article(context)|]]
13530 [[Bar:Article(context)|]]
13531 [[:Bar:Article(context)|]]
13532 [[|Article(context)]]
13533 [[Bar:X(Y)Z|]]
13534 [[:Bar:X(Y)Z|]]
13535 !! html/php
13536 [[Article(context)|Article]]
13537 [[Bar:Article(context)|Article]]
13538 [[:Bar:Article(context)|Article]]
13539 [[Article(context)]]
13540 [[Bar:X(Y)Z|X(Y)Z]]
13541 [[:Bar:X(Y)Z|X(Y)Z]]
13542 !! end
13543
13544 !! test
13545 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, T32149)
13546 !! options
13547 pst
13548 !! wikitext
13549 [[Article (context)|]]
13550 [[Bar:Article (context)|]]
13551 [[:Bar:Article (context)|]]
13552 [[|Article (context)]]
13553 [[Bar:X (Y) Z|]]
13554 [[:Bar:X (Y) Z|]]
13555 !! html/php
13556 [[Article (context)|Article]]
13557 [[Bar:Article (context)|Article]]
13558 [[:Bar:Article (context)|Article]]
13559 [[Article (context)]]
13560 [[Bar:X (Y) Z|X (Y) Z]]
13561 [[:Bar:X (Y) Z|X (Y) Z]]
13562 !! end
13563
13564 !! test
13565 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, T32149)
13566 !! options
13567 pst
13568 !! wikitext
13569 [[Article(context)|]]
13570 [[Bar:Article(context)|]]
13571 [[:Bar:Article(context)|]]
13572 [[|Article(context)]]
13573 [[Bar:X(Y)Z|]]
13574 [[:Bar:X(Y)Z|]]
13575 !! html/php
13576 [[Article(context)|Article]]
13577 [[Bar:Article(context)|Article]]
13578 [[:Bar:Article(context)|Article]]
13579 [[Article(context)]]
13580 [[Bar:X(Y)Z|X(Y)Z]]
13581 [[:Bar:X(Y)Z|X(Y)Z]]
13582 !! end
13583
13584 !! test
13585 pre-save transform: context links ("pipe trick") with commas (T23660)
13586 !! options
13587 pst
13588 !! wikitext
13589 [[Article (context), context|]]
13590 [[Article (context),context|]]
13591 [[Bar:Article (context), context|]]
13592 [[Bar:Article (context),context|]]
13593 [[:Bar:Article (context), context|]]
13594 [[:Bar:Article (context),context|]]
13595 !! html/php
13596 [[Article (context), context|Article]]
13597 [[Article (context),context|Article]]
13598 [[Bar:Article (context), context|Article]]
13599 [[Bar:Article (context),context|Article]]
13600 [[:Bar:Article (context), context|Article]]
13601 [[:Bar:Article (context),context|Article]]
13602 !! end
13603
13604 !! test
13605 Parsoid: backwards pipe trick
13606 !! wikitext
13607 [[|'''bar''']]
13608 !! html/php
13609 <p>[[|<b>bar</b>]]
13610 </p>
13611 !! html/parsoid
13612 <p>[[|<b>bar</b>]]</p>
13613 !! end
13614
13615 !! test
13616 pre-save transform: trim trailing empty lines
13617 !! options
13618 pst
13619 !! wikitext
13620 Empty lines are trimmed
13621
13622
13623
13624
13625 !! html/php
13626 Empty lines are trimmed
13627 !! end
13628
13629 !! test
13630 pre-save transform: Signature expansion
13631 !! options
13632 pst
13633 !! wikitext
13634 * ~~~
13635 * <noinclude>~~~</noinclude>
13636 * <includeonly>~~~</includeonly>
13637 * <onlyinclude>~~~</onlyinclude>
13638 !! html/php
13639 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
13640 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
13641 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
13642 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
13643 !! end
13644
13645
13646 !! test
13647 pre-save transform: Signature expansion in nowiki tags (T2093)
13648 !! options
13649 pst disabled
13650 !! wikitext
13651 Shall not expand:
13652
13653 <nowiki>~~~~</nowiki>
13654
13655 <includeonly><nowiki>~~~~</nowiki></includeonly>
13656
13657 <noinclude><nowiki>~~~~</nowiki></noinclude>
13658
13659 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
13660
13661 {{subst:Foo}} shall be converted to FOO
13662
13663 As well as inside noinclude/onlyinclude
13664 <noinclude>{{subst:Foo}}</noinclude>
13665 <onlyinclude>{{subst:Foo}}</onlyinclude>
13666
13667 But not inside includeonly
13668 <includeonly>{{subst:Foo}}</includeonly>
13669 !! html/php
13670 Shall not expand:
13671
13672 <nowiki>~~~~</nowiki>
13673
13674 <includeonly><nowiki>~~~~</nowiki></includeonly>
13675
13676 <noinclude><nowiki>~~~~</nowiki></noinclude>
13677
13678 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
13679
13680 FOO shall be converted to FOO
13681
13682 As well as inside noinclude/onlyinclude
13683 <noinclude>FOO</noinclude>
13684 <onlyinclude>FOO</onlyinclude>
13685
13686 But not inside includeonly
13687 <includeonly>{{subst:Foo}}</includeonly>
13688 !! end
13689
13690 !! test
13691 Parsoid: Recognize nowiki with trailing space in tags
13692 !! options
13693 parsoid=wt2html
13694 !! wikitext
13695 <nowiki ><div>[[foo]]</nowiki >
13696
13697 a<nowiki / >b
13698
13699 c<nowiki />d
13700
13701 e<nowiki/ >f
13702 !! html
13703 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
13704 <p>ab</p>
13705 <p>cd</p>
13706 <p>ef</p>
13707 !! end
13708
13709 !! test
13710 Parsoid: Recognize nowiki with odd capitalization
13711 !! options
13712 parsoid=wt2html
13713 !! wikitext
13714 <noWikI ><div>[[foo]]</Nowiki >
13715 !! html
13716 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
13717 !! end
13718
13719
13720 !! test
13721 Parsoid: Escape nowiki with trailing space in tags
13722 !! options
13723 parsoid=html2wt
13724 !! html/parsoid
13725 <p>&lt;nowiki &gt; foo &lt/nowiki ></p>
13726 <p>a&lt;nowiki /&gt;b</p>
13727 <p>c&lt;nowiki/ &gt;d</p>
13728 !! wikitext
13729 &lt;nowiki &gt; foo &lt;/nowiki &gt;
13730
13731 a&lt;nowiki /&gt;b
13732
13733 c&lt;nowiki/ &gt;d
13734 !! end
13735
13736 !! test
13737 Parsoid: Escape weird noWikI capitalizations
13738 !! options
13739 parsoid=html2wt
13740 !! html/parsoid
13741 <p>&lt;noWikI &gt; foo &lt/NoWikI ></p>
13742 !! wikitext
13743 &lt;noWikI &gt; foo &lt;/NoWikI &gt;
13744 !! end
13745
13746 ###
13747 ### Message transform tests
13748 ###
13749 !! test
13750 message transform: magic variables
13751 !! options
13752 msg
13753 !! wikitext
13754 {{SITENAME}}
13755 !! html
13756 MediaWiki
13757 !! end
13758
13759 !! test
13760 message transform: should not transform wiki markup
13761 !! options
13762 msg
13763 !! wikitext
13764 ''test''
13765 !! html
13766 ''test''
13767 !! end
13768
13769 !! test
13770 message transform: <noinclude> in transcluded template (T6926)
13771 !! options
13772 msg
13773 !! wikitext
13774 {{Includes}}
13775 !! html
13776 Foobar
13777 !! end
13778
13779 !! test
13780 message transform: <onlyinclude> in transcluded template (T6926)
13781 !! options
13782 msg
13783 !! wikitext
13784 {{Includes2}}
13785 !! html
13786 Foo
13787 !! end
13788
13789 !! test
13790 {{#special:}} page name, known
13791 !! options
13792 msg
13793 !! wikitext
13794 {{#special:Recentchanges}}
13795 !! html
13796 Special:RecentChanges
13797 !! end
13798
13799 !! test
13800 {{#special:}} page name with subpage, known
13801 !! options
13802 msg
13803 !! wikitext
13804 {{#special:Recentchanges/param}}
13805 !! html
13806 Special:RecentChanges/param
13807 !! end
13808
13809 !! test
13810 {{#special:}} page name, unknown
13811 !! options
13812 msg
13813 !! wikitext
13814 {{#special:foobar nonexistent}}
13815 !! html
13816 Special:Foobar nonexistent
13817 !! end
13818
13819 !! test
13820 {{#speciale:}} page name, known
13821 !! options
13822 msg
13823 !! wikitext
13824 {{#speciale:Recentchanges}}
13825 !! html
13826 Special:RecentChanges
13827 !! end
13828
13829 !! test
13830 {{#speciale:}} page name with subpage, known
13831 !! options
13832 msg
13833 !! wikitext
13834 {{#speciale:Recentchanges/param}}
13835 !! html
13836 Special:RecentChanges/param
13837 !! end
13838
13839 !! test
13840 {{#speciale:}} page name, unknown
13841 !! options
13842 msg
13843 !! wikitext
13844 {{#speciale:foobar nonexistent}}
13845 !! html
13846 Special:Foobar_nonexistent
13847 !! end
13848
13849 ###
13850 ### Images
13851 ###
13852 ### For Parsoid-specific tests, see
13853 #### https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
13854
13855 !! test
13856 Simple image
13857 !! options
13858 parsoid=wt2html,wt2wt,html2html
13859 !! wikitext
13860 [[Image:foobar.jpg]]
13861 !! html/php
13862 <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>
13863 </p>
13864 !! html/parsoid
13865 <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>
13866 !! end
13867
13868 !! test
13869 Simple image (using File: namespace, now canonical)
13870 !! wikitext
13871 [[File:Foobar.jpg]]
13872 !! html/php
13873 <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>
13874 </p>
13875 !! html/parsoid
13876 <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>
13877 !! end
13878
13879 !! test
13880 Right-aligned image
13881 !! wikitext
13882 [[File:Foobar.jpg|right]]
13883 !! html/php
13884 <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>
13885
13886 !! html/parsoid
13887 <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>
13888 !! end
13889
13890 !! test
13891 Image with caption
13892 !! wikitext
13893 [[File:Foobar.jpg|right|Caption text]]
13894 !! html/php
13895 <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>
13896
13897 !! html/parsoid
13898 <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>
13899 !! end
13900
13901 !! test
13902 Image with caption, T55312 #1
13903 !! wikitext
13904 [[File:Foobar.jpg|right|Caption page stuff]]
13905 !! html/php
13906 <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>
13907
13908 !! html/parsoid
13909 <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>
13910 !! end
13911
13912 !! test
13913 Image with caption, T55312 #2
13914 !! wikitext
13915 [[File:Foobar.jpg|right|Caption page=]]
13916 !! html/php
13917 <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>
13918
13919 !! html/parsoid
13920 <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>
13921 !! end
13922
13923 !! test
13924 Image with caption, T55312 #3
13925 !! wikitext
13926 [[File:Foobar.jpg|right|Caption page=stuff]]
13927 !! html/php
13928 <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>
13929
13930 !! html/parsoid
13931 <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>
13932 !! end
13933
13934 !! test
13935 Allow empty links in image captions (T62753)
13936 !! options
13937 thumbsize=220
13938 !! wikitext
13939 [[File:Foobar.jpg|thumb|Caption [[Link1]]
13940 [[]]
13941 [[Link2]]
13942 ]]
13943 !! html/php
13944 <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>
13945
13946 !! html/parsoid
13947 <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>
13948 [[]]
13949 <a rel="mw:WikiLink" href="./Link2" title="Link2" data-parsoid='{"stx":"simple","a":{"href":"./Link2"},"sa":{"href":"Link2"}}'>Link2</a>
13950 </figcaption></figure>
13951 !! end
13952
13953 !! test
13954 Titles in unlinked images (T23454)
13955 !! wikitext
13956 [[File:Foobar.jpg|link=|stuff]]
13957 !! html/php
13958 <p><img alt="stuff" src="http://example.com/images/3/3a/Foobar.jpg" title="stuff" width="1941" height="220" />
13959 </p>
13960 !! end
13961
13962 !! test
13963 Link with empty target
13964 !! wikitext
13965 [[]]
13966 !! html
13967 <p>[[]]
13968 </p>
13969 !! end
13970
13971 !! test
13972 Image with link trail
13973 !! wikitext
13974 Linktrails should not work for images: [[File:Foobar.jpg]]s
13975 !! html/php
13976 <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
13977 </p>
13978 !! html/parsoid
13979 <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>
13980 !! end
13981
13982 !! test
13983 Image with empty attribute
13984 !! options
13985 parsoid=wt2html,wt2wt,html2html
13986 !! wikitext
13987 [[File:Foobar.jpg|right||Caption text]]
13988 !! html/php
13989 <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>
13990
13991 !! html/parsoid
13992 <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>
13993 !! end
13994
13995 !! test
13996 1. Block image with individual attributes from templates
13997 !! wikitext
13998 [[File:Foobar.jpg|thumb|{{echo|137px}}|This is a caption]]
13999 !! html/php
14000 <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>
14001
14002 !! html/parsoid
14003 <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>
14004 !! end
14005
14006 !! test
14007 2. Block Image with individual attributes from templates
14008 !! wikitext
14009 [[File:Foobar.jpg|{{echo|thumb}}|{{echo|137px}}|This is a caption]]
14010 !! html/php
14011 <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>
14012
14013 !! html/parsoid
14014 <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>
14015 !! end
14016
14017 !! test
14018 3. Inline image with individual attributes from templates
14019 !! wikitext
14020 [[File:Foobar.jpg|{{echo|50px}}]]
14021 !! html/php
14022 <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>
14023 </p>
14024 !! html/parsoid
14025 <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>
14026 !! end
14027
14028 ## Parsoid does not provide editing support for images where templates produce multiple image attributes.
14029 ## To signal this, we add a 'mw:Placeholder' type to such images. This could change in the future.
14030 !! test
14031 Image with multiple attributes from the same template
14032 !! wikitext
14033 [[File:Foobar.jpg|{{image_attribs}}]]
14034 !! html/php
14035 <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>
14036
14037 !! html/parsoid
14038 <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>
14039 !! end
14040
14041 !! test
14042 Image with link tails
14043 !! options
14044 thumbsize=220
14045 !! wikitext
14046 123[[File:Foobar.jpg]]456
14047 123[[File:Foobar.jpg|right]]456
14048 123[[File:Foobar.jpg|thumb]]456
14049 !! html/php
14050 <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
14051 </p>
14052 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
14053 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
14054
14055 !! html/php+tidy
14056 <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>
14057 <p>123</p>
14058 <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>
14059 <p>456 123</p>
14060 <div class="thumb tright">
14061 <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>
14062 <div class="thumbcaption">
14063 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
14064 </div>
14065 </div>
14066 </div>
14067 <p>456</p>
14068 !! html/parsoid
14069 <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>
14070 <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>
14071 <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>
14072 !! end
14073
14074 !! test
14075 Image with multiple captions -- only last one is accepted
14076 !! wikitext
14077 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
14078 !! html/php
14079 <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>
14080
14081 !! html/parsoid
14082 <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>
14083 !! end
14084
14085 !! test
14086 Image with multiple widths -- use last
14087 !! wikitext
14088 [[File:Foobar.jpg|200px|300px|caption]]
14089 !! html/php
14090 <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>
14091 </p>
14092 !! html/parsoid
14093 <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>
14094 !! end
14095
14096 !! test
14097 Image with multiple alignments -- use first (T50664)
14098 !! options
14099 thumbsize=220
14100 !! wikitext
14101 [[File:Foobar.jpg|thumb|left|right|center|caption]]
14102
14103 [[File:Foobar.jpg|middle|text-top|caption]]
14104 !! html/php
14105 <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>
14106 <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>
14107 </p>
14108 !! html/parsoid
14109 <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>
14110 <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>
14111 !! end
14112
14113 !! test
14114 Image with width attribute at different positions
14115 !! wikitext
14116 [[File:Foobar.jpg|200px|right|Caption]]
14117 [[File:Foobar.jpg|right|200px|Caption]]
14118 [[File:Foobar.jpg|right|Caption|200px]]
14119 !! html/php
14120 <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>
14121 <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>
14122 <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>
14123
14124 !! html/parsoid
14125 <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>
14126 <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>
14127 <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>
14128 !! end
14129
14130 # a sad bit of backward-compatibility
14131 !! test
14132 Image with size specified with pxpx (T15500, T53628)
14133 !! options
14134 parsoid=wt2html,wt2wt,html2html
14135 !! wikitext
14136 [[File:Foobar.jpg|20pxpx]]
14137 [[File:Foobar.jpg|200x20pxpx]]
14138 !! html/php
14139 <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>
14140 <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>
14141 </p>
14142 !! html/parsoid
14143 <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>
14144 !! end
14145
14146 !! test
14147 Image with link parameter, wiki target
14148 !! wikitext
14149 [[File:Foobar.jpg|link=Main Page]]
14150 !! html/php
14151 <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>
14152 </p>
14153 !! html/parsoid
14154 <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>
14155 !! end
14156
14157 # parsoid T51293 (part 1)
14158 !! test
14159 Image with link parameter, URL target
14160 !! wikitext
14161 [[File:Foobar.jpg|link=http://example.com/]]
14162 !! html/php
14163 <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>
14164 </p>
14165 !! html/parsoid
14166 <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>
14167 !! end
14168
14169 # parsoid T51293 (part 2)
14170 !! test
14171 Image with link parameter, protocol-less URL target
14172 !! wikitext
14173 [[File:Foobar.jpg|link=//example.com/]]
14174 !! html/php
14175 <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>
14176 </p>
14177 !! html/parsoid
14178 <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>
14179 !! end
14180
14181 !! test
14182 Escaping non-block captions (T107435)
14183 !! options
14184 parsoid={
14185 "modes": ["wt2wt"],
14186 "changes": [
14187 ["[typeof~='mw:Image']", "attr", "data-mw", "{\"caption\": \"|\"}"]
14188 ]
14189 }
14190 !! wikitext
14191 [[Image:Foobar.jpg|caption]]
14192 !! wikitext/edited
14193 [[Image:Foobar.jpg|<nowiki>|</nowiki>]]
14194 !! end
14195
14196 # wgExternalLinkTarget not supported by Parsoid
14197 !! test
14198 Image with link parameter, wgExternalLinkTarget
14199 !! wikitext
14200 [[Image:foobar.jpg|link=http://example.com/]]
14201 !! config
14202 wgExternalLinkTarget='foobar'
14203 !! html/php
14204 <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>
14205 </p>
14206 !! end
14207
14208 !! test
14209 Image with link parameter, wgNoFollowLinks set to false
14210 !! wikitext
14211 [[Image:foobar.jpg|link=http://example.com/]]
14212 !! config
14213 wgNoFollowLinks=false
14214 !! html
14215 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
14216 </p>
14217 !! end
14218
14219 !! test
14220 Image with link parameter, wgNoFollowDomainExceptions
14221 !! wikitext
14222 [[Image:foobar.jpg|link=http://example.com/]]
14223 !! config
14224 wgNoFollowDomainExceptions='example.com'
14225 !! html
14226 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
14227 </p>
14228 !! end
14229
14230 # wgExternalLinkTarget not supported by Parsoid
14231 !! test
14232 Image with link parameter, wgExternalLinkTarget, unnamed parameter
14233 !! wikitext
14234 [[Image:foobar.jpg|link=http://example.com/|Title]]
14235 !! config
14236 wgExternalLinkTarget='foobar'
14237 !! html/php
14238 <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>
14239 </p>
14240 !! end
14241
14242 !! test
14243 Image with empty link parameter
14244 !! wikitext
14245 [[File:Foobar.jpg|link=]]
14246 !! html/php
14247 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
14248 </p>
14249 !! html/parsoid
14250 <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>
14251 !! end
14252
14253 !! test
14254 Image with link parameter (wiki target) and unnamed parameter
14255 !! wikitext
14256 [[File:Foobar.jpg|link=Main_Page|Title]]
14257 !! html/php
14258 <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>
14259 </p>
14260 !! html/parsoid
14261 <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>
14262 !! end
14263
14264 !! test
14265 Image with link parameter (URL target) and unnamed parameter
14266 !! wikitext
14267 [[File:Foobar.jpg|link=http://example.com/|Title]]
14268 !! html/php
14269 <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>
14270 </p>
14271 !! html/parsoid
14272 <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>
14273 !! end
14274
14275 !! test
14276 Thumbnail image with link parameter
14277 !! options
14278 thumbsize=220
14279 parsoid=wt2html,wt2wt,html2html
14280 !! wikitext
14281 [[File:Foobar.jpg|thumb|link=http://example.com/|Title]]
14282 !! html/php
14283 <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>
14284
14285 !! html/parsoid
14286 <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>
14287 !! end
14288
14289 !! test
14290 Manually-specified thumbnail image
14291 !! options
14292 thumbsize=220
14293 !! wikitext
14294 [[File:Foobar.jpg|thumbnail=Thumb.png|Title]]
14295 !! html/php
14296 <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>
14297
14298 !! html/parsoid
14299 <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>
14300 !! end
14301
14302 !! test
14303 Manually-specified thumbnail image with explicit link to wiki page
14304 !! options
14305 thumbsize=220
14306 parsoid=wt2html,wt2wt,html2html
14307 !! wikitext
14308 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|Title]]
14309 !! html/php
14310 <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>
14311
14312 !! html/parsoid
14313 <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>
14314 !! end
14315
14316 !! test
14317 Manually-specified thumbnail image with explicit link to url
14318 !! options
14319 thumbsize=220
14320 parsoid=wt2html,wt2wt,html2html
14321 !! wikitext
14322 [[File:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
14323 !! html/php
14324 <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>
14325
14326 !! html/parsoid
14327 <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>
14328 !! end
14329
14330 !! test
14331 Manually-specified thumbnail image with explicit no link
14332 !! options
14333 thumbsize=220
14334 parsoid=wt2html,wt2wt,html2html
14335 !! wikitext
14336 [[File:Foobar.jpg|thumb=Thumb.png|link=|Title]]
14337 !! html/php
14338 <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>
14339
14340 !! html/parsoid
14341 <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>
14342 !! end
14343
14344 !! test
14345 Manually-specified thumbnail image with explicit link and alt text
14346 !! options
14347 thumbsize=220
14348 parsoid=wt2html,wt2wt,html2html
14349 !! wikitext
14350 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|alt=alttext|Title]]
14351 !! html/php
14352 <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>
14353
14354 !! html/parsoid
14355 <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>
14356 !! end
14357
14358 !! test
14359 Image with frame and link
14360 !! options
14361 parsoid=wt2html,wt2wt,html2html
14362 !! wikitext
14363 [[File:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
14364 !! html/php
14365 <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>
14366
14367 !! html/parsoid
14368 <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>
14369 !! end
14370
14371 !! test
14372 Image with frame and link and explicit alt
14373 !! options
14374 parsoid=wt2html,wt2wt,html2html
14375 !! wikitext
14376 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
14377 !! html/php
14378 <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>
14379
14380 !! html/parsoid
14381 <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>
14382 !! end
14383
14384 !! test
14385 Image with wiki markup in implicit alt
14386 !! wikitext
14387 [[Image:Foobar.jpg|testing '''bold''' in alt]]
14388
14389 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
14390 !! html/php
14391 <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>
14392 </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>
14393 </p>
14394 !! html/parsoid
14395 <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>
14396
14397 <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>
14398 !! end
14399
14400 !! test
14401 Alt image option should handle most kinds of wikitext without barfing
14402 !! wikitext
14403 [[Image:Foobar.jpg|thumb|This is the image caption|alt=This is a [[link]] and a {{echo|''bold template''}}.]]
14404 !! html/php
14405 <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>
14406
14407 !! html/parsoid
14408 <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>
14409 !! end
14410
14411 ###################
14412 # Conflicting image format options.
14413 # First option specified should 'win'.
14414 # All three cases in each test should be identical.
14415
14416 !! test
14417 Image with 'frameless' first.
14418 !! options
14419 parsoid=wt2html,wt2wt,html2html
14420 !! wikitext
14421 [[File:Foobar.jpg|frameless|caption]]
14422
14423 [[File:Foobar.jpg|frameless|frame|caption]]
14424
14425 [[File:Foobar.jpg|frameless|thumb|caption]]
14426 !! html/php
14427 <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>
14428 </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>
14429 </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>
14430 </p>
14431 !! html/parsoid
14432 <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>
14433 <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>
14434 <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>
14435 !! end
14436
14437 !! test
14438 Image with 'frame' first.
14439 !! options
14440 parsoid=wt2html,wt2wt,html2html
14441 !! wikitext
14442 [[File:Foobar.jpg|frame|caption]]
14443 [[File:Foobar.jpg|frame|frameless|caption]]
14444 [[File:Foobar.jpg|frame|thumb|caption]]
14445 !! html/php
14446 <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>
14447 <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>
14448 <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>
14449
14450 !! html/parsoid
14451 <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>
14452 <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>
14453 <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>
14454 !! end
14455
14456 !! test
14457 Image with 'thumb' first.
14458 !! options
14459 parsoid=wt2html,wt2wt,html2html
14460 !! wikitext
14461 [[File:Foobar.jpg|thumb|caption]]
14462 [[File:Foobar.jpg|thumb|frameless|caption]]
14463 [[File:Foobar.jpg|thumb|frame|caption]]
14464 !! html/php
14465 <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>
14466 <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>
14467 <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>
14468
14469 !! html/parsoid
14470 <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>
14471 <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>
14472 <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>
14473 !! end
14474
14475 ###################
14476 # Image sizing.
14477 # See https://www.mediawiki.org/wiki/Help:Images#Size_and_frame
14478 # and https://phabricator.wikimedia.org/T64258
14479 # Foobar has actual size of 1941x220
14480 # 1. Thumbs & frameless always reduce, can't be enlarged unless it's
14481 # a scalable format.
14482 # 2. Framed images always ignore size options; always render at default size.
14483 # 3. "Unspecified format" and border are the only types which can be
14484 # enlarged.
14485
14486 !! test
14487 Image: "unspecified format" and border enlarge
14488 !! options
14489 parsoid=wt2html,wt2wt,html2html
14490 !! wikitext
14491 [[File:Foobar.jpg|2000px]]
14492
14493 [[File:Foobar.jpg|border|2000px]]
14494 !! html/php
14495 <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>
14496 </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>
14497 </p>
14498 !! html/parsoid
14499 <p><span typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/1941px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="227" width="2000"/></a></span></p>
14500 <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/1941px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="227" width="2000"/></a></span></p>
14501 !! end
14502
14503 !! test
14504 Image: "unspecified format" and border reduce
14505 !! options
14506 parsoid=wt2html,wt2wt,html2html
14507 !! wikitext
14508 [[File:Foobar.jpg|1000px]]
14509
14510 [[File:Foobar.jpg|border|1000px]]
14511 !! html/php
14512 <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>
14513 </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>
14514 </p>
14515 !! html/parsoid
14516 <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>
14517 <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>
14518 !! end
14519
14520 !! test
14521 Image: thumbs reduce
14522 !! options
14523 parsoid=wt2html,wt2wt,html2html
14524 !! wikitext
14525 [[File:Foobar.jpg|thumb|50px]]
14526 !! html/php
14527 <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>
14528
14529 !! html/parsoid
14530 <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>
14531 !! end
14532
14533 !! test
14534 Image: bitmap thumbs can't be enlarged past original size, but vector can.
14535 !! options
14536 parsoid=wt2html,wt2wt,html2html
14537 !! wikitext
14538 [[File:Foobar.jpg|thumb|2000px]]
14539
14540 [[File:Foobar.svg|thumb|2000px]]
14541 !! html/php
14542 <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>
14543 <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>
14544
14545 !! html/parsoid
14546 <figure typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/1941px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></figure>
14547 <figure typeof="mw:Image/Thumb"><a href="./File:Foobar.svg"><img resource="./File:Foobar.svg" src="//example.com/images/thumb/f/ff/Foobar.svg/240px-Foobar.svg" data-file-width="240" data-file-height="180" data-file-type="drawing" height="1500" width="2000"/></a></figure>
14548 !! end
14549
14550 !! test
14551 Image: frameless can reduce in size
14552 !! options
14553 parsoid=wt2html,wt2wt,html2html
14554 !! wikitext
14555 [[File:Foobar.jpg|frameless|50px]]
14556 !! html/php
14557 <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>
14558 </p>
14559 !! html/parsoid
14560 <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>
14561 !! end
14562
14563 !! test
14564 Image: bitmap frameless can't be enlarged past original size, but vector can
14565 !! options
14566 parsoid=wt2html,wt2wt,html2html
14567 !! wikitext
14568 [[File:Foobar.jpg|frameless|2000px]]
14569
14570 [[File:Foobar.svg|frameless|2000px]]
14571 !! html/php
14572 <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>
14573 </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>
14574 </p>
14575 !! html/parsoid
14576 <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/1941px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
14577 <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/240px-Foobar.svg" data-file-width="240" data-file-height="180" data-file-type="drawing" height="1500" width="2000"/></a></span></p>
14578 !! end
14579
14580 !! test
14581 Image: framed images are always unscaled.
14582 !! options
14583 parsoid=wt2html,wt2wt,html2html
14584 !! wikitext
14585 [[File:Foobar.jpg|frame]]
14586
14587 [[File:Foobar.jpg|frame|50px]]
14588
14589 [[File:Foobar.jpg|frame|50x50px]]
14590
14591 [[File:Foobar.jpg|frame|2000px]]
14592 !! html/php
14593 <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>
14594 <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>
14595 <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>
14596 <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>
14597
14598 !! html/parsoid
14599 <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>
14600 <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>
14601 <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>
14602 <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>
14603 !! end
14604
14605 ###################
14606
14607 !! test
14608 Link to image page- image page normally doesn't exists, hence edit link
14609 Add test with existing image page
14610 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
14611 !! wikitext
14612 [[:Image:test]]
14613 !! html
14614 <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>
14615 </p>
14616 !! end
14617
14618 !! test
14619 T20784 Link to non-existent image page with caption should use caption as link text
14620 !! wikitext
14621 [[:Image:test|caption]]
14622 !! html
14623 <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>
14624 </p>
14625 !! end
14626
14627 !! test
14628 Frameless image caption with a free URL
14629 !! wikitext
14630 [[File:Foobar.jpg|http://example.com]]
14631 !! html/php
14632 <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>
14633 </p>
14634 !! html/parsoid
14635 <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>
14636 !! end
14637
14638 !! test
14639 Thumbnail image caption with a free URL
14640 !! options
14641 thumbsize=220
14642 !! wikitext
14643 [[File:Foobar.jpg|thumb|http://example.com]]
14644 !! html/php
14645 <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>
14646
14647 !! html/parsoid
14648 <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>
14649 !! end
14650
14651 !! test
14652 Thumbnail image caption with a free URL and explicit alt
14653 !! options
14654 thumbsize=220
14655 parsoid=wt2html,wt2wt,html2html
14656 !! wikitext
14657 [[File:Foobar.jpg|thumb|http://example.com|alt=Alteration]]
14658 !! html/php
14659 <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>
14660
14661 !! html/parsoid
14662 <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>
14663 !! end
14664
14665 !! test
14666 SVG thumbnails with no language set
14667 !! options
14668 !! wikitext
14669 [[File:Foobar.svg|thumb|caption]]
14670 !! html/php
14671 <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>
14672
14673 !! html/parsoid
14674 <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" data-file-width="240" data-file-height="180" data-file-type="drawing" height="165" width="220"/></a><figcaption>caption</figcaption></figure>
14675 !! end
14676
14677 !! test
14678 SVG thumbnails with language de
14679 !! options
14680 parsoid=wt2html,wt2wt,html2html
14681 !! wikitext
14682 [[File:Foobar.svg|thumb|caption|lang=de]]
14683 !! html/php
14684 <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>
14685
14686 !! html/parsoid
14687 <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" lang="de" data-file-width="240" data-file-height="180" data-file-type="drawing" height="165" width="220"/></a><figcaption>caption</figcaption></figure>
14688 !! end
14689
14690 !! test
14691 SVG thumbnails with invalid language code
14692 !! options
14693 parsoid=wt2html,wt2wt,html2html
14694 !! wikitext
14695 [[File:Foobar.svg|thumb|caption|lang=invalid.language.code]]
14696 !! html/php
14697 <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>
14698
14699 !! html/parsoid
14700 <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>
14701 !! end
14702
14703 !! test
14704 T3887: A ISBN with a thumbnail
14705 !! wikitext
14706 [[File:Foobar.jpg|thumb|ISBN 1235467890]]
14707 !! html/php
14708 <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>
14709
14710 !! html/parsoid
14711 <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>
14712 !! end
14713
14714 !! test
14715 T3887: A RFC with a thumbnail
14716 !! wikitext
14717 [[File:Foobar.jpg|thumb|This is RFC 12354]]
14718 !! html/php
14719 <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>
14720
14721 !! html/parsoid
14722 <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>
14723 !! end
14724
14725 !! test
14726 T3887: A mailto link with a thumbnail
14727 !! wikitext
14728 [[File:Foobar.jpg|thumb|Please mailto:nobody@example.com]]
14729 !! html/php
14730 <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>
14731
14732 !! html/parsoid
14733 <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>
14734 !! end
14735
14736 # Pending resolution to T2368
14737 !! test
14738 T2648: Frameless image caption with a link
14739 !! wikitext
14740 [[File:Foobar.jpg|text with a [[link]] in it]]
14741 !! html/php
14742 <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>
14743 </p>
14744 !! html/parsoid
14745 <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>
14746 !! end
14747
14748 !! test
14749 T2648: Frameless image caption with a link (suffix)
14750 !! wikitext
14751 [[File:Foobar.jpg|text with a [[link]]foo in it]]
14752 !! html/php
14753 <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>
14754 </p>
14755 !! html/parsoid
14756 <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>
14757 !! end
14758
14759 !! test
14760 T2648: Frameless image caption with an interwiki link
14761 !! wikitext
14762 [[File:Foobar.jpg|text with a [[MeatBall:Link]] in it]]
14763 !! html/php
14764 <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>
14765 </p>
14766 !! html/parsoid
14767 <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>
14768 !! end
14769
14770 !! test
14771 T2648: Frameless image caption with a piped interwiki link
14772 !! wikitext
14773 [[File:Foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
14774 !! html/php
14775 <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>
14776 </p>
14777 !! html/parsoid
14778 <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>
14779 !! end
14780
14781 !! test
14782 T107474: Frameless image caption with <nowiki>
14783 !! wikitext
14784 [[File:Foobar.jpg|<nowiki>text with a [[MeatBall:Link|link]] in it</nowiki>]]
14785 !! html/parsoid
14786 <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>
14787 !! end
14788
14789 !! test
14790 Escape HTML special chars in image alt text
14791 !! wikitext
14792 [[File:Foobar.jpg|& < > "]]
14793 !! html/php
14794 <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>
14795 </p>
14796 !! html/parsoid
14797 <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>
14798 !! end
14799
14800 !! test
14801 Escape HTML special chars in image alt text with LanguageConverter
14802 !! options
14803 language=zh
14804 !! wikitext
14805 [[File:Foobar.jpg|& < > "]]
14806 !! html/php
14807 <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>
14808 </p>
14809 !! html/parsoid
14810 <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>
14811 !! end
14812
14813 !! test
14814 Entities in file name and attributes
14815 !! wikitext
14816 [[File:7%25 solution.gif|manualthumb=7%25 solution.gif|link=7%25 solution|[[7%25 solution]]]]
14817 !! html/php
14818 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=7%25_solution.gif" class="new" title="File:7% solution.gif">7% solution</a>
14819 </p>
14820 !! html/parsoid
14821 <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>
14822 !! end
14823
14824 !! test
14825 T2499: Alt text should have &#1234;, not &amp;1234;
14826 !! wikitext
14827 [[File:Foobar.jpg|&#9792;]]
14828 !! html/php
14829 <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>
14830 </p>
14831 !! html/parsoid
14832 <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>
14833 !! end
14834
14835 !! test
14836 Broken image caption with link
14837 !! options
14838 parsoid=wt2html,wt2wt,html2html
14839 !! wikitext
14840 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
14841 !! html/php
14842 <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.
14843 </p>
14844 !! html/parsoid
14845 <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>
14846 !! end
14847
14848 !! test
14849 Image caption containing another image
14850 !! wikitext
14851 [[File:Foobar.jpg|thumb|This is a caption with another [[File:Thumb.png|image]] inside it!]]
14852 !! html/php
14853 <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>
14854
14855 !! html/parsoid
14856 <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>
14857 !! end
14858
14859 !! test
14860 Image: caption containing a newline
14861 !! wikitext
14862 [[File:Foobar.jpg|This
14863 *is some text]]
14864 !! html/php
14865 <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>
14866 </p>
14867 !! html/parsoid
14868 <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>
14869 !!end
14870
14871 !!test
14872 Image: caption containing leading space
14873 (The leading space should not trigger nowiki escaping in wt2wt mode)
14874 !! wikitext
14875 [[File:Foobar.jpg|thumb| bar]]
14876 !! html/php
14877 <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>
14878
14879 !! html/parsoid
14880 <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>
14881 !!end
14882
14883 !! test
14884 Image: caption containing a table
14885 !! options
14886 parsoid=wt2html,wt2wt,html2html
14887 !! wikitext
14888 [[Image:Foobar.jpg|thumb|200px|This is an example image thumbnail caption with a table
14889 {|
14890 ! Foo !! Bar
14891 |-
14892 | Foo1 || Bar1
14893 |}
14894 and some more text.]]
14895 !! html/php
14896 <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>
14897
14898 !! html/parsoid
14899 <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
14900 <table>
14901 <tbody>
14902 <tr><th>Foo </th><th>Bar</th></tr>
14903 <tr>
14904 <td>Foo1 </td>
14905 <td>Bar1</td></tr></tbody></table>and some more text.</figcaption></figure>
14906 !! end
14907
14908 !! test
14909 T5090: External links other than http: in image captions
14910 !! wikitext
14911 [[File:Foobar.jpg|thumb|200x200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
14912 !! html/php
14913 <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>
14914
14915 !! html/parsoid
14916 <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>
14917 !! end
14918
14919 !! test
14920 Custom class
14921 !! options
14922 parsoid=wt2html,wt2wt,html2html
14923 !! wikitext
14924 [[Image:foobar.jpg|a|class=b]]
14925 !! html/php
14926 <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>
14927 </p>
14928 !! html/parsoid
14929 <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>
14930 !! end
14931
14932 !! test
14933 Localized image handling (1).
14934 !! options
14935 parsoid=wt2html,wt2wt,html2html
14936 language=es
14937 !! wikitext
14938 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
14939 !! html/php
14940 <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>
14941
14942 !! html/parsoid
14943 <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>
14944 !! end
14945
14946 !! test
14947 Localized image handling (2).
14948 !! options
14949 thumbsize=220
14950 parsoid=wt2html,wt2wt,html2html
14951 language=es
14952 !! wikitext
14953 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
14954 !! html/php
14955 <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>
14956
14957 !! html/parsoid
14958 <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>
14959 !! end
14960
14961 !! test
14962 Localized image handling (3).
14963 !! options
14964 language=fa
14965 parsoid=html2wt
14966 !! html/parsoid
14967 <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>
14968 !! wikitext
14969 [[File:Foobar.jpg|بندانگشتی]]
14970 !! end
14971
14972 !! test
14973 "border", "frameless" and "class" attributes on an image.
14974 !! options
14975 thumbsize=220
14976 parsoid=wt2html,wt2wt,html2html
14977 !! wikitext
14978 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
14979 !! html/php
14980 <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>
14981 </p>
14982 !! html/parsoid
14983 <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>
14984 !! end
14985
14986 # Note that 'right' is the default alignment, despite the misspelled 'righ' below
14987 !! test
14988 Invalid image attributes (T64500)
14989 !! options
14990 thumbsize=220
14991 parsoid=wt2html,wt2wt,html2html
14992 !! wikitext
14993 [[File:Foobar.jpg|thumb|float|left|caption]]
14994
14995 [[File:Foobar.jpg|thumb|righ|caption]]
14996
14997 [[File:Foobar.jpg|bogus1|thumb|bogus2|left|bogus3|caption]]
14998 !! html/php
14999 <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>
15000 <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>
15001 <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>
15002
15003 !! html/parsoid
15004 <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>
15005 <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>
15006 <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>
15007 !! end
15008
15009 !! article
15010 File:Barfoo.jpg
15011 !! text
15012 #REDIRECT [[File:Barfoo.jpg]]
15013 !! endarticle
15014
15015 # FIXME: Parsoid should run this test -- but we'd need to teach the
15016 # mockAPI about the redirected Barfoo.jpg image.
15017 !! test
15018 Redirected image
15019 !! wikitext
15020 [[Image:Barfoo.jpg]]
15021 !! html/php
15022 <p><a href="/wiki/File:Barfoo.jpg" class="mw-redirect" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
15023 </p>
15024 !! end
15025
15026 !! test
15027 Missing image with uploads disabled
15028 !! options
15029 wgEnableUploads=0
15030 !! wikitext
15031 [[File:Foobaz.jpg]]
15032 !! html/php
15033 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
15034 </p>
15035 !! html/parsoid
15036 <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>
15037 !! end
15038
15039 # Parsoid-specific testing for images
15040 # https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
15041 # Currently imperfect due to a flaw in the Parsoid testrunner
15042 # Work in progress
15043 # THESE TESTS SHOULD BE MOVED UP and merged with the php-specific
15044 # image tests.
15045
15046 !! test
15047 Parsoid-specific image handling - simple image with size and middle alignment
15048 !! wikitext
15049 [[File:Foobar.jpg|middle|50px]]
15050 !! html/parsoid
15051 <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>
15052 !! end
15053
15054 !! test
15055 Parsoid-specific image handling - simple image with size, middle alignment,
15056 non-standard namespace alias
15057 !! options
15058 parsoid=wt2wt,wt2html,html2html
15059 !! wikitext
15060 [[Image:Foobar.jpg|middle|50px]]
15061 !! html/parsoid
15062 <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>
15063 !! end
15064
15065 !! test
15066 Parsoid-specific image handling - simple image with size and middle alignment
15067 (existing content)
15068 !! wikitext
15069 [[File:Foobar.jpg|50px|middle]]
15070 !! html/parsoid
15071 <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>
15072 !! end
15073
15074 !! test
15075 Parsoid-specific image handling - simple image with size and middle alignment
15076 and non-standard namespace name
15077 !! options
15078 parsoid=wt2html,wt2wt,html2html
15079 !! wikitext
15080 [[Image:Foobar.jpg|50px|middle]]
15081 !! html/parsoid
15082 <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>
15083 !! end
15084
15085 !! test
15086 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
15087 !! wikitext
15088 [[File:Foobar.jpg|500x10px|baseline|caption]]
15089 !! html/parsoid
15090 <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>
15091 !! end
15092
15093 !! test
15094 Parsoid-specific image handling - simple image with border and size spec
15095 !! wikitext
15096 [[File:Foobar.jpg|50px|border|caption]]
15097 !! html/parsoid
15098 <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>
15099 !! end
15100
15101 !! test
15102 Parsoid-specific image handling - thumbnail with halign, valign, and caption
15103 !! wikitext
15104 [[File:Foobar.jpg|left|baseline|thumb|caption content]]
15105 !! html/parsoid
15106 <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>
15107 !! end
15108
15109 !! test
15110 Parsoid-specific image handling - thumbnail with halign, valign, and caption
15111 (existing content)
15112 !! wikitext
15113 [[File:Foobar.jpg|thumb|left|baseline|caption content]]
15114 !! html/parsoid
15115 <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>
15116 !! end
15117
15118 !! test
15119 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
15120 !! wikitext
15121 [[Image:Foobar.jpg|right|middle|thumb|50x50px|caption]]
15122 !! html/parsoid
15123 <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>
15124 !! end
15125
15126 !! test
15127 Parsoid-specific image handling - thumbnail with specific size, halign,
15128 valign, and caption (existing content)
15129 !! wikitext
15130 [[File:Foobar.jpg|thumb|50x50px|right|middle|caption]]
15131 !! html/parsoid
15132 <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>
15133 !! end
15134
15135 !! test
15136 Parsoid-specific image handling - framed image with specific size and caption
15137 (size is ignored)
15138 !! options
15139 parsoid=wt2html,wt2wt,html2html
15140 !! wikitext
15141 [[File:Foobar.jpg|frame|500x50px|caption]]
15142 !! html/parsoid
15143 <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>
15144 !! end
15145
15146 !! test
15147 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption
15148 (size is ignored)
15149 !! options
15150 parsoid=wt2html,wt2wt,html2html
15151 !! wikitext
15152 [[File:Foobar.jpg|left|baseline|frame|500x50px|caption]]
15153 !! html/parsoid
15154 <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>
15155 !! end
15156
15157 !! test
15158 Parsoid-specific image handling - frameless image with specific size, border, and caption
15159 !! wikitext
15160 [[File:Foobar.jpg|frameless|442x50px|border|caption]]
15161 !! html/parsoid
15162 <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>
15163 !! end
15164
15165 !! test
15166 Parsoid-specific image handling - simple image with a formatted caption
15167 !! wikitext
15168 [[File:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
15169 !! html/parsoid
15170 <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>
15171 !! end
15172
15173 !! test
15174 Parsoid-specific image handling - caption with a template in it
15175 !! wikitext
15176 [[File:Foobar.jpg|thumb|200x23px|This caption has a {{echo|transclusion}} in it.]]
15177 !! html/parsoid
15178 <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>
15179 !! end
15180
15181 !! test
15182 Parsoid-specific image handling - caption with unbalanced tags in it
15183 !! options
15184 parsoid=wt2html,wt2wt,html2html
15185 !! wikitext
15186 foo
15187 [[File:Foobar.jpg|thumb|200x200px|This caption has a <center>unbalanced tag in it.]]
15188 bar
15189 !! html/parsoid
15190 <p>foo</p>
15191 <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>
15192 <p>bar</p>
15193 !! end
15194
15195 !! test
15196 Parsoid-specific image handling - empty caption (1)
15197 !! options
15198 parsoid=wt2html,wt2wt
15199 !! wikitext
15200 [[File:Foobar.jpg|thumb|]]
15201 !! html/parsoid
15202 <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>
15203 !! end
15204
15205 # empty captions don't get serialized unless we're in the "round trip" case
15206 !! test
15207 Parsoid-specific image handling - empty caption (2)
15208 !! options
15209 parsoid=html2wt
15210 !! html/parsoid
15211 <figure class="mw-default-size" typeof="mw:Image/Thumb">
15212 <a href="./File:Foobar.jpg">
15213 <img resource="./File:Foobar.jpg"
15214 src="//example.com/images/3/3a/Foobar.jpg"
15215 data-file-width="1941" data-file-height="220" data-file-type="bitmap"
15216 height="25" width="220"/>
15217 </a>
15218 <figcaption></figcaption>
15219 </figure>
15220 !! wikitext
15221 [[File:Foobar.jpg|thumb]]
15222 !! end
15223
15224 !! test
15225 Parsoid-specific image handling - whitespace caption
15226 !! wikitext
15227 [[File:Foobar.jpg|thumb| ]]
15228 !! html/parsoid
15229 <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>
15230 !! end
15231
15232 !! test
15233 Parsoid-specific image handling - lang option
15234 !! wikitext
15235 foo
15236 [[File:Foobar.svg|lang=de|caption]]
15237 bar
15238 !! html/parsoid
15239 <p>foo
15240 <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>
15241 bar</p>
15242 !! end
15243
15244 ## Edge case bugs in Parsoid from T93580
15245 !! test
15246 T93580: 1. Templated <ref> inside block images
15247 !! wikitext
15248 [[File:Foobar.jpg|thumb|Caption with templated ref: {{echo|<ref>foo</ref>}}]]
15249
15250 <references />
15251 !! html/parsoid
15252 <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>
15253
15254 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><a href="./Main_Page#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text" data-parsoid="{}">foo</span></li></ol>
15255 !! end
15256
15257 !! test
15258 T93580: 2. <ref> inside inline images
15259 !! wikitext
15260 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: <ref>foo</ref>]]
15261
15262 <references />
15263 !! html/parsoid
15264 <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>
15265
15266 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><a href="./Main_Page#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text" data-parsoid="{}">foo</span></li></ol>
15267 !! end
15268
15269 !! test
15270 T93580: 3. Templated <ref> inside inline images
15271 !! wikitext
15272 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: {{echo|<ref>{{echo|foo}}</ref>}}]]
15273
15274 <references />
15275 !! html/parsoid
15276 <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>
15277
15278 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><a href="./Main_Page#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text" data-parsoid="{}">foo</span></li></ol>
15279 !! end
15280
15281 ###
15282 ### Subpages
15283 ###
15284 !! article
15285 Subpage test/subpage
15286 !! text
15287 foo
15288 !! endarticle
15289
15290 !! test
15291 Subpage link
15292 !! options
15293 subpage title=[[Subpage test]]
15294 !! wikitext
15295 [[/subpage]]
15296 !! html
15297 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
15298 </p>
15299 !! end
15300
15301 !! test
15302 Subpage noslash link
15303 !! options
15304 subpage title=[[Subpage test]]
15305 !! wikitext
15306 [[/subpage/]]
15307 !! html
15308 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
15309 </p>
15310 !! end
15311
15312 !! article
15313 Subpage test/1/2/subpage
15314 !! text
15315 blah
15316 !! endarticle
15317
15318 !! test
15319 Relative subpage noslash link
15320 !! options
15321 parsoid=wt2wt,wt2html,html2html
15322 subpage title=[[Subpage test/1/2/3/4]]
15323 !! wikitext
15324 [[../../subpage/]]
15325
15326 [[../../subpage]]
15327 !! html/php
15328 <p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a>
15329 </p><p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage test/1/2/subpage</a>
15330 </p>
15331 !! html/parsoid
15332 <p><a rel="mw:WikiLink" href="./Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a></p>
15333 <p><a rel="mw:WikiLink" href="./Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
15334 !! end
15335
15336 !! test
15337 Parsoid: dot-slash prefixed wikilinks
15338 !! wikitext
15339 [[./foo]]
15340
15341 [[././bar]]
15342
15343 [[././baz/]]
15344 !! html/php
15345 <p>[[./foo]]
15346 </p><p>[[././bar]]
15347 </p><p>[[././baz/]]
15348 </p>
15349 !! html/parsoid
15350 <p>[[./foo]]
15351 </p><p>[[././bar]]
15352 </p><p>[[././baz/]]
15353 </p>
15354 !! end
15355
15356 !! test
15357 Render invalid page names as plain text (T53090)
15358 !! wikitext
15359 [[./../foo|bar]]
15360 [[foo�|bar]]
15361 [[foo/.|bar]]
15362 [[foo/..|bar]]
15363 [[foo~~~bar]]
15364 [[foo>bar]]
15365 [[foo[bar]]
15366 [[.]]
15367 [[..]]
15368 [[foo././bar]]
15369 [[foo[http://example.com]xyz]]
15370
15371 [[{{echo|./../foo}}|bar]]
15372 [[{{echo|foo/.}}|bar]]
15373 [[{{echo|foo/..}}|bar]]
15374 [[{{echo|foo~~~~bar}}]]
15375 [[{{echo|foo>bar}}]]
15376 [[{{echo|foo././bar}}]]
15377 [[{{echo|foo{bar}}]]
15378 [[{{echo|foo}bar}}]]
15379 [[{{echo|foo[bar}}]]
15380 [[{{echo|foo]bar}}]]
15381 [[{{echo|foo<bar}}]]
15382 !!html/php
15383 <p>[[./../foo|bar]]
15384 [[foo�|bar]]
15385 [[foo/.|bar]]
15386 [[foo/..|bar]]
15387 [[foo~~~bar]]
15388 [[foo&gt;bar]]
15389 [[foo[bar]]
15390 [[.]]
15391 [[..]]
15392 [[foo././bar]]
15393 [[foo<a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>xyz]]
15394 </p><p>[[./../foo|bar]]
15395 [[foo/.|bar]]
15396 [[foo/..|bar]]
15397 [[foo~~~~bar]]
15398 [[foo&gt;bar]]
15399 [[foo././bar]]
15400 [[foo{bar]]
15401 [[foo}bar]]
15402 [[foo[bar]]
15403 [[foo]bar]]
15404 [[foo&lt;bar]]
15405 </p>
15406 !!html/parsoid
15407 <p>[[./../foo|bar]]
15408 [[foo�|bar]]
15409 [[foo/.|bar]]
15410 [[foo/..|bar]]
15411 [[foo~~~bar]]
15412 [[foo>bar]]
15413 [[foo[bar]]
15414 [[.]]
15415 [[..]]
15416 [[foo././bar]]
15417 [[foo<a rel="mw:ExtLink" href="http://example.com"></a>xyz]]</p>
15418
15419 <p>[[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"./../foo"}},"i":0}}]}'>./../foo</span>|bar]]
15420 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/."}},"i":0}}]}'>foo/.</span>|bar]]
15421 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/.."}},"i":0}}]}'>foo/..</span>|bar]]
15422 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo~~~~bar"}},"i":0}}]}'>foo~~~~bar</span>]]
15423 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo>bar"}},"i":0}}]}'>foo>bar</span>]]
15424 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo././bar"}},"i":0}}]}'>foo././bar</span>]]
15425 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo{bar"}},"i":0}}]}'>foo{bar</span>]]
15426 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo}bar"}},"i":0}}]}'>foo}bar</span>]]
15427 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo[bar"}},"i":0}}]}'>foo[bar</span>]]
15428 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo]bar"}},"i":0}}]}'>foo]bar</span>]]
15429 [[<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>
15430 !!end
15431
15432 !! test
15433 Disabled subpages
15434 !! wikitext
15435 [[/subpage]]
15436 !! html
15437 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
15438 </p>
15439 !! end
15440
15441 !! test
15442 T2561: {{/Subpage}}
15443 !! options
15444 subpage title=[[Page]]
15445 !! wikitext
15446 {{/Subpage}}
15447 !! html
15448 <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>
15449 </p>
15450 !! end
15451
15452 ###
15453 ### Categories
15454 ###
15455 !! article
15456 Category:MediaWiki User's Guide
15457 !! text
15458 blah
15459 !! endarticle
15460
15461 !! test
15462 Link to category
15463 !! wikitext
15464 [[:Category:MediaWiki User's Guide]]
15465 !! html
15466 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
15467 </p>
15468 !! end
15469
15470 !! test
15471 Simple category
15472 !! options
15473 cat
15474 !! wikitext
15475 [[Category:MediaWiki User's Guide]]
15476 !! html/php
15477 cat=MediaWiki_User's_Guide sort=
15478 !! html/parsoid
15479 <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"}}'/>
15480 !! end
15481
15482 !! test
15483 PAGESINCATEGORY invalid title fatal (r33546 fix)
15484 !! wikitext
15485 {{PAGESINCATEGORY:<bogus>}}
15486 !! html
15487 <p>0
15488 </p>
15489 !! end
15490
15491 !! test
15492 Category with different sort key
15493 !! options
15494 cat
15495 !! wikitext
15496 [[Category:MediaWiki User's Guide|Foo]]
15497 !! html/php
15498 cat=MediaWiki_User's_Guide sort=Foo
15499 !! html/parsoid
15500 <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"}}'/>
15501 !! end
15502
15503 !! test
15504 Category with identical sort key
15505 !! options
15506 cat
15507 !! wikitext
15508 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
15509 !! html/php
15510 cat=MediaWiki_User's_Guide sort=MediaWiki User's Guide
15511 !! html/parsoid
15512 <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"}}'/>
15513 !! end
15514
15515 !! test
15516 Category with empty sort key
15517 !! options
15518 cat
15519 pst
15520 !! wikitext
15521 [[Category:MediaWiki User's Guide|]]
15522 !! html/php
15523 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
15524 !! end
15525
15526 !! test
15527 Category with empty sort key and parentheses
15528 !! options
15529 cat
15530 pst
15531 !! wikitext
15532 [[Category:Foo (bar)|]]
15533 !! html/php
15534 [[Category:Foo (bar)|Foo]]
15535 !! end
15536
15537 !! test
15538 Category with link tail
15539 !! options
15540 cat
15541 pst
15542 !! wikitext
15543 123[[Category:Foo]]456
15544 !! html/php
15545 123[[Category:Foo]]456
15546 !! end
15547
15548 !! test
15549 Category with template
15550 !! options
15551 cat
15552 pst
15553 !! wikitext
15554 [[Category:{{echo|Foo}}]]
15555 !! html/php
15556 [[Category:{{echo|Foo}}]]
15557 !! end
15558
15559 !! test
15560 Category with template in sort key
15561 !! options
15562 cat
15563 pst
15564 !! wikitext
15565 [[Category:Foo|{{echo|Bar}}]]
15566 !! html/php
15567 [[Category:Foo|{{echo|Bar}}]]
15568 !! end
15569
15570 !! test
15571 Category with template in sort key and title
15572 !! options
15573 cat
15574 pst
15575 !! wikitext
15576 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
15577 !! html/php
15578 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
15579 !! end
15580
15581 ## We used to, but no longer wt2wt this test since the default serializer
15582 ## will normalize all categories to serialize on their own line.
15583 ## This wikitext usage is going to be fairly uncommon in production and
15584 ## selser will take care of preserving formatting in those scenarios.
15585 !! test
15586 Category / paragraph interactions
15587 !! options
15588 parsoid=wt2html
15589 !! wikitext
15590 Foo [[Category:Baz]] Bar
15591
15592 Foo [[Category:Baz]]
15593 Bar
15594
15595 Foo
15596 [[Category:Baz]]
15597 Bar
15598
15599 Foo
15600 [[Category:Baz]] Bar
15601
15602 Foo
15603 [[Category:Baz]]
15604 [[Category:Baz]]
15605 [[Category:Baz]]
15606 Bar
15607
15608 [[Category:Baz]]
15609 [[Category:Baz]]
15610 [[Category:Baz]]
15611
15612 [[Category:Baz]]
15613 {{echo|[[Category:Baz]]}}
15614 [[Category:Baz]]
15615 !! html/php
15616 <p>Foo Bar
15617 </p><p>Foo
15618 Bar
15619 </p><p>Foo
15620 Bar
15621 </p><p>Foo Bar
15622 </p><p>Foo
15623 Bar
15624 </p>
15625 !! html/parsoid
15626 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
15627 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
15628 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
15629 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
15630 <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>
15631 <link rel="mw:PageProp/Category" href="./Category:Baz"/>
15632 !! end
15633
15634 ## We used to, but no longer wt2wt this test since the default serializer
15635 ## will normalize all categories to serialize on their own line.
15636 ## This wikitext usage is going to be fairly uncommon in production and
15637 ## selser will take care of preserving formatting in those scenarios.
15638 ##
15639 ## The whitespace on the empty line is part of the test. Please do not delete
15640 !! test
15641 1. Categories and newlines: All preceding newlines should be suppressed (courtesy T2087)
15642 !! options
15643 parsoid=wt2html
15644 !! wikitext
15645 This
15646
15647 [[Category:Foo]] and this should be part of same paragraph (not an indent-pre)
15648
15649 {{echo|[[Category:Foo]] and so should this!}}
15650 !! html/php
15651 <p>This and this should be part of same paragraph (not an indent-pre) and so should this!
15652 </p>
15653 !! html/parsoid
15654 <p>This
15655
15656 <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of same paragraph (not an indent-pre)
15657
15658 <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>
15659 !! end
15660
15661 ## Parsoid will not try to wt2wt this while preserving newlines because
15662 ## it suppresses excess newlines within list items -- and we don't want to
15663 ## introduce a special case just for categories, which is, in reality somewhat
15664 ## odd behavior -- categories are unlikely to be used in list items like this
15665 ## in top-level pages and are only likely to show up in template-generated
15666 ## list items where this RT-ing is a non-issue.
15667 ##
15668 ## The whitespace on the empty line is part of the test. Please do not delete
15669 !! test
15670 2. Categories and newlines: All preceding newlines should be suppressed (courtesy T2087)
15671 !! options
15672 parsoid=wt2html
15673 !! wikitext
15674 * This
15675
15676 [[Category:Foo]] and this should be part of the same list item
15677 * So should this
15678
15679 {{echo|[[Category:Foo]] and this should be part of the same list item}}
15680 !! html
15681 <ul><li>This and this should be part of the same list item</li>
15682 <li>So should this and this should be part of the same list item</li></ul>
15683 !! html/parsoid
15684 <ul>
15685 <li>This <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of the same list item</li>
15686 <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>
15687 </ul>
15688 !! end
15689
15690 ## Newlines and categories that follow the last item of a list
15691 ## are treated differently because this (list followed by categories)
15692 ## is an extremely common pattern on wikis.
15693 !! test
15694 3. Categories and newlines: newline suppression for last list item should RT properly
15695 !! wikitext
15696 * a
15697 * b
15698
15699 [[Category:Foo]]
15700
15701 [[Category:Bar]]
15702 [[Category:Baz]]
15703 !! html/parsoid
15704 <ul><li> a</li>
15705 <li> b</li></ul>
15706
15707 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
15708
15709 <link rel="mw:PageProp/Category" href="./Category:Bar" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
15710 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
15711 !! end
15712
15713 !! test
15714 4. Categories and newlines: newline suppression for last list item should RT properly
15715 !! wikitext
15716 * a
15717 **** b
15718
15719 [[Category:Foo]]
15720 !! html/parsoid
15721 <ul><li> a
15722 <ul><li><ul><li><ul><li> b</li></ul></li></ul></li></ul></li></ul>
15723
15724 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
15725 !! end
15726
15727 ## only wt2html for this to make sure the algo only applies to the rightmost path
15728 !! test
15729 5. Categories and newlines: migrateTrailingCategories dom pass should only run on the rightmost path of nested lists
15730 !! options
15731 parsoid=wt2html
15732 !! wikitext
15733 * a
15734 ** b
15735 [[Category:Foo]]
15736 * c
15737 ** d
15738 [[Category:Foo]]
15739 !! html/parsoid
15740 <ul><li> a
15741 <ul><li> b
15742 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/></li></ul></li>
15743 <li> c
15744 <ul><li> d</li></ul></li></ul>
15745 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
15746 !! end
15747
15748 ## We used to, but no longer wt2wt this test since the default serializer
15749 ## will normalize all categories to serialize on their own line.
15750 ## This wikitext usage is going to be fairly uncommon in production and
15751 ## selser will take care of preserving formatting in those scenarios.
15752 !! test
15753 6. Categories and newlines: migrateTrailingCategories dom pass should not migrate categories not preceded by newlines
15754 !! options
15755 parsoid=wt2html
15756 !! wikitext
15757 * a [[Category:Foo]]
15758 !! html/parsoid
15759 <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>
15760 !! end
15761
15762 # This test also demonstrates because of newline+category tunneling
15763 # through the list hander, template wrapping doesn't expand to the
15764 # containing list when the list item swallows the category.
15765 !! test
15766 7. Categories and newlines: migrateTrailingCategories dom pass should leave template content alone
15767 !! wikitext
15768 * {{echo|a
15769 [[Category:Foo]]}}
15770 !! html/parsoid
15771 <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
15772 </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>
15773 !! end
15774
15775 !! test
15776 8. Categories and newlines: migrateTrailingCategories dom pass should not get tripped by intervening templates
15777 !! wikitext
15778 * a
15779
15780 {{echo|[[Category:Foo]]
15781 [[Category:Bar]]}}
15782 [[Category:Baz]]
15783 !! html/parsoid
15784 <ul><li> a</li></ul>
15785
15786 <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">
15787 </span><link rel="mw:PageProp/Category" href="./Category:Bar" about="#mwt1" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
15788 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
15789 !! end
15790
15791 !! test
15792 Category links with multiple namespaces
15793 !! wikitext
15794 [[Category:Project:Foo]]
15795 !! html/parsoid
15796 <link rel="mw:PageProp/Category" href="./Category:Project:Foo" />
15797 !! end
15798
15799 !! test
15800 Parsoid: Serialize link to category page with colon escape
15801 !! options
15802 parsoid
15803 !! wikitext
15804
15805 [[:Category:Foo]]
15806 [[:Category:Foo|Bar]]
15807 !! html
15808 <p>
15809 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Category:Foo</a>
15810 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Bar</a>
15811 </p>
15812 !! end
15813
15814 # We used to, but no longer wt2wt this test since the default serializer
15815 # will normalize all categories to serialize on their own line.
15816 # This wikitext usage is going to be fairly uncommon in production and
15817 # selser will take care of preventing whitespace insertion if this
15818 # occurs in an article.
15819 #
15820 # html2html disabled for the same reason (whitespace insertion between
15821 # x and y).
15822 #
15823 # html2wt disabled because it localizes the "Category" namespace.
15824 !! test
15825 Link prefix/suffixes aren't applied to category links
15826 !! options
15827 parsoid=wt2html
15828 language=is
15829 !! wikitext
15830 x[[Category:Foo]]y
15831 !! html/php
15832 <p>xy
15833 </p>
15834 !! html/parsoid
15835 <p>x<link rel="mw:PageProp/Category" href="./Flokkur:Foo" data-parsoid=""/>y</p>
15836 !! end
15837
15838 !! test
15839 Parsoid: Serialize link to file page with colon escape
15840 !! options
15841 parsoid
15842 !! wikitext
15843
15844 [[:File:Foo.png]]
15845 [[:File:Foo.png|Bar]]
15846 !! html
15847 <p>
15848 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">File:Foo.png</a>
15849 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">Bar</a>
15850 </p>
15851 !! end
15852
15853 !! test
15854 Parsoid: Serialize a genuine category link without colon escape
15855 !! options
15856 parsoid
15857 !! wikitext
15858 [[Category:Foo]]
15859 [[Category:Foo|Bar]]
15860 !! html
15861 <link rel="mw:PageProp/Category" href="./Category:Foo">
15862 <link rel="mw:PageProp/Category" href="./Category:Foo#Bar">
15863 !! end
15864
15865 !! test
15866 Normalize hrefs properly before testing for invalid link targets (T72894)
15867 !! options
15868 parsoid=html2wt
15869 !! html/parsoid
15870 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne"/>
15871 !! wikitext
15872 [[Category:Toxine bactérienne]]
15873 !! end
15874
15875 !! test
15876 Parsoid: Defaultsort
15877 !! wikitext
15878 {{DEFAULTSORT:Foo}}
15879 !! html/parsoid
15880 <meta property="mw:PageProp/categorydefaultsort" content="Foo"/>
15881 !! end
15882
15883 # NOTE: mw:ExpandedAttrs is not the best typeof here. mw:Transclusion is better.
15884 # But, this is a limitation of our representation and is documented in
15885 # TemplateHandler.js in processSpecialMagicWord
15886 !! test
15887 Parsoid: Defaultsort (template-generated)
15888 !! wikitext
15889 {{{{echo|DEFAULTSORT}}:Foo}}
15890 !! html/parsoid
15891 <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"}]]}'/>
15892 !! end
15893
15894 ###
15895 ### Inter-language links
15896 ###
15897 !! test
15898 Interlanguage links
15899 !! options
15900 ill
15901 !! wikitext
15902 [[es:Alimento]]
15903 [[fr:Nourriture]]
15904 [[zh:食品]]
15905 !! html/php
15906 es:Alimento fr:Nourriture zh:食品
15907 !! html/parsoid
15908 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Alimento"/>
15909 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/Nourriture"/>
15910 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/食品"/>
15911 !! end
15912
15913 !! test
15914 Duplicate interlanguage links (T26502)
15915 !! options
15916 ill
15917 !! wikitext
15918 [[es:1]]
15919 [[es:2]]
15920 [[fr:1]]
15921 [[fr:2]]
15922 !! html/php
15923 es:1 fr:1
15924 !! html/parsoid
15925 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/1"/>
15926 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/2"/>
15927 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/1"/>
15928 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/2"/>
15929 !! end
15930
15931 ###
15932 ### Sections
15933 ###
15934 !! test
15935 Basic section headings
15936 !! wikitext
15937 == Headline 1 ==
15938 Some text
15939
15940 ==Headline 2==
15941 More
15942 ===Smaller headline===
15943 Blah blah
15944 !! html
15945 <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>
15946 <p>Some text
15947 </p>
15948 <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>
15949 <p>More
15950 </p>
15951 <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>
15952 <p>Blah blah
15953 </p>
15954 !! end
15955
15956 !! test
15957 Section headings with TOC
15958 !! wikitext
15959 == Headline 1 ==
15960 === Subheadline 1 ===
15961 ===== Skipping a level =====
15962 ====== Skipping a level ======
15963
15964 == Headline 2 ==
15965 Some text
15966 ===Another headline===
15967 !! html
15968 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
15969 <ul>
15970 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
15971 <ul>
15972 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
15973 <ul>
15974 <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>
15975 <ul>
15976 <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>
15977 </ul>
15978 </li>
15979 </ul>
15980 </li>
15981 </ul>
15982 </li>
15983 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
15984 <ul>
15985 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
15986 </ul>
15987 </li>
15988 </ul>
15989 </div>
15990
15991 <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>
15992 <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>
15993 <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>
15994 <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>
15995 <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>
15996 <p>Some text
15997 </p>
15998 <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>
15999
16000 !! end
16001
16002 !! test
16003 TOC anchors don't collide
16004 !! wikitext
16005 __FORCETOC__
16006 == Headline 2 ==
16007 == Headline ==
16008 == Headline 2 ==
16009 == Headline ==
16010 !! html/php
16011 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
16012 <ul>
16013 <li class="toclevel-1 tocsection-1"><a href="#Headline_2"><span class="tocnumber">1</span> <span class="toctext">Headline 2</span></a></li>
16014 <li class="toclevel-1 tocsection-2"><a href="#Headline"><span class="tocnumber">2</span> <span class="toctext">Headline</span></a></li>
16015 <li class="toclevel-1 tocsection-3"><a href="#Headline_2_2"><span class="tocnumber">3</span> <span class="toctext">Headline 2</span></a></li>
16016 <li class="toclevel-1 tocsection-4"><a href="#Headline_3"><span class="tocnumber">4</span> <span class="toctext">Headline</span></a></li>
16017 </ul>
16018 </div>
16019
16020 <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>
16021 <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>
16022 <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>
16023 <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>
16024
16025 !! end
16026
16027 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
16028 !! test
16029 Handling of sections up to level 6 and beyond
16030 !! wikitext
16031 = Level 1 Heading=
16032 == Level 2 Heading==
16033 === Level 3 Heading===
16034 ==== Level 4 Heading====
16035 ===== Level 5 Heading=====
16036 ====== Level 6 Heading======
16037 ======= Level 7 Heading=======
16038 ======== Level 8 Heading========
16039 ========= Level 9 Heading=========
16040 ========== Level 10 Heading==========
16041 !! html
16042 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
16043 <ul>
16044 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
16045 <ul>
16046 <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>
16047 <ul>
16048 <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>
16049 <ul>
16050 <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>
16051 <ul>
16052 <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>
16053 <ul>
16054 <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>
16055 <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>
16056 <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>
16057 <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>
16058 <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>
16059 </ul>
16060 </li>
16061 </ul>
16062 </li>
16063 </ul>
16064 </li>
16065 </ul>
16066 </li>
16067 </ul>
16068 </li>
16069 </ul>
16070 </div>
16071
16072 <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>
16073 <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>
16074 <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>
16075 <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>
16076 <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>
16077 <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>
16078 <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>
16079 <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>
16080 <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>
16081 <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>
16082
16083 !! end
16084
16085 !! test
16086 TOC regression (T11764)
16087 !! wikitext
16088 == title 1 ==
16089 === title 1.1 ===
16090 ==== title 1.1.1 ====
16091 === title 1.2 ===
16092 == title 2 ==
16093 === title 2.1 ===
16094 !! html
16095 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
16096 <ul>
16097 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
16098 <ul>
16099 <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>
16100 <ul>
16101 <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>
16102 </ul>
16103 </li>
16104 <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>
16105 </ul>
16106 </li>
16107 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
16108 <ul>
16109 <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>
16110 </ul>
16111 </li>
16112 </ul>
16113 </div>
16114
16115 <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>
16116 <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>
16117 <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>
16118 <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>
16119 <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>
16120 <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>
16121
16122 !! end
16123
16124 !! test
16125 TOC for heading containing <span id="..."></span> (T96153)
16126 !! wikitext
16127 __FORCETOC__
16128 ==<span id="old-anchor"></span>New title==
16129 !! html/php
16130 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
16131 <ul>
16132 <li class="toclevel-1 tocsection-1"><a href="#New_title"><span class="tocnumber">1</span> <span class="toctext">New title</span></a></li>
16133 </ul>
16134 </div>
16135
16136 <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>
16137
16138 !! end
16139
16140 !! test
16141 TOC with wgMaxTocLevel=3 (T8204)
16142 !! options
16143 wgMaxTocLevel=3
16144 !! wikitext
16145 == title 1 ==
16146 === title 1.1 ===
16147 ==== title 1.1.1 ====
16148 === title 1.2 ===
16149 == title 2 ==
16150 === title 2.1 ===
16151 !! html
16152 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
16153 <ul>
16154 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
16155 <ul>
16156 <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>
16157 <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>
16158 </ul>
16159 </li>
16160 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
16161 <ul>
16162 <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>
16163 </ul>
16164 </li>
16165 </ul>
16166 </div>
16167
16168 <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>
16169 <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>
16170 <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>
16171 <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>
16172 <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>
16173 <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>
16174
16175 !! end
16176
16177 !! test
16178 TOC with wgMaxTocLevel=3 and two level four headings (T8204)
16179 !! options
16180 wgMaxTocLevel=3
16181 !! wikitext
16182 ==Section 1==
16183 ===Section 1.1===
16184 ====Section 1.1.1====
16185 ====Section 1.1.1.1====
16186 ==Section 2==
16187 !! html
16188 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
16189 <ul>
16190 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
16191 <ul>
16192 <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>
16193 </ul>
16194 </li>
16195 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
16196 </ul>
16197 </div>
16198
16199 <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>
16200 <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>
16201 <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>
16202 <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>
16203 <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>
16204
16205 !! end
16206
16207
16208 !! test
16209 Resolving duplicate section names
16210 !! wikitext
16211 == Foo bar ==
16212 == Foo bar ==
16213 !! html
16214 <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>
16215 <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>
16216
16217 !! end
16218
16219 !! test
16220 Resolving duplicate section names with differing case (T12721)
16221 !! wikitext
16222 == Foo bar ==
16223 == Foo Bar ==
16224 !! html
16225 <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>
16226 <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>
16227
16228 !! end
16229
16230 !! article
16231 Template:sections
16232 !! text
16233 ===Section 1===
16234 ==Section 2==
16235 !! endarticle
16236
16237 !! test
16238 Template with sections, __NOTOC__
16239 !! wikitext
16240 __NOTOC__
16241 ==Section 0==
16242 {{sections}}
16243 ==Section 4==
16244 !! html
16245 <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>
16246 <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>
16247 <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>
16248 <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>
16249
16250 !! end
16251
16252 !! test
16253 __NOEDITSECTION__ keyword
16254 !! wikitext
16255 __NOEDITSECTION__
16256 ==Section 1==
16257 ==Section 2==
16258 !! html
16259 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
16260 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
16261
16262 !! end
16263
16264 !! test
16265 Link inside a section heading
16266 !! wikitext
16267 ==Section with a [[Main Page|link]] in it==
16268 !! html
16269 <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>
16270
16271 !! end
16272
16273 !! test
16274 TOC regression (T14077)
16275 !! wikitext
16276 __TOC__
16277 == title 1 ==
16278 === title 1.1 ===
16279 == title 2 ==
16280 !! html
16281 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
16282 <ul>
16283 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
16284 <ul>
16285 <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>
16286 </ul>
16287 </li>
16288 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
16289 </ul>
16290 </div>
16291
16292 <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>
16293 <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>
16294 <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>
16295
16296 !! end
16297
16298 !! test
16299 T3219 URL next to image (good)
16300 !! wikitext
16301 http://example.com [[File:Foobar.jpg]]
16302 !! html/php
16303 <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>
16304 </p>
16305 !! html/parsoid
16306 <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>
16307 !!end
16308
16309 !! test
16310 Short headings with trailing space should match behavior of Parser::doHeadings (T21910)
16311 !! wikitext
16312 ===
16313 The line above must have a trailing space!
16314 === <!--
16315 --> <!-- -->
16316 But just in case it doesn't...
16317 !! html
16318 <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>
16319 <p>The line above must have a trailing space!
16320 </p>
16321 <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>
16322 <p>But just in case it doesn't...
16323 </p>
16324 !! end
16325
16326 !! test
16327 Header with special characters (T27462)
16328 !! wikitext
16329 The tooltips shall not show entities to the user (ie. be double escaped)
16330
16331 == text > text ==
16332 section 1
16333
16334 == text < text ==
16335 section 2
16336
16337 == text & text ==
16338 section 3
16339
16340 == text ' text ==
16341 section 4
16342
16343 == text " text ==
16344 section 5
16345 !! html
16346 <p>The tooltips shall not show entities to the user (ie. be double escaped)
16347 </p>
16348 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
16349 <ul>
16350 <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>
16351 <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>
16352 <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>
16353 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
16354 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
16355 </ul>
16356 </div>
16357
16358 <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>
16359 <p>section 1
16360 </p>
16361 <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>
16362 <p>section 2
16363 </p>
16364 <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>
16365 <p>section 3
16366 </p>
16367 <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>
16368 <p>section 4
16369 </p>
16370 <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>
16371 <p>section 5
16372 </p>
16373 !! end
16374
16375 !! test
16376 Header with space, plus and underscore as entity
16377 !! wikitext
16378 Id should not contain + for spaces
16379
16380 == Space between Text ==
16381 section 1
16382
16383 == Space-Entity&#32;between&#32;Text ==
16384 section 2
16385
16386 == Plus+between+Text ==
16387 section 3
16388
16389 == Plus-Entity&#43;between&#43;Text ==
16390 section 4
16391
16392 == Underscore_between_Text ==
16393 section 5
16394
16395 == Underscore-Entity&#95;between&#95;Text ==
16396 section 6
16397
16398 [[#Space between Text]]
16399 [[#Space-Entity&#32;between&#32;Text]]
16400 [[#Plus+between+Text]]
16401 [[#Plus-Entity&#43;between&#43;Text]]
16402 [[#Underscore_between_Text]]
16403 [[#Underscore-Entity&#95;between&#95;Text]]
16404 !! html
16405 <p>Id should not contain + for spaces
16406 </p>
16407 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
16408 <ul>
16409 <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>
16410 <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>
16411 <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>
16412 <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>
16413 <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>
16414 <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>
16415 </ul>
16416 </div>
16417
16418 <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>
16419 <p>section 1
16420 </p>
16421 <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>
16422 <p>section 2
16423 </p>
16424 <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>
16425 <p>section 3
16426 </p>
16427 <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>
16428 <p>section 4
16429 </p>
16430 <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>
16431 <p>section 5
16432 </p>
16433 <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>
16434 <p>section 6
16435 </p><p><a href="#Space_between_Text">#Space between Text</a>
16436 <a href="#Space-Entity_between_Text">#Space-Entity&#32;between&#32;Text</a>
16437 <a href="#Plus.2Bbetween.2BText">#Plus+between+Text</a>
16438 <a href="#Plus-Entity.2Bbetween.2BText">#Plus-Entity&#43;between&#43;Text</a>
16439 <a href="#Underscore_between_Text">#Underscore_between_Text</a>
16440 <a href="#Underscore-Entity_between_Text">#Underscore-Entity&#95;between&#95;Text</a>
16441 </p>
16442 !! end
16443
16444 !! test
16445 Headers with excess '=' characters
16446 (Are similar tests necessary beyond the 1st level?)
16447 !! wikitext
16448 =foo==
16449 ==foo=
16450 =''italic'' heading==
16451 ==''italic'' heading=
16452 !! html
16453 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
16454 <ul>
16455 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
16456 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
16457 <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>
16458 <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>
16459 </ul>
16460 </div>
16461
16462 <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>
16463 <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>
16464 <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>
16465 <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>
16466
16467 !! end
16468
16469 !! test
16470 HTML headers vs TOC (T25393)
16471 (__NOEDITSECTION__ for clearer output, doesn't matter here)
16472 !! wikitext
16473 <h1>Header 1</h1>
16474 == Header 1.1 ==
16475 == Header 1.2 ==
16476
16477 <h1>Header 2
16478 </h1>
16479 == Header 2.1 ==
16480 == Header 2.2 ==
16481 __NOEDITSECTION__
16482 !! html
16483 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
16484 <ul>
16485 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
16486 <ul>
16487 <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>
16488 <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>
16489 </ul>
16490 </li>
16491 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
16492 <ul>
16493 <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>
16494 <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>
16495 </ul>
16496 </li>
16497 </ul>
16498 </div>
16499
16500 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
16501 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
16502 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
16503 <h1><span class="mw-headline" id="Header_2">Header 2</span></h1>
16504 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
16505 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
16506
16507 !! end
16508
16509 !! test
16510 Single-line or multiline-comments can follow headings
16511 !! options
16512 parsoid=wt2html,wt2wt
16513 !! wikitext
16514 ==foo==<!---->
16515 ==bar==<!--c1-->
16516 ==baz==<!--
16517 c2
16518 c3-->
16519 !! html
16520 <h2><span class="mw-headline" id="foo">foo</span></h2>
16521 <h2><span class="mw-headline" id="bar">bar</span></h2>
16522 <h2><span class="mw-headline" id="baz">baz</span></h2>
16523
16524 !! end
16525
16526 !! test
16527 T3219 URL next to image (broken)
16528 !! wikitext
16529 http://example.com[[File:Foobar.jpg]]
16530 !! html/php
16531 <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>
16532 </p>
16533 !! html/parsoid
16534 <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>
16535 !!end
16536
16537 !! test
16538 T3186 news: in the middle of text
16539 !! wikitext
16540 http://en.wikinews.org/wiki/Wikinews:Workplace
16541 !! html
16542 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
16543 </p>
16544 !!end
16545
16546
16547 !! test
16548 Namespaced link must have a title
16549 !! wikitext
16550 [[Project:]]
16551 !! html
16552 <p>[[Project:]]
16553 </p>
16554 !!end
16555
16556 !! test
16557 Namespaced link must have a title (bad fragment version)
16558 !! wikitext
16559 [[Project:#fragment]]
16560 !! html
16561 <p>[[Project:#fragment]]
16562 </p>
16563 !!end
16564
16565
16566 ###
16567 ### HTML tags and HTML attributes
16568 ###
16569
16570 !! test
16571 div with no attributes
16572 !! wikitext
16573 <div>HTML rocks</div>
16574 !! html
16575 <div>HTML rocks</div>
16576
16577 !! end
16578
16579 !! test
16580 div with double-quoted attribute
16581 !! wikitext
16582 <div id="rock">HTML rocks</div>
16583 !! html
16584 <div id="rock">HTML rocks</div>
16585
16586 !! end
16587
16588 !! test
16589 div with single-quoted attribute
16590 !! wikitext
16591 <div id='rock'>HTML rocks</div>
16592 !! html
16593 <div id="rock">HTML rocks</div>
16594
16595 !! end
16596
16597 !! test
16598 div with unquoted attribute
16599 !! wikitext
16600 <div id=rock>HTML rocks</div>
16601 !! html
16602 <div id="rock">HTML rocks</div>
16603
16604 !! end
16605
16606 !! test
16607 div with illegal double attributes
16608 !! wikitext
16609 <div id="a" id="b">HTML rocks</div>
16610 !! html
16611 <div id="b">HTML rocks</div>
16612
16613 !!end
16614
16615 !! test
16616 div with empty attribute value, space before equals
16617 !! options
16618 parsoid=wt2html,html2html
16619 !! wikitext
16620 <div class =>HTML rocks</div>
16621 !! html/php
16622 <div class="">HTML rocks</div>
16623
16624 !! html/parsoid
16625 <div class="" data-parsoid='{"stx":"html"}'>HTML rocks</div>
16626 !! end
16627
16628 !! test
16629 div with multiple empty attribute values
16630 !! options
16631 parsoid=wt2html,html2html
16632 !! wikitext
16633 <div id= title=>HTML rocks</div>
16634 !! html/php
16635 <div id="title.3D">HTML rocks</div>
16636
16637 !! html/parsoid
16638 <div id="title.3D" data-parsoid='{"stx":"html"}'>HTML rocks</div>
16639 !! end
16640
16641 !! test
16642 table with multiple empty attribute values
16643 !! options
16644 parsoid=wt2html,html2html
16645 !! wikitext
16646 {| title= id=
16647 | hi
16648 |}
16649 !! html/php
16650 <table title="id=">
16651 <tr>
16652 <td> hi
16653 </td></tr></table>
16654
16655 !! html/parsoid
16656 <table title="id=">
16657 <tbody><tr><td> hi</td></tr>
16658 </tbody></table>
16659 !! end
16660
16661 !! test
16662 div with braces in attribute value
16663 !! wikitext
16664 <div title="{}">Foo</div>
16665 !! html/php
16666 <div title="&#123;&#125;">Foo</div>
16667
16668 !! html/parsoid
16669 <div title="{}">Foo</div>
16670 !! end
16671
16672 !! test
16673 div with empty attribute value, no space before equals
16674 !! options
16675 parsoid=wt2html,html2html
16676 !! wikitext
16677 <div class=>HTML rocks</div>
16678 !! html/php
16679 <div class="">HTML rocks</div>
16680
16681 !! html/parsoid
16682 <div class="">HTML rocks</div>
16683 !! end
16684
16685 !! test
16686 HTML multiple attributes correction
16687 !! wikitext
16688 <p class="error" class="awesome">Awesome!</p>
16689 !! html
16690 <p class="awesome">Awesome!</p>
16691
16692 !!end
16693
16694 !! test
16695 Table multiple attributes correction
16696 !! wikitext
16697 {|
16698 !+ class="error" class="awesome"| status
16699 |}
16700 !! html
16701 <table>
16702 <tr>
16703 <th class="awesome"> status
16704 </th></tr></table>
16705
16706 !!end
16707
16708 !! test
16709 DIV IN UPPERCASE
16710 !! wikitext
16711 <DIV ID="x">HTML ROCKS</DIV>
16712 !! html
16713 <div id="x">HTML ROCKS</div>
16714
16715 !!end
16716
16717 !! test
16718 Non-ASCII pseudo-tags are rendered as text
16719 !! wikitext
16720 <khyô>
16721 !! html
16722 <p>&lt;khyô&gt;
16723 </p>
16724 !! end
16725
16726 !! test
16727 Pseudo-tag with URL 'name' renders as url link
16728 !! wikitext
16729 <http://example.com/>
16730 !! html
16731 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
16732 </p>
16733 !! end
16734
16735 !! test
16736 text with amp in the middle of nowhere
16737 !! wikitext
16738 Remember AT&T?
16739 !! html
16740 <p>Remember AT&amp;T?
16741 </p>
16742 !! end
16743
16744 !! test
16745 text with character entity: eacute
16746 !! wikitext
16747 I always thought &eacute; was a cute letter.
16748 !! html
16749 <p>I always thought &#233; was a cute letter.
16750 </p>
16751 !! html+tidy
16752 <p>I always thought é was a cute letter.</p>
16753 !! end
16754
16755 !! test
16756 text with entity-escaped character entity-like string: eacute
16757 !! wikitext
16758 I always thought &amp;eacute; was a cute letter.
16759 !! html
16760 <p>I always thought &amp;eacute; was a cute letter.
16761 </p>
16762 !! end
16763
16764 !! test
16765 text with undefined character entity: xacute
16766 !! wikitext
16767 I always thought &xacute; was a cute letter.
16768 !! html
16769 <p>I always thought &amp;xacute; was a cute letter.
16770 </p>
16771 !! end
16772
16773 !! test
16774 HTML5 tags
16775 !! wikitext
16776 <data value="5">five</data>
16777 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
16778 <mark>This highlighted text</mark>
16779 !! html
16780 <p><data value="5">five</data>
16781 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
16782 <mark>This highlighted text</mark>
16783 </p>
16784 !! end
16785
16786 !! test
16787 HTML tag with leading space is parsed as text
16788 !! wikitext
16789 < div>foo< /div>
16790 !! html
16791 <p>&lt; div&gt;foo&lt; /div&gt;
16792 </p>
16793 !! end
16794
16795 ###
16796 ### Nesting tests (see T43545, T52604, T53081)
16797 ###
16798
16799 # This test case is fixed in Parsoid by domino 1.0.12. (T52604)
16800 # Note that html2wt is considerably more difficult if we use <b> in
16801 # the test case, instead of <small>
16802 !! test
16803 Ensure that HTML adoption agency algorithm is properly implemented.
16804 !! wikitext
16805 <small>X<small>Y</small>Z</small>
16806 !! html
16807 <p><small>X<small>Y</small>Z</small>
16808 </p>
16809 !! end
16810
16811 # This was T43545 in the PHP parser.
16812 # Note that tidy doesn't handle this correctly.
16813 !! test
16814 Nesting of <kbd>
16815 !! wikitext
16816 <kbd>X<kbd>Y</kbd>Z</kbd>
16817 !! html
16818 <p><kbd>X<kbd>Y</kbd>Z</kbd>
16819 </p>
16820 !! end
16821
16822 # The following cases were T53081 in the PHP parser.
16823 # Note that there are some other nestable tags (b, i, etc) which are
16824 # not covered; see T53081 for discussion.
16825
16826 # Note that tidy doesn't handle this correctly.
16827 !! test
16828 Nesting of <em>
16829 !! wikitext
16830 <em>X<em>Y</em>Z</em>
16831 !! html
16832 <p><em>X<em>Y</em>Z</em>
16833 </p>
16834 !! end
16835
16836 # Note that tidy doesn't handle this correctly.
16837 !! test
16838 Nesting of <strong>
16839 !! wikitext
16840 <strong>X<strong>Y</strong>Z</strong>
16841 !! html
16842 <p><strong>X<strong>Y</strong>Z</strong>
16843 </p>
16844 !! end
16845
16846 !! test
16847 Nesting of <q>
16848 !! wikitext
16849 <q>X<q>Y</q>Z</q>
16850 !! html+tidy
16851 <p><q>X<q>Y</q>Z</q></p>
16852 !! end
16853
16854 # Note that tidy doesn't handle this correctly.
16855 !! test
16856 Nesting of <ruby>
16857 !! wikitext
16858 <ruby>X<ruby>Y</ruby>Z</ruby>
16859 !! html
16860 <p><ruby>X<ruby>Y</ruby>Z</ruby>
16861 </p>
16862 !! end
16863
16864 # Note that tidy doesn't handle this correctly.
16865 !! test
16866 Nesting of <bdo>
16867 !! wikitext
16868 <bdo>X<bdo>Y</bdo>Z</bdo>
16869 !! html
16870 <p><bdo>X<bdo>Y</bdo>Z</bdo>
16871 </p>
16872 !! end
16873
16874
16875 ###
16876 ### Media links
16877 ###
16878
16879 !! test
16880 Media link
16881 !! wikitext
16882 [[Media:Foobar.jpg]]
16883 !! html/php
16884 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
16885 </p>
16886 !! html/parsoid
16887 <p><a rel="mw:MediaLink" href="//example.com/images/3/3a/Foobar.jpg" title="Foobar.jpg">Media:Foobar.jpg</a></p>
16888 !! end
16889
16890 !! test
16891 Media link with text
16892 !! wikitext
16893 [[Media:Foobar.jpg|A neat file to look at]]
16894 !! html/php
16895 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
16896 </p>
16897 !! html/parsoid
16898 <p><a rel="mw:MediaLink" href="//example.com/images/3/3a/Foobar.jpg" title="Foobar.jpg">A neat file to look at</a></p>
16899 !! end
16900
16901 # FIXME: this is still bad HTML tag nesting
16902 # FIXME: doBlockLevels won't wrap this in a paragraph because it contains a div
16903 !! test
16904 Media link with nasty text
16905 !! wikitext
16906 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
16907 !! html/php
16908 <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>
16909
16910 !! html+php/tidy
16911 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Safe Link</a></p>
16912 <div style="display:none">" onmouseover="alert(document.cookie)" onfoo="</div>
16913 !! html/parsoid
16914 <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>
16915
16916 !! end
16917
16918 !! test
16919 Media link to nonexistent file (T3702)
16920 !! wikitext
16921 [[Media:No such.jpg]]
16922 [[Media:No_such file.jpg]]
16923 !! html/php
16924 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
16925 <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>
16926 </p>
16927 !! html/parsoid
16928 <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>
16929 <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>
16930 !! end
16931
16932 !! test
16933 Image link to nonexistent file (T3850 - good)
16934 !! wikitext
16935 [[File:No_such.jpg]]
16936 !! html/php
16937 <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>
16938 </p>
16939 !! html/parsoid
16940 <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>
16941 !! end
16942
16943 !! test
16944 :Image link to nonexistent file (T3850 - bad)
16945 !! wikitext
16946 [[:Image:No such.jpg]]
16947 !! html/php
16948 <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>
16949 </p>
16950 !! html/parsoid
16951 <p><a rel="mw:WikiLink" href="./File:No_such.jpg" title="File:No such.jpg">Image:No such.jpg</a></p>
16952 !! end
16953
16954
16955
16956 !! test
16957 Character reference normalization in link text (T3938)
16958 !! wikitext
16959 [[Main Page|this&that]]
16960 !! html
16961 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
16962 </p>
16963 !!end
16964
16965 !! article
16966 אַ
16967 !! text
16968 Test for unicode normalization
16969
16970 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
16971 !! endarticle
16972
16973 !! test
16974 (T21451) Links should refer to the normalized form.
16975 !! wikitext
16976 [[&#xFB2E;]]
16977 [[&#x5d0;&#x5b7;]]
16978 [[&#x5d0;ַ]]
16979 [[א&#x5b7;]]
16980 [[אַ]]
16981 !! html
16982 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
16983 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
16984 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
16985 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
16986 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
16987 </p>
16988 !! end
16989
16990 !! test
16991 Empty attribute crash test (T4067)
16992 !! wikitext
16993 <font color="">foo</font>
16994 !! html
16995 <p><font color="">foo</font>
16996 </p>
16997 !! end
16998
16999 !! test
17000 Empty attribute crash test single-quotes (T4067)
17001 !! wikitext
17002 <font color=''>foo</font>
17003 !! html
17004 <p><font color="">foo</font>
17005 </p>
17006 !! end
17007
17008 !! test
17009 Attribute test: equals, then nothing
17010 !! options
17011 parsoid=wt2html,html2html
17012 !! wikitext
17013 <font color=>foo</font>
17014 !! html/php
17015 <p><font color="">foo</font>
17016 </p>
17017 !! html/parsoid
17018 <p><font color="" data-parsoid='{"stx":"html"}'>foo</font></p>
17019 !! end
17020
17021 !! test
17022 Attribute test: unquoted value
17023 !! options
17024 parsoid=wt2html,html2html
17025 !! wikitext
17026 <font color=x>foo</font>
17027 !! html/php
17028 <p><font color="x">foo</font>
17029 </p>
17030 !! html/parsoid
17031 <p><font color="x" data-parsoid='{"stx":"html"}'>foo</font></p>
17032 !! end
17033
17034 !! test
17035 Attribute test: unquoted but illegal value (hash)
17036 !! wikitext
17037 <font color=#x>foo</font>
17038 !! html
17039 <p><font color="#x">foo</font>
17040 </p>
17041 !! end
17042
17043 # Parsoid does not serialize to empty attribute syntax,
17044 # so wt2wt and html2wt cases are skipped
17045 !! test
17046 Attribute test: no value (T54330)
17047 !! options
17048 parsoid=wt2html,html2html
17049 !! wikitext
17050 <font color>foo</font>
17051 !! html/php
17052 <p><font color="">foo</font>
17053 </p>
17054 !! html/parsoid
17055 <p><font color="">foo</font></p>
17056 !! end
17057
17058 !! test
17059 T4095: link with three closing brackets
17060 !! wikitext
17061 [[Main Page]]]
17062 !! html/php
17063 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
17064 </p>
17065 !! html/parsoid
17066 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a>]</p>
17067 !! end
17068
17069 !! test
17070 T4095: link with pipe and three closing brackets
17071 !! wikitext
17072 [[Main Page|link]]]
17073 !! html/php
17074 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
17075 </p>
17076 !! html/parsoid
17077 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">link</a>]</p>
17078 !! end
17079
17080 !! test
17081 T4095: link with pipe and three closing brackets, version 2
17082 !! wikitext
17083 [[Main Page|[http://example.com/]]]
17084 !! html/php
17085 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
17086 </p>
17087 !! html/parsoid
17088 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">[http://example.com/]</a></p>
17089 !! end
17090
17091
17092 ###
17093 ### Safety
17094 ###
17095
17096 !! article
17097 Template:Dangerous attribute
17098 !! text
17099 " onmouseover="alert(document.cookie)
17100 !! endarticle
17101
17102 !! article
17103 Template:Dangerous style attribute
17104 !! text
17105 border-size: expression(alert(document.cookie))
17106 !! endarticle
17107
17108 !! article
17109 Template:Div style
17110 !! text
17111 <div style="float: right; {{{1}}}">Magic div</div>
17112 !! endarticle
17113
17114 !! test
17115 T4304: HTML attribute safety (safe template; regression T4309)
17116 !! wikitext
17117 <div title="{{test}}"></div>
17118 !! html/php
17119 <div title="This is a test template"></div>
17120
17121 !! html/parsoid
17122 <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>
17123 !! end
17124
17125 # Parsoid has enough context to handle this case
17126 !! test
17127 T4304: HTML attribute safety (dangerous template; 2309)
17128 !! wikitext
17129 <div title="{{dangerous attribute}}"></div>
17130 !! html/php
17131 <div title=""></div>
17132
17133 !! html/parsoid
17134 <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>
17135 !! end
17136
17137 !! test
17138 T4304: HTML attribute safety (dangerous style template; 2309)
17139 !! wikitext
17140 <div style="{{dangerous style attribute}}"></div>
17141 !! html/php
17142 <div style="/* insecure input */"></div>
17143
17144 !! html/parsoid
17145 <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>
17146 !! end
17147
17148 !! test
17149 T4304: HTML attribute safety (safe parameter; 2309)
17150 !! wikitext
17151 {{div style|width: 200px}}
17152 !! html/php
17153 <div style="float: right; width: 200px">Magic div</div>
17154
17155 !! html/parsoid
17156 <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>
17157 !! end
17158
17159 !! test
17160 T4304: HTML attribute safety (unsafe parameter; 2309)
17161 !! wikitext
17162 {{div style|width: expression(alert(document.cookie))}}
17163 !! html/php
17164 <div style="/* insecure input */">Magic div</div>
17165
17166 !! html/parsoid
17167 <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>
17168 !! end
17169
17170 ## Parsoid output here differs; needs investigation.
17171 !! test
17172 T4304: HTML attribute safety (unsafe breakout parameter; 2309)
17173 !! wikitext
17174 {{div style|"><script>alert(document.cookie)</script>}}
17175 !! html
17176 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
17177
17178 !! end
17179
17180 ## Parsoid output here differs; needs investigation.
17181 !! test
17182 T4304: HTML attribute safety (unsafe breakout parameter 2; 2309)
17183 !! wikitext
17184 {{div style|" ><script>alert(document.cookie)</script>}}
17185 !! html
17186 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
17187
17188 !! end
17189
17190 !! test
17191 T4304: HTML attribute safety (link)
17192 !! wikitext
17193 <div title="[[Main Page]]"></div>
17194 !! html
17195 <div title="&#91;&#91;Main Page]]"></div>
17196
17197 !! end
17198
17199 !! test
17200 T4304: HTML attribute safety (italics)
17201 !! wikitext
17202 <div title="''foobar''"></div>
17203 !! html
17204 <div title="&#39;&#39;foobar&#39;&#39;"></div>
17205
17206 !! end
17207
17208 !! test
17209 T4304: HTML attribute safety (bold)
17210 !! wikitext
17211 <div title="'''foobar'''"></div>
17212 !! html
17213 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
17214
17215 !! end
17216
17217 !! test
17218 T4304: HTML attribute safety (ISBN)
17219 !! wikitext
17220 <div title="ISBN 1234567890"></div>
17221 !! html
17222 <div title="&#73;SBN 1234567890"></div>
17223
17224 !! end
17225
17226 !! test
17227 T4304: HTML attribute safety (RFC)
17228 !! wikitext
17229 <div title="RFC 1234"></div>
17230 !! html
17231 <div title="&#82;FC 1234"></div>
17232
17233 !! end
17234
17235 !! test
17236 T4304: HTML attribute safety (PMID)
17237 !! wikitext
17238 <div title="PMID 1234567890"></div>
17239 !! html
17240 <div title="&#80;MID 1234567890"></div>
17241
17242 !! end
17243
17244 !! test
17245 T4304: HTML attribute safety (web link)
17246 !! wikitext
17247 <div title="http://example.com/"></div>
17248 !! html
17249 <div title="http&#58;//example.com/"></div>
17250
17251 !! end
17252
17253 !! test
17254 T4304: HTML attribute safety (named web link)
17255 !! wikitext
17256 <div title="[http://example.com/ link]"></div>
17257 !! html
17258 <div title="&#91;http&#58;//example.com/ link]"></div>
17259
17260 !! end
17261
17262 !! test
17263 T5244: HTML attribute safety (extension; safe)
17264 !! wikitext
17265 <div style="<nowiki>background:blue</nowiki>"></div>
17266 !! html/php
17267 <div style="background:blue"></div>
17268
17269 !! html/parsoid
17270 <div style="background:blue" data-parsoid='{"stx":"html","a":{"style":"background:blue"},"sa":{"style":"&lt;nowiki>background:blue&lt;/nowiki>"}}'></div>
17271 !! end
17272
17273 !! test
17274 T5244: HTML attribute safety (extension; unsafe)
17275 !! wikitext
17276 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
17277 !! html/php
17278 <div style="/* insecure input */"></div>
17279
17280 !! html/parsoid
17281 <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>
17282 !! end
17283
17284 # More MSIE fun discovered by Tom Gilder
17285
17286 !! test
17287 MSIE CSS safety test: spurious slash
17288 !! wikitext
17289 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
17290 !! html/php
17291 <div style="/* insecure input */">evil</div>
17292
17293 !! html/parsoid
17294 <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>
17295 !! end
17296
17297 !! test
17298 MSIE CSS safety test: hex code
17299 !! wikitext
17300 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
17301 !! html/php
17302 <div style="/* insecure input */">evil</div>
17303
17304 !! html/parsoid
17305 <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>
17306 !! end
17307
17308 !! test
17309 MSIE CSS safety test: comment in url
17310 !! wikitext
17311 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
17312 !! html/php
17313 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
17314
17315 !! html/parsoid
17316 <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>
17317 !! end
17318
17319 !! test
17320 MSIE CSS safety test: comment in expression
17321 !! wikitext
17322 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
17323 !! html/php
17324 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
17325
17326 !! html/parsoid
17327 <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>
17328 !! end
17329
17330 !! test
17331 CSS safety test (all browsers): vertical tab (T57332 / CVE-2013-4567)
17332 !! wikitext
17333 <p style="font-size: 100px; background-image:url\b(https://www.google.com/images/srpr/logo6w.png)">A</p>
17334 !! html/php
17335 <p style="/* invalid control char */">A</p>
17336
17337 !! html/parsoid
17338 <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>
17339 !! end
17340
17341 !! test
17342 MSIE 6 CSS safety test: Fullwidth (T57332)
17343 !! wikitext
17344 <p style="font-size: 100px; color: expression((title='XSSed'),'red')">A</p>
17345 <div style="top:EXPRESSION(alert())">B</div>
17346 !! html/php
17347 <p style="/* insecure input */">A</p>
17348 <div style="/* insecure input */">B</div>
17349
17350 !! html/parsoid
17351 <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>
17352 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"top:EXPRESSION(alert())"}}'>B</div>
17353 !! end
17354
17355 !! test
17356 MSIE 6 CSS safety test: IPA extensions (T57332)
17357 !! wikitext
17358 <div style="background-image:uʀʟ(javascript:alert())">A</div>
17359 <p style="font-size: 100px; color: expʀessɪoɴ((title='XSSed'),'red')">B</p>
17360 !! html/php
17361 <div style="/* insecure input */">A</div>
17362 <p style="/* insecure input */">B</p>
17363
17364 !! html/parsoid
17365 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"background-image:uʀʟ(javascript:alert())"}}'>A</div>
17366 <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>
17367 !! end
17368
17369 !! test
17370 MSIE 6 CSS safety test: sup/sub script (T57332)
17371 !! wikitext
17372 <div style="background-image:url⁽javascript:alert())">A</div>
17373 <div style="background-image:url₍javascript:alert())">B</div>
17374 <p style="font-size: 100px; color: expressioⁿ((title='XSSed'),'red')">C</p>
17375 !! html/php
17376 <div style="/* insecure input */">A</div>
17377 <div style="/* insecure input */">B</div>
17378 <p style="/* insecure input */">C</p>
17379
17380 !! html/parsoid
17381 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"background-image:url⁽javascript:alert())"}}'>A</div>
17382 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"background-image:url₍javascript:alert())"}}'>B</div>
17383 <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>
17384 !! end
17385
17386 !! test
17387 Opera -o-link CSS
17388 !! options
17389 parsoid=wt2html,html2html
17390 !! wikitext
17391 <div
17392 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;"
17393 style="-o-link:attr(title);-o-link-source:current">X</div>
17394 !! html/php
17395 <div title="data:text/html,&lt;img src=1 onerror=alert(1)&gt;" style="/* insecure input */">X</div>
17396
17397 !! html/parsoid
17398 <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>
17399 !! end
17400
17401 !! test
17402 MSIE 6 CSS safety test: Repetition markers (T57332)
17403 !! wikitext
17404 <p style="font-size: 100px; color: expres〱ion((title='XSSed'),'red')">A</p>
17405 <p style="font-size: 100px; color: expresゝion((title='XSSed'),'red')">B</p>
17406 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">C</p>
17407 <p style="font-size: 100px; color: expresヽion((title='XSSed'),'red')">D</p>
17408 <p style="font-size: 100px; color: expresﹽion((title='XSSed'),'red')">E</p>
17409 <p style="font-size: 100px; color: expresﹼion((title='XSSed'),'red')">F</p>
17410 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">G</p>
17411 !! html/php
17412 <p style="/* insecure input */">A</p>
17413 <p style="/* insecure input */">B</p>
17414 <p style="/* insecure input */">C</p>
17415 <p style="/* insecure input */">D</p>
17416 <p style="/* insecure input */">E</p>
17417 <p style="/* insecure input */">F</p>
17418 <p style="/* insecure input */">G</p>
17419
17420 !! html/parsoid
17421 <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>
17422 <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>
17423 <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>
17424 <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>
17425 <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>
17426 <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>
17427 <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>
17428 !! end
17429
17430 !! test
17431 Table attribute legitimate extension
17432 !! wikitext
17433 {|
17434 !+ style="<nowiki>color:blue</nowiki>"| status
17435 |}
17436 !! html
17437 <table>
17438 <tr>
17439 <th style="color:blue"> status
17440 </th></tr></table>
17441
17442 !!end
17443
17444 !! test
17445 Table attribute safety
17446 !! wikitext
17447 {|
17448 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
17449 |}
17450 !! html
17451 <table>
17452 <tr>
17453 <th style="/* insecure input */"> status
17454 </th></tr></table>
17455
17456 !! end
17457
17458 !! test
17459 CSS line continuation 1
17460 !! wikitext
17461 <div style="background-image: u\&#10;rl(test.jpg);"></div>
17462 !! html
17463 <div style="/* insecure input */"></div>
17464
17465 !! end
17466
17467 !! test
17468 CSS line continuation 2
17469 !! wikitext
17470 <div style="background-image: u\&#13;rl(test.jpg); "></div>
17471 !! html
17472 <div style="/* invalid control char */"></div>
17473
17474 !! end
17475
17476 !! article
17477 Template:Identity
17478 !! text
17479 {{{1}}}
17480 !! endarticle
17481
17482 !! test
17483 Expansion of multi-line templates in attribute values (T8255)
17484 !! wikitext
17485 <div style="background: {{identity|#00FF00}}">-</div>
17486 !! html
17487 <div style="background: #00FF00">-</div>
17488
17489 !! end
17490
17491 !! test
17492 Expansion of multi-line templates in attribute values (T8255 sanity check)
17493 !! wikitext
17494 <div style="background:
17495 #00FF00">-</div>
17496 !! html/php
17497 <div style="background: #00FF00">-</div>
17498
17499 !! html/parsoid
17500 <div style="background:
17501 #00FF00">-</div>
17502 !! end
17503
17504 !! test
17505 Expansion of multi-line templates in attribute values (T8255 sanity check 2)
17506 !! wikitext
17507 <div style="background: &#10;#00FF00">-</div>
17508 !! html
17509 <div style="background: &#10;#00FF00">-</div>
17510
17511 !! end
17512
17513 !! test
17514 Tags which are hidden from Tidy cannot pass through the Sanitizer
17515 !! wikitext
17516 <mw:toc><script>alert();</script></mw:toc>
17517 !! html+tidy
17518 <p>&lt;mw:toc&gt;&lt;script&gt;alert();&lt;/script&gt;&lt;/mw:toc&gt;</p>
17519 !! end
17520
17521 ###
17522 ### Parser hooks (see tests/parser/parserTestsParserHook.php for the <tag> extension)
17523 ###
17524
17525 !! test
17526 Parser hook: empty input
17527 !! wikitext
17528 <tag></tag>
17529 !! html/php
17530 <pre>
17531 ''
17532 array (
17533 )
17534 </pre>
17535
17536 !! html/parsoid
17537 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
17538 !! end
17539
17540 ## Don't expect parsoid to rt this form.
17541 !! test
17542 Parser hook: empty input using terminated empty elements
17543 !! options
17544 parsoid=wt2html,html2html
17545 !! wikitext
17546 <tag/>
17547 !! html/php
17548 <pre>
17549 NULL
17550 array (
17551 )
17552 </pre>
17553
17554 !! html/parsoid
17555 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":null}' data-parsoid='{}' about="#mwt2"></pre>
17556 !! end
17557
17558 !! test
17559 Parser hook: empty input using terminated empty elements (space before)
17560 !! wikitext
17561 <tag />
17562 !! html/php
17563 <pre>
17564 NULL
17565 array (
17566 )
17567 </pre>
17568
17569 !! html/parsoid
17570 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":null}' data-parsoid='{}' about="#mwt2"></pre>
17571 !! end
17572
17573 !! test
17574 Parser hook: basic input
17575 !! wikitext
17576 <tag>input</tag>
17577 !! html/php
17578 <pre>
17579 'input'
17580 array (
17581 )
17582 </pre>
17583
17584 !! html/parsoid
17585 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
17586 !! end
17587
17588 ## Don't expect parsoid to rt this form.
17589 !! test
17590 Parser hook: case insensitive
17591 !! options
17592 parsoid=wt2html,html2html
17593 !! wikitext
17594 <TAG>input</TAG>
17595 !! html/php
17596 <pre>
17597 'input'
17598 array (
17599 )
17600 </pre>
17601
17602 !! html/parsoid
17603 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
17604 !! end
17605
17606 ## Don't expect parsoid to rt this form.
17607 !! test
17608 Parser hook: case insensitive, redux
17609 !! options
17610 parsoid=wt2html,html2html
17611 !! wikitext
17612 <TaG>input</TAg>
17613 !! html/php
17614 <pre>
17615 'input'
17616 array (
17617 )
17618 </pre>
17619
17620 !! html/parsoid
17621 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
17622 !! end
17623
17624 !! test
17625 Parser hook: nested tags
17626 !! wikitext
17627 <tag><tag></tag></tag>
17628 !! html/php
17629 <pre>
17630 '<tag>'
17631 array (
17632 )
17633 </pre>&lt;/tag&gt;
17634
17635 !! html/parsoid
17636 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"&lt;tag>"}}' data-parsoid='{}' about="#mwt2"></pre>&lt;/tag>
17637 !! end
17638
17639 !! test
17640 Parser hook: basic arguments
17641 !! wikitext
17642 <tag width="200" height="100" depth="50" square=""></tag>
17643 !! html/php
17644 <pre>
17645 ''
17646 array (
17647 'width' => '200',
17648 'height' => '100',
17649 'depth' => '50',
17650 'square' => '',
17651 )
17652 </pre>
17653
17654 !! html/parsoid
17655 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
17656 !! end
17657
17658 ## Don't expect parsoid to rt this form.
17659 !! test
17660 Parser hook: basic arguments, variations
17661 !! options
17662 parsoid=wt2html,html2html
17663 !! wikitext
17664 <tag width=200 height = "100" depth = '50' square></tag>
17665 !! html/php
17666 <pre>
17667 ''
17668 array (
17669 'width' => '200',
17670 'height' => '100',
17671 'depth' => '50',
17672 'square' => '',
17673 )
17674 </pre>
17675
17676 !! html/parsoid
17677 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
17678 !! end
17679
17680 !! test
17681 Parser hook: argument containing a forward slash (T7344)
17682 !! wikitext
17683 <tag filename="/tmp/bla"></tag>
17684 !! html/php
17685 <pre>
17686 ''
17687 array (
17688 'filename' => '/tmp/bla',
17689 )
17690 </pre>
17691
17692 !! html/parsoid
17693 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"filename":"/tmp/bla"},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
17694 !! end
17695
17696 ## Don't expect parsoid to rt this form.
17697 !! test
17698 Parser hook: empty input using terminated empty elements (T4374)
17699 !! options
17700 parsoid=wt2html,html2html
17701 !! wikitext
17702 <tag foo=bar/>text
17703 !! html/php
17704 <pre>
17705 NULL
17706 array (
17707 'foo' => 'bar',
17708 )
17709 </pre>text
17710
17711 !! html/parsoid
17712 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"foo":"bar"},"body":null}' data-parsoid='{}' about="#mwt2"></pre>text
17713 !! end
17714
17715 ## </tag> should be output literally since there is no matching tag that begins it
17716 ## Don't expect parsoid to rt this form.
17717 !! test
17718 Parser hook: basic arguments using terminated empty elements (T4374)
17719 !! options
17720 parsoid=wt2html
17721 !! wikitext
17722 <tag width=200 height = "100" depth = '50' square/>
17723 other stuff
17724 </tag>
17725 !! html/php
17726 <pre>
17727 NULL
17728 array (
17729 'width' => '200',
17730 'height' => '100',
17731 'depth' => '50',
17732 'square' => '',
17733 )
17734 </pre>
17735 <p>other stuff
17736 &lt;/tag&gt;
17737 </p>
17738 !! html/parsoid
17739 <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
17740 &lt;/tag></p>
17741 !! end
17742
17743 ## Don't expect parsoid to rt this form.
17744 !! test
17745 Parser hook: Don't allow unclosed extension tags
17746 !! options
17747 parsoid=wt2html
17748 !! wikitext
17749 test <tag>123
17750
17751 this is a '''test'''
17752 !! html/php
17753 <p>test &lt;tag&gt;123
17754 </p><p>this is a <b>test</b>
17755 </p>
17756 !! html/parsoid
17757 <p>test &lt;tag>123</p>
17758
17759 <p>this is a <b>test</b></p>
17760 !! end
17761
17762 ###
17763 ### (see tests/parser/parserTestsParserHook.php for the <statictag> extension)
17764 ###
17765
17766 !! test
17767 Parser hook: static parser hook not inside a comment
17768 !! wikitext
17769 <statictag>hello, world</statictag>
17770
17771 <statictag action="flush" />
17772 !! html/php
17773 <p><br />
17774 hello, world
17775 </p>
17776 !! html/parsoid
17777 <p><span typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{},"body":{"extsrc":"hello, world"}}' data-parsoid='{}' about="#mwt2"></span></p>
17778 <p typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{"action":"flush"},"body":null}' data-parsoid='{}' about="#mwt4">hello, world</p>
17779 !! end
17780
17781 !! test
17782 Parser hook: static parser hook inside a comment
17783 !! wikitext
17784 <!-- <statictag>hello, world</statictag> -->
17785 <statictag action="flush" />
17786 !! html/php
17787 <p><br />
17788 </p>
17789 !! html/parsoid
17790 <!-- <statictag&#x3E;hello, world</statictag&#x3E; -->
17791 <p typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{"action":"flush"},"body":null}' data-parsoid='{}' about="#mwt2"></p>
17792 !! end
17793
17794 # Nested template calls; this case was broken by Parser.php rev 1.506,
17795 # since reverted.
17796
17797 !! article
17798 Template:One-parameter
17799 !! text
17800 (My parameter is: {{{1}}})
17801 !! endarticle
17802
17803 !! article
17804 Template:Map-one-parameter
17805 !! text
17806 {{{{{1}}}|{{{2}}}}}
17807 !! endarticle
17808
17809 !! test
17810 Nested template calls
17811 !! wikitext
17812 {{Map-one-parameter|One-parameter|param}}
17813 !! html
17814 <p>(My parameter is: param)
17815 </p>
17816 !! end
17817
17818
17819 ###
17820 ### Sanitizer
17821 ###
17822
17823 # HTML+Tidy effectively strips out the empty tags completely
17824 # But since Parsoid doesn't it wraps the <s></s> tags in p-tags
17825 # which Tidy would have done for the PHP parser had there been content inside it.
17826 !! test
17827 Sanitizer: Closing of open tags
17828 !! wikitext
17829 <s></s><table></table>
17830 !! html
17831 <s></s><table></table>
17832
17833 !! html/parsoid
17834 <p><s></s></p><table></table>
17835 !! end
17836
17837 !! test
17838 Sanitizer: Closing of open but not closed tags
17839 !! wikitext
17840 <s>foo
17841 !! html
17842 <p><s>foo</s>
17843 </p>
17844 !! end
17845
17846 !! test
17847 Sanitizer: Closing of closed but not open tags
17848 !! options
17849 parsoid=wt2html
17850 !! wikitext
17851 </s>
17852 !! html/php+tidy
17853 !! html/parsoid
17854 !! end
17855
17856 !! test
17857 Sanitizer: Closing of closed but not open table tags
17858 !! options
17859 parsoid=wt2html
17860 !! wikitext
17861 Table not started</td></tr></table>
17862 !! html/php+tidy
17863 <p>Table not started</p>
17864 !! html/parsoid
17865 <p>Table not started</p>
17866 !! end
17867
17868 !! test
17869 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
17870 !! wikitext
17871 <span id="æ: v">byte</span>[[#æ: v|backlink]]
17872 !! html/php
17873 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
17874 </p>
17875 !! html/parsoid
17876 <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>
17877 !! end
17878
17879 # In HTML5, the restrictions are that id must contain at least one character,
17880 # and must not contain any space characters.
17881 !! test
17882 Sanitizer: Validating the contents of the id attribute (T6515)
17883 !! options
17884 disabled
17885 !! wikitext
17886 <br id="" /><br id="a space" />
17887 !! html
17888 Something ...
17889 !! end
17890
17891 # In HTML5, id must be unique amongst all the ids in the element's home subtree.
17892 !! test
17893 Sanitizer: Validating id attribute uniqueness (T6515, T8301)
17894 !! options
17895 disabled
17896 !! wikitext
17897 <br id="foo" /><br id="foo" />
17898 !! html
17899 Something need to be done. foo-2 ?
17900 !! end
17901
17902 !! test
17903 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
17904 !! wikitext
17905 <div itemscope>
17906 <meta itemprop="hello" content="world">
17907 <meta http-equiv="refresh" content="5">
17908 <meta itemprop="hello" http-equiv="refresh" content="5">
17909 <link itemprop="hello" href="{{SERVER}}">
17910 <link rel="stylesheet" href="{{SERVER}}">
17911 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
17912 </div>
17913 !! html
17914 <div itemscope="">
17915 <p> <meta itemprop="hello" content="world" />
17916 &lt;meta http-equiv="refresh" content="5"&gt;
17917 <meta itemprop="hello" content="5" />
17918 <link itemprop="hello" href="http&#58;//example.org" />
17919 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
17920 <link itemprop="hello" href="http&#58;//example.org" />
17921 </p>
17922 </div>
17923
17924 !! end
17925
17926 !! test
17927 Sanitizer: Strip comments from CSS attributes
17928 !! options
17929 parsoid=wt2html,wt2wt
17930 !! wikitext
17931 <span style="margin:/*negate mbox-text padding */-0.125em -0.45em; /*rainbow*/rgba(255, 0, 0, 0.3)">2013</span>
17932 !! html/php
17933 <p><span style="margin: -0.125em -0.45em; rgba(255, 0, 0, 0.3)">2013</span>
17934 </p>
17935 !! html/parsoid
17936 <p><span style="margin: -0.125em -0.45em; rgba(255, 0, 0, 0.3)">2013</span></p>
17937 !! end
17938
17939 !! test
17940 Language converter: output gets cut off unexpectedly (T7757)
17941 !! options
17942 language=zh
17943 !! wikitext
17944 this bit is safe: }-
17945
17946 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
17947
17948 then we get cut off here: }-
17949
17950 all additional text is vanished
17951 !! html
17952 <p>this bit is safe: }-
17953 </p><p>but if we add a conversion instance: xxx
17954 </p><p>then we get cut off here: }-
17955 </p><p>all additional text is vanished
17956 </p>
17957 !! end
17958
17959 !! test
17960 Self closed html pairs (T7487)
17961 !! wikitext
17962 <center><font id="bug" />Centered text</center>
17963 <div><font id="bug2" />In div text</div>
17964 !! html+tidy
17965 <center><font id="bug"></font>Centered text</center>
17966 <div><font id="bug2"></font>In div text</div>
17967 !! end
17968
17969 #
17970 #
17971 #
17972
17973 !! test
17974 Punctuation: nbsp before exclamation
17975 !! wikitext
17976 C'est grave !
17977 !! html
17978 <p>C'est grave&#160;!
17979 </p>
17980 !! end
17981
17982 !! test
17983 Punctuation: CSS !important (T13874)
17984 !! wikitext
17985 <div style="width:50% !important">important</div>
17986 !! html
17987 <div style="width:50% !important">important</div>
17988
17989 !!end
17990
17991 !! test
17992 Punctuation: CSS ! important (T13874; with space after)
17993 !! wikitext
17994 <div style="width:50% ! important">important</div>
17995 !! html
17996 <div style="width:50% ! important">important</div>
17997
17998 !!end
17999
18000 !! test
18001 HTML bullet list, closed tags (T7497)
18002 !! wikitext
18003 <ul>
18004 <li>One</li>
18005 <li>Two</li>
18006 </ul>
18007 !! html/php
18008 <ul>
18009 <li>One</li>
18010 <li>Two</li>
18011 </ul>
18012
18013 !! html/parsoid
18014 <ul data-parsoid='{"stx":"html"}'>
18015 <li data-parsoid='{"stx":"html"}'>One</li>
18016 <li data-parsoid='{"stx":"html"}'>Two</li>
18017 </ul>
18018
18019 !! end
18020
18021 !! test
18022 HTML bullet list, unclosed tags (T7497)
18023 !! wikitext
18024 <ul>
18025 <li>One
18026 <li>Two
18027 </ul>
18028 !! html/php+tidy
18029 <ul>
18030 <li>One</li>
18031 <li>Two</li>
18032 </ul>
18033 !! html/parsoid
18034 <ul data-parsoid='{"stx":"html"}'>
18035 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
18036 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
18037 </ul>
18038
18039 !! end
18040
18041 !! test
18042 HTML ordered list, closed tags (T7497)
18043 !! wikitext
18044 <ol>
18045 <li>One</li>
18046 <li>Two</li>
18047 </ol>
18048 !! html/php
18049 <ol>
18050 <li>One</li>
18051 <li>Two</li>
18052 </ol>
18053
18054 !! html/parsoid
18055 <ol data-parsoid='{"stx":"html"}'>
18056 <li data-parsoid='{"stx":"html"}'>One</li>
18057 <li data-parsoid='{"stx":"html"}'>Two</li>
18058 </ol>
18059
18060 !! end
18061
18062 !! test
18063 HTML ordered list, unclosed tags (T7497)
18064 !! options
18065 !! wikitext
18066 <ol>
18067 <li>One
18068 <li>Two
18069 </ol>
18070 !! html/php+tidy
18071 <ol>
18072 <li>One</li>
18073 <li>Two</li>
18074 </ol>
18075 !! html/parsoid
18076 <ol data-parsoid='{"stx":"html"}'>
18077 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
18078 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
18079 </ol>
18080
18081 !! end
18082
18083 !! test
18084 HTML nested bullet list, closed tags (T7497)
18085 !! wikitext
18086 <ul>
18087 <li>One</li>
18088 <li>Two:
18089 <ul>
18090 <li>Sub-one</li>
18091 <li>Sub-two</li>
18092 </ul>
18093 </li>
18094 </ul>
18095 !! html/php
18096 <ul>
18097 <li>One</li>
18098 <li>Two:
18099 <ul>
18100 <li>Sub-one</li>
18101 <li>Sub-two</li>
18102 </ul>
18103 </li>
18104 </ul>
18105
18106 !! html/parsoid
18107 <ul data-parsoid='{"stx":"html"}'>
18108 <li data-parsoid='{"stx":"html"}'>One</li>
18109 <li data-parsoid='{"stx":"html"}'>Two:
18110 <ul data-parsoid='{"stx":"html"}'>
18111 <li data-parsoid='{"stx":"html"}'>Sub-one</li>
18112 <li data-parsoid='{"stx":"html"}'>Sub-two</li>
18113 </ul>
18114 </li>
18115 </ul>
18116 !! end
18117
18118 !! test
18119 HTML nested bullet list, open tags (T7497)
18120 !! wikitext
18121 <ul>
18122 <li>One
18123 <li>Two:
18124 <ul>
18125 <li>Sub-one
18126 <li>Sub-two
18127 </ul>
18128 </ul>
18129 !! html/php+tidy
18130 <ul>
18131 <li>One</li>
18132 <li>Two:
18133 <ul>
18134 <li>Sub-one</li>
18135 <li>Sub-two</li>
18136 </ul>
18137 </li>
18138 </ul>
18139 !! html/parsoid
18140 <ul>
18141 <li>One
18142 </li>
18143 <li>Two:
18144 <ul>
18145 <li>Sub-one
18146 </li>
18147 <li>Sub-two
18148 </li>
18149 </ul>
18150 </li>
18151 </ul>
18152
18153 !! end
18154
18155 !! test
18156 HTML nested ordered list, closed tags (T7497)
18157 !! wikitext
18158 <ol>
18159 <li>One</li>
18160 <li>Two:
18161 <ol>
18162 <li>Sub-one</li>
18163 <li>Sub-two</li>
18164 </ol>
18165 </li>
18166 </ol>
18167 !! html
18168 <ol>
18169 <li>One</li>
18170 <li>Two:
18171 <ol>
18172 <li>Sub-one</li>
18173 <li>Sub-two</li>
18174 </ol>
18175 </li>
18176 </ol>
18177
18178 !! end
18179
18180 !! test
18181 HTML nested ordered list, open tags (T7497)
18182 !! wikitext
18183 <ol>
18184 <li>One
18185 <li>Two:
18186 <ol>
18187 <li>Sub-one
18188 <li>Sub-two
18189 </ol>
18190 </ol>
18191 !! html/php
18192 <ol>
18193 <li>One
18194 <li>Two:
18195 <ol>
18196 <li>Sub-one
18197 <li>Sub-two
18198 </ol>
18199 </ol>
18200
18201 !! html/parsoid
18202 <ol>
18203 <li>One
18204 </li>
18205 <li>Two:
18206 <ol>
18207 <li>Sub-one
18208 </li>
18209 <li>Sub-two
18210 </li>
18211 </ol>
18212 </li>
18213 </ol>
18214
18215 !! end
18216
18217 !! test
18218 HTML ordered list item with parameters oddity
18219 !! wikitext
18220 <ol><li id="fragment">One</li>
18221 </ol>
18222 !! html
18223 <ol><li id="fragment">One</li>
18224 </ol>
18225
18226 !! end
18227
18228 # parsoid doesn't explicitly mark autonumbered links, see T55505
18229 !!test
18230 T7918: autonumbering
18231 !! wikitext
18232 [http://first/] [http://second] [ftp://ftp]
18233
18234 ftp://inlineftp
18235
18236 [mailto:enclosed@mail.tld With target]
18237
18238 [mailto:enclosed@mail.tld]
18239
18240 mailto:inline@mail.tld
18241 !! html/php
18242 <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>
18243 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
18244 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
18245 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
18246 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
18247 </p>
18248 !! html/parsoid
18249 <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>
18250 <p><a rel="mw:ExtLink" href="ftp://inlineftp">ftp://inlineftp</a></p>
18251 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld">With target</a></p>
18252 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld"></a></p>
18253 <p><a rel="mw:ExtLink" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a></p>
18254 !! end
18255
18256
18257 #
18258 # Security and HTML correctness
18259 # From Nick Jenkins' fuzz testing
18260 #
18261
18262 !! test
18263 Fuzz testing: Parser13
18264 !! wikitext
18265 {|
18266 | http://a|
18267 !! html
18268 <table>
18269 <tr>
18270 <td>
18271 </td>
18272 </tr>
18273 </table>
18274
18275 !! end
18276
18277 !! test
18278 Fuzz testing: Parser14
18279 !! wikitext
18280 == onmouseover= ==
18281 http://__TOC__
18282 !! html
18283 <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>
18284 http://<div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
18285 <ul>
18286 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
18287 </ul>
18288 </div>
18289
18290
18291 !! html+tidy
18292 <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>
18293 <p>http://</p>
18294 <div id="toc" class="toc">
18295 <div class="toctitle">
18296 <h2>Contents</h2>
18297 </div>
18298 <ul>
18299 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
18300 </ul>
18301 </div>
18302 <p></p>
18303 !! end
18304
18305 !! test
18306 Fuzz testing: Parser14-table
18307 !! options
18308 parsoid=wt2html,html2html
18309 !! wikitext
18310 ==a==
18311 {| STYLE=__TOC__
18312 !! html
18313 <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>
18314 <table style="&#95;_TOC&#95;_">
18315 <tr><td></td></tr>
18316 </table>
18317
18318 !! html+tidy
18319 <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>
18320 <table style="__TOC__">
18321 <tr>
18322 <td></td>
18323 </tr>
18324 </table>
18325 !! html/parsoid
18326 <h2>a</h2>
18327 <table style="__TOC__"></table>
18328 !! end
18329
18330 # Known to produce bogus xml (extra </td>)
18331 !! test
18332 Fuzz testing: Parser16
18333 !! wikitext
18334 {|
18335 !https://||||||
18336 !! html
18337 <table>
18338 <tr>
18339 <th>https://</th>
18340 <th></th>
18341 <th></th>
18342 <th>
18343 </td>
18344 </tr>
18345 </table>
18346
18347 !! html+tidy
18348 <table>
18349 <tr>
18350 <th>https://</th>
18351 <th></th>
18352 <th></th>
18353 <th></th>
18354 </tr>
18355 </table>
18356 !! end
18357
18358 !! test
18359 Fuzz testing: Parser21
18360 !! wikitext
18361 {|
18362 ! irc://{{ftp://a" onmouseover="alert('hello world');"
18363 |
18364 !! html
18365 <table>
18366 <tr>
18367 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
18368 </th>
18369 <td>
18370 </td>
18371 </tr>
18372 </table>
18373
18374 !! end
18375
18376 !! test
18377 Fuzz testing: Parser22
18378 !! wikitext
18379 http://===r:::https://b
18380
18381 {|
18382 !! html
18383 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
18384 </p>
18385 <table>
18386 <tr><td></td></tr>
18387 </table>
18388
18389 !! end
18390
18391 # Known to produce bad XML for now
18392 !! test
18393 Fuzz testing: Parser24
18394 !! options
18395 parsoid=wt2html
18396 !! wikitext
18397 {|
18398 {{{|
18399 <u CLASS=
18400 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
18401 <br style="onmouseover='alert(document.cookie);' " />
18402
18403 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
18404 |
18405 !! html/php
18406 <table>
18407 {{{|
18408 <u class="&#124;">}}}} &gt;
18409 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
18410
18411 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
18412 <tr>
18413 <td></u>
18414 </td>
18415 </tr>
18416 </table>
18417
18418 !! html/parsoid
18419 <p data-parsoid='{"fostered":true,"autoInsertedEnd":true}'>{{{|
18420 <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>"}'/>}}}} >
18421 <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}'>
18422
18423
18424
18425 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'></td></tr></tbody></table>
18426 !! end
18427
18428 # Note: the current result listed for this is not what the original one was,
18429 # but the original bug was JavaScript injection, which is fixed in any case.
18430 # It's not clear that the original result listed was any more correct than the
18431 # current one. Original result:
18432 # <p>{{{|
18433 # </p>
18434 # <li class="&#124;&#124;">
18435 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
18436 !!test
18437 Fuzz testing: Parser25 (T8055)
18438 !! wikitext
18439 {{{
18440 |
18441 <LI CLASS=||
18442 >
18443 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
18444 !! html/php
18445 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
18446 </p>
18447 !! html/parsoid
18448 <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"]}'>
18449 </span><p about="#mwt1">&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b></p>
18450 !! end
18451
18452 !!test
18453 Fuzz testing: URL adjacent extension (with space, clean)
18454 !! wikitext
18455 http://example.com <nowiki>junk</nowiki>
18456 !! html/php
18457 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
18458 </p>
18459 !! html/parsoid
18460 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a> <span typeof="mw:Nowiki">junk</span></p>
18461 !! end
18462
18463 !!test
18464 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
18465 !! wikitext
18466 http://example.com<nowiki>junk</nowiki>
18467 !! html/php
18468 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
18469 </p>
18470 !! html/parsoid
18471 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a><span typeof="mw:Nowiki">junk</span></p>
18472 !! end
18473
18474 !! test
18475 Fuzz testing: URL adjacent extension (no space, dirty; pre)
18476 !! wikitext
18477 http://example.com<pre>junk</pre>
18478 !! html/php
18479 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
18480
18481 !! html/php+tidy
18482 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></p>
18483 <pre>
18484 junk
18485 </pre>
18486 !! html/parsoid
18487 <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>
18488 !! end
18489
18490 !! test
18491 Fuzz testing: image with bogus manual thumbnail
18492 !! wikitext
18493 [[Image:foobar.jpg|thumbnail= ]]
18494 !! html/php
18495 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
18496
18497 !! html/parsoid
18498 <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>
18499 !! end
18500
18501 !! test
18502 Fuzz testing: encoded newline in generated HTML replacements (T8577)
18503 !! wikitext
18504 <pre dir="&#10;"></pre>
18505 !! html/php
18506 <pre dir="&#10;"></pre>
18507
18508 !! html/parsoid
18509 <pre typeof="mw:Extension/pre" about="#mwt2" dir="&amp;#10;" data-mw='{"name":"pre","attrs":{"dir":"&amp;#10;"},"body":{"extsrc":""}}'></pre>
18510 !! end
18511
18512 !! test
18513 Parsing optional HTML elements (T8171)
18514 !! options
18515 !! wikitext
18516 <table>
18517 <tr>
18518 <td> Some tabular data</td>
18519 <td> More tabular data ...
18520 <td> And yet som tabular data</td>
18521 </tr>
18522 </table>
18523 !! html
18524 <table>
18525 <tr>
18526 <td> Some tabular data</td>
18527 <td> More tabular data ...
18528 </td><td> And yet som tabular data</td>
18529 </tr>
18530 </table>
18531
18532 !! end
18533
18534 !! test
18535 Correct handling of <td>, <tr> (T8171)
18536 !! options
18537 !! wikitext
18538 <table>
18539 <tr>
18540 <td> Some tabular data</td>
18541 <td> More tabular data ...</td>
18542 <td> And yet som tabular data</td>
18543 </tr>
18544 </table>
18545 !! html
18546 <table>
18547 <tr>
18548 <td> Some tabular data</td>
18549 <td> More tabular data ...</td>
18550 <td> And yet som tabular data</td>
18551 </tr>
18552 </table>
18553
18554 !! end
18555
18556
18557 !! test
18558 Parsing crashing regression (fr:JavaScript)
18559 !! wikitext
18560 </body></x>
18561 !! html
18562 <p>&lt;/body&gt;&lt;/x&gt;
18563 </p>
18564 !! end
18565
18566 !! test
18567 Inline wiki vs wiki block nesting
18568 !! wikitext
18569 '''Bold paragraph
18570
18571 New wiki paragraph
18572 !! html
18573 <p><b>Bold paragraph</b>
18574 </p><p>New wiki paragraph
18575 </p>
18576 !! end
18577
18578 # FIXME: The current php output is documented
18579 # and desired output is the parsoid target.
18580 !! test
18581 Inline HTML vs wiki block nesting
18582 !! wikitext
18583 <b>Bold paragraph
18584
18585 New wiki paragraph
18586 !! html/php
18587 <p><b>Bold paragraph
18588 </p><p>New wiki paragraph</b>
18589 </p>
18590 !! html/parsoid
18591 <p><b>Bold paragraph</b>
18592 </p><p>New wiki paragraph
18593 </p>
18594 !! end
18595
18596 # Original result was this:
18597 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
18598 # </p>
18599 # While that might be marginally more intuitive, maybe, the six-apostrophe
18600 # construct is clearly pathological and the result stated here (which is what
18601 # the parser actually does) is about as reasonable as anything.
18602 !!test
18603 Mixing markup for italics and bold
18604 !! options
18605 !! wikitext
18606 '''bold''''''bold''bolditalics'''''
18607 !! html
18608 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
18609 </p>
18610 !! end
18611
18612
18613 !! article
18614 Xyzzyx
18615 !! text
18616 Article for special page transclusion test
18617 !! endarticle
18618
18619 !! test
18620 Special page transclusion
18621 !! options
18622 !! wikitext
18623 {{Special:Prefixindex/Xyzzyx}}
18624 !! html
18625 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
18626 </ul>
18627
18628 !! end
18629
18630 !! test
18631 Special page transclusion twice (T7021)
18632 !! options
18633 !! wikitext
18634 {{Special:Prefixindex/Xyzzyx}}
18635 {{Special:Prefixindex/Xyzzyx}}
18636 !! html
18637 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
18638 </ul>
18639 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
18640 </ul>
18641
18642 !! end
18643
18644 !! test
18645 Transclusion of default MediaWiki message
18646 !! wikitext
18647 {{MediaWiki:Mainpage}}
18648 !! html
18649 <p>Main Page
18650 </p>
18651 !! end
18652
18653 !! test
18654 Transclusion of nonexistent MediaWiki message
18655 !! wikitext
18656 {{MediaWiki:Mainpagexxx}}
18657 !! html
18658 <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>
18659 </p>
18660 !! end
18661
18662 !! test
18663 Transclusion of MediaWiki message with underscore
18664 !! wikitext
18665 {{MediaWiki:history_short}}
18666 !! html
18667 <p>History
18668 </p>
18669 !! end
18670
18671 !! test
18672 Transclusion of MediaWiki message with space
18673 !! wikitext
18674 {{MediaWiki:history short}}
18675 !! html
18676 <p>History
18677 </p>
18678 !! end
18679
18680 !! test
18681 Invalid header with following text
18682 !! wikitext
18683 = x = y
18684 !! html
18685 <p>= x = y
18686 </p>
18687 !! end
18688
18689
18690 !! test
18691 Section extraction test (section 0)
18692 !! options
18693 section=0
18694 !! wikitext
18695 start
18696 ==a==
18697 ===aa===
18698 ====aaa====
18699 ==b==
18700 ===ba===
18701 ===bb===
18702 ====bba====
18703 ===bc===
18704 ==c==
18705 ===ca===
18706 !! html/php
18707 start
18708 !! end
18709
18710 !! test
18711 Section extraction test (section 1)
18712 !! options
18713 section=1
18714 !! wikitext
18715 start
18716 ==a==
18717 ===aa===
18718 ====aaa====
18719 ==b==
18720 ===ba===
18721 ===bb===
18722 ====bba====
18723 ===bc===
18724 ==c==
18725 ===ca===
18726 !! html/php
18727 ==a==
18728 ===aa===
18729 ====aaa====
18730 !! end
18731
18732 !! test
18733 Section extraction test (section 2)
18734 !! options
18735 section=2
18736 !! wikitext
18737 start
18738 ==a==
18739 ===aa===
18740 ====aaa====
18741 ==b==
18742 ===ba===
18743 ===bb===
18744 ====bba====
18745 ===bc===
18746 ==c==
18747 ===ca===
18748 !! html/php
18749 ===aa===
18750 ====aaa====
18751 !! end
18752
18753 !! test
18754 Section extraction test (section 3)
18755 !! options
18756 section=3
18757 !! wikitext
18758 start
18759 ==a==
18760 ===aa===
18761 ====aaa====
18762 ==b==
18763 ===ba===
18764 ===bb===
18765 ====bba====
18766 ===bc===
18767 ==c==
18768 ===ca===
18769 !! html/php
18770 ====aaa====
18771 !! end
18772
18773 !! test
18774 Section extraction test (section 4)
18775 !! options
18776 section=4
18777 !! wikitext
18778 start
18779 ==a==
18780 ===aa===
18781 ====aaa====
18782 ==b==
18783 ===ba===
18784 ===bb===
18785 ====bba====
18786 ===bc===
18787 ==c==
18788 ===ca===
18789 !! html/php
18790 ==b==
18791 ===ba===
18792 ===bb===
18793 ====bba====
18794 ===bc===
18795 !! end
18796
18797 !! test
18798 Section extraction test (section 5)
18799 !! options
18800 section=5
18801 !! wikitext
18802 start
18803 ==a==
18804 ===aa===
18805 ====aaa====
18806 ==b==
18807 ===ba===
18808 ===bb===
18809 ====bba====
18810 ===bc===
18811 ==c==
18812 ===ca===
18813 !! html/php
18814 ===ba===
18815 !! end
18816
18817 !! test
18818 Section extraction test (section 6)
18819 !! options
18820 section=6
18821 !! wikitext
18822 start
18823 ==a==
18824 ===aa===
18825 ====aaa====
18826 ==b==
18827 ===ba===
18828 ===bb===
18829 ====bba====
18830 ===bc===
18831 ==c==
18832 ===ca===
18833 !! html/php
18834 ===bb===
18835 ====bba====
18836 !! end
18837
18838 !! test
18839 Section extraction test (section 7)
18840 !! options
18841 section=7
18842 !! wikitext
18843 start
18844 ==a==
18845 ===aa===
18846 ====aaa====
18847 ==b==
18848 ===ba===
18849 ===bb===
18850 ====bba====
18851 ===bc===
18852 ==c==
18853 ===ca===
18854 !! html/php
18855 ====bba====
18856 !! end
18857
18858 !! test
18859 Section extraction test (section 8)
18860 !! options
18861 section=8
18862 !! wikitext
18863 start
18864 ==a==
18865 ===aa===
18866 ====aaa====
18867 ==b==
18868 ===ba===
18869 ===bb===
18870 ====bba====
18871 ===bc===
18872 ==c==
18873 ===ca===
18874 !! html/php
18875 ===bc===
18876 !! end
18877
18878 !! test
18879 Section extraction test (section 9)
18880 !! options
18881 section=9
18882 !! wikitext
18883 start
18884 ==a==
18885 ===aa===
18886 ====aaa====
18887 ==b==
18888 ===ba===
18889 ===bb===
18890 ====bba====
18891 ===bc===
18892 ==c==
18893 ===ca===
18894 !! html/php
18895 ==c==
18896 ===ca===
18897 !! end
18898
18899 !! test
18900 Section extraction test (section 10)
18901 !! options
18902 section=10
18903 !! wikitext
18904 start
18905 ==a==
18906 ===aa===
18907 ====aaa====
18908 ==b==
18909 ===ba===
18910 ===bb===
18911 ====bba====
18912 ===bc===
18913 ==c==
18914 ===ca===
18915 !! html/php
18916 ===ca===
18917 !! end
18918
18919 !! test
18920 Section extraction test (nonexistent section 11)
18921 !! options
18922 section=11
18923 !! wikitext
18924 start
18925 ==a==
18926 ===aa===
18927 ====aaa====
18928 ==b==
18929 ===ba===
18930 ===bb===
18931 ====bba====
18932 ===bc===
18933 ==c==
18934 ===ca===
18935 !! html/php
18936 !! end
18937
18938 !! test
18939 Section extraction test with bogus heading (section 1)
18940 !! options
18941 section=1
18942 !! wikitext
18943 ==a==
18944 ==bogus== not a legal section
18945 ==b==
18946 !! html/php
18947 ==a==
18948 ==bogus== not a legal section
18949 !! end
18950
18951 !! test
18952 Section extraction test with bogus heading (section 2)
18953 !! options
18954 section=2
18955 !! wikitext
18956 ==a==
18957 ==bogus== not a legal section
18958 ==b==
18959 !! html/php
18960 ==b==
18961 !! end
18962
18963 !! test
18964 Section extraction test with comment after heading (section 1)
18965 !! options
18966 section=1
18967 !! wikitext
18968 ==a==
18969 ==b== <!-- -->
18970 ==c==
18971 !! html/php
18972 ==a==
18973 !! end
18974
18975 !! test
18976 Section extraction test with comment after heading (section 2)
18977 !! options
18978 section=2
18979 !! wikitext
18980 ==a==
18981 ==b== <!-- -->
18982 ==c==
18983 !! html/php
18984 ==b== <!-- -->
18985 !! end
18986
18987 !! test
18988 Section extraction test with bogus <nowiki> heading (section 1)
18989 !! options
18990 section=1
18991 !! wikitext
18992 ==a==
18993 ==bogus== <nowiki>not a legal section</nowiki>
18994 ==b==
18995 !! html/php
18996 ==a==
18997 ==bogus== <nowiki>not a legal section</nowiki>
18998 !! end
18999
19000 !! test
19001 Section extraction test with bogus <nowiki> heading (section 2)
19002 !! options
19003 section=2
19004 !! wikitext
19005 ==a==
19006 ==bogus== <nowiki>not a legal section</nowiki>
19007 ==b==
19008 !! html/php
19009 ==b==
19010 !! end
19011
19012 # Formerly testing for T4587, now resolved by the use of unmarked sections
19013 # instead of respecting commented sections
19014 !! test
19015 Section extraction prefixed by comment (section 1)
19016 !! options
19017 section=1
19018 !! wikitext
19019 <!-- -->==sec1==
19020 ==sec2==
19021 !! html/php
19022 ==sec2==
19023 !!end
19024
19025 !! test
19026 Section extraction prefixed by comment (section 2)
19027 !! options
19028 section=2
19029 !! wikitext
19030 <!-- -->==sec1==
19031 ==sec2==
19032 !! html/php
19033
19034 !!end
19035
19036 # Formerly testing for T4607, now resolved by the use of unmarked sections
19037 # instead of respecting HTML-style headings
19038 !! test
19039 Section extraction, mixed wiki and html (section 1)
19040 !! options
19041 section=1
19042 !! wikitext
19043 <h2>unmarked</h2>
19044 unmarked
19045 ==1==
19046 one
19047 ==2==
19048 two
19049 !! html/php
19050 ==1==
19051 one
19052 !! end
19053
19054 !! test
19055 Section extraction, mixed wiki and html (section 2)
19056 !! options
19057 section=2
19058 !! wikitext
19059 <h2>unmarked</h2>
19060 unmarked
19061 ==1==
19062 one
19063 ==2==
19064 two
19065 !! html/php
19066 ==2==
19067 two
19068 !! end
19069
19070
19071 # Formerly testing for T5342
19072 !! test
19073 Section extraction, heading surrounded by <noinclude>
19074 !! options
19075 section=1
19076 !! wikitext
19077 <noinclude>==unmarked==</noinclude>
19078 ==marked==
19079 !! html/php
19080 ==marked==
19081 !!end
19082
19083 # Test behavior of T21910
19084 !! test
19085 Sectiion with all-equals
19086 !! options
19087 section=2
19088 !! wikitext
19089 ===
19090 The line above must have a trailing space
19091 === <!--
19092 --> <!-- -->
19093 But just in case it doesn't...
19094 !! html/php
19095 === <!--
19096 --> <!-- -->
19097 But just in case it doesn't...
19098 !! end
19099
19100 !! test
19101 Section replacement test (section 0)
19102 !! options
19103 replace=0,"xxx"
19104 !! wikitext
19105 start
19106 ==a==
19107 ===aa===
19108 ====aaa====
19109 ==b==
19110 ===ba===
19111 ===bb===
19112 ====bba====
19113 ===bc===
19114 ==c==
19115 ===ca===
19116 !! html/php
19117 xxx
19118
19119 ==a==
19120 ===aa===
19121 ====aaa====
19122 ==b==
19123 ===ba===
19124 ===bb===
19125 ====bba====
19126 ===bc===
19127 ==c==
19128 ===ca===
19129 !! end
19130
19131 !! test
19132 Section replacement test (section 1)
19133 !! options
19134 replace=1,"xxx"
19135 !! wikitext
19136 start
19137 ==a==
19138 ===aa===
19139 ====aaa====
19140 ==b==
19141 ===ba===
19142 ===bb===
19143 ====bba====
19144 ===bc===
19145 ==c==
19146 ===ca===
19147 !! html/php
19148 start
19149 xxx
19150
19151 ==b==
19152 ===ba===
19153 ===bb===
19154 ====bba====
19155 ===bc===
19156 ==c==
19157 ===ca===
19158 !! end
19159
19160 !! test
19161 Section replacement test (section 2)
19162 !! options
19163 replace=2,"xxx"
19164 !! wikitext
19165 start
19166 ==a==
19167 ===aa===
19168 ====aaa====
19169 ==b==
19170 ===ba===
19171 ===bb===
19172 ====bba====
19173 ===bc===
19174 ==c==
19175 ===ca===
19176 !! html/php
19177 start
19178 ==a==
19179 xxx
19180
19181 ==b==
19182 ===ba===
19183 ===bb===
19184 ====bba====
19185 ===bc===
19186 ==c==
19187 ===ca===
19188 !! end
19189
19190 !! test
19191 Section replacement test (section 3)
19192 !! options
19193 replace=3,"xxx"
19194 !! wikitext
19195 start
19196 ==a==
19197 ===aa===
19198 ====aaa====
19199 ==b==
19200 ===ba===
19201 ===bb===
19202 ====bba====
19203 ===bc===
19204 ==c==
19205 ===ca===
19206 !! html/php
19207 start
19208 ==a==
19209 ===aa===
19210 xxx
19211
19212 ==b==
19213 ===ba===
19214 ===bb===
19215 ====bba====
19216 ===bc===
19217 ==c==
19218 ===ca===
19219 !! end
19220
19221 !! test
19222 Section replacement test (section 4)
19223 !! options
19224 replace=4,"xxx"
19225 !! wikitext
19226 start
19227 ==a==
19228 ===aa===
19229 ====aaa====
19230 ==b==
19231 ===ba===
19232 ===bb===
19233 ====bba====
19234 ===bc===
19235 ==c==
19236 ===ca===
19237 !! html/php
19238 start
19239 ==a==
19240 ===aa===
19241 ====aaa====
19242 xxx
19243
19244 ==c==
19245 ===ca===
19246 !! end
19247
19248 !! test
19249 Section replacement test (section 5)
19250 !! options
19251 replace=5,"xxx"
19252 !! wikitext
19253 start
19254 ==a==
19255 ===aa===
19256 ====aaa====
19257 ==b==
19258 ===ba===
19259 ===bb===
19260 ====bba====
19261 ===bc===
19262 ==c==
19263 ===ca===
19264 !! html/php
19265 start
19266 ==a==
19267 ===aa===
19268 ====aaa====
19269 ==b==
19270 xxx
19271
19272 ===bb===
19273 ====bba====
19274 ===bc===
19275 ==c==
19276 ===ca===
19277 !! end
19278
19279 !! test
19280 Section replacement test (section 6)
19281 !! options
19282 replace=6,"xxx"
19283 !! wikitext
19284 start
19285 ==a==
19286 ===aa===
19287 ====aaa====
19288 ==b==
19289 ===ba===
19290 ===bb===
19291 ====bba====
19292 ===bc===
19293 ==c==
19294 ===ca===
19295 !! html/php
19296 start
19297 ==a==
19298 ===aa===
19299 ====aaa====
19300 ==b==
19301 ===ba===
19302 xxx
19303
19304 ===bc===
19305 ==c==
19306 ===ca===
19307 !! end
19308
19309 !! test
19310 Section replacement test (section 7)
19311 !! options
19312 replace=7,"xxx"
19313 !! wikitext
19314 start
19315 ==a==
19316 ===aa===
19317 ====aaa====
19318 ==b==
19319 ===ba===
19320 ===bb===
19321 ====bba====
19322 ===bc===
19323 ==c==
19324 ===ca===
19325 !! html/php
19326 start
19327 ==a==
19328 ===aa===
19329 ====aaa====
19330 ==b==
19331 ===ba===
19332 ===bb===
19333 xxx
19334
19335 ===bc===
19336 ==c==
19337 ===ca===
19338 !! end
19339
19340 !! test
19341 Section replacement test (section 8)
19342 !! options
19343 replace=8,"xxx"
19344 !! wikitext
19345 start
19346 ==a==
19347 ===aa===
19348 ====aaa====
19349 ==b==
19350 ===ba===
19351 ===bb===
19352 ====bba====
19353 ===bc===
19354 ==c==
19355 ===ca===
19356 !! html/php
19357 start
19358 ==a==
19359 ===aa===
19360 ====aaa====
19361 ==b==
19362 ===ba===
19363 ===bb===
19364 ====bba====
19365 xxx
19366
19367 ==c==
19368 ===ca===
19369 !!end
19370
19371 !! test
19372 Section replacement test (section 9)
19373 !! options
19374 replace=9,"xxx"
19375 !! wikitext
19376 start
19377 ==a==
19378 ===aa===
19379 ====aaa====
19380 ==b==
19381 ===ba===
19382 ===bb===
19383 ====bba====
19384 ===bc===
19385 ==c==
19386 ===ca===
19387 !! html/php
19388 start
19389 ==a==
19390 ===aa===
19391 ====aaa====
19392 ==b==
19393 ===ba===
19394 ===bb===
19395 ====bba====
19396 ===bc===
19397 xxx
19398 !! end
19399
19400 !! test
19401 Section replacement test (section 10)
19402 !! options
19403 replace=10,"xxx"
19404 !! wikitext
19405 start
19406 ==a==
19407 ===aa===
19408 ====aaa====
19409 ==b==
19410 ===ba===
19411 ===bb===
19412 ====bba====
19413 ===bc===
19414 ==c==
19415 ===ca===
19416 !! html/php
19417 start
19418 ==a==
19419 ===aa===
19420 ====aaa====
19421 ==b==
19422 ===ba===
19423 ===bb===
19424 ====bba====
19425 ===bc===
19426 ==c==
19427 xxx
19428 !! end
19429
19430 !! test
19431 Section replacement test with initial whitespace (T15728)
19432 !! options
19433 replace=2,"xxx"
19434 !! wikitext
19435 Preformatted initial line
19436 ==a==
19437 ===a===
19438 !! html/php
19439 Preformatted initial line
19440 ==a==
19441 xxx
19442 !! end
19443
19444
19445 !! test
19446 Section extraction, heading followed by pre with 20 spaces (T8398)
19447 !! options
19448 section=1
19449 !! wikitext
19450 ==a==
19451 a
19452 !! html/php
19453 ==a==
19454 a
19455 !! end
19456
19457 !! test
19458 Section extraction, heading followed by pre with 19 spaces (T8398 sanity check)
19459 !! options
19460 section=1
19461 !! wikitext
19462 ==a==
19463 a
19464 !! html/php
19465 ==a==
19466 a
19467 !! end
19468
19469
19470 !! test
19471 Section extraction, <pre> around bogus header (T12309)
19472 !! options
19473 section=2
19474 !! wikitext
19475 == Section One ==
19476 <pre>
19477 =======
19478 </pre>
19479
19480 == Section Two ==
19481 stuff
19482 !! html/php
19483 == Section Two ==
19484 stuff
19485 !! end
19486
19487 !! test
19488 Section replacement, <pre> around bogus header (T12309)
19489 !! options
19490 replace=2,"xxx"
19491 !! wikitext
19492 == Section One ==
19493 <pre>
19494 =======
19495 </pre>
19496
19497 == Section Two ==
19498 stuff
19499 !! html/php
19500 == Section One ==
19501 <pre>
19502 =======
19503 </pre>
19504
19505 xxx
19506 !! end
19507
19508 !! test
19509 Handling of &#x0A; in URLs
19510 !! wikitext
19511 ** irc://&#x0A;a
19512 !! html/php
19513 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
19514
19515 !! html/parsoid
19516 <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>
19517 !! end
19518
19519 !! test
19520 Handling of %0A in URLs
19521 !! wikitext
19522 ** irc://%0Aa
19523 !! html/php
19524 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
19525
19526 !! html/parsoid
19527 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
19528 !! end
19529
19530 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
19531 !! test
19532 5 quotes, code coverage +1 line
19533 !! options
19534 parsoid=wt2html
19535 !! wikitext
19536 '''''
19537 !! html/php
19538 !! html/parsoid
19539 <p><b><i></i></b></p>
19540 !! end
19541
19542 # same html as previous, but wikitext adjusted to match parsoid html2wt
19543 # note that wt2html and html2html will put the <i> before the <b>
19544 !! test
19545 5 quotes, code coverage +1 line w/ nowiki (1)
19546 !! options
19547 parsoid=wt2wt,html2wt
19548 !! wikitext
19549 '''''<nowiki/>'''''
19550 !! html/php
19551 <p><i></i>
19552 </p>
19553 !! html/parsoid
19554 <p><b><i></i></b></p>
19555 !! end
19556
19557 # same as previous, just swapping the <i> and <b>
19558 !! test
19559 5 quotes, code coverage +1 line w/ nowiki (2)
19560 !! wikitext
19561 '''''<nowiki/>'''''
19562 !! html/php
19563 <p><i></i>
19564 </p>
19565 !! html/parsoid
19566 <p><i><b></b></i></p>
19567 !! end
19568
19569 !! test
19570 Special:Search page linking.
19571 !! wikitext
19572 {{Special:search}}
19573 !! html
19574 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
19575 </p>
19576 !! end
19577
19578 !! test
19579 {{!}} is a magic word
19580 !! wikitext
19581 {{!}} is a magic word there and {{!}} is still a magic word here
19582 | is not a magic word here but {{!}} is still a magic word here
19583 !! html/php
19584 <p>| is a magic word there and | is still a magic word here
19585 | is not a magic word here but | is still a magic word here
19586 </p>
19587 !! html/parsoid
19588 <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
19589 | 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>
19590 !! end
19591
19592 !! test
19593 Say the magic word
19594 !! options
19595 title=[[Parser test]]
19596 !! wikitext
19597 * {{PAGENAME}}
19598 * {{PAGENAMEE}}
19599 * {{FULLPAGENAME}}
19600 * {{FULLPAGENAMEE}}
19601 * {{BASEPAGENAME}}
19602 * {{BASEPAGENAMEE}}
19603 * {{SUBPAGENAME}}
19604 * {{SUBPAGENAMEE}}
19605 * {{ROOTPAGENAME}}
19606 * {{ROOTPAGENAMEE}}
19607 * {{TALKPAGENAME}}
19608 * {{TALKPAGENAMEE}}
19609 * {{SUBJECTPAGENAME}}
19610 * {{SUBJECTPAGENAMEE}}
19611 * {{NAMESPACEE}}
19612 * {{NAMESPACE}}
19613 * {{NAMESPACENUMBER}}
19614 * {{TALKSPACE}}
19615 * {{TALKSPACEE}}
19616 * {{SUBJECTSPACE}}
19617 * {{SUBJECTSPACEE}}
19618 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
19619 !! html
19620 <ul><li> Parser test</li>
19621 <li> Parser_test</li>
19622 <li> Parser test</li>
19623 <li> Parser_test</li>
19624 <li> Parser test</li>
19625 <li> Parser_test</li>
19626 <li> Parser test</li>
19627 <li> Parser_test</li>
19628 <li> Parser test</li>
19629 <li> Parser_test</li>
19630 <li> Talk:Parser test</li>
19631 <li> Talk:Parser_test</li>
19632 <li> Parser test</li>
19633 <li> Parser_test</li>
19634 <li> </li>
19635 <li> </li>
19636 <li> 0</li>
19637 <li> Talk</li>
19638 <li> Talk</li>
19639 <li> </li>
19640 <li> </li>
19641 <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>
19642
19643 !! end
19644 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
19645
19646 !! test
19647 Gallery with valid attributes
19648 !! wikitext
19649 <gallery type="123" summary="345">
19650 File:File:Foobar.jpg
19651 </gallery>
19652 !! html/php
19653 <ul class="gallery mw-gallery-traditional" type="123">
19654 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19655 <div class="thumb" style="height: 150px;">File:Foobar.jpg</div>
19656 <div class="gallerytext">
19657 </div>
19658 </div></li>
19659 </ul>
19660
19661 !! html/parsoid
19662 <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"}}'>
19663 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><span style="display: inline-block; height: 100%; vertical-align: middle;"></span><span style="vertical-align: middle; display: inline-block;">File:File:Foobar.jpg</span></div><div class="gallerytext"></div></li>
19664 </ul>
19665 !! end
19666
19667 ## Parsoid thinks the "centre" here is a property, not a caption.
19668 !! test
19669 Gallery
19670 !! options
19671 parsoid={
19672 "modes": ["wt2html"],
19673 "nativeGallery": true
19674 }
19675 !! wikitext
19676 <gallery>
19677 image1.png |
19678 image2.gif|||||
19679
19680 image3|
19681 image4 |300px| centre
19682 image5.svg| http://///////
19683 [[x|xx]]]]
19684 * image6
19685 </gallery>
19686 !! html/php
19687 <ul class="gallery mw-gallery-traditional">
19688 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19689 <div class="thumb" style="height: 150px;">Image1.png</div>
19690 <div class="gallerytext">
19691 </div>
19692 </div></li>
19693 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19694 <div class="thumb" style="height: 150px;">Image2.gif</div>
19695 <div class="gallerytext">
19696 </div>
19697 </div></li>
19698 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19699 <div class="thumb" style="height: 150px;">Image3</div>
19700 <div class="gallerytext">
19701 </div>
19702 </div></li>
19703 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19704 <div class="thumb" style="height: 150px;">Image4</div>
19705 <div class="gallerytext">
19706 <pre>centre
19707 </pre>
19708 </div>
19709 </div></li>
19710 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19711 <div class="thumb" style="height: 150px;">Image5.svg</div>
19712 <div class="gallerytext">
19713 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
19714 </p>
19715 </div>
19716 </div></li>
19717 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19718 <div class="thumb" style="height: 150px;">* image6</div>
19719 <div class="gallerytext">
19720 </div>
19721 </div></li>
19722 </ul>
19723
19724 !! html/parsoid
19725 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt3" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
19726 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><span style="display: inline-block; height: 100%; vertical-align: middle;"></span><span style="vertical-align: middle; display: inline-block;">image1.png </span></div><div class="gallerytext"></div></li>
19727 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><span style="display: inline-block; height: 100%; vertical-align: middle;"></span><span style="vertical-align: middle; display: inline-block;">image2.gif</span></div><div class="gallerytext"></div></li>
19728 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><span style="display: inline-block; height: 100%; vertical-align: middle;"></span><span style="vertical-align: middle; display: inline-block;">image3</span></div><div class="gallerytext"></div></li>
19729 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><span style="display: inline-block; height: 100%; vertical-align: middle;"></span><span style="vertical-align: middle; display: inline-block;">image4 </span></div><div class="gallerytext"></div></li>
19730 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><span style="display: inline-block; height: 100%; vertical-align: middle;"></span><span style="vertical-align: middle; display: inline-block;"> image5.svg</span></div><div class="gallerytext"> <a rel="mw:ExtLink" href="http://///////">http://///////</a></div></li>
19731 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><span style="display: inline-block; height: 100%; vertical-align: middle;"></span><span style="vertical-align: middle; display: inline-block;">* image6</span></div><div class="gallerytext"></div></li>
19732 </ul>
19733 !! end
19734
19735 !! test
19736 Gallery (with options, html)
19737 !! options
19738 parsoid={
19739 "modes": ["wt2html", "html2html"],
19740 "nativeGallery": true
19741 }
19742 !! wikitext
19743 <gallery widths="70px" heights="40px" perrow="2" caption="Foo [[Main Page]]">
19744 File:Nonexistent.jpg|caption
19745 File:Nonexistent.jpg
19746 image:foobar.jpg|some '''caption''' [[Main Page]]
19747 image:foobar.jpg
19748 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
19749 </gallery>
19750 !! html/php
19751 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
19752 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
19753 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19754 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
19755 <div class="gallerytext">
19756 <p>caption
19757 </p>
19758 </div>
19759 </div></li>
19760 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19761 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
19762 <div class="gallerytext">
19763 </div>
19764 </div></li>
19765 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19766 <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>
19767 <div class="gallerytext">
19768 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
19769 </p>
19770 </div>
19771 </div></li>
19772 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19773 <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>
19774 <div class="gallerytext">
19775 </div>
19776 </div></li>
19777 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19778 <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>
19779 <div class="gallerytext">
19780 <p>blabla.
19781 </p>
19782 </div>
19783 </div></li>
19784 </ul>
19785
19786 !! html/parsoid
19787 <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":{}}'>
19788 <li class="gallerycaption">Foo <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a></li>
19789 <li class="gallerybox" style="width: 105px;"><div class="thumb" style="width: 100px; height: 70px;"><span style="display: inline-block; height: 100%; vertical-align: middle;"></span><span style="vertical-align: middle; display: inline-block;">File:Nonexistent.jpg</span></div><div class="gallerytext">caption</div></li>
19790 <li class="gallerybox" style="width: 105px;"><div class="thumb" style="width: 100px; height: 70px;"><span style="display: inline-block; height: 100%; vertical-align: middle;"></span><span style="vertical-align: middle; display: inline-block;">File:Nonexistent.jpg</span></div><div class="gallerytext"></div></li>
19791 <li class="gallerybox" style="width: 105px;"><div class="thumb" style="width: 100px; height: 70px;"><span style="display: inline-block; height: 100%; vertical-align: middle;"></span><span typeof="mw:Image" style="vertical-align: middle; display: inline-block;"><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>
19792 <li class="gallerybox" style="width: 105px;"><div class="thumb" style="width: 100px; height: 70px;"><span style="display: inline-block; height: 100%; vertical-align: middle;"></span><span typeof="mw:Image" style="vertical-align: middle; display: inline-block;"><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>
19793 <li class="gallerybox" style="width: 105px;"><div class="thumb" style="width: 100px; height: 70px;"><span style="display: inline-block; height: 100%; vertical-align: middle;"></span><span typeof="mw:Image" style="vertical-align: middle; display: inline-block;"><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>
19794 </ul>
19795 !! end
19796
19797 !! test
19798 Gallery (with options, extsrc)
19799 !! options
19800 parsoid={
19801 "nativeGallery": false
19802 }
19803 !! wikitext
19804 <gallery widths="70px" heights="40px" perrow="2" caption="Foo [[Main Page]]">
19805 File:Nonexistent.jpg|caption
19806 File:Nonexistent.jpg
19807 image:foobar.jpg|some '''caption''' [[Main Page]]
19808 image:foobar.jpg
19809 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
19810 </gallery>
19811 !! html/php
19812 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
19813 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
19814 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19815 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
19816 <div class="gallerytext">
19817 <p>caption
19818 </p>
19819 </div>
19820 </div></li>
19821 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19822 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
19823 <div class="gallerytext">
19824 </div>
19825 </div></li>
19826 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19827 <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>
19828 <div class="gallerytext">
19829 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
19830 </p>
19831 </div>
19832 </div></li>
19833 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19834 <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>
19835 <div class="gallerytext">
19836 </div>
19837 </div></li>
19838 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19839 <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>
19840 <div class="gallerytext">
19841 <p>blabla.
19842 </p>
19843 </div>
19844 </div></li>
19845 </ul>
19846
19847 !! html/parsoid
19848 <ul class="gallery mw-gallery-traditional" style="max-width: 226px; _width: 226px;" typeof="mw:Extension/gallery" about="#mwt3" data-parsoid='{}' 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"}}'>
19849 <li class="gallerycaption">Foo <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a></li>
19850 <li class="gallerybox" style="width: 105px;"><div class="thumb" style="width: 100px; height: 70px;"><span style="display: inline-block; height: 100%; vertical-align: middle;"></span><span style="vertical-align: middle; display: inline-block;">File:Nonexistent.jpg</span></div><div class="gallerytext">caption</div></li>
19851 <li class="gallerybox" style="width: 105px;"><div class="thumb" style="width: 100px; height: 70px;"><span style="display: inline-block; height: 100%; vertical-align: middle;"></span><span style="vertical-align: middle; display: inline-block;">File:Nonexistent.jpg</span></div><div class="gallerytext"></div></li>
19852 <li class="gallerybox" style="width: 105px;"><div class="thumb" style="width: 100px; height: 70px;"><span style="display: inline-block; height: 100%; vertical-align: middle;"></span><span typeof="mw:Image" style="vertical-align: middle; display: inline-block;"><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>
19853 <li class="gallerybox" style="width: 105px;"><div class="thumb" style="width: 100px; height: 70px;"><span style="display: inline-block; height: 100%; vertical-align: middle;"></span><span typeof="mw:Image" style="vertical-align: middle; display: inline-block;"><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>
19854 <li class="gallerybox" style="width: 105px;"><div class="thumb" style="width: 100px; height: 70px;"><span style="display: inline-block; height: 100%; vertical-align: middle;"></span><span typeof="mw:Image" style="vertical-align: middle; display: inline-block;"><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>
19855 </ul>
19856 !! end
19857
19858 !! test
19859 Gallery with link that has fragment
19860 !! options
19861 parsoid={
19862 "modes": ["wt2html", "html2html"],
19863 "nativeGallery": true
19864 }
19865 !! wikitext
19866 <gallery>
19867 image:foobar.jpg|link=Main_Page
19868 image:foobar.jpg|link=Main_Page#section
19869 image:foobar.jpg|link=Main Page#section|caption
19870 </gallery>
19871 !! html/php
19872 <ul class="gallery mw-gallery-traditional">
19873 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19874 <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>
19875 <div class="gallerytext">
19876 </div>
19877 </div></li>
19878 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19879 <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>
19880 <div class="gallerytext">
19881 </div>
19882 </div></li>
19883 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19884 <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>
19885 <div class="gallerytext">
19886 <p>caption
19887 </p>
19888 </div>
19889 </div></li>
19890 </ul>
19891
19892 !! html/parsoid
19893 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
19894 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><span style="display: inline-block; height: 100%; vertical-align: middle;"></span><span typeof="mw:Image" style="vertical-align: middle; display: inline-block;"><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>
19895 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><span style="display: inline-block; height: 100%; vertical-align: middle;"></span><span typeof="mw:Image" style="vertical-align: middle; display: inline-block;"><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>
19896 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><span style="display: inline-block; height: 100%; vertical-align: middle;"></span><span typeof="mw:Image" style="vertical-align: middle; display: inline-block;"><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>
19897 </ul>
19898 !! end
19899
19900 ## Whoops, Parsoid shouldn't be parsing templates in the attribute caption!
19901 !! test
19902 Gallery with template inside caption
19903 !! options
19904 parsoid={
19905 "nativeGallery": true
19906 }
19907 !! wikitext
19908 <gallery caption="{{echo|hi}}">
19909 File:Foobar.jpg|{{echo|ho}}
19910 </gallery>
19911 !! html/php
19912 <ul class="gallery mw-gallery-traditional">
19913 <li class='gallerycaption'>{{echo|hi}}</li>
19914 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19915 <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>
19916 <div class="gallerytext">
19917 <p>ho
19918 </p>
19919 </div>
19920 </div></li>
19921 </ul>
19922
19923 !! html/parsoid
19924 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt6" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
19925 <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>
19926 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><span style="display: inline-block; height: 100%; vertical-align: middle;"></span><span typeof="mw:Image" style="vertical-align: middle; display: inline-block;"><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>
19927 </ul>
19928 !! end
19929
19930 !! test
19931 Gallery with wikitext inside caption
19932 !! options
19933 parsoid={
19934 "nativeGallery": true
19935 }
19936 !! wikitext
19937 <gallery>
19938 File:Foobar.jpg|alt=galleryalt|[[File:Foobar.jpg|alt=inneralt|20x20px|desc]]
19939 File:Foobar.jpg|alt=galleryalt|{{Test|unamedParam|alt=param}}
19940 </gallery>
19941 !! html/php
19942 <ul class="gallery mw-gallery-traditional">
19943 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19944 <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>
19945 <div class="gallerytext">
19946 <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>
19947 </p>
19948 </div>
19949 </div></li>
19950 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19951 <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>
19952 <div class="gallerytext">
19953 <p>This is a test template
19954 </p>
19955 </div>
19956 </div></li>
19957 </ul>
19958
19959 !! html/parsoid
19960 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt6" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
19961 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><span style="display: inline-block; height: 100%; vertical-align: middle;"></span><span typeof="mw:Image" style="vertical-align: middle; display: inline-block;"><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>
19962 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><span style="display: inline-block; height: 100%; vertical-align: middle;"></span><span typeof="mw:Image" style="vertical-align: middle; display: inline-block;"><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>
19963 </ul>
19964 !! end
19965
19966 !! test
19967 Gallery (with showfilename option)
19968 !! options
19969 parsoid={
19970 "nativeGallery": true
19971 }
19972 !! wikitext
19973 <gallery showfilename="">
19974 File:Nonexistent.jpg|caption
19975 File:Nonexistent.jpg
19976 File:Foobar.jpg|some '''caption''' [[Main Page]]
19977 File:Foobar.jpg
19978 </gallery>
19979 !! html/php
19980 <ul class="gallery mw-gallery-traditional">
19981 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19982 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
19983 <div class="gallerytext">
19984 <p><a href="/wiki/File:Nonexistent.jpg" class="galleryfilename galleryfilename-truncate" title="File:Nonexistent.jpg">Nonexistent.jpg</a>
19985 caption
19986 </p>
19987 </div>
19988 </div></li>
19989 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19990 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
19991 <div class="gallerytext">
19992 <p><a href="/wiki/File:Nonexistent.jpg" class="galleryfilename galleryfilename-truncate" title="File:Nonexistent.jpg">Nonexistent.jpg</a>
19993 </p>
19994 </div>
19995 </div></li>
19996 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19997 <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>
19998 <div class="gallerytext">
19999 <p><a href="/wiki/File:Foobar.jpg" class="galleryfilename galleryfilename-truncate" title="File:Foobar.jpg">Foobar.jpg</a>
20000 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
20001 </p>
20002 </div>
20003 </div></li>
20004 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20005 <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>
20006 <div class="gallerytext">
20007 <p><a href="/wiki/File:Foobar.jpg" class="galleryfilename galleryfilename-truncate" title="File:Foobar.jpg">Foobar.jpg</a>
20008 </p>
20009 </div>
20010 </div></li>
20011 </ul>
20012
20013 !! html/parsoid
20014 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt3" data-mw='{"name":"gallery","attrs":{"showfilename":""},"body":{}}'>
20015 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><span style="display: inline-block; height: 100%; vertical-align: middle;"></span><span style="vertical-align: middle; display: inline-block;">File:Nonexistent.jpg</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>
20016 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><span style="display: inline-block; height: 100%; vertical-align: middle;"></span><span style="vertical-align: middle; display: inline-block;">File:Nonexistent.jpg</span></div><div class="gallerytext"><a href="./File:Nonexistent.jpg" class="galleryfilename galleryfilename-truncate" title="File:Nonexistent.jpg">File:Nonexistent.jpg</a></div></li>
20017 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><span style="display: inline-block; height: 100%; vertical-align: middle;"></span><span typeof="mw:Image" style="vertical-align: middle; display: inline-block;"><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>
20018 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><span style="display: inline-block; height: 100%; vertical-align: middle;"></span><span typeof="mw:Image" style="vertical-align: middle; display: inline-block;"><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>
20019 </ul>
20020 !! end
20021
20022 ## Should Parsoid be preserving these variations?
20023 !! test
20024 Gallery (with namespace-less filenames)
20025 !! options
20026 parsoid={
20027 "modes": ["wt2html", "html2html"],
20028 "nativeGallery": true
20029 }
20030 !! wikitext
20031 <gallery>
20032 File:Nonexistent.jpg
20033 Nonexistent.jpg
20034 image:foobar.jpg
20035 foobar.jpg
20036 </gallery>
20037 !! html/php
20038 <ul class="gallery mw-gallery-traditional">
20039 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20040 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
20041 <div class="gallerytext">
20042 </div>
20043 </div></li>
20044 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20045 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
20046 <div class="gallerytext">
20047 </div>
20048 </div></li>
20049 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20050 <div class="thumb" style="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>
20051 <div class="gallerytext">
20052 </div>
20053 </div></li>
20054 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20055 <div class="thumb" style="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>
20056 <div class="gallerytext">
20057 </div>
20058 </div></li>
20059 </ul>
20060
20061 !! html/parsoid
20062 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20063 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><span style="display: inline-block; height: 100%; vertical-align: middle;"></span><span style="vertical-align: middle; display: inline-block;">File:Nonexistent.jpg</span></div><div class="gallerytext"></div></li>
20064 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><span style="display: inline-block; height: 100%; vertical-align: middle;"></span><span style="vertical-align: middle; display: inline-block;">Nonexistent.jpg</span></div><div class="gallerytext"></div></li>
20065 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><span style="display: inline-block; height: 100%; vertical-align: middle;"></span><span typeof="mw:Image" style="vertical-align: middle; display: inline-block;"><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>
20066 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><span style="display: inline-block; height: 100%; vertical-align: middle;"></span><span typeof="mw:Image" style="vertical-align: middle; display: inline-block;"><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>
20067 </ul>
20068 !! end
20069
20070 !! test
20071 Gallery override link with WikiLink (T36852)
20072 !! options
20073 parsoid={
20074 "nativeGallery": true
20075 }
20076 !! wikitext
20077 <gallery>
20078 File:Foobar.jpg|alt=galleryalt|link=InterWikiLink
20079 </gallery>
20080 !! html/php
20081 <ul class="gallery mw-gallery-traditional">
20082 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20083 <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>
20084 <div class="gallerytext">
20085 </div>
20086 </div></li>
20087 </ul>
20088
20089 !! html/parsoid
20090 <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":{}}'>
20091 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><span style="display: inline-block; height: 100%; vertical-align: middle;"></span><span typeof="mw:Image" style="vertical-align: middle; display: inline-block;"><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>
20092 </ul>
20093 !! end
20094
20095 !! test
20096 Gallery override link with absolute external link (T36852)
20097 !! options
20098 parsoid={
20099 "nativeGallery": true
20100 }
20101 !! wikitext
20102 <gallery>
20103 File:Foobar.jpg|alt=galleryalt|link=http://www.example.org
20104 </gallery>
20105 !! html/php
20106 <ul class="gallery mw-gallery-traditional">
20107 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20108 <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>
20109 <div class="gallerytext">
20110 </div>
20111 </div></li>
20112 </ul>
20113
20114 !! html/parsoid
20115 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20116 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><span style="display: inline-block; height: 100%; vertical-align: middle;"></span><span typeof="mw:Image" style="vertical-align: middle; display: inline-block;"><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>
20117 </ul>
20118 !! end
20119
20120 !! test
20121 Gallery override link with absolute external link with LanguageConverter
20122 !! options
20123 language=zh
20124 !! input
20125 <gallery>
20126 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
20127 </gallery>
20128 !! result
20129 <ul class="gallery mw-gallery-traditional">
20130 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20131 <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>
20132 <div class="gallerytext">
20133 <p>caption
20134 </p>
20135 </div>
20136 </div></li>
20137 </ul>
20138
20139 !! end
20140
20141 !! test
20142 Gallery override link with malicious javascript (T36852)
20143 !! options
20144 parsoid={
20145 "modes": ["wt2html", "html2html"],
20146 "nativeGallery": true
20147 }
20148 !! wikitext
20149 <gallery>
20150 File:Foobar.jpg|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
20151 </gallery>
20152 !! html/php
20153 <ul class="gallery mw-gallery-traditional">
20154 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20155 <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>
20156 <div class="gallerytext">
20157 </div>
20158 </div></li>
20159 </ul>
20160
20161 !! html/parsoid
20162 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20163 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><span style="display: inline-block; height: 100%; vertical-align: middle;"></span><span typeof="mw:Image" style="vertical-align: middle; display: inline-block;"><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>
20164 </ul>
20165 !! end
20166
20167 !! test
20168 Gallery with invalid title as link (T45964)
20169 !! options
20170 parsoid={
20171 "modes": ["wt2html", "html2html"],
20172 "nativeGallery": true
20173 }
20174 !! wikitext
20175 <gallery>
20176 File:Foobar.jpg|link=<
20177 </gallery>
20178 !! html/php
20179 <ul class="gallery mw-gallery-traditional">
20180 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20181 <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>
20182 <div class="gallerytext">
20183 </div>
20184 </div></li>
20185 </ul>
20186
20187 !! html/parsoid
20188 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20189 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><span style="display: inline-block; height: 100%; vertical-align: middle;"></span><span typeof="mw:Image" style="vertical-align: middle; display: inline-block;"><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>
20190 </ul>
20191 !! end
20192
20193 !! test
20194 Serialize gallery without attrs in data-mw
20195 !! options
20196 parsoid={
20197 "modes": ["html2wt"],
20198 "nativeGallery": true
20199 }
20200 !! html/parsoid
20201 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","body":{}}'>
20202 <li class="gallerycaption">123</li>
20203 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><span style="display: inline-block; height: 100%; vertical-align: middle;"></span><span style="vertical-align: middle; display: inline-block;">File:Test.png</span></div><div class="gallerytext"></div></li>
20204 </ul>
20205 !! wikitext
20206 <gallery caption="123">
20207 File:Test.png
20208 </gallery>
20209 !! end
20210
20211 !! test
20212 Gallery with class and style attributes
20213 !! options
20214 parsoid={
20215 "nativeGallery": true
20216 }
20217 !! wikitext
20218 <gallery class="center" style="text-align: center;">
20219 File:Foobar.jpg
20220 </gallery>
20221 !! html/php
20222 <ul class="gallery mw-gallery-traditional center" style="text-align: center;">
20223 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20224 <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>
20225 <div class="gallerytext">
20226 </div>
20227 </div></li>
20228 </ul>
20229
20230 !! html/parsoid
20231 <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":{}}'>
20232 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><span style="display: inline-block; height: 100%; vertical-align: middle;"></span><span typeof="mw:Image" style="vertical-align: middle; display: inline-block;"><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>
20233 </ul>
20234 !! end
20235
20236 !! test
20237 Gallery in slideshow mode
20238 !! options
20239 parsoid={
20240 "nativeGallery": true
20241 }
20242 !! wikitext
20243 <gallery mode="slideshow" showthumbnails="">
20244 File:Foobar.jpg
20245 </gallery>
20246 !! html/php
20247 <ul class="gallery mw-gallery-slideshow" data-showthumbnails="1">
20248 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20249 <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>
20250 <div class="gallerytext">
20251 </div>
20252 </div></li>
20253 </ul>
20254
20255 !! html/parsoid
20256 <ul class="gallery mw-gallery-slideshow" data-showthumbnails="1" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{"mode":"slideshow","showthumbnails":""},"body":{}}'>
20257 <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>
20258 </ul>
20259 !! end
20260
20261 !! test
20262 HTML Hex character encoding (spells the word "JavaScript")
20263 !! options
20264 parsoid=wt2html,wt2wt,html2html
20265 !! wikitext
20266 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
20267 !! html/php
20268 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
20269 </p>
20270 !! html/php+tidy
20271 <p>JavaScript</p>
20272 !! html/parsoid
20273 <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>
20274 !! end
20275
20276 !! test
20277 HTML Hex character encoding bogus encoding (T28437 regression check)
20278 !! wikitext
20279 &#xsee;&#XSEE;
20280 !! html/php
20281 <p>&amp;#xsee;&amp;#XSEE;
20282 </p>
20283 !! html/parsoid
20284 <p>&amp;#xsee;&amp;#XSEE;</p>
20285 !! end
20286
20287 !! test
20288 HTML Hex character encoding mixed case
20289 !! options
20290 parsoid=wt2html,wt2wt,html2html
20291 !! wikitext
20292 &#xEE;&#Xee;
20293 !! html/php
20294 <p>&#xee;&#xee;
20295 </p>
20296 !! html/php+tidy
20297 <p>îî</p>
20298 !! html/parsoid
20299 <p><span typeof="mw:Entity">î</span><span typeof="mw:Entity">î</span></p>
20300 !! end
20301
20302 # See: https://www.w3.org/TR/html5/syntax.html#character-references
20303 # Note that U+000C (form feed) is not a valid XML character, so
20304 # it is banned even though allowed in HTML5.
20305 !! test
20306 Illegal character references (T106578)
20307 !! wikitext
20308 ; Null: &#00;
20309 ; FF: &#xC;
20310 ; CR: &#xD;
20311 ; Control (low): &#8;
20312 ; Control (high): &#x7F; &#x9F;
20313 ; Surrogate: &#xD83D;&#xDCA9;
20314 ; This is an okay astral character: &#x1F4A9;
20315 !! html+tidy
20316 <dl>
20317 <dt>Null</dt>
20318 <dd>&amp;#00;</dd>
20319 <dt>FF</dt>
20320 <dd>&amp;#xC;</dd>
20321 <dt>CR</dt>
20322 <dd>&amp;#xD;</dd>
20323 <dt>Control (low)</dt>
20324 <dd>&amp;#8;</dd>
20325 <dt>Control (high)</dt>
20326 <dd>&amp;#x7F; &amp;#x9F;</dd>
20327 <dt>Surrogate</dt>
20328 <dd>&amp;#xD83D;&amp;#xDCA9;</dd>
20329 <dt>This is an okay astral character</dt>
20330 <dd>💩</dd>
20331 </dl>
20332 !! end
20333
20334 !! test
20335 __FORCETOC__ override
20336 !! wikitext
20337 __NEWSECTIONLINK__
20338 __FORCETOC__
20339 !! html/php
20340 <p><br />
20341 </p>
20342 !! end
20343
20344 !! test
20345 ISBN code coverage
20346 !! wikitext
20347 ISBN 978-0-1234-56&#x20;789
20348 !! html
20349 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
20350 </p>
20351 !! html+tidy
20352 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a> 789</p>
20353 !! html/parsoid
20354 <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>
20355 !! end
20356
20357 !! test
20358 ISBN followed by 5 spaces
20359 !! wikitext
20360 ISBN
20361 !! html
20362 <p>ISBN
20363 </p>
20364 !! end
20365
20366 !! test
20367 Double ISBN
20368 !! wikitext
20369 ISBN ISBN 1234567890
20370 !! html/php
20371 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
20372 </p>
20373 !! html/parsoid
20374 <p>ISBN <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a></p>
20375 !! end
20376
20377 # Uppercase X and lowercase x as well
20378 !! test
20379 ISBN with an X
20380 !! wikitext
20381 ISBN 3-462-04561-X
20382 ISBN 3-462-04561-x
20383 ISBN 080442957X
20384 ISBN 080442957x
20385 ISBN 978080442957X
20386 ISBN 978080442957x
20387 !! html/php
20388 <p><a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-X</a>
20389 <a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-x</a>
20390 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957X</a>
20391 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957x</a>
20392 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957X</a>
20393 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957x</a>
20394 </p>
20395 !! html/parsoid
20396 <p><a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-X</a>
20397 <a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-x</a>
20398 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957X</a>
20399 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957x</a>
20400 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957X</a>
20401 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957x</a></p>
20402 !! end
20403
20404 !! test
20405 ISBN with empty prefix (parsoid test)
20406 !! wikitext
20407 ISBN 1234567890
20408 !! html/php
20409 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
20410 </p>
20411 !! html/parsoid
20412 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink">ISBN 1234567890</a></p>
20413 !! end
20414
20415 !! test
20416 T24905: <abbr> followed by ISBN followed by </a>
20417 !! wikitext
20418 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
20419 !! html/php
20420 <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>
20421 </p>
20422 !! html/parsoid
20423 <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>
20424 !! end
20425
20426 !! test
20427 Double RFC
20428 !! wikitext
20429 RFC RFC 1234
20430 !! html
20431 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
20432 </p>
20433 !! end
20434
20435 !! test
20436 Double RFC with a wiki link
20437 !! wikitext
20438 RFC [[RFC 1234]]
20439 !! html
20440 <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>
20441 </p>
20442 !! end
20443
20444 !! test
20445 RFC code coverage
20446 !! wikitext
20447 RFC 983&#x20;987
20448 !! html
20449 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
20450 </p>
20451 !! html+tidy
20452 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a> 987</p>
20453 !! end
20454
20455 !! test
20456 Centre-aligned image
20457 !! wikitext
20458 [[Image:foobar.jpg|centre]]
20459 !! html
20460 <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>
20461
20462 !!end
20463
20464 !! test
20465 None-aligned image
20466 !! wikitext
20467 [[Image:foobar.jpg|none]]
20468 !! html
20469 <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>
20470
20471 !!end
20472
20473 !! test
20474 Width + Height sized image (using px) (height is ignored)
20475 !! wikitext
20476 [[Image:foobar.jpg|640x480px]]
20477 !! html
20478 <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>
20479 </p>
20480 !!end
20481
20482 !! test
20483 Width-sized image (using px, no following whitespace)
20484 !! wikitext
20485 [[Image:foobar.jpg|640px]]
20486 !! html
20487 <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>
20488 </p>
20489 !!end
20490
20491 !! test
20492 Width-sized image (using px, with following whitespace - test regression from r39467)
20493 !! wikitext
20494 [[Image:foobar.jpg|640px ]]
20495 !! html
20496 <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>
20497 </p>
20498 !!end
20499
20500 !! test
20501 Width-sized image (using px, with preceding whitespace - test regression from r39467)
20502 !! wikitext
20503 [[Image:foobar.jpg| 640px]]
20504 !! html
20505 <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>
20506 </p>
20507 !!end
20508
20509 !! test
20510 Image with page parameter
20511 !! options
20512 djvu
20513 !! wikitext
20514 [[File:LoremIpsum.djvu|page=2]]
20515 !! html/php
20516 <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>
20517 </p>
20518 !! html/parsoid
20519 <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>
20520 !! end
20521
20522 !! test
20523 Another italics / bold test
20524 !! wikitext
20525 ''' ''x'
20526 !! html
20527 <pre>'<i> </i>x'
20528 </pre>
20529 !!end
20530
20531 # FIXME: The php output seems broken. It's interleaving some open/close tags.
20532 !! test
20533 dt/dd/dl test
20534 !! wikitext
20535 :;;;::
20536 !! html/php
20537 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dt></dl></dd></dl></dd></dl></dd></dl></dd></dl></dd></dl>
20538
20539 !! html/parsoid
20540 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dd></dl></dd></dl></dt></dl></dt></dl></dt></dl></dd></dl>
20541
20542 !!end
20543
20544 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
20545 !! test
20546 Images with the "|" character in the comment
20547 !! wikitext
20548 [[File:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
20549 !! html/php
20550 <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>
20551
20552 !! html/parsoid
20553 <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>
20554 !! end
20555
20556 !! test
20557 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
20558 !! wikitext
20559 <html><script>alert(1);</script></html>
20560 !! html
20561 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
20562 </p>
20563 !! end
20564
20565 !! test
20566 HTML with raw HTML ($wgRawHtml==true)
20567 !! options
20568 wgRawHtml=1
20569 !! wikitext
20570 <html><script>alert(1);</script></html>
20571 !! html
20572 <p><script>alert(1);</script>
20573 </p>
20574 !! end
20575
20576 !! test
20577 Parents of subpages, one level up
20578 !! options
20579 subpage title=[[Subpage test/L1/L2/L3]]
20580 !! wikitext
20581 [[../|L2]]
20582 !! html
20583 <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>
20584 </p>
20585 !! end
20586
20587
20588 !! test
20589 Parents of subpages, one level up, not named
20590 !! options
20591 subpage title=[[Subpage test/L1/L2/L3]]
20592 !! wikitext
20593 [[../]]
20594 !! html
20595 <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>
20596 </p>
20597 !! end
20598
20599
20600
20601 !! test
20602 Parents of subpages, two levels up
20603 !! options
20604 subpage title=[[Subpage test/L1/L2/L3]]
20605 !! wikitext
20606 [[../../|L1]]2
20607
20608 [[../../|L1]]l
20609 !! html
20610 <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
20611 </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>
20612 </p>
20613 !! end
20614
20615 !! test
20616 Parents of subpages, two levels up, without trailing slash or name.
20617 !! options
20618 subpage title=[[Subpage test/L1/L2/L3]]
20619 !! wikitext
20620 [[../..]]
20621 !! html
20622 <p>[[../..]]
20623 </p>
20624 !! end
20625
20626 !! test
20627 Parents of subpages, two levels up, with lots of extra trailing slashes.
20628 !! options
20629 subpage title=[[Subpage test/L1/L2/L3]]
20630 !! wikitext
20631 [[../../////]]
20632 !! html
20633 <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>
20634 </p>
20635 !! end
20636
20637 !! article
20638 Subpage test/L1/L2/L3Sibling
20639 !! text
20640 Sibling article
20641 !! endarticle
20642
20643 !! test
20644 Transclusion of a sibling page (one level up)
20645 !! options
20646 subpage title=[[Subpage test/L1/L2/L3]]
20647 !! wikitext
20648 {{../L3Sibling}}
20649 !! html
20650 <p>Sibling article
20651 </p>
20652 !! end
20653
20654 !! test
20655 Transclusion of a child page
20656 !! options
20657 subpage title=[[Subpage test/L1/L2]]
20658 !! wikitext
20659 {{/L3Sibling}}
20660 !! html
20661 <p>Sibling article
20662 </p>
20663 !! end
20664
20665 # This is wt2html only in Parsoid because we add <nowiki>
20666 # because of {{..}} and we don't expect to fix that to
20667 # eliminate the nowikis selective for {{..}} markup.
20668 !! test
20669 Non-transclusion because of too many up levels
20670 !! options
20671 subpage title=[[Subpage test/L1/L2/L3]]
20672 parsoid=wt2html
20673 !! wikitext
20674 {{../../../../More than parent}}
20675 !! html/php
20676 <p>{{../../../../More than parent}}
20677 </p>
20678 !! html/parsoid
20679 <p>{{../../../../More than parent}}</p>
20680 !! end
20681
20682 !! test
20683 Definition list code coverage
20684 !! wikitext
20685 ; title : def
20686 ; title : def
20687 ;title: def
20688 !! html/php
20689 <dl><dt> title &#160;</dt>
20690 <dd> def</dd>
20691 <dt> title&#160;</dt>
20692 <dd> def</dd>
20693 <dt>title</dt>
20694 <dd> def</dd></dl>
20695
20696 !! html/parsoid
20697 <dl><dt> title <span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
20698 <dt> title<span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
20699 <dt>title</dt><dd> def</dd></dl>
20700 !! end
20701
20702 !! test
20703 Don't fall for the self-closing div
20704 !! wikitext
20705 <div>hello world</div/>
20706 !! html
20707 <div>hello world</div>
20708
20709 !! end
20710
20711 !! test
20712 MSGNW magic word
20713 !! wikitext
20714 {{MSGNW:msg}}
20715 !! html/php
20716 <p>&#91;&#91;:Template:Msg&#93;&#93;
20717 </p>
20718 !! end
20719
20720 !! test
20721 RAW magic word
20722 !! wikitext
20723 {{RAW:QUERTY}}
20724 !! html
20725 <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>
20726 </p>
20727 !! end
20728
20729 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
20730 !! test
20731 Always escape literal '>' in output, not just after '<'
20732 !! wikitext
20733 ><>
20734 !! html
20735 <p>&gt;&lt;&gt;
20736 </p>
20737 !! end
20738
20739 !! test
20740 Template caching
20741 !! wikitext
20742 {{Test}}
20743 {{Test}}
20744 !! html
20745 <p>This is a test template
20746 This is a test template
20747 </p>
20748 !! end
20749
20750
20751 !! article
20752 MediaWiki:Fake
20753 !! text
20754 ==header==
20755 !! endarticle
20756
20757 !! test
20758 Inclusion of !userCanEdit() content
20759 !! wikitext
20760 {{MediaWiki:Fake}}
20761 !! html
20762 <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>
20763
20764 !! end
20765
20766
20767 !! test
20768 Out-of-order TOC heading levels
20769 !! wikitext
20770 ==2==
20771 ======6======
20772 ===3===
20773 =1=
20774 =====5=====
20775 ==2==
20776 !! html
20777 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
20778 <ul>
20779 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
20780 <ul>
20781 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
20782 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
20783 </ul>
20784 </li>
20785 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
20786 <ul>
20787 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
20788 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
20789 </ul>
20790 </li>
20791 </ul>
20792 </div>
20793
20794 <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>
20795 <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>
20796 <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>
20797 <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>
20798 <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>
20799 <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>
20800
20801 !! end
20802
20803
20804 !! test
20805 ISBN with a dummy number
20806 !! wikitext
20807 ISBN ---
20808 !! html
20809 <p>ISBN ---
20810 </p>
20811 !! end
20812
20813
20814 !! test
20815 ISBN with space-delimited number
20816 !! wikitext
20817 ISBN 92 9017 032 8
20818 !! html/php
20819 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
20820 </p>
20821 !! html/parsoid
20822 <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>
20823 !! end
20824
20825
20826 !! test
20827 ISBN with multiple spaces, no number
20828 !! wikitext
20829 ISBN foo
20830 !! html
20831 <p>ISBN foo
20832 </p>
20833 !! end
20834
20835
20836 !! test
20837 ISBN length
20838 !! wikitext
20839 ISBN 123456789
20840
20841 ISBN 1234567890
20842
20843 ISBN 12345678901
20844 !! html/php
20845 <p>ISBN 123456789
20846 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
20847 </p><p>ISBN 12345678901
20848 </p>
20849 !! html/parsoid
20850 <p>ISBN 123456789</p>
20851
20852 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a></p>
20853
20854 <p>ISBN 12345678901</p>
20855 !! end
20856
20857
20858 !! test
20859 ISBN with trailing year (T9110)
20860 !! wikitext
20861 ISBN 1-234-56789-0 - 2006
20862
20863 ISBN 1 234 56789 0 - 2006
20864 !! html/php
20865 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
20866 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
20867 </p>
20868 !! html/parsoid
20869 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1-234-56789-0</a> - 2006</p>
20870
20871 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1 234 56789 0</a> - 2006</p>
20872 !! end
20873
20874
20875 !! test
20876 anchorencode
20877 !! wikitext
20878 {{anchorencode:foo bar©#%n}}
20879 !! html
20880 <p>foo_bar.C2.A9.23.25n
20881 </p>
20882 !! end
20883
20884 !! test
20885 anchorencode trims spaces
20886 !! wikitext
20887 {{anchorencode: __pretty__please__}}
20888 !! html
20889 <p>pretty_please
20890 </p>
20891 !! end
20892
20893 !! test
20894 anchorencode deals with links
20895 !! wikitext
20896 {{anchorencode: [[hello|world]] [[hi]]}}
20897 !! html
20898 <p>world_hi
20899 </p>
20900 !! end
20901
20902 !! test
20903 anchorencode deals with templates
20904 !! wikitext
20905 {{anchorencode: {{Foo}} }}
20906 !! html
20907 <p>FOO
20908 </p>
20909 !! end
20910
20911 !! test
20912 anchorencode encodes like the TOC generator: (T20431)
20913 !! wikitext
20914 === _ +:.3A%3A&&amp;]] ===
20915 {{anchorencode: _ +:.3A%3A&&amp;]] }}
20916 __NOEDITSECTION__
20917 !! html
20918 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
20919 <p>.2B:.3A.253A.26.26.5D.5D
20920 </p>
20921 !! end
20922
20923 !! test
20924 T8200: blockquotes and paragraph formatting
20925 !! wikitext
20926 <blockquote>
20927 foo
20928 </blockquote>
20929
20930 bar
20931
20932 baz
20933 !! html
20934 <blockquote>
20935 <p>foo
20936 </p>
20937 </blockquote>
20938 <p>bar
20939 </p>
20940 <pre>baz
20941 </pre>
20942 !! end
20943
20944 !! test
20945 T10293: Use of center tag ruins paragraph formatting
20946 !! wikitext
20947 <center>
20948 foo
20949 </center>
20950
20951 bar
20952
20953 baz
20954 !! html
20955 <center>
20956 <p>foo
20957 </p>
20958 </center>
20959 <p>bar
20960 </p>
20961 <pre>baz
20962 </pre>
20963 !! end
20964
20965 !!test
20966 Parsing of overlapping (improperly nested) inline html tags
20967 !! wikitext
20968 <span><s>x</span></s>
20969 !! html/php
20970 <p><span><s>x&lt;/span&gt;</s></span>
20971 </p>
20972 !! html/parsoid
20973 <p><span><s>x</s></span>
20974 </p>
20975 !!end
20976
20977 ###
20978 ### Language variants related tests
20979 ###
20980 !! test
20981 Self-link in language variants
20982 !! options
20983 title=[[Dunav]] language=sr
20984 !! wikitext
20985 Both [[Dunav]] and [[Дунав]] are names for this river.
20986 !! html
20987 <p>Both <a class="mw-selflink selflink">Dunav</a> and <a class="mw-selflink selflink">Дунав</a> are names for this river.
20988 </p>
20989 !!end
20990
20991 !! article
20992 Дуна
20993 !! text
20994 content
20995 !! endarticle
20996
20997 !! test
20998 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
20999 !! options
21000 title=[[Duna]] language=sr
21001 !! wikitext
21002 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
21003 !! html
21004 <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.
21005 </p>
21006 !! end
21007
21008 !! test
21009 Link to a section of a variant of this title shouldn't be parsed as self-link
21010 !! options
21011 title=[[Duna]] language=sr
21012 !! wikitext
21013 [[Dуна]] is a self-link while [[Dunа#Foo]] and [[Dуна#Foo]] are not self-links.
21014 !! html
21015 <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.
21016 </p>
21017 !! end
21018
21019 !! test
21020 Link to pages in language variants
21021 !! options
21022 language=sr
21023 !! wikitext
21024 Main Page can be written as [[Маин Паге]]
21025 !! html
21026 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
21027 </p>
21028 !!end
21029
21030
21031 !! test
21032 Multiple links to pages in language variants
21033 !! options
21034 language=sr
21035 !! wikitext
21036 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
21037 !! html
21038 <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>.
21039 </p>
21040 !!end
21041
21042
21043 !! test
21044 Simple template in language variants
21045 !! options
21046 language=sr
21047 !! wikitext
21048 {{тест}}
21049 !! html
21050 <p>This is a test template
21051 </p>
21052 !! end
21053
21054
21055 !! test
21056 Template with explicit namespace in language variants
21057 !! options
21058 language=sr
21059 !! wikitext
21060 {{Template:тест}}
21061 !! html
21062 <p>This is a test template
21063 </p>
21064 !! end
21065
21066
21067 !! test
21068 Basic test for template parameter in language variants
21069 !! options
21070 language=sr
21071 !! wikitext
21072 {{парамтест|param=foo}}
21073 !! html
21074 <p>This is a test template with parameter foo
21075 </p>
21076 !! end
21077
21078 !! test
21079 Simple category in language variants
21080 !! options
21081 language=sr cat
21082 !! wikitext
21083 [[Category:МедиаWики Усер'с Гуиде]]
21084 !! html/php
21085 cat=МедиаWики_Усер'с_Гуиде sort=
21086 !! html/parsoid
21087 <link rel="mw:PageProp/Category" href="./Категорија:МедиаWики_Усер'с_Гуиде" data-parsoid='{"stx":"simple","a":{"href":"./Категорија:МедиаWики_Усер&#39;с_Гуиде"},"sa":{"href":"Category:МедиаWики Усер&#39;с Гуиде"}}'/>
21088 !! end
21089
21090 !! article
21091 Category:分类
21092 !! text
21093 blah
21094 !! endarticle
21095
21096 !! article
21097 Category:分類
21098 !! text
21099 blah
21100 !! endarticle
21101
21102 ## We used to, but no longer wt2wt this test since the default serializer
21103 ## will normalize all categories to serialize on their own line.
21104 ## This wikitext usage is going to be fairly uncommon in production and
21105 ## selser will take care of preserving formatting in those scenarios.
21106 !! test
21107 Don't convert blue categorylinks to another variant (T35210)
21108 !! options
21109 cat
21110 language=zh
21111 parsoid=wt2html
21112 !! wikitext
21113 [[A]][[Category:分类]]
21114 !! html/php
21115 cat=分类 sort=
21116 !! html/parsoid
21117 <p><a rel="mw:WikiLink" href="./A" title="A">A</a></p>
21118 <link rel="mw:PageProp/Category" href="./Category:分类"/>
21119 !! end
21120
21121 !! test
21122 Stripping -{}- tags (language variants)
21123 !! options
21124 language=sr
21125 !! wikitext
21126 Latin proverb: -{Ne nuntium necare}-
21127 !! html
21128 <p>Latin proverb: Ne nuntium necare
21129 </p>
21130 !! end
21131
21132
21133 !! test
21134 Prevent conversion with -{}- tags (language variants)
21135 !! options
21136 language=sr variant=sr-ec
21137 !! wikitext
21138 Latinski: -{Ne nuntium necare}-
21139 !! html
21140 <p>Латински: Ne nuntium necare
21141 </p>
21142 !! end
21143
21144
21145 !! test
21146 Prevent conversion of text with -{}- tags (language variants)
21147 !! options
21148 language=sr variant=sr-ec
21149 !! wikitext
21150 Latinski: -{Ne nuntium necare}-
21151 !! html
21152 <p>Латински: Ne nuntium necare
21153 </p>
21154 !! end
21155
21156
21157 !! test
21158 Prevent conversion of links with -{}- tags (language variants)
21159 !! options
21160 language=sr variant=sr-ec
21161 !! wikitext
21162 -{[[Main Page]]}-
21163 !! html
21164 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
21165 </p>
21166 !! end
21167
21168
21169 !! test
21170 -{}- tags within headlines (within html for parserConvert())
21171 !! options
21172 language=sr variant=sr-ec
21173 !! wikitext
21174 == -{Naslov}- ==
21175 !! html
21176 <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>
21177
21178 !! end
21179
21180
21181 !! test
21182 Explicit definition of language variant alternatives
21183 !! options
21184 language=zh variant=zh-tw
21185 !! wikitext
21186 -{zh:China;zh-tw:Taiwan}-, not China
21187 !! html
21188 <p>Taiwan, not China
21189 </p>
21190 !! end
21191
21192
21193 !! test
21194 Conversion around HTML tags
21195 !! options
21196 language=sr variant=sr-ec
21197 !! wikitext
21198 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
21199 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
21200 !! html
21201 <p>
21202 <span title="ЛаCтин">ски</span>
21203 </p>
21204 !! end
21205
21206
21207 !! test
21208 Explicit session-wise language variant mapping (A flag and - flag)
21209 !! options
21210 language=zh variant=zh-tw
21211 !! wikitext
21212 Taiwan is not China.
21213 But -{A|zh:China;zh-tw:Taiwan}- is China,
21214 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
21215 and -{China}- is China.
21216 !! html
21217 <p>Taiwan is not China.
21218 But Taiwan is Taiwan,
21219 (This should be stripped!)
21220 and China is China.
21221 </p>
21222 !! end
21223
21224 !! test
21225 Explicit session-wise language variant mapping (H flag for hide)
21226 !! options
21227 language=zh variant=zh-tw
21228 !! wikitext
21229 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
21230 Taiwan is China.
21231 !! html
21232 <p>(This should be stripped!)
21233 Taiwan is Taiwan.
21234 </p>
21235 !! end
21236
21237 !! test
21238 Adding explicit conversion rule for title (T flag)
21239 !! options
21240 language=zh variant=zh-tw showtitle
21241 !! wikitext
21242 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
21243 !! html
21244 Taiwan
21245 <p>Should be stripped!
21246 </p>
21247 !! end
21248
21249 !! test
21250 Testing that changing the language variant here in the tests actually works
21251 !! options
21252 language=zh variant=zh showtitle
21253 !! wikitext
21254 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
21255 !! html
21256 China
21257 <p>Should be stripped!
21258 </p>
21259 !! end
21260
21261 !! test
21262 Recursive conversion of alt and title attrs shouldn't clear converter state
21263 !! options
21264 language=zh variant=zh-cn showtitle
21265 !! wikitext
21266 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
21267 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
21268 !! html
21269 China
21270 <p>
21271 Should be stripped<span title="Exclamation">!</span>
21272 </p>
21273 !! end
21274
21275 !! test
21276 T26072: more test on conversion rule for title
21277 !! options
21278 language=zh variant=zh-tw showtitle
21279 !! wikitext
21280 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
21281 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
21282 !! html
21283 Taiwan
21284 <p>This should be stripped!
21285 This won't take interferes with the title rule.
21286 </p>
21287 !! end
21288
21289 !! test
21290 Partly disable title conversion if variant == main language code
21291 !! options
21292 language=zh variant=zh title=[[ZH]] showtitle
21293 !! wikitext
21294 -{T|zh-cn:CN;zh-tw:TW}-
21295 !! html
21296 ZH
21297 <p>
21298 </p>
21299 !! end
21300
21301 !! test
21302 Partly disable title conversion if variant == main language code, more
21303 !! options
21304 language=zh variant=zh title=[[ZH]] showtitle
21305 !! wikitext
21306 -{T|TW}-
21307 !! html
21308 ZH
21309 <p>
21310 </p>
21311 !! end
21312
21313 !! test
21314 Raw output of variant escape tags (R flag)
21315 !! options
21316 language=zh variant=zh-tw
21317 !! wikitext
21318 Raw: -{R|zh:China;zh-tw:Taiwan}-
21319 !! html
21320 <p>Raw: zh:China;zh-tw:Taiwan
21321 </p>
21322 !! end
21323
21324 !! test
21325 Nested markup inside raw output of variant escape tags (R flag)
21326 !! options
21327 language=zh variant=zh-tw
21328 !! wikitext
21329 Nested raw: -{R|nested -{zh:China;zh-tw:Taiwan}- nested}-
21330 !! html
21331 <p>Nested raw: nested Taiwan nested
21332 </p>
21333 !! end
21334
21335 !! test
21336 Templates inside raw output of variant escape tags (R flag)
21337 !! options
21338 language=zh variant=zh-tw
21339 !! wikitext
21340 Nested raw: -{R|nested {{echo|hi}} templates}-
21341 !! html
21342 <p>Nested raw: nested hi templates
21343 </p>
21344 !! end
21345
21346 !! test
21347 Strings evaluating false shouldn't be ignored by Language converter (T51072)
21348 !! options
21349 language=zh variant=zh-cn
21350 !! input
21351 -{zh-cn:0;zh-sg:1;zh-tw:2;zh-hk:3}-
21352 !! result
21353 <p>0
21354 </p>
21355 !! end
21356
21357 !! test
21358 Conversion rules from [numeric-only string] to [something else] (T48634)
21359 !! options
21360 language=zh variant=zh-cn
21361 !! input
21362 -{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
21363 !! result
21364 <p>D12345EE12345
21365 </p>
21366 !! end
21367
21368 !! test
21369 Bidirectional converter rule entries with an empty value should be ignored (T53551)
21370 !! options
21371 language=zh variant=zh-cn
21372 !! input
21373 -{H|zh-cn:foo;zh-tw:;}-foobar
21374 !! result
21375 <p>foobar
21376 </p>
21377 !! end
21378
21379 !! test
21380 Unidirectional converter rule entries with an empty "from" string should be ignored (T53551)
21381 !! options
21382 language=zh variant=zh-cn
21383 !! input
21384 -{H|=>zh-cn:foo;}-foobar
21385 !! result
21386 <p>foobar
21387 </p>
21388 !! end
21389
21390 !! test
21391 Empty converter rule entries shouldn't be inserted into the conversion table (T53551)
21392 !! options
21393 language=zh variant=zh-cn
21394 !! input
21395 -{H|}-foobar
21396 !! result
21397 <p>foobar
21398 </p>
21399 !! end
21400
21401 !! test
21402 Nested using of manual convert syntax
21403 !! options
21404 language=zh variant=zh-hk
21405 !! wikitext
21406 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
21407 !! html
21408 <p>Nested: Hello Hong Kong!
21409 </p>
21410 !! end
21411
21412 !! test
21413 HTML markups with conversion syntax in attribs, nested in other conversion blocks
21414 !! options
21415 language=zh variant=zh-cn
21416 !! wikitext
21417 -{zh;zh-hans;zh-hant|<span title="-{X}-">A</span>}-
21418 !! html
21419 <p><span title="X">A</span>
21420 </p>
21421 !! end
21422
21423 !! test
21424 HTML markups with conversion syntax in attribs, nested in other conversion blocks (not working yet)
21425 !! options
21426 language=zh variant=zh-cn disabled
21427 !! wikitext
21428 -{<span title="-{X}-">A</span>}-
21429 !! html
21430 <p><span title="X">A</span>
21431 </p>
21432 !! end
21433
21434 # Since Parsoid is starting to emit canonical wikitext for links,
21435 # [http://example.com http://example.com] will not RT back to that
21436 # form anymore.
21437 !! test
21438 Proper conversion of text in external links
21439 !! options
21440 language=sr variant=sr-ec
21441 parsoid=wt2html
21442 !! wikitext
21443 http://www.google.com
21444 gopher://www.google.com
21445 [http://www.google.com http://www.google.com]
21446 [gopher://www.google.com gopher://www.google.com]
21447 [https://www.google.com irc://www.google.com]
21448 [ftp://www.google.com www.google.com/ftp://dir]
21449 [//www.google.com www.google.com]
21450 !! html/php
21451 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
21452 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
21453 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
21454 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
21455 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
21456 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
21457 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
21458 </p>
21459 !! html/parsoid
21460 <p><a rel="mw:ExtLink" href="http://www.google.com">http://www.google.com</a>
21461 <a rel="mw:ExtLink" href="gopher://www.google.com">gopher://www.google.com</a>
21462 <a rel="mw:ExtLink" href="http://www.google.com">http://www.google.com</a>
21463 <a rel="mw:ExtLink" href="gopher://www.google.com">gopher://www.google.com</a>
21464 <a rel="mw:ExtLink" href="https://www.google.com">irc://www.google.com</a>
21465 <a rel="mw:ExtLink" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
21466 <a rel="mw:ExtLink" href="//www.google.com">www.гоогле.цом</a></p>
21467 !! end
21468
21469 !! test
21470 Do not convert roman numbers to language variants
21471 !! options
21472 language=sr variant=sr-ec
21473 !! wikitext
21474 Fridrih IV je car.
21475 !! html
21476 <p>Фридрих IV је цар.
21477 </p>
21478 !! end
21479
21480 !! test
21481 Unclosed language converter markup "-{"
21482 !! options
21483 language=sr
21484 !! wikitext
21485 -{T|hello
21486 !! html
21487 <p>-{T|hello
21488 </p>
21489 !! end
21490
21491 !! test
21492 Don't convert raw rule "-{R|=&gt;}-" to "=>"
21493 !! options
21494 language=sr
21495 !! wikitext
21496 -{R|=&gt;}-
21497 !! html
21498 <p>=&gt;
21499 </p>
21500 !!end
21501
21502 !! test
21503 Don't break link parsing if language converter markup is in the caption.
21504 !! options
21505 language=sr variant=sr-ec
21506 !! wikitext
21507 [[Main Page|-{R|main page}-]]
21508 !! html
21509 <p><a href="/wiki/Main_Page" title="Маин Паге">main page</a>
21510 </p>
21511 !! end
21512
21513 !! test
21514 T146304: Don't break template parsing if language converter markup is in the parameter.
21515 !! options
21516 language=sr variant=sr-ec
21517 !! wikitext
21518 {{echo|-{R|foo}-}}
21519 !! html/php
21520 <p>foo
21521 </p>
21522 !! end
21523
21524 !! test
21525 T146305: Don't break image parsing if language converter markup is in the caption.
21526 !! options
21527 language=sr
21528 !! wikitext
21529 [[File:Foobar.jpg|thumb|-{R|caption:}-]]
21530 !! html/php
21531 <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>
21532
21533 !! html/parsoid
21534 <figure class="mw-default-size" typeof="mw:Image/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='{"disabled":true,"show":true,"text":"caption:"}'></span></figcaption></figure>
21535 !! end
21536
21537 !! test
21538 T146305: Don't break image parsing if nested language converter markup is in the caption.
21539 !! options
21540 language=zh variant=zh-cn
21541 !! wikitext
21542 [[File:Foobar.jpg|thumb|-{zh-cn:blog (hk: -{zh-hans|WEBJOURNAL}-, tw: -{zh-hans|WEBLOG}-)}-]]
21543 !! html/php
21544 <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>
21545
21546 !! html/parsoid
21547 <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><span typeof="mw:LanguageVariant" data-mw='{"bidir":[{"l":"zh-cn","t":"blog (hk: &lt;span typeof=\"mw:LanguageVariant\" data-parsoid=&#39;{\"fl\":[\"zh-hans\"],\"dsr\":[42,64,null,2]}&#39; data-mw=&#39;{\"filter\":[\"zh-hans\"],\"text\":\"WEBJOURNAL\"}&#39;>&lt;/span>, tw: &lt;span typeof=\"mw:LanguageVariant\" data-parsoid=&#39;{\"fl\":[\"zh-hans\"],\"dsr\":[70,88,null,2]}&#39; data-mw=&#39;{\"filter\":[\"zh-hans\"],\"text\":\"WEBLOG\"}&#39;>&lt;/span>)"}],"show":true}'></span></figcaption></figure>
21548 !! end
21549
21550 !! test
21551 Don't break gallery if language converter markup is inside.
21552 !! options
21553 language=zh
21554 !! wikitext
21555 <gallery>
21556 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=-{R|foo}-|-{R|bar}-]]|alt=-{R|bat}-
21557 File:foobar.jpg|{{Test|unamedParam|alt=-{R|param}-}}|alt=galleryalt
21558 </gallery>
21559 !! html
21560 <ul class="gallery mw-gallery-traditional">
21561 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21562 <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>
21563 <div class="gallerytext">
21564 <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>
21565 </p>
21566 </div>
21567 </div></li>
21568 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21569 <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>
21570 <div class="gallerytext">
21571 <p>This is a test template
21572 </p>
21573 </div>
21574 </div></li>
21575 </ul>
21576
21577 !! end
21578
21579 !! test
21580 T153135: Don't break list handling if language converter markup is in the item.
21581 !! options
21582 language=zh variant=zh-cn
21583 !! wikitext
21584 ;-{zh-cn:AAA;zh-tw:BBB}-
21585 ;-{R|foo:bar}-
21586 !! html/php
21587 <dl><dt>AAA</dt>
21588 <dt>foo:bar</dt></dl>
21589
21590 !! html/parsoid
21591 <dl>
21592 <dt><span typeof="mw:LanguageVariant" data-mw='{"bidir":[{"l":"zh-cn","t":"AAA"},{"l":"zh-tw","t":"BBB"}],"show":true}'></span></dt>
21593 <dt><span typeof="mw:LanguageVariant" data-mw='{"disabled":true,"show":true,"text":"foo:bar"}'></span></dt>
21594 </dl>
21595 !! end
21596
21597 // Note that parsoid does not protect colons unless language converter
21598 // markup is properly nested, because it is a backtracking parser.
21599 !! test
21600 T153135: Unclosed markup in definition list (code coverage)
21601 !! options
21602 language=zh variant=zh-cn
21603 !! wikitext
21604 ;<b>foo:bar
21605 ;-{zh-cn:AAA
21606 !! html/php
21607 <dl><dt><b>foo:bar</dt>
21608 <dt>-{zh-cn:AAA</b></dt></dl>
21609
21610 !! html/parsoid
21611 <dl>
21612 <dt><b>foo:bar</b></dt>
21613 <b>
21614 <dt>-{zh-cn</dt>
21615 <dd>AAA</dd>
21616 </b></dl>
21617 !! end
21618
21619 !! test
21620 T153135: Nested language converter markup in definition list (code coverage)
21621 !! options
21622 language=zh variant=zh-cn
21623 !! wikitext
21624 ;-{zh-cn:AAA -{zh-hans|foo:bar}- -{R|bat:baz}-}-:def
21625 !! html/php
21626 <dl><dt>AAA foo:bar bat:baz</dt>
21627 <dd>def</dd></dl>
21628
21629 !! html/parsoid
21630 <dl>
21631 <dt><span typeof="mw:LanguageVariant" data-mw='{"bidir":[{"l":"zh-cn","t":"AAA &lt;span typeof=\"mw:LanguageVariant\" data-parsoid=&#39;{\"fl\":[\"zh-hans\"],\"dsr\":[13,32,null,2]}&#39; data-mw=&#39;{\"filter\":[\"zh-hans\"],\"text\":\"bar\"}&#39;>&lt;/span> &lt;span typeof=\"mw:LanguageVariant\" data-parsoid=&#39;{\"fl\":[\"R\"],\"dsr\":[33,46,null,2]}&#39; data-mw=&#39;{\"disabled\":true,\"show\":true,\"text\":\"bat:baz\"}&#39;>&lt;/span>"}],"show":true}'></span></dt>
21632 <dd>def</dd>
21633 </dl>
21634 !! end
21635
21636 !! test
21637 T153140: Don't break table handling if language converter markup is in the cell.
21638 !! options
21639 language=sr variant=sr-ec
21640 !! wikitext
21641 {|
21642 |-
21643 | -{R|B}-
21644 |}
21645 !! html/php
21646 <table>
21647
21648 <tr>
21649 <td> B
21650 </td></tr></table>
21651
21652 !! html/parsoid
21653 <table>
21654
21655 <tr>
21656 <td> B
21657 </td></tr></table>
21658
21659 !! end
21660
21661 !! test
21662 T2529: Uncovered bullet
21663 !! wikitext
21664 * Foo {{bullet}}
21665 !! html
21666 <ul><li> Foo </li>
21667 <li> Bar</li></ul>
21668
21669 !! end
21670
21671 # Plain MediaWiki does not remove empty lists, but tidy actually does.
21672 # Templates in Wikipedia rely on this behavior, as tidy has always been
21673 # enabled there. These tests are normally run *without* tidy, so specify the
21674 # full output here.
21675 # To test realistic parsing behavior, apply a tidy-like transformation to both
21676 # the expected output and your parser's output.
21677 !! test
21678 T2529: Uncovered bullet leaving empty list, normally removed by tidy
21679 !! wikitext
21680 ******* Foo {{bullet}}
21681 !! html
21682 <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>
21683 <li> Bar</li></ul>
21684
21685 !! end
21686
21687 !! test
21688 T2529: Uncovered table already at line-start
21689 !! wikitext
21690 x
21691
21692 {{table}}
21693 y
21694 !! html
21695 <p>x
21696 </p>
21697 <table>
21698 <tr>
21699 <td> 1 </td>
21700 <td> 2
21701 </td></tr>
21702 <tr>
21703 <td> 3 </td>
21704 <td> 4
21705 </td></tr></table>
21706 <p>y
21707 </p>
21708 !! end
21709
21710 !! test
21711 T2529: Uncovered bullet in parser function result
21712 !! wikitext
21713 * Foo {{lc:{{bullet}} }}
21714 !! html
21715 <ul><li> Foo </li>
21716 <li> bar</li></ul>
21717
21718 !! end
21719
21720 !! test
21721 T7678: Double-parsed template argument
21722 !! wikitext
21723 {{lc:{{{1}}}|hello}}
21724 !! html
21725 <p>{{{1}}}
21726 </p>
21727 !! end
21728
21729 !! test
21730 T7678: Double-parsed template invocation
21731 !! wikitext
21732 {{lc:{{paramtest {{!}} param = hello }} }}
21733 !! html
21734 <p>{{paramtest | param = hello }}
21735 </p>
21736 !! end
21737
21738 !! test
21739 Case insensitivity of parser functions for non-ASCII characters (T10143)
21740 !! options
21741 language=cs
21742 title=[[Main Page]]
21743 !! wikitext
21744 {{PRVNÍVELKÉ:ěščř}}
21745 {{prvnívelké:ěščř}}
21746 {{PRVNÍMALÉ:ěščř}}
21747 {{prvnímalé:ěščř}}
21748 {{MALÁ:ěščř}}
21749 {{malá:ěščř}}
21750 {{VELKÁ:ěščř}}
21751 {{velká:ěščř}}
21752 !! html
21753 <p>Ěščř
21754 Ěščř
21755 ěščř
21756 ěščř
21757 ěščř
21758 ěščř
21759 ĚŠČŘ
21760 ĚŠČŘ
21761 </p>
21762 !! end
21763
21764 !! test
21765 Morwen/13: Unclosed link followed by heading
21766 !! wikitext
21767 [[link
21768 ==heading==
21769 !! html
21770 <p>[[link
21771 </p>
21772 <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>
21773
21774 !! end
21775
21776 !! test
21777 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
21778 !! wikitext
21779 {{foo|
21780 =heading=
21781 !! html
21782 <p>{{foo|
21783 </p>
21784 <h1><span class="mw-headline" id="heading">heading</span></h1>
21785
21786 !! end
21787
21788 !! test
21789 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
21790 !! wikitext
21791 {{foo|
21792 ==heading==
21793 !! html
21794 <p>{{foo|
21795 </p>
21796 <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>
21797
21798 !! end
21799
21800 !! test
21801 Tildes in comments
21802 !! options
21803 pst
21804 !! wikitext
21805 <!-- ~~~~ -->
21806 !! html/php
21807 <!-- ~~~~ -->
21808 !! end
21809
21810 !! test
21811 Paragraphs inside divs (no extra line breaks)
21812 !! wikitext
21813 <div>Line one
21814
21815 Line two</div>
21816 !! html
21817 <div>Line one
21818 Line two</div>
21819
21820 !! end
21821
21822 !! test
21823 Paragraphs inside divs (extra line break on open)
21824 !! wikitext
21825 <div>
21826 Line one
21827
21828 Line two</div>
21829 !! html
21830 <div>
21831 <p>Line one
21832 </p>
21833 Line two</div>
21834
21835 !! end
21836
21837 !! test
21838 Paragraphs inside divs (extra line break on close)
21839 !! wikitext
21840 <div>Line one
21841
21842 Line two
21843 </div>
21844 !! html
21845 <div>Line one
21846 <p>Line two
21847 </p>
21848 </div>
21849
21850 !! end
21851
21852 !! test
21853 Paragraphs inside divs (extra line break on open and close)
21854 !! wikitext
21855 <div>
21856 Line one
21857
21858 Line two
21859 </div>
21860 !! html
21861 <div>
21862 <p>Line one
21863 </p><p>Line two
21864 </p>
21865 </div>
21866
21867 !! end
21868
21869 !! test
21870 Nesting tags, paragraphs on lines which begin with <div>
21871 !! wikitext
21872 <div></div><strong>A
21873 B</strong>
21874 !! html/php+tidy
21875 <p><strong>A</strong></p>
21876 <p><strong>B</strong></p>
21877 !! html/parsoid
21878 <div></div>
21879 <p><strong>A
21880 B</strong>
21881 </p>
21882 !! end
21883
21884 # T8200: <blockquote> should behave like <div> with respect to line breaks
21885 !! test
21886 T8200: paragraphs inside blockquotes (no extra line breaks)
21887 !! wikitext
21888 <blockquote>Line one
21889
21890 Line two</blockquote>
21891 !! html
21892 <blockquote>Line one
21893 Line two</blockquote>
21894
21895 !! html+tidy
21896 <blockquote>
21897 <p>Line one Line two</p>
21898 </blockquote>
21899 !! end
21900
21901 !! test
21902 T8200: paragraphs inside blockquotes (extra line break on open)
21903 !! wikitext
21904 <blockquote>
21905 Line one
21906
21907 Line two</blockquote>
21908 !! html
21909 <blockquote>
21910 <p>Line one
21911 </p>
21912 Line two</blockquote>
21913
21914 !! html+tidy
21915 <blockquote>
21916 <p>Line one</p>
21917 Line two</blockquote>
21918 !! end
21919
21920 !! test
21921 T8200: paragraphs inside blockquotes (extra line break on close)
21922 !! wikitext
21923 <blockquote>Line one
21924
21925 Line two
21926 </blockquote>
21927 !! html
21928 <blockquote>Line one
21929 <p>Line two
21930 </p>
21931 </blockquote>
21932
21933 !! html+tidy
21934 <blockquote>
21935 <p>Line one</p>
21936 <p>Line two</p>
21937 </blockquote>
21938 !! end
21939
21940 !! test
21941 T8200: paragraphs inside blockquotes (extra line break on open and close)
21942 !! wikitext
21943 <blockquote>
21944 Line one
21945
21946 Line two
21947 </blockquote>
21948 !! html
21949 <blockquote>
21950 <p>Line one
21951 </p><p>Line two
21952 </p>
21953 </blockquote>
21954
21955 !! html+tidy
21956 <blockquote>
21957 <p>Line one</p>
21958 <p>Line two</p>
21959 </blockquote>
21960 !! end
21961
21962 !! test
21963 Paragraphs inside blockquotes/divs (no extra line breaks)
21964 !! wikitext
21965 <blockquote><div>Line one
21966
21967 Line two</div></blockquote>
21968 !! html
21969 <blockquote><div>Line one
21970 Line two</div></blockquote>
21971
21972 !! end
21973
21974 !! test
21975 Paragraphs inside blockquotes/divs (extra line break on open)
21976 !! wikitext
21977 <blockquote><div>
21978 Line one
21979
21980 Line two</div></blockquote>
21981 !! html
21982 <blockquote><div>
21983 <p>Line one
21984 </p>
21985 Line two</div></blockquote>
21986
21987 !! end
21988
21989 !! test
21990 Paragraphs inside blockquotes/divs (extra line break on close)
21991 !! wikitext
21992 <blockquote><div>Line one
21993
21994 Line two
21995 </div></blockquote>
21996 !! html
21997 <blockquote><div>Line one
21998 <p>Line two
21999 </p>
22000 </div></blockquote>
22001
22002 !! end
22003
22004 !! test
22005 Paragraphs inside blockquotes/divs (extra line break on open and close)
22006 !! wikitext
22007 <blockquote><div>
22008 Line one
22009
22010 Line two
22011 </div></blockquote>
22012 !! html
22013 <blockquote><div>
22014 <p>Line one
22015 </p><p>Line two
22016 </p>
22017 </div></blockquote>
22018
22019 !! end
22020
22021 !! test
22022 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
22023 !! options
22024 wgLinkHolderBatchSize=0
22025 !! wikitext
22026 [[meatball:1]]
22027 [[meatball:2]]
22028 [[meatball:3]]
22029 !! html
22030 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
22031 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
22032 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
22033 </p>
22034 !! end
22035
22036 !! test
22037 Free external link invading image caption
22038 !! wikitext
22039 [[Image:Foobar.jpg|thumb|http://x|hello]]
22040 !! html
22041 <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>
22042
22043 !! end
22044
22045 !! test
22046 T17196: localised external link numbers
22047 !! options
22048 language=fa
22049 !! wikitext
22050 [http://en.wikipedia.org/]
22051 !! html/php
22052 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
22053 </p>
22054 !! html/parsoid
22055 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/"></a></p>
22056 !! end
22057
22058 !! test
22059 Multibyte character in padleft
22060 !! wikitext
22061 {{padleft:-Hello|7|Æ}}
22062 !! html
22063 <p>Æ-Hello
22064 </p>
22065 !! end
22066
22067 !! test
22068 Multibyte character in padright
22069 !! wikitext
22070 {{padright:Hello-|7|Æ}}
22071 !! html
22072 <p>Hello-Æ
22073 </p>
22074 !! end
22075
22076 !!test
22077 formatdate parser function
22078 !! wikitext
22079 {{#formatdate:2009-03-24}}
22080 !! html
22081 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
22082 </p>
22083 !! end
22084
22085 !!test
22086 formatdate parser function, with default format
22087 !! wikitext
22088 {{#formatdate:2009-03-24|mdy}}
22089 !! html
22090 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
22091 </p>
22092 !! end
22093
22094 !! test
22095 Spacing of numbers in formatted dates
22096 !! wikitext
22097 {{#formatdate:January 15}}
22098 !! html
22099 <p><span class="mw-formatted-date" title="01-15">January 15</span>
22100 </p>
22101 !! end
22102
22103 !! test
22104 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
22105 !! options
22106 language=nl title=[[MediaWiki:Common.css]]
22107 !! wikitext
22108 {{#formatdate:2009-03-24|dmy}}
22109 !! html
22110 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
22111 </p>
22112 !! end
22113
22114 #
22115 #
22116 #
22117
22118 #
22119 # Edit comments
22120 #
22121
22122 !! test
22123 Edit comment with link
22124 !! options
22125 comment
22126 !! wikitext
22127 I like the [[Main Page]] a lot
22128 !! html/php
22129 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
22130 !!end
22131
22132 !! test
22133 Edit comment with link and link text
22134 !! options
22135 comment
22136 !! wikitext
22137 I like the [[Main Page|best pages]] a lot
22138 !! html/php
22139 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
22140 !!end
22141
22142 !! test
22143 Edit comment with link and link text with suffix
22144 !! options
22145 comment
22146 !! wikitext
22147 I like the [[Main Page|best page]]s a lot
22148 !! html/php
22149 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
22150 !!end
22151
22152 !! test
22153 Edit comment with section link (non-local, eg in history list)
22154 !! options
22155 comment title=[[Main Page]]
22156 !! wikitext
22157 /* External links */ removed bogus entries
22158 !! html/php
22159 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
22160 !!end
22161
22162 !! test
22163 Edit comment with section link and text before it (non-local, eg in history list)
22164 !! options
22165 comment title=[[Main Page]]
22166 !! wikitext
22167 pre-comment text /* External links */ removed bogus entries
22168 !! html/php
22169 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>
22170 !!end
22171
22172 !! test
22173 Edit comment with section link (local, eg in diff view)
22174 !! options
22175 comment local title=[[Main Page]]
22176 !! wikitext
22177 /* External links */ removed bogus entries
22178 !! html/php
22179 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
22180 !!end
22181
22182 !! test
22183 Edit comment with subpage link (T16080)
22184 !! options
22185 comment
22186 subpage
22187 title=[[Subpage test]]
22188 !! wikitext
22189 Poked at a [[/subpage]] here...
22190 !! html/php
22191 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
22192 !!end
22193
22194 !! test
22195 Edit comment with subpage link and link text (T16080)
22196 !! options
22197 comment
22198 subpage
22199 title=[[Subpage test]]
22200 !! wikitext
22201 Poked at a [[/subpage|neat little page]] here...
22202 !! html/php
22203 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
22204 !!end
22205
22206 !! test
22207 Edit comment with bogus subpage link in non-subpage NS (T16080)
22208 !! options
22209 comment
22210 title=[[Subpage test]]
22211 !! wikitext
22212 Poked at a [[/subpage]] here...
22213 !! html/php
22214 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...
22215 !!end
22216
22217 !! test
22218 Edit comment with bare anchor link (local, as on diff)
22219 !! options
22220 comment
22221 local
22222 title=[[Main Page]]
22223 !! wikitext
22224 [[#section]]
22225 !! html/php
22226 <a href="#section">#section</a>
22227 !! end
22228
22229 !! test
22230 Edit comment with bare anchor link (non-local, as on history)
22231 !! options
22232 comment
22233 title=[[Main Page]]
22234 !! wikitext
22235 [[#section]]
22236 !! html/php
22237 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
22238 !! end
22239
22240 !! test
22241 Anchor starting with underscore
22242 !! options
22243 title=[[Foo]]
22244 !! wikitext
22245 [[#_ref|One]]
22246 !! html/php
22247 <p><a href="#_ref">One</a>
22248 </p>
22249 !! html/parsoid
22250 <p><a rel="mw:WikiLink" href="./Foo#_ref" data-parsoid='{"stx":"piped","a":{"href":"./Foo#_ref"},"sa":{"href":"#_ref"}}'>One</a></p>
22251 !! end
22252
22253 !! test
22254 Id starting with underscore
22255 !! wikitext
22256 <div id="_ref"></div>
22257 !! html/*
22258 <div id="_ref"></div>
22259
22260 !! end
22261
22262 !! test
22263 Edit comment with link with more than one pipe (T99346)
22264 !! options
22265 comment
22266 !! wikitext
22267 [[Main Page|Many|pipes]]
22268 !! html/php
22269 <a href="/wiki/Main_Page" title="Main Page">Many|pipes</a>
22270 !! end
22271
22272 !! test
22273 Complex edit comment with link with more than one pipe (T99346)
22274 !! options
22275 comment
22276 !! wikitext
22277 Created page with "<noinclude>[[Category:Requests for permissions/Bot|{{subst:#titleparts:{{subst:PAGENAME}}|1|3}}]]</noinclude> === [[User:MineoBot|]] 8=== {{Request for permissions/links|Mineo..."
22278 !! html/php
22279 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;
22280 !! end
22281
22282 !! test
22283 Space normalisation on autocomment (T24784)
22284 !! options
22285 comment
22286 title=[[Main Page]]
22287 !! wikitext
22288 /* __hello__world__ */
22289 !! html/php
22290 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
22291 !! end
22292
22293 !! test
22294 percent-encoding and + signs in comments (T28410)
22295 !! options
22296 comment
22297 !! wikitext
22298 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
22299 !! html/php
22300 <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>
22301 !! end
22302
22303 # Parsoid doesn't support this yet: see T75581
22304 # but it *should* omit the 'src' attribute if the image is bad.
22305 # PHP side of tests was disabled in
22306 # mediawiki/core:6bd31e7d95161a6e88fa86df60871051da997c3c
22307 # because of issues in the PHP parserTests infrastructure
22308 # (but the output below is indeed what the PHP side emits)
22309 !! test
22310 Bad images - basic functionality
22311 !! wikitext
22312 [[File:Bad.jpg]]
22313 !! DISABLED/html/php
22314 !! html/parsoid
22315 <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>
22316 !! end
22317
22318 !! test
22319 Bad images - T18039: text after bad image disappears
22320 !! wikitext
22321 Foo bar
22322 [[File:Bad.jpg]]
22323 Bar foo
22324 !! DISABLED/html/php
22325 <p>Foo bar
22326 </p><p>Bar foo
22327 </p>
22328 !! html/parsoid
22329 <p>Foo bar
22330 <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>
22331 Bar foo</p>
22332 !! end
22333
22334 !! test
22335 Verify that displaytitle works (T24501) no displaytitle
22336 !! options
22337 showtitle
22338 !! config
22339 wgAllowDisplayTitle=true
22340 wgRestrictDisplayTitle=false
22341 !! wikitext
22342 this is not the the title
22343 !! html/php
22344 Parser test
22345 <p>this is not the the title
22346 </p>
22347 !! end
22348
22349 !! test
22350 Verify that displaytitle works (T24501) RestrictDisplayTitle=false
22351 !! options
22352 showtitle
22353 title=[[Screen]]
22354 !! config
22355 wgAllowDisplayTitle=true
22356 wgRestrictDisplayTitle=false
22357 !! wikitext
22358 this is not the the title
22359 {{DISPLAYTITLE:whatever}}
22360 !! html/php
22361 whatever
22362 <p>this is not the the title
22363 </p>
22364 !! end
22365
22366 !! test
22367 Verify that displaytitle works (T24501) RestrictDisplayTitle=true mismatch
22368 !! options
22369 showtitle
22370 title=[[Screen]]
22371 !! config
22372 wgAllowDisplayTitle=true
22373 wgRestrictDisplayTitle=true
22374 !! wikitext
22375 this is not the the title
22376 {{DISPLAYTITLE:whatever}}
22377 !! html/php
22378 Screen
22379 <p>this is not the the title
22380 </p>
22381 !! end
22382
22383 !! test
22384 Verify that displaytitle works (T24501) RestrictDisplayTitle=true matching
22385 !! options
22386 showtitle
22387 title=[[Screen]]
22388 !! config
22389 wgAllowDisplayTitle=true
22390 wgRestrictDisplayTitle=true
22391 !! wikitext
22392 this is not the the title
22393 {{DISPLAYTITLE:screen}}
22394 !! html/php
22395 screen
22396 <p>this is not the the title
22397 </p>
22398 !! end
22399
22400 !! test
22401 Verify that displaytitle works (T24501) AllowDisplayTitle=false
22402 !! options
22403 showtitle
22404 title=[[Screen]]
22405 !! config
22406 wgAllowDisplayTitle=false
22407 !! wikitext
22408 this is not the the title
22409 {{DISPLAYTITLE:screen}}
22410 !! html/php
22411 Screen
22412 <p>this is not the the title
22413 <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>
22414 </p>
22415 !! end
22416
22417 !! test
22418 Verify that displaytitle works (T24501) AllowDisplayTitle=false no DISPLAYTITLE
22419 !! options
22420 showtitle
22421 title=[[Screen]]
22422 !! config
22423 wgAllowDisplayTitle=false
22424 !! wikitext
22425 this is not the the title
22426 !! html/php
22427 Screen
22428 <p>this is not the the title
22429 </p>
22430 !! end
22431
22432 !! test
22433 Verify that displaytitle handles inline CSS styles (T28547) - rejected value
22434 !! options
22435 showtitle
22436 title=[[Screen]]
22437 !! config
22438 wgAllowDisplayTitle=true
22439 wgRestrictDisplayTitle=true
22440 !! wikitext
22441 this is not the the title
22442 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
22443 !! html/php
22444 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
22445 <p>this is not the the title
22446 </p>
22447 !! end
22448
22449 !! test
22450 Verify that displaytitle handles inline CSS styles (T28547) - accepted value
22451 !! options
22452 showtitle
22453 title=[[Screen]]
22454 !! config
22455 wgAllowDisplayTitle=true
22456 wgRestrictDisplayTitle=true
22457 !! wikitext
22458 this is not the the title
22459 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
22460 !! html/php
22461 <span style="color: red;">s</span>creen
22462 <p>this is not the the title
22463 </p>
22464 !! end
22465
22466 !! test
22467 Page status indicators: Empty name is invalid
22468 !! options
22469 showindicators
22470 !! wikitext
22471 <indicator name=" "></indicator>
22472 <indicator></indicator>
22473 !! html/php
22474 <p><span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
22475 <span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
22476 </p>
22477 !! end
22478
22479 !! test
22480 Page status indicators: Weird syntaxes that are okay
22481 !! options
22482 showindicators
22483 !! wikitext
22484 <indicator name="empty" />
22485 <indicator name="name"></indicator>
22486 !! html/php
22487 empty=
22488 name=
22489 <p><br />
22490 </p>
22491 !! end
22492
22493 !! test
22494 Page status indicators: Torture test
22495 !! options
22496 showindicators
22497 !! wikitext
22498 <indicator name="01">hello world</indicator>
22499 <indicator name="02">[[Main Page]]</indicator>
22500 <indicator name="03">[[File:Foobar.jpg|25px|link=]]</indicator>
22501 <indicator name="04">[[File:Foobar.jpg|25px]]</indicator>
22502 <indicator name="05">* foo
22503 * bar</indicator>
22504 <indicator name="06"><nowiki>foo</nowiki></indicator>
22505 <indicator name="07"> Preformatted</indicator>
22506 <indicator name="08"><div>Broken tag</indicator>
22507 <indicator name="09">{| class=wikitable
22508 | cell
22509 |}</indicator>
22510 <indicator name="10">Two
22511
22512 paragraphs</indicator>
22513 !! html/php
22514 01=hello world
22515 02=<a href="/wiki/Main_Page" title="Main Page">Main Page</a>
22516 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" />
22517 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>
22518 05=<ul><li> foo</li>
22519 <li> bar</li></ul>
22520
22521 06=foo
22522 07=<pre>Preformatted
22523 </pre>
22524 08=<div>Broken tag</div>
22525
22526 09=<table class="wikitable">
22527 <tr>
22528 <td> cell
22529 </td></tr></table>
22530
22531 10=<p>Two
22532 </p><p>paragraphs
22533 </p>
22534 <p><br />
22535 </p><p><br />
22536 </p><p><br />
22537 </p><p><br />
22538 </p><p><br />
22539 </p>
22540 !! end
22541
22542 !! test
22543 preload: check <noinclude> and <includeonly>
22544 !! options
22545 preload
22546 !! wikitext
22547 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
22548 !! html/php
22549 Hello kind world.
22550 !! end
22551
22552 !! test
22553 preload: check <onlyinclude>
22554 !! options
22555 preload
22556 !! wikitext
22557 Goodbye <onlyinclude>Hello world</onlyinclude>
22558 !! html/php
22559 Hello world
22560 !! end
22561
22562 !! test
22563 preload: can pass tags through if we want to
22564 !! options
22565 preload
22566 !! wikitext
22567 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
22568 !! html/php
22569 <includeonly>Hello world</includeonly>
22570 !! end
22571
22572 !! test
22573 preload: check that it doesn't try to do tricks
22574 !! options
22575 preload
22576 !! wikitext
22577 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
22578 !! html/php
22579 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
22580 !! end
22581
22582 !! test
22583 Play a bit with r67090 and T5158
22584 !! wikitext
22585 <div style="width:50% !important">&nbsp;</div>
22586 <div style="width:50%&nbsp;!important">&nbsp;</div>
22587 <div style="width:50%&#160;!important">&nbsp;</div>
22588 <div style="border : solid;">&nbsp;</div>
22589 !! html/php
22590 <div style="width:50% !important">&#160;</div>
22591 <div style="width:50% !important">&#160;</div>
22592 <div style="width:50% !important">&#160;</div>
22593 <div style="border&#160;: solid;">&#160;</div>
22594
22595 !! html/parsoid
22596 <div style="width:50% !important" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
22597 <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>
22598 <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>
22599 <div style="border : solid;" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
22600
22601 !! end
22602
22603 !! test
22604 HTML5 data attributes
22605 !! wikitext
22606 <span data-foo="bar">Baz</span>
22607 <p data-abc-def_hij="">Quuz</p>
22608 !! html/php
22609 <p><span data-foo="bar">Baz</span>
22610 </p>
22611 <p data-abc-def_hij="">Quuz</p>
22612
22613 !! html/parsoid
22614 <p><span data-foo="bar" data-parsoid='{"stx":"html"}'>Baz</span></p>
22615 <p data-abc-def_hij="" data-parsoid='{"stx":"html"}'>Quuz</p>
22616 !! end
22617
22618 !! test
22619 Strip reserved data attributes
22620 !! wikitext
22621 <div data-mw="foo" data-parsoid="bar" data-mw-someext="baz" data-ok="fred" data-ooui="xyzzy" data-bad:ns="ns">d</div>
22622 !! html/php
22623 <div data-ok="fred">d</div>
22624
22625 !! html/parsoid
22626 <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>
22627 !! end
22628
22629 !! test
22630 percent-encoding and + signs in internal links (T28410)
22631 !! wikitext
22632 [[User:+%]] [[Page+title%]]
22633 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
22634 [[%]] [[+]] [[File:%+abc%39|foo|[[bar]]]]
22635 [[%33%45]] [[%33%45+]]
22636 !! html/php
22637 <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>
22638 <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>
22639 <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>
22640 <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>
22641 </p>
22642 !! html/parsoid
22643 <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>
22644 <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>
22645 <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>
22646 <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>
22647 !! end
22648
22649 !! test
22650 Special characters in embedded file links (T29679)
22651 !! wikitext
22652 [[File:Contains & ampersand.jpg]]
22653 [[File:Does not exist.jpg|Title with & ampersand]]
22654 !! html/php
22655 <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>
22656 <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>
22657 </p>
22658 !! html/parsoid
22659 <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>
22660 <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>
22661 !! end
22662
22663 !! test
22664 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
22665 !! wikitext
22666 Text&apos;s been normalized?
22667 !! html
22668 <p>Text&#39;s been normalized?
22669 </p>
22670 !! end
22671
22672 !! test
22673 T21052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
22674 !! wikitext
22675 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
22676 !! html
22677 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
22678 </p>
22679 !! end
22680
22681 !! test
22682 T21052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
22683 !! wikitext
22684 [http://www.example.org/ ideograms]
22685 !! html
22686 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
22687 </p>
22688 !! end
22689
22690 !! test
22691 T21052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
22692 !! wikitext
22693 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
22694 !! html
22695 <p><img src="http://www.example.org/pic.png" alt="pic.png"/> &lt;-- U+3000 (vim: ^Vu3000)
22696 </p>
22697 !! end
22698
22699 !! article
22700 Mediawiki:loop1
22701 !! text
22702 {{Identical|A}}
22703 !! endarticle
22704
22705 !! article
22706 Mediawiki:loop2
22707 !! text
22708 {{Identical|B}}
22709 !! endarticle
22710
22711 !! article
22712 Template:Identical
22713 !! text
22714 {{int:loop1}}
22715 {{int:loop2}}
22716 !! endarticle
22717
22718 !! test
22719 T33098 Template which includes system messages which includes the template
22720 !! wikitext
22721 {{Identical}}
22722 !! html
22723 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
22724 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
22725 </p>
22726 !! end
22727
22728 !! test
22729 T33490 Turkish: ucfirst 'blah'
22730 !! options
22731 language=tr
22732 !! wikitext
22733 {{ucfirst:blah}}
22734 !! html
22735 <p>Blah
22736 </p>
22737 !! end
22738
22739 !! test
22740 T33490 Turkish: ucfirst 'ix'
22741 !! options
22742 language=tr
22743 !! wikitext
22744 {{ucfirst:ix}}
22745 !! html
22746 <p>İx
22747 </p>
22748 !! end
22749
22750 !! test
22751 T33490 Turkish: lcfirst 'BLAH'
22752 !! options
22753 language=tr
22754 !! wikitext
22755 {{lcfirst:BLAH}}
22756 !! html
22757 <p>bLAH
22758 </p>
22759 !! end
22760
22761 !! test
22762 T33490 Turkish: ucfırst (with a dotless i)
22763 !! options
22764 language=tr
22765 !! wikitext
22766 {{ucfırst:blah}}
22767 !! html
22768 <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>
22769 </p>
22770 !! end
22771
22772 !! test
22773 T33490 ucfırst (with a dotless i) with English language
22774 !! options
22775 language=en
22776 !! wikitext
22777 {{ucfırst:blah}}
22778 !! html
22779 <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>
22780 </p>
22781 !! end
22782
22783 # Note that Parsoid doesn't emit an explicit TOC.
22784 # Note also that the html2wt direction tends to emit an extra newline
22785 # between the __TOC__ magicword and the first heading unless *both*
22786 # the <meta> and the <h2> have a data-parsoid attribute set (even if
22787 # it's "{}").
22788
22789 !! test
22790 T28375: TOC with italics
22791 !! options
22792 title=[[Main Page]]
22793 !! wikitext
22794 __TOC__
22795 == ''Lost'' episodes ==
22796 !! html/php
22797 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
22798 <ul>
22799 <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>
22800 </ul>
22801 </div>
22802
22803 <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>
22804
22805 !! html/parsoid
22806 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
22807 <h2 data-parsoid='{}'> <i>Lost</i> episodes </h2>
22808 !! end
22809
22810 !! test
22811 T28375: TOC with bold
22812 !! options
22813 title=[[Main Page]]
22814 !! wikitext
22815 __TOC__
22816 == '''should be bold''' then normal text ==
22817 !! html/php
22818 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
22819 <ul>
22820 <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>
22821 </ul>
22822 </div>
22823
22824 <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>
22825
22826 !! html/parsoid
22827 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
22828 <h2 data-parsoid='{}'> <b>should be bold</b> then normal text </h2>
22829 !! end
22830
22831 !! test
22832 T35845: Headings become cursive in TOC when they contain an image
22833 !! options
22834 title=[[Main Page]]
22835 !! wikitext
22836 __TOC__
22837 == Image [[Image:foobar.jpg]] ==
22838 !! html/php
22839 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
22840 <ul>
22841 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
22842 </ul>
22843 </div>
22844
22845 <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>
22846
22847 !! html/parsoid
22848 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
22849 <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>
22850 !! end
22851
22852 !! test
22853 T35845 (2): Headings become bold in TOC when they contain a blockquote
22854 !! options
22855 title=[[Main Page]]
22856 !! wikitext
22857 __TOC__
22858 == <blockquote>Quote</blockquote> ==
22859 !! html/php
22860 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
22861 <ul>
22862 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
22863 </ul>
22864 </div>
22865
22866 <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>
22867
22868 !! html/php+tidy
22869 <p></p>
22870 <div id="toc" class="toc">
22871 <div class="toctitle">
22872 <h2>Contents</h2>
22873 </div>
22874 <ul>
22875 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
22876 </ul>
22877 </div>
22878 <p></p>
22879 <h2><span class="mw-headline" id="Quote"></span></h2>
22880 <blockquote>
22881 <p><span class="mw-headline" id="Quote">Quote</span></p>
22882 </blockquote>
22883 <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>
22884 !! html/parsoid
22885 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
22886 <h2 data-parsoid='{}'> <blockquote>Quote</blockquote> </h2>
22887 !! end
22888
22889 !! test
22890 Unclosed tags in TOC
22891 !! options
22892 title=[[Main Page]]
22893 !! wikitext
22894 __TOC__
22895 == Proof: 2 < 3 ==
22896 <small>Hanc marginis exiguitas non caperet.</small>
22897 QED
22898 !! html/php
22899 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
22900 <ul>
22901 <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>
22902 </ul>
22903 </div>
22904
22905 <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>
22906 <p><small>Hanc marginis exiguitas non caperet.</small>
22907 QED
22908 </p>
22909 !! html/parsoid
22910 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
22911 <h2 data-parsoid='{}'> Proof: 2 &lt; 3 </h2>
22912 <p><small>Hanc marginis exiguitas non caperet.</small>
22913 QED</p>
22914 !! end
22915
22916 !! test
22917 Multiple tags in TOC
22918 !! wikitext
22919 __TOC__
22920 == <i>Foo</i> <b>Bar</b> ==
22921
22922 == <i>Foo</i> <blockquote>Bar</blockquote> ==
22923 !! html/php
22924 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
22925 <ul>
22926 <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>
22927 <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>
22928 </ul>
22929 </div>
22930
22931 <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>
22932 <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>
22933
22934 !! html/php+tidy
22935 <p></p>
22936 <div id="toc" class="toc">
22937 <div class="toctitle">
22938 <h2>Contents</h2>
22939 </div>
22940 <ul>
22941 <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>
22942 <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>
22943 </ul>
22944 </div>
22945 <p></p>
22946 <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>
22947 <h2><span class="mw-headline" id="Foo_Bar_2"><i>Foo</i></span></h2>
22948 <blockquote>
22949 <p><span class="mw-headline" id="Foo_Bar_2">Bar</span></p>
22950 </blockquote>
22951 <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>
22952 !! html/parsoid
22953 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
22954 <h2 data-parsoid='{}'> <i data-parsoid='{"stx":"html"}'>Foo</i> <b data-parsoid='{"stx":"html"}'>Bar</b> </h2>
22955 <h2> <i data-parsoid='{"stx":"html"}'>Foo</i> <blockquote>Bar</blockquote> </h2>
22956 !! end
22957
22958 # Don't expect Parsoid to roundtrip this until the php parser comes closer to
22959 # html5 tag parsing.
22960 !! test
22961 Tags with parameters in TOC
22962 !! options
22963 parsoid=wt2html
22964 !! wikitext
22965 __TOC__
22966 == <sup class="in-h2">Hello</sup> ==
22967
22968 == <sup class="a > b">Evilbye</sup> ==
22969 !! html/php
22970 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
22971 <ul>
22972 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
22973 <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>
22974 </ul>
22975 </div>
22976
22977 <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>
22978 <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>
22979
22980 !! html/parsoid
22981 <meta property="mw:PageProp/toc" />
22982 <h2> <sup class="in-h2" data-parsoid='{"stx":"html"}'>Hello</sup> </h2>
22983
22984 <h2> <sup class="a " data-parsoid='{"stx":"html"}'> b">Evilbye</sup> </h2>
22985 !! end
22986
22987 !! test
22988 span tags with directionality in TOC
22989 !! wikitext
22990 __TOC__
22991 == <span dir="ltr">C++</span> ==
22992
22993 == <span dir="rtl">זבנג!</span> ==
22994
22995 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
22996
22997 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
22998
22999 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
23000 !! html/php
23001 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
23002 <ul>
23003 <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>
23004 <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>
23005 <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>
23006 <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>
23007 <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>
23008 </ul>
23009 </div>
23010
23011 <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>
23012 <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>
23013 <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>
23014 <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>
23015 <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>
23016
23017 !! html/parsoid
23018 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
23019 <h2 data-parsoid='{}'> <span dir="ltr">C++</span> </h2>
23020 <h2> <span dir="rtl">זבנג!</span> </h2>
23021 <h2> <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> </h2>
23022 <h2> <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> </h2>
23023 <h2> <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> </h2>
23024 !! end
23025
23026 !! test
23027 T74884: bdi element in ToC
23028 !! wikitext
23029 __TOC__
23030 == <bdi>test</bdi> ==
23031 !! html/php
23032 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
23033 <ul>
23034 <li class="toclevel-1 tocsection-1"><a href="#test"><span class="tocnumber">1</span> <span class="toctext"><bdi>test</bdi></span></a></li>
23035 </ul>
23036 </div>
23037
23038 <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>
23039
23040 !! html/parsoid
23041 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
23042 <h2 data-parsoid='{}'> <bdi>test</bdi> </h2>
23043 !! end
23044
23045 !! test
23046 T35715: s/strike element in ToC
23047 !! wikitext
23048 __TOC__
23049 == <s>test</s> test <strike>test</strike> ==
23050 !! html/php
23051 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
23052 <ul>
23053 <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>
23054 </ul>
23055 </div>
23056
23057 <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>
23058
23059 !! html/parsoid
23060 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
23061 <h2 data-parsoid='{}'> <s>test</s> test <strike>test</strike> </h2>
23062 !! end
23063
23064 # Note that the html output does not have the <p></p>, but the
23065 # html+tidy output *does*. This is because the empty <p></p> is
23066 # removed by the sanitizer, but only when tidy is *not* enabled (!).
23067 !! test
23068 Empty <p> tag in TOC, removed by Sanitizer (T92892)
23069 !! wikitext
23070 __TOC__
23071 == x ==
23072 !! html/php
23073 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
23074 <ul>
23075 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
23076 </ul>
23077 </div>
23078
23079 <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>
23080
23081 !! html/php+tidy
23082 <p></p>
23083 <div id="toc" class="toc">
23084 <div class="toctitle">
23085 <h2>Contents</h2>
23086 </div>
23087 <ul>
23088 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
23089 </ul>
23090 </div>
23091 <p></p>
23092 <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>
23093 !! html/parsoid
23094 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
23095 <h2 data-parsoid='{}'> x </h2>
23096 !! end
23097
23098 !! article
23099 MediaWiki:T34057
23100 !! text
23101 == {{int:headline_sample}} ==
23102 !! endarticle
23103
23104 !! test
23105 T34057: Title needed when expanding <h> nodes.
23106 !! options
23107 title=[[Main Page]]
23108 !! wikitext
23109 {{int:T34057}}
23110 !! html
23111 <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>
23112
23113 !! end
23114
23115 !! test
23116 Strip marker in urlencode
23117 !! wikitext
23118 {{urlencode:x<nowiki/>y}}
23119 {{urlencode:x<nowiki/>y|wiki}}
23120 {{urlencode:x<nowiki/>y|path}}
23121 {{urlencode:x<pre id="one">two</pre>y}}
23122 !! html/php
23123 <p>xy
23124 xy
23125 xy
23126 xy
23127 </p>
23128 !! end
23129
23130 !! test
23131 Strip marker in lc
23132 !! wikitext
23133 {{lc:x<nowiki/>y}}
23134 !! html
23135 <p>xy
23136 </p>
23137 !! end
23138
23139 !! test
23140 Strip marker in uc
23141 !! wikitext
23142 {{uc:x<nowiki/>y}}
23143 !! html
23144 <p>XY
23145 </p>
23146 !! end
23147
23148 !! test
23149 Strip marker in formatNum
23150 !! wikitext
23151 {{formatnum:1<nowiki/>2}}
23152 {{formatnum:1<nowiki/>2|R}}
23153 !! html
23154 <p>12
23155 12
23156 </p>
23157 !! end
23158
23159 !! test
23160 Check noCommafy in formatNum
23161 !! options
23162 language=be-tarask
23163 !! wikitext
23164 {{formatnum:123456.78}}
23165 {{formatnum:123456.78|NOSEP}}
23166 !! html
23167 <p>123 456,78
23168 123456.78
23169 </p>
23170 !! end
23171
23172 !! test
23173 Wrong option for formatNum (T58199)
23174 !! wikitext
23175 {{formatnum:1,234.56|Random}}
23176 {{formatnum:1,234.56|EVERYTHING}}
23177 {{formatnum:1234.56|any argument that has the string 'NOSEP'}}
23178 !! html
23179 <p>1,234.56
23180 1,234.56
23181 1,234.56
23182 </p>
23183 !! end
23184
23185 !! test
23186 Strip marker in grammar
23187 !! options
23188 language=fi
23189 !! wikitext
23190 {{grammar:elative|foo<nowiki/>bar}}
23191 !! html
23192 <p>foobarista
23193 </p>
23194 !! end
23195
23196 !! test
23197 Strip marker in padleft
23198 !! wikitext
23199 {{padleft:|2|x<nowiki/>y}}
23200 !! html
23201 <p>xy
23202 </p>
23203 !! end
23204
23205 !! test
23206 Strip marker in padright
23207 !! wikitext
23208 {{padright:|2|x<nowiki/>y}}
23209 !! html
23210 <p>xy
23211 </p>
23212 !! end
23213
23214 !! test
23215 Strip marker in anchorencode
23216 !! wikitext
23217 {{anchorencode:x<nowiki/>y}}
23218 !! html
23219 <p>xy
23220 </p>
23221 !! end
23222
23223 !! test
23224 nowiki inside link inside heading (T20295)
23225 !! wikitext
23226 ==[[foo|x<nowiki>y</nowiki>z]]==
23227 !! html
23228 <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>
23229
23230 !! end
23231
23232 !! test
23233 new support for bdi element (T33817)
23234 !! wikitext
23235 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
23236 !! html
23237 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
23238
23239 !!end
23240
23241 !! test
23242 Ignore pipe between table row attributes
23243 !! wikitext
23244 {|
23245 | quux
23246 |- id=foo | style='color: red'
23247 | bar
23248 |}
23249 !! html
23250 <table>
23251 <tr>
23252 <td> quux
23253 </td></tr>
23254 <tr id="foo" style="color: red">
23255 <td> bar
23256 </td></tr></table>
23257
23258 !! end
23259
23260 !!test
23261 Language parser function
23262 !! wikitext
23263 {{#language:ar}}
23264 !! html
23265 <p>العربية
23266 </p>
23267 !! end
23268
23269 !!test
23270 Padleft and padright as substr
23271 !! wikitext
23272 {{padleft:|3|abcde}}
23273 {{padright:|3|abcde}}
23274 !! html
23275 <p>abc
23276 abc
23277 </p>
23278 !! end
23279
23280 !!test
23281 Special parser function
23282 !! wikitext
23283 {{#special:RandomPage}}
23284 {{#special:BaDtItLe}}
23285 {{#special:Foobar}}
23286 !! html
23287 <p>Special:Random
23288 Special:Badtitle
23289 Special:Foobar
23290 </p>
23291 !! end
23292
23293 !!test
23294 T36939 - Case insensitive link parsing ([HttP://])
23295 !! wikitext
23296 [HttP://MediaWiki.Org/]
23297 !! html/php
23298 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
23299 </p>
23300 !! html/parsoid
23301 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/"></a></p>
23302 !! end
23303
23304 !!test
23305 T36939 - Case insensitive link parsing ([HttP:// title])
23306 !! wikitext
23307 [HttP://MediaWiki.Org/ MediaWiki]
23308 !! html
23309 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
23310 </p>
23311 !! end
23312
23313 !!test
23314 T36939 - Case insensitive link parsing (HttP://)
23315 !! wikitext
23316 HttP://MediaWiki.Org/
23317 !! html/php
23318 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
23319 </p>
23320 !! html/parsoid
23321 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a></p>
23322 !! end
23323
23324 !!test
23325 Disable TOC
23326 !! options
23327 notoc
23328 !! wikitext
23329 Lead
23330 == Section 1 ==
23331 == Section 2 ==
23332 == Section 3 ==
23333 == Section 4 ==
23334 == Section 5 ==
23335 !! html
23336 <p>Lead
23337 </p>
23338
23339 <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>
23340 <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>
23341 <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>
23342 <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>
23343 <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>
23344
23345 !! end
23346
23347
23348 ###
23349 ### Parsoid-specific tests
23350 ### Parsoid-PHP parser incompatibilities
23351 ###
23352 !!test
23353 1. SOL-sensitive wikitext tokens as template-args
23354 !!options
23355 parsoid=wt2html,wt2wt
23356 !! wikitext
23357 {{echo|*a}}
23358 {{echo|#a}}
23359 {{echo|:a}}
23360 !! html
23361 <span about="#mwt1" typeof="mw:Transclusion">
23362 </span><ul about="#mwt1"><li>a</li>
23363 </ul>
23364 <span about="#mwt2" typeof="mw:Transclusion">
23365 </span><ol about="#mwt2"><li>a</li>
23366 </ol>
23367 <span about="#mwt3" typeof="mw:Transclusion">
23368 </span><dl about="#mwt3"><dd>a</dd>
23369 </dl>
23370 !!end
23371
23372 #### -----------------------------------------------------------------
23373 #### Parsoid-specific functionality tests
23374 #### -----------------------------------------------------------------
23375
23376 # T65642/T68749: Formatting elt fixup around images is cleaned up.
23377 # We know wt2wt will fail, but we expect selser to pass.
23378 # Due to the nature of our testing, wt2wt and selser tests will enter the
23379 # blacklist and we'll catch selser regressions based on changes to the
23380 # blacklist entries for selser tests.
23381 !! test
23382 1. Bad treebuilder fixup of formatting elt is cleaned up
23383 !! options
23384 parsoid=wt2html,wt2wt
23385 !! wikitext
23386 {|
23387 |
23388 <small>
23389 [[Image:Foobar.jpg|right|Test]]
23390 </small>
23391 |}
23392 !! html/parsoid
23393 <table>
23394 <tbody><tr><td>
23395 <small>
23396 <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>
23397 </small>
23398 </td></tr>
23399 </tbody></table>
23400 !! end
23401
23402 !! test
23403 2. Bad treebuilder fixup of formatting elt is cleaned up
23404 !! options
23405 parsoid=wt2html,wt2wt
23406 !! wikitext
23407 '''foo[[File:Foobar.jpg|thumb|caption]]bar'''
23408
23409 <small>[[Image:Foobar.jpg|right|300px]]</small>
23410 !! html/parsoid
23411
23412 <p><b>foo</b></p>
23413 <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>
23414 <p><b>bar</b></p>
23415 <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>
23416 !! end
23417
23418 !! test
23419 3. Bad treebuilder fixup of formatting elt is cleaned up
23420 !! options
23421 parsoid=wt2html,wt2wt
23422 !! wikitext
23423 <small>'''foo[[File:Foobar.jpg|thumb|caption]]bar'''</small>
23424 !! html/parsoid
23425 <p><small><b>foo</b></small></p>
23426 <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>
23427 <p><small><b>bar</b></small></p>
23428 !! end
23429
23430 !! test
23431 4. Bad treebuilder fixup of formatting elt is cleaned up: formatting tags around captionless images are ignored
23432 !! options
23433 parsoid=wt2html,wt2wt
23434 !! wikitext
23435 '''<small>[[Image:Foobar.jpg|right|300px]]</small>'''
23436 !! html/parsoid
23437 <p><b><small></small></b></p>
23438 <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>
23439 <p></p>
23440 !! end
23441
23442 #### ----------------------------------------------------------------
23443 #### Parsoid-only testing of Parsoid's impl of LST
23444 #### Not implemented yet, see
23445 #### https://www.mediawiki.org/wiki/Parsoid/HTML_based_LST
23446 #### ----------------------------------------------------------------
23447
23448 ## We still need to support serializing the older format while content is stored.
23449 !! test
23450 LST Sections: Backwards compatibility
23451 !! options
23452 parsoid={
23453 "suppressErrors": true,
23454 "modes": ["html2wt"]
23455 }
23456 !! wikitext
23457 <section begin="2011-05-16" />
23458 <section end="2014-04-10 (MW 1.23wmf22)" />
23459 !! html/parsoid
23460 <p><meta typeof="mw:Extension/LabeledSectionTransclusion/begin" content="2011-05-16"/>
23461 <meta typeof="mw:Extension/LabeledSectionTransclusion/end" content="2014-04-10 (MW 1.23wmf22)"/></p>
23462 !! end
23463
23464 !! test
23465 LST Sections: Newfangled approach
23466 !! wikitext
23467 <section begin="2011-05-16" />
23468 <section end="2014-04-10 (MW 1.23wmf22)" />
23469 !! html/parsoid
23470 <p><span typeof="mw:Extension/section" about="#mwt4" data-mw='{"name":"section","attrs":{"begin":"2011-05-16"},"body":null}'>
23471 </span>
23472 <span typeof="mw:Extension/section" about="#mwt6" data-mw='{"name":"section","attrs":{"end":"2014-04-10 (MW 1.23wmf22)"},"body":null}'>
23473 </span></p>
23474 !! end
23475
23476 #--------- Test stripping of empty nodes in template content ----------
23477
23478 !! test
23479 Empty LI and TR nodes should be stripped from template content
23480 !! wikitext
23481 {{EmptyLITest}}
23482 {{EmptyTRTest}}
23483 !! html/parsoid
23484 <ul about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyLITest","href":"./Template:EmptyLITest"},"params":{},"i":0}}]}'>
23485 <li>a</li>
23486 <li>b</li>
23487 </ul>
23488 <table about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRTest","href":"./Template:EmptyTRTest"},"params":{},"i":0}}]}'>
23489 <tbody>
23490 <tr>
23491 <td>foo</td>
23492 </tr>
23493 <tr>
23494 <td>bar</td>
23495 </tr>
23496 </tbody>
23497 </table>
23498 !! end
23499
23500 !! test
23501 Empty LI and TR nodes should not be stripped from top-level content
23502 !! wikitext
23503 * a
23504 *
23505 * b
23506 {|
23507 |-
23508 |-
23509 |foo
23510 |}
23511 !! html/parsoid
23512 <ul>
23513 <li> a</li>
23514 <li></li>
23515 <li> b</li>
23516 </ul>
23517 <table>
23518 <tbody>
23519 <tr></tr>
23520 <tr>
23521 <td>foo</td>
23522 </tr>
23523 </tbody>
23524 </table>
23525 !! end
23526
23527 !! test
23528 Empty TR nodes should not be stripped if they have any attributes set
23529 !! wikitext
23530 {{EmptyTRWithHTMLAttrTest}}
23531 !! html/parsoid
23532 <table about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRWithHTMLAttrTest","href":"./Template:EmptyTRWithHTMLAttrTest"},"params":{},"i":0}}]}'>
23533 <tr align="center"></tr>
23534 <tr><td>foo</td></tr>
23535 <tr align="center"></tr>
23536 <tr><td>bar</td></tr>
23537 </table>
23538 !! end
23539
23540 #### ----------------------------------------------------------------
23541 #### The following section of tests are primarily to test
23542 #### wikitext escaping capabilities of Parsoid. Given that
23543 #### escaping can be done any number of ways, the wikitext (input)
23544 #### is always adjusted to reflect how Parsoid adds nowiki
23545 #### escape tags.
23546 ####
23547 #### We are marking several tests as parsoid-only since the
23548 #### HTML in the result section is different from what the
23549 #### PHP parser generates for it.
23550 #### ----------------------------------------------------------------
23551
23552
23553 #### --------------- Headings ---------------
23554 #### 0. Unnested
23555 #### 1. Nested inside html <h1>=foo=</h1>
23556 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
23557 #### 3. Nested inside html with wikitext split by html tags
23558 #### 4. No escape needed
23559 #### 5. Empty headings <h1></h1>
23560 #### 6. Heading chars in SOL context
23561 #### ----------------------------------------
23562 !! test
23563 Headings: 0. Unnested
23564 !! options
23565 parsoid=html2wt
23566 !! html/parsoid
23567 <p>=foo=</p>
23568
23569 <p> =foo=
23570 <!--cmt-->
23571 =foo=</p>
23572
23573 <p>=foo<i>a</i>=</p>
23574 !! wikitext
23575 <nowiki>=foo=</nowiki>
23576
23577 <nowiki> </nowiki>=foo=
23578 <!--cmt-->
23579 <nowiki>=foo=</nowiki>
23580
23581 =foo''a''<nowiki>=</nowiki>
23582 !!end
23583
23584 # New headings and existing headings are handled differently
23585 !! test
23586 Headings: 1. Nested inside html
23587 !! options
23588 parsoid=html2wt
23589 !! html/parsoid
23590 <h1>=foo=</h1>
23591 <h2>=foo=</h2>
23592 <h3>=foo=</h3>
23593
23594 <h1 data-parsoid=''>=foo=</h1>
23595 <h2 data-parsoid=''>=foo=</h2>
23596 <h3 data-parsoid=''>=foo=</h3>
23597 <h4 data-parsoid=''>=foo=</h4>
23598 <h5 data-parsoid=''>=foo=</h5>
23599 <h6 data-parsoid=''>=foo=</h6>
23600 !! wikitext
23601 = =foo= =
23602
23603 == =foo= ==
23604
23605 === =foo= ===
23606
23607 =<nowiki>=foo=</nowiki>=
23608 ==<nowiki>=foo=</nowiki>==
23609 ===<nowiki>=foo=</nowiki>===
23610 ====<nowiki>=foo=</nowiki>====
23611 =====<nowiki>=foo=</nowiki>=====
23612 ======<nowiki>=foo=</nowiki>======
23613
23614 !!end
23615
23616 !! test
23617 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
23618 !! options
23619 parsoid=html2wt
23620 !! html/parsoid
23621 <h1>foo</h1>*bar
23622 <h1>foo</h1>=bar
23623 <h1>foo</h1>=bar=
23624 !! wikitext
23625 = foo =
23626 <nowiki>*</nowiki>bar
23627
23628 = foo =
23629 =bar
23630
23631 = foo =
23632 <nowiki>=bar=</nowiki>
23633 !!end
23634
23635 !! test
23636 Headings: 3. Nested inside html with wikitext split by html tags
23637 !! options
23638 parsoid=html2wt
23639 !! html/parsoid
23640 <h1>=<b>bold</b>foo=</h1>
23641 !! wikitext
23642 = ='''bold'''foo= =
23643 !!end
23644
23645 !! test
23646 Headings: 4a. No escaping needed (testing just h1 and h2)
23647 !! options
23648 parsoid=html2wt
23649 !! html/parsoid
23650 <h1>=foo</h1>
23651 <h1>foo=</h1>
23652 <h1> =foo= </h1>
23653 <h1>=foo= bar</h1>
23654 <h2>=foo</h2>
23655 <h2>foo=</h2>
23656 <h1>=</h1>
23657 <h1><i>=</i>foo=</h1>
23658 !! wikitext
23659 = =foo =
23660
23661 = foo= =
23662
23663 = =foo= =
23664
23665 = =foo= bar =
23666
23667 == =foo ==
23668
23669 == foo= ==
23670
23671 = = =
23672
23673 = ''=''foo= =
23674 !!end
23675
23676 !! test
23677 Headings: 4b. No escaping needed (inside p-tags)
23678 !! options
23679 parsoid=html2wt
23680 !! html/parsoid
23681 <p>===
23682 =foo= x
23683 =foo= <s></s>
23684 </p>
23685 !! wikitext
23686 ===
23687 =foo= x
23688 =foo= <s></s>
23689 !!end
23690
23691 !! test
23692 Headings: 5. Empty headings
23693 !! options
23694 parsoid=html2wt
23695 !! html/parsoid
23696 <h1 data-parsoid='{}'></h1>
23697
23698 <h2 data-parsoid='{}'></h2>
23699
23700 <h3 data-parsoid='{}'></h3>
23701
23702 <h4 data-parsoid='{}'></h4>
23703
23704 <h5 data-parsoid='{}'></h5>
23705
23706 <h6 data-parsoid='{}'></h6>
23707 !! wikitext
23708 =<nowiki/>=
23709
23710 ==<nowiki/>==
23711
23712 ===<nowiki/>===
23713
23714 ====<nowiki/>====
23715
23716 =====<nowiki/>=====
23717
23718 ======<nowiki/>======
23719 !!end
23720
23721 !! test
23722 Headings: 6a. Heading chars in SOL context (with trailing spaces)
23723 !! options
23724 parsoid=html2wt
23725 !! html/parsoid
23726 <p>=a=</p>
23727
23728 <p>=a=</p>
23729
23730 <p>=a=</p>
23731 !! wikitext
23732 <nowiki>=a=</nowiki>
23733
23734 <nowiki>=a=</nowiki>
23735
23736 <nowiki>=a=</nowiki>
23737 !!end
23738
23739 !! test
23740 Headings: 6b. Heading chars in SOL context (with trailing newlines)
23741 !! options
23742 parsoid=html2wt
23743 !! html/parsoid
23744 <p>=a=
23745 b</p>
23746
23747 <p>=a=
23748 b</p>
23749
23750 <p>=a=
23751 b</p>
23752 !! wikitext
23753 <nowiki>=a=</nowiki>
23754 b
23755
23756 <nowiki>=a=</nowiki>
23757 b
23758
23759 <nowiki>=a=</nowiki>
23760 b
23761 !!end
23762
23763 !! test
23764 Headings: 6c. Heading chars in SOL context (leading newline break)
23765 !! options
23766 parsoid=html2wt
23767 !! html/parsoid
23768 <p>a
23769 =b=</p>
23770 !! wikitext
23771 a
23772 <nowiki>=b=</nowiki>
23773 !!end
23774
23775 !! test
23776 Headings: 6d. Heading chars in SOL context (with interspersed comments)
23777 !! options
23778 parsoid=html2wt
23779 !! html/parsoid
23780 <!--c0--><p>=a=</p>
23781
23782 <!--c1--><p>=a=</p> <!--c2--> <!--c3-->
23783 !! wikitext
23784 <!--c0--><nowiki>=a=</nowiki>
23785
23786 <!--c1--><nowiki>=a=</nowiki> <!--c2--> <!--c3-->
23787 !!end
23788
23789 !! test
23790 Headings: 6d. Heading chars in SOL context (No escaping needed)
23791 !! options
23792 parsoid=html2wt
23793 !! html/parsoid
23794 =a=<div>b</div>
23795 !! wikitext
23796 =a=<div>b</div>
23797 !!end
23798
23799 !! test
23800 Headings: 7. Insert a newline between new content and headings
23801 !! options
23802 parsoid=html2wt
23803 !! html/parsoid
23804 <h2>NEW</h2>
23805 <p>new</p>
23806 <h2 data-parsoid='{}'>A</h2>
23807 <p data-parsoid='{}'>a</p>
23808 !! wikitext
23809 == NEW ==
23810 new
23811
23812 ==A==
23813 a
23814
23815 !! end
23816
23817 #### --------------- Lists ---------------
23818 #### 0. Outside nests (*foo, etc.)
23819 #### 1. Nested inside html <ul><li>*foo</li></ul>
23820 #### 2. Inside definition lists
23821 #### 3. Only bullets at start should be escaped
23822 #### 4. No escapes needed
23823 #### 5. No unnecessary escapes
23824 #### 6. Escape bullets in SOL position
23825 #### 7. Escape bullets in a multi-line context
23826 #### ----------------------------------------
23827
23828 !! test
23829 Lists: 0. Outside nests
23830 !! options
23831 parsoid=html2wt
23832 !! html/parsoid
23833 <p>*foo</p>
23834
23835 <p>#foo</p>
23836
23837 <p>;Foo:bar</p>
23838 !! wikitext
23839 <nowiki>*</nowiki>foo
23840
23841 <nowiki>#</nowiki>foo
23842
23843 <nowiki>;</nowiki>Foo<nowiki>:</nowiki>bar
23844 !!end
23845
23846 ## Making these next 3 tests Parsoid-only since they are html2wt tests
23847 ## to test wikitext escaping, and insignificant whitespace diffs
23848 ## cause PHP parser tests to barf
23849 !! test
23850 Lists: 1. Nested inside html (No unnecessary escapes)
23851 !! options
23852 parsoid=html2wt
23853 !! html/parsoid
23854 <ul>
23855 <li>*foo</li>
23856 <li>#foo</li>
23857 <li>:foo</li>
23858 <li>;foo</li>
23859 <li data-parsoid='{}'>*foo</li>
23860 <li data-parsoid='{}'>#foo</li>
23861 <li data-parsoid='{}'>:foo</li>
23862 <li data-parsoid='{}'>;foo</li>
23863 </ul>
23864
23865 <ol>
23866 <li>*foo</li>
23867 <li>#foo</li>
23868 <li>:foo</li>
23869 <li>;foo</li>
23870 <li data-parsoid='{}'>*foo</li>
23871 <li data-parsoid='{}'>#foo</li>
23872 <li data-parsoid='{}'>:foo</li>
23873 <li data-parsoid='{}'>;foo</li>
23874 </ol>
23875 !! wikitext
23876 * *foo
23877 * #foo
23878 * :foo
23879 * ;foo
23880 *<nowiki>*foo</nowiki>
23881 *<nowiki>#foo</nowiki>
23882 *<nowiki>:foo</nowiki>
23883 *<nowiki>;foo</nowiki>
23884
23885 # *foo
23886 # #foo
23887 # :foo
23888 # ;foo
23889 #<nowiki>*foo</nowiki>
23890 #<nowiki>#foo</nowiki>
23891 #<nowiki>:foo</nowiki>
23892 #<nowiki>;foo</nowiki>
23893 !!end
23894
23895 !! test
23896 Lists: 2. Inside definition lists
23897 !! options
23898 parsoid=html2wt
23899 !! html/parsoid
23900 <dl><dt>;foo</dt></dl>
23901 <dl><dt>:foo</dt></dl>
23902 <dl><dt>:foo</dt>
23903 <dd>bar</dd></dl>
23904 <dl><dd>:foo</dd></dl>
23905 !! wikitext
23906 ; ;foo
23907
23908 ; <nowiki>:foo</nowiki>
23909
23910 ; <nowiki>:foo</nowiki>
23911 : bar
23912
23913 : :foo
23914 !!end
23915
23916 !! test
23917 Lists: 3. Only bullets at start of text in wikitext-generated HTML should be escaped
23918 !! options
23919 parsoid=html2wt
23920 !! html/parsoid
23921 <ul>
23922 <li>*foo*bar</li>
23923 <li data-parsoid='{}'>*foo<i>it</i>*bar</li>
23924 </ul>
23925 !! wikitext
23926 * *foo*bar
23927 *<nowiki>*foo</nowiki>''it''*bar
23928 !!end
23929
23930 !! test
23931 Lists: 4. No escapes needed
23932 !! options
23933 parsoid=html2wt
23934 !! html/parsoid
23935 <ul>
23936 <li>foo*bar
23937 </li>
23938 </ul>
23939 <ul>
23940 <li><i>foo</i>*bar
23941 </li>
23942 </ul>
23943 <ul>
23944 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>: bar
23945 </li>
23946 </ul>
23947 <ul>
23948 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>*bar
23949 </li>
23950 </ul>
23951 !! wikitext
23952 *foo*bar
23953
23954 *''foo''*bar
23955
23956 *[[Foo]]: bar
23957
23958 *[[Foo]]*bar
23959 !!end
23960
23961 !! test
23962 Lists: 5. No unnecessary escapes
23963 !! options
23964 parsoid=html2wt
23965 !! html/parsoid
23966 <ul><li> bar <span>[[foo]]</span></li></ul>
23967 <ul><li> =bar <span>[[foo]]</span></li></ul>
23968 <ul><li> [[bar <span>[[foo]]</span></li></ul>
23969 <ul><li> ]]bar <span>[[foo]]</span></li></ul>
23970 <ul><li> =bar <span>foo]]</span>=</li></ul>
23971 <ul><li> <s></s>: a</li></ul>
23972 <ul><li> <i>* foo</i></li></ul>
23973
23974 !! wikitext
23975 * bar <span><nowiki>[[foo]]</nowiki></span>
23976
23977 * =bar <span><nowiki>[[foo]]</nowiki></span>
23978
23979 * [[bar <span><nowiki>[[foo]]</nowiki></span>
23980
23981 * ]]bar <span><nowiki>[[foo]]</nowiki></span>
23982
23983 * =bar <span>foo]]</span>=
23984
23985 * <s></s>: a
23986
23987 * ''* foo''
23988 !!end
23989
23990 !! test
23991 Lists: 6. Escape bullets in SOL position
23992 !! options
23993 parsoid=html2wt
23994 !! html/parsoid
23995 <p><!--cmt-->*foo</p>
23996 !! wikitext
23997 <!--cmt--><nowiki>*</nowiki>foo
23998 !!end
23999
24000 !! test
24001 Lists: 7. Escape bullets in a multi-line context
24002 !! options
24003 parsoid=html2wt
24004 !! html/parsoid
24005 <p>a
24006 *b
24007 </p>
24008 !! wikitext
24009 a
24010 <nowiki>*</nowiki>b
24011 !!end
24012
24013 !! test
24014 Lists: 8. Escape colons only if not present in tags
24015 !! options
24016 parsoid=html2wt
24017 !! html/parsoid
24018 <dl><dt>a:b<i>c:d</i></dt></dl>
24019 !! wikitext
24020 ; <nowiki>a:b</nowiki>''c:d''
24021 !! end
24022
24023 #### --------------- HRs ---------------
24024 #### 1. Single line
24025 #### -----------------------------------
24026
24027 !! test
24028 HRs: 1. Single line
24029 !! options
24030 parsoid=html2wt
24031 !! html/parsoid
24032 <hr />----
24033 <hr />=foo=
24034 <hr />*foo
24035 !! wikitext
24036 ----<nowiki>----</nowiki>
24037 ----=foo=
24038 ----*foo
24039 !! end
24040
24041 #### --------------- Tables ---------------
24042 #### 1a. Simple example
24043 #### 1b. No escaping needed (!foo)
24044 #### 1c. No escaping needed (|foo)
24045 #### 1d. No escaping needed (|}foo)
24046 ####
24047 #### 2a. Nested in td (<td>foo|bar</td>)
24048 #### 2b. Nested in td (<td>foo||bar</td>)
24049 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
24050 ####
24051 #### 3a. Nested in th (<th>foo!bar</th>)
24052 #### 3b. Nested in th (<th>foo!!bar</th>)
24053 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
24054 ####
24055 #### 4a. Escape -
24056 #### 4b. Escape +
24057 #### 4c. No escaping needed
24058 #### --------------------------------------
24059
24060 !! test
24061 Tables: 1a. Simple example
24062 !! options
24063 parsoid=html2wt
24064 !! html/parsoid
24065 <p>{|
24066 |}
24067 </p>
24068 !! wikitext
24069 <nowiki>{|</nowiki>
24070 |}
24071 !! end
24072
24073 !! test
24074 Tables: 1b. No escaping needed
24075 !! options
24076 parsoid=html2wt
24077 !! html/parsoid
24078 <p>!foo
24079 </p>
24080 !! wikitext
24081 !foo
24082 !! end
24083
24084 !! test
24085 Tables: 1c. No escaping needed
24086 !! options
24087 parsoid=html2wt
24088 !! html/parsoid
24089 <p>|foo
24090 </p>
24091 !! wikitext
24092 |foo
24093 !! end
24094
24095 !! test
24096 Tables: 1d. No escaping needed
24097 !! options
24098 parsoid=html2wt
24099 !! html/parsoid
24100 <p>|}foo
24101 </p>
24102 !! wikitext
24103 |}foo
24104 !! end
24105
24106 !! test
24107 Tables: 2a. Nested in td
24108 !! options
24109 parsoid=html2wt
24110 !! html/parsoid
24111 <table><tbody><tr>
24112 <td>foo|bar</td></tr>
24113 <tr><td>x<div>a|b</div></td>
24114 </tbody></table>
24115 !! wikitext
24116 {|
24117 |<nowiki>foo|bar</nowiki>
24118 |-
24119 |x<div><nowiki>a|b</nowiki></div>
24120 |}
24121 !! html/php+tidy
24122 <table>
24123 <tr>
24124 <td>foo|bar</td>
24125 </tr>
24126 <tr>
24127 <td>x
24128 <div>a|b</div>
24129 </td>
24130 </tr>
24131 </table>
24132 !! end
24133
24134 !! test
24135 Tables: 2b. Nested in td
24136 !! options
24137 parsoid=html2wt
24138 !! html/parsoid
24139 <table><tbody><tr>
24140 <td>foo||bar</td>
24141 <td>a<i>b||c</i></td>
24142 <td>a<i><div>b||c</div></i></td>
24143 </tr></tbody></table>
24144 !! wikitext
24145 {|
24146 |<nowiki>foo||bar</nowiki>
24147 |a''<nowiki>b||c</nowiki>''
24148 |a''<div><nowiki>b||c</nowiki></div>''
24149 |}
24150 !! html/php
24151 <table>
24152 <tr>
24153 <td>foo||bar
24154 </td>
24155 <td>a<i>b||c</i>
24156 </td>
24157 <td>a<i><div>b||c</div></i>
24158 </td></tr></table>
24159
24160 !! end
24161
24162 !! test
24163 Tables: 2c. Nested in td -- no escaping needed
24164 !! options
24165 parsoid=html2wt
24166 !! html/*
24167 <table>
24168 <tr>
24169 <td>foo!!bar
24170 </td></tr></table>
24171
24172 !! wikitext
24173 {|
24174 |foo!!bar
24175 |}
24176 !! end
24177
24178 !! test
24179 Tables: 3a. Nested in th
24180 !! options
24181 parsoid=html2wt
24182 !! html/*
24183 <table>
24184 <tr>
24185 <th>foo!bar
24186 </th></tr></table>
24187
24188 !! wikitext
24189 {|
24190 !foo!bar
24191 |}
24192 !! end
24193
24194 !! test
24195 Tables: 3b. Nested in th
24196 !! options
24197 parsoid=html2wt
24198 !! html/parsoid
24199 <table><tbody>
24200 <tr><th>foo!!bar</th>
24201 <th><i>foo|bar</i></th>
24202 <th><i>foo!!bar</i></th>
24203 <th><i><span>foo!!bar</span></i></th>
24204 </tr></tbody></table>
24205 !! wikitext
24206 {|
24207 !<nowiki>foo!!bar</nowiki>
24208 !''<nowiki>foo|bar</nowiki>''
24209 !''<nowiki>foo!!bar</nowiki>''
24210 !''<span><nowiki>foo!!bar</nowiki></span>''
24211 |}
24212 !! html/php
24213 <table>
24214 <tr>
24215 <th>foo!!bar
24216 </th>
24217 <th><i>foo|bar</i>
24218 </th>
24219 <th><i>foo!!bar</i>
24220 </th>
24221 <th><i><span>foo!!bar</span></i>
24222 </th></tr></table>
24223
24224 !! end
24225
24226 !! test
24227 Tables: 3c. Nested in th
24228 !! options
24229 parsoid=html2wt
24230 !! html/parsoid
24231 <table><tbody>
24232 <tr><th>foo||bar</th>
24233 <th><span typeof="mw:Nowiki">foo||bar</span></th>
24234 </tr></tbody></table>
24235 !! wikitext
24236 {|
24237 !<nowiki>foo||bar</nowiki>
24238 !<nowiki>foo||bar</nowiki>
24239 |}
24240 !! html/php
24241 <table>
24242 <tr>
24243 <th>foo||bar
24244 </th>
24245 <th>foo||bar
24246 </th></tr></table>
24247
24248 !! end
24249
24250 !! test
24251 Tables: 4a. Escape -
24252 !! options
24253 parsoid=html2wt
24254 !! html/*
24255 <table>
24256 <tr>
24257 <th>-bar
24258 </th></tr>
24259 <tr>
24260 <td>-bar
24261 </td></tr></table>
24262
24263 !! wikitext
24264 {|
24265 !-bar
24266 |-
24267 |<nowiki>-bar</nowiki>
24268 |}
24269 !! end
24270
24271 !! test
24272 Tables: 4b. Escape +
24273 !! options
24274 parsoid=html2wt
24275 !! html/*
24276 <table>
24277 <tr>
24278 <th>+bar
24279 </th></tr>
24280 <tr>
24281 <td>+bar
24282 </td></tr></table>
24283
24284 !! wikitext
24285 {|
24286 !+bar
24287 |-
24288 |<nowiki>+bar</nowiki>
24289 |}
24290 !! end
24291
24292 !! test
24293 Tables: 4c. No escaping needed
24294 !! options
24295 parsoid=html2wt
24296 !! html/parsoid
24297 <table><tbody>
24298 <tr><td>foo-bar</td><td>foo+bar</td></tr>
24299 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
24300 <tr><td>foo
24301 <p>bar|baz
24302 +bar
24303 -bar</p></td></tr>
24304 <tr><td>x
24305 <div>a|b</div></td>
24306 </tbody></table>
24307 !! wikitext
24308 {|
24309 |foo-bar
24310 |foo+bar
24311 |-
24312 |''foo''-bar
24313 |''foo''+bar
24314 |-
24315 |foo
24316 bar|baz
24317 +bar
24318 -bar
24319 |-
24320 |x
24321 <div>a|b</div>
24322 |}
24323 !! html/php
24324 <table>
24325 <tr>
24326 <td>foo-bar
24327 </td>
24328 <td>foo+bar
24329 </td></tr>
24330 <tr>
24331 <td><i>foo</i>-bar
24332 </td>
24333 <td><i>foo</i>+bar
24334 </td></tr>
24335 <tr>
24336 <td>foo
24337 <p>bar|baz
24338 +bar
24339 -bar
24340 </p>
24341 </td></tr>
24342 <tr>
24343 <td>x
24344 <div>a|b</div>
24345 </td></tr></table>
24346
24347 !! end
24348
24349 !! test
24350 Tables: 4d. No escaping needed
24351 !! options
24352 parsoid=html2wt
24353 !! html/parsoid
24354 <table>
24355 <tbody><tr><td><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>-bar</td>
24356 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>+1</td>
24357 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>-2</td></tr>
24358 </tbody></table>
24359 !! wikitext
24360 {|
24361 |[[Foo]]-bar
24362 ||+1
24363 ||-2
24364 |}
24365 !! html/php
24366 <table>
24367 <tr>
24368 <td><a href="/wiki/Foo" title="Foo">Foo</a>-bar
24369 </td>
24370 <td>+1
24371 </td>
24372 <td>-2
24373 </td></tr></table>
24374
24375 !! end
24376
24377 !! test
24378 T97430: Don't emit empty nowiki pairs around marker meta tags
24379 !! options
24380 parsoid=html2wt
24381 !! html/parsoid
24382 <p>*This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
24383 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.</p>
24384 !! wikitext
24385 <nowiki>*</nowiki>This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
24386 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.
24387 !! end
24388
24389 !! test
24390 Unclosed xmlish element in table line shouldn't eat end delimiters
24391 !! options
24392 parsoid=html2wt
24393 !! html/parsoid
24394 <table>
24395 <tbody><tr><td> &lt;foo</td>
24396 <td> bar></td></tr>
24397 </tbody></table>
24398 !! wikitext
24399 {|
24400 | <foo
24401 | bar>
24402 |}
24403 !! html/php
24404 <table>
24405 <tr>
24406 <td> &lt;foo
24407 </td>
24408 <td> bar&gt;
24409 </td></tr></table>
24410
24411 !! end
24412
24413 #### --------------- Links ----------------
24414 #### 1. Quote marks in link text
24415 #### 2. Wikilinks: Escapes needed
24416 #### 3. Wikilinks: No escapes needed
24417 #### 4. Extlinks: Escapes needed
24418 #### 5. Extlinks: No escapes needed
24419 #### --------------------------------------
24420 !! test
24421 Links 1. WikiLinks: No escapes needed
24422 !! options
24423 parsoid=html2wt
24424 !! html/parsoid
24425 <p><a rel="mw:WikiLink" href="Foo" title="Foo">Foo<i>boo</i></a>
24426 <a rel="mw:WikiLink" href="Foo" title="Foo">[Foobar]</a>
24427 <a rel="mw:WikiLink" href="Foo" title="Foo">x [Foobar] x</a></p>
24428 !! wikitext
24429 [[Foo|Foo''boo'']]
24430 [[Foo|[Foobar]]]
24431 [[Foo|x [Foobar] x]]
24432 !! html/php
24433 <p><a href="/wiki/Foo" title="Foo">Foo<i>boo</i></a>
24434 <a href="/wiki/Foo" title="Foo">[Foobar]</a>
24435 <a href="/wiki/Foo" title="Foo">x [Foobar] x</a>
24436 </p>
24437 !! end
24438
24439 !! test
24440 Links 2. WikiLinks: Escapes needed
24441 !! options
24442 parsoid=html2wt
24443 !! html/parsoid
24444 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
24445 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
24446 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
24447 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
24448 <a href="Foo" rel="mw:WikiLink">|Bar</a>
24449 <a href="Foo" rel="mw:WikiLink">]]bar</a>
24450 <a href="Foo" rel="mw:WikiLink">[[bar</a>
24451 <a href="Foo" rel="mw:WikiLink">x [[ y</a>
24452 <a href="Foo" rel="mw:WikiLink">x ]] y</a>
24453 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
24454 !! wikitext
24455 [[Foo|<nowiki>Foobar]</nowiki>]]
24456 [[Foo|x <nowiki>[http://google.com g]</nowiki> x]]
24457 [[Foo|<nowiki>[[Bar]]</nowiki>]]
24458 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
24459 [[Foo|<nowiki>|Bar</nowiki>]]
24460 [[Foo|<nowiki>]]bar</nowiki>]]
24461 [[Foo|<nowiki>[[bar</nowiki>]]
24462 [[Foo|<nowiki>x [[ y</nowiki>]]
24463 [[Foo|<nowiki>x ]] y</nowiki>]]
24464 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
24465 !! html/php
24466 <p><a href="/wiki/Foo" title="Foo">Foobar]</a>
24467 <a href="/wiki/Foo" title="Foo">x [http://google.com g] x</a>
24468 <a href="/wiki/Foo" title="Foo">[[Bar]]</a>
24469 <a href="/wiki/Foo" title="Foo">x [[Bar]] x</a>
24470 <a href="/wiki/Foo" title="Foo">|Bar</a>
24471 <a href="/wiki/Foo" title="Foo">]]bar</a>
24472 <a href="/wiki/Foo" title="Foo">[[bar</a>
24473 <a href="/wiki/Foo" title="Foo">x [[ y</a>
24474 <a href="/wiki/Foo" title="Foo">x ]] y</a>
24475 <a href="/wiki/Foo" title="Foo">x ]] y [[ z</a>
24476 </p>
24477 !! end
24478
24479 !! test
24480 Links 3. WikiLinks: No escapes needed
24481 !! options
24482 parsoid=html2wt
24483 !! html/parsoid
24484 <p><a rel="mw:WikiLink" href="Foo">[Foobar</a>
24485 <a rel="mw:WikiLink" href="Foo" title="Foo">foo|bar</a></p>
24486 !! wikitext
24487 [[Foo|[Foobar]]
24488 [[Foo|foo|bar]]
24489 !! html/php
24490 <p><a href="/wiki/Foo" title="Foo">[Foobar</a>
24491 <a href="/wiki/Foo" title="Foo">foo|bar</a>
24492 </p>
24493 !! end
24494
24495 !! test
24496 Links 4. ExtLinks: Escapes needed
24497 !! options
24498 parsoid=html2wt
24499 !! html/parsoid
24500 <p><a rel="mw:ExtLink" href="http://google.com">[google]</a>
24501 <a rel="mw:ExtLink" href="http://google.com">google]</a>
24502 <a rel="mw:ExtLink" href="http://google.com">goog] le</a></p>
24503 <p>[http://google.com]</p>
24504 <p>[http://google.com google]</p>
24505 <p>[<a rel="mw:ExtLink" href="http://google.com">http://google.com</a>]</p>
24506 <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>
24507 !! wikitext
24508 [http://google.com <nowiki>[google]</nowiki>]
24509 [http://google.com <nowiki>google]</nowiki>]
24510 [http://google.com <nowiki>goog] le</nowiki>]
24511
24512 <nowiki>[http://google.com]</nowiki>
24513
24514 <nowiki>[http://google.com google]</nowiki>
24515
24516 [http://google.com<nowiki>]</nowiki>
24517
24518 [{{echo|http://google.com}}<nowiki>]</nowiki>
24519 !! html/php
24520 <p><a rel="nofollow" class="external text" href="http://google.com">[google]</a>
24521 <a rel="nofollow" class="external text" href="http://google.com">google]</a>
24522 <a rel="nofollow" class="external text" href="http://google.com">goog] le</a>
24523 </p><p>[http://google.com]
24524 </p><p>[http://google.com google]
24525 </p><p>[<a rel="nofollow" class="external free" href="http://google.com">http://google.com</a>]
24526 </p><p>[<a rel="nofollow" class="external free" href="http://google.com">http://google.com</a>]
24527 </p>
24528 !! end
24529
24530 !! test
24531 Links 5. ExtLinks: No escapes needed
24532 !! options
24533 parsoid=html2wt
24534 !! html/parsoid
24535 <p><a rel="mw:ExtLink" href="http://google.com">[google</a></p>
24536 <p>[<a ref="mw:ExtLink" href="http://google.com"></a>]</p>
24537 !! wikitext
24538 [http://google.com [google]
24539
24540 [[http://google.com]]
24541 !! html/php
24542 <p><a rel="nofollow" class="external text" href="http://google.com">[google</a>
24543 </p><p>[<a rel="nofollow" class="external autonumber" href="http://google.com">[1]</a>]
24544 </p>
24545 !! end
24546
24547 !! test
24548 Links 6. Add <nowiki/>s between text-nodes and url-links when required (T66300)
24549 !! options
24550 parsoid=html2wt
24551 !! html/parsoid
24552 <p>x<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>y
24553 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>?x
24554 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>&amp;x
24555 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>'x
24556 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,x
24557 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.x
24558 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
24559 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>:x
24560 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
24561 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>!x
24562 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>=x
24563 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>(x)
24564 <a rel="mw:ExtLink" href="http://example.com(x" data-parsoid='{"stx":"url"}'>http://example.com(x</a>)
24565 </p>
24566 !! wikitext
24567 x<nowiki/>http://example.com<nowiki/>y
24568 http://example.com<nowiki/>?x
24569 http://example.com<nowiki/>&x
24570 http://example.com<nowiki/>'x
24571 http://example.com<nowiki/>,x
24572 http://example.com<nowiki/>.x
24573 http://example.com<nowiki/>;x
24574 http://example.com<nowiki/>:x
24575 http://example.com<nowiki/>;x
24576 http://example.com<nowiki/>!x
24577 http://example.com<nowiki/>=x
24578 http://example.com<nowiki/>(x)
24579 http://example.com(x<nowiki/>)
24580 !! end
24581
24582 !! test
24583 Links 7a. Don't add spurious <nowiki/>s between text-nodes and url-links (T66300)
24584 !! options
24585 parsoid=html2wt
24586 !! html/parsoid
24587 <p>x
24588 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>
24589 y
24590 "<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>"
24591 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>)
24592 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>) foo
24593 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,
24594 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>, foo
24595 </p>
24596 !! wikitext
24597 x
24598 http://example.com
24599 y
24600 "http://example.com"
24601 (http://example.com)
24602 (http://example.com) foo
24603 http://example.com,
24604 http://example.com, foo
24605 !! html/php
24606 <p>x
24607 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
24608 y
24609 "<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>"
24610 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
24611 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>) foo
24612 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
24613 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>, foo
24614 </p>
24615 !! end
24616
24617 !! test
24618 Links 7b. Don't add spurious <nowiki/>s between text-nodes and url-links (T66300)
24619 !! options
24620 parsoid=html2wt
24621 !! html/parsoid
24622 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.,;:!?\
24623 -<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:</p>
24624 !! wikitext
24625 http://example.com.,;:!?\
24626 -http://example.com:
24627 !! html/php
24628 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.,;:!?\
24629 -<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
24630 </p>
24631 !! end
24632
24633 !! test
24634 Links 8. Add <nowiki/>s between text-nodes and RFC-links when required (T66300)
24635 !! options
24636 parsoid=html2wt
24637 !! html/parsoid
24638 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>4
24639 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
24640 X<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y</p>
24641 !! wikitext
24642 RFC 123<nowiki/>4
24643 RFC 123<nowiki/>y
24644 X<nowiki/>RFC 123<nowiki/>y
24645 !! end
24646
24647 !! test
24648 Links 9. Don't add spurious <nowiki/>s between text-nodes and RFC-links (T66300)
24649 !! options
24650 parsoid=html2wt
24651 !! html/parsoid
24652 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>?foo
24653 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>&amp;foo
24654 -<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>-
24655 </p>
24656 !! wikitext
24657 RFC 123?foo
24658 RFC 123&foo
24659 -RFC 123-
24660 !! html/php
24661 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>?foo
24662 <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>&amp;foo
24663 -<a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>-
24664 </p>
24665 !! end
24666
24667 !! test
24668 Links 10. Add <nowiki/>s between text-nodes and PMID-links when required (T66300)
24669 !! options
24670 parsoid=html2wt
24671 !! html/parsoid
24672 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>4
24673 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
24674 X<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
24675 !! wikitext
24676 PMID 123<nowiki/>4
24677 PMID 123<nowiki/>y
24678 X<nowiki/>PMID 123<nowiki/>y
24679 !! end
24680
24681 !! test
24682 Links 11. Don't add spurious <nowiki/>s between text-nodes and PMID-links (T66300)
24683 !! options
24684 parsoid=html2wt
24685 !! html/parsoid
24686 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>?foo
24687 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>&foo
24688 -<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>-
24689 </p>
24690 !! wikitext
24691 PMID 123?foo
24692 PMID 123&foo
24693 -PMID 123-
24694 !! html/php
24695 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>?foo
24696 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>&amp;foo
24697 -<a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>-
24698 </p>
24699 !! end
24700
24701 !! test
24702 Links 12. Add <nowiki/>s between text-nodes and ISBN-links when required (T66300)
24703 !! options
24704 parsoid=html2wt
24705 !! html/parsoid
24706 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>1
24707 <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>x
24708 a<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>b
24709 </p>
24710 !! wikitext
24711 ISBN 1234567890<nowiki/>1
24712 ISBN 1234567890<nowiki/>x
24713 a<nowiki/>ISBN 1234567890<nowiki/>b
24714 !! end
24715
24716 !! test
24717 Links 13. Don't add spurious <nowiki/>s between text-nodes and ISBN-links (T66300)
24718 !! options
24719 parsoid=html2wt
24720 !! html/parsoid
24721 <p>-<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>'s
24722 !! wikitext
24723 -ISBN 1234567890's
24724 !! html/php
24725 <p>-<a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>'s
24726 </p>
24727 !! end
24728
24729 !! test
24730 Links 14. Protect link-like plain text. (Parsoid bug T78425)
24731 !! options
24732 parsoid=html2wt
24733 !! html/*
24734 <p>this is not a link: http://example.com
24735 </p>
24736 !! wikitext
24737 this is not a link: <nowiki>http://example.com</nowiki>
24738 !! end
24739
24740 !! test
24741 Links 15. Link trails can't become link prefixes.
24742 !! options
24743 language=is
24744 parsoid=html2wt
24745 !! html/parsoid
24746 <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>
24747 !! wikitext
24748 [[Söfnuður]]-[[00]]
24749 !! html/php
24750 <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>
24751 </p>
24752 !! end
24753
24754 #### --------------- Quotes ---------------
24755 #### 1. Quotes inside <b> and <i>
24756 #### 2. Link fragments separated by <i> and <b> tags
24757 #### 3. Link fragments inside <i> and <b>
24758 #### 4. No escaping needed
24759 #### --------------------------------------
24760 !! test
24761 1a. Quotes inside <b> and <i>
24762 !! options
24763 parsoid=html2wt
24764 !! html/*
24765 <p><i>'foo'</i>
24766 <i>''foo''</i>
24767 <i>'''foo'''</i>
24768 <i>foo</i>'s
24769 <b>'foo'</b>
24770 <b>''foo''</b>
24771 <b>'''foo'''</b>
24772 <b>foo'<i>bar'</i>baz</b>
24773 <b>foo</b>'s
24774 '<i>foo</i>
24775 <i>foo</i>'
24776 <i>foo'</i>'
24777 '<i>foo</i>'
24778 '<b>foo</b>
24779 <b>foo</b>'
24780 '<b>foo</b>'
24781 <i>fools'<span> errand</span></i>
24782 <i><span>fool</span>'s errand</i>
24783 '<i>foo</i> bar '<i>baz</i>
24784 a|!*#-:;+-~[]{}b'<i>x</i>
24785 </p>
24786 !! wikitext
24787 ''<nowiki/>'foo'''
24788 ''<nowiki>''foo''</nowiki>''
24789 ''<nowiki>'''foo'''</nowiki>''
24790 ''foo''<nowiki/>'s
24791 '''<nowiki/>'foo''''
24792 '''<nowiki>''foo''</nowiki>'''
24793 '''<nowiki>'''foo'''</nowiki>'''
24794 '''foo'<nowiki/>''bar'<nowiki/>''baz'''
24795 '''foo'''<nowiki/>'s
24796 '''foo''
24797 ''foo''<nowiki/>'
24798 ''foo'''<nowiki/>'
24799 '''foo''<nowiki/>'
24800 ''''foo'''
24801 '''foo'''<nowiki/>'
24802 ''''foo'''<nowiki/>'
24803 ''fools'<span> errand</span>''
24804 ''<span>fool</span>'s errand''
24805 '<nowiki/>''foo'' bar '''baz''
24806 a|!*#-:;+-~[]{}b'''x''
24807 !! end
24808
24809 !! test
24810 1b. Quotes inside <b> and <i> with other tags on same line
24811 !! options
24812 parsoid=html2wt
24813 !! html/parsoid
24814 '<i>a</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
24815 <i>a'</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
24816 <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>
24817 <a rel="mw:WikiLink" href="Foo" title="Foo">foo</a> x'<i><a href="Bar" rel="mw:WikiLink" title="Bar">bar</a></i>
24818 '<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>
24819 '<i>foo</i> <div title="name">test</div>
24820 '<i>foo</i> and <br data-parsoid='{"stx":"html","noClose":true}'/> bar
24821 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
24822 <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>
24823 </ol>
24824 !! wikitext
24825 '''a'' foo ''[[bar]]''
24826 ''a''' foo ''[[bar]]''
24827 ''a''' foo '''{{echo|[[bar]]}}'''
24828 [[foo]] x'''[[bar]]''
24829 '''foo'' <ref>test</ref>
24830 '''foo'' <div title="name">test</div>
24831 '''foo'' and <br> bar
24832 <references />
24833 !! end
24834
24835 !! test
24836 2. Link fragments separated by <i> and <b> tags
24837 !! options
24838 parsoid=html2wt
24839 !! html/parsoid
24840 <p>[[<i>foo</i>hello]]</p>
24841 <p>[[<b>foo</b>hello]]</p>
24842 !! wikitext
24843 [[''foo''<nowiki>hello]]</nowiki>
24844
24845 [['''foo'''<nowiki>hello]]</nowiki>
24846 !! end
24847
24848 # FIXME: Escaping one or both of [[ and ]] is also acceptable --
24849 # this is one of the shortcomings of this format
24850 !! test
24851 3. Link fragments inside <i> and <b>
24852 !! options
24853 parsoid=html2wt
24854 !! html/parsoid
24855 <p><i>[[foo</i>]]</p>
24856 <p><b>[[foo</b>]]</p>
24857 !! wikitext
24858 ''[[foo''<nowiki>]]</nowiki>
24859
24860 '''[[foo'''<nowiki>]]</nowiki>
24861 !! end
24862
24863 !! test
24864 4. No escaping needed
24865 !! options
24866 parsoid=html2wt
24867 !! html/parsoid
24868 <p>'<span><i>bar</i></span>'
24869 '<span><b>bar</b></span>'
24870 'a:b'foo
24871 </p>
24872 !! wikitext
24873 '<span>''bar''</span>'
24874 '<span>'''bar'''</span>'
24875 'a:b'foo
24876 !! end
24877
24878 #### ----------- Paragraphs ---------------
24879 #### 1. No unnecessary escapes
24880 #### --------------------------------------
24881
24882 !! test
24883 1. No unnecessary escapes
24884 !! options
24885 parsoid=html2wt
24886 !! html/parsoid
24887 <p>bar <span>[[foo]]</span>
24888 </p><p>=bar <span>[[foo]]</span>
24889 </p><p>[[bar <span>[[foo]]</span>
24890 </p><p>]]bar <span>[[foo]]</span>
24891 </p><p>=bar <span>foo]]</span>=
24892 </p>
24893 !! wikitext
24894 bar <span><nowiki>[[foo]]</nowiki></span>
24895
24896 =bar <span><nowiki>[[foo]]</nowiki></span>
24897
24898 [[bar <span><nowiki>[[foo]]</nowiki></span>
24899
24900 ]]bar <span><nowiki>[[foo]]</nowiki></span>
24901
24902 =bar <span>foo]]</span><nowiki>=</nowiki>
24903 !!end
24904
24905 #### ----------------------- PRE --------------------------
24906 #### 1. Leading whitespace in SOL context should be escaped
24907 #### ------------------------------------------------------
24908 !! test
24909 1. Leading whitespace in SOL context should be escaped
24910 !! options
24911 parsoid=html2wt
24912 !! html/parsoid
24913 <p> a</p>
24914
24915 <p> a</p>
24916
24917 <p> a(tab)</p>
24918
24919 <p> a
24920 <!--cmt-->
24921 a</p>
24922
24923 <p>a
24924 b</p>
24925
24926 <p>a
24927 b</p>
24928
24929 <p>a
24930 b</p>
24931 !! wikitext
24932 <nowiki> </nowiki>a
24933
24934 <nowiki> </nowiki> a
24935
24936 a(tab)
24937
24938 <nowiki> </nowiki> a
24939 <!--cmt-->
24940 <nowiki> </nowiki>a
24941
24942 a
24943 <nowiki> </nowiki>b
24944
24945 a
24946 b
24947
24948 a
24949 b
24950 !! html/php
24951 <p> a
24952 </p><p> a
24953 </p><p> a(tab)
24954 </p><p> a
24955 a
24956 </p><p>a
24957 b
24958 </p><p>a
24959 b
24960 </p><p>a
24961 b
24962 </p>
24963 !! end
24964
24965 !! test
24966 2. Leading whitespace in non-indent-pre contexts should not be escaped
24967 !! options
24968 parsoid=html2wt
24969 !! html/parsoid
24970 <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>
24971 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
24972 <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>
24973 b</span></li>
24974 </ol>
24975 !! wikitext
24976 foo <ref>''a''
24977 b</ref>
24978 <references />
24979 !! end
24980
24981 !! test
24982 3. Leading whitespace in indent-pre suppressing contexts should not be escaped
24983 !! options
24984 parsoid=html2wt
24985 !! html/parsoid
24986 <blockquote>
24987 <p>
24988 a
24989 <span>b</span>
24990 c</p>
24991 </blockquote>
24992 !! wikitext
24993 <blockquote>
24994 a
24995 <span>b</span>
24996 c
24997 </blockquote>
24998 !! end
24999
25000 !! test
25001 4. Leading whitespace in indent-pre suppressing contexts should not be escaped
25002 !! options
25003 parsoid=html2wt
25004 !! html/parsoid
25005 <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>
25006 !! wikitext
25007 [[File:Foobar.jpg|thumb|caption]]
25008 !! end
25009
25010 !! test
25011 5. Nowiki escaping should account for indent-pres
25012 !! options
25013 parsoid=html2wt
25014 !! html/parsoid
25015 <pre>==foo==</pre>
25016 !! wikitext
25017 ==foo==
25018 !! end
25019
25020 !!test
25021 T95794: nowiki escaping should account for leading space at start-of-line in an indent-pre block
25022 !! options
25023 parsoid=html2wt
25024 !! html/parsoid
25025 <pre>
25026 * foo
25027 * bar
25028 </pre>
25029 !! wikitext
25030 * foo
25031 * bar
25032 !! end
25033
25034 #### --------------- Behavior Switches --------------------
25035
25036 !! test
25037 1. Valid behavior switches should be escaped
25038 !! options
25039 parsoid=html2wt
25040 !! html/parsoid
25041 __TOC__
25042 <i>__TOC__</i>
25043 !! wikitext
25044 <nowiki>__TOC__</nowiki>
25045 ''<nowiki>__TOC__</nowiki>''
25046 !! end
25047
25048 !! test
25049 2. Invalid behavior switches should not be escaped
25050 !! options
25051 parsoid=html2wt
25052 !! html/parsoid
25053 __TOO__
25054 __|__
25055 !! wikitext
25056 __TOO__
25057 __|__
25058 !! end
25059
25060 # We use indent-pre as an indirect way to test for sol-transparent behavior.
25061 !! test
25062 Behavior switches should be SOL-transparent
25063 !! options
25064 parsoid=html2wt
25065 !! html/parsoid
25066 <meta property="mw:PageProp/toc" />
25067
25068 <!-- this one's bogus -->
25069 <pre>__TOO__</pre>
25070
25071 <pre data-parsoid='{}'><meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/> foo</pre>
25072
25073 <meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/><pre data-parsoid='{}'>bar</pre>
25074 !! wikitext
25075 __TOC__
25076
25077 <!-- this one's bogus -->
25078 __TOO__
25079
25080 __TOC__ foo
25081
25082 __TOC__
25083 bar
25084 !! end
25085
25086 #### --------------- HTML tags ---------------
25087 #### 1. a tags
25088 #### 2. other tags
25089 #### 3. multi-line html tag
25090 #### 4. extension tags
25091 #### -----------------------------------------
25092 !! test
25093 1. a tags
25094 !! options
25095 parsoid=html2wt
25096 !! html/parsoid
25097 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
25098 !! wikitext
25099 <a href="http://google.com">google</a>
25100 !! end
25101
25102 !! test
25103 2. other tags
25104 !! options
25105 parsoid=html2wt
25106 !! html/parsoid
25107 <ul><li> &lt;div&gt;foo&lt;/div&gt;</li>
25108 <li> &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;</li>
25109 <li> &lt;td&gt;</li></ul>
25110
25111 !! wikitext
25112 * <nowiki><div>foo</div></nowiki>
25113 * <nowiki><div style="color:red">foo</div></nowiki>
25114 * <nowiki><td></nowiki>
25115 !! end
25116
25117 !! test
25118 3. multi-line html tag
25119 !! options
25120 parsoid=html2wt
25121 !! html/parsoid
25122 <p>&lt;div
25123 &gt;foo&lt;/div
25124 &gt;
25125 </p>
25126 !! wikitext
25127 <nowiki><div
25128 >foo</div
25129 ></nowiki>
25130 !! end
25131
25132 !! test
25133 4. extension tags
25134 !! options
25135 parsoid=html2wt
25136 !! html/parsoid
25137 <p>&lt;ref&gt;foo&lt;/ref&gt;
25138 </p><p>&lt;ref&gt;bar
25139 </p><p>baz&lt;/ref&gt;
25140 </p>
25141 !! wikitext
25142 <nowiki><ref>foo</ref></nowiki>
25143
25144 <nowiki><ref>bar</nowiki>
25145
25146 baz<nowiki></ref></nowiki>
25147 !! end
25148
25149 #### --------------- Others ---------------
25150 !! test
25151 Escaping nowikis
25152 !! options
25153 parsoid=html2wt
25154 !! html/parsoid
25155 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
25156 </p>
25157 !! wikitext
25158 &lt;nowiki&gt;foo&lt;/nowiki&gt;
25159 !! end
25160
25161 ## The quote-char in the input is necessary for triggering the bug
25162 !! test
25163 (T54035) Nowiki-escaping should not get tripped by " :" in text
25164 !! options
25165 parsoid=html2wt
25166 !! html/parsoid
25167 <p>foo's bar :</p>
25168 !! wikitext
25169 foo's bar :
25170 !! end
25171
25172 #----------- End of wikitext escaping tests --------------
25173
25174 !! test
25175
25176 Tag-like HTML structures are passed through as text
25177 !! wikitext
25178 <x y>
25179
25180 <x.y>
25181
25182 <x-y>
25183
25184 1>2
25185
25186 x<y
25187
25188 a>b
25189
25190 1<d e>f
25191 !! html
25192 <p>&lt;x y&gt;
25193 </p><p>&lt;x.y&gt;
25194 </p><p>&lt;x-y&gt;
25195 </p><p>1&gt;2
25196 </p><p>x&lt;y
25197 </p><p>a&gt;b
25198 </p><p>1&lt;d e&gt;f
25199 </p>
25200 !! end
25201
25202 !! test
25203 HTML tag with necessary entities in attributes
25204 !! wikitext
25205 <span title="&amp;amp;">foo</span>
25206 !! html
25207 <p><span title="&amp;amp;">foo</span>
25208 </p>
25209 !! end
25210
25211 !! test
25212 HTML tag with 'unnecessary' entity encoding in attributes
25213 !! wikitext
25214 <span title="&amp;">foo</span>
25215 !! html
25216 <p><span title="&amp;">foo</span>
25217 </p>
25218 !! end
25219
25220 !! test
25221 HTML tag with broken attribute value quoting
25222 !! options
25223 parsoid=wt2html,html2html
25224 !! wikitext
25225 <span title="Hello world>Foo</span>
25226 !! html/php
25227 <p><span title="Hello world">Foo</span>
25228 </p>
25229 !! html/parsoid
25230 <p><span title="Hello world">Foo</span></p>
25231 !! end
25232
25233 !! test
25234 Self-closed tag with broken attribute value quoting
25235 !! options
25236 parsoid=wt2html,html2html
25237 !! wikitext
25238 <div title="Hello world />Foo
25239 !! html/php+tidy
25240 <div title="Hello world"></div>
25241 <p>Foo</p>
25242 !! html/parsoid
25243 <div title="Hello world " data-parsoid='{"stx":"html","selfClose":true}'></div><p>Foo</p>
25244 !! end
25245
25246 !! test
25247 Table with broken attribute value quoting
25248 !! options
25249 parsoid=wt2html,html2html
25250 !! wikitext
25251 {|
25252 | title="Hello world|Foo
25253 |}
25254 !! html/php
25255 <table>
25256 <tr>
25257 <td title="Hello world">Foo
25258 </td></tr></table>
25259
25260 !! html/parsoid
25261 <table>
25262 <tr>
25263 <td title="Hello world">Foo
25264 </td></tr></table>
25265
25266 !! end
25267
25268 !! test
25269 Table with broken attribute value quoting on consecutive lines
25270 !! options
25271 parsoid=wt2html,html2html
25272 !! wikitext
25273 {|
25274 | title="Hello world|Foo
25275 | style="color:red|Bar
25276 |}
25277 !! html/php
25278 <table>
25279 <tr>
25280 <td title="Hello world">Foo
25281 </td>
25282 <td style="color:red">Bar
25283 </td></tr></table>
25284
25285 !! html/parsoid
25286 <table><tbody>
25287 <tr>
25288 <td title="Hello world">Foo
25289 </td><td style="color: red">Bar
25290 </td></tr></tbody></table>
25291
25292 !! end
25293
25294 !!test
25295 Accept empty td cell attribute
25296 !! wikitext
25297 {|
25298 | align="center" | foo || |
25299 |}
25300 !! html
25301 <table>
25302 <tr>
25303 <td align="center"> foo </td>
25304 <td>
25305 </td></tr></table>
25306
25307 !!end
25308
25309 !!test
25310 Non-empty attributes in th-cells
25311 !! wikitext
25312 {|
25313 ! Foo !! style="color: red" | Bar
25314 |}
25315 !! html
25316 <table>
25317 <tr>
25318 <th> Foo </th>
25319 <th style="color: red"> Bar
25320 </th></tr></table>
25321
25322 !!end
25323
25324 !!test
25325 Accept empty attributes in th-cells
25326 !! wikitext
25327 {|
25328 !| foo !!| bar
25329 |}
25330 !! html
25331 <table>
25332 <tr>
25333 <th> foo </th>
25334 <th> bar
25335 </th></tr></table>
25336
25337 !!end
25338
25339 !!test
25340 Empty table rows go away
25341 !! wikitext
25342 {|
25343 | Hello
25344 | there
25345 |- class="foo"
25346 |-
25347 |}
25348 !! html
25349 <table>
25350 <tr>
25351 <td> Hello
25352 </td>
25353 <td> there
25354 </td></tr>
25355
25356 </table>
25357
25358 !! end
25359
25360 ###
25361 ### Parsoid-centric tests for testing RTing of inter-element separators
25362 ### Edge cases not tested by existing parser tests and specific to
25363 ### Parsoid-specific serialization strategies.
25364 ###
25365
25366 !!test
25367 RT-ed inter-element separators should be valid separators
25368 !! wikitext
25369 {|
25370 |- [[foo]]
25371 |}
25372 !! html/php
25373 <table>
25374
25375 </table>
25376
25377 !! html/parsoid
25378 <table>
25379 <tbody><tr data-parsoid='{"startTagSrc":"|-","a":{"[[foo]]":null},"sa":{"[[foo]]":""},"autoInsertedEnd":true}'></tr>
25380 </tbody></table>
25381 !!end
25382
25383 # Parsoid-only since PHP parser relies on Tidy for correct output
25384 !!test
25385 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
25386 !!options
25387 parsoid
25388 !! wikitext
25389 {|
25390 |<small>foo
25391 bar
25392 |}
25393
25394 {|
25395 |<small>foo<small>
25396 |}
25397 !! html
25398 <table>
25399 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'>foo
25400 <p>bar</p></small></td></tr>
25401 </tbody></table>
25402
25403 <table>
25404 <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>
25405 </tbody></table>
25406 !!end
25407
25408 # Note that the "style" attribute is really a template parameter here.
25409 # The = would have to be {{=}} if you wanted the literal.
25410 !!test
25411 Empty TD followed by TD with tpl-generated attribute
25412 !! wikitext
25413 {|
25414 |-
25415 |
25416 |{{echo|style='color:red'}}|foo
25417 |}
25418 !! html
25419 <table>
25420
25421 <tr>
25422 <td>
25423 </td>
25424 <td>foo
25425 </td></tr></table>
25426
25427 !!end
25428
25429 !!test
25430 Indented table with an empty td
25431 !! wikitext
25432 {|
25433 |-
25434 |
25435 |foo
25436 |}
25437 !! html
25438 <table>
25439
25440 <tr>
25441 <td>
25442 </td>
25443 <td>foo
25444 </td></tr></table>
25445
25446 !!end
25447
25448 ## We have some newline diffs RT-ing this edge case
25449 ## and it is not important enough -- we seem to be emitting
25450 ## at most 2 newlines after a </tr> and this is unrelated to
25451 ## the issue from T85627 that this is testing.
25452 !!test
25453 Indented table with blank lines in between (T85627)
25454 !! options
25455 parsoid=wt2html
25456 !! wikitext
25457 {|
25458 |foo
25459
25460
25461 |}
25462 !! html
25463 <table>
25464
25465 <tr>
25466 <td>foo
25467 </td></tr></table>
25468
25469 !!end
25470
25471 !!test
25472 Indented block & table
25473 !! wikitext
25474 <div>foo</div>
25475 {|
25476 |foo
25477 |}
25478 !! html/php
25479 <div>foo</div>
25480 <table>
25481 <tr>
25482 <td>foo
25483 </td></tr></table>
25484
25485 !! html/parsoid
25486 <div data-parsoid='{"stx":"html"}'>foo</div>
25487 <table><tbody>
25488 <tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>foo</td></tr>
25489 </tbody></table>
25490 !!end
25491
25492 !! test
25493 Indent and comment before table row
25494 !! wikitext
25495 {|
25496 <!--hi-->|-
25497 | there
25498 |}
25499 !! html/php
25500 <table>
25501
25502 <tr>
25503 <td> there
25504 </td></tr></table>
25505
25506 !! html/parsoid
25507 <table>
25508 <!--hi--><tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
25509 <td data-parsoid='{"autoInsertedEnd":true}'> there</td></tr>
25510 </tbody></table>
25511 !! end
25512
25513 # Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext
25514 !!test
25515 Empty TR followed by a template-generated TR
25516 !!options
25517 parsoid
25518 !! wikitext
25519 {|
25520 |-
25521 {{echo|<tr><td>foo</td></tr>}}
25522 |}
25523 !! html
25524 <table>
25525 <tbody>
25526 <tr></tr>
25527 <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}}]}'>
25528 <td>foo</td></tr>
25529 </tbody></table>
25530 !!end
25531
25532 ## PHP and parsoid output differ for this, and since this is primarily
25533 ## for testing Parsoid's serializer, marking this Parsoid only
25534 !!test
25535 Empty TR followed by mixed-ws-comment line should RT correctly
25536 !!options
25537 parsoid
25538 !! wikitext
25539 {|
25540 |-
25541 <!--c-->
25542 |-
25543 <!--c--> <!--d-->
25544 |}
25545 !! html
25546 <table>
25547 <tbody>
25548 <tr></tr>
25549 <!--c-->
25550 <tr>
25551 <!--c--> </tr><!--d-->
25552 </tbody></table>
25553
25554 !!end
25555
25556 !!test
25557 Multi-line image caption generated by templates with/without trailing newlines
25558 !! wikitext
25559 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
25560 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
25561 !! html/parsoid
25562 <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>
25563 <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>
25564 !!end
25565
25566 !! test
25567 New element inserted (without intervening newlines) after an old sol-transparent node should serialize correctly
25568 !! options
25569 parsoid=html2wt
25570 !! html/parsoid
25571 <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>
25572
25573 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{}'/><h1>new heading</h1>
25574 !! wikitext
25575 <includeonly>foo</includeonly>
25576 new para
25577
25578 [[Category:Foo]]
25579
25580 = new heading =
25581 !! end
25582
25583 ## PHP emits broken html for this, and since this is primarily
25584 ## a Parsoid serializer test, marking this Parsoid only
25585 !!test
25586 Improperly nested inline or quotes tags with whitespace in between
25587 !! wikitext
25588 <span> <s>x</span> </s>
25589 ''' ''x''' ''
25590 !! html/parsoid
25591 <p><span> <s>x</s></span><s> </s>
25592 <b> <i>x</i></b><i> </i>
25593 </p>
25594 !!end
25595
25596 !!test
25597 Encapsulate protected attributes from wt
25598 !! wikitext
25599 <div typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
25600
25601 {| typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true"
25602 | ok
25603 |}
25604 !! html/parsoid
25605 <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>
25606
25607 <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">
25608 <tbody><tr><td data-parsoid='{"autoInsertedEnd":true}'> ok</td></tr>
25609 </tbody></table>
25610 !!end
25611
25612 ## Currently the p-wrapper is fragile in how it adds / removes transformations.
25613 ## Having nested or stray pre tags results in the attempt to add duplicates,
25614 ## causing an assertion fail. This test tries to prevent that situation.
25615 !!test
25616 Ensure ParagraphWrapper can deal with stray closing pre tags
25617 !!options
25618 parsoid=wt2html
25619 !! wikitext
25620 plain text</pre>
25621 !! html/parsoid
25622 plain text
25623 !!end
25624
25625 !!test
25626 1. Ensure fostered text content is wrapped in element nodes
25627 !!options
25628 parsoid=wt2html
25629 !! wikitext
25630 <table>hi</table><table>ho</table>
25631 !! html/parsoid
25632 <p>hi</p>
25633 <table></table>
25634 <p>ho</p>
25635 <table></table>
25636 !!end
25637
25638 !!test
25639 2. Ensure fostered text content is wrapped in element nodes (traps regressions around fostered marker on the element getting lost)
25640 !!options
25641 parsoid=wt2html,wt2wt
25642 !! wikitext
25643 <table>
25644 <tr> || ||
25645 <td> a
25646 </table>
25647 !! html/parsoid
25648 <p> || ||
25649 </p><table>
25650 <tbody><tr><td> a</td></tr>
25651 </tbody></table>
25652 !!end
25653
25654 !!test
25655 Encapsulation properly handles null DSR information from foster box
25656 !!options
25657 parsoid=wt2html,wt2wt
25658 !! wikitext
25659 {{echo|<table>foo<tr><td>bar</td></tr></table>}}
25660 !! html/parsoid
25661 <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>
25662 !!end
25663
25664 !!test
25665 1. Encapsulate foster-parented transclusion content
25666 !!options
25667 parsoid=wt2wt,wt2html
25668 !! wikitext
25669 <table>{{echo|foo<tr><td>bar</td></tr>}}</table>
25670 !! html/parsoid
25671 <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>
25672 <tbody>
25673 <tr>
25674 <td>bar</td>
25675 </tr>
25676 </tbody>
25677 </table>
25678 !!end
25679
25680 !!test
25681 2. Encapsulate foster-parented transclusion content
25682 !!options
25683 parsoid=wt2wt,wt2html
25684 !! wikitext
25685 <table><div>{{echo|foo}}</div><tr><td>bar</td></tr></table>
25686 !! html/parsoid
25687 <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>
25688 <table>
25689 <tbody>
25690 <tr>
25691 <td>bar</td>
25692 </tr>
25693 </tbody>
25694 </table>
25695 !!end
25696
25697 !!test
25698 3. Encapsulate foster-parented transclusion content
25699 !!options
25700 parsoid=wt2wt,wt2html
25701 !! wikitext
25702 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
25703 !! html/parsoid
25704 <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;]}">
25705 <p>foo</p>
25706 </div>
25707 <table>
25708 <tbody>
25709 <tr>
25710 <td>bar</td>
25711 </tr>
25712 </tbody>
25713 </table>
25714 !!end
25715
25716 !!test
25717 4. Encapsulate foster-parented transclusion content
25718 !!options
25719 parsoid=wt2wt,wt2html
25720 !! wikitext
25721 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
25722 !! html/parsoid
25723 <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;]}">
25724 <p>foo</p>
25725 </div>
25726 <table>
25727 <tbody>
25728 <tr>
25729 <td>bar</td>
25730 </tr>
25731 </tbody>
25732 </table>
25733 !!end
25734
25735 !!test
25736 5. Encapsulate foster-parented transclusion content
25737 !!options
25738 parsoid=wt2wt,wt2html
25739 !! wikitext
25740 <table><tr><td><div><p>{{echo|foo</p></div></td>foo}}</tr></table>
25741 !! html/parsoid
25742 <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>
25743 <table>
25744 <tbody>
25745 <tr>
25746 <td>
25747 <div>
25748 <p>foo</p>
25749 </div>
25750 </td>
25751 </tr>
25752 </tbody>
25753 </table>
25754 !!end
25755
25756 !!test
25757 6. Encapsulate foster-parented transclusion content
25758 !!options
25759 parsoid=wt2wt,wt2html
25760 !! wikitext
25761 <table><tr><td><div><p>{{echo|foo</p></div></td>foo</tr></table>}}<p>ok</p>
25762 !! html/parsoid
25763 <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>
25764 <table>
25765 <tbody>
25766 <tr>
25767 <td>
25768 <div>
25769 <p>foo</p>
25770 </div>
25771 </td>
25772 </tr>
25773 </tbody>
25774 </table>
25775 <p>ok</p>
25776 !!end
25777
25778 !!test
25779 7. Encapsulate foster-parented transclusion content
25780 !!options
25781 parsoid=wt2wt,wt2html
25782 !! wikitext
25783 <table>{{echo|<p>foo</p>}}<td>bar</td></table>
25784 !! html/parsoid
25785 <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>
25786 <table>
25787 <tbody>
25788 <tr>
25789 <td>bar</td>
25790 </tr>
25791 </tbody>
25792 </table>
25793 !!end
25794
25795 # Note that the wt is broken on purpose: the = should be {{=}} if you
25796 # don't want it to be a template parameter key.
25797 !!test
25798 8. Encapsulate foster-parented transclusion content
25799 !!options
25800 parsoid=wt2wt,wt2html
25801 !! wikitext
25802 {{echo|a
25803 }}{|{{echo|style='color:red'}}
25804 |-
25805 |b
25806 |}
25807 !! html/parsoid
25808 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\n"}},"i":0}}]}'>a</p>
25809 <span> </span>
25810 <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>
25811 <table>
25812 <tbody>
25813 <tr>
25814 <td>b</td>
25815 </tr>
25816 </tbody>
25817 </table>
25818 !!end
25819
25820 !!test
25821 9. Encapsulate foster-parented transclusion content
25822 !!options
25823 parsoid=wt2wt,wt2html
25824 !! wikitext
25825 <table>{{echo|hi</table>hello}}
25826 !! html/parsoid
25827 <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>
25828 !!end
25829
25830 !!test
25831 Table in fosterable position
25832 !!options
25833 parsoid=wt2html
25834 !! wikitext
25835 {{OpenTable}}
25836 <div>
25837 {|
25838 |}
25839 </div>
25840 |}
25841 !! html/parsoid
25842 <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">
25843 </span>
25844 <table about="#mwt1" data-parsoid='{"autoInsertedEnd":true}'></table>
25845
25846 <table>
25847 </table>
25848 !!end
25849
25850 # Parsoid only for T66747
25851 !! test
25852 Properly encapsulate empty-content transclusions in fosterable positions
25853 !! wikitext
25854 <table>
25855 {{#if:|
25856 <td>foo</td>
25857 }}
25858 </table>
25859 !! html/parsoid
25860 <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"}]]}'>
25861
25862 </table>
25863 !! end
25864
25865 !! test
25866 Always encapsulate foster box when template range is expanded to table
25867 !! options
25868 parsoid=wt2wt
25869 !! wikitext
25870 {|
25871 hello
25872 {{OpenTable}}
25873 |}
25874 !! html/parsoid
25875
25876 !! end
25877
25878 !! test
25879 T115289: Unclosed table
25880 !! wikitext
25881 {{echo|<table>}}<!--c-->[[Category:Two]]
25882 !! html/parsoid
25883 <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>
25884 !! end
25885
25886 !! test
25887 T115289: Don't migrate newlines out of tables with fostered content
25888 !! wikitext
25889 <table><td></td>{{echo|<tr>[[Category:One]]}}<!--c-->[[Category:Two]]
25890 !! html/parsoid
25891 <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>
25892 !! end
25893
25894 !! test
25895 T73074: More fostering fun
25896 !! wikitext
25897 <table><td></td>{{echo|<tr>}}<!--c-->[[Category:Two]]
25898 !! html/parsoid
25899 <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>
25900 !! end
25901
25902 !!test
25903 Support <object> element with .data attribute
25904 !!options
25905 parsoid=html2wt
25906 !! html/parsoid
25907 <object data="test.swf"></object>
25908 !! wikitext
25909 <object data="test.swf"></object>
25910 !!end
25911
25912 !! test
25913 Don't block XML namespace declaration
25914 !! wikitext
25915 <span xmlns:dct="http://purl.org/dc/terms/" property="dct:title">MediaWiki</span>
25916 !! html/php
25917 <p><span xmlns:dct="http&#58;//purl.org/dc/terms/" property="dct:title">MediaWiki</span>
25918 </p>
25919 !! html/parsoid
25920 <p><span xmlns:dct="http://purl.org/dc/terms/" data-x-property="dct:title" data-parsoid='{"stx":"html"}'>MediaWiki</span></p>
25921 !! end
25922
25923 # -----------------------------------------------------------------
25924 # The following section of tests are primarily to spec requirements
25925 # around Parsoid's serialization (old, new, edited content)
25926 #
25927 # All these tests are marked Parsoid html2wt and html2html only
25928 # ----------------------------------------------------------------
25929
25930 !! test
25931 Ignore rel attribute in a-tags during serialization to url-links
25932 !! options
25933 parsoid=html2wt
25934 !! html/parsoid
25935 <a href='http://en.wikipedia.org/wiki/Foobar'>http://en.wikipedia.org/wiki/Foobar</a>
25936 <a href='http://en.wikipedia.org/wiki/Foobar' rel='mw:ExtLink'>http://en.wikipedia.org/wiki/Foobar</a>
25937 <a href='http://en.wikipedia.org/wiki/Foobar' rel='mw:WikiLink'>http://en.wikipedia.org/wiki/Foobar</a>
25938 !! wikitext
25939 http://en.wikipedia.org/wiki/Foobar
25940 http://en.wikipedia.org/wiki/Foobar
25941 http://en.wikipedia.org/wiki/Foobar
25942 !! end
25943
25944 # 'mi' is a localinterwiki prefix as well as a language
25945 !! test
25946 Serialize interwiki links pointing to the current wiki as plain wiki links (T67869)
25947 !! options
25948 parsoid=html2wt
25949 !! html/parsoid
25950 <p><a rel="mw:ExtLink" href="http://mi.wikipedia.org/wiki/Foo">Foo</a></p>
25951 !! wikitext
25952 [[Foo]]
25953 !! end
25954
25955 !! test
25956 Parsoid should accept interwiki shortcuts
25957 !! options
25958 parsoid=html2wt
25959 !! html/parsoid
25960 <p><a rel='mw:WikiLink' href='./fr:Foo'>Foo</a>
25961 <a rel='mw:ExtLink' href='./fr:Foo'>Foo</a>
25962 <a href='./fr:Foo'>Foo</a></p>
25963 <p><a rel='mw:WikiLink' href='fr%3AFoo'>Foo</a>
25964 <a rel='mw:ExtLink' href='fr%3AFoo'>Foo</a>
25965 <a href='fr%3AFoo'>Foo</a></p>
25966 !! wikitext
25967 [[:fr:Foo|Foo]]
25968 [[:fr:Foo|Foo]]
25969 [[:fr:Foo|Foo]]
25970
25971 [[:fr:Foo|Foo]]
25972 [[:fr:Foo|Foo]]
25973 [[:fr:Foo|Foo]]
25974 !! end
25975
25976 !! test
25977 Parsoid should not accept invalid interwiki shortcuts
25978 !! options
25979 parsoid=html2wt
25980 !! html/parsoid
25981 <p><a rel='mw:WikiLink' href='news:Foo'>Foo</a>
25982 <a rel='mw:ExtLink' href='news:Foo'>Foo</a>
25983 <a href='news:Foo'>Foo</a></p>
25984 !! wikitext
25985 [news:Foo Foo]
25986 [news:Foo Foo]
25987 [news:Foo Foo]
25988 !! end
25989
25990 # See T93839
25991 !! test
25992 New wikilinks should be serialized properly
25993 !! options
25994 parsoid=html2wt
25995 !! html/parsoid
25996 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{}'>Foo</a>
25997 <a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>
25998 <a href="//en.wikipedia.org/wiki/Foo">//en.wikipedia.org/wiki/Foo</a>
25999 <a href="http://en.wikipedia.org/wiki/Foo">http://en.wikipedia.org/wiki/Foo</a>
26000 <a href="//en.wikipedia.org/wiki/Foo_bar">//en.wikipedia.org/wiki/Foo bar</a>
26001 !! wikitext
26002 [[Foo]]
26003 [[Foo]]
26004 [[:en:Foo|//en.wikipedia.org/wiki/Foo]]
26005 http://en.wikipedia.org/wiki/Foo
26006 [[:en:Foo_bar|//en.wikipedia.org/wiki/Foo bar]]
26007 !! end
26008
26009 !! test
26010 New wiki links (href variations)
26011 !! options
26012 parsoid=html2wt
26013 !! html/parsoid
26014 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
26015 <a rel="mw:WikiLink" href="Foo_bar">Foo_bar</a>
26016 <a rel="mw:WikiLink" href="Foo bar">Foo_bar</a>
26017 <a rel="mw:WikiLink" href="./Toxine_bact%C3%A9rienne">Toxine bactérienne</a>
26018 !! wikitext
26019 [[Foo_bar]]
26020 [[Foo_bar]]
26021 [[Foo_bar]]
26022 [[Toxine bactérienne]]
26023 !! end
26024
26025 !! test
26026 New wiki links (content string variations)
26027 !! options
26028 parsoid=html2wt
26029 !! html/parsoid
26030 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
26031 <a rel="mw:WikiLink" href="./Foo_bar">Foo bar</a>
26032 <a rel="mw:WikiLink" href="./Foo_bar">./Foo_bar</a>
26033 !! wikitext
26034 [[Foo_bar]]
26035 [[Foo bar]]
26036 [[Foo_bar|./Foo_bar]]
26037 !! end
26038
26039 !! test
26040 New category links (href variations)
26041 !! options
26042 parsoid=html2wt
26043 !! html/parsoid
26044 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne" />
26045 <link rel="mw:PageProp/Category" href="./Category:Toxine_bact%C3%A9rienne" />
26046 <link rel="mw:PageProp/Category" href="Category:Toxine_bact%C3%A9rienne" />
26047 !! wikitext
26048 [[Category:Toxine bactérienne]]
26049 [[Category:Toxine bactérienne]]
26050 [[Category:Toxine bactérienne]]
26051 !! end
26052
26053 !! test
26054 New sol transparent links don't need indent-pre nowiki protection
26055 !! options
26056 parsoid=html2wt
26057 language=de
26058 !! html/parsoid
26059 <link rel="mw:PageProp/redirect" href="./Main_Page">
26060 <!-- this is good --> <link rel="mw:PageProp/Category" href="./Category:Good" />
26061 <!-- this is great --> <link rel="mw:PageProp/Category" href="./Kategorie:Great" />
26062 !! wikitext
26063 #WEITERLEITUNG [[Main Page]]
26064 <!-- this is good --> [[Category:Good]]
26065 <!-- this is great --> [[Kategorie:Great]]
26066 !! end
26067
26068 !! test
26069 New interlanguage links (href variations)
26070 !! options
26071 parsoid=html2wt
26072 !! html/parsoid
26073 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine bactérienne" />
26074 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bactérienne" />
26075 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bact%C3%A9rienne" />
26076 !! wikitext
26077 [[es:Toxine bactérienne]]
26078 [[es:Toxine_bactérienne]]
26079 [[es:Toxine_bactérienne]]
26080 !! end
26081
26082 !! test
26083 Image: Modifying size of an image (1)
26084 !! options
26085 parsoid={
26086 "modes": ["wt2wt"],
26087 "changes": [
26088 ["img[height]", "attr", "height", "22"],
26089 ["img[width]", "attr", "width", "200"]
26090 ]
26091 }
26092 !! wikitext
26093 [[Image:Foobar.jpg|230x230px]]
26094 !! wikitext/edited
26095 [[Image:Foobar.jpg|200x200px]]
26096 !!end
26097
26098 !! test
26099 Image: Modifying size of an image (2)
26100 !! options
26101 parsoid={
26102 "modes": ["wt2wt"],
26103 "changes": [
26104 ["img[height]", "attr", "height", "100"],
26105 ["img[width]", "attr", "width", "500"]
26106 ]
26107 }
26108 !! wikitext
26109 [[Image:Foobar.jpg|230x230px]]
26110 !! wikitext/edited
26111 [[Image:Foobar.jpg|500x500px]]
26112 !!end
26113
26114 # Change in size is ignored so long as class='mw-default-size'
26115 !! test
26116 Image: Modifying size of an image (3)
26117 !! options
26118 parsoid={
26119 "modes": ["wt2wt"],
26120 "changes": [
26121 ["figure[class]", "removeClass", "mw-default-size"],
26122 ["figure img", "attr", "height", "19"],
26123 ["figure img", "attr", "width", "170"]
26124 ]
26125 }
26126 !! wikitext
26127 [[Image:Foobar.jpg|thumb]]
26128 !! wikitext/edited
26129 [[Image:Foobar.jpg|thumb|170x170px]]
26130 !!end
26131
26132 !! test
26133 Image: Modifying alignment of an image (T50665)
26134 !! options
26135 parsoid={
26136 "modes": ["wt2wt"],
26137 "changes": [
26138 ["figure[class]", "removeClass", "mw-halign-right"],
26139 ["figure[class]", "addClass", "mw-halign-left"]
26140 ]
26141 }
26142 !! wikitext
26143 [[Image:Foobar.jpg|thumb|caption|right]]
26144 !! wikitext/edited
26145 [[Image:Foobar.jpg|thumb|caption|left]]
26146 !! end
26147
26148 !! test
26149 Image: Modifying mw-default-size of an frameless image (T64805)
26150 !! options
26151 parsoid={
26152 "modes": ["wt2wt"],
26153 "changes": [
26154 ["figure.mw-default-size", "removeClass", "mw-default-size"]
26155 ]
26156 }
26157 !! wikitext
26158 [[Image:Foobar.jpg|frameless|right]]
26159 !! wikitext/edited
26160 [[Image:Foobar.jpg|frameless|right|220x220px]]
26161 !! end
26162
26163 !! test
26164 Image: Modifying valign of an image (T51221)
26165 !! options
26166 parsoid={
26167 "modes": ["wt2wt"],
26168 "changes": [
26169 ["*[typeof=\"mw:Image\"]", "removeClass", "mw-valign-middle"],
26170 ["*[typeof=\"mw:Image\"]", "addClass", "mw-valign-text-top"]
26171 ]
26172 }
26173 !! wikitext
26174 [[File:Foobar.jpg|20px|middle]]
26175 !! wikitext/edited
26176 [[File:Foobar.jpg|20px|text-top]]
26177 !! end
26178
26179 !! test
26180 Image: Modifying alt attribute of an image (T58400)
26181 !! options
26182 parsoid={
26183 "modes": ["wt2wt"],
26184 "changes": [
26185 ["img[alt]", "attr", "alt", "some alternate edited text"]
26186 ]
26187 }
26188 !! wikitext
26189 [[File:Foobar.jpg|thumb|some caption|alt=some alternate text]]
26190 !! wikitext/edited
26191 [[File:Foobar.jpg|thumb|some caption|alt=some alternate edited text]]
26192 !!end
26193
26194 !! test
26195 Image: Modifying caption of an image
26196 !! options
26197 parsoid={
26198 "modes": ["wt2wt"],
26199 "changes": [
26200 ["figcaption", "text", "new caption"]
26201 ]
26202 }
26203 !! wikitext
26204 [[Image:Foobar.jpg|thumb|original caption]]
26205 !! wikitext/edited
26206 [[Image:Foobar.jpg|thumb|new caption]]
26207 !!end
26208
26209 !! test
26210 Image: empty alt attribute (T50924)
26211 !! options
26212 parsoid
26213 !! wikitext
26214 [[File:Foobar.jpg|thumb|alt=|bar]]
26215 !! html
26216 <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>
26217 !! end
26218
26219 !! test
26220 Image: new attributes should be serialized in wiki's language for RTL languages (T53852)
26221 !! options
26222 parsoid=html2wt
26223 language=ar
26224 disabled
26225 !! html/parsoid
26226 <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>
26227 !! wikitext
26228 [[Imagen:Foobar.jpg|derecha|miniaturadeimagen]]
26229 !! end
26230
26231 !! test
26232 Image: Block level image should have \n before and after
26233 !! wikitext
26234 123
26235 [[File:Foobar.jpg|right|thumb|150x150px]]
26236 456
26237 !! html/parsoid
26238 <p>123</p>
26239 <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>
26240 <p>456</p>
26241 !!end
26242
26243 !! test
26244 Image: New block level image should have \n before and after (existing content)
26245 !! wikitext
26246 123
26247 [[File:Foobar.jpg|right|thumb|150x150px]]
26248 456
26249 !! html/parsoid
26250 <p>123</p>
26251 <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>
26252 <p>456</p>
26253 !!end
26254
26255 !! test
26256 Image: upright option (parsoid)
26257 !! wikitext
26258 [[File:Foobar.jpg|thumb|upright|caption]]
26259 [[File:Foobar.jpg|thumb|upright=0.5|caption]]
26260 [[File:Foobar.jpg|thumb|500x500px|upright=0.5|caption]]
26261 !! html/parsoid
26262 <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>
26263 <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>
26264 <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>
26265 !!end
26266
26267 !! test
26268 Image: upright option is ignored on inline and frame images (parsoid)
26269 !! wikitext
26270 [[File:Foobar.jpg|500x500px|upright=0.5|caption]]
26271 !! html/parsoid
26272 <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>
26273 !!end
26274
26275 !! test
26276 Image: from basic HTML (1)
26277 !! options
26278 parsoid=html2wt
26279 !! html/parsoid
26280 <span typeof="mw:Image">
26281 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
26282 </span>
26283 !! wikitext
26284 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
26285 !! end
26286
26287 !! test
26288 Image: from basic HTML (2)
26289 !! options
26290 parsoid=html2wt
26291 !! html/parsoid
26292 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
26293 !! wikitext
26294 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
26295 !! end
26296
26297 !! test
26298 Image: from basic HTML (3)
26299 !! options
26300 parsoid=html2wt
26301 !! html/parsoid
26302 <a href="Main"><img src="./File:Foobar.jpg" width=100 height=100 alt="Alt"></a>
26303 !! wikitext
26304 [[File:Foobar.jpg|link=Main|alt=Alt|100x100px]]
26305 !! end
26306
26307 !! test
26308 Image: from basic HTML (4)
26309 !! options
26310 parsoid=html2wt
26311 !! html/parsoid
26312 <img src="./File:Foobar.jpg">
26313 !! wikitext
26314 [[File:Foobar.jpg|link=]]
26315 !! end
26316
26317 !! test
26318 Image: Invalid title as link
26319 !! wikitext
26320 [[File:Foobar.jpg|link=<]]
26321 !! html/php
26322 <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>
26323 </p>
26324 !! html/parsoid
26325 <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>
26326 !! end
26327
26328 !! test
26329 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
26330 !! options
26331 parsoid=html2wt
26332 !! html/parsoid
26333 <ul>
26334 <li><p>foo</p></li>
26335 </ul>
26336 !! wikitext
26337 * foo
26338 !! end
26339
26340 !! test
26341 Lists: Serialize correctly even when list tags has unneeded whitespace between tags
26342 !! options
26343 parsoid=html2wt
26344 !! html/parsoid
26345 <ul> <li>foo</li></ul>
26346 !! wikitext
26347 * foo
26348 !! end
26349
26350 !! test
26351 Don't strip leading whitespace when handling indent-pre suppressing tags
26352 !! options
26353 parsoid=html2wt
26354 !! html/parsoid
26355 <table>
26356 <tr><td> indented row</td></tr>
26357 </table>
26358 <blockquote><p>
26359 <b>This is very bold of you!</b>
26360 </p>
26361 <table><tr><td>
26362 indented cell (no pre-wrapping!)
26363 </td></tr></table>
26364 </blockquote>
26365 <p>foo</p>
26366 <div>bar</div>
26367 !! wikitext
26368 {|
26369 | indented row
26370 |}
26371 <blockquote>
26372 '''This is very bold of you!'''
26373
26374 {|
26375 |
26376 indented cell (no pre-wrapping!)
26377 |}
26378 </blockquote>
26379 foo
26380 <div>bar</div>
26381 !! end
26382
26383 !! test
26384 Nowiki-wrap leading whitespace when handling indent-pre inducing tags
26385 !! options
26386 parsoid=html2wt
26387 !! html/parsoid
26388 <p>foo</p>
26389 <span>bar</span>
26390
26391 <span>foo2
26392 </span>bar2
26393
26394 <div>foo</div>
26395 <span>bar</span>
26396
26397 <div>
26398 <span>foo</span>
26399 </div>
26400 !! wikitext
26401 foo
26402
26403 <span>bar</span>
26404
26405 <span>foo2
26406 <nowiki> </nowiki></span>bar2
26407
26408 <div>foo</div>
26409 <nowiki> </nowiki><span>bar</span>
26410
26411 <div>
26412 <nowiki> </nowiki><span>foo</span>
26413 </div>
26414 !! end
26415
26416 !! test
26417 Lists: Dont insert newlines in a serialized list item.
26418 !! options
26419 parsoid=html2wt
26420 !! html/parsoid
26421 <ul><li>a<br>b</li><li>c</li></ul>
26422 !! wikitext
26423 * a<br>b
26424 * c
26425 !! end
26426
26427 !! test
26428 1. Headings: Force sol-transparent links and behavior switches to serialize before/after
26429 !! options
26430 parsoid={
26431 "modes": ["html2wt"],
26432 "scrubWikitext": false
26433 }
26434 !! html/parsoid
26435 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
26436 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
26437
26438 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
26439 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
26440
26441 <h2 data-parsoid='{}'>howdy<link href="./Category:A5" rel="mw:PageProp/Category" /></h2>
26442
26443 <h2><meta property="mw:PageProp/toc" /> ok</h2>
26444 !! wikitext
26445 == hello there [[Category:A1]] ==
26446
26447 == [[Category:A2]] hi pal ==
26448
26449 == <!--foo--> [[Category:A3]] how goes it ==
26450
26451 == it goes well [[Category:A4]] <!--bar--> ==
26452
26453 ==howdy [[Category:A5]]==
26454
26455 == __TOC__ ok ==
26456 !! end
26457
26458 !! test
26459 2. Headings: Force sol-transparent links and behavior switches to serialize before/after
26460 !! options
26461 parsoid={
26462 "modes": ["html2wt"],
26463 "scrubWikitext": true
26464 }
26465 !! html/parsoid
26466 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
26467 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
26468
26469 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
26470 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
26471
26472 <h2><meta property="mw:PageProp/toc" /> ok</h2>
26473 !! wikitext
26474 == hello there ==
26475 [[Category:A1]]
26476 [[Category:A2]]
26477
26478 == hi pal ==
26479
26480 <!--foo--> [[Category:A3]]
26481
26482 == how goes it ==
26483
26484 == it goes well ==
26485 [[Category:A4]] <!--bar-->
26486
26487 __TOC__
26488
26489 == ok ==
26490 !! end
26491
26492 !! test
26493 Headings: Don't hoist metas that come from templates
26494 !! options
26495 parsoid={
26496 "modes": ["html2wt"],
26497 "scrubWikitext": true
26498 }
26499 !! html/parsoid
26500 <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>
26501 !! wikitext
26502 == {{echo|foo [[Category:Foo]]}} ==
26503 !! end
26504
26505 !! test
26506 Headings: Category in ref isn't hoisted
26507 !! options
26508 parsoid={
26509 "modes": ["html2wt"],
26510 "scrubWikitext": true
26511 }
26512 !! html/parsoid
26513 <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>
26514
26515 <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>
26516 !! wikitext
26517 == foo <ref>bar
26518 [[Category:Baz]] </ref> ==
26519
26520 <references />
26521 !! end
26522
26523 !! test
26524 Parsoid: Serialize positional parameters with = in them as named parameter
26525 !! options
26526 parsoid=html2wt
26527 !! html/parsoid
26528 <p about="#mwt1" typeof="mw:Transclusion"
26529 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
26530
26531 <p about="#mwt1" typeof="mw:Transclusion"
26532 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}, "2":{"wt":"bar"}},"i":0}}]}'>foo</p>
26533
26534 <!--Orig params with data-parsoid has heuristics for handling = chars-->
26535 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
26536 <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>
26537 !! wikitext
26538 {{echo|1=f=oo}}
26539
26540 {{echo|1=f=oo|2=bar}}
26541
26542 <!--Orig params with data-parsoid has heuristics for handling = chars-->
26543 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
26544 {{echo|<nowiki>f=oo</nowiki>|bar}}
26545 !! end
26546
26547 !! test
26548 Parsoid: Serialize positional parameters with = in extlink as named parameter
26549 !! options
26550 parsoid=html2wt
26551 !! html/parsoid
26552 <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>
26553 !! wikitext
26554 {{echo|1=http://stuff?is=ok}}
26555 !! end
26556
26557 !! test
26558 Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
26559 !! options
26560 parsoid=html2wt
26561 !! html/parsoid
26562 <div>a<p>b</p></div>
26563 <div>a
26564 <p>b</p></div>
26565 <div>
26566 a
26567 <p>b</p></div>
26568 !! wikitext
26569 <div>a
26570 b
26571 </div>
26572 <div>a
26573 b
26574 </div>
26575 <div>
26576 a
26577
26578 b
26579 </div>
26580 !! end
26581
26582 !! test
26583 Substrings resembling wikitext in hrefs should not get nowiki escapes
26584 !! options
26585 parsoid=html2wt
26586 !! html/parsoid
26587 <a rel="mw:WikiLink" href="./Foo''bar''baz">Foo''bar''baz</a>
26588 !! wikitext
26589 [[Foo''bar''baz]]
26590 !! end
26591
26592 !! test
26593 Enforce single-line context in the serializer
26594 !! options
26595 parsoid=html2wt
26596 !! html/parsoid
26597 <h2>testing
26598 123</h2>
26599
26600 <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">
26601 </span><span about="#mwt1">you</span> </h2>
26602
26603 <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>
26604
26605 <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
26606 there</span></li></ol>
26607
26608 <ul><li>asd
26609 sdf</li></ul>
26610
26611 <ul><li>foo
26612 bar
26613 baz</li>
26614 <li>foo <b>bar</b>
26615 baz</li></ul>
26616
26617 <dl><dt>hi
26618 ho </dt><dd data-parsoid='{"stx":"row"}'> hi
26619 ho</dd></dl>
26620
26621 <dl><dd> <table>
26622 <tbody><tr><td> ha
26623 ha
26624 ha</td></tr>
26625 </tbody></table></dd></dl>
26626 !! wikitext
26627 == testing 123 ==
26628
26629 == hi {{bogus|there
26630 you}} ==
26631
26632 == foo <ref>hello
26633 there</ref> ==
26634
26635 <references />
26636
26637 * asd sdf
26638
26639 * foo bar baz
26640 * foo '''bar''' baz
26641
26642 ; hi ho : hi ho
26643
26644 : {|
26645 | ha
26646 ha
26647 ha
26648 |}
26649 !! end
26650
26651 !! test
26652 Serialize new placeholder space without spans
26653 !! options
26654 parsoid=html2wt
26655 !! html/parsoid
26656 <p>foo<span typeof="mw:Placeholder"> </span>: bar</p>
26657
26658 <p>foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span>: bar</p>
26659
26660 <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>
26661 !! wikitext
26662 foo : bar
26663
26664 foo : bar
26665
26666 <ref>foo : bar</ref>ok
26667 !! end
26668
26669
26670 #-----------------------
26671 # Tag minimization tests
26672 #-----------------------
26673
26674 !! test
26675 1. I/B quote minimization: wikitext-only tags should be combined
26676 !! options
26677 parsoid=html2wt
26678 !! html/parsoid
26679 <p><i>A</i><i>B</i></p>
26680 <p><b>A</b><b>B</b></p>
26681 <p><i>A</i><b><i>B</i></b></p>
26682 <p><b>A</b><i><b>B</b></i></p>
26683 <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
26684 <p><i><b>A</b></i><i><b>B</b></i></p>
26685 <p><i><b>A</b></i><b><i>B</i></b></p>
26686 <p><b><i>A</i></b><i><b>B</b></i></p>
26687 !! wikitext
26688 ''AB''
26689
26690 '''AB'''
26691
26692 ''A'''B'''''
26693
26694 '''A''B'''''
26695
26696 '''A''BC''D'''
26697
26698 '''''AB'''''
26699
26700 '''''AB'''''
26701
26702 '''''AB'''''
26703 !! end
26704
26705 !! test
26706 2. I/B quote minimization: wikitext and html tags should not be combined
26707 !! options
26708 parsoid=html2wt
26709 !! html/parsoid
26710 <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
26711 <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
26712 !! wikitext
26713 ''A''<i>B</i>
26714
26715 ''A''<nowiki/>'''<i>B</i>'''
26716 !! end
26717
26718 !! test
26719 3. I/B quote minimization: templated content stops minimization
26720 !! options
26721 parsoid=html2wt
26722 !! html/parsoid
26723 <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>
26724 <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>
26725 !! wikitext
26726 ''A''{{echo|''B''}}
26727
26728 ''A''{{echo|'''''B'''''}}
26729 !! end
26730
26731 !! test
26732 4. I/B quote minimization: new content should be mimimized with adjacent old content
26733 !! options
26734 parsoid=html2wt
26735 !! html/parsoid
26736 <p><i>A</i><i>B</i></p>
26737 <p><b>A</b><b>B</b></p>
26738 <p><i>A</i><b><i>B</i></b></p>
26739 !! wikitext
26740 ''AB''
26741
26742 '''AB'''
26743
26744 ''A'''B'''''
26745 !! end
26746
26747 !! test
26748 5a. Merge adjacent quote nodes if they've been edited
26749 !! options
26750 parsoid={
26751 "modes": ["wt2wt", "selser"],
26752 "changes": [
26753 ["p", "contents", "remove", ":contains('b')"]
26754 ]
26755 }
26756 !! wikitext
26757 ''a''b''c''
26758 !! wikitext/edited
26759 ''ac''
26760 !! end
26761
26762 !! test
26763 5b. Merge adjacent quote nodes if they've been edited
26764 !! options
26765 parsoid={
26766 "modes": ["wt2wt", "selser"],
26767 "changes": [
26768 ["#x", "remove"]
26769 ]
26770 }
26771 !! wikitext
26772 ''a''<span id="x">b</span>''c''
26773 !! wikitext/edited
26774 ''ac''
26775 !! end
26776
26777 !! test
26778 1. Merge adjacent link nodes as long as at least one element is new
26779 !! options
26780 parsoid={
26781 "modes": ["html2wt"],
26782 "scrubWikitext": true
26783 }
26784 !! html/parsoid
26785 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
26786 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
26787 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a data-parsoid="{}" rel="mw:WikiLink" href="./Football">ball</a>
26788 !! wikitext
26789 [[Football]]
26790 [[Football]]
26791 [[Football|Foot]][[Football|ball]]
26792 !! end
26793
26794 !! test
26795 2. Merge adjacent link nodes and enable additional normalizations
26796 !! options
26797 parsoid={
26798 "modes": ["html2wt"],
26799 "scrubWikitext": true
26800 }
26801 !! html/parsoid
26802 <a rel="mw:WikiLink" href="./Football"><i>Foot</i></a><a rel="mw:WikiLink" href="./Football"><i>ball</i></a>
26803 !! wikitext
26804 [[Football|''Football'']]
26805 !! end
26806
26807 !! test
26808 3. Don't merge adjacent link nodes if scrubWikitext is false
26809 !! options
26810 parsoid={
26811 "modes": ["html2wt"],
26812 "scrubWikitext": false
26813 }
26814 !! html/parsoid
26815 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
26816 !! wikitext
26817 [[Football|Foot]][[Football|ball]]
26818 !! end
26819
26820 #------------------------------
26821 # End of tag minimization tests
26822 #------------------------------
26823
26824 !!test
26825 T56262: New entities
26826 !! options
26827 parsoid=html2wt
26828 !! html/parsoid
26829 <span typeof="mw:Entity">&nbsp;</span>
26830 !! wikitext
26831 &nbsp;
26832 !! end
26833
26834 ## Note that there is no wikitext output for 'unknownproperty' ##
26835 ## Unknown magic words are silently dropped ##
26836
26837 !! test
26838 Magic words
26839 !! options
26840 parsoid=html2wt
26841 !! html/parsoid
26842 <meta property='mw:PageProp/toc' />
26843 <meta property='mw:PageProp/notoc' />
26844 <meta property='mw:PageProp/forcetoc' />
26845 <meta property='mw:PageProp/index' />
26846 <meta property='mw:PageProp/noindex' />
26847 <meta property='mw:PageProp/nogallery' />
26848 <meta property='mw:PageProp/noeditsection' />
26849 <meta property='mw:PageProp/notitleconvert' />
26850 <meta property='mw:PageProp/nocontentconvert' />
26851 <meta property='mw:PageProp/unknownproperty' />
26852 !! wikitext
26853 __TOC__
26854 __NOTOC__
26855 __FORCETOC__
26856 __INDEX__
26857 __NOINDEX__
26858 __NOGALLERY__
26859 __NOEDITSECTION__
26860 __NOTITLECONVERT__
26861 __NOCONTENTCONVERT__
26862 !! end
26863
26864 !! test
26865 Consecutive <pre>s should not get merged
26866 !! options
26867 parsoid=html2wt,html2html
26868 !! html/parsoid
26869 <pre>a</pre><pre>b</pre>
26870
26871 <pre>c
26872 </pre><pre>
26873 d</pre>
26874
26875 <pre>e
26876
26877 </pre><pre>
26878
26879 f</pre>
26880 !! wikitext
26881 a
26882
26883 b
26884
26885 c
26886
26887 d
26888
26889 e
26890
26891
26892
26893 f
26894 !! end
26895
26896 !! test
26897 Edited ISBN links not serializable as ISBN links should serialize as wikilinks
26898 !! options
26899 parsoid=html2wt
26900 !! html/parsoid
26901 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink">ISBN 1234567895</a>
26902 !! wikitext
26903 [[Special:BookSources/1234567890|ISBN 1234567895]]
26904 !! end
26905
26906 !! test
26907 Edited RFC links not serializable as RFC links should serialize as extlinks
26908 !! options
26909 parsoid=html2wt
26910 !! html/parsoid
26911 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink">New RFC</a>
26912 !! wikitext
26913 [//tools.ietf.org/html/rfc123 New RFC]
26914 !! end
26915
26916 !! test
26917 Edited PMID links not serializable as PMID links should serialize as extlinks
26918 !! options
26919 parsoid=html2wt
26920 !! html/parsoid
26921 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink">New PMID</a>
26922 !! wikitext
26923 [//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract New PMID]
26924 !! end
26925
26926 !! test
26927 WTS of autolinks with trailing/surrounding context
26928 !! options
26929 parsoid=html2wt
26930 !! html/parsoid
26931 <p><a href="http://cscott.net">http://cscott.net</a><b>foo</b></p>
26932 <p><a href="http://cscott.net">http://cscott.net</a><b data-parsoid='{"stx":"html"}'>foo</b></p>
26933 <p><b><a href="http://cscott.net">http://cscott.net</a></b></p>
26934 <p><b><a href="http://cscott.net">http://cscott.net</a> </b></p>
26935 <p><b><a href="http://cscott.net">http://cscott.net</a>x</b></p>
26936 <p><a href="http://cscott.net">http://cscott.net</a>x</p>
26937 !! wikitext
26938 http://cscott.net'''foo'''
26939
26940 http://cscott.net<b>foo</b>
26941
26942 '''http://cscott.net'''
26943
26944 '''http://cscott.net '''
26945
26946 '''http://cscott.net<nowiki/>x'''
26947
26948 http://cscott.net<nowiki/>x
26949 !! end
26950
26951 !! test
26952 WTS of autolinks with nowikis (round-trip)
26953 !! wikitext
26954 x<nowiki/>http://cscott.net<nowiki/>x
26955 !! html/parsoid
26956 <p>x<a rel="mw:ExtLink" href="http://cscott.net">http://cscott.net</a>x</p>
26957 !! end
26958
26959 # this is the "easy" test because it leaves in place all the
26960 # data-parsoid information indicating this is an autolink
26961 !! test
26962 WTS of autolinks with escapes (editing)
26963 !! options
26964 parsoid={
26965 "modes": ["wt2wt"],
26966 "changes": [
26967 [ "span", "remove" ]
26968 ]
26969 }
26970 !! wikitext
26971 x<nowiki/>http://cscott.net<nowiki/>x
26972 !! wikitext/edited
26973 x<nowiki/>http://cscott.net<nowiki/>x
26974 !! end
26975
26976 !! test
26977 WTS of edited autolink-like text (T103364)
26978 !! options
26979 parsoid={
26980 "modes": ["wt2wt"],
26981 "changes": [
26982 [ "span[typeof]", "removeAttr", "typeof" ]
26983 ]
26984 }
26985 !! wikitext
26986 Not a link: <nowiki>http://example.com</nowiki>.
26987 !! wikitext/edited
26988 Not a link: <span><nowiki>http://example.com</nowiki></span>.
26989 !! end
26990
26991 !! test
26992 WTS of newly-authored autolink-like text (T103364)
26993 !! options
26994 parsoid=html2wt
26995 !! html/parsoid
26996 <p>http://example.com is not a link.</p>
26997 !! wikitext
26998 <nowiki>http://example.com</nowiki> is not a link.
26999 !! end
27000
27001 !! test
27002 WTS of autolink-like text after an autolink (T108563)
27003 !! options
27004 parsoid=html2wt
27005 !! html/parsoid
27006 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a> http://example.com is not a link.</p>
27007 !! wikitext
27008 http://example.com <nowiki>http://example.com</nowiki> is not a link.
27009 !! end
27010
27011 !! test
27012 Magic links inside links (not autolinked)
27013 !! wikitext
27014 [[Foo|http://example.com]]
27015 [[Foo|RFC 1234]]
27016 [[Foo|PMID 1234]]
27017 [[Foo|ISBN 123456789x]]
27018
27019 [http://foo.com http://example.com]
27020 [http://foo.com RFC 1234]
27021 [http://foo.com PMID 1234]
27022 [http://foo.com ISBN 123456789x]
27023 !! html+tidy
27024 <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>
27025 <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>
27026 !! html/parsoid
27027 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">http://example.com</a>
27028 <a rel="mw:WikiLink" href="./Foo" title="Foo">RFC 1234</a>
27029 <a rel="mw:WikiLink" href="./Foo" title="Foo">PMID 1234</a>
27030 <a rel="mw:WikiLink" href="./Foo" title="Foo">ISBN 123456789x</a></p>
27031
27032 <p><a rel="mw:ExtLink" href="http://foo.com">http://example.com</a>
27033 <a rel="mw:ExtLink" href="http://foo.com">RFC 1234</a>
27034 <a rel="mw:ExtLink" href="http://foo.com">PMID 1234</a>
27035 <a rel="mw:ExtLink" href="http://foo.com">ISBN 123456789x</a></p>
27036 !! end
27037
27038 !! test
27039 Magic links inside image captions (autolinked)
27040 !! wikitext
27041 [[File:Foobar.jpg|thumb|http://example.com]]
27042 [[File:Foobar.jpg|thumb|RFC 1234]]
27043 [[File:Foobar.jpg|thumb|PMID 1234]]
27044 [[File:Foobar.jpg|thumb|ISBN 123456789x]]
27045 !! html+tidy
27046 <div class="thumb tright">
27047 <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>
27048 <div class="thumbcaption">
27049 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
27050 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></div>
27051 </div>
27052 </div>
27053 <div class="thumb tright">
27054 <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>
27055 <div class="thumbcaption">
27056 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
27057 <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a></div>
27058 </div>
27059 </div>
27060 <div class="thumb tright">
27061 <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>
27062 <div class="thumbcaption">
27063 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
27064 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a></div>
27065 </div>
27066 </div>
27067 <div class="thumb tright">
27068 <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>
27069 <div class="thumbcaption">
27070 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
27071 <a href="/wiki/Special:BookSources/123456789X" class="internal mw-magiclink-isbn">ISBN 123456789x</a></div>
27072 </div>
27073 </div>
27074 !! html/parsoid
27075 <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>
27076 <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>
27077 <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>
27078 <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>
27079 !! end
27080
27081 !! test
27082 WTS of magic word text (T109371)
27083 !! options
27084 parsoid=html2wt
27085 !! html/parsoid
27086 <p>RFC 1234</p>
27087 <p><a href="http://foo.com" rel="mw:ExtLink">RFC 1234</a></p>
27088 <p><a href="./Foo" rel="mw:WikiLink">RFC 1234</a></p>
27089 !! wikitext
27090 <nowiki>RFC 1234</nowiki>
27091
27092 [http://foo.com RFC 1234]
27093
27094 [[Foo|RFC 1234]]
27095 !! end
27096
27097 !! test
27098 Edited Redirect link should emit a non-piped wikitext link
27099 !! options
27100 parsoid=html2wt
27101 !! html/parsoid
27102 <link rel="mw:PageProp/redirect" href="Bar" data-parsoid='{"a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>
27103 !! wikitext
27104 #REDIRECT [[Bar]]
27105 !! end
27106
27107 !! test
27108 T75121: Infer extension name from typeOf if data-mw is not present
27109 !! options
27110 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
27111 !! html/parsoid
27112 <div typeOf="mw:Extension/foo"></div>
27113 !! wikitext
27114 <foo />
27115 !! end
27116
27117 # Note that the <p> wrapping isn't present in PHP parser output
27118 # The important thing for this test is that P-wrapping doesn't
27119 # interfere with the <nowiki> protection for leading - in <td>
27120 # (which isn't necessary for <th>).
27121 !! test
27122 T88318: p-wrapped dash in table.
27123 !! options
27124 parsoid=html2wt,wt2wt
27125 !! html/parsoid
27126 <table><tbody>
27127 <tr><th><p>-</p></th><th><p>- </p></th></tr>
27128 <tr><td><p>-</p></td><td><p>- </p></td></tr>
27129 <tr><td><small>-</small></td><td><br/><p>-</p></td><td><br/>-</td></tr>
27130 </tbody></table>
27131 !! wikitext
27132 {|
27133 !-
27134 !-
27135 |-
27136 |<nowiki>-</nowiki>
27137 |<nowiki>- </nowiki>
27138 |-
27139 |<small>-</small>
27140 |<br>
27141 -
27142 |<br>
27143 -
27144 |}
27145 !! html/php+tidy
27146 <table>
27147 <tr>
27148 <th>-</th>
27149 <th>-</th>
27150 </tr>
27151 <tr>
27152 <td>-</td>
27153 <td>-</td>
27154 </tr>
27155 <tr>
27156 <td><small>-</small></td>
27157 <td><br />
27158 <p>-</p>
27159 </td>
27160 <td><br />
27161 <p>-</p>
27162 </td>
27163 </tr>
27164 </table>
27165 !! end
27166
27167 !! test
27168 T149209: WTS: Handle newlines in table cells properly
27169 !! options
27170 parsoid=html2wt
27171 !! html/parsoid
27172 <table>
27173 <tbody>
27174 <tr><td>a
27175 b
27176 </td><td data-parsoid='{"stx_v":"row"}'>c</td></tr>
27177 <tr><td><p>x</p>
27178 </td><td data-parsoid='{"stx_v":"row", "startTagSrc": "{{!}}{{!}}"}'>y</td></tr>
27179 </tbody></table>
27180 <table>
27181 <tbody>
27182 <tr><th>a
27183 b
27184 </th><th data-parsoid='{"stx_v":"row"}'>c</th></tr>
27185 <tr><th><p>x</h>
27186 </th><th data-parsoid='{"stx_v":"row"}'>y</th></tr>
27187 </tbody></table>
27188 !! wikitext
27189 {|
27190 |a
27191 b
27192 |c
27193 |-
27194 |x
27195 {{!}}y
27196 |}
27197 {|
27198 !a
27199 b
27200 !c
27201 |-
27202 !x
27203 !y
27204 |}
27205 !! end
27206
27207 !! test
27208 T149209: Selser: Handle newlines in table cells properly
27209 !! options
27210 parsoid={
27211 "modes": ["selser"],
27212 "changes": [
27213 [ "#h1", "html", "a\nb\n" ],
27214 [ "#h2", "html", "a\nb\n" ],
27215 [ "#c1", "html", "a\nb\n" ],
27216 [ "#c2", "html", "<p>a</p>" ],
27217 [ "#c3", "html", "<p>a</p>" ],
27218 [ "#c4", "html", "edit-me<p>a</p>" ]
27219 ]
27220 }
27221 !! wikitext
27222 {|
27223 ! id="h1" |edit-me!!1
27224 |-
27225 ! id="h2" |edit-me||2
27226 |-
27227 | id="c1" |edit-me||3
27228 |-
27229 | id="c2" |edit-me||4
27230 |-
27231 | id="c3" |edit-me||p||q||r
27232 |-
27233 | id="c4" |edit-me||p||q||r
27234 |}
27235 !! wikitext/edited
27236 {|
27237 ! id="h1" |a
27238 b
27239 !1
27240 |-
27241 ! id="h2" |a
27242 b
27243 !2
27244 |-
27245 | id="c1" |a
27246 b
27247 |3
27248 |-
27249 | id="c2" |a
27250 |4
27251 |-
27252 | id="c3" |a
27253 |p||q||r
27254 |-
27255 | id="c4" |edit-me
27256 a
27257 |p||q||r
27258 |}
27259 !! end
27260
27261 !! test
27262 HTML id attribute with Parsoid-like element ids should not be serialized to wikitext
27263 !! options
27264 parsoid=html2wt
27265 !! html/parsoid
27266 <table id='mwAb'>
27267 <td id='mwAc'>foo</td>
27268 <td id='serialize-this'>bar</td>
27269 </table>
27270 !! wikitext
27271 {|
27272 |foo
27273 | id="serialize-this" |bar
27274 |}
27275 !! end
27276
27277 !! test
27278 Parsoid-like element ids should not be serialized to wikitext unless shadowed
27279 !! options
27280 parsoid=html2wt
27281 !! html/parsoid
27282 <div id="mwAQ" data-parsoid='{"stx":"html","a":{"id":"mwAQ"},"sa":{"id":"hello"}}'>ok</div>
27283 !! wikitext
27284 <div id="hello">ok</div>
27285 !! end
27286
27287 !! test
27288 WTS change modes
27289 !! options
27290 parsoid={
27291 "modes": ["wt2wt"],
27292 "changes": [
27293 [ "#xyz", "before", "<b>before</b> stuff " ],
27294 [ "#xyz", "after", " stuff <i>after</i>" ],
27295 [ "#xyz", "html", "x <b>y</b> z" ]
27296 ]
27297 }
27298 !! wikitext
27299 <span id="xyz">hello</span>
27300 !! wikitext/edited
27301 '''before''' stuff <span id="xyz">x '''y''' z</span> stuff ''after''
27302 !! end
27303
27304 !! test
27305 Never serialize a-tag as html, regardless of what data-parsoid has to say
27306 !! options
27307 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
27308 !! html/parsoid
27309 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"html"}'>Foo</a>
27310 !! wikitext
27311 [[Foo]]
27312 !! end
27313
27314 ## SSS FIXME: This is broken output nevertheless.
27315 ## What might be a reasonable non-broken output for this?
27316 ## This is an edge case unlikely to be seen in production
27317 ## that I am not wasting more time on this right now.
27318 !! test
27319 Never serialize a-tag as html, no matter what attributes it has
27320 !! options
27321 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
27322 !! html/parsoid
27323 <a bad='true' href='http://boo.org'><img src='http://boohoo.org' /></a>
27324 !! wikitext
27325 [http://boo.org http://boohoo.org]
27326 !! end
27327
27328 # Misnested is an indication that selser can reuse the source but these have
27329 # shown to sneak through on occasion. See T101768.
27330 # The original wikitext here is: [http://test.com [[one]] two three]
27331 !! test
27332 Strip span tags added to mark misnested links
27333 !! options
27334 parsoid=html2wt
27335 !! html/parsoid
27336 <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>
27337 !! wikitext
27338 [http://test.com][[one]] two three
27339 !! end
27340
27341 !! test
27342 Catch regression when unpacking misnested links
27343 !! options
27344 parsoid=wt2html
27345 !! wikitext
27346 {{echo|hi}}[http://example.com [[ho]]]
27347 !! html/parsoid
27348 <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>
27349 !! end
27350
27351 !! test
27352 Use data-parsoid.firstWikitextNode to compute newline constraints for template content
27353 !! options
27354 parsoid=html2wt
27355 !! html/parsoid
27356 <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|}"]}'>
27357 <tbody><tr><td>d
27358 </td></tr>
27359 </tbody></table>
27360 !! wikitext
27361 {{echo|a}}
27362 {|{{echo|c
27363 {{!}}d
27364 }}
27365 |}
27366 !! end
27367
27368 ## This test verifies the presence and computation of this attribute indirectly
27369 ## by making an edit and ensuring that the serialization is correct (which it would be
27370 ## only if firstWikitextNode is properly set).
27371 !! test
27372 data-parsoid.firstWikitextNode should be computed properly in the presence of fostered content
27373 !! options
27374 parsoid= {
27375 "modes": ["wt2wt"],
27376 "changes": [
27377 [ "div#x", "remove" ],
27378 [ "div", "before", "<div>new</div>" ]
27379 ]
27380 }
27381 !! wikitext
27382 <div id="x">foo</div>
27383 {|
27384 {{echo|<div>boo</div>
27385 {{!}}b}}
27386 |c
27387 |}
27388 !! wikitext/edited
27389
27390 <div>new</div>
27391 {|
27392 {{echo|<div>boo</div>
27393 {{!}}b}}
27394 |c
27395 |}
27396 !! end
27397
27398 # --------------------------------------------
27399 # Tests spec'ing wikitext serialization norms |
27400 # --------------------------------------------
27401
27402 !! test
27403 Serialize multi-line indent-pre starting with wikitext syntax
27404 !! options
27405 parsoid=html2wt
27406 !! html/parsoid
27407 <pre>* 1
27408 ** 2
27409 * 3</pre>
27410 !! wikitext
27411 * 1
27412 ** 2
27413 * 3
27414 !! end
27415
27416 !! test
27417 1. Categories should always be serialized on their own line
27418 !! options
27419 parsoid=html2wt
27420 !! html/parsoid
27421 foo<link rel="mw:PageProp/Category" href="./Category:Foo">bar
27422 !! wikitext
27423 foo
27424 [[Category:Foo]]
27425 bar
27426 !! end
27427
27428 !! test
27429 2. Categories that are part of templates should not introduce a line break
27430 !! wikitext
27431 foo {{echo|<span>bar</span> [[Category:baz]]}} bar
27432 !! html/parsoid
27433 <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>
27434 !! end
27435
27436 # Careful while editing these next 2 tests. There are \u200f characters
27437 # before and after the <link> tags in the HTML and following some
27438 # of the categories in wikitext
27439 # Do not remove these characters in edits.
27440 #
27441 # As part of the serialization, these bidi characters will get stripped.
27442 !! test
27443 RTL (\u200f) and LTR (\u200e) markers around category tags should be stripped
27444 !! options
27445 parsoid={
27446 "modes": ["html2wt"],
27447 "scrubWikitext": true
27448 }
27449 !! html/parsoid
27450 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏
27451 ‏<link rel="mw:PageProp/Category" href="./קטגוריה:_שיטות_משפט" />‏</p>
27452 !! wikitext
27453 [[קטגוריה:טקסים]]
27454 [[קטגוריה: שיטות משפט]]
27455 !! end
27456
27457 !! test
27458 RTL (\u200f) and LTR (\u200e) markers should not be stripped if followed by a text node
27459 !! options
27460 parsoid={
27461 "modes": ["html2wt"],
27462 "scrubWikitext": true
27463 }
27464 !! html/parsoid
27465 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏y</p>
27466 !! wikitext
27467 [[קטגוריה:טקסים]]
27468 ‏y
27469 !! end
27470
27471 !! test
27472 Lists: Add space after bullets
27473 !! options
27474 parsoid=html2wt
27475 !! html/parsoid
27476 <ul>
27477 <li>foo</li>
27478 <li> bar</li>
27479 <li><span> baz</span></li>
27480 </ul>
27481 !! wikitext
27482 * foo
27483 * bar
27484 * <span> baz</span>
27485 !! end
27486
27487 !! test
27488 1. Headings: Add space before/after == (T53744)
27489 !! options
27490 parsoid=html2wt
27491 !! html/parsoid
27492 <h2>foo</h2>
27493 <h2> bar</h2>
27494 <h2>baz </h2>
27495 <h2><span> baz</span></h2>
27496 !! wikitext
27497 == foo ==
27498
27499 == bar ==
27500
27501 == baz ==
27502
27503 == <span> baz</span> ==
27504 !! end
27505
27506 !! test
27507 2. Headings: Add space before/after == even after hoisted content
27508 !! options
27509 parsoid={
27510 "modes": ["html2wt"],
27511 "scrubWikitext": true
27512 }
27513 !! html/parsoid
27514 <h2> <link href="./Category:A2" rel="mw:PageProp/Category" />ok</h2>
27515 !! wikitext
27516 [[Category:A2]]
27517
27518 == ok ==
27519 !! end
27520
27521 !! test
27522 1. Headings: suppress newly created empty headings
27523 !! options
27524 parsoid={
27525 "modes": ["html2wt"],
27526 "scrubWikitext": true
27527 }
27528 !! html/parsoid
27529 <h2></h2>
27530 !! wikitext
27531 !! end
27532
27533 !! test
27534 2. Headings: don't suppress empty headings if scrubWikitext is false
27535 !! options
27536 parsoid=html2wt
27537 !! html/parsoid
27538 <h2></h2>
27539 !! wikitext
27540 ==<nowiki/>==
27541 !! end
27542
27543 !! test
27544 3. Headings: suppress empty headings on edits
27545 !! options
27546 parsoid={
27547 "modes": ["selser"],
27548 "scrubWikitext": true,
27549 "changes": [
27550 [ "#x", "remove"]
27551 ]
27552 }
27553 !! wikitext
27554 ==<span id="x">foo</span>==
27555 !! wikitext/edited
27556 !! end
27557
27558 !! test
27559 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = true)
27560 !! options
27561 parsoid={
27562 "modes": ["html2wt"],
27563 "scrubWikitext": true
27564 }
27565 !! html/parsoid
27566 <h2>foo<br/>bar</h2>
27567 <h2>foo <span><br/>bar</span> baz</h2>
27568 !! wikitext
27569 == foo bar ==
27570
27571 == foo <span> bar</span> baz ==
27572 !! end
27573
27574 !! test
27575 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = false)
27576 !! options
27577 parsoid={
27578 "modes": ["html2wt"],
27579 "scrubWikitext": false
27580 }
27581 !! html/parsoid
27582 <h2>foo<br/>bar</h2>
27583 !! wikitext
27584 == foo<br> bar ==
27585 !! end
27586
27587 !! test
27588 1. WT Quote Tags: suppress newly created empty style tags
27589 !! options
27590 parsoid={
27591 "modes": ["html2wt"],
27592 "scrubWikitext": true
27593 }
27594 !! html/parsoid
27595 <i></i><b></b>
27596 !! wikitext
27597 !! end
27598
27599 !! test
27600 2. WT Quote Tags: don't suppress empty style tags if scrubWikitext is false
27601 !! options
27602 parsoid=html2wt
27603 !! html/parsoid
27604 <i></i><b></b>
27605 !! wikitext
27606 ''<nowiki/>'''''<nowiki/>'''
27607 !! end
27608
27609 !! test
27610 3. WT Quote Tags: suppress empty style tags on edits
27611 !! options
27612 parsoid={
27613 "modes": ["selser"],
27614 "scrubWikitext": true,
27615 "changes": [
27616 [ "#x", "remove"]
27617 ]
27618 }
27619 !! wikitext
27620 '''<span id="x">foo</span>'''
27621 !! wikitext/edited
27622 !! end
27623
27624 !! test
27625 1. Anchors: suppress newly created empty anchors
27626 !! options
27627 parsoid={
27628 "modes": ["html2wt"],
27629 "scrubWikitext": true
27630 }
27631 !! html/parsoid
27632 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
27633 !! wikitext
27634 !! end
27635
27636 !! test
27637 2. Anchors: don't suppress empty anchors if scrubWikitext is false
27638 !! options
27639 parsoid={
27640 "modes": ["html2wt"],
27641 "scrubWikitext": false
27642 }
27643 !! html/parsoid
27644 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
27645 !! wikitext
27646 [[Test|<nowiki/>]]
27647 !! end
27648
27649 !! test
27650 3. Anchors: suppress empty anchors on edits
27651 !! options
27652 parsoid={
27653 "modes": ["selser"],
27654 "scrubWikitext": true,
27655 "changes": [
27656 [ "#x", "remove"]
27657 ]
27658 }
27659 !! wikitext
27660 [[Test|<span id="x">foo</span>]]
27661 !! wikitext/edited
27662 !! end
27663
27664 !! test
27665 3a. Anchors: do not suppress numbered extlinks
27666 !! options
27667 parsoid={
27668 "modes": ["wt2wt"],
27669 "scrubWikitext": true
27670 }
27671 !! wikitext
27672 [http://foo.com]
27673 !! html/parsoid
27674 <a rel="mw:ExtLink" href="http://foo.com"></a>
27675 !! end
27676
27677 !! test
27678 3b. Anchors: do not suppress numbered extlinks
27679 !! options
27680 parsoid={
27681 "modes": ["wt2wt"],
27682 "scrubWikitext": true,
27683 "changes": [
27684 [ "#x", "remove"]
27685 ]
27686 }
27687 !! wikitext
27688 [http://foo.com <span id="x">foo</span>]
27689 !! wikitext/edited
27690 [http://foo.com]
27691 !! end
27692
27693 !!test
27694 Normalizations should be restricted to edited content
27695 !!options
27696 parsoid={
27697 "modes": ["selser"],
27698 "scrubWikitext": true,
27699 "changes": [
27700 [ "h1", "before", "<i></i>"]
27701 ]
27702 }
27703 !!wikitext
27704 a
27705 = =
27706 b
27707 !!wikitext/edited
27708 a
27709 = =
27710 b
27711 !!end
27712
27713 !! test
27714 1. Multiple normalizations (html2wt)
27715 !! options
27716 parsoid={
27717 "modes": ["html2wt"],
27718 "scrubWikitext": true
27719 }
27720 !! html
27721 <h2><i></i></h2>
27722 <p><a href='Foo' rel='mw:WikiLink'>foo<i></i>
27723 </a><b><i></i></b>x</p>
27724 !! wikitext
27725
27726 [[foo]]
27727 x
27728
27729 !! end
27730
27731 !! test
27732 2. Multiple normalizations (selser)
27733 !! options
27734 parsoid={
27735 "modes": ["selser"],
27736 "scrubWikitext": true,
27737 "changes": [
27738 [ "#x", "after", "<h1><i></i></h1>\n<p> x<b></b></p>"]
27739 ]
27740 }
27741 !! wikitext
27742 <span id="x">foo</span>
27743 !! wikitext/edited
27744 <span id="x">foo</span>
27745
27746 x
27747 !! end
27748
27749 !! test
27750 1. Indent Pre Nowiki: suppress whitespace at the start of new paragraph
27751 !! options
27752 parsoid={
27753 "modes": ["html2wt"],
27754 "scrubWikitext": true
27755 }
27756 !! html/parsoid
27757 <p> hi</p>
27758 <p> hello</p>
27759 !! wikitext
27760 hi
27761
27762 hello
27763 !! end
27764
27765 !! test
27766 2. Indent Pre Nowiki: don't suppress whitespace at the start of new paragraph if scrubWikitext is false
27767 !! options
27768 parsoid=html2wt
27769 !! html/parsoid
27770 <p> hi</p>
27771 <p> hello</p>
27772 !! wikitext
27773 <nowiki> </nowiki>hi
27774
27775 <nowiki> </nowiki> hello
27776 !! end
27777
27778 !! test
27779 3. Indent Pre Nowiki: suppress whitespace after newlines in new paragraph or table cell
27780 !! options
27781 parsoid={
27782 "modes": ["html2wt"],
27783 "scrubWikitext": true
27784 }
27785 !! html/parsoid
27786 <p>Foo
27787 bar
27788 baz</p>
27789
27790 <table><tr><td>Foo
27791 bar
27792 baz bang</td></tr></table>
27793
27794 <p><!--boo--> foo
27795 bar</p>
27796
27797 <p> foo
27798 bar<span>boo</span></p>
27799 !! wikitext
27800 Foo
27801 bar
27802 baz
27803
27804 {|
27805 |Foo
27806 bar
27807 baz bang
27808 |}
27809
27810 <!--boo-->foo
27811 bar
27812
27813 foo
27814 bar<span>boo</span>
27815 !! end
27816
27817 !! test
27818 4. Indent Pre Nowiki: suppress leading whitespace in edited paragraphs
27819 !! options
27820 parsoid={
27821 "modes": ["selser"],
27822 "scrubWikitext": true,
27823 "changes": [
27824 [ "p", "html", " a\n b" ]
27825 ]
27826 }
27827 !! wikitext
27828 xyz
27829 !! wikitext/edited
27830 a
27831 b
27832 !! end
27833
27834 !! test
27835 1. New links that end in spaces
27836 !! options
27837 parsoid={
27838 "modes": ["html2wt"],
27839 "scrubWikitext": false
27840 }
27841 !! html/parsoid
27842 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
27843 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
27844 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
27845 !! wikitext
27846 [[Berlin ]]<nowiki/>is the capital of Germany.
27847
27848 [[Foo ]]'''bar'''
27849
27850 [[Boston ]] is a city.
27851 !! end
27852
27853 !! test
27854 2. New links that end in spaces
27855 !! options
27856 parsoid={
27857 "modes": ["html2wt"],
27858 "scrubWikitext": true
27859 }
27860 !! html/parsoid
27861 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
27862 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
27863 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
27864 !! wikitext
27865 [[Berlin]] is the capital of Germany.
27866
27867 [[Foo]] '''bar'''
27868
27869 [[Boston]] is a city.
27870 !! end
27871
27872 !! test
27873 1. Table cells with escapable prefixes
27874 !! options
27875 parsoid={
27876 "modes": ["html2wt"],
27877 "scrubWikitext": false
27878 }
27879 !! html
27880 <table>
27881 <tr><td>a</td></tr>
27882 <tr><td>-</td></tr>
27883 <tr><td>+</td></tr>
27884 </table>
27885 !! wikitext
27886 {|
27887 |a
27888 |-
27889 |<nowiki>-</nowiki>
27890 |-
27891 |<nowiki>+</nowiki>
27892 |}
27893 !! end
27894
27895 !! test
27896 2. Table cells with escapable prefixes
27897 !! options
27898 parsoid={
27899 "modes": ["html2wt"],
27900 "scrubWikitext": true
27901 }
27902 !! html
27903 <table>
27904 <tr><td>a</td></tr>
27905 <tr><td>-</td></tr>
27906 <tr><td>+</td></tr>
27907 </table>
27908 !! wikitext
27909 {|
27910 |a
27911 |-
27912 | -
27913 |-
27914 | +
27915 |}
27916 !! end
27917
27918 !! test
27919 3a. Table cells with escapable prefixes after edits
27920 !! options
27921 parsoid={
27922 "modes": ["selser"],
27923 "scrubWikitext": true,
27924 "changes": [
27925 [ "table tbody tr:first-child td:first-child", "remove"]
27926 ]
27927 }
27928 !! wikitext
27929 {|
27930 |a||-
27931 |}
27932 !! wikitext/edited
27933 {|
27934 | -
27935 |}
27936 !! end
27937
27938 !! test
27939 3b. Table cells with escapable prefixes after edits
27940 !! options
27941 parsoid={
27942 "modes": ["selser"],
27943 "scrubWikitext": true,
27944 "changes": [
27945 [ "table tbody tr:first-child td:first-child", "html", "-" ],
27946 [ "#x", "remove" ]
27947 ]
27948 }
27949 !! wikitext
27950 {|
27951 |pqr
27952 |<span id="x">foo</span>+
27953 |}
27954 !! wikitext/edited
27955 {|
27956 | -
27957 | +
27958 |}
27959 !! end
27960
27961 # FIXME: This test will fail because
27962 # normalization doesn't realize that the id attribute
27963 # will eliminate the escapable scenario
27964 !! test
27965 4a. Table cells without escapable prefixes after edits
27966 !! options
27967 parsoid={
27968 "modes": ["selser"],
27969 "scrubWikitext": true,
27970 "changes": [
27971 [ "#x", "html", "-" ]
27972 ]
27973 }
27974 !! wikitext
27975 {|
27976 | id="x" |abcd
27977 |}
27978 !! wikitext/edited
27979 {|
27980 | id="x" |-
27981 |}
27982 !! end
27983
27984 ## This tests normalizer's ability to discriminate between
27985 ## cells having identical content.
27986 !! test
27987 4b. Table cells without escapable prefixes after edits
27988 !! options
27989 parsoid={
27990 "modes": ["selser"],
27991 "scrubWikitext": true,
27992 "changes": [
27993 [ "td", "html", "-" ]
27994 ]
27995 }
27996 !! wikitext
27997 {|
27998 |a||b
27999 |}
28000 !! wikitext/edited
28001 {|
28002 | -||-
28003 |}
28004 !! end
28005
28006 ## This tests normalizer's ability to not be tripped by
28007 ## comments (and whitespace)
28008 !! test
28009 4c. Table cells without escapable prefixes after edits
28010 !! options
28011 parsoid={
28012 "modes": ["selser"],
28013 "scrubWikitext": true,
28014 "changes": [
28015 [ "table tbody tr td:first-child", "remove" ]
28016 ]
28017 }
28018 !! wikitext
28019 {|
28020 |-
28021 <!--foo--> |a||-
28022 |}
28023 !! wikitext/edited
28024 {|
28025 |-
28026 <!--foo--> | -
28027 |}
28028 !! end
28029
28030 ## This tests normalizer's ability to handle HTML cells
28031 !! test
28032 4d. Table cells without escapable prefixes after edits
28033 !! options
28034 parsoid={
28035 "modes": ["selser"],
28036 "scrubWikitext": true,
28037 "changes": [
28038 [ "td", "html", "-" ]
28039 ]
28040 }
28041 !! wikitext
28042 <table>
28043 <tr><td>a</td></tr>
28044 </table>
28045 !! wikitext/edited
28046 <table>
28047 <tr><td>-</td></tr>
28048 </table>
28049 !! end
28050
28051 ## T111151 Remove font elements without attributes
28052 !! test
28053 5a. font tags without attributes should be dropped in scrubWikitext mode
28054 !! options
28055 parsoid={
28056 "modes": ["html2wt"],
28057 "scrubWikitext": true
28058 }
28059 !! html
28060 <font>foo</font>
28061 <font><font>bar</font></font>
28062 <font class="x">boo</font>
28063 !! wikitext
28064 foo
28065 bar
28066 <font class="x">boo</font>
28067 !! end
28068
28069 !! test
28070 5b. font tags should not be dropped without scrubWikitext being enabled
28071 !! options
28072 parsoid={
28073 "modes": ["html2wt"],
28074 "scrubWikitext": false
28075 }
28076 !! html
28077 <font>foo</font>
28078 !! wikitext
28079 <font>foo</font>
28080 !! end
28081
28082 !! test
28083 Escape nowiki DOM elements
28084 !! options
28085 parsoid=html2wt
28086 !! html/parsoid
28087 <nowiki><i>foo</i></nowiki>
28088 !! wikitext
28089 &lt;nowiki&gt;''foo''&lt;/nowiki&gt;
28090 !! end
28091
28092 # This is meant to be an interim fix while we go about figuring out
28093 # how to not introduce these trailing <nowiki/>s in the first place.
28094 !! test
28095 T115717: Strip trailing <nowiki/>s (without affecting valid uses)
28096 !! options
28097 parsoid=html2wt
28098 !! html/parsoid
28099 <p>x<meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/>
28100 y</p>
28101 <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>
28102 <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>
28103 !! wikitext
28104 x
28105 y
28106
28107 {{echo|
28108 1 = <nowiki/>}}
28109
28110 {{echo|
28111 1 = <nowiki/>
28112 }}
28113 !! end
28114
28115 # ---------------------------------------------------
28116 # End of tests spec'ing wikitext serialization norms |
28117 # ---------------------------------------------------
28118
28119 # T104032
28120 !! test
28121 Bare inline nodes not wrapped inside p-tags should be treated as p-wrapped
28122 !! options
28123 parsoid=html2wt
28124 !! html/parsoid
28125 a<p>b</p>
28126 <b>c</b><p>d</p>
28127 <table><tr>
28128 <td>a<p>b</p></td>
28129 <td><b>c</b><p>d</p></td>
28130 </tr></table>
28131 !! wikitext
28132 a
28133
28134 b
28135
28136 '''c'''
28137
28138 d
28139 {|
28140 |a
28141 b
28142 |'''c'''
28143 d
28144 |}
28145 !! end
28146
28147 !! test
28148 Anchor without href scenarios
28149 !! options
28150 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
28151 !! html/parsoid
28152 <a class="bc"></a>
28153 <a class="no">dice</a>
28154 <a name="foo"></a>
28155 !! wikitext
28156
28157 dice
28158 <span name="foo"></span>
28159 !! end
28160
28161 !! test
28162 New transclusion added after a list should be serialized after the list
28163 !! options
28164 parsoid=html2wt
28165 !! html/parsoid
28166 <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>
28167 !! wikitext
28168 * a
28169 {{echo|foo}}
28170 !! end
28171
28172 # -----------------------------------------------------------------
28173 # End of section for Parsoid-only html2wt tests for serialization
28174 # of new content
28175 # -----------------------------------------------------------------
28176
28177 # -----------------------------------------------------------------
28178 # The following section of tests are primarily to spec behavior of
28179 # the selective serializer. All these tests have manual selser
28180 # changes. The automated selser changes for all tests handle the
28181 # wide variation of changes, but these tests here capture specs
28182 # deterministically.
28183 # ----------------------------------------------------------------
28184
28185 ## T90517
28186 !! test
28187 Selser: New comments should not be lost
28188 !! options
28189 parsoid={
28190 "modes": ["selser"],
28191 "changes": [
28192 [ "#a", "after", "<!--c1-->" ],
28193 [ "#b", "before", "<!--c2-->" ]
28194 ]
28195 }
28196 !! wikitext
28197 <span id="a">a</span>
28198
28199 <span id="b">b</span>
28200 !! wikitext/edited
28201 <span id="a">a</span><!--c1-->
28202
28203 <!--c2--><span id="b">b</span>
28204 !! end
28205
28206 ## T89383
28207 !! test
28208 Selser: Check for validity of DSR before using it
28209 !! options
28210 parsoid={
28211 "modes": ["selser"],
28212 "changes": [
28213 [ "#a", "before", "<meta property='mw:PageProp/displaytitle' content='foo'>" ]
28214 ]
28215 }
28216 !! wikitext
28217 <span id="a">a</span>
28218 !! wikitext/edited
28219 {{DISPLAYTITLE:foo}}
28220 <span id="a">a</span>
28221 !! end
28222
28223 !! test
28224 1. DOMDiff: Changes to <ref> content should be looked up using id
28225 !! options
28226 parsoid={
28227 "modes": ["selser"],
28228 "changes": [
28229 ["#X", "after", "bar"],
28230 ["#Y", "after", "baz"]
28231 ]
28232 }
28233 !! wikitext
28234 X <ref><span id="X">foo</span></ref>
28235 Y <ref name="a" />
28236 <references>
28237 <ref name="a"><span id="Y">foo</span></ref>
28238 </references>
28239 !! wikitext/edited
28240 X <ref><span id="X">foo</span>bar</ref>
28241 Y <ref name="a" />
28242 <references>
28243 <ref name="a"><span id="Y">foo</span>baz</ref>
28244 </references>
28245 !! end
28246
28247 !! test
28248 2. DOMDiff: Changes to <ref> content should be looked up using id
28249 !! options
28250 parsoid={
28251 "modes": ["selser"],
28252 "changes": [
28253 ["#Z", "after", "bar"]
28254 ]
28255 }
28256 !! wikitext
28257 A <ref>foo bar for a</ref>
28258 B <ref group="X" name="b" />
28259
28260 <references />
28261
28262 <references group="X">
28263 <ref name="b"><span id="Z">foo</span></ref>
28264 </references>
28265 !! wikitext/edited
28266 A <ref>foo bar for a</ref>
28267 B <ref group="X" name="b" />
28268
28269 <references />
28270
28271 <references group="X">
28272 <ref name="b"><span id="Z">foo</span>bar</ref>
28273 </references>
28274 !! end
28275
28276 !! test
28277 DOMDiff: Edits to content nested in elements with templated attributes should not be lost (T139388)
28278 !! options
28279 parsoid={
28280 "modes": ["selser"],
28281 "changes": [
28282 [ "div:first-child", "text", "bar" ]
28283 ]
28284 }
28285 !! wikitext
28286 <div style="{{1x|color:red;}}%">foo</div>
28287 !! wikitext/edited
28288 <div style="{{1x|color:red;}}%">bar</div>
28289 !! end
28290
28291 !! test
28292 Empty LI (T49673)
28293 !! wikitext
28294 * a
28295 *
28296 *
28297 * b
28298 !! html/php+tidy
28299 <ul>
28300 <li>a</li>
28301 <li class="mw-empty-elt"></li>
28302 <li class="mw-empty-elt"></li>
28303 <li>b</li>
28304 </ul>
28305 !! end
28306
28307 !! test
28308 Thumbnail output
28309 !! wikitext
28310 [[File:Thumb.png|thumb]]
28311 !! html/php+tidy
28312 <div class="thumb tright">
28313 <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>
28314 <div class="thumbcaption">
28315 <div class="magnify"><a href="/wiki/File:Thumb.png" class="internal" title="Enlarge"></a></div>
28316 </div>
28317 </div>
28318 </div>
28319 !! end
28320
28321 !! test
28322 unclosed internal link XSS (T137264)
28323 !! wikitext
28324 [[#%3Cscript%3Ealert(1)%3C/script%3E|
28325 !! html/php
28326 <p>[[#&lt;script&gt;alert(1)&lt;/script&gt;|
28327 </p>
28328 !! html/parsoid
28329 <p>[[#%3Cscript%3Ealert(1)%3C/script%3E|</p>
28330 !! end
28331
28332 !! test
28333 Validating that <style> isn't eaten by tidy (T167349)
28334 !! options
28335 # Use $wgRawHtml to inject a <style> tag, since you normally can't in wikitext
28336 wgRawHtml=1
28337 !! wikitext
28338 <div class="foo">
28339 <html><style>.foo::before { content: "<foo>"; }</style></html>
28340 <html><style data-mw-foobar="baz">.foo::after { content: "<bar>"; }</style></html>
28341 </div>
28342 !! html+tidy
28343 <div class="foo">
28344 <style>.foo::before { content: "<foo>"; }</style>
28345 <style data-mw-foobar="baz">.foo::after { content: "<bar>"; }</style>
28346 </div>
28347 !! end