Merge "Revert "Make mw.widgets.SearchInputWidget extend OO.ui.SearchInputWidget""
[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 showflags
10438 !! wikitext
10439 {{REVISIONID}}
10440 !! html/*
10441 <p>1337
10442 </p>
10443 flags=vary-revision-id
10444 !! end
10445
10446 !! test
10447 Magic Word: {{SCRIPTPATH}}
10448 !! options
10449 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10450 !! wikitext
10451 {{SCRIPTPATH}}
10452 !! html/*
10453
10454 !! end
10455
10456 !! test
10457 Magic Word: {{STYLEPATH}}
10458 !! options
10459 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10460 !! wikitext
10461 {{STYLEPATH}}
10462 !! html/*
10463 <p>/skins
10464 </p>
10465 !! end
10466
10467 !! test
10468 Magic Word: {{SERVER}}
10469 !! options
10470 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10471 !! wikitext
10472 {{SERVER}}
10473 !! html/*
10474 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
10475 </p>
10476 !! end
10477
10478 !! test
10479 Magic Word: {{SERVERNAME}}
10480 !! options
10481 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10482 !! wikitext
10483 {{SERVERNAME}}
10484 !! html/*
10485 <p>example.org
10486 </p>
10487 !! end
10488
10489 !! test
10490 Magic Word: {{SITENAME}}
10491 !! options
10492 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10493 !! wikitext
10494 {{SITENAME}}
10495 !! html/*
10496 <p>MediaWiki
10497 </p>
10498 !! end
10499
10500 !! test
10501 Magic Word: {{PAGELANGUAGE}}
10502 !! options
10503 language=fr
10504 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10505 !! wikitext
10506 {{PAGELANGUAGE}}
10507 !! html/*
10508 <p>fr
10509 </p>
10510 !! end
10511
10512 !! test
10513 Magic Word: {{PAGELANGUAGE}} on a page with no explicitly set language
10514 !! options
10515 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10516 !! wikitext
10517 {{PAGELANGUAGE}}
10518 !! html/*
10519 <p>en
10520 </p>
10521 !! end
10522
10523 !! test
10524 Case-sensitive magic words, when cased differently, should just be template transclusions
10525 !! wikitext
10526 {{CurrentMonth}}
10527 {{currentday}}
10528 {{cURreNTweEK}}
10529 {{currentHour}}
10530 !! html
10531 <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>
10532 <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>
10533 <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>
10534 <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>
10535 </p>
10536 !! end
10537
10538 !! test
10539 Case-insensitive magic words should still work with weird casing.
10540 !! wikitext
10541 {{sErVeRNaMe}}
10542 {{LCFirst:AOEU}}
10543 {{ucFIRST:aoeu}}
10544 {{SERver}}
10545 !! html
10546 <p>example.org
10547 aOEU
10548 Aoeu
10549 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
10550 </p>
10551 !! end
10552
10553 # From plwiki:PLOS_ONE
10554 !! test
10555 Parsoid: Page property magic word with magic word contents
10556 !! wikitext
10557 {{DISPLAYTITLE:''{{PAGENAME}}''}}
10558 !! html/parsoid
10559 <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>"}]]}'/>
10560 !! end
10561
10562 # NOTE: mw:ExpandedAttrs is not the best typeof here. mw:Transclusion is better.
10563 # But, this is a limitation of our representation and is documented in
10564 # TemplateHandler.js in processSpecialMagicWord
10565 !! test
10566 Parsoid: Template-generated DISPLAYTITLE
10567 !! wikitext
10568 {{{{echo|DISPLAYTITLE}}:Foo}}
10569 !! options
10570 showtitle
10571 !! config
10572 wgAllowDisplayTitle=true
10573 wgRestrictDisplayTitle=false
10574 !! html/php
10575 Foo
10576
10577 !! html/parsoid
10578 <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"}]]}'/>
10579 !! end
10580
10581 !! test
10582 Namespace 1 {{ns:1}}
10583 !! wikitext
10584 {{ns:1}}
10585 !! html
10586 <p>Talk
10587 </p>
10588 !! end
10589
10590 !! test
10591 Namespace 1 {{ns:01}}
10592 !! wikitext
10593 {{ns:01}}
10594 !! html
10595 <p>Talk
10596 </p>
10597 !! end
10598
10599 !! test
10600 Namespace 0 {{ns:0}} (T6783)
10601 !! wikitext
10602 {{ns:0}}
10603 !! html
10604
10605 !! end
10606
10607 !! test
10608 Namespace 0 {{ns:00}} (T6783)
10609 !! wikitext
10610 {{ns:00}}
10611 !! html
10612
10613 !! end
10614
10615 !! test
10616 Namespace -1 {{ns:-1}}
10617 !! wikitext
10618 {{ns:-1}}
10619 !! html
10620 <p>Special
10621 </p>
10622 !! end
10623
10624 !! test
10625 Namespace User {{ns:User}}
10626 !! wikitext
10627 {{ns:User}}
10628 !! html
10629 <p>User
10630 </p>
10631 !! end
10632
10633 !! test
10634 Namespace User talk {{ns:User_talk}}
10635 !! wikitext
10636 {{ns:User_talk}}
10637 !! html
10638 <p>User talk
10639 </p>
10640 !! end
10641
10642 !! test
10643 Namespace User talk {{ns:uSeR tAlK}}
10644 !! wikitext
10645 {{ns:uSeR tAlK}}
10646 !! html
10647 <p>User talk
10648 </p>
10649 !! end
10650
10651 !! test
10652 Namespace File {{ns:File}}
10653 !! wikitext
10654 {{ns:File}}
10655 !! html
10656 <p>File
10657 </p>
10658 !! end
10659
10660 !! test
10661 Namespace File {{ns:Image}}
10662 !! wikitext
10663 {{ns:Image}}
10664 !! html
10665 <p>File
10666 </p>
10667 !! end
10668
10669 !! test
10670 Namespace (lang=de) Benutzer {{ns:User}}
10671 !! options
10672 language=de
10673 !! wikitext
10674 {{ns:User}}
10675 !! html
10676 <p>Benutzer
10677 </p>
10678 !! end
10679
10680 !! test
10681 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
10682 !! options
10683 language=de
10684 !! wikitext
10685 {{ns:3}}
10686 !! html
10687 <p>Benutzer Diskussion
10688 </p>
10689 !! end
10690
10691 !! test
10692 Urlencode
10693 !! wikitext
10694 {{urlencode:hi world?!}}
10695 {{urlencode:hi world?!|WIKI}}
10696 {{urlencode:hi world?!|PATH}}
10697 {{urlencode:hi world?!|QUERY}}
10698 !! html/php
10699 <p>hi+world%3F%21
10700 hi_world%3F!
10701 hi%20world%3F%21
10702 hi+world%3F%21
10703 </p>
10704 !! end
10705
10706 !! test
10707 Magic Word: prioritize type info over data-parsoid
10708 !! options
10709 parsoid=html2wt
10710 !! html/parsoid
10711 <meta property="mw:PageProp/forcetoc" data-parsoid='{"magicSrc":"__NOTOC__"}'/>
10712 !! wikitext
10713 __FORCETOC__
10714 !! end
10715
10716 !! test
10717 Magic Word: serialize on separate line (parsoid)
10718 !! options
10719 parsoid=wt2wt,html2wt
10720 !! wikitext
10721 foo
10722 __NOTOC__
10723 bar
10724 !! html/parsoid
10725 foo<meta property="mw:PageProp/notoc"/>bar
10726 !! end
10727
10728 !! test
10729 Magic Word: rt non-english wikis
10730 !! options
10731 parsoid=wt2wt
10732 language=de
10733 !! wikitext
10734 __NOEDITSECTION__
10735 !! html/parsoid
10736 <meta property="mw:PageProp/noeditsection" data-parsoid='{"magicSrc":"__NOEDITSECTION__"}'/>
10737 !! end
10738
10739 !!test
10740 __proto__ is treated as normal wikitext (T105997)
10741 !!wikitext
10742 __proto__
10743 !!html
10744 <p>__proto__
10745 </p>
10746 !!end
10747
10748 ###
10749 ### Magic links
10750 ###
10751 !! test
10752 Magic links: internal link to RFC (T2479)
10753 !! wikitext
10754 [[RFC 123]]
10755 !! html/php
10756 <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>
10757 </p>
10758 !! html/parsoid
10759 <p><a rel="mw:WikiLink" href="./RFC_123" title="RFC 123">RFC 123</a></p>
10760 !! end
10761
10762 !! test
10763 Magic links: RFC (T2479)
10764 !! wikitext
10765 RFC 822
10766 !! html/php
10767 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
10768 </p>
10769 !! html/parsoid
10770 <p><a href="//tools.ietf.org/html/rfc822" rel="mw:ExtLink">RFC 822</a></p>
10771 !! end
10772
10773 !! test
10774 Magic links: RFC (T67278)
10775 !! wikitext
10776 This is RFC 822 but thisRFC 822 is not RFC 822linked.
10777 !! html/php
10778 <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.
10779 </p>
10780 !! html/parsoid
10781 <p>This is <a href="//tools.ietf.org/html/rfc822" rel="mw:ExtLink">RFC 822</a> but thisRFC 822 is not RFC 822linked.</p>
10782 !! end
10783
10784 !! test
10785 Magic links: RFC (w/ non-newline whitespace, T30950/T31025)
10786 !! wikitext
10787 RFC &nbsp;&#160;&#0160;&#xA0;&#Xa0; 822
10788 RFC
10789 822
10790 !! html/php
10791 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
10792 RFC
10793 822
10794 </p>
10795 !! html/parsoid
10796 <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>
10797 RFC
10798 822</p>
10799 !! end
10800
10801 !! test
10802 Magic links: ISBN (T3937)
10803 !! wikitext
10804 ISBN 0-306-40615-2
10805 !! html/php
10806 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
10807 </p>
10808 !! html/parsoid
10809 <p><a href="./Special:BookSources/0306406152" rel="mw:WikiLink">ISBN 0-306-40615-2</a></p>
10810 !! end
10811
10812 !! test
10813 Magic links: ISBN (T67278)
10814 !! wikitext
10815 This is ISBN 978-0-316-09811-3 but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.
10816 !! html/php
10817 <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.
10818 </p>
10819 !! html/parsoid
10820 <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>
10821 !! end
10822
10823 !! test
10824 Magic links: ISBN (w/ non-newline whitespace, T30950/T31025)
10825 !! wikitext
10826 ISBN &nbsp;&#160;&#0160;&#xA0;&#Xa0; 978&nbsp;0&#160;316&#0160;09811&#xA0;3
10827 ISBN
10828 9780316098113
10829 ISBN 978
10830 0316098113
10831 !! html/php
10832 <p><a href="/wiki/Special:BookSources/9780316098113" class="internal mw-magiclink-isbn">ISBN 978 0 316 09811 3</a>
10833 ISBN
10834 9780316098113
10835 ISBN 978
10836 0316098113
10837 </p>
10838 !! html/parsoid
10839 <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>
10840 ISBN
10841 9780316098113
10842 ISBN 978
10843 0316098113</p>
10844 !! end
10845
10846 !! test
10847 Magic links: PMID incorrectly converts space to underscore
10848 !! wikitext
10849 PMID 1234
10850 !! html/php
10851 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
10852 </p>
10853 !! html/parsoid
10854 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract" rel="mw:ExtLink">PMID 1234</a></p>
10855 !! end
10856
10857 !! test
10858 Magic links: PMID (T67278)
10859 !! wikitext
10860 This is PMID 1234 but thisPMID 1234 is not PMID 1234linked.
10861 !! html/php
10862 <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.
10863 </p>
10864 !! html/parsoid
10865 <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>
10866 !! end
10867
10868 !! test
10869 Magic links: PMID (w/ non-newline whitespace, T30950/T31025)
10870 !! wikitext
10871 PMID &nbsp;&#160;&#0160;&#xA0;&#Xa0; 1234
10872 PMID
10873 1234
10874 !! html/php
10875 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
10876 PMID
10877 1234
10878 </p>
10879 !! html/parsoid
10880 <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>
10881 PMID
10882 1234</p>
10883 !! end
10884
10885 # <nowiki> nodes shouldn't be inserted during html2wt by Parsoid,
10886 # since these are ExtLinkText, not MagicLinkText
10887 !! test
10888 Magic links: use appropriate serialization for "almost" magic links.
10889 !! wikitext
10890 X[[Special:BookSources/0978739256|foo]]
10891
10892 X[//tools.ietf.org/html/rfc1234 foo]
10893 !! html/php
10894 <p>X<a href="/wiki/Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a>
10895 </p><p>X<a rel="nofollow" class="external text" href="//tools.ietf.org/html/rfc1234">foo</a>
10896 </p>
10897 !! html/parsoid
10898 <p>X<a rel="mw:WikiLink" href="./Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a></p>
10899 <p>X<a rel="mw:ExtLink" href="//tools.ietf.org/html/rfc1234">foo</a></p>
10900 !! end
10901
10902 !! test
10903 Magic links: All disabled (T47942)
10904 !! options
10905 wgEnableMagicLinks={"ISBN":false, "PMID":false, "RFC":false}
10906 !! wikitext
10907 ISBN 0-306-40615-2
10908 PMID 1234
10909 RFC 4321
10910 !! html/php
10911 <p>ISBN 0-306-40615-2
10912 PMID 1234
10913 RFC 4321
10914 </p>
10915 !! end
10916
10917 ###
10918 ### Templates
10919 ####
10920
10921 !! test
10922 Nonexistent template
10923 !! wikitext
10924 {{thistemplatedoesnotexist}}
10925 !! html
10926 <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>
10927 </p>
10928 !! end
10929
10930 !! test
10931 Template with invalid target containing tags
10932 !! wikitext
10933 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
10934 !! html
10935 <p>{{a<b>b</b>|foo|a=b|a = b}}
10936 </p>
10937 !! end
10938
10939 !! test
10940 Template with invalid target containing unclosed tag
10941 !! wikitext
10942 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
10943 !! html
10944 <p>{{a<b>|foo|a=b|a = b}}</b>
10945 </p>
10946 !! end
10947
10948 !! test
10949 Template with invalid target containing wikilink
10950 !! wikitext
10951 {{[[Main Page]]}}
10952 !! html/php
10953 <p>{{<a href="/wiki/Main_Page" title="Main Page">Main Page</a>}}
10954 </p>
10955 !! html/parsoid
10956 <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>
10957 !! end
10958
10959 !! test
10960 Template with just whitespace in it, T70421
10961 !! wikitext
10962 {{echo|{{ }}}}
10963 !! html/parsoid
10964 <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>
10965 !! end
10966
10967 !! article
10968 Template:test
10969 !! text
10970 This is a test template
10971 !! endarticle
10972
10973 !! test
10974 Simple template
10975 !! wikitext
10976 {{test}}
10977 !! html
10978 <p>This is a test template
10979 </p>
10980 !! end
10981
10982 !! test
10983 Template with explicit namespace
10984 !! wikitext
10985 {{Template:test}}
10986 !! html
10987 <p>This is a test template
10988 </p>
10989 !! end
10990
10991
10992 !! article
10993 Template:paramtest
10994 !! text
10995 This is a test template with parameter {{{param}}}
10996 !! endarticle
10997
10998 !! test
10999 Template parameter
11000 !! wikitext
11001 {{paramtest|param=foo}}
11002 !! html
11003 <p>This is a test template with parameter foo
11004 </p>
11005 !! end
11006
11007 !! article
11008 Template:paramtestnum
11009 !! text
11010 [[{{{1}}}|{{{2}}}]]
11011 !! endarticle
11012
11013 !! test
11014 Template unnamed parameter
11015 !! wikitext
11016 {{paramtestnum|Main Page|the main page}}
11017 !! html
11018 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
11019 </p>
11020 !! end
11021
11022 !! article
11023 Template:templatesimple
11024 !! text
11025 (test)
11026 !! endarticle
11027
11028 !! article
11029 Template:templateredirect
11030 !! text
11031 #redirect [[Template:templatesimple]]
11032 !! endarticle
11033
11034 !! article
11035 Template:templateasargtestnum
11036 !! text
11037 {{{{{1}}}}}
11038 !! endarticle
11039
11040 !! article
11041 Template:templateasargtest
11042 !! text
11043 {{template{{{templ}}}}}
11044 !! endarticle
11045
11046 !! article
11047 Template:templateasargtest2
11048 !! text
11049 {{{{{templ}}}}}
11050 !! endarticle
11051
11052 !! test
11053 Template with template name as unnamed argument
11054 !! wikitext
11055 {{templateasargtestnum|templatesimple}}
11056 !! html
11057 <p>(test)
11058 </p>
11059 !! end
11060
11061 !! test
11062 Template with template name as argument
11063 !! wikitext
11064 {{templateasargtest|templ=simple}}
11065 !! html
11066 <p>(test)
11067 </p>
11068 !! end
11069
11070 !! test
11071 Template with template name as argument (2)
11072 !! wikitext
11073 {{templateasargtest2|templ=templatesimple}}
11074 !! html
11075 <p>(test)
11076 </p>
11077 !! end
11078
11079 !! article
11080 Template:templateasargtestdefault
11081 !! text
11082 {{{{{templ|templatesimple}}}}}
11083 !! endarticle
11084
11085 !! article
11086 Template:templa
11087 !! text
11088 '''templ'''
11089 !! endarticle
11090
11091 !! test
11092 Template with default value
11093 !! wikitext
11094 {{templateasargtestdefault}}
11095 !! html
11096 <p>(test)
11097 </p>
11098 !! end
11099
11100 !! test
11101 Template with default value (value set)
11102 !! wikitext
11103 {{templateasargtestdefault|templ=templa}}
11104 !! html
11105 <p><b>templ</b>
11106 </p>
11107 !! end
11108
11109 !! test
11110 Template redirect
11111 !! wikitext
11112 {{templateredirect}}
11113 !! html/php
11114 <p>(test)
11115 </p>
11116 !! html/parsoid
11117 <link rel="mw:PageProp/redirect" href="./Template:Templatesimple" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"templateredirect","href":"./Template:Templateredirect"},"params":{},"i":0}}]}'/>
11118 !! end
11119
11120 !! test
11121 Template with argument in separate line
11122 !! wikitext
11123 {{ templateasargtest |
11124 templ = simple }}
11125 !! html
11126 <p>(test)
11127 </p>
11128 !! end
11129
11130 !! test
11131 Template with complex template as argument
11132 !! wikitext
11133 {{paramtest|
11134 param ={{ templateasargtest |
11135 templ = simple }}}}
11136 !! html
11137 <p>This is a test template with parameter (test)
11138 </p>
11139 !! end
11140
11141 !! test
11142 Templates with templated name
11143 !! wikitext
11144 {{{{echo|echo}}|foo}}
11145 {{{{echo|inner list}} }}
11146 !! html
11147 <p>foo
11148 </p>
11149 <ul><li> item 1</li></ul>
11150
11151 !! html/parsoid
11152 <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>
11153 <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>
11154 !! end
11155
11156 # Parsoid markup is deliberate "broken". This is an edge case.
11157 # See long comment in TemplateHandler.js:convertAttribsToString.
11158 !! test
11159 Templates with invalid templated targets
11160 !! wikitext
11161 {{echo
11162 {{echo|foo}}
11163 }}
11164 !! html/php
11165 <p>{{echo
11166 foo
11167 }}
11168 </p>
11169 !! html/parsoid
11170 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo\n{{echo|foo}}\n"},"params":{},"i":0}}]}'>{{echo
11171 foo }}</p>
11172 !! end
11173
11174 !! test
11175 Template with thumb image (with link in description)
11176 !! wikitext
11177 {{paramtest|param=[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
11178 !! html/php
11179 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>
11180
11181 !! html+tidy
11182 <p>This is a test template with parameter</p>
11183 <div class="thumb tright">
11184 <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>
11185 <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>
11186 </div>
11187 </div>
11188 !! html/parsoid
11189 <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>
11190 !! end
11191
11192 !! article
11193 Template:complextemplate
11194 !! text
11195 {{{1}}} {{paramtest|
11196 param ={{{param}}}}}
11197 !! endarticle
11198
11199 !! test
11200 Template with complex arguments
11201 !! wikitext
11202 {{complextemplate|
11203 param ={{ templateasargtest |
11204 templ = simple }}|[[Template:complextemplate|link]]}}
11205 !! html
11206 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
11207 </p>
11208 !! end
11209
11210 !! test
11211 T2553: link with two variables in a piped link
11212 !! wikitext
11213 {|
11214 |[[{{{1}}}|{{{2}}}]]
11215 |}
11216 !! html/php
11217 <table>
11218 <tr>
11219 <td>[[{{{1}}}|{{{2}}}]]
11220 </td></tr></table>
11221
11222 !! html/parsoid
11223 <table>
11224 <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>
11225 </tbody></table>
11226 !! end
11227
11228 # See: T2553
11229 !! test
11230 Abort table cell attribute parsing on wikilink
11231 !! wikitext
11232 {|
11233 | testing [[one|two]] | three || four
11234 | testing one two | three || four
11235 | testing="[[one|two]]" | three || four
11236 |}
11237 !! html/php
11238 <table>
11239 <tr>
11240 <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>
11241 <td> four
11242 </td>
11243 <td> three </td>
11244 <td> four
11245 </td>
11246 <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>
11247 <td> four
11248 </td></tr></table>
11249
11250 !! html/parsoid
11251 <table>
11252 <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>
11253 <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>
11254 <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>
11255 </tbody></table>
11256 !! end
11257
11258 !! test
11259 Don't abort table cell attribute parsing if wikilink is found in template arg
11260 !! wikitext
11261 {|
11262 | Test {{#tag:ref|One two "[[three]]" four}}
11263 |}
11264 !! html/parsoid
11265 <table>
11266 <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>
11267 </tbody></table>
11268 !! end
11269
11270 !! test
11271 Magic variable as template parameter
11272 !! wikitext
11273 {{paramtest|param={{SITENAME}}}}
11274 !! html
11275 <p>This is a test template with parameter MediaWiki
11276 </p>
11277 !! end
11278
11279 !! article
11280 Template:linktest
11281 !! text
11282 [[{{{param}}}|link]]
11283 !! endarticle
11284
11285 !! test
11286 Template parameter as link source
11287 !! wikitext
11288 {{linktest|param=Main Page}}
11289 !! html
11290 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
11291 </p>
11292 !! end
11293
11294 !!article
11295 Template:paramtest2
11296 !! text
11297 including another template, {{paramtest|param={{{arg}}}}}
11298 !! endarticle
11299
11300 !! test
11301 Template passing argument to another template
11302 !! wikitext
11303 {{paramtest2|arg='hmm'}}
11304 !! html
11305 <p>including another template, This is a test template with parameter 'hmm'
11306 </p>
11307 !! end
11308
11309 !! article
11310 Template:Linktest2
11311 !! text
11312 Main Page
11313 !! endarticle
11314
11315 !! test
11316 Template as link source
11317 !! wikitext
11318 [[{{linktest2}}]]
11319
11320 [[{{linktest2}}|Main Page]]
11321
11322 [[{{linktest2}}]]Page
11323 !! html
11324 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
11325 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
11326 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
11327 </p>
11328 !! end
11329
11330
11331 !! article
11332 Template:loop1
11333 !! text
11334 {{loop2}}
11335 !! endarticle
11336
11337 !! article
11338 Template:loop2
11339 !! text
11340 {{loop1}}
11341 !! endarticle
11342
11343 !! test
11344 Template infinite loop
11345 !! wikitext
11346 {{loop1}}
11347 !! html
11348 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
11349 </p>
11350 !! end
11351
11352 !! test
11353 Template from main namespace
11354 !! wikitext
11355 {{:Main Page}}
11356 !! html
11357 <p>blah blah
11358 </p>
11359 !! end
11360
11361 !! article
11362 Template:table
11363 !! text
11364 {|
11365 | 1 || 2
11366 |-
11367 | 3 || 4
11368 |}
11369 !! endarticle
11370
11371 !! test
11372 T2529: Template with table, not included at beginning of line
11373 !! wikitext
11374 foo {{table}}
11375 !! html
11376 <p>foo
11377 </p>
11378 <table>
11379 <tr>
11380 <td> 1 </td>
11381 <td> 2
11382 </td></tr>
11383 <tr>
11384 <td> 3 </td>
11385 <td> 4
11386 </td></tr></table>
11387
11388 !! end
11389
11390 !! test
11391 T2523: Template shouldn't eat newline (or add an extra one before table)
11392 !! wikitext
11393 foo
11394 {{table}}
11395 !! html
11396 <p>foo
11397 </p>
11398 <table>
11399 <tr>
11400 <td> 1 </td>
11401 <td> 2
11402 </td></tr>
11403 <tr>
11404 <td> 3 </td>
11405 <td> 4
11406 </td></tr></table>
11407
11408 !! end
11409
11410 !! test
11411 T2041: Template parameters shown as broken links
11412 !! wikitext
11413 {{{parameter}}}
11414 !! html
11415 <p>{{{parameter}}}
11416 </p>
11417 !! end
11418
11419 !! test
11420 Template with targets containing wikilinks
11421 !! options
11422 parsoid=wt2html
11423 !! wikitext
11424 {{[[foo]]}}
11425
11426 {{[[{{echo|foo}}]]}}
11427
11428 {{{{echo|[[foo}}]]}}
11429 !! html/php
11430 <p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
11431 </p><p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
11432 </p><p>{{[[foo}}]]
11433 </p>
11434 !! html/parsoid
11435 <p>{{<a rel="mw:WikiLink" href="./Foo" title="Foo">foo</a>}}</p>
11436 <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>
11437 <p>{{<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[foo}}]]"}},"i":0}}]}'>[[foo}}]]</span></p>
11438 !! end
11439
11440 !! article
11441 Template:''
11442 !! text
11443 bar
11444 !! endarticle
11445
11446 !! test
11447 Templates: Double quotes as template target
11448 !! wikitext
11449 foo {{''}} baz
11450 !! html/php
11451 <p>foo bar baz
11452 </p>
11453 !! html/parsoid
11454 <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
11455 </p>
11456 !! end
11457
11458 ## This test is about making sure Parsoid's data-mw is well formed in the
11459 ## face of multiple templates with intersecting and overlapping ranges. The
11460 ## wikitext itself is wretched.
11461 !! test
11462 Templates with intersecting and overlapping ranges
11463 !! wikitext
11464 {|{{echo|
11465 <p>ha</p>}}
11466 {|{{echo|
11467 <p>ho</p>}}
11468 {{echo|{{!}}hi}}
11469 |}
11470 !! html/php+tidy
11471 <p>ha</p>
11472 <p>ho</p>
11473 <table>
11474 <tr>
11475 <td></td>
11476 </tr>
11477 <tr>
11478 <td>hi</td>
11479 </tr>
11480 </table>
11481 <table>
11482 <tr>
11483 <td></td>
11484 </tr>
11485 </table>
11486 !! html/parsoid
11487 <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":""}]]}'>
11488
11489 </table><p about="#mwt1">ho</p><table about="#mwt1" typeof="mw:ExpandedAttrs" data-mw='{"attribs":[[{"txt":"","html":""},{"html":""}]]}'>
11490
11491 <tbody><tr><td>hi</td></tr>
11492 </tbody></table>
11493 !! end
11494
11495 !! article
11496 Template:MSGNW test
11497 !! text
11498 ''None'' of '''this''' should be
11499 * interpreted
11500 but rather passed unmodified
11501 {{test}}
11502 <gallery>
11503 File:Foobar.jpg
11504 </gallery>
11505 <!-- comment -->
11506 !! endarticle
11507
11508 # hmm, fix this or just deprecate msgnw and document its behavior?
11509 !! test
11510 msgnw keyword
11511 !! wikitext
11512 {{msgnw:MSGNW test}}
11513 !! html/php
11514 <p>&#39;&#39;None&#39;&#39; of &#39;&#39;&#39;this&#39;&#39;&#39; should be
11515 &#42; interpreted
11516 &#32;but rather passed unmodified
11517 &#123;&#123;test&#125;&#125;
11518 &#60;gallery&#62;
11519 File:Foobar.jpg
11520 &#60;/gallery&#62;
11521 &#60;!-- comment --&#62;
11522 </p>
11523 !! end
11524
11525 !! test
11526 int keyword
11527 !! wikitext
11528 {{int:youhavenewmessages|lots of money|not!}}
11529 !! html
11530 <p>You have lots of money (not!).
11531 </p>
11532 !! end
11533
11534 !! test
11535 int keyword - non-existing message
11536 !! wikitext
11537 {{int:var}}
11538 !! html
11539 <p>⧼var⧽
11540 </p>
11541 !! end
11542
11543 !! article
11544 Template:Includes
11545 !! text
11546 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
11547 !! endarticle
11548
11549 !! test
11550 <includeonly> and <noinclude> being included
11551 !! wikitext
11552 {{Includes}}
11553 !! html
11554 <p>Foobar
11555 </p>
11556 !! end
11557
11558 !! article
11559 Template:Includes2
11560 !! text
11561 <onlyinclude>Foo</onlyinclude>bar
11562 !! endarticle
11563
11564 !! test
11565 <onlyinclude> being included
11566 !! wikitext
11567 {{Includes2}}
11568 !! html
11569 <p>Foo
11570 </p>
11571 !! end
11572
11573
11574 !! article
11575 Template:Includes3
11576 !! text
11577 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
11578 !! endarticle
11579
11580 !! test
11581 <onlyinclude> and <includeonly> being included
11582 !! wikitext
11583 {{Includes3}}
11584 !! html
11585 <p>Foo
11586 </p>
11587 !! end
11588
11589 !! test
11590 <includeonly> and <noinclude> on a page
11591 !! wikitext
11592 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
11593 !! html
11594 <p>Foozar
11595 </p>
11596 !! end
11597
11598 !! test
11599 Un-closed <noinclude>
11600 !! wikitext
11601 <noinclude>
11602 !! html
11603 !! end
11604
11605 !! test
11606 <onlyinclude> on a page
11607 !! wikitext
11608 <onlyinclude>Foo</onlyinclude>bar
11609 !! html
11610 <p>Foobar
11611 </p>
11612 !! end
11613
11614 !! test
11615 Un-closed <onlyinclude>
11616 !! wikitext
11617 <onlyinclude>
11618 !! html
11619 !! end
11620
11621 !!test
11622 Self-closed noinclude, includeonly, onlyinclude tags
11623 !! wikitext
11624 <noinclude />
11625 <includeonly />
11626 <onlyinclude />
11627 !! html
11628 <p><br />
11629 </p>
11630 !!end
11631
11632 !!test
11633 Unbalanced includeonly and noinclude tags
11634 !! wikitext
11635 {|
11636 |a</noinclude>
11637 |b</noinclude></noinclude>
11638 |c</noinclude></includeonly>
11639 |d</includeonly></includeonly>
11640 |}
11641 !! html
11642 <table>
11643 <tr>
11644 <td>a
11645 </td>
11646 <td>b
11647 </td>
11648 <td>c&lt;/includeonly&gt;
11649 </td>
11650 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
11651 </td></tr></table>
11652
11653 !!end
11654
11655 !! article
11656 Template:Includeonly section
11657 !! text
11658 <includeonly>
11659 ==Includeonly section==
11660 </includeonly>
11661 ==Section T-1==
11662 !!endarticle
11663
11664 !! test
11665 T8563: Edit link generation for section shown by <includeonly>
11666 !! wikitext
11667 {{includeonly section}}
11668 !! html
11669 <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>
11670 <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>
11671
11672 !! end
11673
11674 # Uses same input as the contents of [[Template:Includeonly section]]
11675 !! test
11676 T8563: Section extraction for section shown by <includeonly>
11677 !! options
11678 section=T-2
11679 !! wikitext
11680 <includeonly>
11681 ==Includeonly section==
11682 </includeonly>
11683 ==Section T-2==
11684 !! html
11685 ==Section T-2==
11686 !! end
11687
11688 !! test
11689 T8563: Edit link generation for section suppressed by <includeonly>
11690 !! wikitext
11691 <includeonly>
11692 ==Includeonly section==
11693 </includeonly>
11694 ==Section 1==
11695 !! html
11696 <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>
11697
11698 !! end
11699
11700 !! test
11701 T8563: Section extraction for section suppressed by <includeonly>
11702 !! options
11703 section=1
11704 !! wikitext
11705 <includeonly>
11706 ==Includeonly section==
11707 </includeonly>
11708 ==Section 1==
11709 !! html
11710 ==Section 1==
11711 !! end
11712
11713 !! test
11714 Un-closed <includeonly>
11715 !! wikitext
11716 <includeonly>
11717 !! html/php
11718 !! html/parsoid
11719 <meta typeof="mw:Includes/IncludeOnly" data-parsoid='{"src":"&lt;includeonly>"}'/>
11720 !! end
11721
11722 ## We used to, but no longer wt2wt this test since the default serializer
11723 ## will normalize the include directives to serialize on their own line.
11724 ## Selser will take care of preserving formatting in scenarios where they
11725 ## intermingled with other wikitext.
11726 !! test
11727 Includes and comments at SOL
11728 !! options
11729 parsoid=wt2html,html2html
11730 !! wikitext
11731 <!-- comment --><noinclude><!-- comment --></noinclude><!-- comment -->== hu ==
11732
11733 <noinclude>
11734 some
11735 </noinclude>* stuff
11736 * here
11737
11738 <includeonly>can have stuff</includeonly>=== here ===
11739
11740 !! html/php
11741 <h2><span class="mw-headline" id="hu">hu</span></h2>
11742 <p>some
11743 </p>
11744 <ul><li> stuff</li>
11745 <li> here</li></ul>
11746 <h3><span class="mw-headline" id="here">here</span></h3>
11747
11748 !! html/parsoid
11749 <!-- 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>
11750
11751 <meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/>
11752 <p>some</p>
11753 <meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"&lt;/noinclude>"}'/><ul><li> stuff</li>
11754 <li> here</li></ul>
11755
11756 <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>
11757
11758 !! end
11759
11760 # TODO: test with DOM fragment reuse!
11761 !! test
11762 Parsoid: DOM fragment reuse
11763 !! options
11764 parsoid=wt2wt,wt2html
11765 !! wikitext
11766 a{{echo|b<table></table>c}}d
11767
11768 a{{echo|b
11769 <table></table>
11770 c}}d
11771
11772 {{echo|a
11773
11774 <table></table>
11775
11776 b}}
11777 !! html
11778 <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>
11779
11780 <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">
11781 </span><table about="#mwt2" data-parsoid='{"stx":"html"}'></table><span about="#mwt2">
11782 </span><p about="#mwt2">cd</p>
11783
11784 <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">
11785
11786 </span><table about="#mwt3" data-parsoid='{"stx":"html"}'></table><span about="#mwt3">
11787
11788 </span><p about="#mwt3">b</p>
11789 !! end
11790
11791 !! test
11792 Parsoid: Merge double tds (T52603)
11793 !! options
11794 parsoid
11795 !! wikitext
11796 {|
11797 |{{echo|{{!}} foo}}
11798 |}
11799 !! html
11800 <table><tbody>
11801 <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>
11802 </tbody></table>
11803 !! end
11804
11805 !! test
11806 Parsoid: Merge double tds in nested transclusion content (T52603)
11807 !! options
11808 parsoid
11809 !! wikitext
11810 {{echo|<div>}}
11811 {|
11812 |{{echo|{{!}} foo}}
11813 |}
11814 {{echo|</div>}}
11815 !! html
11816 <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}}]}'>
11817 <table><tbody>
11818 <tr><td data-mw='{"parts":["|"]}'> foo</td></tr>
11819 </tbody></table>
11820 </div>
11821 !! end
11822
11823 ###
11824 ### <includeonly> and <noinclude> in attributes
11825 ###
11826 !!test
11827 0. includeonly around the entire attribute
11828 !! wikitext
11829 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
11830 !! html
11831 <p><span id="v2">bar</span>
11832 </p>
11833 !!end
11834
11835 !!test
11836 1. includeonly in html attr key
11837 !! wikitext
11838 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
11839 !! html
11840 <p><span id="foo">bar</span>
11841 </p>
11842 !!end
11843
11844 !!test
11845 2. includeonly in html attr value
11846 !! wikitext
11847 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
11848 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
11849 !! html
11850 <p><span id="v1">bar</span>
11851 <span id="v1">bar</span>
11852 </p>
11853 !!end
11854
11855 !!test
11856 3. includeonly in part of an attr value
11857 !! wikitext
11858 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
11859 !! html
11860 <p><span style="color:red;">bar</span>
11861 </p>
11862 !!end
11863
11864 !!test
11865 4. includeonly in table attributes
11866 !! wikitext
11867 {|
11868 |- <noinclude>
11869 |-
11870 |a
11871 </noinclude>
11872 |- <includeonly>
11873 |-
11874 |b
11875 </includeonly>
11876 |}
11877 !! html
11878 <table>
11879
11880
11881 <tr>
11882 <td>a
11883 </td></tr>
11884 </table>
11885
11886 !!end
11887
11888 ###
11889 ### Preprocessor precedence tests
11890 ### See: https://www.mediawiki.org/wiki/Preprocessor_ABNF
11891 ###
11892 ##{{[[-{{{{{{[[Foo|bar}}]]}-}}}}}]]
11893 !! test
11894 Preprocessor precedence 1: link is rightmost opening
11895 !! wikitext
11896 {{[[Foo|bar}}]]
11897
11898 But close-brace is not a valid character in a link title:
11899 {{[[Foo}}|bar]]
11900
11901 However, we can still tell this was handled as a link in the preprocessor:
11902 {{echo|[[Foo}}|bar]]|bat}}
11903 !! html
11904 <p>{{<a href="/wiki/Foo" title="Foo">bar}}</a>
11905 </p><p>But close-brace is not a valid character in a link title:
11906 {{[[Foo}}|bar]]
11907 </p><p>However, we can still tell this was handled as a link in the preprocessor:
11908 [[Foo}}|bar]]
11909 </p>
11910 !! end
11911
11912 !! test
11913 Preprocessor precedence 2: template is rightmost opening
11914 !! options
11915 language=zh
11916 !! wikitext
11917 -{{echo|foo}-}}-
11918 !! html
11919 <p>-foo}--
11920 </p>
11921 !! end
11922
11923 !! test
11924 Preprocessor precedence 3: language converter is rightmost opening
11925 !! options
11926 language=zh
11927 !! wikitext
11928 {{echo|hi}}
11929
11930 {{-{R|echo|hi}}}-
11931
11932 [[-{R|raw]]}-
11933 !! html
11934 <p>hi
11935 </p><p>{{echo|hi}}
11936 </p><p>[[raw]]
11937 </p>
11938 !! end
11939
11940 !! test
11941 Preprocessor precedence 4: left-most angle bracket
11942 !! options
11943 language=zh
11944 !! wikitext
11945 <!--{raw}-->
11946 !! html
11947 !! end
11948
11949 !! article
11950 Template:Precedence5
11951 !! text
11952 {{{{{1}}}}}
11953 !! endarticle
11954
11955 !! test
11956 Preprocessor precedence 5: tplarg takes precedence over template
11957 !! wikitext
11958 {{Precedence5|Bullet}}
11959 !! html
11960 <ul><li> Bar</li></ul>
11961
11962 !! end
11963
11964 !! test
11965 Preprocessor precedence 6: broken link is rightmost opening
11966 !! wikitext
11967 {{echo|[[Foo}}
11968
11969 {{echo|[[Foo|bar|bat=baz}}
11970 !! html
11971 <p>{{echo|[[Foo}}
11972 </p><p>{{echo|[[Foo|bar|bat=baz}}
11973 </p>
11974 !! end
11975
11976 # This next test exposes a difference between PHP and Parsoid:
11977 # Given [[Foo|{{echo|Bar]]x}}y]]z:
11978 # 1) Both PHP and Parsoid ignore the `]]` inside the `echo` in the
11979 # "preprocessor" stage. The `{{echo` extends until the `x}}`, and the
11980 # outer `[[Foo` extends until the `y]]`
11981 # 2a) But then the PHP preprocessor emits `[[Foo|Bar]]xy]]z` as an
11982 # intermediate result (after template expansion), and link processing
11983 # happens on this intermediate result, which moves the wikilink
11984 # boundary leftward to `[[Foo|Bar]]`
11985 # 2b) Parsoid works in a single step, so it's going to keep the
11986 # wikilink as extending to the `y]]`
11987 # 3a) Then PHP does linktrail processing which slurps up the trailing
11988 # `xy` inside the link.
11989 # 3b) Parsoid will do linktrail processing to slurp up the trailing
11990 # `z` inside the link.
11991 # This is "correct" behavior. Parsoid's basic worldview is that the
11992 # `]]` inside the template shouldn't be allowed to leak out to affect
11993 # the surrounding wikilink. PHP may match Parsoid (in the future)
11994 # if you use {{#balance}} (T114445).
11995
11996 !! test
11997 Preprocessor precedence 7: broken template is rightmost opening
11998 !! wikitext
11999 [[Foo|{{echo|Bar]]
12000
12001 [[Foo|{{echo|Bar]]-x}}-y]]-z
12002
12003 Careful: linktrails can move the end of the wikilink:
12004 [[Foo|{{echo|y']]a}}l]]l
12005 !! html
12006 <p><a href="/wiki/Foo" title="Foo">{{echo|Bar</a>
12007 </p><p><a href="/wiki/Foo" title="Foo">Bar</a>-x-y]]-z
12008 </p><p>Careful: linktrails can move the end of the wikilink:
12009 <a href="/wiki/Foo" title="Foo">y'al</a>]]l
12010 </p>
12011 !! end
12012
12013 !! test
12014 Preprocessor precedence 8: broken language converter is rightmost opening
12015 !! options
12016 language=zh
12017 !! wikitext
12018 [[Foo-{R|raw]]
12019 !! html
12020 <p>[[Foo-{R|raw]]
12021 </p>
12022 !! end
12023
12024 !! article
12025 Template:Preprocessor_precedence_9
12026 !! text
12027 ;4: {{{{1}}}}
12028 ;5: {{{{{2}}}}}
12029 ;6: {{{{{{3}}}}}}
12030 ;7: {{{{{{{4}}}}}}}
12031 !! endarticle
12032
12033 !! test
12034 Preprocessor precedence 9: groups of braces
12035 !! wikitext
12036 {{Preprocessor precedence 9|Four|Bullet|1|2}}
12037 !! html
12038 <dl><dt>4</dt>
12039 <dd> {Four}</dd>
12040 <dt>5</dt>
12041 <dd> </dd></dl>
12042 <ul><li> Bar</li></ul>
12043 <dl><dt>6</dt>
12044 <dd> Four</dd>
12045 <dt>7</dt>
12046 <dd> {Bullet}</dd></dl>
12047
12048 !! end
12049
12050 !! article
12051 Template:Preprocessor_precedence_10
12052 !! text
12053 ;1: -{R|raw}-
12054 ;2: -{{Bullet}}-
12055 ;3: -{{{1}}}-
12056 ;4: -{{{{2}}}}-
12057 ;5: -{{{{{3}}}}}-
12058 ;6: -{{{{{{4}}}}}}-
12059 ;7: -{{{{{{{5}}}}}}}-
12060 !! endarticle
12061
12062 !! test
12063 Preprocessor precedence 10: groups of braces with leading dash
12064 !! options
12065 language=zh
12066 !! wikitext
12067 {{Preprocessor precedence 10|Three|raw2|Bullet|1|2}}
12068 !! html
12069 <dl><dt>1</dt>
12070 <dd> raw</dd>
12071 <dt>2</dt>
12072 <dd> -</dd></dl>
12073 <ul><li> Bar-</li></ul>
12074 <dl><dt>3</dt>
12075 <dd> -Three-</dd>
12076 <dt>4</dt>
12077 <dd> raw2</dd>
12078 <dt>5</dt>
12079 <dd> -</dd></dl>
12080 <ul><li> Bar-</li></ul>
12081 <dl><dt>6</dt>
12082 <dd> -Three-</dd>
12083 <dt>7</dt>
12084 <dd> raw2</dd></dl>
12085
12086 !! end
12087
12088 !! test
12089 Preprocessor precedence 11: found during visual diff testing
12090 !! wikitext
12091 {{#tag:span|-{{#tag:span|-{{echo|x}}}}}}
12092
12093 {{echo|-{{echo|-{{echo|x}}}}}}
12094
12095 {{echo|-{{echo|x}}}}
12096 !! html
12097 <p><span>-<span>-x</span></span>
12098 </p><p>--x
12099 </p><p>-x
12100 </p>
12101 !! end
12102
12103 !! test
12104 Preprocessor precedence 12: broken language converter closed by brace.
12105 !! wikitext
12106 This form breaks the template, which is unfortunate:
12107 * {{echo|foo-{bar}bat}}
12108
12109 But if the broken language converter markup is inside an extension
12110 tag, nothing bad happens:
12111 * <nowiki>foo-{bar}bat</nowiki>
12112 * {{echo|<nowiki>foo-{bar}bat</nowiki>}}
12113 * <pre>foo-{bar}bat</pre>
12114 * {{echo|<pre>foo-{bar}bat</pre>}}
12115
12116 <tag>foo-{bar}bat</tag>
12117 {{echo|<tag>foo-{bar}bat</tag>}}
12118
12119 !! html+tidy
12120 <p>This form breaks the template, which is unfortunate:</p>
12121 <ul>
12122 <li>{{echo|foo-{bar}bat}}</li>
12123 </ul>
12124 <p>But if the broken language converter markup is inside an extension tag, nothing bad happens:</p>
12125 <ul>
12126 <li>foo-{bar}bat</li>
12127 <li>foo-{bar}bat</li>
12128 <li>
12129 <pre>
12130 foo-{bar}bat
12131 </pre></li>
12132 <li>
12133 <pre>
12134 foo-{bar}bat
12135 </pre></li>
12136 </ul>
12137 <pre>
12138 'foo-{bar}bat'
12139 array (
12140 )
12141 </pre>
12142 <pre>
12143 'foo-{bar}bat'
12144 array (
12145 )
12146 </pre>
12147 !! end
12148
12149 !! test
12150 Preprocessor precedence, 13: broken language converter in external link
12151 !! wikitext
12152 * [http://example.com/-{foo Example in URL]
12153 * [http://example.com Example in -{link} description]
12154 * {{echo|[http://example.com/-{foo Breaks template, however]}}
12155 !! html+tidy
12156 <ul>
12157 <li><a rel="nofollow" class="external text" href="http://example.com/-{foo">Example in URL</a></li>
12158 <li><a rel="nofollow" class="external text" href="http://example.com">Example in -{link} description</a></li>
12159 <li>{{echo|<a rel="nofollow" class="external text" href="http://example.com/-{foo">Breaks template, however</a>}}</li>
12160 </ul>
12161 !! end
12162
12163 !! test
12164 Preprocessor precedence, 14: broken language converter in comment
12165 !! wikitext
12166 * <!--{{foo}}--> ...should be ok
12167 * <!---{{foo}}--> ...extra dashes
12168 * {{echo|foo<!-- -{bar} -->bat}} ...should be ok
12169 !! html+tidy
12170 <ul>
12171 <li>...should be ok</li>
12172 <li>...extra dashes</li>
12173 <li>foobat ...should be ok</li>
12174 </ul>
12175 !! end
12176
12177 !! test
12178 Preprocessor precedence, 15: broken brace markup in headings
12179 !! wikitext
12180 __NOTOC__ __NOEDITSECTION__
12181 ===1 foo[bar 1===
12182 1
12183 ===2 foo[[bar 2===
12184 2
12185 ===3 foo{bar 3===
12186 3
12187 ===4 foo{{bar 4===
12188 4
12189 ===5 foo{{{bar 5===
12190 5
12191 ===6 foo-{bar 6===
12192 6
12193 !! html+tidy
12194 <h3><span class="mw-headline" id="1_foo.5Bbar_1">1 foo[bar 1</span></h3>
12195 <p>1</p>
12196 <h3><span class="mw-headline" id="2_foo.5B.5Bbar_2">2 foo[[bar 2</span></h3>
12197 <p>2</p>
12198 <h3><span class="mw-headline" id="3_foo.7Bbar_3">3 foo{bar 3</span></h3>
12199 <p>3</p>
12200 <h3><span class="mw-headline" id="4_foo.7B.7Bbar_4">4 foo{{bar 4</span></h3>
12201 <p>4</p>
12202 <h3><span class="mw-headline" id="5_foo.7B.7B.7Bbar_5">5 foo{{{bar 5</span></h3>
12203 <p>5</p>
12204 <h3><span class="mw-headline" id="6_foo-.7Bbar_6">6 foo-{bar 6</span></h3>
12205 <p>6</p>
12206 !! end
12207
12208 ###
12209 ### Token Stream Patcher tests
12210 ###
12211 ### These tests won't always pass wt2wt and other modes because
12212 ### on serialization, the table will be output on a new line.
12213 ### For now, we are blacklisting them, and using this to test selser.
12214 ###
12215
12216 !!test
12217 1. Table tag in SOL posn. should get reparsed correctly with valid TSR
12218 !!options
12219 parsoid=wt2html,wt2wt
12220 !!wikitext
12221 {{echo|}}{| width = '100%'
12222 |foo
12223 |}
12224 !!html/parsoid
12225 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":""}},"i":0}}]}'></span><table width="100%">
12226 <tbody><tr><td>foo</td></tr>
12227 </tbody></table>
12228 !!end
12229
12230 ## We used to, but no longer wt2wt this test since the default serializer
12231 ## will normalize the include directives to serialize on their own line.
12232 ## Selser will take care of preserving formatting in scenarios where they
12233 ## intermingled with other wikitext.
12234 !!test
12235 2. Table tag in SOL posn. should get reparsed correctly with valid TSR
12236 !!options
12237 parsoid=wt2html
12238 !!wikitext
12239 <includeonly>a</includeonly>{| {{{b}}}
12240 |c
12241 |}
12242 !!html/parsoid
12243 <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":""}]]}'>
12244 <tbody><tr><td>c</td></tr>
12245 </tbody></table>
12246 !!end
12247
12248 !! test
12249 Table wikitext syntax outside wiki-tables
12250 !! wikitext
12251 a
12252 |+ not a caption
12253 ! not a table heading
12254 |- not a table row
12255 | not a table cell
12256 | class="foo bar" | baz
12257 b
12258 |}
12259 |-
12260 c
12261 !! html
12262 <p>a
12263 |+ not a caption
12264 ! not a table heading
12265 |- not a table row
12266 | not a table cell
12267 | class="foo bar" | baz
12268 b
12269 |}
12270 |-
12271 c
12272 </p>
12273 !! end
12274
12275 ###
12276 ### Testing parsing of templates where a template arg
12277 ### has the same name as the template itself.
12278 ###
12279
12280 !! article
12281 Template:quote
12282 !! text
12283 {{{quote|{{{1}}}}}}
12284 !! endarticle
12285
12286 !!test
12287 Templates: Template Name/Arg clash: 1. Use of positional param
12288 !! wikitext
12289 {{quote|foo}}
12290 !! html
12291 <p>foo
12292 </p>
12293 !!end
12294
12295 !!test
12296 Templates: Template Name/Arg clash: 2. Use of named param
12297 !! wikitext
12298 {{quote|quote=foo}}
12299 !! html
12300 <p>foo
12301 </p>
12302 !!end
12303
12304 !!test
12305 Templates: Template Name/Arg clash: 3. Use of named param with empty input
12306 !! wikitext
12307 {{quote|quote}}
12308 !! html
12309 <p>quote
12310 </p>
12311 !!end
12312
12313 ###
12314 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
12315 ###
12316
12317 !!test
12318 Templates: 1. Simple use
12319 !! wikitext
12320 {{echo|Foo}}
12321 !! html
12322 <p>Foo
12323 </p>
12324 !!end
12325
12326 !!test
12327 Templates: 2. Inside a block tag
12328 !! wikitext
12329 <div>{{echo|Foo}}</div>
12330 <blockquote>{{echo|Foo}}</blockquote>
12331 !! html
12332 <div>Foo</div>
12333 <blockquote>Foo</blockquote>
12334
12335 !! html+tidy
12336 <div>Foo</div>
12337 <blockquote>
12338 <p>Foo</p>
12339 </blockquote>
12340 !!end
12341
12342 !!test
12343 Templates: P-wrapping: 1a. Templates on consecutive lines
12344 !! wikitext
12345 {{echo|Foo}}
12346 {{echo|bar}}
12347 !! html
12348 <p>Foo
12349 bar
12350 </p>
12351 !!end
12352
12353 !!test
12354 Templates: P-wrapping: 1b. Templates on consecutive lines
12355 !! wikitext
12356 Foo
12357
12358 {{echo|bar}}
12359 {{echo|baz}}
12360 !! html
12361 <p>Foo
12362 </p><p>bar
12363 baz
12364 </p>
12365 !!end
12366
12367 !!test
12368 Templates: P-wrapping: 1c. Templates on consecutive lines
12369 !! wikitext
12370 {{echo|Foo}}
12371 {{echo|bar}} <div>baz</div>
12372 !! html
12373 <p>Foo
12374 </p>
12375 bar <div>baz</div>
12376
12377 !! html+tidy
12378 <p>Foo</p>
12379 <p>bar</p>
12380 <div>baz</div>
12381 !! end
12382
12383 !!test
12384 Templates: P-wrapping: 1d. Template preceded by comment-only line
12385 !!options
12386 parsoid
12387 !! wikitext
12388 <!-- foo -->
12389 {{echo|Bar}}
12390 !! html
12391 <!-- foo -->
12392
12393 <p about="#mwt223" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Bar"}},"i":0}}]}'>Bar</p>
12394 !!end
12395
12396 !!test
12397 Templates: Inline Text: 1. Multiple template uses
12398 !! wikitext
12399 {{echo|Foo}}bar{{echo|baz}}
12400 !! html
12401 <p>Foobarbaz
12402 </p>
12403 !!end
12404
12405 !!test
12406 Templates: Inline Text: 2. Back-to-back template uses
12407 !! wikitext
12408 {{echo|Foo}}{{echo|bar}}
12409 !! html
12410 <p>Foobar
12411 </p>
12412 !!end
12413
12414 !!test
12415 Templates: Block Tags: 1. Multiple template uses
12416 !! wikitext
12417 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
12418 !! html
12419 <div>Foo</div><div>bar</div><div>baz</div>
12420
12421 !!end
12422
12423 !!test
12424 Templates: Block Tags: 2. Back-to-back template uses
12425 !! wikitext
12426 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
12427 !! html
12428 <div>Foo</div><div>bar</div>
12429
12430 !!end
12431
12432 # This is an edge case relating to paragraph wrapping.
12433 !!test
12434 Templates: Correctly encapsulate templates producing </p> tag without a corresponding <p> tag
12435 !! wikitext
12436 {{echo|a
12437 b</p>}}
12438 !! html/parsoid
12439 <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
12440 b</p>
12441 !!end
12442
12443 !!test
12444 Templates: Links: 1. Simple example
12445 !! wikitext
12446 {{echo|[[Foo|bar]]}}
12447 !! html
12448 <p><a href="/wiki/Foo" title="Foo">bar</a>
12449 </p>
12450 !!end
12451
12452 !!test
12453 Templates: Links: 2. Generation of link href
12454 !! wikitext
12455 [[{{echo|Foo}}|bar]]
12456 !! html
12457 <p><a href="/wiki/Foo" title="Foo">bar</a>
12458 </p>
12459 !!end
12460
12461 !!test
12462 Templates: Links: 3. Generation of part of a link href
12463 !! wikitext
12464 [[Fo{{echo|o}}|bar]]
12465
12466 [[Foo{{echo|bar}}]]
12467
12468 [[Foo{{echo|bar}}baz]]
12469
12470 [[Foo{{echo|bar}}|bar]]
12471
12472 [[:Foo{{echo|bar}}]]
12473
12474 [[:Foo{{echo|bar}}|bar]]
12475 !! html
12476 <p><a href="/wiki/Foo" title="Foo">bar</a>
12477 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
12478 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</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><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
12481 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
12482 </p>
12483 !!end
12484
12485 !!test
12486 Templates: Links: 4. Multiple templates generating link href
12487 !! wikitext
12488 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
12489 !! html
12490 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
12491 </p>
12492 !!end
12493
12494 !!test
12495 Templates: Links: 5. Generation of link text
12496 !! wikitext
12497 [[Foo|{{echo|bar}}]]
12498 !! html
12499 <p><a href="/wiki/Foo" title="Foo">bar</a>
12500 </p>
12501 !!end
12502
12503 !!test
12504 Templates: Links: 5. Nested templates (only outermost template should be marked)
12505 !! wikitext
12506 {{echo|[[{{echo|Foo}}|bar]]}}
12507 !! html
12508 <p><a href="/wiki/Foo" title="Foo">bar</a>
12509 </p>
12510 !!end
12511
12512 !!test
12513 Templates: HTML Tag: 1. Generation of HTML attr. key
12514 !! wikitext
12515 <div {{echo|style}}="color:red;">foo</div>
12516 !! html
12517 <div style="color:red;">foo</div>
12518
12519 !!end
12520
12521 !!test
12522 Templates: HTML Tag: 2. Generation of HTML attr. value
12523 !! wikitext
12524 <div style={{echo|'color:red;'}}>foo</div>
12525 !! html
12526 <div style="color:red;">foo</div>
12527
12528 !!end
12529
12530 !!test
12531 Templates: HTML Tag: 3. Generation of HTML attr key and value
12532 !! wikitext
12533 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
12534 !! html
12535 <div style="color:red;">foo</div>
12536
12537 !!end
12538
12539 !!test
12540 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
12541 !! wikitext
12542 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
12543 !! html
12544 <div title="This is a long title with just one piece templated">foo</div>
12545
12546 !!end
12547
12548 !!test
12549 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
12550 !! wikitext
12551 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
12552 !! html
12553 <div title="This is a long title with just one piece templated">foo</div>
12554
12555 !!end
12556
12557 !!test
12558 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
12559 !! wikitext
12560 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
12561 !! html
12562 <div title="This is a long title with just one piece templated">foo</div>
12563
12564 !!end
12565
12566 # SSS FIXME: While it is great we added support for all this,
12567 # do we want to make this part of the spec? Maybe we want to
12568 # deprecate this kind of usage in the future?
12569 !!test
12570 Templates: HTML Tag: 7. Generation of partial attribute key string
12571 !! wikitext
12572 <div st{{echo|yle}}="color:red;">foo</div>
12573 !! html
12574 <div style="color:red;">foo</div>
12575
12576 !!end
12577
12578 !! test
12579 Templates: HTML Tag: 8. Template-generated attribute (k=v)
12580 !! wikitext
12581 <div {{echo|1=id="v1"}}>bar</div>
12582 !! html
12583 <div id="v1">bar</div>
12584
12585 !!end
12586
12587 !! test
12588 Templates: HTML Tag: 9. Multiple template-generated attributes
12589 !! wikitext
12590 <div {{echo|1=id="v1" title="foo"}}>bar</div>
12591 !! html
12592 <div id="v1" title="foo">bar</div>
12593
12594 !!end
12595
12596 !! test
12597 Templates: Support for templates generating attributes and content
12598 !! wikitext
12599 {| {{mixed_attr_content_template}}
12600 |-
12601 |bar
12602 |}
12603 !! html/php
12604 <table style="color:red;" title="T48811">
12605
12606 <tr>
12607 <td>foo
12608 </td></tr>
12609 <tr>
12610 <td>bar
12611 </td></tr></table>
12612
12613 !! html/parsoid
12614 <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|}"]}'>
12615 <tbody><tr>
12616 <td>foo</td></tr>
12617 <tr>
12618 <td>bar</td></tr>
12619 </tbody></table>
12620 !!end
12621
12622 !! test
12623 1. Entities and nowikis inside templated attributes should be handled correctly
12624 !! wikitext
12625 <div {{echo|style{{=}}"background:&#35;f9f9f9;"}}>foo</div>
12626 !! html/php
12627 <div style="background:#f9f9f9;">foo</div>
12628
12629 !! html/parsoid
12630 <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>
12631 !! end
12632
12633 !! test
12634 2. Entities and nowikis inside templated attributes should be handled correctly
12635 !! wikitext
12636 {|
12637 |{{table_attribs_3}}
12638 |}
12639 !! html/php
12640 <table>
12641 <tr>
12642 <td style="background:#f9f9f9;">Foo
12643 </td></tr></table>
12644
12645 !! html/parsoid
12646 <table>
12647 <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>
12648 </tbody></table>
12649 !! end
12650
12651 !! test
12652 3. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
12653 !! wikitext
12654 {{tbl-start}}
12655 |{{table_attribs_3}}
12656 {{tbl-end}}
12657 !! html/php
12658 <table>
12659 <tr>
12660 <td style="background:#f9f9f9;">Foo
12661 </td></tr></table>
12662
12663 !! html/parsoid
12664 <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}}]}'>
12665 <tbody><tr><td style="background:#f9f9f9;">Foo</td></tr>
12666 </tbody></table>
12667 !! end
12668
12669 # T107622
12670 !! test
12671 4. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
12672 !! wikitext
12673 {|
12674 | {{table_attribs_6}} hi
12675 |}
12676 !! html/php
12677 <table>
12678 <tr>
12679 <td style="background: red;"> hi
12680 </td></tr></table>
12681
12682 !! html/parsoid
12683 <table>
12684 <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>
12685 </tbody></table>
12686 !! end
12687
12688 !!test
12689 Templates: HTML Tables: 1. Generating start of a HTML table
12690 !! wikitext
12691 {{echo|<table><tr><td>foo</td>}}</tr></table>
12692 !! html
12693 <table><tr><td>foo</td></tr></table>
12694
12695 !!end
12696
12697 !!test
12698 Templates: HTML Tables: 2a. Generating middle of a HTML table
12699 !! wikitext
12700 <table><tr>{{echo|<td>foo</td>}}</tr></table>
12701 !! html
12702 <table><tr><td>foo</td></tr></table>
12703
12704 !!end
12705
12706 !!test
12707 Templates: HTML Tables: 2b. Generating middle of a HTML table
12708 !! wikitext
12709 <table>{{echo|<tr><td>foo</td></tr>}}</table>
12710 !! html
12711 <table><tr><td>foo</td></tr></table>
12712
12713 !!end
12714
12715 !!test
12716 Templates: HTML Tables: 3. Generating end of a HTML table
12717 !! wikitext
12718 <table><tr>{{echo|<td>foo</td></tr></table>}}
12719 !! html
12720 <table><tr><td>foo</td></tr></table>
12721
12722 !!end
12723
12724 !!test
12725 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
12726 !! wikitext
12727 {{echo|<table>}}<tr><td>foo</td></tr></table>
12728 !! html
12729 <table><tr><td>foo</td></tr></table>
12730
12731 !!end
12732
12733 !!test
12734 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
12735 !! wikitext
12736 <table>{{echo|<tr>}}<td>foo</td></tr></table>
12737 !! html
12738 <table><tr><td>foo</td></tr></table>
12739
12740 !!end
12741
12742 !!test
12743 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
12744 !! wikitext
12745 <table><tr>{{echo|<td>}}foo</td></tr></table>
12746 !! html
12747 <table><tr><td>foo</td></tr></table>
12748
12749 !!end
12750
12751 !!test
12752 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
12753 !! wikitext
12754 <table><tr><td>foo{{echo|</td>}}</tr></table>
12755 !! html
12756 <table><tr><td>foo</td></tr></table>
12757
12758 !!end
12759
12760 !!test
12761 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
12762 !! wikitext
12763 <table><tr><td>foo</td>{{echo|</tr>}}</table>
12764 !! html
12765 <table><tr><td>foo</td></tr></table>
12766
12767 !!end
12768
12769 !!test
12770 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
12771 !! wikitext
12772 <table><tr><td>foo</td></tr>{{echo|</table>}}
12773 !! html
12774 <table><tr><td>foo</td></tr></table>
12775
12776 !!end
12777
12778 !!test
12779 Templates: HTML Tables: 5. Proper fostering of categories from inside
12780 !!options
12781 parsoid=wt2html,wt2wt
12782 !! wikitext
12783 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
12784 <!--Two categories (T52330)-->
12785 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
12786 !! html
12787 <link rel="mw:PageProp/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
12788 <!--Two categories (T52330)-->
12789 <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>
12790 !!end
12791
12792 !!test
12793 Templates: Wiki Tables: 1a. Fostering of entire template content
12794 !! wikitext
12795 {|
12796 {{echo|a}}
12797 |}
12798 !! html
12799 <table>
12800 a
12801 <tr><td></td></tr></table>
12802
12803 !! html+tidy
12804 <p>a</p>
12805 <table>
12806 <tr>
12807 <td></td>
12808 </tr>
12809 </table>
12810 !! end
12811
12812 !!test
12813 Templates: Wiki Tables: 1b. Fostering of entire template content
12814 !! wikitext
12815 {|
12816 {{echo|<div>}}
12817 foo
12818 {{echo|</div>}}
12819 |}
12820 !! html
12821 <table>
12822 <div>
12823 <p>foo
12824 </p>
12825 </div>
12826 <tr><td></td></tr></table>
12827
12828 !! html+tidy
12829 <div>
12830 <p>foo</p>
12831 </div>
12832 <table>
12833 <tr>
12834 <td></td>
12835 </tr>
12836 </table>
12837 !! end
12838
12839 !!test
12840 Templates: Wiki Tables: 2. Fostering of partial template content
12841 !! wikitext
12842 {|
12843 {{echo|a
12844 <div>b</div>}}
12845 |}
12846 !! html
12847 <table>
12848 a
12849 <div>b</div>
12850 <tr><td></td></tr></table>
12851
12852 !! html+tidy
12853 <p>a</p>
12854 <div>b</div>
12855 <table>
12856 <tr>
12857 <td></td>
12858 </tr>
12859 </table>
12860 !! end
12861
12862 !!test
12863 Templates: Wiki Tables: 3. td-content via multiple templates
12864 !! wikitext
12865 {|
12866 {{echo|{{pipe}}a}}{{echo|b}}
12867 |}
12868 !! html
12869 <table>
12870 <tr>
12871 <td>ab
12872 </td></tr></table>
12873
12874 !!end
12875
12876 !!test
12877 Templates: Wiki Tables: 4. Templated tags, no content
12878 !! wikitext
12879 {{tbl-start}}
12880 {{tbl-end}}
12881 !! html
12882 <table>
12883 <tr><td></td></tr></table>
12884
12885 !!end
12886
12887 !!test
12888 Templates: Wiki Tables: 5. Templated tags, regular td-tags
12889 !! wikitext
12890 {{tbl-start}}
12891 |foo
12892 {{tbl-end}}
12893 !! html
12894 <table>
12895 <tr>
12896 <td>foo
12897 </td></tr></table>
12898
12899 !!end
12900
12901 !!test
12902 Templates: Wiki Tables: 6. Templated tags, templated td-tags
12903 !! wikitext
12904 {{tbl-start}}
12905 {{!}}foo
12906 {{tbl-end}}
12907 !! html
12908 <table>
12909 <tr>
12910 <td>foo
12911 </td></tr></table>
12912
12913 !!end
12914
12915 ## This test case is very specific to Parsoid's internals
12916 ## and is hence only tested for Parsoid's code. Parsoid uses
12917 ## a <meta> marker tag for <ref> tags and they are expanded
12918 ## much later. We are verifying that this <meta> tag usage
12919 ## doesn't prevent foster parenting.
12920 !!test
12921 Templates: Wiki Tables: 7. Fosterable <ref>s should get fostered
12922 !!wikitext
12923 {{PartialTable}}<ref>foo</ref>
12924 |}
12925
12926 <references />
12927 !!html/parsoid
12928 <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">
12929 <tbody>
12930 </tbody></table>
12931
12932 <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>
12933 !!end
12934
12935 !! test
12936 Templates: Wiki Tables: 8. Fosterable meta-tags should get fostered
12937 !! wikitext
12938 {{echo|
12939 {{{!}}
12940 {{!}}-}}
12941 <onlyinclude>
12942 |foo
12943 </onlyinclude>
12944 {{!}}}
12945 !! html/parsoid
12946 <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{{!}}}"]}'>
12947 </span><meta typeof="mw:Includes/OnlyInclude" about="#mwt1"/><table about="#mwt1">
12948 <tbody><tr>
12949
12950 <td>foo
12951 <meta typeof="mw:Includes/OnlyInclude/End"/></td></tr>
12952 </tbody></table>
12953 !! end
12954
12955 !!test
12956 Templates: Lists: Multi-line list-items via templates
12957 !! wikitext
12958 *{{echo|a {{nonexistent|
12959 unused}}}}
12960 *{{echo|b {{nonexistent|
12961 unused}}}}
12962 !! html
12963 <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>
12964 <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>
12965
12966 !!end
12967
12968 !!test
12969 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
12970 !! wikitext
12971 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
12972 !! html
12973 <p><i>ab</i>c<i>d</i>e
12974 </p>
12975 !!end
12976
12977 !!test
12978 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
12979 (PHP parser generates misnested html)
12980 !! wikitext
12981 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
12982 !! html/parsoid
12983 <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>
12984 !!end
12985
12986 !!test
12987 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
12988 (PHP parser generates misnested html; Parsoid html2wt mode adds newlines between {{echo}}s)
12989 !! options
12990 parsoid=wt2html,wt2wt
12991 !! wikitext
12992 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
12993 !! html
12994 <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>
12995 <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>
12996 <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>
12997 !!end
12998
12999 !!test
13000 Templates: Ugly nesting: 4. Divs opened/closed across templates
13001 !! wikitext
13002 a<div>b{{echo|c</div>d}}e
13003 !! html
13004 a<div>bc</div>de
13005
13006 !! html+tidy
13007 <p>a</p>
13008 <div>bc</div>
13009 <p>de</p>
13010 !! end
13011
13012 !!test
13013 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
13014 (Parsoid-centric)
13015 !! options
13016 parsoid
13017 !! wikitext
13018 {|
13019 |{{echo|foo</table>}}
13020 |bar
13021 |}
13022 !! html
13023 <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|}"]}'>
13024
13025 <tbody>
13026 <tr>
13027 <td>foo</td></tr></tbody></table><span about="#mwt1">
13028 </span><span about="#mwt1">|bar</span><span about="#mwt1">
13029 |}</span>
13030 !!end
13031
13032 !!test
13033 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
13034 (Parsoid-centric)
13035 !! options
13036 parsoid
13037 !! wikitext
13038 <table>
13039 <tr>
13040 <td>
13041 <table>
13042 <tr>
13043 <td>1. {{echo|foo </table>}}</td>
13044 <td> bar </td>
13045 <td>2. {{echo|baz </table>}}</td>
13046 </tr>
13047 <tr>
13048 <td>abc</td>
13049 </tr>
13050 </table>
13051 </td>
13052 </tr>
13053 <tr>
13054 <td>xyz</td>
13055 </tr>
13056 </table>
13057 !! html
13058 <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>"]}'>
13059 <tbody><tr>
13060 <td>
13061 <table>
13062 <tbody><tr>
13063 <td>1. foo </td></tr></tbody></table></td>
13064 <td> bar </td>
13065 <td>2. baz </td></tr></tbody></table><span about="#mwt2">
13066 </span><span about="#mwt2">
13067 </span><span about="#mwt2">
13068 </span><span about="#mwt2">abc</span><span about="#mwt2">
13069 </span><span about="#mwt2">
13070 </span><span about="#mwt2">
13071 </span><span about="#mwt2">
13072 </span><span about="#mwt2">
13073 </span><span about="#mwt2">
13074 </span><span about="#mwt2">xyz</span><span about="#mwt2">
13075 </span><span about="#mwt2">
13076 </span>
13077 !!end
13078
13079 !! test
13080 Templates: Ugly templates: 3. newline-only template parameter
13081 !! wikitext
13082 foo {{echo|
13083 }}
13084 !! html
13085 <p>foo
13086 </p>
13087 !! end
13088
13089 # This looks like a bug: a single newline triggers p/br for some reason.
13090 !! test
13091 Templates: Ugly templates: 4. newline-only template parameter inconsistency
13092 !! wikitext
13093 {{echo|
13094 }}
13095 !! html
13096 <p><br />
13097 </p>
13098 !! end
13099
13100 # T66017 -- ugly wikitext with fostered content generates two template ranges that
13101 # have a true overlap (T1-start - T2-start - T1-end - T2-end).
13102 !! test
13103 Templates: Ugly templates: 5. Template encapsulation test: Non-trivial overlap of template ranges is properly handled
13104 !! wikitext
13105 {{echo|<table>}}
13106 {{echo|<div>foo}}
13107 {{echo|</table>}}
13108 !! html/parsoid
13109 <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
13110 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
13111 </table>
13112 !! end
13113
13114 # T66017 -- ugly wikitext with fostered content generates two template ranges
13115 # that are "identical" and generate nesting cycles in the algorithm
13116 !! test
13117 Templates: Ugly templates: 6. Template encapsulation test: Cyclical nesting of template ranges is properly handled
13118 !! wikitext
13119 {{echo|<table><tr><td><table>}}
13120 {{echo|<div>}}
13121 {{echo|</div>}}
13122 !! html/parsoid
13123 <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"}'>
13124 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
13125 </table></td></tr></tbody></table>
13126 !! end
13127
13128 !! test
13129 Templates: Parameters substituted at the top-level
13130 !! wikitext
13131 {{{foo|''who'' {{echo|me}}? '''never!'''}}}
13132
13133 {{{foo|bar|baz}}}
13134 !! html/php
13135 <p><i>who</i> me? <b>never!</b>
13136 </p><p>bar
13137 </p>
13138 !! html/parsoid
13139 <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>
13140
13141 <p about="#mwt3" typeof="mw:Param" data-mw='{"parts":[{"templatearg":{"target":{"wt":"foo"},"params":{"1":{"wt":"bar"},"2":{"wt":"baz"}},"i":0}}]}'>bar</p>
13142 !! end
13143
13144 !!test
13145 Parser Functions: 1. Simple example
13146 !! wikitext
13147 {{uc:foo}}
13148 !! html
13149 <p>FOO
13150 </p>
13151 !!end
13152
13153 !!test
13154 Parser Functions: 2. Nested use (only outermost should be marked up)
13155 !! wikitext
13156 {{uc:{{lc:FOO}}}}
13157 !! html
13158 <p>FOO
13159 </p>
13160 !!end
13161
13162 ###
13163 ### Pre-save transform tests
13164 ###
13165 !! test
13166 pre-save transform: subst:
13167 !! options
13168 pst
13169 !! wikitext
13170 {{subst:test}}
13171 !! html/php
13172 This is a test template
13173 !! end
13174
13175 !! test
13176 pre-save transform: normal template
13177 !! options
13178 pst
13179 !! wikitext
13180 {{test}}
13181 !! html/php
13182 {{test}}
13183 !! end
13184
13185 !! test
13186 pre-save transform: nonexistent template
13187 !! options
13188 pst
13189 !! wikitext
13190 {{thistemplatedoesnotexist}}
13191 !! html/php
13192 {{thistemplatedoesnotexist}}
13193 !! end
13194
13195 !! test
13196 pre-save transform: subst magic variables
13197 !! options
13198 pst
13199 !! wikitext
13200 {{subst:SITENAME}}
13201 !! html/php
13202 MediaWiki
13203 !! end
13204
13205 # This is T2089, which I fixed. -- wtm
13206 !! test
13207 pre-save transform: subst: templates with parameters
13208 !! options
13209 pst
13210 !! wikitext
13211 {{subst:paramtest|param="something else"}}
13212 !! html/php
13213 This is a test template with parameter "something else"
13214 !! end
13215
13216 !! article
13217 Template:nowikitest
13218 !! text
13219 <nowiki>'''not wiki'''</nowiki>
13220 !! endarticle
13221
13222 !! test
13223 pre-save transform: nowiki in subst (T3188)
13224 !! options
13225 pst
13226 !! wikitext
13227 {{subst:nowikitest}}
13228 !! html/php
13229 <nowiki>'''not wiki'''</nowiki>
13230 !! end
13231
13232 !! article
13233 Template:commenttest
13234 !! text
13235 This template has <!-- a comment --> in it.
13236 !! endarticle
13237
13238 !! test
13239 pre-save transform: comment in subst (T3936)
13240 !! options
13241 pst
13242 !! wikitext
13243 {{subst:commenttest}}
13244 !! html/php
13245 This template has <!-- a comment --> in it.
13246 !! end
13247
13248 !! test
13249 pre-save transform: unclosed tag
13250 !! options
13251 pst
13252 !! wikitext
13253 <nowiki>'''not wiki'''
13254 !! html/php
13255 <nowiki>'''not wiki'''
13256 !! end
13257
13258 !! test
13259 pre-save transform: mixed tag case
13260 !! options
13261 pst
13262 !! wikitext
13263 <NOwiki>'''not wiki'''</noWIKI>
13264 !! html/php
13265 <NOwiki>'''not wiki'''</noWIKI>
13266 !! end
13267
13268 !! test
13269 pre-save transform: unclosed comment in <nowiki>
13270 !! options
13271 pst
13272 !! wikitext
13273 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
13274 !! html/php
13275 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
13276 !!end
13277
13278 # Leading @ in this template definition works around a limitation
13279 # in parsoid's parserTests which otherwise strips the <span> from the
13280 # result (confusing it for a template wrapper)
13281 !! article
13282 Template:dangerous
13283 !!text
13284 @<span onmouseover="alert('crap')">Oh no</span>
13285 !!endarticle
13286
13287 !!test
13288 (confirming safety of fix for subst T3936)
13289 !! wikitext
13290 {{Template:dangerous}}
13291 !! html
13292 <p>@<span>Oh no</span>
13293 </p>
13294 !! end
13295
13296 !! test
13297 pre-save transform: comment containing gallery (T7024)
13298 !! options
13299 pst
13300 !! wikitext
13301 <!-- <gallery>data</gallery> -->
13302 !! html/php
13303 <!-- <gallery>data</gallery> -->
13304 !!end
13305
13306 !! test
13307 pre-save transform: comment containing extension
13308 !! options
13309 pst
13310 !! wikitext
13311 <!-- <tag>data</tag> -->
13312 !! html/php
13313 <!-- <tag>data</tag> -->
13314 !!end
13315
13316 !! test
13317 pre-save transform: comment containing nowiki
13318 !! options
13319 pst
13320 !! wikitext
13321 <!-- <nowiki>data</nowiki> -->
13322 !! html/php
13323 <!-- <nowiki>data</nowiki> -->
13324 !!end
13325
13326 !! test
13327 pre-save transform: <noinclude> in subst (T5298)
13328 !! options
13329 pst
13330 !! wikitext
13331 {{subst:Includes}}
13332 !! html/php
13333 Foobar
13334 !! end
13335
13336 !! test
13337 pre-save transform: <onlyinclude> in subst (T5298)
13338 !! options
13339 pst
13340 !! wikitext
13341 {{subst:Includes2}}
13342 !! html/php
13343 Foo
13344 !! end
13345
13346 !! article
13347 Template:SubstTest
13348 !!text
13349 {{<includeonly>subst:</includeonly>Includes}}
13350 !! endarticle
13351
13352 !! article
13353 Template:SafeSubstTest
13354 !! text
13355 {{<includeonly>safesubst:</includeonly>Includes}}
13356 !! endarticle
13357
13358 !! test
13359 T24297: safesubst: works during PST
13360 !! options
13361 pst
13362 !! wikitext
13363 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
13364 !! html/php
13365 FoobarFoobar
13366 !! end
13367
13368 !! test
13369 T24297: safesubst: works during normal parse
13370 !! wikitext
13371 {{SafeSubstTest}}
13372 !! html
13373 <p>Foobar
13374 </p>
13375 !! end
13376
13377 !! test
13378 subst: does not work during normal parse
13379 !! wikitext
13380 {{SubstTest}}
13381 !! html
13382 <p>{{subst:Includes}}
13383 </p>
13384 !! end
13385
13386 !! test
13387 pre-save transform: context links ("pipe trick")
13388 !! options
13389 pst
13390 !! wikitext
13391 [[Article (context)|]]
13392 [[Bar:Article|]]
13393 [[:Bar:Article|]]
13394 [[Bar:Article (context)|]]
13395 [[:Bar:Article (context)|]]
13396 [[|Article]]
13397 [[|Article (context)]]
13398 [[Bar:X (Y) Z|]]
13399 [[:Bar:X (Y) Z|]]
13400 !! html/php
13401 [[Article (context)|Article]]
13402 [[Bar:Article|Article]]
13403 [[:Bar:Article|Article]]
13404 [[Bar:Article (context)|Article]]
13405 [[:Bar:Article (context)|Article]]
13406 [[Article]]
13407 [[Article (context)]]
13408 [[Bar:X (Y) Z|X (Y) Z]]
13409 [[:Bar:X (Y) Z|X (Y) Z]]
13410 !! end
13411
13412 !! test
13413 pre-save transform: context links ("pipe trick") with interwiki prefix
13414 !! options
13415 pst
13416 !! wikitext
13417 [[interwiki:Article|]]
13418 [[:interwiki:Article|]]
13419 [[interwiki:Bar:Article|]]
13420 [[:interwiki:Bar:Article|]]
13421 !! html/php
13422 [[interwiki:Article|Article]]
13423 [[:interwiki:Article|Article]]
13424 [[interwiki:Bar:Article|Bar:Article]]
13425 [[:interwiki:Bar:Article|Bar:Article]]
13426 !! end
13427
13428 !! test
13429 pre-save transform: context links ("pipe trick") with parens in title
13430 !! options
13431 pst title=[[Somearticle (context)]]
13432 !! wikitext
13433 [[|Article]]
13434 !! html/php
13435 [[Article (context)|Article]]
13436 !! end
13437
13438 !! test
13439 pre-save transform: context links ("pipe trick") with comma in title
13440 !! options
13441 pst title=[[Someplace, Somewhere]]
13442 !! wikitext
13443 [[|Otherplace]]
13444 [[Otherplace, Elsewhere|]]
13445 [[Otherplace, Elsewhere, Anywhere|]]
13446 !! html/php
13447 [[Otherplace, Somewhere|Otherplace]]
13448 [[Otherplace, Elsewhere|Otherplace]]
13449 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
13450 !! end
13451
13452 !! test
13453 pre-save transform: context links ("pipe trick") with parens and comma
13454 !! options
13455 pst title=[[Someplace (IGNORED), Somewhere]]
13456 !! wikitext
13457 [[|Otherplace]]
13458 [[Otherplace (place), Elsewhere|]]
13459 !! html/php
13460 [[Otherplace, Somewhere|Otherplace]]
13461 [[Otherplace (place), Elsewhere|Otherplace]]
13462 !! end
13463
13464 !! test
13465 pre-save transform: context links ("pipe trick") with comma and parens
13466 !! options
13467 pst title=[[Who, me? (context)]]
13468 !! wikitext
13469 [[|Yes, you.]]
13470 [[Me, Myself, and I (1937 song)|]]
13471 !! html/php
13472 [[Yes, you. (context)|Yes, you.]]
13473 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
13474 !! end
13475
13476 !! test
13477 pre-save transform: context links ("pipe trick") with namespace
13478 !! options
13479 pst title=[[Ns:Somearticle]]
13480 !! wikitext
13481 [[|Article]]
13482 !! html/php
13483 [[Ns:Article|Article]]
13484 !! end
13485
13486 !! test
13487 pre-save transform: context links ("pipe trick") with namespace and parens
13488 !! options
13489 pst title=[[Ns:Somearticle (context)]]
13490 !! wikitext
13491 [[|Article]]
13492 !! html/php
13493 [[Ns:Article (context)|Article]]
13494 !! end
13495
13496 !! test
13497 pre-save transform: context links ("pipe trick") with namespace and comma
13498 !! options
13499 pst title=[[Ns:Somearticle, Context, Whatever]]
13500 !! wikitext
13501 [[|Article]]
13502 !! html/php
13503 [[Ns:Article, Context, Whatever|Article]]
13504 !! end
13505
13506 !! test
13507 pre-save transform: context links ("pipe trick") with namespace, comma and parens
13508 !! options
13509 pst title=[[Ns:Somearticle, Context (context)]]
13510 !! wikitext
13511 [[|Article]]
13512 !! html/php
13513 [[Ns:Article (context)|Article]]
13514 !! end
13515
13516 !! test
13517 pre-save transform: context links ("pipe trick") with namespace, parens and comma
13518 !! options
13519 pst title=[[Ns:Somearticle (IGNORED), Context]]
13520 !! wikitext
13521 [[|Article]]
13522 !! html/php
13523 [[Ns:Article, Context|Article]]
13524 !! end
13525
13526 !! test
13527 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, T32149)
13528 !! options
13529 pst
13530 !! wikitext
13531 [[Article(context)|]]
13532 [[Bar:Article(context)|]]
13533 [[:Bar:Article(context)|]]
13534 [[|Article(context)]]
13535 [[Bar:X(Y)Z|]]
13536 [[:Bar:X(Y)Z|]]
13537 !! html/php
13538 [[Article(context)|Article]]
13539 [[Bar:Article(context)|Article]]
13540 [[:Bar:Article(context)|Article]]
13541 [[Article(context)]]
13542 [[Bar:X(Y)Z|X(Y)Z]]
13543 [[:Bar:X(Y)Z|X(Y)Z]]
13544 !! end
13545
13546 !! test
13547 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, T32149)
13548 !! options
13549 pst
13550 !! wikitext
13551 [[Article (context)|]]
13552 [[Bar:Article (context)|]]
13553 [[:Bar:Article (context)|]]
13554 [[|Article (context)]]
13555 [[Bar:X (Y) Z|]]
13556 [[:Bar:X (Y) Z|]]
13557 !! html/php
13558 [[Article (context)|Article]]
13559 [[Bar:Article (context)|Article]]
13560 [[:Bar:Article (context)|Article]]
13561 [[Article (context)]]
13562 [[Bar:X (Y) Z|X (Y) Z]]
13563 [[:Bar:X (Y) Z|X (Y) Z]]
13564 !! end
13565
13566 !! test
13567 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, T32149)
13568 !! options
13569 pst
13570 !! wikitext
13571 [[Article(context)|]]
13572 [[Bar:Article(context)|]]
13573 [[:Bar:Article(context)|]]
13574 [[|Article(context)]]
13575 [[Bar:X(Y)Z|]]
13576 [[:Bar:X(Y)Z|]]
13577 !! html/php
13578 [[Article(context)|Article]]
13579 [[Bar:Article(context)|Article]]
13580 [[:Bar:Article(context)|Article]]
13581 [[Article(context)]]
13582 [[Bar:X(Y)Z|X(Y)Z]]
13583 [[:Bar:X(Y)Z|X(Y)Z]]
13584 !! end
13585
13586 !! test
13587 pre-save transform: context links ("pipe trick") with commas (T23660)
13588 !! options
13589 pst
13590 !! wikitext
13591 [[Article (context), context|]]
13592 [[Article (context),context|]]
13593 [[Bar:Article (context), context|]]
13594 [[Bar:Article (context),context|]]
13595 [[:Bar:Article (context), context|]]
13596 [[:Bar:Article (context),context|]]
13597 !! html/php
13598 [[Article (context), context|Article]]
13599 [[Article (context),context|Article]]
13600 [[Bar:Article (context), context|Article]]
13601 [[Bar:Article (context),context|Article]]
13602 [[:Bar:Article (context), context|Article]]
13603 [[:Bar:Article (context),context|Article]]
13604 !! end
13605
13606 !! test
13607 Parsoid: backwards pipe trick
13608 !! wikitext
13609 [[|'''bar''']]
13610 !! html/php
13611 <p>[[|<b>bar</b>]]
13612 </p>
13613 !! html/parsoid
13614 <p>[[|<b>bar</b>]]</p>
13615 !! end
13616
13617 !! test
13618 pre-save transform: trim trailing empty lines
13619 !! options
13620 pst
13621 !! wikitext
13622 Empty lines are trimmed
13623
13624
13625
13626
13627 !! html/php
13628 Empty lines are trimmed
13629 !! end
13630
13631 !! test
13632 pre-save transform: Signature expansion
13633 !! options
13634 pst
13635 !! wikitext
13636 * ~~~
13637 * ~~~~
13638 * ~~~~~
13639 * <noinclude>~~~</noinclude>
13640 * <includeonly>~~~</includeonly>
13641 * <onlyinclude>~~~</onlyinclude>
13642 !! html/php
13643 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
13644 * [[Special:Contributions/127.0.0.1|127.0.0.1]] 00:02, 1 January 1970 (UTC)
13645 * 00:02, 1 January 1970 (UTC)
13646 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
13647 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
13648 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
13649 !! end
13650
13651
13652 !! test
13653 ParserOutput flags from signature expansion (T84843)
13654 !! options
13655 pst
13656 showflags
13657 !! wikitext
13658 ~~~~
13659 !! html/php
13660 [[Special:Contributions/127.0.0.1|127.0.0.1]] 00:02, 1 January 1970 (UTC)
13661 flags=user-signature
13662 !! end
13663
13664
13665 !! test
13666 pre-save transform: Signature expansion in nowiki tags (T2093)
13667 !! options
13668 pst disabled
13669 !! wikitext
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 {{subst:Foo}} shall be converted to FOO
13681
13682 As well as inside noinclude/onlyinclude
13683 <noinclude>{{subst:Foo}}</noinclude>
13684 <onlyinclude>{{subst:Foo}}</onlyinclude>
13685
13686 But not inside includeonly
13687 <includeonly>{{subst:Foo}}</includeonly>
13688 !! html/php
13689 Shall not expand:
13690
13691 <nowiki>~~~~</nowiki>
13692
13693 <includeonly><nowiki>~~~~</nowiki></includeonly>
13694
13695 <noinclude><nowiki>~~~~</nowiki></noinclude>
13696
13697 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
13698
13699 FOO shall be converted to FOO
13700
13701 As well as inside noinclude/onlyinclude
13702 <noinclude>FOO</noinclude>
13703 <onlyinclude>FOO</onlyinclude>
13704
13705 But not inside includeonly
13706 <includeonly>{{subst:Foo}}</includeonly>
13707 !! end
13708
13709 !! test
13710 Parsoid: Recognize nowiki with trailing space in tags
13711 !! options
13712 parsoid=wt2html
13713 !! wikitext
13714 <nowiki ><div>[[foo]]</nowiki >
13715
13716 a<nowiki / >b
13717
13718 c<nowiki />d
13719
13720 e<nowiki/ >f
13721 !! html
13722 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
13723 <p>ab</p>
13724 <p>cd</p>
13725 <p>ef</p>
13726 !! end
13727
13728 !! test
13729 Parsoid: Recognize nowiki with odd capitalization
13730 !! options
13731 parsoid=wt2html
13732 !! wikitext
13733 <noWikI ><div>[[foo]]</Nowiki >
13734 !! html
13735 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
13736 !! end
13737
13738
13739 !! test
13740 Parsoid: Escape nowiki with trailing space in tags
13741 !! options
13742 parsoid=html2wt
13743 !! html/parsoid
13744 <p>&lt;nowiki &gt; foo &lt/nowiki ></p>
13745 <p>a&lt;nowiki /&gt;b</p>
13746 <p>c&lt;nowiki/ &gt;d</p>
13747 !! wikitext
13748 &lt;nowiki &gt; foo &lt;/nowiki &gt;
13749
13750 a&lt;nowiki /&gt;b
13751
13752 c&lt;nowiki/ &gt;d
13753 !! end
13754
13755 !! test
13756 Parsoid: Escape weird noWikI capitalizations
13757 !! options
13758 parsoid=html2wt
13759 !! html/parsoid
13760 <p>&lt;noWikI &gt; foo &lt/NoWikI ></p>
13761 !! wikitext
13762 &lt;noWikI &gt; foo &lt;/NoWikI &gt;
13763 !! end
13764
13765 ###
13766 ### Message transform tests
13767 ###
13768 !! test
13769 message transform: magic variables
13770 !! options
13771 msg
13772 !! wikitext
13773 {{SITENAME}}
13774 !! html
13775 MediaWiki
13776 !! end
13777
13778 !! test
13779 message transform: should not transform wiki markup
13780 !! options
13781 msg
13782 !! wikitext
13783 ''test''
13784 !! html
13785 ''test''
13786 !! end
13787
13788 !! test
13789 message transform: <noinclude> in transcluded template (T6926)
13790 !! options
13791 msg
13792 !! wikitext
13793 {{Includes}}
13794 !! html
13795 Foobar
13796 !! end
13797
13798 !! test
13799 message transform: <onlyinclude> in transcluded template (T6926)
13800 !! options
13801 msg
13802 !! wikitext
13803 {{Includes2}}
13804 !! html
13805 Foo
13806 !! end
13807
13808 !! test
13809 {{#special:}} page name, known
13810 !! options
13811 msg
13812 !! wikitext
13813 {{#special:Recentchanges}}
13814 !! html
13815 Special:RecentChanges
13816 !! end
13817
13818 !! test
13819 {{#special:}} page name with subpage, known
13820 !! options
13821 msg
13822 !! wikitext
13823 {{#special:Recentchanges/param}}
13824 !! html
13825 Special:RecentChanges/param
13826 !! end
13827
13828 !! test
13829 {{#special:}} page name, unknown
13830 !! options
13831 msg
13832 !! wikitext
13833 {{#special:foobar nonexistent}}
13834 !! html
13835 Special:Foobar nonexistent
13836 !! end
13837
13838 !! test
13839 {{#speciale:}} page name, known
13840 !! options
13841 msg
13842 !! wikitext
13843 {{#speciale:Recentchanges}}
13844 !! html
13845 Special:RecentChanges
13846 !! end
13847
13848 !! test
13849 {{#speciale:}} page name with subpage, known
13850 !! options
13851 msg
13852 !! wikitext
13853 {{#speciale:Recentchanges/param}}
13854 !! html
13855 Special:RecentChanges/param
13856 !! end
13857
13858 !! test
13859 {{#speciale:}} page name, unknown
13860 !! options
13861 msg
13862 !! wikitext
13863 {{#speciale:foobar nonexistent}}
13864 !! html
13865 Special:Foobar_nonexistent
13866 !! end
13867
13868 ###
13869 ### Images
13870 ###
13871 ### For Parsoid-specific tests, see
13872 #### https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
13873
13874 !! test
13875 Simple image
13876 !! options
13877 parsoid=wt2html,wt2wt,html2html
13878 !! wikitext
13879 [[Image:foobar.jpg]]
13880 !! html/php
13881 <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>
13882 </p>
13883 !! html/parsoid
13884 <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>
13885 !! end
13886
13887 !! test
13888 Simple image (using File: namespace, now canonical)
13889 !! wikitext
13890 [[File:Foobar.jpg]]
13891 !! html/php
13892 <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>
13893 </p>
13894 !! html/parsoid
13895 <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>
13896 !! end
13897
13898 !! test
13899 Right-aligned image
13900 !! wikitext
13901 [[File:Foobar.jpg|right]]
13902 !! html/php
13903 <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>
13904
13905 !! html/parsoid
13906 <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>
13907 !! end
13908
13909 !! test
13910 Image with caption
13911 !! wikitext
13912 [[File:Foobar.jpg|right|Caption text]]
13913 !! html/php
13914 <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>
13915
13916 !! html/parsoid
13917 <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>
13918 !! end
13919
13920 !! test
13921 Image with caption, T55312 #1
13922 !! wikitext
13923 [[File:Foobar.jpg|right|Caption page stuff]]
13924 !! html/php
13925 <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>
13926
13927 !! html/parsoid
13928 <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>
13929 !! end
13930
13931 !! test
13932 Image with caption, T55312 #2
13933 !! wikitext
13934 [[File:Foobar.jpg|right|Caption page=]]
13935 !! html/php
13936 <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>
13937
13938 !! html/parsoid
13939 <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>
13940 !! end
13941
13942 !! test
13943 Image with caption, T55312 #3
13944 !! wikitext
13945 [[File:Foobar.jpg|right|Caption page=stuff]]
13946 !! html/php
13947 <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>
13948
13949 !! html/parsoid
13950 <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>
13951 !! end
13952
13953 !! test
13954 Allow empty links in image captions (T62753)
13955 !! options
13956 thumbsize=220
13957 !! wikitext
13958 [[File:Foobar.jpg|thumb|Caption [[Link1]]
13959 [[]]
13960 [[Link2]]
13961 ]]
13962 !! html/php
13963 <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>
13964
13965 !! html/parsoid
13966 <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>
13967 [[]]
13968 <a rel="mw:WikiLink" href="./Link2" title="Link2" data-parsoid='{"stx":"simple","a":{"href":"./Link2"},"sa":{"href":"Link2"}}'>Link2</a>
13969 </figcaption></figure>
13970 !! end
13971
13972 !! test
13973 Titles in unlinked images (T23454)
13974 !! wikitext
13975 [[File:Foobar.jpg|link=|stuff]]
13976 !! html/php
13977 <p><img alt="stuff" src="http://example.com/images/3/3a/Foobar.jpg" title="stuff" width="1941" height="220" />
13978 </p>
13979 !! end
13980
13981 !! test
13982 Link with empty target
13983 !! wikitext
13984 [[]]
13985 !! html
13986 <p>[[]]
13987 </p>
13988 !! end
13989
13990 !! test
13991 Image with link trail
13992 !! wikitext
13993 Linktrails should not work for images: [[File:Foobar.jpg]]s
13994 !! html/php
13995 <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
13996 </p>
13997 !! html/parsoid
13998 <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>
13999 !! end
14000
14001 !! test
14002 Image with empty attribute
14003 !! options
14004 parsoid=wt2html,wt2wt,html2html
14005 !! wikitext
14006 [[File:Foobar.jpg|right||Caption text]]
14007 !! html/php
14008 <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>
14009
14010 !! html/parsoid
14011 <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>
14012 !! end
14013
14014 !! test
14015 1. Block image with individual attributes from templates
14016 !! wikitext
14017 [[File:Foobar.jpg|thumb|{{echo|137px}}|This is a caption]]
14018 !! html/php
14019 <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>
14020
14021 !! html/parsoid
14022 <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>
14023 !! end
14024
14025 !! test
14026 2. Block Image with individual attributes from templates
14027 !! wikitext
14028 [[File:Foobar.jpg|{{echo|thumb}}|{{echo|137px}}|This is a caption]]
14029 !! html/php
14030 <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>
14031
14032 !! html/parsoid
14033 <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>
14034 !! end
14035
14036 !! test
14037 3. Inline image with individual attributes from templates
14038 !! wikitext
14039 [[File:Foobar.jpg|{{echo|50px}}]]
14040 !! html/php
14041 <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>
14042 </p>
14043 !! html/parsoid
14044 <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>
14045 !! end
14046
14047 ## Parsoid does not provide editing support for images where templates produce multiple image attributes.
14048 ## To signal this, we add a 'mw:Placeholder' type to such images. This could change in the future.
14049 !! test
14050 Image with multiple attributes from the same template
14051 !! wikitext
14052 [[File:Foobar.jpg|{{image_attribs}}]]
14053 !! html/php
14054 <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>
14055
14056 !! html/parsoid
14057 <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>
14058 !! end
14059
14060 !! test
14061 Image with link tails
14062 !! options
14063 thumbsize=220
14064 !! wikitext
14065 123[[File:Foobar.jpg]]456
14066 123[[File:Foobar.jpg|right]]456
14067 123[[File:Foobar.jpg|thumb]]456
14068 !! html/php
14069 <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
14070 </p>
14071 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
14072 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
14073
14074 !! html/php+tidy
14075 <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>
14076 <p>123</p>
14077 <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>
14078 <p>456 123</p>
14079 <div class="thumb tright">
14080 <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>
14081 <div class="thumbcaption">
14082 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
14083 </div>
14084 </div>
14085 </div>
14086 <p>456</p>
14087 !! html/parsoid
14088 <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>
14089 <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>
14090 <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>
14091 !! end
14092
14093 !! test
14094 Image with multiple captions -- only last one is accepted
14095 !! wikitext
14096 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
14097 !! html/php
14098 <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>
14099
14100 !! html/parsoid
14101 <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>
14102 !! end
14103
14104 !! test
14105 Image with multiple widths -- use last
14106 !! wikitext
14107 [[File:Foobar.jpg|200px|300px|caption]]
14108 !! html/php
14109 <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>
14110 </p>
14111 !! html/parsoid
14112 <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>
14113 !! end
14114
14115 !! test
14116 Image with multiple alignments -- use first (T50664)
14117 !! options
14118 thumbsize=220
14119 !! wikitext
14120 [[File:Foobar.jpg|thumb|left|right|center|caption]]
14121
14122 [[File:Foobar.jpg|middle|text-top|caption]]
14123 !! html/php
14124 <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>
14125 <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>
14126 </p>
14127 !! html/parsoid
14128 <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>
14129 <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>
14130 !! end
14131
14132 !! test
14133 Image with width attribute at different positions
14134 !! wikitext
14135 [[File:Foobar.jpg|200px|right|Caption]]
14136 [[File:Foobar.jpg|right|200px|Caption]]
14137 [[File:Foobar.jpg|right|Caption|200px]]
14138 !! html/php
14139 <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>
14140 <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>
14141 <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>
14142
14143 !! html/parsoid
14144 <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>
14145 <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>
14146 <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>
14147 !! end
14148
14149 # a sad bit of backward-compatibility
14150 !! test
14151 Image with size specified with pxpx (T15500, T53628)
14152 !! options
14153 parsoid=wt2html,wt2wt,html2html
14154 !! wikitext
14155 [[File:Foobar.jpg|20pxpx]]
14156 [[File:Foobar.jpg|200x20pxpx]]
14157 !! html/php
14158 <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>
14159 <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>
14160 </p>
14161 !! html/parsoid
14162 <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>
14163 !! end
14164
14165 !! test
14166 Image with link parameter, wiki target
14167 !! wikitext
14168 [[File:Foobar.jpg|link=Main Page]]
14169 !! html/php
14170 <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>
14171 </p>
14172 !! html/parsoid
14173 <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>
14174 !! end
14175
14176 # parsoid T51293 (part 1)
14177 !! test
14178 Image with link parameter, URL target
14179 !! wikitext
14180 [[File:Foobar.jpg|link=http://example.com/]]
14181 !! html/php
14182 <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>
14183 </p>
14184 !! html/parsoid
14185 <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>
14186 !! end
14187
14188 # parsoid T51293 (part 2)
14189 !! test
14190 Image with link parameter, protocol-less URL target
14191 !! wikitext
14192 [[File:Foobar.jpg|link=//example.com/]]
14193 !! html/php
14194 <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>
14195 </p>
14196 !! html/parsoid
14197 <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>
14198 !! end
14199
14200 !! test
14201 Escaping non-block captions (T107435)
14202 !! options
14203 parsoid={
14204 "modes": ["wt2wt"],
14205 "changes": [
14206 ["[typeof~='mw:Image']", "attr", "data-mw", "{\"caption\": \"|\"}"]
14207 ]
14208 }
14209 !! wikitext
14210 [[Image:Foobar.jpg|caption]]
14211 !! wikitext/edited
14212 [[Image:Foobar.jpg|<nowiki>|</nowiki>]]
14213 !! end
14214
14215 # wgExternalLinkTarget not supported by Parsoid
14216 !! test
14217 Image with link parameter, wgExternalLinkTarget
14218 !! wikitext
14219 [[Image:foobar.jpg|link=http://example.com/]]
14220 !! config
14221 wgExternalLinkTarget='foobar'
14222 !! html/php
14223 <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>
14224 </p>
14225 !! end
14226
14227 !! test
14228 Image with link parameter, wgNoFollowLinks set to false
14229 !! wikitext
14230 [[Image:foobar.jpg|link=http://example.com/]]
14231 !! config
14232 wgNoFollowLinks=false
14233 !! html
14234 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
14235 </p>
14236 !! end
14237
14238 !! test
14239 Image with link parameter, wgNoFollowDomainExceptions
14240 !! wikitext
14241 [[Image:foobar.jpg|link=http://example.com/]]
14242 !! config
14243 wgNoFollowDomainExceptions='example.com'
14244 !! html
14245 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
14246 </p>
14247 !! end
14248
14249 # wgExternalLinkTarget not supported by Parsoid
14250 !! test
14251 Image with link parameter, wgExternalLinkTarget, unnamed parameter
14252 !! wikitext
14253 [[Image:foobar.jpg|link=http://example.com/|Title]]
14254 !! config
14255 wgExternalLinkTarget='foobar'
14256 !! html/php
14257 <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>
14258 </p>
14259 !! end
14260
14261 !! test
14262 Image with empty link parameter
14263 !! wikitext
14264 [[File:Foobar.jpg|link=]]
14265 !! html/php
14266 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
14267 </p>
14268 !! html/parsoid
14269 <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>
14270 !! end
14271
14272 !! test
14273 Image with link parameter (wiki target) and unnamed parameter
14274 !! wikitext
14275 [[File:Foobar.jpg|link=Main_Page|Title]]
14276 !! html/php
14277 <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>
14278 </p>
14279 !! html/parsoid
14280 <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>
14281 !! end
14282
14283 !! test
14284 Image with link parameter (URL target) and unnamed parameter
14285 !! wikitext
14286 [[File:Foobar.jpg|link=http://example.com/|Title]]
14287 !! html/php
14288 <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>
14289 </p>
14290 !! html/parsoid
14291 <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>
14292 !! end
14293
14294 !! test
14295 Thumbnail image with link parameter
14296 !! options
14297 thumbsize=220
14298 parsoid=wt2html,wt2wt,html2html
14299 !! wikitext
14300 [[File:Foobar.jpg|thumb|link=http://example.com/|Title]]
14301 !! html/php
14302 <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>
14303
14304 !! html/parsoid
14305 <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>
14306 !! end
14307
14308 !! test
14309 Manually-specified thumbnail image
14310 !! options
14311 thumbsize=220
14312 !! wikitext
14313 [[File:Foobar.jpg|thumbnail=Thumb.png|Title]]
14314 !! html/php
14315 <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>
14316
14317 !! html/parsoid
14318 <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>
14319 !! end
14320
14321 !! test
14322 Manually-specified thumbnail image with explicit link to wiki page
14323 !! options
14324 thumbsize=220
14325 parsoid=wt2html,wt2wt,html2html
14326 !! wikitext
14327 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|Title]]
14328 !! html/php
14329 <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>
14330
14331 !! html/parsoid
14332 <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>
14333 !! end
14334
14335 !! test
14336 Manually-specified thumbnail image with explicit link to url
14337 !! options
14338 thumbsize=220
14339 parsoid=wt2html,wt2wt,html2html
14340 !! wikitext
14341 [[File:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
14342 !! html/php
14343 <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>
14344
14345 !! html/parsoid
14346 <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>
14347 !! end
14348
14349 !! test
14350 Manually-specified thumbnail image with explicit no link
14351 !! options
14352 thumbsize=220
14353 parsoid=wt2html,wt2wt,html2html
14354 !! wikitext
14355 [[File:Foobar.jpg|thumb=Thumb.png|link=|Title]]
14356 !! html/php
14357 <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>
14358
14359 !! html/parsoid
14360 <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>
14361 !! end
14362
14363 !! test
14364 Manually-specified thumbnail image with explicit link and alt text
14365 !! options
14366 thumbsize=220
14367 parsoid=wt2html,wt2wt,html2html
14368 !! wikitext
14369 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|alt=alttext|Title]]
14370 !! html/php
14371 <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>
14372
14373 !! html/parsoid
14374 <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>
14375 !! end
14376
14377 !! test
14378 Image with frame and link
14379 !! options
14380 parsoid=wt2html,wt2wt,html2html
14381 !! wikitext
14382 [[File:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
14383 !! html/php
14384 <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>
14385
14386 !! html/parsoid
14387 <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>
14388 !! end
14389
14390 !! test
14391 Image with frame and link and explicit alt
14392 !! options
14393 parsoid=wt2html,wt2wt,html2html
14394 !! wikitext
14395 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
14396 !! html/php
14397 <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>
14398
14399 !! html/parsoid
14400 <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>
14401 !! end
14402
14403 !! test
14404 Image with wiki markup in implicit alt
14405 !! wikitext
14406 [[Image:Foobar.jpg|testing '''bold''' in alt]]
14407
14408 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
14409 !! html/php
14410 <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>
14411 </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>
14412 </p>
14413 !! html/parsoid
14414 <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>
14415
14416 <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>
14417 !! end
14418
14419 !! test
14420 Alt image option should handle most kinds of wikitext without barfing
14421 !! wikitext
14422 [[Image:Foobar.jpg|thumb|This is the image caption|alt=This is a [[link]] and a {{echo|''bold template''}}.]]
14423 !! html/php
14424 <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>
14425
14426 !! html/parsoid
14427 <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>
14428 !! end
14429
14430 ###################
14431 # Conflicting image format options.
14432 # First option specified should 'win'.
14433 # All three cases in each test should be identical.
14434
14435 !! test
14436 Image with 'frameless' first.
14437 !! options
14438 parsoid=wt2html,wt2wt,html2html
14439 !! wikitext
14440 [[File:Foobar.jpg|frameless|caption]]
14441
14442 [[File:Foobar.jpg|frameless|frame|caption]]
14443
14444 [[File:Foobar.jpg|frameless|thumb|caption]]
14445 !! html/php
14446 <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>
14447 </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>
14448 </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>
14449 </p>
14450 !! html/parsoid
14451 <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>
14452 <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>
14453 <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>
14454 !! end
14455
14456 !! test
14457 Image with 'frame' first.
14458 !! options
14459 parsoid=wt2html,wt2wt,html2html
14460 !! wikitext
14461 [[File:Foobar.jpg|frame|caption]]
14462 [[File:Foobar.jpg|frame|frameless|caption]]
14463 [[File:Foobar.jpg|frame|thumb|caption]]
14464 !! html/php
14465 <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>
14466 <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>
14467 <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>
14468
14469 !! html/parsoid
14470 <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>
14471 <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>
14472 <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>
14473 !! end
14474
14475 !! test
14476 Image with 'thumb' first.
14477 !! options
14478 parsoid=wt2html,wt2wt,html2html
14479 !! wikitext
14480 [[File:Foobar.jpg|thumb|caption]]
14481 [[File:Foobar.jpg|thumb|frameless|caption]]
14482 [[File:Foobar.jpg|thumb|frame|caption]]
14483 !! html/php
14484 <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>
14485 <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>
14486 <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>
14487
14488 !! html/parsoid
14489 <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>
14490 <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>
14491 <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>
14492 !! end
14493
14494 ###################
14495 # Image sizing.
14496 # See https://www.mediawiki.org/wiki/Help:Images#Size_and_frame
14497 # and https://phabricator.wikimedia.org/T64258
14498 # Foobar has actual size of 1941x220
14499 # 1. Thumbs & frameless always reduce, can't be enlarged unless it's
14500 # a scalable format.
14501 # 2. Framed images always ignore size options; always render at default size.
14502 # 3. "Unspecified format" and border are the only types which can be
14503 # enlarged.
14504
14505 !! test
14506 Image: "unspecified format" and border enlarge
14507 !! options
14508 parsoid=wt2html,wt2wt,html2html
14509 !! wikitext
14510 [[File:Foobar.jpg|2000px]]
14511
14512 [[File:Foobar.jpg|border|2000px]]
14513 !! html/php
14514 <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>
14515 </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>
14516 </p>
14517 !! html/parsoid
14518 <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>
14519 <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>
14520 !! end
14521
14522 !! test
14523 Image: "unspecified format" and border reduce
14524 !! options
14525 parsoid=wt2html,wt2wt,html2html
14526 !! wikitext
14527 [[File:Foobar.jpg|1000px]]
14528
14529 [[File:Foobar.jpg|border|1000px]]
14530 !! html/php
14531 <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>
14532 </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>
14533 </p>
14534 !! html/parsoid
14535 <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>
14536 <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>
14537 !! end
14538
14539 !! test
14540 Image: thumbs reduce
14541 !! options
14542 parsoid=wt2html,wt2wt,html2html
14543 !! wikitext
14544 [[File:Foobar.jpg|thumb|50px]]
14545 !! html/php
14546 <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>
14547
14548 !! html/parsoid
14549 <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>
14550 !! end
14551
14552 !! test
14553 Image: bitmap thumbs can't be enlarged past original size, but vector can.
14554 !! options
14555 parsoid=wt2html,wt2wt,html2html
14556 !! wikitext
14557 [[File:Foobar.jpg|thumb|2000px]]
14558
14559 [[File:Foobar.svg|thumb|2000px]]
14560 !! html/php
14561 <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>
14562 <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>
14563
14564 !! html/parsoid
14565 <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>
14566 <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>
14567 !! end
14568
14569 !! test
14570 Image: frameless can reduce in size
14571 !! options
14572 parsoid=wt2html,wt2wt,html2html
14573 !! wikitext
14574 [[File:Foobar.jpg|frameless|50px]]
14575 !! html/php
14576 <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>
14577 </p>
14578 !! html/parsoid
14579 <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>
14580 !! end
14581
14582 !! test
14583 Image: bitmap frameless can't be enlarged past original size, but vector can
14584 !! options
14585 parsoid=wt2html,wt2wt,html2html
14586 !! wikitext
14587 [[File:Foobar.jpg|frameless|2000px]]
14588
14589 [[File:Foobar.svg|frameless|2000px]]
14590 !! html/php
14591 <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>
14592 </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>
14593 </p>
14594 !! html/parsoid
14595 <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>
14596 <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>
14597 !! end
14598
14599 !! test
14600 Image: framed images are always unscaled.
14601 !! options
14602 parsoid=wt2html,wt2wt,html2html
14603 !! wikitext
14604 [[File:Foobar.jpg|frame]]
14605
14606 [[File:Foobar.jpg|frame|50px]]
14607
14608 [[File:Foobar.jpg|frame|50x50px]]
14609
14610 [[File:Foobar.jpg|frame|2000px]]
14611 !! html/php
14612 <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>
14613 <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>
14614 <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>
14615 <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>
14616
14617 !! html/parsoid
14618 <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>
14619 <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>
14620 <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>
14621 <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>
14622 !! end
14623
14624 ###################
14625
14626 !! test
14627 Link to image page- image page normally doesn't exists, hence edit link
14628 Add test with existing image page
14629 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
14630 !! wikitext
14631 [[:Image:test]]
14632 !! html
14633 <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>
14634 </p>
14635 !! end
14636
14637 !! test
14638 T20784 Link to non-existent image page with caption should use caption as link text
14639 !! wikitext
14640 [[:Image:test|caption]]
14641 !! html
14642 <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>
14643 </p>
14644 !! end
14645
14646 !! test
14647 Frameless image caption with a free URL
14648 !! wikitext
14649 [[File:Foobar.jpg|http://example.com]]
14650 !! html/php
14651 <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>
14652 </p>
14653 !! html/parsoid
14654 <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>
14655 !! end
14656
14657 !! test
14658 Thumbnail image caption with a free URL
14659 !! options
14660 thumbsize=220
14661 !! wikitext
14662 [[File:Foobar.jpg|thumb|http://example.com]]
14663 !! html/php
14664 <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>
14665
14666 !! html/parsoid
14667 <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>
14668 !! end
14669
14670 !! test
14671 Thumbnail image caption with a free URL and explicit alt
14672 !! options
14673 thumbsize=220
14674 parsoid=wt2html,wt2wt,html2html
14675 !! wikitext
14676 [[File:Foobar.jpg|thumb|http://example.com|alt=Alteration]]
14677 !! html/php
14678 <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>
14679
14680 !! html/parsoid
14681 <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>
14682 !! end
14683
14684 !! test
14685 SVG thumbnails with no language set
14686 !! options
14687 !! wikitext
14688 [[File:Foobar.svg|thumb|caption]]
14689 !! html/php
14690 <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>
14691
14692 !! html/parsoid
14693 <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>
14694 !! end
14695
14696 !! test
14697 SVG thumbnails with language de
14698 !! options
14699 parsoid=wt2html,wt2wt,html2html
14700 !! wikitext
14701 [[File:Foobar.svg|thumb|caption|lang=de]]
14702 !! html/php
14703 <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>
14704
14705 !! html/parsoid
14706 <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>
14707 !! end
14708
14709 !! test
14710 SVG thumbnails with invalid language code
14711 !! options
14712 parsoid=wt2html,wt2wt,html2html
14713 !! wikitext
14714 [[File:Foobar.svg|thumb|caption|lang=invalid.language.code]]
14715 !! html/php
14716 <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>
14717
14718 !! html/parsoid
14719 <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>
14720 !! end
14721
14722 !! test
14723 T3887: A ISBN with a thumbnail
14724 !! wikitext
14725 [[File:Foobar.jpg|thumb|ISBN 1235467890]]
14726 !! html/php
14727 <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>
14728
14729 !! html/parsoid
14730 <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>
14731 !! end
14732
14733 !! test
14734 T3887: A RFC with a thumbnail
14735 !! wikitext
14736 [[File:Foobar.jpg|thumb|This is RFC 12354]]
14737 !! html/php
14738 <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>
14739
14740 !! html/parsoid
14741 <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>
14742 !! end
14743
14744 !! test
14745 T3887: A mailto link with a thumbnail
14746 !! wikitext
14747 [[File:Foobar.jpg|thumb|Please mailto:nobody@example.com]]
14748 !! html/php
14749 <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>
14750
14751 !! html/parsoid
14752 <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>
14753 !! end
14754
14755 # Pending resolution to T2368
14756 !! test
14757 T2648: Frameless image caption with a link
14758 !! wikitext
14759 [[File:Foobar.jpg|text with a [[link]] in it]]
14760 !! html/php
14761 <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>
14762 </p>
14763 !! html/parsoid
14764 <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>
14765 !! end
14766
14767 !! test
14768 T2648: Frameless image caption with a link (suffix)
14769 !! wikitext
14770 [[File:Foobar.jpg|text with a [[link]]foo in it]]
14771 !! html/php
14772 <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>
14773 </p>
14774 !! html/parsoid
14775 <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>
14776 !! end
14777
14778 !! test
14779 T2648: Frameless image caption with an interwiki link
14780 !! wikitext
14781 [[File:Foobar.jpg|text with a [[MeatBall:Link]] in it]]
14782 !! html/php
14783 <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>
14784 </p>
14785 !! html/parsoid
14786 <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>
14787 !! end
14788
14789 !! test
14790 T2648: Frameless image caption with a piped interwiki link
14791 !! wikitext
14792 [[File:Foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
14793 !! html/php
14794 <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>
14795 </p>
14796 !! html/parsoid
14797 <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>
14798 !! end
14799
14800 !! test
14801 T107474: Frameless image caption with <nowiki>
14802 !! wikitext
14803 [[File:Foobar.jpg|<nowiki>text with a [[MeatBall:Link|link]] in it</nowiki>]]
14804 !! html/parsoid
14805 <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>
14806 !! end
14807
14808 !! test
14809 Escape HTML special chars in image alt text
14810 !! wikitext
14811 [[File:Foobar.jpg|& < > "]]
14812 !! html/php
14813 <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>
14814 </p>
14815 !! html/parsoid
14816 <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>
14817 !! end
14818
14819 !! test
14820 Escape HTML special chars in image alt text with LanguageConverter
14821 !! options
14822 language=zh
14823 !! wikitext
14824 [[File:Foobar.jpg|& < > "]]
14825 !! html/php
14826 <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>
14827 </p>
14828 !! html/parsoid
14829 <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>
14830 !! end
14831
14832 !! test
14833 Entities in file name and attributes
14834 !! wikitext
14835 [[File:7%25 solution.gif|manualthumb=7%25 solution.gif|link=7%25 solution|[[7%25 solution]]]]
14836 !! html/php
14837 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=7%25_solution.gif" class="new" title="File:7% solution.gif">7% solution</a>
14838 </p>
14839 !! html/parsoid
14840 <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>
14841 !! end
14842
14843 !! test
14844 T2499: Alt text should have &#1234;, not &amp;1234;
14845 !! wikitext
14846 [[File:Foobar.jpg|&#9792;]]
14847 !! html/php
14848 <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>
14849 </p>
14850 !! html/parsoid
14851 <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>
14852 !! end
14853
14854 !! test
14855 Broken image caption with link
14856 !! options
14857 parsoid=wt2html,wt2wt,html2html
14858 !! wikitext
14859 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
14860 !! html/php
14861 <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.
14862 </p>
14863 !! html/parsoid
14864 <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>
14865 !! end
14866
14867 !! test
14868 Image caption containing another image
14869 !! wikitext
14870 [[File:Foobar.jpg|thumb|This is a caption with another [[File:Thumb.png|image]] inside it!]]
14871 !! html/php
14872 <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>
14873
14874 !! html/parsoid
14875 <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>
14876 !! end
14877
14878 !! test
14879 Image: caption containing a newline
14880 !! wikitext
14881 [[File:Foobar.jpg|This
14882 *is some text]]
14883 !! html/php
14884 <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>
14885 </p>
14886 !! html/parsoid
14887 <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>
14888 !!end
14889
14890 !!test
14891 Image: caption containing leading space
14892 (The leading space should not trigger nowiki escaping in wt2wt mode)
14893 !! wikitext
14894 [[File:Foobar.jpg|thumb| bar]]
14895 !! html/php
14896 <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>
14897
14898 !! html/parsoid
14899 <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>
14900 !!end
14901
14902 !! test
14903 Image: caption containing a table
14904 !! options
14905 parsoid=wt2html,wt2wt,html2html
14906 !! wikitext
14907 [[Image:Foobar.jpg|thumb|200px|This is an example image thumbnail caption with a table
14908 {|
14909 ! Foo !! Bar
14910 |-
14911 | Foo1 || Bar1
14912 |}
14913 and some more text.]]
14914 !! html/php
14915 <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>
14916
14917 !! html/parsoid
14918 <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
14919 <table>
14920 <tbody>
14921 <tr><th>Foo </th><th>Bar</th></tr>
14922 <tr>
14923 <td>Foo1 </td>
14924 <td>Bar1</td></tr></tbody></table>and some more text.</figcaption></figure>
14925 !! end
14926
14927 !! test
14928 T5090: External links other than http: in image captions
14929 !! wikitext
14930 [[File:Foobar.jpg|thumb|200x200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
14931 !! html/php
14932 <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>
14933
14934 !! html/parsoid
14935 <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>
14936 !! end
14937
14938 !! test
14939 Custom class
14940 !! options
14941 parsoid=wt2html,wt2wt,html2html
14942 !! wikitext
14943 [[Image:foobar.jpg|a|class=b]]
14944 !! html/php
14945 <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>
14946 </p>
14947 !! html/parsoid
14948 <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>
14949 !! end
14950
14951 !! test
14952 Localized image handling (1).
14953 !! options
14954 parsoid=wt2html,wt2wt,html2html
14955 language=es
14956 !! wikitext
14957 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
14958 !! html/php
14959 <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>
14960
14961 !! html/parsoid
14962 <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>
14963 !! end
14964
14965 !! test
14966 Localized image handling (2).
14967 !! options
14968 thumbsize=220
14969 parsoid=wt2html,wt2wt,html2html
14970 language=es
14971 !! wikitext
14972 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
14973 !! html/php
14974 <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>
14975
14976 !! html/parsoid
14977 <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>
14978 !! end
14979
14980 !! test
14981 Localized image handling (3).
14982 !! options
14983 language=fa
14984 parsoid=html2wt
14985 !! html/parsoid
14986 <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>
14987 !! wikitext
14988 [[File:Foobar.jpg|بندانگشتی]]
14989 !! end
14990
14991 !! test
14992 "border", "frameless" and "class" attributes on an image.
14993 !! options
14994 thumbsize=220
14995 parsoid=wt2html,wt2wt,html2html
14996 !! wikitext
14997 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
14998 !! html/php
14999 <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>
15000 </p>
15001 !! html/parsoid
15002 <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>
15003 !! end
15004
15005 # Note that 'right' is the default alignment, despite the misspelled 'righ' below
15006 !! test
15007 Invalid image attributes (T64500)
15008 !! options
15009 thumbsize=220
15010 parsoid=wt2html,wt2wt,html2html
15011 !! wikitext
15012 [[File:Foobar.jpg|thumb|float|left|caption]]
15013
15014 [[File:Foobar.jpg|thumb|righ|caption]]
15015
15016 [[File:Foobar.jpg|bogus1|thumb|bogus2|left|bogus3|caption]]
15017 !! html/php
15018 <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>
15019 <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>
15020 <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>
15021
15022 !! html/parsoid
15023 <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>
15024 <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>
15025 <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>
15026 !! end
15027
15028 !! article
15029 File:Barfoo.jpg
15030 !! text
15031 #REDIRECT [[File:Barfoo.jpg]]
15032 !! endarticle
15033
15034 # FIXME: Parsoid should run this test -- but we'd need to teach the
15035 # mockAPI about the redirected Barfoo.jpg image.
15036 !! test
15037 Redirected image
15038 !! wikitext
15039 [[Image:Barfoo.jpg]]
15040 !! html/php
15041 <p><a href="/wiki/File:Barfoo.jpg" class="mw-redirect" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
15042 </p>
15043 !! end
15044
15045 !! test
15046 Missing image with uploads disabled
15047 !! options
15048 wgEnableUploads=0
15049 !! wikitext
15050 [[File:Foobaz.jpg]]
15051 !! html/php
15052 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
15053 </p>
15054 !! html/parsoid
15055 <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>
15056 !! end
15057
15058 # Parsoid-specific testing for images
15059 # https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
15060 # Currently imperfect due to a flaw in the Parsoid testrunner
15061 # Work in progress
15062 # THESE TESTS SHOULD BE MOVED UP and merged with the php-specific
15063 # image tests.
15064
15065 !! test
15066 Parsoid-specific image handling - simple image with size and middle alignment
15067 !! wikitext
15068 [[File:Foobar.jpg|middle|50px]]
15069 !! html/parsoid
15070 <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>
15071 !! end
15072
15073 !! test
15074 Parsoid-specific image handling - simple image with size, middle alignment,
15075 non-standard namespace alias
15076 !! options
15077 parsoid=wt2wt,wt2html,html2html
15078 !! wikitext
15079 [[Image:Foobar.jpg|middle|50px]]
15080 !! html/parsoid
15081 <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>
15082 !! end
15083
15084 !! test
15085 Parsoid-specific image handling - simple image with size and middle alignment
15086 (existing content)
15087 !! wikitext
15088 [[File:Foobar.jpg|50px|middle]]
15089 !! html/parsoid
15090 <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>
15091 !! end
15092
15093 !! test
15094 Parsoid-specific image handling - simple image with size and middle alignment
15095 and non-standard namespace name
15096 !! options
15097 parsoid=wt2html,wt2wt,html2html
15098 !! wikitext
15099 [[Image:Foobar.jpg|50px|middle]]
15100 !! html/parsoid
15101 <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>
15102 !! end
15103
15104 !! test
15105 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
15106 !! wikitext
15107 [[File:Foobar.jpg|500x10px|baseline|caption]]
15108 !! html/parsoid
15109 <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>
15110 !! end
15111
15112 !! test
15113 Parsoid-specific image handling - simple image with border and size spec
15114 !! wikitext
15115 [[File:Foobar.jpg|50px|border|caption]]
15116 !! html/parsoid
15117 <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>
15118 !! end
15119
15120 !! test
15121 Parsoid-specific image handling - thumbnail with halign, valign, and caption
15122 !! wikitext
15123 [[File:Foobar.jpg|left|baseline|thumb|caption content]]
15124 !! html/parsoid
15125 <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>
15126 !! end
15127
15128 !! test
15129 Parsoid-specific image handling - thumbnail with halign, valign, and caption
15130 (existing content)
15131 !! wikitext
15132 [[File:Foobar.jpg|thumb|left|baseline|caption content]]
15133 !! html/parsoid
15134 <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>
15135 !! end
15136
15137 !! test
15138 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
15139 !! wikitext
15140 [[Image:Foobar.jpg|right|middle|thumb|50x50px|caption]]
15141 !! html/parsoid
15142 <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>
15143 !! end
15144
15145 !! test
15146 Parsoid-specific image handling - thumbnail with specific size, halign,
15147 valign, and caption (existing content)
15148 !! wikitext
15149 [[File:Foobar.jpg|thumb|50x50px|right|middle|caption]]
15150 !! html/parsoid
15151 <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>
15152 !! end
15153
15154 !! test
15155 Parsoid-specific image handling - framed image with specific size and caption
15156 (size is ignored)
15157 !! options
15158 parsoid=wt2html,wt2wt,html2html
15159 !! wikitext
15160 [[File:Foobar.jpg|frame|500x50px|caption]]
15161 !! html/parsoid
15162 <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>
15163 !! end
15164
15165 !! test
15166 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption
15167 (size is ignored)
15168 !! options
15169 parsoid=wt2html,wt2wt,html2html
15170 !! wikitext
15171 [[File:Foobar.jpg|left|baseline|frame|500x50px|caption]]
15172 !! html/parsoid
15173 <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>
15174 !! end
15175
15176 !! test
15177 Parsoid-specific image handling - frameless image with specific size, border, and caption
15178 !! wikitext
15179 [[File:Foobar.jpg|frameless|442x50px|border|caption]]
15180 !! html/parsoid
15181 <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>
15182 !! end
15183
15184 !! test
15185 Parsoid-specific image handling - simple image with a formatted caption
15186 !! wikitext
15187 [[File:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
15188 !! html/parsoid
15189 <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>
15190 !! end
15191
15192 !! test
15193 Parsoid-specific image handling - caption with a template in it
15194 !! wikitext
15195 [[File:Foobar.jpg|thumb|200x23px|This caption has a {{echo|transclusion}} in it.]]
15196 !! html/parsoid
15197 <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>
15198 !! end
15199
15200 !! test
15201 Parsoid-specific image handling - caption with unbalanced tags in it
15202 !! options
15203 parsoid=wt2html,wt2wt,html2html
15204 !! wikitext
15205 foo
15206 [[File:Foobar.jpg|thumb|200x200px|This caption has a <center>unbalanced tag in it.]]
15207 bar
15208 !! html/parsoid
15209 <p>foo</p>
15210 <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>
15211 <p>bar</p>
15212 !! end
15213
15214 !! test
15215 Parsoid-specific image handling - empty caption (1)
15216 !! options
15217 parsoid=wt2html,wt2wt
15218 !! wikitext
15219 [[File:Foobar.jpg|thumb|]]
15220 !! html/parsoid
15221 <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>
15222 !! end
15223
15224 # empty captions don't get serialized unless we're in the "round trip" case
15225 !! test
15226 Parsoid-specific image handling - empty caption (2)
15227 !! options
15228 parsoid=html2wt
15229 !! html/parsoid
15230 <figure class="mw-default-size" typeof="mw:Image/Thumb">
15231 <a href="./File:Foobar.jpg">
15232 <img resource="./File:Foobar.jpg"
15233 src="//example.com/images/3/3a/Foobar.jpg"
15234 data-file-width="1941" data-file-height="220" data-file-type="bitmap"
15235 height="25" width="220"/>
15236 </a>
15237 <figcaption></figcaption>
15238 </figure>
15239 !! wikitext
15240 [[File:Foobar.jpg|thumb]]
15241 !! end
15242
15243 !! test
15244 Parsoid-specific image handling - whitespace caption
15245 !! wikitext
15246 [[File:Foobar.jpg|thumb| ]]
15247 !! html/parsoid
15248 <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>
15249 !! end
15250
15251 !! test
15252 Parsoid-specific image handling - lang option
15253 !! wikitext
15254 foo
15255 [[File:Foobar.svg|lang=de|caption]]
15256 bar
15257 !! html/parsoid
15258 <p>foo
15259 <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>
15260 bar</p>
15261 !! end
15262
15263 ## Edge case bugs in Parsoid from T93580
15264 !! test
15265 T93580: 1. Templated <ref> inside block images
15266 !! wikitext
15267 [[File:Foobar.jpg|thumb|Caption with templated ref: {{echo|<ref>foo</ref>}}]]
15268
15269 <references />
15270 !! html/parsoid
15271 <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>
15272
15273 <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>
15274 !! end
15275
15276 !! test
15277 T93580: 2. <ref> inside inline images
15278 !! wikitext
15279 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: <ref>foo</ref>]]
15280
15281 <references />
15282 !! html/parsoid
15283 <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>
15284
15285 <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>
15286 !! end
15287
15288 !! test
15289 T93580: 3. Templated <ref> inside inline images
15290 !! wikitext
15291 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: {{echo|<ref>{{echo|foo}}</ref>}}]]
15292
15293 <references />
15294 !! html/parsoid
15295 <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>
15296
15297 <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>
15298 !! end
15299
15300 ###
15301 ### Subpages
15302 ###
15303 !! article
15304 Subpage test/subpage
15305 !! text
15306 foo
15307 !! endarticle
15308
15309 !! test
15310 Subpage link
15311 !! options
15312 subpage title=[[Subpage test]]
15313 !! wikitext
15314 [[/subpage]]
15315 !! html
15316 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
15317 </p>
15318 !! end
15319
15320 !! test
15321 Subpage noslash link
15322 !! options
15323 subpage title=[[Subpage test]]
15324 !! wikitext
15325 [[/subpage/]]
15326 !! html
15327 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
15328 </p>
15329 !! end
15330
15331 !! article
15332 Subpage test/1/2/subpage
15333 !! text
15334 blah
15335 !! endarticle
15336
15337 !! test
15338 Relative subpage noslash link
15339 !! options
15340 parsoid=wt2wt,wt2html,html2html
15341 subpage title=[[Subpage test/1/2/3/4]]
15342 !! wikitext
15343 [[../../subpage/]]
15344
15345 [[../../subpage]]
15346 !! html/php
15347 <p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a>
15348 </p><p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage test/1/2/subpage</a>
15349 </p>
15350 !! html/parsoid
15351 <p><a rel="mw:WikiLink" href="./Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a></p>
15352 <p><a rel="mw:WikiLink" href="./Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
15353 !! end
15354
15355 !! test
15356 Parsoid: dot-slash prefixed wikilinks
15357 !! wikitext
15358 [[./foo]]
15359
15360 [[././bar]]
15361
15362 [[././baz/]]
15363 !! html/php
15364 <p>[[./foo]]
15365 </p><p>[[././bar]]
15366 </p><p>[[././baz/]]
15367 </p>
15368 !! html/parsoid
15369 <p>[[./foo]]
15370 </p><p>[[././bar]]
15371 </p><p>[[././baz/]]
15372 </p>
15373 !! end
15374
15375 !! test
15376 Render invalid page names as plain text (T53090)
15377 !! wikitext
15378 [[./../foo|bar]]
15379 [[foo�|bar]]
15380 [[foo/.|bar]]
15381 [[foo/..|bar]]
15382 [[foo~~~bar]]
15383 [[foo>bar]]
15384 [[foo[bar]]
15385 [[.]]
15386 [[..]]
15387 [[foo././bar]]
15388 [[foo[http://example.com]xyz]]
15389
15390 [[{{echo|./../foo}}|bar]]
15391 [[{{echo|foo/.}}|bar]]
15392 [[{{echo|foo/..}}|bar]]
15393 [[{{echo|foo~~~~bar}}]]
15394 [[{{echo|foo>bar}}]]
15395 [[{{echo|foo././bar}}]]
15396 [[{{echo|foo{bar}}]]
15397 [[{{echo|foo}bar}}]]
15398 [[{{echo|foo[bar}}]]
15399 [[{{echo|foo]bar}}]]
15400 [[{{echo|foo<bar}}]]
15401 !!html/php
15402 <p>[[./../foo|bar]]
15403 [[foo�|bar]]
15404 [[foo/.|bar]]
15405 [[foo/..|bar]]
15406 [[foo~~~bar]]
15407 [[foo&gt;bar]]
15408 [[foo[bar]]
15409 [[.]]
15410 [[..]]
15411 [[foo././bar]]
15412 [[foo<a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>xyz]]
15413 </p><p>[[./../foo|bar]]
15414 [[foo/.|bar]]
15415 [[foo/..|bar]]
15416 [[foo~~~~bar]]
15417 [[foo&gt;bar]]
15418 [[foo././bar]]
15419 [[foo{bar]]
15420 [[foo}bar]]
15421 [[foo[bar]]
15422 [[foo]bar]]
15423 [[foo&lt;bar]]
15424 </p>
15425 !!html/parsoid
15426 <p>[[./../foo|bar]]
15427 [[foo�|bar]]
15428 [[foo/.|bar]]
15429 [[foo/..|bar]]
15430 [[foo~~~bar]]
15431 [[foo>bar]]
15432 [[foo[bar]]
15433 [[.]]
15434 [[..]]
15435 [[foo././bar]]
15436 [[foo<a rel="mw:ExtLink" href="http://example.com"></a>xyz]]</p>
15437
15438 <p>[[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"./../foo"}},"i":0}}]}'>./../foo</span>|bar]]
15439 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/."}},"i":0}}]}'>foo/.</span>|bar]]
15440 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/.."}},"i":0}}]}'>foo/..</span>|bar]]
15441 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo~~~~bar"}},"i":0}}]}'>foo~~~~bar</span>]]
15442 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo>bar"}},"i":0}}]}'>foo>bar</span>]]
15443 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo././bar"}},"i":0}}]}'>foo././bar</span>]]
15444 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo{bar"}},"i":0}}]}'>foo{bar</span>]]
15445 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo}bar"}},"i":0}}]}'>foo}bar</span>]]
15446 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo[bar"}},"i":0}}]}'>foo[bar</span>]]
15447 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo]bar"}},"i":0}}]}'>foo]bar</span>]]
15448 [[<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>
15449 !!end
15450
15451 !! test
15452 Disabled subpages
15453 !! wikitext
15454 [[/subpage]]
15455 !! html
15456 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
15457 </p>
15458 !! end
15459
15460 !! test
15461 T2561: {{/Subpage}}
15462 !! options
15463 subpage title=[[Page]]
15464 !! wikitext
15465 {{/Subpage}}
15466 !! html
15467 <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>
15468 </p>
15469 !! end
15470
15471 ###
15472 ### Categories
15473 ###
15474 !! article
15475 Category:MediaWiki User's Guide
15476 !! text
15477 blah
15478 !! endarticle
15479
15480 !! test
15481 Link to category
15482 !! wikitext
15483 [[:Category:MediaWiki User's Guide]]
15484 !! html
15485 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
15486 </p>
15487 !! end
15488
15489 !! test
15490 Simple category
15491 !! options
15492 cat
15493 !! wikitext
15494 [[Category:MediaWiki User's Guide]]
15495 !! html/php
15496 cat=MediaWiki_User's_Guide sort=
15497 !! html/parsoid
15498 <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"}}'/>
15499 !! end
15500
15501 !! test
15502 PAGESINCATEGORY invalid title fatal (r33546 fix)
15503 !! wikitext
15504 {{PAGESINCATEGORY:<bogus>}}
15505 !! html
15506 <p>0
15507 </p>
15508 !! end
15509
15510 !! test
15511 Category with different sort key
15512 !! options
15513 cat
15514 !! wikitext
15515 [[Category:MediaWiki User's Guide|Foo]]
15516 !! html/php
15517 cat=MediaWiki_User's_Guide sort=Foo
15518 !! html/parsoid
15519 <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"}}'/>
15520 !! end
15521
15522 !! test
15523 Category with identical sort key
15524 !! options
15525 cat
15526 !! wikitext
15527 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
15528 !! html/php
15529 cat=MediaWiki_User's_Guide sort=MediaWiki User's Guide
15530 !! html/parsoid
15531 <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"}}'/>
15532 !! end
15533
15534 !! test
15535 Category with empty sort key
15536 !! options
15537 cat
15538 pst
15539 !! wikitext
15540 [[Category:MediaWiki User's Guide|]]
15541 !! html/php
15542 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
15543 !! end
15544
15545 !! test
15546 Category with empty sort key and parentheses
15547 !! options
15548 cat
15549 pst
15550 !! wikitext
15551 [[Category:Foo (bar)|]]
15552 !! html/php
15553 [[Category:Foo (bar)|Foo]]
15554 !! end
15555
15556 !! test
15557 Category with link tail
15558 !! options
15559 cat
15560 pst
15561 !! wikitext
15562 123[[Category:Foo]]456
15563 !! html/php
15564 123[[Category:Foo]]456
15565 !! end
15566
15567 !! test
15568 Category with template
15569 !! options
15570 cat
15571 pst
15572 !! wikitext
15573 [[Category:{{echo|Foo}}]]
15574 !! html/php
15575 [[Category:{{echo|Foo}}]]
15576 !! end
15577
15578 !! test
15579 Category with template in sort key
15580 !! options
15581 cat
15582 pst
15583 !! wikitext
15584 [[Category:Foo|{{echo|Bar}}]]
15585 !! html/php
15586 [[Category:Foo|{{echo|Bar}}]]
15587 !! end
15588
15589 !! test
15590 Category with template in sort key and title
15591 !! options
15592 cat
15593 pst
15594 !! wikitext
15595 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
15596 !! html/php
15597 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
15598 !! end
15599
15600 ## We used to, but no longer wt2wt this test since the default serializer
15601 ## will normalize all categories to serialize on their own line.
15602 ## This wikitext usage is going to be fairly uncommon in production and
15603 ## selser will take care of preserving formatting in those scenarios.
15604 !! test
15605 Category / paragraph interactions
15606 !! options
15607 parsoid=wt2html
15608 !! wikitext
15609 Foo [[Category:Baz]] Bar
15610
15611 Foo [[Category:Baz]]
15612 Bar
15613
15614 Foo
15615 [[Category:Baz]]
15616 Bar
15617
15618 Foo
15619 [[Category:Baz]] Bar
15620
15621 Foo
15622 [[Category:Baz]]
15623 [[Category:Baz]]
15624 [[Category:Baz]]
15625 Bar
15626
15627 [[Category:Baz]]
15628 [[Category:Baz]]
15629 [[Category:Baz]]
15630
15631 [[Category:Baz]]
15632 {{echo|[[Category:Baz]]}}
15633 [[Category:Baz]]
15634 !! html/php
15635 <p>Foo Bar
15636 </p><p>Foo
15637 Bar
15638 </p><p>Foo
15639 Bar
15640 </p><p>Foo Bar
15641 </p><p>Foo
15642 Bar
15643 </p>
15644 !! html/parsoid
15645 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
15646 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
15647 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
15648 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
15649 <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>
15650 <link rel="mw:PageProp/Category" href="./Category:Baz"/>
15651 !! end
15652
15653 ## We used to, but no longer wt2wt this test since the default serializer
15654 ## will normalize all categories to serialize on their own line.
15655 ## This wikitext usage is going to be fairly uncommon in production and
15656 ## selser will take care of preserving formatting in those scenarios.
15657 ##
15658 ## The whitespace on the empty line is part of the test. Please do not delete
15659 !! test
15660 1. Categories and newlines: All preceding newlines should be suppressed (courtesy T2087)
15661 !! options
15662 parsoid=wt2html
15663 !! wikitext
15664 This
15665
15666 [[Category:Foo]] and this should be part of same paragraph (not an indent-pre)
15667
15668 {{echo|[[Category:Foo]] and so should this!}}
15669 !! html/php
15670 <p>This and this should be part of same paragraph (not an indent-pre) and so should this!
15671 </p>
15672 !! html/parsoid
15673 <p>This
15674
15675 <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of same paragraph (not an indent-pre)
15676
15677 <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>
15678 !! end
15679
15680 ## Parsoid will not try to wt2wt this while preserving newlines because
15681 ## it suppresses excess newlines within list items -- and we don't want to
15682 ## introduce a special case just for categories, which is, in reality somewhat
15683 ## odd behavior -- categories are unlikely to be used in list items like this
15684 ## in top-level pages and are only likely to show up in template-generated
15685 ## list items where this RT-ing is a non-issue.
15686 ##
15687 ## The whitespace on the empty line is part of the test. Please do not delete
15688 !! test
15689 2. Categories and newlines: All preceding newlines should be suppressed (courtesy T2087)
15690 !! options
15691 parsoid=wt2html
15692 !! wikitext
15693 * This
15694
15695 [[Category:Foo]] and this should be part of the same list item
15696 * So should this
15697
15698 {{echo|[[Category:Foo]] and this should be part of the same list item}}
15699 !! html
15700 <ul><li>This and this should be part of the same list item</li>
15701 <li>So should this and this should be part of the same list item</li></ul>
15702 !! html/parsoid
15703 <ul>
15704 <li>This <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of the same list item</li>
15705 <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>
15706 </ul>
15707 !! end
15708
15709 ## Newlines and categories that follow the last item of a list
15710 ## are treated differently because this (list followed by categories)
15711 ## is an extremely common pattern on wikis.
15712 !! test
15713 3. Categories and newlines: newline suppression for last list item should RT properly
15714 !! wikitext
15715 * a
15716 * b
15717
15718 [[Category:Foo]]
15719
15720 [[Category:Bar]]
15721 [[Category:Baz]]
15722 !! html/parsoid
15723 <ul><li> a</li>
15724 <li> b</li></ul>
15725
15726 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
15727
15728 <link rel="mw:PageProp/Category" href="./Category:Bar" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
15729 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
15730 !! end
15731
15732 !! test
15733 4. Categories and newlines: newline suppression for last list item should RT properly
15734 !! wikitext
15735 * a
15736 **** b
15737
15738 [[Category:Foo]]
15739 !! html/parsoid
15740 <ul><li> a
15741 <ul><li><ul><li><ul><li> b</li></ul></li></ul></li></ul></li></ul>
15742
15743 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
15744 !! end
15745
15746 ## only wt2html for this to make sure the algo only applies to the rightmost path
15747 !! test
15748 5. Categories and newlines: migrateTrailingCategories dom pass should only run on the rightmost path of nested lists
15749 !! options
15750 parsoid=wt2html
15751 !! wikitext
15752 * a
15753 ** b
15754 [[Category:Foo]]
15755 * c
15756 ** d
15757 [[Category:Foo]]
15758 !! html/parsoid
15759 <ul><li> a
15760 <ul><li> b
15761 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/></li></ul></li>
15762 <li> c
15763 <ul><li> d</li></ul></li></ul>
15764 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
15765 !! end
15766
15767 ## We used to, but no longer wt2wt this test since the default serializer
15768 ## will normalize all categories to serialize on their own line.
15769 ## This wikitext usage is going to be fairly uncommon in production and
15770 ## selser will take care of preserving formatting in those scenarios.
15771 !! test
15772 6. Categories and newlines: migrateTrailingCategories dom pass should not migrate categories not preceded by newlines
15773 !! options
15774 parsoid=wt2html
15775 !! wikitext
15776 * a [[Category:Foo]]
15777 !! html/parsoid
15778 <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>
15779 !! end
15780
15781 # This test also demonstrates because of newline+category tunneling
15782 # through the list hander, template wrapping doesn't expand to the
15783 # containing list when the list item swallows the category.
15784 !! test
15785 7. Categories and newlines: migrateTrailingCategories dom pass should leave template content alone
15786 !! wikitext
15787 * {{echo|a
15788 [[Category:Foo]]}}
15789 !! html/parsoid
15790 <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
15791 </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>
15792 !! end
15793
15794 !! test
15795 8. Categories and newlines: migrateTrailingCategories dom pass should not get tripped by intervening templates
15796 !! wikitext
15797 * a
15798
15799 {{echo|[[Category:Foo]]
15800 [[Category:Bar]]}}
15801 [[Category:Baz]]
15802 !! html/parsoid
15803 <ul><li> a</li></ul>
15804
15805 <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">
15806 </span><link rel="mw:PageProp/Category" href="./Category:Bar" about="#mwt1" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
15807 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
15808 !! end
15809
15810 !! test
15811 Category links with multiple namespaces
15812 !! wikitext
15813 [[Category:Project:Foo]]
15814 !! html/parsoid
15815 <link rel="mw:PageProp/Category" href="./Category:Project:Foo" />
15816 !! end
15817
15818 !! test
15819 Parsoid: Serialize link to category page with colon escape
15820 !! options
15821 parsoid
15822 !! wikitext
15823
15824 [[:Category:Foo]]
15825 [[:Category:Foo|Bar]]
15826 !! html
15827 <p>
15828 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Category:Foo</a>
15829 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Bar</a>
15830 </p>
15831 !! end
15832
15833 # We used to, but no longer wt2wt this test since the default serializer
15834 # will normalize all categories to serialize on their own line.
15835 # This wikitext usage is going to be fairly uncommon in production and
15836 # selser will take care of preventing whitespace insertion if this
15837 # occurs in an article.
15838 #
15839 # html2html disabled for the same reason (whitespace insertion between
15840 # x and y).
15841 #
15842 # html2wt disabled because it localizes the "Category" namespace.
15843 !! test
15844 Link prefix/suffixes aren't applied to category links
15845 !! options
15846 parsoid=wt2html
15847 language=is
15848 !! wikitext
15849 x[[Category:Foo]]y
15850 !! html/php
15851 <p>xy
15852 </p>
15853 !! html/parsoid
15854 <p>x<link rel="mw:PageProp/Category" href="./Flokkur:Foo" data-parsoid=""/>y</p>
15855 !! end
15856
15857 !! test
15858 Parsoid: Serialize link to file page with colon escape
15859 !! options
15860 parsoid
15861 !! wikitext
15862
15863 [[:File:Foo.png]]
15864 [[:File:Foo.png|Bar]]
15865 !! html
15866 <p>
15867 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">File:Foo.png</a>
15868 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">Bar</a>
15869 </p>
15870 !! end
15871
15872 !! test
15873 Parsoid: Serialize a genuine category link without colon escape
15874 !! options
15875 parsoid
15876 !! wikitext
15877 [[Category:Foo]]
15878 [[Category:Foo|Bar]]
15879 !! html
15880 <link rel="mw:PageProp/Category" href="./Category:Foo">
15881 <link rel="mw:PageProp/Category" href="./Category:Foo#Bar">
15882 !! end
15883
15884 !! test
15885 Normalize hrefs properly before testing for invalid link targets (T72894)
15886 !! options
15887 parsoid=html2wt
15888 !! html/parsoid
15889 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne"/>
15890 !! wikitext
15891 [[Category:Toxine bactérienne]]
15892 !! end
15893
15894 !! test
15895 Parsoid: Defaultsort
15896 !! wikitext
15897 {{DEFAULTSORT:Foo}}
15898 !! html/parsoid
15899 <meta property="mw:PageProp/categorydefaultsort" content="Foo"/>
15900 !! end
15901
15902 # NOTE: mw:ExpandedAttrs is not the best typeof here. mw:Transclusion is better.
15903 # But, this is a limitation of our representation and is documented in
15904 # TemplateHandler.js in processSpecialMagicWord
15905 !! test
15906 Parsoid: Defaultsort (template-generated)
15907 !! wikitext
15908 {{{{echo|DEFAULTSORT}}:Foo}}
15909 !! html/parsoid
15910 <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"}]]}'/>
15911 !! end
15912
15913 ###
15914 ### Inter-language links
15915 ###
15916 !! test
15917 Interlanguage links
15918 !! options
15919 ill
15920 !! wikitext
15921 [[es:Alimento]]
15922 [[fr:Nourriture]]
15923 [[zh:食品]]
15924 !! html/php
15925 es:Alimento fr:Nourriture zh:食品
15926 !! html/parsoid
15927 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Alimento"/>
15928 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/Nourriture"/>
15929 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/食品"/>
15930 !! end
15931
15932 !! test
15933 Duplicate interlanguage links (T26502)
15934 !! options
15935 ill
15936 !! wikitext
15937 [[es:1]]
15938 [[es:2]]
15939 [[fr:1]]
15940 [[fr:2]]
15941 !! html/php
15942 es:1 fr:1
15943 !! html/parsoid
15944 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/1"/>
15945 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/2"/>
15946 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/1"/>
15947 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/2"/>
15948 !! end
15949
15950 ###
15951 ### Sections
15952 ###
15953 !! test
15954 Basic section headings
15955 !! wikitext
15956 == Headline 1 ==
15957 Some text
15958
15959 ==Headline 2==
15960 More
15961 ===Smaller headline===
15962 Blah blah
15963 !! html
15964 <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>
15965 <p>Some text
15966 </p>
15967 <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>
15968 <p>More
15969 </p>
15970 <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>
15971 <p>Blah blah
15972 </p>
15973 !! end
15974
15975 !! test
15976 Section headings with TOC
15977 !! wikitext
15978 == Headline 1 ==
15979 === Subheadline 1 ===
15980 ===== Skipping a level =====
15981 ====== Skipping a level ======
15982
15983 == Headline 2 ==
15984 Some text
15985 ===Another headline===
15986 !! html
15987 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
15988 <ul>
15989 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
15990 <ul>
15991 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
15992 <ul>
15993 <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>
15994 <ul>
15995 <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>
15996 </ul>
15997 </li>
15998 </ul>
15999 </li>
16000 </ul>
16001 </li>
16002 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
16003 <ul>
16004 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
16005 </ul>
16006 </li>
16007 </ul>
16008 </div>
16009
16010 <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>
16011 <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>
16012 <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>
16013 <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>
16014 <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>
16015 <p>Some text
16016 </p>
16017 <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>
16018
16019 !! end
16020
16021 !! test
16022 TOC anchors don't collide
16023 !! wikitext
16024 __FORCETOC__
16025 == Headline 2 ==
16026 == Headline ==
16027 == Headline 2 ==
16028 == Headline ==
16029 !! html/php
16030 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
16031 <ul>
16032 <li class="toclevel-1 tocsection-1"><a href="#Headline_2"><span class="tocnumber">1</span> <span class="toctext">Headline 2</span></a></li>
16033 <li class="toclevel-1 tocsection-2"><a href="#Headline"><span class="tocnumber">2</span> <span class="toctext">Headline</span></a></li>
16034 <li class="toclevel-1 tocsection-3"><a href="#Headline_2_2"><span class="tocnumber">3</span> <span class="toctext">Headline 2</span></a></li>
16035 <li class="toclevel-1 tocsection-4"><a href="#Headline_3"><span class="tocnumber">4</span> <span class="toctext">Headline</span></a></li>
16036 </ul>
16037 </div>
16038
16039 <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>
16040 <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>
16041 <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>
16042 <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>
16043
16044 !! end
16045
16046 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
16047 !! test
16048 Handling of sections up to level 6 and beyond
16049 !! wikitext
16050 = Level 1 Heading=
16051 == Level 2 Heading==
16052 === Level 3 Heading===
16053 ==== Level 4 Heading====
16054 ===== Level 5 Heading=====
16055 ====== Level 6 Heading======
16056 ======= Level 7 Heading=======
16057 ======== Level 8 Heading========
16058 ========= Level 9 Heading=========
16059 ========== Level 10 Heading==========
16060 !! html
16061 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
16062 <ul>
16063 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
16064 <ul>
16065 <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>
16066 <ul>
16067 <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>
16068 <ul>
16069 <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>
16070 <ul>
16071 <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>
16072 <ul>
16073 <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>
16074 <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>
16075 <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>
16076 <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>
16077 <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>
16078 </ul>
16079 </li>
16080 </ul>
16081 </li>
16082 </ul>
16083 </li>
16084 </ul>
16085 </li>
16086 </ul>
16087 </li>
16088 </ul>
16089 </div>
16090
16091 <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>
16092 <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>
16093 <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>
16094 <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>
16095 <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>
16096 <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>
16097 <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>
16098 <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>
16099 <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>
16100 <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>
16101
16102 !! end
16103
16104 !! test
16105 TOC regression (T11764)
16106 !! wikitext
16107 == title 1 ==
16108 === title 1.1 ===
16109 ==== title 1.1.1 ====
16110 === title 1.2 ===
16111 == title 2 ==
16112 === title 2.1 ===
16113 !! html
16114 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
16115 <ul>
16116 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
16117 <ul>
16118 <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>
16119 <ul>
16120 <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>
16121 </ul>
16122 </li>
16123 <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>
16124 </ul>
16125 </li>
16126 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
16127 <ul>
16128 <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>
16129 </ul>
16130 </li>
16131 </ul>
16132 </div>
16133
16134 <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>
16135 <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>
16136 <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>
16137 <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>
16138 <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>
16139 <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>
16140
16141 !! end
16142
16143 !! test
16144 TOC for heading containing <span id="..."></span> (T96153)
16145 !! wikitext
16146 __FORCETOC__
16147 ==<span id="old-anchor"></span>New title==
16148 !! html/php
16149 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
16150 <ul>
16151 <li class="toclevel-1 tocsection-1"><a href="#New_title"><span class="tocnumber">1</span> <span class="toctext">New title</span></a></li>
16152 </ul>
16153 </div>
16154
16155 <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>
16156
16157 !! end
16158
16159 !! test
16160 TOC with wgMaxTocLevel=3 (T8204)
16161 !! options
16162 wgMaxTocLevel=3
16163 !! wikitext
16164 == title 1 ==
16165 === title 1.1 ===
16166 ==== title 1.1.1 ====
16167 === title 1.2 ===
16168 == title 2 ==
16169 === title 2.1 ===
16170 !! html
16171 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
16172 <ul>
16173 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
16174 <ul>
16175 <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>
16176 <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>
16177 </ul>
16178 </li>
16179 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
16180 <ul>
16181 <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>
16182 </ul>
16183 </li>
16184 </ul>
16185 </div>
16186
16187 <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>
16188 <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>
16189 <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>
16190 <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>
16191 <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>
16192 <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>
16193
16194 !! end
16195
16196 !! test
16197 TOC with wgMaxTocLevel=3 and two level four headings (T8204)
16198 !! options
16199 wgMaxTocLevel=3
16200 !! wikitext
16201 ==Section 1==
16202 ===Section 1.1===
16203 ====Section 1.1.1====
16204 ====Section 1.1.1.1====
16205 ==Section 2==
16206 !! html
16207 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
16208 <ul>
16209 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
16210 <ul>
16211 <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>
16212 </ul>
16213 </li>
16214 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
16215 </ul>
16216 </div>
16217
16218 <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>
16219 <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>
16220 <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>
16221 <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>
16222 <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>
16223
16224 !! end
16225
16226
16227 !! test
16228 Resolving duplicate section names
16229 !! wikitext
16230 == Foo bar ==
16231 == Foo bar ==
16232 !! html
16233 <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>
16234 <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>
16235
16236 !! end
16237
16238 !! test
16239 Resolving duplicate section names with differing case (T12721)
16240 !! wikitext
16241 == Foo bar ==
16242 == Foo Bar ==
16243 !! html
16244 <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>
16245 <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>
16246
16247 !! end
16248
16249 !! article
16250 Template:sections
16251 !! text
16252 ===Section 1===
16253 ==Section 2==
16254 !! endarticle
16255
16256 !! test
16257 Template with sections, __NOTOC__
16258 !! wikitext
16259 __NOTOC__
16260 ==Section 0==
16261 {{sections}}
16262 ==Section 4==
16263 !! html
16264 <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>
16265 <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>
16266 <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>
16267 <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>
16268
16269 !! end
16270
16271 !! test
16272 __NOEDITSECTION__ keyword
16273 !! wikitext
16274 __NOEDITSECTION__
16275 ==Section 1==
16276 ==Section 2==
16277 !! html
16278 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
16279 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
16280
16281 !! end
16282
16283 !! test
16284 Link inside a section heading
16285 !! wikitext
16286 ==Section with a [[Main Page|link]] in it==
16287 !! html
16288 <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>
16289
16290 !! end
16291
16292 !! test
16293 TOC regression (T14077)
16294 !! wikitext
16295 __TOC__
16296 == title 1 ==
16297 === title 1.1 ===
16298 == title 2 ==
16299 !! html
16300 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
16301 <ul>
16302 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
16303 <ul>
16304 <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>
16305 </ul>
16306 </li>
16307 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
16308 </ul>
16309 </div>
16310
16311 <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>
16312 <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>
16313 <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>
16314
16315 !! end
16316
16317 !! test
16318 T3219 URL next to image (good)
16319 !! wikitext
16320 http://example.com [[File:Foobar.jpg]]
16321 !! html/php
16322 <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>
16323 </p>
16324 !! html/parsoid
16325 <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>
16326 !!end
16327
16328 !! test
16329 Short headings with trailing space should match behavior of Parser::doHeadings (T21910)
16330 !! wikitext
16331 ===
16332 The line above must have a trailing space!
16333 === <!--
16334 --> <!-- -->
16335 But just in case it doesn't...
16336 !! html
16337 <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>
16338 <p>The line above must have a trailing space!
16339 </p>
16340 <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>
16341 <p>But just in case it doesn't...
16342 </p>
16343 !! end
16344
16345 !! test
16346 Header with special characters (T27462)
16347 !! wikitext
16348 The tooltips shall not show entities to the user (ie. be double escaped)
16349
16350 == text > text ==
16351 section 1
16352
16353 == text < text ==
16354 section 2
16355
16356 == text & text ==
16357 section 3
16358
16359 == text ' text ==
16360 section 4
16361
16362 == text " text ==
16363 section 5
16364 !! html
16365 <p>The tooltips shall not show entities to the user (ie. be double escaped)
16366 </p>
16367 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
16368 <ul>
16369 <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>
16370 <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>
16371 <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>
16372 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
16373 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
16374 </ul>
16375 </div>
16376
16377 <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>
16378 <p>section 1
16379 </p>
16380 <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>
16381 <p>section 2
16382 </p>
16383 <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>
16384 <p>section 3
16385 </p>
16386 <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>
16387 <p>section 4
16388 </p>
16389 <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>
16390 <p>section 5
16391 </p>
16392 !! end
16393
16394 !! test
16395 Header with space, plus and underscore as entity
16396 !! wikitext
16397 Id should not contain + for spaces
16398
16399 == Space between Text ==
16400 section 1
16401
16402 == Space-Entity&#32;between&#32;Text ==
16403 section 2
16404
16405 == Plus+between+Text ==
16406 section 3
16407
16408 == Plus-Entity&#43;between&#43;Text ==
16409 section 4
16410
16411 == Underscore_between_Text ==
16412 section 5
16413
16414 == Underscore-Entity&#95;between&#95;Text ==
16415 section 6
16416
16417 [[#Space between Text]]
16418 [[#Space-Entity&#32;between&#32;Text]]
16419 [[#Plus+between+Text]]
16420 [[#Plus-Entity&#43;between&#43;Text]]
16421 [[#Underscore_between_Text]]
16422 [[#Underscore-Entity&#95;between&#95;Text]]
16423 !! html
16424 <p>Id should not contain + for spaces
16425 </p>
16426 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
16427 <ul>
16428 <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>
16429 <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>
16430 <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>
16431 <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>
16432 <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>
16433 <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>
16434 </ul>
16435 </div>
16436
16437 <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>
16438 <p>section 1
16439 </p>
16440 <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>
16441 <p>section 2
16442 </p>
16443 <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>
16444 <p>section 3
16445 </p>
16446 <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>
16447 <p>section 4
16448 </p>
16449 <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>
16450 <p>section 5
16451 </p>
16452 <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>
16453 <p>section 6
16454 </p><p><a href="#Space_between_Text">#Space between Text</a>
16455 <a href="#Space-Entity_between_Text">#Space-Entity&#32;between&#32;Text</a>
16456 <a href="#Plus.2Bbetween.2BText">#Plus+between+Text</a>
16457 <a href="#Plus-Entity.2Bbetween.2BText">#Plus-Entity&#43;between&#43;Text</a>
16458 <a href="#Underscore_between_Text">#Underscore_between_Text</a>
16459 <a href="#Underscore-Entity_between_Text">#Underscore-Entity&#95;between&#95;Text</a>
16460 </p>
16461 !! end
16462
16463 !! test
16464 Headers with excess '=' characters
16465 (Are similar tests necessary beyond the 1st level?)
16466 !! wikitext
16467 =foo==
16468 ==foo=
16469 =''italic'' heading==
16470 ==''italic'' heading=
16471 !! html
16472 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
16473 <ul>
16474 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
16475 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
16476 <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>
16477 <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>
16478 </ul>
16479 </div>
16480
16481 <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>
16482 <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>
16483 <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>
16484 <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>
16485
16486 !! end
16487
16488 !! test
16489 HTML headers vs TOC (T25393)
16490 (__NOEDITSECTION__ for clearer output, doesn't matter here)
16491 !! wikitext
16492 <h1>Header 1</h1>
16493 == Header 1.1 ==
16494 == Header 1.2 ==
16495
16496 <h1>Header 2
16497 </h1>
16498 == Header 2.1 ==
16499 == Header 2.2 ==
16500 __NOEDITSECTION__
16501 !! html
16502 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
16503 <ul>
16504 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
16505 <ul>
16506 <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>
16507 <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>
16508 </ul>
16509 </li>
16510 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
16511 <ul>
16512 <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>
16513 <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>
16514 </ul>
16515 </li>
16516 </ul>
16517 </div>
16518
16519 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
16520 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
16521 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
16522 <h1><span class="mw-headline" id="Header_2">Header 2</span></h1>
16523 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
16524 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
16525
16526 !! end
16527
16528 !! test
16529 Single-line or multiline-comments can follow headings
16530 !! options
16531 parsoid=wt2html,wt2wt
16532 !! wikitext
16533 ==foo==<!---->
16534 ==bar==<!--c1-->
16535 ==baz==<!--
16536 c2
16537 c3-->
16538 !! html
16539 <h2><span class="mw-headline" id="foo">foo</span></h2>
16540 <h2><span class="mw-headline" id="bar">bar</span></h2>
16541 <h2><span class="mw-headline" id="baz">baz</span></h2>
16542
16543 !! end
16544
16545 !! test
16546 T3219 URL next to image (broken)
16547 !! wikitext
16548 http://example.com[[File:Foobar.jpg]]
16549 !! html/php
16550 <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>
16551 </p>
16552 !! html/parsoid
16553 <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>
16554 !!end
16555
16556 !! test
16557 T3186 news: in the middle of text
16558 !! wikitext
16559 http://en.wikinews.org/wiki/Wikinews:Workplace
16560 !! html
16561 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
16562 </p>
16563 !!end
16564
16565
16566 !! test
16567 Namespaced link must have a title
16568 !! wikitext
16569 [[Project:]]
16570 !! html
16571 <p>[[Project:]]
16572 </p>
16573 !!end
16574
16575 !! test
16576 Namespaced link must have a title (bad fragment version)
16577 !! wikitext
16578 [[Project:#fragment]]
16579 !! html
16580 <p>[[Project:#fragment]]
16581 </p>
16582 !!end
16583
16584
16585 ###
16586 ### HTML tags and HTML attributes
16587 ###
16588
16589 !! test
16590 div with no attributes
16591 !! wikitext
16592 <div>HTML rocks</div>
16593 !! html
16594 <div>HTML rocks</div>
16595
16596 !! end
16597
16598 !! test
16599 div with double-quoted attribute
16600 !! wikitext
16601 <div id="rock">HTML rocks</div>
16602 !! html
16603 <div id="rock">HTML rocks</div>
16604
16605 !! end
16606
16607 !! test
16608 div with single-quoted attribute
16609 !! wikitext
16610 <div id='rock'>HTML rocks</div>
16611 !! html
16612 <div id="rock">HTML rocks</div>
16613
16614 !! end
16615
16616 !! test
16617 div with unquoted attribute
16618 !! wikitext
16619 <div id=rock>HTML rocks</div>
16620 !! html
16621 <div id="rock">HTML rocks</div>
16622
16623 !! end
16624
16625 !! test
16626 div with illegal double attributes
16627 !! wikitext
16628 <div id="a" id="b">HTML rocks</div>
16629 !! html
16630 <div id="b">HTML rocks</div>
16631
16632 !!end
16633
16634 !! test
16635 div with empty attribute value, space before equals
16636 !! options
16637 parsoid=wt2html,html2html
16638 !! wikitext
16639 <div class =>HTML rocks</div>
16640 !! html/php
16641 <div class="">HTML rocks</div>
16642
16643 !! html/parsoid
16644 <div class="" data-parsoid='{"stx":"html"}'>HTML rocks</div>
16645 !! end
16646
16647 !! test
16648 div with multiple empty attribute values
16649 !! options
16650 parsoid=wt2html,html2html
16651 !! wikitext
16652 <div id= title=>HTML rocks</div>
16653 !! html/php
16654 <div id="title.3D">HTML rocks</div>
16655
16656 !! html/parsoid
16657 <div id="title.3D" data-parsoid='{"stx":"html"}'>HTML rocks</div>
16658 !! end
16659
16660 !! test
16661 table with multiple empty attribute values
16662 !! options
16663 parsoid=wt2html,html2html
16664 !! wikitext
16665 {| title= id=
16666 | hi
16667 |}
16668 !! html/php
16669 <table title="id=">
16670 <tr>
16671 <td> hi
16672 </td></tr></table>
16673
16674 !! html/parsoid
16675 <table title="id=">
16676 <tbody><tr><td> hi</td></tr>
16677 </tbody></table>
16678 !! end
16679
16680 !! test
16681 div with braces in attribute value
16682 !! wikitext
16683 <div title="{}">Foo</div>
16684 !! html/php
16685 <div title="&#123;&#125;">Foo</div>
16686
16687 !! html/parsoid
16688 <div title="{}">Foo</div>
16689 !! end
16690
16691 !! test
16692 div with empty attribute value, no space before equals
16693 !! options
16694 parsoid=wt2html,html2html
16695 !! wikitext
16696 <div class=>HTML rocks</div>
16697 !! html/php
16698 <div class="">HTML rocks</div>
16699
16700 !! html/parsoid
16701 <div class="">HTML rocks</div>
16702 !! end
16703
16704 !! test
16705 HTML multiple attributes correction
16706 !! wikitext
16707 <p class="error" class="awesome">Awesome!</p>
16708 !! html
16709 <p class="awesome">Awesome!</p>
16710
16711 !!end
16712
16713 !! test
16714 Table multiple attributes correction
16715 !! wikitext
16716 {|
16717 !+ class="error" class="awesome"| status
16718 |}
16719 !! html
16720 <table>
16721 <tr>
16722 <th class="awesome"> status
16723 </th></tr></table>
16724
16725 !!end
16726
16727 !! test
16728 DIV IN UPPERCASE
16729 !! wikitext
16730 <DIV ID="x">HTML ROCKS</DIV>
16731 !! html
16732 <div id="x">HTML ROCKS</div>
16733
16734 !!end
16735
16736 !! test
16737 Non-ASCII pseudo-tags are rendered as text
16738 !! wikitext
16739 <khyô>
16740 !! html
16741 <p>&lt;khyô&gt;
16742 </p>
16743 !! end
16744
16745 !! test
16746 Pseudo-tag with URL 'name' renders as url link
16747 !! wikitext
16748 <http://example.com/>
16749 !! html
16750 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
16751 </p>
16752 !! end
16753
16754 !! test
16755 text with amp in the middle of nowhere
16756 !! wikitext
16757 Remember AT&T?
16758 !! html
16759 <p>Remember AT&amp;T?
16760 </p>
16761 !! end
16762
16763 !! test
16764 text with character entity: eacute
16765 !! wikitext
16766 I always thought &eacute; was a cute letter.
16767 !! html
16768 <p>I always thought &#233; was a cute letter.
16769 </p>
16770 !! html+tidy
16771 <p>I always thought é was a cute letter.</p>
16772 !! end
16773
16774 !! test
16775 text with entity-escaped character entity-like string: eacute
16776 !! wikitext
16777 I always thought &amp;eacute; was a cute letter.
16778 !! html
16779 <p>I always thought &amp;eacute; was a cute letter.
16780 </p>
16781 !! end
16782
16783 !! test
16784 text with undefined character entity: xacute
16785 !! wikitext
16786 I always thought &xacute; was a cute letter.
16787 !! html
16788 <p>I always thought &amp;xacute; was a cute letter.
16789 </p>
16790 !! end
16791
16792 !! test
16793 HTML5 tags
16794 !! wikitext
16795 <data value="5">five</data>
16796 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
16797 <mark>This highlighted text</mark>
16798 !! html
16799 <p><data value="5">five</data>
16800 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
16801 <mark>This highlighted text</mark>
16802 </p>
16803 !! end
16804
16805 !! test
16806 HTML tag with leading space is parsed as text
16807 !! wikitext
16808 < div>foo< /div>
16809 !! html
16810 <p>&lt; div&gt;foo&lt; /div&gt;
16811 </p>
16812 !! end
16813
16814 ###
16815 ### Nesting tests (see T43545, T52604, T53081)
16816 ###
16817
16818 # This test case is fixed in Parsoid by domino 1.0.12. (T52604)
16819 # Note that html2wt is considerably more difficult if we use <b> in
16820 # the test case, instead of <small>
16821 !! test
16822 Ensure that HTML adoption agency algorithm is properly implemented.
16823 !! wikitext
16824 <small>X<small>Y</small>Z</small>
16825 !! html
16826 <p><small>X<small>Y</small>Z</small>
16827 </p>
16828 !! end
16829
16830 # This was T43545 in the PHP parser.
16831 # Note that tidy doesn't handle this correctly.
16832 !! test
16833 Nesting of <kbd>
16834 !! wikitext
16835 <kbd>X<kbd>Y</kbd>Z</kbd>
16836 !! html
16837 <p><kbd>X<kbd>Y</kbd>Z</kbd>
16838 </p>
16839 !! end
16840
16841 # The following cases were T53081 in the PHP parser.
16842 # Note that there are some other nestable tags (b, i, etc) which are
16843 # not covered; see T53081 for discussion.
16844
16845 # Note that tidy doesn't handle this correctly.
16846 !! test
16847 Nesting of <em>
16848 !! wikitext
16849 <em>X<em>Y</em>Z</em>
16850 !! html
16851 <p><em>X<em>Y</em>Z</em>
16852 </p>
16853 !! end
16854
16855 # Note that tidy doesn't handle this correctly.
16856 !! test
16857 Nesting of <strong>
16858 !! wikitext
16859 <strong>X<strong>Y</strong>Z</strong>
16860 !! html
16861 <p><strong>X<strong>Y</strong>Z</strong>
16862 </p>
16863 !! end
16864
16865 !! test
16866 Nesting of <q>
16867 !! wikitext
16868 <q>X<q>Y</q>Z</q>
16869 !! html+tidy
16870 <p><q>X<q>Y</q>Z</q></p>
16871 !! end
16872
16873 # Note that tidy doesn't handle this correctly.
16874 !! test
16875 Nesting of <ruby>
16876 !! wikitext
16877 <ruby>X<ruby>Y</ruby>Z</ruby>
16878 !! html
16879 <p><ruby>X<ruby>Y</ruby>Z</ruby>
16880 </p>
16881 !! end
16882
16883 # Note that tidy doesn't handle this correctly.
16884 !! test
16885 Nesting of <bdo>
16886 !! wikitext
16887 <bdo>X<bdo>Y</bdo>Z</bdo>
16888 !! html
16889 <p><bdo>X<bdo>Y</bdo>Z</bdo>
16890 </p>
16891 !! end
16892
16893
16894 ###
16895 ### Media links
16896 ###
16897
16898 !! test
16899 Media link
16900 !! wikitext
16901 [[Media:Foobar.jpg]]
16902 !! html/php
16903 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
16904 </p>
16905 !! html/parsoid
16906 <p><a rel="mw:MediaLink" href="//example.com/images/3/3a/Foobar.jpg" title="Foobar.jpg">Media:Foobar.jpg</a></p>
16907 !! end
16908
16909 !! test
16910 Media link with text
16911 !! wikitext
16912 [[Media:Foobar.jpg|A neat file to look at]]
16913 !! html/php
16914 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
16915 </p>
16916 !! html/parsoid
16917 <p><a rel="mw:MediaLink" href="//example.com/images/3/3a/Foobar.jpg" title="Foobar.jpg">A neat file to look at</a></p>
16918 !! end
16919
16920 # FIXME: this is still bad HTML tag nesting
16921 # FIXME: doBlockLevels won't wrap this in a paragraph because it contains a div
16922 !! test
16923 Media link with nasty text
16924 !! wikitext
16925 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
16926 !! html/php
16927 <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>
16928
16929 !! html+php/tidy
16930 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Safe Link</a></p>
16931 <div style="display:none">" onmouseover="alert(document.cookie)" onfoo="</div>
16932 !! html/parsoid
16933 <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>
16934
16935 !! end
16936
16937 !! test
16938 Media link to nonexistent file (T3702)
16939 !! wikitext
16940 [[Media:No such.jpg]]
16941 [[Media:No_such file.jpg]]
16942 !! html/php
16943 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
16944 <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>
16945 </p>
16946 !! html/parsoid
16947 <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>
16948 <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>
16949 !! end
16950
16951 !! test
16952 Image link to nonexistent file (T3850 - good)
16953 !! wikitext
16954 [[File:No_such.jpg]]
16955 !! html/php
16956 <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>
16957 </p>
16958 !! html/parsoid
16959 <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>
16960 !! end
16961
16962 !! test
16963 :Image link to nonexistent file (T3850 - bad)
16964 !! wikitext
16965 [[:Image:No such.jpg]]
16966 !! html/php
16967 <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>
16968 </p>
16969 !! html/parsoid
16970 <p><a rel="mw:WikiLink" href="./File:No_such.jpg" title="File:No such.jpg">Image:No such.jpg</a></p>
16971 !! end
16972
16973
16974
16975 !! test
16976 Character reference normalization in link text (T3938)
16977 !! wikitext
16978 [[Main Page|this&that]]
16979 !! html
16980 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
16981 </p>
16982 !!end
16983
16984 !! article
16985 אַ
16986 !! text
16987 Test for unicode normalization
16988
16989 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
16990 !! endarticle
16991
16992 !! test
16993 (T21451) Links should refer to the normalized form.
16994 !! wikitext
16995 [[&#xFB2E;]]
16996 [[&#x5d0;&#x5b7;]]
16997 [[&#x5d0;ַ]]
16998 [[א&#x5b7;]]
16999 [[אַ]]
17000 !! html
17001 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
17002 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
17003 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
17004 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
17005 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
17006 </p>
17007 !! end
17008
17009 !! test
17010 Empty attribute crash test (T4067)
17011 !! wikitext
17012 <font color="">foo</font>
17013 !! html
17014 <p><font color="">foo</font>
17015 </p>
17016 !! end
17017
17018 !! test
17019 Empty attribute crash test single-quotes (T4067)
17020 !! wikitext
17021 <font color=''>foo</font>
17022 !! html
17023 <p><font color="">foo</font>
17024 </p>
17025 !! end
17026
17027 !! test
17028 Attribute test: equals, then nothing
17029 !! options
17030 parsoid=wt2html,html2html
17031 !! wikitext
17032 <font color=>foo</font>
17033 !! html/php
17034 <p><font color="">foo</font>
17035 </p>
17036 !! html/parsoid
17037 <p><font color="" data-parsoid='{"stx":"html"}'>foo</font></p>
17038 !! end
17039
17040 !! test
17041 Attribute test: unquoted value
17042 !! options
17043 parsoid=wt2html,html2html
17044 !! wikitext
17045 <font color=x>foo</font>
17046 !! html/php
17047 <p><font color="x">foo</font>
17048 </p>
17049 !! html/parsoid
17050 <p><font color="x" data-parsoid='{"stx":"html"}'>foo</font></p>
17051 !! end
17052
17053 !! test
17054 Attribute test: unquoted but illegal value (hash)
17055 !! wikitext
17056 <font color=#x>foo</font>
17057 !! html
17058 <p><font color="#x">foo</font>
17059 </p>
17060 !! end
17061
17062 # Parsoid does not serialize to empty attribute syntax,
17063 # so wt2wt and html2wt cases are skipped
17064 !! test
17065 Attribute test: no value (T54330)
17066 !! options
17067 parsoid=wt2html,html2html
17068 !! wikitext
17069 <font color>foo</font>
17070 !! html/php
17071 <p><font color="">foo</font>
17072 </p>
17073 !! html/parsoid
17074 <p><font color="">foo</font></p>
17075 !! end
17076
17077 !! test
17078 T4095: link with three closing brackets
17079 !! wikitext
17080 [[Main Page]]]
17081 !! html/php
17082 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
17083 </p>
17084 !! html/parsoid
17085 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a>]</p>
17086 !! end
17087
17088 !! test
17089 T4095: link with pipe and three closing brackets
17090 !! wikitext
17091 [[Main Page|link]]]
17092 !! html/php
17093 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
17094 </p>
17095 !! html/parsoid
17096 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">link</a>]</p>
17097 !! end
17098
17099 !! test
17100 T4095: link with pipe and three closing brackets, version 2
17101 !! wikitext
17102 [[Main Page|[http://example.com/]]]
17103 !! html/php
17104 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
17105 </p>
17106 !! html/parsoid
17107 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">[http://example.com/]</a></p>
17108 !! end
17109
17110
17111 ###
17112 ### Safety
17113 ###
17114
17115 !! article
17116 Template:Dangerous attribute
17117 !! text
17118 " onmouseover="alert(document.cookie)
17119 !! endarticle
17120
17121 !! article
17122 Template:Dangerous style attribute
17123 !! text
17124 border-size: expression(alert(document.cookie))
17125 !! endarticle
17126
17127 !! article
17128 Template:Div style
17129 !! text
17130 <div style="float: right; {{{1}}}">Magic div</div>
17131 !! endarticle
17132
17133 !! test
17134 T4304: HTML attribute safety (safe template; regression T4309)
17135 !! wikitext
17136 <div title="{{test}}"></div>
17137 !! html/php
17138 <div title="This is a test template"></div>
17139
17140 !! html/parsoid
17141 <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>
17142 !! end
17143
17144 # Parsoid has enough context to handle this case
17145 !! test
17146 T4304: HTML attribute safety (dangerous template; 2309)
17147 !! wikitext
17148 <div title="{{dangerous attribute}}"></div>
17149 !! html/php
17150 <div title=""></div>
17151
17152 !! html/parsoid
17153 <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>
17154 !! end
17155
17156 !! test
17157 T4304: HTML attribute safety (dangerous style template; 2309)
17158 !! wikitext
17159 <div style="{{dangerous style attribute}}"></div>
17160 !! html/php
17161 <div style="/* insecure input */"></div>
17162
17163 !! html/parsoid
17164 <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>
17165 !! end
17166
17167 !! test
17168 T4304: HTML attribute safety (safe parameter; 2309)
17169 !! wikitext
17170 {{div style|width: 200px}}
17171 !! html/php
17172 <div style="float: right; width: 200px">Magic div</div>
17173
17174 !! html/parsoid
17175 <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>
17176 !! end
17177
17178 !! test
17179 T4304: HTML attribute safety (unsafe parameter; 2309)
17180 !! wikitext
17181 {{div style|width: expression(alert(document.cookie))}}
17182 !! html/php
17183 <div style="/* insecure input */">Magic div</div>
17184
17185 !! html/parsoid
17186 <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>
17187 !! end
17188
17189 ## Parsoid output here differs; needs investigation.
17190 !! test
17191 T4304: HTML attribute safety (unsafe breakout parameter; 2309)
17192 !! wikitext
17193 {{div style|"><script>alert(document.cookie)</script>}}
17194 !! html
17195 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
17196
17197 !! end
17198
17199 ## Parsoid output here differs; needs investigation.
17200 !! test
17201 T4304: HTML attribute safety (unsafe breakout parameter 2; 2309)
17202 !! wikitext
17203 {{div style|" ><script>alert(document.cookie)</script>}}
17204 !! html
17205 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
17206
17207 !! end
17208
17209 !! test
17210 T4304: HTML attribute safety (link)
17211 !! wikitext
17212 <div title="[[Main Page]]"></div>
17213 !! html
17214 <div title="&#91;&#91;Main Page]]"></div>
17215
17216 !! end
17217
17218 !! test
17219 T4304: HTML attribute safety (italics)
17220 !! wikitext
17221 <div title="''foobar''"></div>
17222 !! html
17223 <div title="&#39;&#39;foobar&#39;&#39;"></div>
17224
17225 !! end
17226
17227 !! test
17228 T4304: HTML attribute safety (bold)
17229 !! wikitext
17230 <div title="'''foobar'''"></div>
17231 !! html
17232 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
17233
17234 !! end
17235
17236 !! test
17237 T4304: HTML attribute safety (ISBN)
17238 !! wikitext
17239 <div title="ISBN 1234567890"></div>
17240 !! html
17241 <div title="&#73;SBN 1234567890"></div>
17242
17243 !! end
17244
17245 !! test
17246 T4304: HTML attribute safety (RFC)
17247 !! wikitext
17248 <div title="RFC 1234"></div>
17249 !! html
17250 <div title="&#82;FC 1234"></div>
17251
17252 !! end
17253
17254 !! test
17255 T4304: HTML attribute safety (PMID)
17256 !! wikitext
17257 <div title="PMID 1234567890"></div>
17258 !! html
17259 <div title="&#80;MID 1234567890"></div>
17260
17261 !! end
17262
17263 !! test
17264 T4304: HTML attribute safety (web link)
17265 !! wikitext
17266 <div title="http://example.com/"></div>
17267 !! html
17268 <div title="http&#58;//example.com/"></div>
17269
17270 !! end
17271
17272 !! test
17273 T4304: HTML attribute safety (named web link)
17274 !! wikitext
17275 <div title="[http://example.com/ link]"></div>
17276 !! html
17277 <div title="&#91;http&#58;//example.com/ link]"></div>
17278
17279 !! end
17280
17281 !! test
17282 T5244: HTML attribute safety (extension; safe)
17283 !! wikitext
17284 <div style="<nowiki>background:blue</nowiki>"></div>
17285 !! html/php
17286 <div style="background:blue"></div>
17287
17288 !! html/parsoid
17289 <div style="background:blue" data-parsoid='{"stx":"html","a":{"style":"background:blue"},"sa":{"style":"&lt;nowiki>background:blue&lt;/nowiki>"}}'></div>
17290 !! end
17291
17292 !! test
17293 T5244: HTML attribute safety (extension; unsafe)
17294 !! wikitext
17295 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
17296 !! html/php
17297 <div style="/* insecure input */"></div>
17298
17299 !! html/parsoid
17300 <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>
17301 !! end
17302
17303 # More MSIE fun discovered by Tom Gilder
17304
17305 !! test
17306 MSIE CSS safety test: spurious slash
17307 !! wikitext
17308 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
17309 !! html/php
17310 <div style="/* insecure input */">evil</div>
17311
17312 !! html/parsoid
17313 <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>
17314 !! end
17315
17316 !! test
17317 MSIE CSS safety test: hex code
17318 !! wikitext
17319 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
17320 !! html/php
17321 <div style="/* insecure input */">evil</div>
17322
17323 !! html/parsoid
17324 <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>
17325 !! end
17326
17327 !! test
17328 MSIE CSS safety test: comment in url
17329 !! wikitext
17330 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
17331 !! html/php
17332 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
17333
17334 !! html/parsoid
17335 <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>
17336 !! end
17337
17338 !! test
17339 MSIE CSS safety test: comment in expression
17340 !! wikitext
17341 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
17342 !! html/php
17343 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
17344
17345 !! html/parsoid
17346 <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>
17347 !! end
17348
17349 !! test
17350 CSS safety test (all browsers): vertical tab (T57332 / CVE-2013-4567)
17351 !! wikitext
17352 <p style="font-size: 100px; background-image:url\b(https://www.google.com/images/srpr/logo6w.png)">A</p>
17353 !! html/php
17354 <p style="/* invalid control char */">A</p>
17355
17356 !! html/parsoid
17357 <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>
17358 !! end
17359
17360 !! test
17361 MSIE 6 CSS safety test: Fullwidth (T57332)
17362 !! wikitext
17363 <p style="font-size: 100px; color: expression((title='XSSed'),'red')">A</p>
17364 <div style="top:EXPRESSION(alert())">B</div>
17365 !! html/php
17366 <p style="/* insecure input */">A</p>
17367 <div style="/* insecure input */">B</div>
17368
17369 !! html/parsoid
17370 <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>
17371 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"top:EXPRESSION(alert())"}}'>B</div>
17372 !! end
17373
17374 !! test
17375 MSIE 6 CSS safety test: IPA extensions (T57332)
17376 !! wikitext
17377 <div style="background-image:uʀʟ(javascript:alert())">A</div>
17378 <p style="font-size: 100px; color: expʀessɪoɴ((title='XSSed'),'red')">B</p>
17379 !! html/php
17380 <div style="/* insecure input */">A</div>
17381 <p style="/* insecure input */">B</p>
17382
17383 !! html/parsoid
17384 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"background-image:uʀʟ(javascript:alert())"}}'>A</div>
17385 <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>
17386 !! end
17387
17388 !! test
17389 MSIE 6 CSS safety test: sup/sub script (T57332)
17390 !! wikitext
17391 <div style="background-image:url⁽javascript:alert())">A</div>
17392 <div style="background-image:url₍javascript:alert())">B</div>
17393 <p style="font-size: 100px; color: expressioⁿ((title='XSSed'),'red')">C</p>
17394 !! html/php
17395 <div style="/* insecure input */">A</div>
17396 <div style="/* insecure input */">B</div>
17397 <p style="/* insecure input */">C</p>
17398
17399 !! html/parsoid
17400 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"background-image:url⁽javascript:alert())"}}'>A</div>
17401 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"background-image:url₍javascript:alert())"}}'>B</div>
17402 <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>
17403 !! end
17404
17405 !! test
17406 Opera -o-link CSS
17407 !! options
17408 parsoid=wt2html,html2html
17409 !! wikitext
17410 <div
17411 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;"
17412 style="-o-link:attr(title);-o-link-source:current">X</div>
17413 !! html/php
17414 <div title="data:text/html,&lt;img src=1 onerror=alert(1)&gt;" style="/* insecure input */">X</div>
17415
17416 !! html/parsoid
17417 <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>
17418 !! end
17419
17420 !! test
17421 MSIE 6 CSS safety test: Repetition markers (T57332)
17422 !! wikitext
17423 <p style="font-size: 100px; color: expres〱ion((title='XSSed'),'red')">A</p>
17424 <p style="font-size: 100px; color: expresゝion((title='XSSed'),'red')">B</p>
17425 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">C</p>
17426 <p style="font-size: 100px; color: expresヽion((title='XSSed'),'red')">D</p>
17427 <p style="font-size: 100px; color: expresﹽion((title='XSSed'),'red')">E</p>
17428 <p style="font-size: 100px; color: expresﹼion((title='XSSed'),'red')">F</p>
17429 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">G</p>
17430 !! html/php
17431 <p style="/* insecure input */">A</p>
17432 <p style="/* insecure input */">B</p>
17433 <p style="/* insecure input */">C</p>
17434 <p style="/* insecure input */">D</p>
17435 <p style="/* insecure input */">E</p>
17436 <p style="/* insecure input */">F</p>
17437 <p style="/* insecure input */">G</p>
17438
17439 !! html/parsoid
17440 <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>
17441 <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>
17442 <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>
17443 <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>
17444 <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>
17445 <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>
17446 <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>
17447 !! end
17448
17449 !! test
17450 Table attribute legitimate extension
17451 !! wikitext
17452 {|
17453 !+ style="<nowiki>color:blue</nowiki>"| status
17454 |}
17455 !! html
17456 <table>
17457 <tr>
17458 <th style="color:blue"> status
17459 </th></tr></table>
17460
17461 !!end
17462
17463 !! test
17464 Table attribute safety
17465 !! wikitext
17466 {|
17467 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
17468 |}
17469 !! html
17470 <table>
17471 <tr>
17472 <th style="/* insecure input */"> status
17473 </th></tr></table>
17474
17475 !! end
17476
17477 !! test
17478 CSS line continuation 1
17479 !! wikitext
17480 <div style="background-image: u\&#10;rl(test.jpg);"></div>
17481 !! html
17482 <div style="/* insecure input */"></div>
17483
17484 !! end
17485
17486 !! test
17487 CSS line continuation 2
17488 !! wikitext
17489 <div style="background-image: u\&#13;rl(test.jpg); "></div>
17490 !! html
17491 <div style="/* invalid control char */"></div>
17492
17493 !! end
17494
17495 !! article
17496 Template:Identity
17497 !! text
17498 {{{1}}}
17499 !! endarticle
17500
17501 !! test
17502 Expansion of multi-line templates in attribute values (T8255)
17503 !! wikitext
17504 <div style="background: {{identity|#00FF00}}">-</div>
17505 !! html
17506 <div style="background: #00FF00">-</div>
17507
17508 !! end
17509
17510 !! test
17511 Expansion of multi-line templates in attribute values (T8255 sanity check)
17512 !! wikitext
17513 <div style="background:
17514 #00FF00">-</div>
17515 !! html/php
17516 <div style="background: #00FF00">-</div>
17517
17518 !! html/parsoid
17519 <div style="background:
17520 #00FF00">-</div>
17521 !! end
17522
17523 !! test
17524 Expansion of multi-line templates in attribute values (T8255 sanity check 2)
17525 !! wikitext
17526 <div style="background: &#10;#00FF00">-</div>
17527 !! html
17528 <div style="background: &#10;#00FF00">-</div>
17529
17530 !! end
17531
17532 !! test
17533 Tags which are hidden from Tidy cannot pass through the Sanitizer
17534 !! wikitext
17535 <mw:toc><script>alert();</script></mw:toc>
17536 !! html+tidy
17537 <p>&lt;mw:toc&gt;&lt;script&gt;alert();&lt;/script&gt;&lt;/mw:toc&gt;</p>
17538 !! end
17539
17540 ###
17541 ### Parser hooks (see tests/parser/parserTestsParserHook.php for the <tag> extension)
17542 ###
17543
17544 !! test
17545 Parser hook: empty input
17546 !! wikitext
17547 <tag></tag>
17548 !! html/php
17549 <pre>
17550 ''
17551 array (
17552 )
17553 </pre>
17554
17555 !! html/parsoid
17556 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
17557 !! end
17558
17559 ## Don't expect parsoid to rt this form.
17560 !! test
17561 Parser hook: empty input using terminated empty elements
17562 !! options
17563 parsoid=wt2html,html2html
17564 !! wikitext
17565 <tag/>
17566 !! html/php
17567 <pre>
17568 NULL
17569 array (
17570 )
17571 </pre>
17572
17573 !! html/parsoid
17574 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":null}' data-parsoid='{}' about="#mwt2"></pre>
17575 !! end
17576
17577 !! test
17578 Parser hook: empty input using terminated empty elements (space before)
17579 !! wikitext
17580 <tag />
17581 !! html/php
17582 <pre>
17583 NULL
17584 array (
17585 )
17586 </pre>
17587
17588 !! html/parsoid
17589 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":null}' data-parsoid='{}' about="#mwt2"></pre>
17590 !! end
17591
17592 !! test
17593 Parser hook: basic input
17594 !! wikitext
17595 <tag>input</tag>
17596 !! html/php
17597 <pre>
17598 'input'
17599 array (
17600 )
17601 </pre>
17602
17603 !! html/parsoid
17604 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
17605 !! end
17606
17607 ## Don't expect parsoid to rt this form.
17608 !! test
17609 Parser hook: case insensitive
17610 !! options
17611 parsoid=wt2html,html2html
17612 !! wikitext
17613 <TAG>input</TAG>
17614 !! html/php
17615 <pre>
17616 'input'
17617 array (
17618 )
17619 </pre>
17620
17621 !! html/parsoid
17622 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
17623 !! end
17624
17625 ## Don't expect parsoid to rt this form.
17626 !! test
17627 Parser hook: case insensitive, redux
17628 !! options
17629 parsoid=wt2html,html2html
17630 !! wikitext
17631 <TaG>input</TAg>
17632 !! html/php
17633 <pre>
17634 'input'
17635 array (
17636 )
17637 </pre>
17638
17639 !! html/parsoid
17640 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
17641 !! end
17642
17643 !! test
17644 Parser hook: nested tags
17645 !! wikitext
17646 <tag><tag></tag></tag>
17647 !! html/php
17648 <pre>
17649 '<tag>'
17650 array (
17651 )
17652 </pre>&lt;/tag&gt;
17653
17654 !! html/parsoid
17655 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"&lt;tag>"}}' data-parsoid='{}' about="#mwt2"></pre>&lt;/tag>
17656 !! end
17657
17658 !! test
17659 Parser hook: basic arguments
17660 !! wikitext
17661 <tag width="200" height="100" depth="50" square=""></tag>
17662 !! html/php
17663 <pre>
17664 ''
17665 array (
17666 'width' => '200',
17667 'height' => '100',
17668 'depth' => '50',
17669 'square' => '',
17670 )
17671 </pre>
17672
17673 !! html/parsoid
17674 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
17675 !! end
17676
17677 ## Don't expect parsoid to rt this form.
17678 !! test
17679 Parser hook: basic arguments, variations
17680 !! options
17681 parsoid=wt2html,html2html
17682 !! wikitext
17683 <tag width=200 height = "100" depth = '50' square></tag>
17684 !! html/php
17685 <pre>
17686 ''
17687 array (
17688 'width' => '200',
17689 'height' => '100',
17690 'depth' => '50',
17691 'square' => '',
17692 )
17693 </pre>
17694
17695 !! html/parsoid
17696 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
17697 !! end
17698
17699 !! test
17700 Parser hook: argument containing a forward slash (T7344)
17701 !! wikitext
17702 <tag filename="/tmp/bla"></tag>
17703 !! html/php
17704 <pre>
17705 ''
17706 array (
17707 'filename' => '/tmp/bla',
17708 )
17709 </pre>
17710
17711 !! html/parsoid
17712 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"filename":"/tmp/bla"},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
17713 !! end
17714
17715 ## Don't expect parsoid to rt this form.
17716 !! test
17717 Parser hook: empty input using terminated empty elements (T4374)
17718 !! options
17719 parsoid=wt2html,html2html
17720 !! wikitext
17721 <tag foo=bar/>text
17722 !! html/php
17723 <pre>
17724 NULL
17725 array (
17726 'foo' => 'bar',
17727 )
17728 </pre>text
17729
17730 !! html/parsoid
17731 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"foo":"bar"},"body":null}' data-parsoid='{}' about="#mwt2"></pre>text
17732 !! end
17733
17734 ## </tag> should be output literally since there is no matching tag that begins it
17735 ## Don't expect parsoid to rt this form.
17736 !! test
17737 Parser hook: basic arguments using terminated empty elements (T4374)
17738 !! options
17739 parsoid=wt2html
17740 !! wikitext
17741 <tag width=200 height = "100" depth = '50' square/>
17742 other stuff
17743 </tag>
17744 !! html/php
17745 <pre>
17746 NULL
17747 array (
17748 'width' => '200',
17749 'height' => '100',
17750 'depth' => '50',
17751 'square' => '',
17752 )
17753 </pre>
17754 <p>other stuff
17755 &lt;/tag&gt;
17756 </p>
17757 !! html/parsoid
17758 <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
17759 &lt;/tag></p>
17760 !! end
17761
17762 ## Don't expect parsoid to rt this form.
17763 !! test
17764 Parser hook: Don't allow unclosed extension tags
17765 !! options
17766 parsoid=wt2html
17767 !! wikitext
17768 test <tag>123
17769
17770 this is a '''test'''
17771 !! html/php
17772 <p>test &lt;tag&gt;123
17773 </p><p>this is a <b>test</b>
17774 </p>
17775 !! html/parsoid
17776 <p>test &lt;tag>123</p>
17777
17778 <p>this is a <b>test</b></p>
17779 !! end
17780
17781 ###
17782 ### (see tests/parser/parserTestsParserHook.php for the <statictag> extension)
17783 ###
17784
17785 !! test
17786 Parser hook: static parser hook not inside a comment
17787 !! wikitext
17788 <statictag>hello, world</statictag>
17789
17790 <statictag action="flush" />
17791 !! html/php
17792 <p><br />
17793 hello, world
17794 </p>
17795 !! html/parsoid
17796 <p><span typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{},"body":{"extsrc":"hello, world"}}' data-parsoid='{}' about="#mwt2"></span></p>
17797 <p typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{"action":"flush"},"body":null}' data-parsoid='{}' about="#mwt4">hello, world</p>
17798 !! end
17799
17800 !! test
17801 Parser hook: static parser hook inside a comment
17802 !! wikitext
17803 <!-- <statictag>hello, world</statictag> -->
17804 <statictag action="flush" />
17805 !! html/php
17806 <p><br />
17807 </p>
17808 !! html/parsoid
17809 <!-- <statictag&#x3E;hello, world</statictag&#x3E; -->
17810 <p typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{"action":"flush"},"body":null}' data-parsoid='{}' about="#mwt2"></p>
17811 !! end
17812
17813 # Nested template calls; this case was broken by Parser.php rev 1.506,
17814 # since reverted.
17815
17816 !! article
17817 Template:One-parameter
17818 !! text
17819 (My parameter is: {{{1}}})
17820 !! endarticle
17821
17822 !! article
17823 Template:Map-one-parameter
17824 !! text
17825 {{{{{1}}}|{{{2}}}}}
17826 !! endarticle
17827
17828 !! test
17829 Nested template calls
17830 !! wikitext
17831 {{Map-one-parameter|One-parameter|param}}
17832 !! html
17833 <p>(My parameter is: param)
17834 </p>
17835 !! end
17836
17837
17838 ###
17839 ### Sanitizer
17840 ###
17841
17842 # HTML+Tidy effectively strips out the empty tags completely
17843 # But since Parsoid doesn't it wraps the <s></s> tags in p-tags
17844 # which Tidy would have done for the PHP parser had there been content inside it.
17845 !! test
17846 Sanitizer: Closing of open tags
17847 !! wikitext
17848 <s></s><table></table>
17849 !! html
17850 <s></s><table></table>
17851
17852 !! html/parsoid
17853 <p><s></s></p><table></table>
17854 !! end
17855
17856 !! test
17857 Sanitizer: Closing of open but not closed tags
17858 !! wikitext
17859 <s>foo
17860 !! html
17861 <p><s>foo</s>
17862 </p>
17863 !! end
17864
17865 !! test
17866 Sanitizer: Closing of closed but not open tags
17867 !! options
17868 parsoid=wt2html
17869 !! wikitext
17870 </s>
17871 !! html/php+tidy
17872 !! html/parsoid
17873 !! end
17874
17875 !! test
17876 Sanitizer: Closing of closed but not open table tags
17877 !! options
17878 parsoid=wt2html
17879 !! wikitext
17880 Table not started</td></tr></table>
17881 !! html/php+tidy
17882 <p>Table not started</p>
17883 !! html/parsoid
17884 <p>Table not started</p>
17885 !! end
17886
17887 !! test
17888 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
17889 !! wikitext
17890 <span id="æ: v">byte</span>[[#æ: v|backlink]]
17891 !! html/php
17892 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
17893 </p>
17894 !! html/parsoid
17895 <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>
17896 !! end
17897
17898 # In HTML5, the restrictions are that id must contain at least one character,
17899 # and must not contain any space characters.
17900 !! test
17901 Sanitizer: Validating the contents of the id attribute (T6515)
17902 !! options
17903 disabled
17904 !! wikitext
17905 <br id="" /><br id="a space" />
17906 !! html
17907 Something ...
17908 !! end
17909
17910 # In HTML5, id must be unique amongst all the ids in the element's home subtree.
17911 !! test
17912 Sanitizer: Validating id attribute uniqueness (T6515, T8301)
17913 !! options
17914 disabled
17915 !! wikitext
17916 <br id="foo" /><br id="foo" />
17917 !! html
17918 Something need to be done. foo-2 ?
17919 !! end
17920
17921 !! test
17922 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
17923 !! wikitext
17924 <div itemscope>
17925 <meta itemprop="hello" content="world">
17926 <meta http-equiv="refresh" content="5">
17927 <meta itemprop="hello" http-equiv="refresh" content="5">
17928 <link itemprop="hello" href="{{SERVER}}">
17929 <link rel="stylesheet" href="{{SERVER}}">
17930 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
17931 </div>
17932 !! html
17933 <div itemscope="">
17934 <p> <meta itemprop="hello" content="world" />
17935 &lt;meta http-equiv="refresh" content="5"&gt;
17936 <meta itemprop="hello" content="5" />
17937 <link itemprop="hello" href="http&#58;//example.org" />
17938 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
17939 <link itemprop="hello" href="http&#58;//example.org" />
17940 </p>
17941 </div>
17942
17943 !! end
17944
17945 !! test
17946 Sanitizer: Strip comments from CSS attributes
17947 !! options
17948 parsoid=wt2html,wt2wt
17949 !! wikitext
17950 <span style="margin:/*negate mbox-text padding */-0.125em -0.45em; /*rainbow*/rgba(255, 0, 0, 0.3)">2013</span>
17951 !! html/php
17952 <p><span style="margin: -0.125em -0.45em; rgba(255, 0, 0, 0.3)">2013</span>
17953 </p>
17954 !! html/parsoid
17955 <p><span style="margin: -0.125em -0.45em; rgba(255, 0, 0, 0.3)">2013</span></p>
17956 !! end
17957
17958 !! test
17959 Language converter: output gets cut off unexpectedly (T7757)
17960 !! options
17961 language=zh
17962 !! wikitext
17963 this bit is safe: }-
17964
17965 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
17966
17967 then we get cut off here: }-
17968
17969 all additional text is vanished
17970 !! html
17971 <p>this bit is safe: }-
17972 </p><p>but if we add a conversion instance: xxx
17973 </p><p>then we get cut off here: }-
17974 </p><p>all additional text is vanished
17975 </p>
17976 !! end
17977
17978 !! test
17979 Self closed html pairs (T7487)
17980 !! wikitext
17981 <center><font id="bug" />Centered text</center>
17982 <div><font id="bug2" />In div text</div>
17983 !! html+tidy
17984 <center><font id="bug"></font>Centered text</center>
17985 <div><font id="bug2"></font>In div text</div>
17986 !! end
17987
17988 #
17989 #
17990 #
17991
17992 !! test
17993 Punctuation: nbsp before exclamation
17994 !! wikitext
17995 C'est grave !
17996 !! html
17997 <p>C'est grave&#160;!
17998 </p>
17999 !! end
18000
18001 !! test
18002 Punctuation: CSS !important (T13874)
18003 !! wikitext
18004 <div style="width:50% !important">important</div>
18005 !! html
18006 <div style="width:50% !important">important</div>
18007
18008 !!end
18009
18010 !! test
18011 Punctuation: CSS ! important (T13874; with space after)
18012 !! wikitext
18013 <div style="width:50% ! important">important</div>
18014 !! html
18015 <div style="width:50% ! important">important</div>
18016
18017 !!end
18018
18019 !! test
18020 HTML bullet list, closed tags (T7497)
18021 !! wikitext
18022 <ul>
18023 <li>One</li>
18024 <li>Two</li>
18025 </ul>
18026 !! html/php
18027 <ul>
18028 <li>One</li>
18029 <li>Two</li>
18030 </ul>
18031
18032 !! html/parsoid
18033 <ul data-parsoid='{"stx":"html"}'>
18034 <li data-parsoid='{"stx":"html"}'>One</li>
18035 <li data-parsoid='{"stx":"html"}'>Two</li>
18036 </ul>
18037
18038 !! end
18039
18040 !! test
18041 HTML bullet list, unclosed tags (T7497)
18042 !! wikitext
18043 <ul>
18044 <li>One
18045 <li>Two
18046 </ul>
18047 !! html/php+tidy
18048 <ul>
18049 <li>One</li>
18050 <li>Two</li>
18051 </ul>
18052 !! html/parsoid
18053 <ul data-parsoid='{"stx":"html"}'>
18054 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
18055 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
18056 </ul>
18057
18058 !! end
18059
18060 !! test
18061 HTML ordered list, closed tags (T7497)
18062 !! wikitext
18063 <ol>
18064 <li>One</li>
18065 <li>Two</li>
18066 </ol>
18067 !! html/php
18068 <ol>
18069 <li>One</li>
18070 <li>Two</li>
18071 </ol>
18072
18073 !! html/parsoid
18074 <ol data-parsoid='{"stx":"html"}'>
18075 <li data-parsoid='{"stx":"html"}'>One</li>
18076 <li data-parsoid='{"stx":"html"}'>Two</li>
18077 </ol>
18078
18079 !! end
18080
18081 !! test
18082 HTML ordered list, unclosed tags (T7497)
18083 !! options
18084 !! wikitext
18085 <ol>
18086 <li>One
18087 <li>Two
18088 </ol>
18089 !! html/php+tidy
18090 <ol>
18091 <li>One</li>
18092 <li>Two</li>
18093 </ol>
18094 !! html/parsoid
18095 <ol data-parsoid='{"stx":"html"}'>
18096 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
18097 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
18098 </ol>
18099
18100 !! end
18101
18102 !! test
18103 HTML nested bullet list, closed tags (T7497)
18104 !! wikitext
18105 <ul>
18106 <li>One</li>
18107 <li>Two:
18108 <ul>
18109 <li>Sub-one</li>
18110 <li>Sub-two</li>
18111 </ul>
18112 </li>
18113 </ul>
18114 !! html/php
18115 <ul>
18116 <li>One</li>
18117 <li>Two:
18118 <ul>
18119 <li>Sub-one</li>
18120 <li>Sub-two</li>
18121 </ul>
18122 </li>
18123 </ul>
18124
18125 !! html/parsoid
18126 <ul data-parsoid='{"stx":"html"}'>
18127 <li data-parsoid='{"stx":"html"}'>One</li>
18128 <li data-parsoid='{"stx":"html"}'>Two:
18129 <ul data-parsoid='{"stx":"html"}'>
18130 <li data-parsoid='{"stx":"html"}'>Sub-one</li>
18131 <li data-parsoid='{"stx":"html"}'>Sub-two</li>
18132 </ul>
18133 </li>
18134 </ul>
18135 !! end
18136
18137 !! test
18138 HTML nested bullet list, open tags (T7497)
18139 !! wikitext
18140 <ul>
18141 <li>One
18142 <li>Two:
18143 <ul>
18144 <li>Sub-one
18145 <li>Sub-two
18146 </ul>
18147 </ul>
18148 !! html/php+tidy
18149 <ul>
18150 <li>One</li>
18151 <li>Two:
18152 <ul>
18153 <li>Sub-one</li>
18154 <li>Sub-two</li>
18155 </ul>
18156 </li>
18157 </ul>
18158 !! html/parsoid
18159 <ul>
18160 <li>One
18161 </li>
18162 <li>Two:
18163 <ul>
18164 <li>Sub-one
18165 </li>
18166 <li>Sub-two
18167 </li>
18168 </ul>
18169 </li>
18170 </ul>
18171
18172 !! end
18173
18174 !! test
18175 HTML nested ordered list, closed tags (T7497)
18176 !! wikitext
18177 <ol>
18178 <li>One</li>
18179 <li>Two:
18180 <ol>
18181 <li>Sub-one</li>
18182 <li>Sub-two</li>
18183 </ol>
18184 </li>
18185 </ol>
18186 !! html
18187 <ol>
18188 <li>One</li>
18189 <li>Two:
18190 <ol>
18191 <li>Sub-one</li>
18192 <li>Sub-two</li>
18193 </ol>
18194 </li>
18195 </ol>
18196
18197 !! end
18198
18199 !! test
18200 HTML nested ordered list, open tags (T7497)
18201 !! wikitext
18202 <ol>
18203 <li>One
18204 <li>Two:
18205 <ol>
18206 <li>Sub-one
18207 <li>Sub-two
18208 </ol>
18209 </ol>
18210 !! html/php
18211 <ol>
18212 <li>One
18213 <li>Two:
18214 <ol>
18215 <li>Sub-one
18216 <li>Sub-two
18217 </ol>
18218 </ol>
18219
18220 !! html/parsoid
18221 <ol>
18222 <li>One
18223 </li>
18224 <li>Two:
18225 <ol>
18226 <li>Sub-one
18227 </li>
18228 <li>Sub-two
18229 </li>
18230 </ol>
18231 </li>
18232 </ol>
18233
18234 !! end
18235
18236 !! test
18237 HTML ordered list item with parameters oddity
18238 !! wikitext
18239 <ol><li id="fragment">One</li>
18240 </ol>
18241 !! html
18242 <ol><li id="fragment">One</li>
18243 </ol>
18244
18245 !! end
18246
18247 # parsoid doesn't explicitly mark autonumbered links, see T55505
18248 !!test
18249 T7918: autonumbering
18250 !! wikitext
18251 [http://first/] [http://second] [ftp://ftp]
18252
18253 ftp://inlineftp
18254
18255 [mailto:enclosed@mail.tld With target]
18256
18257 [mailto:enclosed@mail.tld]
18258
18259 mailto:inline@mail.tld
18260 !! html/php
18261 <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>
18262 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
18263 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
18264 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
18265 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
18266 </p>
18267 !! html/parsoid
18268 <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>
18269 <p><a rel="mw:ExtLink" href="ftp://inlineftp">ftp://inlineftp</a></p>
18270 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld">With target</a></p>
18271 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld"></a></p>
18272 <p><a rel="mw:ExtLink" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a></p>
18273 !! end
18274
18275
18276 #
18277 # Security and HTML correctness
18278 # From Nick Jenkins' fuzz testing
18279 #
18280
18281 !! test
18282 Fuzz testing: Parser13
18283 !! wikitext
18284 {|
18285 | http://a|
18286 !! html
18287 <table>
18288 <tr>
18289 <td>
18290 </td>
18291 </tr>
18292 </table>
18293
18294 !! end
18295
18296 !! test
18297 Fuzz testing: Parser14
18298 !! wikitext
18299 == onmouseover= ==
18300 http://__TOC__
18301 !! html
18302 <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>
18303 http://<div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
18304 <ul>
18305 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
18306 </ul>
18307 </div>
18308
18309
18310 !! html+tidy
18311 <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>
18312 <p>http://</p>
18313 <div id="toc" class="toc">
18314 <div class="toctitle">
18315 <h2>Contents</h2>
18316 </div>
18317 <ul>
18318 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
18319 </ul>
18320 </div>
18321 <p></p>
18322 !! end
18323
18324 !! test
18325 Fuzz testing: Parser14-table
18326 !! options
18327 parsoid=wt2html,html2html
18328 !! wikitext
18329 ==a==
18330 {| STYLE=__TOC__
18331 !! html
18332 <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>
18333 <table style="&#95;_TOC&#95;_">
18334 <tr><td></td></tr>
18335 </table>
18336
18337 !! html+tidy
18338 <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>
18339 <table style="__TOC__">
18340 <tr>
18341 <td></td>
18342 </tr>
18343 </table>
18344 !! html/parsoid
18345 <h2>a</h2>
18346 <table style="__TOC__"></table>
18347 !! end
18348
18349 # Known to produce bogus xml (extra </td>)
18350 !! test
18351 Fuzz testing: Parser16
18352 !! wikitext
18353 {|
18354 !https://||||||
18355 !! html
18356 <table>
18357 <tr>
18358 <th>https://</th>
18359 <th></th>
18360 <th></th>
18361 <th>
18362 </td>
18363 </tr>
18364 </table>
18365
18366 !! html+tidy
18367 <table>
18368 <tr>
18369 <th>https://</th>
18370 <th></th>
18371 <th></th>
18372 <th></th>
18373 </tr>
18374 </table>
18375 !! end
18376
18377 !! test
18378 Fuzz testing: Parser21
18379 !! wikitext
18380 {|
18381 ! irc://{{ftp://a" onmouseover="alert('hello world');"
18382 |
18383 !! html
18384 <table>
18385 <tr>
18386 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
18387 </th>
18388 <td>
18389 </td>
18390 </tr>
18391 </table>
18392
18393 !! end
18394
18395 !! test
18396 Fuzz testing: Parser22
18397 !! wikitext
18398 http://===r:::https://b
18399
18400 {|
18401 !! html
18402 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
18403 </p>
18404 <table>
18405 <tr><td></td></tr>
18406 </table>
18407
18408 !! end
18409
18410 # Known to produce bad XML for now
18411 !! test
18412 Fuzz testing: Parser24
18413 !! options
18414 parsoid=wt2html
18415 !! wikitext
18416 {|
18417 {{{|
18418 <u CLASS=
18419 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
18420 <br style="onmouseover='alert(document.cookie);' " />
18421
18422 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
18423 |
18424 !! html/php
18425 <table>
18426 {{{|
18427 <u class="&#124;">}}}} &gt;
18428 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
18429
18430 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
18431 <tr>
18432 <td></u>
18433 </td>
18434 </tr>
18435 </table>
18436
18437 !! html/parsoid
18438 <p data-parsoid='{"fostered":true,"autoInsertedEnd":true}'>{{{|
18439 <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>"}'/>}}}} >
18440 <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}'>
18441
18442
18443
18444 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'></td></tr></tbody></table>
18445 !! end
18446
18447 # Note: the current result listed for this is not what the original one was,
18448 # but the original bug was JavaScript injection, which is fixed in any case.
18449 # It's not clear that the original result listed was any more correct than the
18450 # current one. Original result:
18451 # <p>{{{|
18452 # </p>
18453 # <li class="&#124;&#124;">
18454 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
18455 !!test
18456 Fuzz testing: Parser25 (T8055)
18457 !! wikitext
18458 {{{
18459 |
18460 <LI CLASS=||
18461 >
18462 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
18463 !! html/php
18464 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
18465 </p>
18466 !! html/parsoid
18467 <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"]}'>
18468 </span><p about="#mwt1">&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b></p>
18469 !! end
18470
18471 !!test
18472 Fuzz testing: URL adjacent extension (with space, clean)
18473 !! wikitext
18474 http://example.com <nowiki>junk</nowiki>
18475 !! html/php
18476 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
18477 </p>
18478 !! html/parsoid
18479 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a> <span typeof="mw:Nowiki">junk</span></p>
18480 !! end
18481
18482 !!test
18483 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
18484 !! wikitext
18485 http://example.com<nowiki>junk</nowiki>
18486 !! html/php
18487 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
18488 </p>
18489 !! html/parsoid
18490 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a><span typeof="mw:Nowiki">junk</span></p>
18491 !! end
18492
18493 !! test
18494 Fuzz testing: URL adjacent extension (no space, dirty; pre)
18495 !! wikitext
18496 http://example.com<pre>junk</pre>
18497 !! html/php
18498 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
18499
18500 !! html/php+tidy
18501 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></p>
18502 <pre>
18503 junk
18504 </pre>
18505 !! html/parsoid
18506 <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>
18507 !! end
18508
18509 !! test
18510 Fuzz testing: image with bogus manual thumbnail
18511 !! wikitext
18512 [[Image:foobar.jpg|thumbnail= ]]
18513 !! html/php
18514 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
18515
18516 !! html/parsoid
18517 <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>
18518 !! end
18519
18520 !! test
18521 Fuzz testing: encoded newline in generated HTML replacements (T8577)
18522 !! wikitext
18523 <pre dir="&#10;"></pre>
18524 !! html/php
18525 <pre dir="&#10;"></pre>
18526
18527 !! html/parsoid
18528 <pre typeof="mw:Extension/pre" about="#mwt2" dir="&amp;#10;" data-mw='{"name":"pre","attrs":{"dir":"&amp;#10;"},"body":{"extsrc":""}}'></pre>
18529 !! end
18530
18531 !! test
18532 Parsing optional HTML elements (T8171)
18533 !! options
18534 !! wikitext
18535 <table>
18536 <tr>
18537 <td> Some tabular data</td>
18538 <td> More tabular data ...
18539 <td> And yet som tabular data</td>
18540 </tr>
18541 </table>
18542 !! html
18543 <table>
18544 <tr>
18545 <td> Some tabular data</td>
18546 <td> More tabular data ...
18547 </td><td> And yet som tabular data</td>
18548 </tr>
18549 </table>
18550
18551 !! end
18552
18553 !! test
18554 Correct handling of <td>, <tr> (T8171)
18555 !! options
18556 !! wikitext
18557 <table>
18558 <tr>
18559 <td> Some tabular data</td>
18560 <td> More tabular data ...</td>
18561 <td> And yet som tabular data</td>
18562 </tr>
18563 </table>
18564 !! html
18565 <table>
18566 <tr>
18567 <td> Some tabular data</td>
18568 <td> More tabular data ...</td>
18569 <td> And yet som tabular data</td>
18570 </tr>
18571 </table>
18572
18573 !! end
18574
18575
18576 !! test
18577 Parsing crashing regression (fr:JavaScript)
18578 !! wikitext
18579 </body></x>
18580 !! html
18581 <p>&lt;/body&gt;&lt;/x&gt;
18582 </p>
18583 !! end
18584
18585 !! test
18586 Inline wiki vs wiki block nesting
18587 !! wikitext
18588 '''Bold paragraph
18589
18590 New wiki paragraph
18591 !! html
18592 <p><b>Bold paragraph</b>
18593 </p><p>New wiki paragraph
18594 </p>
18595 !! end
18596
18597 # FIXME: The current php output is documented
18598 # and desired output is the parsoid target.
18599 !! test
18600 Inline HTML vs wiki block nesting
18601 !! wikitext
18602 <b>Bold paragraph
18603
18604 New wiki paragraph
18605 !! html/php
18606 <p><b>Bold paragraph
18607 </p><p>New wiki paragraph</b>
18608 </p>
18609 !! html/parsoid
18610 <p><b>Bold paragraph</b>
18611 </p><p>New wiki paragraph
18612 </p>
18613 !! end
18614
18615 # Original result was this:
18616 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
18617 # </p>
18618 # While that might be marginally more intuitive, maybe, the six-apostrophe
18619 # construct is clearly pathological and the result stated here (which is what
18620 # the parser actually does) is about as reasonable as anything.
18621 !!test
18622 Mixing markup for italics and bold
18623 !! options
18624 !! wikitext
18625 '''bold''''''bold''bolditalics'''''
18626 !! html
18627 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
18628 </p>
18629 !! end
18630
18631
18632 !! article
18633 Xyzzyx
18634 !! text
18635 Article for special page transclusion test
18636 !! endarticle
18637
18638 !! test
18639 Special page transclusion
18640 !! options
18641 !! wikitext
18642 {{Special:Prefixindex/Xyzzyx}}
18643 !! html
18644 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
18645 </ul>
18646
18647 !! end
18648
18649 !! test
18650 Special page transclusion twice (T7021)
18651 !! options
18652 !! wikitext
18653 {{Special:Prefixindex/Xyzzyx}}
18654 {{Special:Prefixindex/Xyzzyx}}
18655 !! html
18656 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
18657 </ul>
18658 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
18659 </ul>
18660
18661 !! end
18662
18663 !! test
18664 Transclusion of default MediaWiki message
18665 !! wikitext
18666 {{MediaWiki:Mainpage}}
18667 !! html
18668 <p>Main Page
18669 </p>
18670 !! end
18671
18672 !! test
18673 Transclusion of nonexistent MediaWiki message
18674 !! wikitext
18675 {{MediaWiki:Mainpagexxx}}
18676 !! html
18677 <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>
18678 </p>
18679 !! end
18680
18681 !! test
18682 Transclusion of MediaWiki message with underscore
18683 !! wikitext
18684 {{MediaWiki:history_short}}
18685 !! html
18686 <p>History
18687 </p>
18688 !! end
18689
18690 !! test
18691 Transclusion of MediaWiki message with space
18692 !! wikitext
18693 {{MediaWiki:history short}}
18694 !! html
18695 <p>History
18696 </p>
18697 !! end
18698
18699 !! test
18700 Invalid header with following text
18701 !! wikitext
18702 = x = y
18703 !! html
18704 <p>= x = y
18705 </p>
18706 !! end
18707
18708
18709 !! test
18710 Section extraction test (section 0)
18711 !! options
18712 section=0
18713 !! wikitext
18714 start
18715 ==a==
18716 ===aa===
18717 ====aaa====
18718 ==b==
18719 ===ba===
18720 ===bb===
18721 ====bba====
18722 ===bc===
18723 ==c==
18724 ===ca===
18725 !! html/php
18726 start
18727 !! end
18728
18729 !! test
18730 Section extraction test (section 1)
18731 !! options
18732 section=1
18733 !! wikitext
18734 start
18735 ==a==
18736 ===aa===
18737 ====aaa====
18738 ==b==
18739 ===ba===
18740 ===bb===
18741 ====bba====
18742 ===bc===
18743 ==c==
18744 ===ca===
18745 !! html/php
18746 ==a==
18747 ===aa===
18748 ====aaa====
18749 !! end
18750
18751 !! test
18752 Section extraction test (section 2)
18753 !! options
18754 section=2
18755 !! wikitext
18756 start
18757 ==a==
18758 ===aa===
18759 ====aaa====
18760 ==b==
18761 ===ba===
18762 ===bb===
18763 ====bba====
18764 ===bc===
18765 ==c==
18766 ===ca===
18767 !! html/php
18768 ===aa===
18769 ====aaa====
18770 !! end
18771
18772 !! test
18773 Section extraction test (section 3)
18774 !! options
18775 section=3
18776 !! wikitext
18777 start
18778 ==a==
18779 ===aa===
18780 ====aaa====
18781 ==b==
18782 ===ba===
18783 ===bb===
18784 ====bba====
18785 ===bc===
18786 ==c==
18787 ===ca===
18788 !! html/php
18789 ====aaa====
18790 !! end
18791
18792 !! test
18793 Section extraction test (section 4)
18794 !! options
18795 section=4
18796 !! wikitext
18797 start
18798 ==a==
18799 ===aa===
18800 ====aaa====
18801 ==b==
18802 ===ba===
18803 ===bb===
18804 ====bba====
18805 ===bc===
18806 ==c==
18807 ===ca===
18808 !! html/php
18809 ==b==
18810 ===ba===
18811 ===bb===
18812 ====bba====
18813 ===bc===
18814 !! end
18815
18816 !! test
18817 Section extraction test (section 5)
18818 !! options
18819 section=5
18820 !! wikitext
18821 start
18822 ==a==
18823 ===aa===
18824 ====aaa====
18825 ==b==
18826 ===ba===
18827 ===bb===
18828 ====bba====
18829 ===bc===
18830 ==c==
18831 ===ca===
18832 !! html/php
18833 ===ba===
18834 !! end
18835
18836 !! test
18837 Section extraction test (section 6)
18838 !! options
18839 section=6
18840 !! wikitext
18841 start
18842 ==a==
18843 ===aa===
18844 ====aaa====
18845 ==b==
18846 ===ba===
18847 ===bb===
18848 ====bba====
18849 ===bc===
18850 ==c==
18851 ===ca===
18852 !! html/php
18853 ===bb===
18854 ====bba====
18855 !! end
18856
18857 !! test
18858 Section extraction test (section 7)
18859 !! options
18860 section=7
18861 !! wikitext
18862 start
18863 ==a==
18864 ===aa===
18865 ====aaa====
18866 ==b==
18867 ===ba===
18868 ===bb===
18869 ====bba====
18870 ===bc===
18871 ==c==
18872 ===ca===
18873 !! html/php
18874 ====bba====
18875 !! end
18876
18877 !! test
18878 Section extraction test (section 8)
18879 !! options
18880 section=8
18881 !! wikitext
18882 start
18883 ==a==
18884 ===aa===
18885 ====aaa====
18886 ==b==
18887 ===ba===
18888 ===bb===
18889 ====bba====
18890 ===bc===
18891 ==c==
18892 ===ca===
18893 !! html/php
18894 ===bc===
18895 !! end
18896
18897 !! test
18898 Section extraction test (section 9)
18899 !! options
18900 section=9
18901 !! wikitext
18902 start
18903 ==a==
18904 ===aa===
18905 ====aaa====
18906 ==b==
18907 ===ba===
18908 ===bb===
18909 ====bba====
18910 ===bc===
18911 ==c==
18912 ===ca===
18913 !! html/php
18914 ==c==
18915 ===ca===
18916 !! end
18917
18918 !! test
18919 Section extraction test (section 10)
18920 !! options
18921 section=10
18922 !! wikitext
18923 start
18924 ==a==
18925 ===aa===
18926 ====aaa====
18927 ==b==
18928 ===ba===
18929 ===bb===
18930 ====bba====
18931 ===bc===
18932 ==c==
18933 ===ca===
18934 !! html/php
18935 ===ca===
18936 !! end
18937
18938 !! test
18939 Section extraction test (nonexistent section 11)
18940 !! options
18941 section=11
18942 !! wikitext
18943 start
18944 ==a==
18945 ===aa===
18946 ====aaa====
18947 ==b==
18948 ===ba===
18949 ===bb===
18950 ====bba====
18951 ===bc===
18952 ==c==
18953 ===ca===
18954 !! html/php
18955 !! end
18956
18957 !! test
18958 Section extraction test with bogus heading (section 1)
18959 !! options
18960 section=1
18961 !! wikitext
18962 ==a==
18963 ==bogus== not a legal section
18964 ==b==
18965 !! html/php
18966 ==a==
18967 ==bogus== not a legal section
18968 !! end
18969
18970 !! test
18971 Section extraction test with bogus heading (section 2)
18972 !! options
18973 section=2
18974 !! wikitext
18975 ==a==
18976 ==bogus== not a legal section
18977 ==b==
18978 !! html/php
18979 ==b==
18980 !! end
18981
18982 !! test
18983 Section extraction test with comment after heading (section 1)
18984 !! options
18985 section=1
18986 !! wikitext
18987 ==a==
18988 ==b== <!-- -->
18989 ==c==
18990 !! html/php
18991 ==a==
18992 !! end
18993
18994 !! test
18995 Section extraction test with comment after heading (section 2)
18996 !! options
18997 section=2
18998 !! wikitext
18999 ==a==
19000 ==b== <!-- -->
19001 ==c==
19002 !! html/php
19003 ==b== <!-- -->
19004 !! end
19005
19006 !! test
19007 Section extraction test with bogus <nowiki> heading (section 1)
19008 !! options
19009 section=1
19010 !! wikitext
19011 ==a==
19012 ==bogus== <nowiki>not a legal section</nowiki>
19013 ==b==
19014 !! html/php
19015 ==a==
19016 ==bogus== <nowiki>not a legal section</nowiki>
19017 !! end
19018
19019 !! test
19020 Section extraction test with bogus <nowiki> heading (section 2)
19021 !! options
19022 section=2
19023 !! wikitext
19024 ==a==
19025 ==bogus== <nowiki>not a legal section</nowiki>
19026 ==b==
19027 !! html/php
19028 ==b==
19029 !! end
19030
19031 # Formerly testing for T4587, now resolved by the use of unmarked sections
19032 # instead of respecting commented sections
19033 !! test
19034 Section extraction prefixed by comment (section 1)
19035 !! options
19036 section=1
19037 !! wikitext
19038 <!-- -->==sec1==
19039 ==sec2==
19040 !! html/php
19041 ==sec2==
19042 !!end
19043
19044 !! test
19045 Section extraction prefixed by comment (section 2)
19046 !! options
19047 section=2
19048 !! wikitext
19049 <!-- -->==sec1==
19050 ==sec2==
19051 !! html/php
19052
19053 !!end
19054
19055 # Formerly testing for T4607, now resolved by the use of unmarked sections
19056 # instead of respecting HTML-style headings
19057 !! test
19058 Section extraction, mixed wiki and html (section 1)
19059 !! options
19060 section=1
19061 !! wikitext
19062 <h2>unmarked</h2>
19063 unmarked
19064 ==1==
19065 one
19066 ==2==
19067 two
19068 !! html/php
19069 ==1==
19070 one
19071 !! end
19072
19073 !! test
19074 Section extraction, mixed wiki and html (section 2)
19075 !! options
19076 section=2
19077 !! wikitext
19078 <h2>unmarked</h2>
19079 unmarked
19080 ==1==
19081 one
19082 ==2==
19083 two
19084 !! html/php
19085 ==2==
19086 two
19087 !! end
19088
19089
19090 # Formerly testing for T5342
19091 !! test
19092 Section extraction, heading surrounded by <noinclude>
19093 !! options
19094 section=1
19095 !! wikitext
19096 <noinclude>==unmarked==</noinclude>
19097 ==marked==
19098 !! html/php
19099 ==marked==
19100 !!end
19101
19102 # Test behavior of T21910
19103 !! test
19104 Sectiion with all-equals
19105 !! options
19106 section=2
19107 !! wikitext
19108 ===
19109 The line above must have a trailing space
19110 === <!--
19111 --> <!-- -->
19112 But just in case it doesn't...
19113 !! html/php
19114 === <!--
19115 --> <!-- -->
19116 But just in case it doesn't...
19117 !! end
19118
19119 !! test
19120 Section replacement test (section 0)
19121 !! options
19122 replace=0,"xxx"
19123 !! wikitext
19124 start
19125 ==a==
19126 ===aa===
19127 ====aaa====
19128 ==b==
19129 ===ba===
19130 ===bb===
19131 ====bba====
19132 ===bc===
19133 ==c==
19134 ===ca===
19135 !! html/php
19136 xxx
19137
19138 ==a==
19139 ===aa===
19140 ====aaa====
19141 ==b==
19142 ===ba===
19143 ===bb===
19144 ====bba====
19145 ===bc===
19146 ==c==
19147 ===ca===
19148 !! end
19149
19150 !! test
19151 Section replacement test (section 1)
19152 !! options
19153 replace=1,"xxx"
19154 !! wikitext
19155 start
19156 ==a==
19157 ===aa===
19158 ====aaa====
19159 ==b==
19160 ===ba===
19161 ===bb===
19162 ====bba====
19163 ===bc===
19164 ==c==
19165 ===ca===
19166 !! html/php
19167 start
19168 xxx
19169
19170 ==b==
19171 ===ba===
19172 ===bb===
19173 ====bba====
19174 ===bc===
19175 ==c==
19176 ===ca===
19177 !! end
19178
19179 !! test
19180 Section replacement test (section 2)
19181 !! options
19182 replace=2,"xxx"
19183 !! wikitext
19184 start
19185 ==a==
19186 ===aa===
19187 ====aaa====
19188 ==b==
19189 ===ba===
19190 ===bb===
19191 ====bba====
19192 ===bc===
19193 ==c==
19194 ===ca===
19195 !! html/php
19196 start
19197 ==a==
19198 xxx
19199
19200 ==b==
19201 ===ba===
19202 ===bb===
19203 ====bba====
19204 ===bc===
19205 ==c==
19206 ===ca===
19207 !! end
19208
19209 !! test
19210 Section replacement test (section 3)
19211 !! options
19212 replace=3,"xxx"
19213 !! wikitext
19214 start
19215 ==a==
19216 ===aa===
19217 ====aaa====
19218 ==b==
19219 ===ba===
19220 ===bb===
19221 ====bba====
19222 ===bc===
19223 ==c==
19224 ===ca===
19225 !! html/php
19226 start
19227 ==a==
19228 ===aa===
19229 xxx
19230
19231 ==b==
19232 ===ba===
19233 ===bb===
19234 ====bba====
19235 ===bc===
19236 ==c==
19237 ===ca===
19238 !! end
19239
19240 !! test
19241 Section replacement test (section 4)
19242 !! options
19243 replace=4,"xxx"
19244 !! wikitext
19245 start
19246 ==a==
19247 ===aa===
19248 ====aaa====
19249 ==b==
19250 ===ba===
19251 ===bb===
19252 ====bba====
19253 ===bc===
19254 ==c==
19255 ===ca===
19256 !! html/php
19257 start
19258 ==a==
19259 ===aa===
19260 ====aaa====
19261 xxx
19262
19263 ==c==
19264 ===ca===
19265 !! end
19266
19267 !! test
19268 Section replacement test (section 5)
19269 !! options
19270 replace=5,"xxx"
19271 !! wikitext
19272 start
19273 ==a==
19274 ===aa===
19275 ====aaa====
19276 ==b==
19277 ===ba===
19278 ===bb===
19279 ====bba====
19280 ===bc===
19281 ==c==
19282 ===ca===
19283 !! html/php
19284 start
19285 ==a==
19286 ===aa===
19287 ====aaa====
19288 ==b==
19289 xxx
19290
19291 ===bb===
19292 ====bba====
19293 ===bc===
19294 ==c==
19295 ===ca===
19296 !! end
19297
19298 !! test
19299 Section replacement test (section 6)
19300 !! options
19301 replace=6,"xxx"
19302 !! wikitext
19303 start
19304 ==a==
19305 ===aa===
19306 ====aaa====
19307 ==b==
19308 ===ba===
19309 ===bb===
19310 ====bba====
19311 ===bc===
19312 ==c==
19313 ===ca===
19314 !! html/php
19315 start
19316 ==a==
19317 ===aa===
19318 ====aaa====
19319 ==b==
19320 ===ba===
19321 xxx
19322
19323 ===bc===
19324 ==c==
19325 ===ca===
19326 !! end
19327
19328 !! test
19329 Section replacement test (section 7)
19330 !! options
19331 replace=7,"xxx"
19332 !! wikitext
19333 start
19334 ==a==
19335 ===aa===
19336 ====aaa====
19337 ==b==
19338 ===ba===
19339 ===bb===
19340 ====bba====
19341 ===bc===
19342 ==c==
19343 ===ca===
19344 !! html/php
19345 start
19346 ==a==
19347 ===aa===
19348 ====aaa====
19349 ==b==
19350 ===ba===
19351 ===bb===
19352 xxx
19353
19354 ===bc===
19355 ==c==
19356 ===ca===
19357 !! end
19358
19359 !! test
19360 Section replacement test (section 8)
19361 !! options
19362 replace=8,"xxx"
19363 !! wikitext
19364 start
19365 ==a==
19366 ===aa===
19367 ====aaa====
19368 ==b==
19369 ===ba===
19370 ===bb===
19371 ====bba====
19372 ===bc===
19373 ==c==
19374 ===ca===
19375 !! html/php
19376 start
19377 ==a==
19378 ===aa===
19379 ====aaa====
19380 ==b==
19381 ===ba===
19382 ===bb===
19383 ====bba====
19384 xxx
19385
19386 ==c==
19387 ===ca===
19388 !!end
19389
19390 !! test
19391 Section replacement test (section 9)
19392 !! options
19393 replace=9,"xxx"
19394 !! wikitext
19395 start
19396 ==a==
19397 ===aa===
19398 ====aaa====
19399 ==b==
19400 ===ba===
19401 ===bb===
19402 ====bba====
19403 ===bc===
19404 ==c==
19405 ===ca===
19406 !! html/php
19407 start
19408 ==a==
19409 ===aa===
19410 ====aaa====
19411 ==b==
19412 ===ba===
19413 ===bb===
19414 ====bba====
19415 ===bc===
19416 xxx
19417 !! end
19418
19419 !! test
19420 Section replacement test (section 10)
19421 !! options
19422 replace=10,"xxx"
19423 !! wikitext
19424 start
19425 ==a==
19426 ===aa===
19427 ====aaa====
19428 ==b==
19429 ===ba===
19430 ===bb===
19431 ====bba====
19432 ===bc===
19433 ==c==
19434 ===ca===
19435 !! html/php
19436 start
19437 ==a==
19438 ===aa===
19439 ====aaa====
19440 ==b==
19441 ===ba===
19442 ===bb===
19443 ====bba====
19444 ===bc===
19445 ==c==
19446 xxx
19447 !! end
19448
19449 !! test
19450 Section replacement test with initial whitespace (T15728)
19451 !! options
19452 replace=2,"xxx"
19453 !! wikitext
19454 Preformatted initial line
19455 ==a==
19456 ===a===
19457 !! html/php
19458 Preformatted initial line
19459 ==a==
19460 xxx
19461 !! end
19462
19463
19464 !! test
19465 Section extraction, heading followed by pre with 20 spaces (T8398)
19466 !! options
19467 section=1
19468 !! wikitext
19469 ==a==
19470 a
19471 !! html/php
19472 ==a==
19473 a
19474 !! end
19475
19476 !! test
19477 Section extraction, heading followed by pre with 19 spaces (T8398 sanity check)
19478 !! options
19479 section=1
19480 !! wikitext
19481 ==a==
19482 a
19483 !! html/php
19484 ==a==
19485 a
19486 !! end
19487
19488
19489 !! test
19490 Section extraction, <pre> around bogus header (T12309)
19491 !! options
19492 section=2
19493 !! wikitext
19494 == Section One ==
19495 <pre>
19496 =======
19497 </pre>
19498
19499 == Section Two ==
19500 stuff
19501 !! html/php
19502 == Section Two ==
19503 stuff
19504 !! end
19505
19506 !! test
19507 Section replacement, <pre> around bogus header (T12309)
19508 !! options
19509 replace=2,"xxx"
19510 !! wikitext
19511 == Section One ==
19512 <pre>
19513 =======
19514 </pre>
19515
19516 == Section Two ==
19517 stuff
19518 !! html/php
19519 == Section One ==
19520 <pre>
19521 =======
19522 </pre>
19523
19524 xxx
19525 !! end
19526
19527 !! test
19528 Handling of &#x0A; in URLs
19529 !! wikitext
19530 ** irc://&#x0A;a
19531 !! html/php
19532 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
19533
19534 !! html/parsoid
19535 <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>
19536 !! end
19537
19538 !! test
19539 Handling of %0A in URLs
19540 !! wikitext
19541 ** irc://%0Aa
19542 !! html/php
19543 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
19544
19545 !! html/parsoid
19546 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
19547 !! end
19548
19549 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
19550 !! test
19551 5 quotes, code coverage +1 line
19552 !! options
19553 parsoid=wt2html
19554 !! wikitext
19555 '''''
19556 !! html/php
19557 !! html/parsoid
19558 <p><b><i></i></b></p>
19559 !! end
19560
19561 # same html as previous, but wikitext adjusted to match parsoid html2wt
19562 # note that wt2html and html2html will put the <i> before the <b>
19563 !! test
19564 5 quotes, code coverage +1 line w/ nowiki (1)
19565 !! options
19566 parsoid=wt2wt,html2wt
19567 !! wikitext
19568 '''''<nowiki/>'''''
19569 !! html/php
19570 <p><i></i>
19571 </p>
19572 !! html/parsoid
19573 <p><b><i></i></b></p>
19574 !! end
19575
19576 # same as previous, just swapping the <i> and <b>
19577 !! test
19578 5 quotes, code coverage +1 line w/ nowiki (2)
19579 !! wikitext
19580 '''''<nowiki/>'''''
19581 !! html/php
19582 <p><i></i>
19583 </p>
19584 !! html/parsoid
19585 <p><i><b></b></i></p>
19586 !! end
19587
19588 !! test
19589 Special:Search page linking.
19590 !! wikitext
19591 {{Special:search}}
19592 !! html
19593 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
19594 </p>
19595 !! end
19596
19597 !! test
19598 {{!}} is a magic word
19599 !! wikitext
19600 {{!}} is a magic word there and {{!}} is still a magic word here
19601 | is not a magic word here but {{!}} is still a magic word here
19602 !! html/php
19603 <p>| is a magic word there and | is still a magic word here
19604 | is not a magic word here but | is still a magic word here
19605 </p>
19606 !! html/parsoid
19607 <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
19608 | 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>
19609 !! end
19610
19611 !! test
19612 Say the magic word
19613 !! options
19614 title=[[Parser test]]
19615 !! wikitext
19616 * {{PAGENAME}}
19617 * {{PAGENAMEE}}
19618 * {{FULLPAGENAME}}
19619 * {{FULLPAGENAMEE}}
19620 * {{BASEPAGENAME}}
19621 * {{BASEPAGENAMEE}}
19622 * {{SUBPAGENAME}}
19623 * {{SUBPAGENAMEE}}
19624 * {{ROOTPAGENAME}}
19625 * {{ROOTPAGENAMEE}}
19626 * {{TALKPAGENAME}}
19627 * {{TALKPAGENAMEE}}
19628 * {{SUBJECTPAGENAME}}
19629 * {{SUBJECTPAGENAMEE}}
19630 * {{NAMESPACEE}}
19631 * {{NAMESPACE}}
19632 * {{NAMESPACENUMBER}}
19633 * {{TALKSPACE}}
19634 * {{TALKSPACEE}}
19635 * {{SUBJECTSPACE}}
19636 * {{SUBJECTSPACEE}}
19637 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
19638 !! html
19639 <ul><li> Parser test</li>
19640 <li> Parser_test</li>
19641 <li> Parser test</li>
19642 <li> Parser_test</li>
19643 <li> Parser test</li>
19644 <li> Parser_test</li>
19645 <li> Parser test</li>
19646 <li> Parser_test</li>
19647 <li> Parser test</li>
19648 <li> Parser_test</li>
19649 <li> Talk:Parser test</li>
19650 <li> Talk:Parser_test</li>
19651 <li> Parser test</li>
19652 <li> Parser_test</li>
19653 <li> </li>
19654 <li> </li>
19655 <li> 0</li>
19656 <li> Talk</li>
19657 <li> Talk</li>
19658 <li> </li>
19659 <li> </li>
19660 <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>
19661
19662 !! end
19663 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
19664
19665 !! test
19666 Gallery with valid attributes
19667 !! wikitext
19668 <gallery type="123" summary="345">
19669 File:File:Foobar.jpg
19670 </gallery>
19671 !! html/php
19672 <ul class="gallery mw-gallery-traditional" type="123">
19673 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19674 <div class="thumb" style="height: 150px;">File:Foobar.jpg</div>
19675 <div class="gallerytext">
19676 </div>
19677 </div></li>
19678 </ul>
19679
19680 !! html/parsoid
19681 <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"}}'>
19682 <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>
19683 </ul>
19684 !! end
19685
19686 ## Parsoid thinks the "centre" here is a property, not a caption.
19687 !! test
19688 Gallery
19689 !! options
19690 parsoid={
19691 "modes": ["wt2html"],
19692 "nativeGallery": true
19693 }
19694 !! wikitext
19695 <gallery>
19696 image1.png |
19697 image2.gif|||||
19698
19699 image3|
19700 image4 |300px| centre
19701 image5.svg| http://///////
19702 [[x|xx]]]]
19703 * image6
19704 </gallery>
19705 !! html/php
19706 <ul class="gallery mw-gallery-traditional">
19707 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19708 <div class="thumb" style="height: 150px;">Image1.png</div>
19709 <div class="gallerytext">
19710 </div>
19711 </div></li>
19712 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19713 <div class="thumb" style="height: 150px;">Image2.gif</div>
19714 <div class="gallerytext">
19715 </div>
19716 </div></li>
19717 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19718 <div class="thumb" style="height: 150px;">Image3</div>
19719 <div class="gallerytext">
19720 </div>
19721 </div></li>
19722 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19723 <div class="thumb" style="height: 150px;">Image4</div>
19724 <div class="gallerytext">
19725 <pre>centre
19726 </pre>
19727 </div>
19728 </div></li>
19729 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19730 <div class="thumb" style="height: 150px;">Image5.svg</div>
19731 <div class="gallerytext">
19732 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
19733 </p>
19734 </div>
19735 </div></li>
19736 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19737 <div class="thumb" style="height: 150px;">* image6</div>
19738 <div class="gallerytext">
19739 </div>
19740 </div></li>
19741 </ul>
19742
19743 !! html/parsoid
19744 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt3" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
19745 <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>
19746 <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>
19747 <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>
19748 <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>
19749 <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>
19750 <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>
19751 </ul>
19752 !! end
19753
19754 !! test
19755 Gallery (with options, html)
19756 !! options
19757 parsoid={
19758 "modes": ["wt2html", "html2html"],
19759 "nativeGallery": true
19760 }
19761 !! wikitext
19762 <gallery widths="70px" heights="40px" perrow="2" caption="Foo [[Main Page]]">
19763 File:Nonexistent.jpg|caption
19764 File:Nonexistent.jpg
19765 image:foobar.jpg|some '''caption''' [[Main Page]]
19766 image:foobar.jpg
19767 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
19768 </gallery>
19769 !! html/php
19770 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
19771 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
19772 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19773 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
19774 <div class="gallerytext">
19775 <p>caption
19776 </p>
19777 </div>
19778 </div></li>
19779 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19780 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
19781 <div class="gallerytext">
19782 </div>
19783 </div></li>
19784 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19785 <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>
19786 <div class="gallerytext">
19787 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
19788 </p>
19789 </div>
19790 </div></li>
19791 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19792 <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>
19793 <div class="gallerytext">
19794 </div>
19795 </div></li>
19796 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19797 <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>
19798 <div class="gallerytext">
19799 <p>blabla.
19800 </p>
19801 </div>
19802 </div></li>
19803 </ul>
19804
19805 !! html/parsoid
19806 <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":{}}'>
19807 <li class="gallerycaption">Foo <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a></li>
19808 <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>
19809 <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>
19810 <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>
19811 <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>
19812 <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>
19813 </ul>
19814 !! end
19815
19816 !! test
19817 Gallery (with options, extsrc)
19818 !! options
19819 parsoid={
19820 "nativeGallery": false
19821 }
19822 !! wikitext
19823 <gallery widths="70px" heights="40px" perrow="2" caption="Foo [[Main Page]]">
19824 File:Nonexistent.jpg|caption
19825 File:Nonexistent.jpg
19826 image:foobar.jpg|some '''caption''' [[Main Page]]
19827 image:foobar.jpg
19828 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
19829 </gallery>
19830 !! html/php
19831 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
19832 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
19833 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19834 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
19835 <div class="gallerytext">
19836 <p>caption
19837 </p>
19838 </div>
19839 </div></li>
19840 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19841 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
19842 <div class="gallerytext">
19843 </div>
19844 </div></li>
19845 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19846 <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>
19847 <div class="gallerytext">
19848 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
19849 </p>
19850 </div>
19851 </div></li>
19852 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19853 <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>
19854 <div class="gallerytext">
19855 </div>
19856 </div></li>
19857 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19858 <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>
19859 <div class="gallerytext">
19860 <p>blabla.
19861 </p>
19862 </div>
19863 </div></li>
19864 </ul>
19865
19866 !! html/parsoid
19867 <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"}}'>
19868 <li class="gallerycaption">Foo <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a></li>
19869 <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>
19870 <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>
19871 <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>
19872 <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>
19873 <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>
19874 </ul>
19875 !! end
19876
19877 !! test
19878 Gallery with link that has fragment
19879 !! options
19880 parsoid={
19881 "modes": ["wt2html", "html2html"],
19882 "nativeGallery": true
19883 }
19884 !! wikitext
19885 <gallery>
19886 image:foobar.jpg|link=Main_Page
19887 image:foobar.jpg|link=Main_Page#section
19888 image:foobar.jpg|link=Main Page#section|caption
19889 </gallery>
19890 !! html/php
19891 <ul class="gallery mw-gallery-traditional">
19892 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19893 <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>
19894 <div class="gallerytext">
19895 </div>
19896 </div></li>
19897 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19898 <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>
19899 <div class="gallerytext">
19900 </div>
19901 </div></li>
19902 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19903 <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>
19904 <div class="gallerytext">
19905 <p>caption
19906 </p>
19907 </div>
19908 </div></li>
19909 </ul>
19910
19911 !! html/parsoid
19912 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
19913 <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>
19914 <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>
19915 <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>
19916 </ul>
19917 !! end
19918
19919 ## Whoops, Parsoid shouldn't be parsing templates in the attribute caption!
19920 !! test
19921 Gallery with template inside caption
19922 !! options
19923 parsoid={
19924 "nativeGallery": true
19925 }
19926 !! wikitext
19927 <gallery caption="{{echo|hi}}">
19928 File:Foobar.jpg|{{echo|ho}}
19929 </gallery>
19930 !! html/php
19931 <ul class="gallery mw-gallery-traditional">
19932 <li class='gallerycaption'>{{echo|hi}}</li>
19933 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19934 <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>
19935 <div class="gallerytext">
19936 <p>ho
19937 </p>
19938 </div>
19939 </div></li>
19940 </ul>
19941
19942 !! html/parsoid
19943 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt6" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
19944 <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>
19945 <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>
19946 </ul>
19947 !! end
19948
19949 !! test
19950 Gallery with wikitext inside caption
19951 !! options
19952 parsoid={
19953 "nativeGallery": true
19954 }
19955 !! wikitext
19956 <gallery>
19957 File:Foobar.jpg|alt=galleryalt|[[File:Foobar.jpg|alt=inneralt|20x20px|desc]]
19958 File:Foobar.jpg|alt=galleryalt|{{Test|unamedParam|alt=param}}
19959 </gallery>
19960 !! html/php
19961 <ul class="gallery mw-gallery-traditional">
19962 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19963 <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>
19964 <div class="gallerytext">
19965 <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>
19966 </p>
19967 </div>
19968 </div></li>
19969 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19970 <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>
19971 <div class="gallerytext">
19972 <p>This is a test template
19973 </p>
19974 </div>
19975 </div></li>
19976 </ul>
19977
19978 !! html/parsoid
19979 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt6" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
19980 <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>
19981 <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>
19982 </ul>
19983 !! end
19984
19985 !! test
19986 Gallery (with showfilename option)
19987 !! options
19988 parsoid={
19989 "nativeGallery": true
19990 }
19991 !! wikitext
19992 <gallery showfilename="">
19993 File:Nonexistent.jpg|caption
19994 File:Nonexistent.jpg
19995 File:Foobar.jpg|some '''caption''' [[Main Page]]
19996 File:Foobar.jpg
19997 </gallery>
19998 !! html/php
19999 <ul class="gallery mw-gallery-traditional">
20000 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20001 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
20002 <div class="gallerytext">
20003 <p><a href="/wiki/File:Nonexistent.jpg" class="galleryfilename galleryfilename-truncate" title="File:Nonexistent.jpg">Nonexistent.jpg</a>
20004 caption
20005 </p>
20006 </div>
20007 </div></li>
20008 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20009 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
20010 <div class="gallerytext">
20011 <p><a href="/wiki/File:Nonexistent.jpg" class="galleryfilename galleryfilename-truncate" title="File:Nonexistent.jpg">Nonexistent.jpg</a>
20012 </p>
20013 </div>
20014 </div></li>
20015 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20016 <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>
20017 <div class="gallerytext">
20018 <p><a href="/wiki/File:Foobar.jpg" class="galleryfilename galleryfilename-truncate" title="File:Foobar.jpg">Foobar.jpg</a>
20019 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
20020 </p>
20021 </div>
20022 </div></li>
20023 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20024 <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>
20025 <div class="gallerytext">
20026 <p><a href="/wiki/File:Foobar.jpg" class="galleryfilename galleryfilename-truncate" title="File:Foobar.jpg">Foobar.jpg</a>
20027 </p>
20028 </div>
20029 </div></li>
20030 </ul>
20031
20032 !! html/parsoid
20033 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt3" data-mw='{"name":"gallery","attrs":{"showfilename":""},"body":{}}'>
20034 <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>
20035 <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>
20036 <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>
20037 <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>
20038 </ul>
20039 !! end
20040
20041 ## Should Parsoid be preserving these variations?
20042 !! test
20043 Gallery (with namespace-less filenames)
20044 !! options
20045 parsoid={
20046 "modes": ["wt2html", "html2html"],
20047 "nativeGallery": true
20048 }
20049 !! wikitext
20050 <gallery>
20051 File:Nonexistent.jpg
20052 Nonexistent.jpg
20053 image:foobar.jpg
20054 foobar.jpg
20055 </gallery>
20056 !! html/php
20057 <ul class="gallery mw-gallery-traditional">
20058 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20059 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
20060 <div class="gallerytext">
20061 </div>
20062 </div></li>
20063 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20064 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
20065 <div class="gallerytext">
20066 </div>
20067 </div></li>
20068 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20069 <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>
20070 <div class="gallerytext">
20071 </div>
20072 </div></li>
20073 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20074 <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>
20075 <div class="gallerytext">
20076 </div>
20077 </div></li>
20078 </ul>
20079
20080 !! html/parsoid
20081 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20082 <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>
20083 <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>
20084 <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>
20085 <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>
20086 </ul>
20087 !! end
20088
20089 !! test
20090 Gallery override link with WikiLink (T36852)
20091 !! options
20092 parsoid={
20093 "nativeGallery": true
20094 }
20095 !! wikitext
20096 <gallery>
20097 File:Foobar.jpg|alt=galleryalt|link=InterWikiLink
20098 </gallery>
20099 !! html/php
20100 <ul class="gallery mw-gallery-traditional">
20101 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20102 <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>
20103 <div class="gallerytext">
20104 </div>
20105 </div></li>
20106 </ul>
20107
20108 !! html/parsoid
20109 <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":{}}'>
20110 <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>
20111 </ul>
20112 !! end
20113
20114 !! test
20115 Gallery override link with absolute external link (T36852)
20116 !! options
20117 parsoid={
20118 "nativeGallery": true
20119 }
20120 !! wikitext
20121 <gallery>
20122 File:Foobar.jpg|alt=galleryalt|link=http://www.example.org
20123 </gallery>
20124 !! html/php
20125 <ul class="gallery mw-gallery-traditional">
20126 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20127 <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>
20128 <div class="gallerytext">
20129 </div>
20130 </div></li>
20131 </ul>
20132
20133 !! html/parsoid
20134 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20135 <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>
20136 </ul>
20137 !! end
20138
20139 !! test
20140 Gallery override link with absolute external link with LanguageConverter
20141 !! options
20142 language=zh
20143 !! input
20144 <gallery>
20145 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
20146 </gallery>
20147 !! result
20148 <ul class="gallery mw-gallery-traditional">
20149 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20150 <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>
20151 <div class="gallerytext">
20152 <p>caption
20153 </p>
20154 </div>
20155 </div></li>
20156 </ul>
20157
20158 !! end
20159
20160 !! test
20161 Gallery override link with malicious javascript (T36852)
20162 !! options
20163 parsoid={
20164 "modes": ["wt2html", "html2html"],
20165 "nativeGallery": true
20166 }
20167 !! wikitext
20168 <gallery>
20169 File:Foobar.jpg|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
20170 </gallery>
20171 !! html/php
20172 <ul class="gallery mw-gallery-traditional">
20173 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20174 <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>
20175 <div class="gallerytext">
20176 </div>
20177 </div></li>
20178 </ul>
20179
20180 !! html/parsoid
20181 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20182 <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>
20183 </ul>
20184 !! end
20185
20186 !! test
20187 Gallery with invalid title as link (T45964)
20188 !! options
20189 parsoid={
20190 "modes": ["wt2html", "html2html"],
20191 "nativeGallery": true
20192 }
20193 !! wikitext
20194 <gallery>
20195 File:Foobar.jpg|link=<
20196 </gallery>
20197 !! html/php
20198 <ul class="gallery mw-gallery-traditional">
20199 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20200 <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>
20201 <div class="gallerytext">
20202 </div>
20203 </div></li>
20204 </ul>
20205
20206 !! html/parsoid
20207 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20208 <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>
20209 </ul>
20210 !! end
20211
20212 !! test
20213 Serialize gallery without attrs in data-mw
20214 !! options
20215 parsoid={
20216 "modes": ["html2wt"],
20217 "nativeGallery": true
20218 }
20219 !! html/parsoid
20220 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","body":{}}'>
20221 <li class="gallerycaption">123</li>
20222 <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>
20223 </ul>
20224 !! wikitext
20225 <gallery caption="123">
20226 File:Test.png
20227 </gallery>
20228 !! end
20229
20230 !! test
20231 Gallery with class and style attributes
20232 !! options
20233 parsoid={
20234 "nativeGallery": true
20235 }
20236 !! wikitext
20237 <gallery class="center" style="text-align: center;">
20238 File:Foobar.jpg
20239 </gallery>
20240 !! html/php
20241 <ul class="gallery mw-gallery-traditional center" style="text-align: center;">
20242 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20243 <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>
20244 <div class="gallerytext">
20245 </div>
20246 </div></li>
20247 </ul>
20248
20249 !! html/parsoid
20250 <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":{}}'>
20251 <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>
20252 </ul>
20253 !! end
20254
20255 !! test
20256 Gallery in slideshow mode
20257 !! options
20258 parsoid={
20259 "nativeGallery": true
20260 }
20261 !! wikitext
20262 <gallery mode="slideshow" showthumbnails="">
20263 File:Foobar.jpg
20264 </gallery>
20265 !! html/php
20266 <ul class="gallery mw-gallery-slideshow" data-showthumbnails="1">
20267 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20268 <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>
20269 <div class="gallerytext">
20270 </div>
20271 </div></li>
20272 </ul>
20273
20274 !! html/parsoid
20275 <ul class="gallery mw-gallery-slideshow" data-showthumbnails="1" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{"mode":"slideshow","showthumbnails":""},"body":{}}'>
20276 <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>
20277 </ul>
20278 !! end
20279
20280 !! test
20281 HTML Hex character encoding (spells the word "JavaScript")
20282 !! options
20283 parsoid=wt2html,wt2wt,html2html
20284 !! wikitext
20285 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
20286 !! html/php
20287 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
20288 </p>
20289 !! html/php+tidy
20290 <p>JavaScript</p>
20291 !! html/parsoid
20292 <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>
20293 !! end
20294
20295 !! test
20296 HTML Hex character encoding bogus encoding (T28437 regression check)
20297 !! wikitext
20298 &#xsee;&#XSEE;
20299 !! html/php
20300 <p>&amp;#xsee;&amp;#XSEE;
20301 </p>
20302 !! html/parsoid
20303 <p>&amp;#xsee;&amp;#XSEE;</p>
20304 !! end
20305
20306 !! test
20307 HTML Hex character encoding mixed case
20308 !! options
20309 parsoid=wt2html,wt2wt,html2html
20310 !! wikitext
20311 &#xEE;&#Xee;
20312 !! html/php
20313 <p>&#xee;&#xee;
20314 </p>
20315 !! html/php+tidy
20316 <p>îî</p>
20317 !! html/parsoid
20318 <p><span typeof="mw:Entity">î</span><span typeof="mw:Entity">î</span></p>
20319 !! end
20320
20321 # See: https://www.w3.org/TR/html5/syntax.html#character-references
20322 # Note that U+000C (form feed) is not a valid XML character, so
20323 # it is banned even though allowed in HTML5.
20324 !! test
20325 Illegal character references (T106578)
20326 !! wikitext
20327 ; Null: &#00;
20328 ; FF: &#xC;
20329 ; CR: &#xD;
20330 ; Control (low): &#8;
20331 ; Control (high): &#x7F; &#x9F;
20332 ; Surrogate: &#xD83D;&#xDCA9;
20333 ; This is an okay astral character: &#x1F4A9;
20334 !! html+tidy
20335 <dl>
20336 <dt>Null</dt>
20337 <dd>&amp;#00;</dd>
20338 <dt>FF</dt>
20339 <dd>&amp;#xC;</dd>
20340 <dt>CR</dt>
20341 <dd>&amp;#xD;</dd>
20342 <dt>Control (low)</dt>
20343 <dd>&amp;#8;</dd>
20344 <dt>Control (high)</dt>
20345 <dd>&amp;#x7F; &amp;#x9F;</dd>
20346 <dt>Surrogate</dt>
20347 <dd>&amp;#xD83D;&amp;#xDCA9;</dd>
20348 <dt>This is an okay astral character</dt>
20349 <dd>💩</dd>
20350 </dl>
20351 !! end
20352
20353 !! test
20354 __FORCETOC__ override
20355 !! wikitext
20356 __NEWSECTIONLINK__
20357 __FORCETOC__
20358 !! html/php
20359 <p><br />
20360 </p>
20361 !! end
20362
20363 !! test
20364 ISBN code coverage
20365 !! wikitext
20366 ISBN 978-0-1234-56&#x20;789
20367 !! html
20368 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
20369 </p>
20370 !! html+tidy
20371 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a> 789</p>
20372 !! html/parsoid
20373 <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>
20374 !! end
20375
20376 !! test
20377 ISBN followed by 5 spaces
20378 !! wikitext
20379 ISBN
20380 !! html
20381 <p>ISBN
20382 </p>
20383 !! end
20384
20385 !! test
20386 Double ISBN
20387 !! wikitext
20388 ISBN ISBN 1234567890
20389 !! html/php
20390 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
20391 </p>
20392 !! html/parsoid
20393 <p>ISBN <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a></p>
20394 !! end
20395
20396 # Uppercase X and lowercase x as well
20397 !! test
20398 ISBN with an X
20399 !! wikitext
20400 ISBN 3-462-04561-X
20401 ISBN 3-462-04561-x
20402 ISBN 080442957X
20403 ISBN 080442957x
20404 ISBN 978080442957X
20405 ISBN 978080442957x
20406 !! html/php
20407 <p><a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-X</a>
20408 <a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-x</a>
20409 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957X</a>
20410 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957x</a>
20411 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957X</a>
20412 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957x</a>
20413 </p>
20414 !! html/parsoid
20415 <p><a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-X</a>
20416 <a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-x</a>
20417 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957X</a>
20418 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957x</a>
20419 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957X</a>
20420 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957x</a></p>
20421 !! end
20422
20423 !! test
20424 ISBN with empty prefix (parsoid test)
20425 !! wikitext
20426 ISBN 1234567890
20427 !! html/php
20428 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
20429 </p>
20430 !! html/parsoid
20431 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink">ISBN 1234567890</a></p>
20432 !! end
20433
20434 !! test
20435 T24905: <abbr> followed by ISBN followed by </a>
20436 !! wikitext
20437 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
20438 !! html/php
20439 <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>
20440 </p>
20441 !! html/parsoid
20442 <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>
20443 !! end
20444
20445 !! test
20446 Double RFC
20447 !! wikitext
20448 RFC RFC 1234
20449 !! html
20450 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
20451 </p>
20452 !! end
20453
20454 !! test
20455 Double RFC with a wiki link
20456 !! wikitext
20457 RFC [[RFC 1234]]
20458 !! html
20459 <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>
20460 </p>
20461 !! end
20462
20463 !! test
20464 RFC code coverage
20465 !! wikitext
20466 RFC 983&#x20;987
20467 !! html
20468 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
20469 </p>
20470 !! html+tidy
20471 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a> 987</p>
20472 !! end
20473
20474 !! test
20475 Centre-aligned image
20476 !! wikitext
20477 [[Image:foobar.jpg|centre]]
20478 !! html
20479 <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>
20480
20481 !!end
20482
20483 !! test
20484 None-aligned image
20485 !! wikitext
20486 [[Image:foobar.jpg|none]]
20487 !! html
20488 <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>
20489
20490 !!end
20491
20492 !! test
20493 Width + Height sized image (using px) (height is ignored)
20494 !! wikitext
20495 [[Image:foobar.jpg|640x480px]]
20496 !! html
20497 <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>
20498 </p>
20499 !!end
20500
20501 !! test
20502 Width-sized image (using px, no following whitespace)
20503 !! wikitext
20504 [[Image:foobar.jpg|640px]]
20505 !! html
20506 <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>
20507 </p>
20508 !!end
20509
20510 !! test
20511 Width-sized image (using px, with following whitespace - test regression from r39467)
20512 !! wikitext
20513 [[Image:foobar.jpg|640px ]]
20514 !! html
20515 <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>
20516 </p>
20517 !!end
20518
20519 !! test
20520 Width-sized image (using px, with preceding whitespace - test regression from r39467)
20521 !! wikitext
20522 [[Image:foobar.jpg| 640px]]
20523 !! html
20524 <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>
20525 </p>
20526 !!end
20527
20528 !! test
20529 Image with page parameter
20530 !! options
20531 djvu
20532 !! wikitext
20533 [[File:LoremIpsum.djvu|page=2]]
20534 !! html/php
20535 <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>
20536 </p>
20537 !! html/parsoid
20538 <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>
20539 !! end
20540
20541 !! test
20542 Another italics / bold test
20543 !! wikitext
20544 ''' ''x'
20545 !! html
20546 <pre>'<i> </i>x'
20547 </pre>
20548 !!end
20549
20550 # FIXME: The php output seems broken. It's interleaving some open/close tags.
20551 !! test
20552 dt/dd/dl test
20553 !! wikitext
20554 :;;;::
20555 !! html/php
20556 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dt></dl></dd></dl></dd></dl></dd></dl></dd></dl></dd></dl>
20557
20558 !! html/parsoid
20559 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dd></dl></dd></dl></dt></dl></dt></dl></dt></dl></dd></dl>
20560
20561 !!end
20562
20563 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
20564 !! test
20565 Images with the "|" character in the comment
20566 !! wikitext
20567 [[File:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
20568 !! html/php
20569 <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>
20570
20571 !! html/parsoid
20572 <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>
20573 !! end
20574
20575 !! test
20576 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
20577 !! wikitext
20578 <html><script>alert(1);</script></html>
20579 !! html
20580 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
20581 </p>
20582 !! end
20583
20584 !! test
20585 HTML with raw HTML ($wgRawHtml==true)
20586 !! options
20587 wgRawHtml=1
20588 !! wikitext
20589 <html><script>alert(1);</script></html>
20590 !! html
20591 <p><script>alert(1);</script>
20592 </p>
20593 !! end
20594
20595 !! test
20596 Parents of subpages, one level up
20597 !! options
20598 subpage title=[[Subpage test/L1/L2/L3]]
20599 !! wikitext
20600 [[../|L2]]
20601 !! html
20602 <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>
20603 </p>
20604 !! end
20605
20606
20607 !! test
20608 Parents of subpages, one level up, not named
20609 !! options
20610 subpage title=[[Subpage test/L1/L2/L3]]
20611 !! wikitext
20612 [[../]]
20613 !! html
20614 <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>
20615 </p>
20616 !! end
20617
20618
20619
20620 !! test
20621 Parents of subpages, two levels up
20622 !! options
20623 subpage title=[[Subpage test/L1/L2/L3]]
20624 !! wikitext
20625 [[../../|L1]]2
20626
20627 [[../../|L1]]l
20628 !! html
20629 <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
20630 </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>
20631 </p>
20632 !! end
20633
20634 !! test
20635 Parents of subpages, two levels up, without trailing slash or name.
20636 !! options
20637 subpage title=[[Subpage test/L1/L2/L3]]
20638 !! wikitext
20639 [[../..]]
20640 !! html
20641 <p>[[../..]]
20642 </p>
20643 !! end
20644
20645 !! test
20646 Parents of subpages, two levels up, with lots of extra trailing slashes.
20647 !! options
20648 subpage title=[[Subpage test/L1/L2/L3]]
20649 !! wikitext
20650 [[../../////]]
20651 !! html
20652 <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>
20653 </p>
20654 !! end
20655
20656 !! article
20657 Subpage test/L1/L2/L3Sibling
20658 !! text
20659 Sibling article
20660 !! endarticle
20661
20662 !! test
20663 Transclusion of a sibling page (one level up)
20664 !! options
20665 subpage title=[[Subpage test/L1/L2/L3]]
20666 !! wikitext
20667 {{../L3Sibling}}
20668 !! html
20669 <p>Sibling article
20670 </p>
20671 !! end
20672
20673 !! test
20674 Transclusion of a child page
20675 !! options
20676 subpage title=[[Subpage test/L1/L2]]
20677 !! wikitext
20678 {{/L3Sibling}}
20679 !! html
20680 <p>Sibling article
20681 </p>
20682 !! end
20683
20684 # This is wt2html only in Parsoid because we add <nowiki>
20685 # because of {{..}} and we don't expect to fix that to
20686 # eliminate the nowikis selective for {{..}} markup.
20687 !! test
20688 Non-transclusion because of too many up levels
20689 !! options
20690 subpage title=[[Subpage test/L1/L2/L3]]
20691 parsoid=wt2html
20692 !! wikitext
20693 {{../../../../More than parent}}
20694 !! html/php
20695 <p>{{../../../../More than parent}}
20696 </p>
20697 !! html/parsoid
20698 <p>{{../../../../More than parent}}</p>
20699 !! end
20700
20701 !! test
20702 Definition list code coverage
20703 !! wikitext
20704 ; title : def
20705 ; title : def
20706 ;title: def
20707 !! html/php
20708 <dl><dt> title &#160;</dt>
20709 <dd> def</dd>
20710 <dt> title&#160;</dt>
20711 <dd> def</dd>
20712 <dt>title</dt>
20713 <dd> def</dd></dl>
20714
20715 !! html/parsoid
20716 <dl><dt> title <span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
20717 <dt> title<span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
20718 <dt>title</dt><dd> def</dd></dl>
20719 !! end
20720
20721 !! test
20722 Don't fall for the self-closing div
20723 !! wikitext
20724 <div>hello world</div/>
20725 !! html
20726 <div>hello world</div>
20727
20728 !! end
20729
20730 !! test
20731 MSGNW magic word
20732 !! wikitext
20733 {{MSGNW:msg}}
20734 !! html/php
20735 <p>&#91;&#91;:Template:Msg&#93;&#93;
20736 </p>
20737 !! end
20738
20739 !! test
20740 RAW magic word
20741 !! wikitext
20742 {{RAW:QUERTY}}
20743 !! html
20744 <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>
20745 </p>
20746 !! end
20747
20748 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
20749 !! test
20750 Always escape literal '>' in output, not just after '<'
20751 !! wikitext
20752 ><>
20753 !! html
20754 <p>&gt;&lt;&gt;
20755 </p>
20756 !! end
20757
20758 !! test
20759 Template caching
20760 !! wikitext
20761 {{Test}}
20762 {{Test}}
20763 !! html
20764 <p>This is a test template
20765 This is a test template
20766 </p>
20767 !! end
20768
20769
20770 !! article
20771 MediaWiki:Fake
20772 !! text
20773 ==header==
20774 !! endarticle
20775
20776 !! test
20777 Inclusion of !userCanEdit() content
20778 !! wikitext
20779 {{MediaWiki:Fake}}
20780 !! html
20781 <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>
20782
20783 !! end
20784
20785
20786 !! test
20787 Out-of-order TOC heading levels
20788 !! wikitext
20789 ==2==
20790 ======6======
20791 ===3===
20792 =1=
20793 =====5=====
20794 ==2==
20795 !! html
20796 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
20797 <ul>
20798 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
20799 <ul>
20800 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
20801 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
20802 </ul>
20803 </li>
20804 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
20805 <ul>
20806 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
20807 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
20808 </ul>
20809 </li>
20810 </ul>
20811 </div>
20812
20813 <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>
20814 <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>
20815 <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>
20816 <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>
20817 <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>
20818 <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>
20819
20820 !! end
20821
20822
20823 !! test
20824 ISBN with a dummy number
20825 !! wikitext
20826 ISBN ---
20827 !! html
20828 <p>ISBN ---
20829 </p>
20830 !! end
20831
20832
20833 !! test
20834 ISBN with space-delimited number
20835 !! wikitext
20836 ISBN 92 9017 032 8
20837 !! html/php
20838 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
20839 </p>
20840 !! html/parsoid
20841 <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>
20842 !! end
20843
20844
20845 !! test
20846 ISBN with multiple spaces, no number
20847 !! wikitext
20848 ISBN foo
20849 !! html
20850 <p>ISBN foo
20851 </p>
20852 !! end
20853
20854
20855 !! test
20856 ISBN length
20857 !! wikitext
20858 ISBN 123456789
20859
20860 ISBN 1234567890
20861
20862 ISBN 12345678901
20863 !! html/php
20864 <p>ISBN 123456789
20865 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
20866 </p><p>ISBN 12345678901
20867 </p>
20868 !! html/parsoid
20869 <p>ISBN 123456789</p>
20870
20871 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a></p>
20872
20873 <p>ISBN 12345678901</p>
20874 !! end
20875
20876
20877 !! test
20878 ISBN with trailing year (T9110)
20879 !! wikitext
20880 ISBN 1-234-56789-0 - 2006
20881
20882 ISBN 1 234 56789 0 - 2006
20883 !! html/php
20884 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
20885 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
20886 </p>
20887 !! html/parsoid
20888 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1-234-56789-0</a> - 2006</p>
20889
20890 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1 234 56789 0</a> - 2006</p>
20891 !! end
20892
20893
20894 !! test
20895 anchorencode
20896 !! wikitext
20897 {{anchorencode:foo bar©#%n}}
20898 !! html
20899 <p>foo_bar.C2.A9.23.25n
20900 </p>
20901 !! end
20902
20903 !! test
20904 anchorencode trims spaces
20905 !! wikitext
20906 {{anchorencode: __pretty__please__}}
20907 !! html
20908 <p>pretty_please
20909 </p>
20910 !! end
20911
20912 !! test
20913 anchorencode deals with links
20914 !! wikitext
20915 {{anchorencode: [[hello|world]] [[hi]]}}
20916 !! html
20917 <p>world_hi
20918 </p>
20919 !! end
20920
20921 !! test
20922 anchorencode deals with templates
20923 !! wikitext
20924 {{anchorencode: {{Foo}} }}
20925 !! html
20926 <p>FOO
20927 </p>
20928 !! end
20929
20930 !! test
20931 anchorencode encodes like the TOC generator: (T20431)
20932 !! wikitext
20933 === _ +:.3A%3A&&amp;]] ===
20934 {{anchorencode: _ +:.3A%3A&&amp;]] }}
20935 __NOEDITSECTION__
20936 !! html
20937 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
20938 <p>.2B:.3A.253A.26.26.5D.5D
20939 </p>
20940 !! end
20941
20942 !! test
20943 T8200: blockquotes and paragraph formatting
20944 !! wikitext
20945 <blockquote>
20946 foo
20947 </blockquote>
20948
20949 bar
20950
20951 baz
20952 !! html
20953 <blockquote>
20954 <p>foo
20955 </p>
20956 </blockquote>
20957 <p>bar
20958 </p>
20959 <pre>baz
20960 </pre>
20961 !! end
20962
20963 !! test
20964 T10293: Use of center tag ruins paragraph formatting
20965 !! wikitext
20966 <center>
20967 foo
20968 </center>
20969
20970 bar
20971
20972 baz
20973 !! html
20974 <center>
20975 <p>foo
20976 </p>
20977 </center>
20978 <p>bar
20979 </p>
20980 <pre>baz
20981 </pre>
20982 !! end
20983
20984 !!test
20985 Parsing of overlapping (improperly nested) inline html tags
20986 !! wikitext
20987 <span><s>x</span></s>
20988 !! html/php
20989 <p><span><s>x&lt;/span&gt;</s></span>
20990 </p>
20991 !! html/parsoid
20992 <p><span><s>x</s></span>
20993 </p>
20994 !!end
20995
20996 ###
20997 ### Language variants related tests
20998 ###
20999 !! test
21000 Self-link in language variants
21001 !! options
21002 title=[[Dunav]] language=sr
21003 !! wikitext
21004 Both [[Dunav]] and [[Дунав]] are names for this river.
21005 !! html
21006 <p>Both <a class="mw-selflink selflink">Dunav</a> and <a class="mw-selflink selflink">Дунав</a> are names for this river.
21007 </p>
21008 !!end
21009
21010 !! article
21011 Дуна
21012 !! text
21013 content
21014 !! endarticle
21015
21016 !! test
21017 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
21018 !! options
21019 title=[[Duna]] language=sr
21020 !! wikitext
21021 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
21022 !! html
21023 <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.
21024 </p>
21025 !! end
21026
21027 !! test
21028 Link to a section of a variant of this title shouldn't be parsed as self-link
21029 !! options
21030 title=[[Duna]] language=sr
21031 !! wikitext
21032 [[Dуна]] is a self-link while [[Dunа#Foo]] and [[Dуна#Foo]] are not self-links.
21033 !! html
21034 <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.
21035 </p>
21036 !! end
21037
21038 !! test
21039 Link to pages in language variants
21040 !! options
21041 language=sr
21042 !! wikitext
21043 Main Page can be written as [[Маин Паге]]
21044 !! html
21045 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
21046 </p>
21047 !!end
21048
21049
21050 !! test
21051 Multiple links to pages in language variants
21052 !! options
21053 language=sr
21054 !! wikitext
21055 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
21056 !! html
21057 <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>.
21058 </p>
21059 !!end
21060
21061
21062 !! test
21063 Simple template in language variants
21064 !! options
21065 language=sr
21066 !! wikitext
21067 {{тест}}
21068 !! html
21069 <p>This is a test template
21070 </p>
21071 !! end
21072
21073
21074 !! test
21075 Template with explicit namespace in language variants
21076 !! options
21077 language=sr
21078 !! wikitext
21079 {{Template:тест}}
21080 !! html
21081 <p>This is a test template
21082 </p>
21083 !! end
21084
21085
21086 !! test
21087 Basic test for template parameter in language variants
21088 !! options
21089 language=sr
21090 !! wikitext
21091 {{парамтест|param=foo}}
21092 !! html
21093 <p>This is a test template with parameter foo
21094 </p>
21095 !! end
21096
21097 !! test
21098 Simple category in language variants
21099 !! options
21100 language=sr cat
21101 !! wikitext
21102 [[Category:МедиаWики Усер'с Гуиде]]
21103 !! html/php
21104 cat=МедиаWики_Усер'с_Гуиде sort=
21105 !! html/parsoid
21106 <link rel="mw:PageProp/Category" href="./Категорија:МедиаWики_Усер'с_Гуиде" data-parsoid='{"stx":"simple","a":{"href":"./Категорија:МедиаWики_Усер&#39;с_Гуиде"},"sa":{"href":"Category:МедиаWики Усер&#39;с Гуиде"}}'/>
21107 !! end
21108
21109 !! article
21110 Category:分类
21111 !! text
21112 blah
21113 !! endarticle
21114
21115 !! article
21116 Category:分類
21117 !! text
21118 blah
21119 !! endarticle
21120
21121 ## We used to, but no longer wt2wt this test since the default serializer
21122 ## will normalize all categories to serialize on their own line.
21123 ## This wikitext usage is going to be fairly uncommon in production and
21124 ## selser will take care of preserving formatting in those scenarios.
21125 !! test
21126 Don't convert blue categorylinks to another variant (T35210)
21127 !! options
21128 cat
21129 language=zh
21130 parsoid=wt2html
21131 !! wikitext
21132 [[A]][[Category:分类]]
21133 !! html/php
21134 cat=分类 sort=
21135 !! html/parsoid
21136 <p><a rel="mw:WikiLink" href="./A" title="A">A</a></p>
21137 <link rel="mw:PageProp/Category" href="./Category:分类"/>
21138 !! end
21139
21140 !! test
21141 Stripping -{}- tags (language variants)
21142 !! options
21143 language=sr
21144 !! wikitext
21145 Latin proverb: -{Ne nuntium necare}-
21146 !! html
21147 <p>Latin proverb: Ne nuntium necare
21148 </p>
21149 !! end
21150
21151
21152 !! test
21153 Prevent conversion with -{}- tags (language variants)
21154 !! options
21155 language=sr variant=sr-ec
21156 !! wikitext
21157 Latinski: -{Ne nuntium necare}-
21158 !! html
21159 <p>Латински: Ne nuntium necare
21160 </p>
21161 !! end
21162
21163
21164 !! test
21165 Prevent conversion of text with -{}- tags (language variants)
21166 !! options
21167 language=sr variant=sr-ec
21168 !! wikitext
21169 Latinski: -{Ne nuntium necare}-
21170 !! html
21171 <p>Латински: Ne nuntium necare
21172 </p>
21173 !! end
21174
21175
21176 !! test
21177 Prevent conversion of links with -{}- tags (language variants)
21178 !! options
21179 language=sr variant=sr-ec
21180 !! wikitext
21181 -{[[Main Page]]}-
21182 !! html
21183 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
21184 </p>
21185 !! end
21186
21187
21188 !! test
21189 -{}- tags within headlines (within html for parserConvert())
21190 !! options
21191 language=sr variant=sr-ec
21192 !! wikitext
21193 == -{Naslov}- ==
21194 !! html
21195 <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>
21196
21197 !! end
21198
21199
21200 !! test
21201 Explicit definition of language variant alternatives
21202 !! options
21203 language=zh variant=zh-tw
21204 !! wikitext
21205 -{zh:China;zh-tw:Taiwan}-, not China
21206 !! html
21207 <p>Taiwan, not China
21208 </p>
21209 !! end
21210
21211
21212 !! test
21213 Conversion around HTML tags
21214 !! options
21215 language=sr variant=sr-ec
21216 !! wikitext
21217 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
21218 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
21219 !! html
21220 <p>
21221 <span title="ЛаCтин">ски</span>
21222 </p>
21223 !! end
21224
21225
21226 !! test
21227 Explicit session-wise language variant mapping (A flag and - flag)
21228 !! options
21229 language=zh variant=zh-tw
21230 !! wikitext
21231 Taiwan is not China.
21232 But -{A|zh:China;zh-tw:Taiwan}- is China,
21233 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
21234 and -{China}- is China.
21235 !! html
21236 <p>Taiwan is not China.
21237 But Taiwan is Taiwan,
21238 (This should be stripped!)
21239 and China is China.
21240 </p>
21241 !! end
21242
21243 !! test
21244 Explicit session-wise language variant mapping (H flag for hide)
21245 !! options
21246 language=zh variant=zh-tw
21247 !! wikitext
21248 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
21249 Taiwan is China.
21250 !! html
21251 <p>(This should be stripped!)
21252 Taiwan is Taiwan.
21253 </p>
21254 !! end
21255
21256 !! test
21257 Adding explicit conversion rule for title (T flag)
21258 !! options
21259 language=zh variant=zh-tw showtitle
21260 !! wikitext
21261 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
21262 !! html
21263 Taiwan
21264 <p>Should be stripped!
21265 </p>
21266 !! end
21267
21268 !! test
21269 Testing that changing the language variant here in the tests actually works
21270 !! options
21271 language=zh variant=zh showtitle
21272 !! wikitext
21273 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
21274 !! html
21275 China
21276 <p>Should be stripped!
21277 </p>
21278 !! end
21279
21280 !! test
21281 Recursive conversion of alt and title attrs shouldn't clear converter state
21282 !! options
21283 language=zh variant=zh-cn showtitle
21284 !! wikitext
21285 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
21286 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
21287 !! html
21288 China
21289 <p>
21290 Should be stripped<span title="Exclamation">!</span>
21291 </p>
21292 !! end
21293
21294 !! test
21295 T26072: more test on conversion rule for title
21296 !! options
21297 language=zh variant=zh-tw showtitle
21298 !! wikitext
21299 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
21300 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
21301 !! html
21302 Taiwan
21303 <p>This should be stripped!
21304 This won't take interferes with the title rule.
21305 </p>
21306 !! end
21307
21308 !! test
21309 Partly disable title conversion if variant == main language code
21310 !! options
21311 language=zh variant=zh title=[[ZH]] showtitle
21312 !! wikitext
21313 -{T|zh-cn:CN;zh-tw:TW}-
21314 !! html
21315 ZH
21316 <p>
21317 </p>
21318 !! end
21319
21320 !! test
21321 Partly disable title conversion if variant == main language code, more
21322 !! options
21323 language=zh variant=zh title=[[ZH]] showtitle
21324 !! wikitext
21325 -{T|TW}-
21326 !! html
21327 ZH
21328 <p>
21329 </p>
21330 !! end
21331
21332 !! test
21333 Raw output of variant escape tags (R flag)
21334 !! options
21335 language=zh variant=zh-tw
21336 !! wikitext
21337 Raw: -{R|zh:China;zh-tw:Taiwan}-
21338 !! html
21339 <p>Raw: zh:China;zh-tw:Taiwan
21340 </p>
21341 !! end
21342
21343 !! test
21344 Nested markup inside raw output of variant escape tags (R flag)
21345 !! options
21346 language=zh variant=zh-tw
21347 !! wikitext
21348 Nested raw: -{R|nested -{zh:China;zh-tw:Taiwan}- nested}-
21349 !! html
21350 <p>Nested raw: nested Taiwan nested
21351 </p>
21352 !! end
21353
21354 !! test
21355 Templates inside raw output of variant escape tags (R flag)
21356 !! options
21357 language=zh variant=zh-tw
21358 !! wikitext
21359 Nested raw: -{R|nested {{echo|hi}} templates}-
21360 !! html
21361 <p>Nested raw: nested hi templates
21362 </p>
21363 !! end
21364
21365 !! test
21366 Strings evaluating false shouldn't be ignored by Language converter (T51072)
21367 !! options
21368 language=zh variant=zh-cn
21369 !! input
21370 -{zh-cn:0;zh-sg:1;zh-tw:2;zh-hk:3}-
21371 !! result
21372 <p>0
21373 </p>
21374 !! end
21375
21376 !! test
21377 Conversion rules from [numeric-only string] to [something else] (T48634)
21378 !! options
21379 language=zh variant=zh-cn
21380 !! input
21381 -{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
21382 !! result
21383 <p>D12345EE12345
21384 </p>
21385 !! end
21386
21387 !! test
21388 Bidirectional converter rule entries with an empty value should be ignored (T53551)
21389 !! options
21390 language=zh variant=zh-cn
21391 !! input
21392 -{H|zh-cn:foo;zh-tw:;}-foobar
21393 !! result
21394 <p>foobar
21395 </p>
21396 !! end
21397
21398 !! test
21399 Unidirectional converter rule entries with an empty "from" string should be ignored (T53551)
21400 !! options
21401 language=zh variant=zh-cn
21402 !! input
21403 -{H|=>zh-cn:foo;}-foobar
21404 !! result
21405 <p>foobar
21406 </p>
21407 !! end
21408
21409 !! test
21410 Empty converter rule entries shouldn't be inserted into the conversion table (T53551)
21411 !! options
21412 language=zh variant=zh-cn
21413 !! input
21414 -{H|}-foobar
21415 !! result
21416 <p>foobar
21417 </p>
21418 !! end
21419
21420 !! test
21421 Nested using of manual convert syntax
21422 !! options
21423 language=zh variant=zh-hk
21424 !! wikitext
21425 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
21426 !! html
21427 <p>Nested: Hello Hong Kong!
21428 </p>
21429 !! end
21430
21431 !! test
21432 HTML markups with conversion syntax in attribs, nested in other conversion blocks
21433 !! options
21434 language=zh variant=zh-cn
21435 !! wikitext
21436 -{zh;zh-hans;zh-hant|<span title="-{X}-">A</span>}-
21437 !! html
21438 <p><span title="X">A</span>
21439 </p>
21440 !! end
21441
21442 !! test
21443 HTML markups with conversion syntax in attribs, nested in other conversion blocks (not working yet)
21444 !! options
21445 language=zh variant=zh-cn disabled
21446 !! wikitext
21447 -{<span title="-{X}-">A</span>}-
21448 !! html
21449 <p><span title="X">A</span>
21450 </p>
21451 !! end
21452
21453 # Since Parsoid is starting to emit canonical wikitext for links,
21454 # [http://example.com http://example.com] will not RT back to that
21455 # form anymore.
21456 !! test
21457 Proper conversion of text in external links
21458 !! options
21459 language=sr variant=sr-ec
21460 parsoid=wt2html
21461 !! wikitext
21462 http://www.google.com
21463 gopher://www.google.com
21464 [http://www.google.com http://www.google.com]
21465 [gopher://www.google.com gopher://www.google.com]
21466 [https://www.google.com irc://www.google.com]
21467 [ftp://www.google.com www.google.com/ftp://dir]
21468 [//www.google.com www.google.com]
21469 !! html/php
21470 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
21471 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
21472 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
21473 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
21474 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
21475 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
21476 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
21477 </p>
21478 !! html/parsoid
21479 <p><a rel="mw:ExtLink" href="http://www.google.com">http://www.google.com</a>
21480 <a rel="mw:ExtLink" href="gopher://www.google.com">gopher://www.google.com</a>
21481 <a rel="mw:ExtLink" href="http://www.google.com">http://www.google.com</a>
21482 <a rel="mw:ExtLink" href="gopher://www.google.com">gopher://www.google.com</a>
21483 <a rel="mw:ExtLink" href="https://www.google.com">irc://www.google.com</a>
21484 <a rel="mw:ExtLink" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
21485 <a rel="mw:ExtLink" href="//www.google.com">www.гоогле.цом</a></p>
21486 !! end
21487
21488 !! test
21489 Do not convert roman numbers to language variants
21490 !! options
21491 language=sr variant=sr-ec
21492 !! wikitext
21493 Fridrih IV je car.
21494 !! html
21495 <p>Фридрих IV је цар.
21496 </p>
21497 !! end
21498
21499 !! test
21500 Unclosed language converter markup "-{"
21501 !! options
21502 language=sr
21503 !! wikitext
21504 -{T|hello
21505 !! html
21506 <p>-{T|hello
21507 </p>
21508 !! end
21509
21510 !! test
21511 Don't convert raw rule "-{R|=&gt;}-" to "=>"
21512 !! options
21513 language=sr
21514 !! wikitext
21515 -{R|=&gt;}-
21516 !! html
21517 <p>=&gt;
21518 </p>
21519 !!end
21520
21521 !! test
21522 Don't break link parsing if language converter markup is in the caption.
21523 !! options
21524 language=sr variant=sr-ec
21525 !! wikitext
21526 [[Main Page|-{R|main page}-]]
21527 !! html
21528 <p><a href="/wiki/Main_Page" title="Маин Паге">main page</a>
21529 </p>
21530 !! end
21531
21532 !! test
21533 T146304: Don't break template parsing if language converter markup is in the parameter.
21534 !! options
21535 language=sr variant=sr-ec
21536 !! wikitext
21537 {{echo|-{R|foo}-}}
21538 !! html/php
21539 <p>foo
21540 </p>
21541 !! end
21542
21543 !! test
21544 T146305: Don't break image parsing if language converter markup is in the caption.
21545 !! options
21546 language=sr
21547 !! wikitext
21548 [[File:Foobar.jpg|thumb|-{R|caption:}-]]
21549 !! html/php
21550 <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>
21551
21552 !! html/parsoid
21553 <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>
21554 !! end
21555
21556 !! test
21557 T146305: Don't break image parsing if nested language converter markup is in the caption.
21558 !! options
21559 language=zh variant=zh-cn
21560 !! wikitext
21561 [[File:Foobar.jpg|thumb|-{zh-cn:blog (hk: -{zh-hans|WEBJOURNAL}-, tw: -{zh-hans|WEBLOG}-)}-]]
21562 !! html/php
21563 <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>
21564
21565 !! html/parsoid
21566 <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>
21567 !! end
21568
21569 !! test
21570 Don't break gallery if language converter markup is inside.
21571 !! options
21572 language=zh
21573 !! wikitext
21574 <gallery>
21575 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=-{R|foo}-|-{R|bar}-]]|alt=-{R|bat}-
21576 File:foobar.jpg|{{Test|unamedParam|alt=-{R|param}-}}|alt=galleryalt
21577 </gallery>
21578 !! html
21579 <ul class="gallery mw-gallery-traditional">
21580 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21581 <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>
21582 <div class="gallerytext">
21583 <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>
21584 </p>
21585 </div>
21586 </div></li>
21587 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21588 <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>
21589 <div class="gallerytext">
21590 <p>This is a test template
21591 </p>
21592 </div>
21593 </div></li>
21594 </ul>
21595
21596 !! end
21597
21598 !! test
21599 T153135: Don't break list handling if language converter markup is in the item.
21600 !! options
21601 language=zh variant=zh-cn
21602 !! wikitext
21603 ;-{zh-cn:AAA;zh-tw:BBB}-
21604 ;-{R|foo:bar}-
21605 !! html/php
21606 <dl><dt>AAA</dt>
21607 <dt>foo:bar</dt></dl>
21608
21609 !! html/parsoid
21610 <dl>
21611 <dt><span typeof="mw:LanguageVariant" data-mw='{"bidir":[{"l":"zh-cn","t":"AAA"},{"l":"zh-tw","t":"BBB"}],"show":true}'></span></dt>
21612 <dt><span typeof="mw:LanguageVariant" data-mw='{"disabled":true,"show":true,"text":"foo:bar"}'></span></dt>
21613 </dl>
21614 !! end
21615
21616 // Note that parsoid does not protect colons unless language converter
21617 // markup is properly nested, because it is a backtracking parser.
21618 !! test
21619 T153135: Unclosed markup in definition list (code coverage)
21620 !! options
21621 language=zh variant=zh-cn
21622 !! wikitext
21623 ;<b>foo:bar
21624 ;-{zh-cn:AAA
21625 !! html/php
21626 <dl><dt><b>foo:bar</dt>
21627 <dt>-{zh-cn:AAA</b></dt></dl>
21628
21629 !! html/parsoid
21630 <dl>
21631 <dt><b>foo:bar</b></dt>
21632 <b>
21633 <dt>-{zh-cn</dt>
21634 <dd>AAA</dd>
21635 </b></dl>
21636 !! end
21637
21638 !! test
21639 T153135: Nested language converter markup in definition list (code coverage)
21640 !! options
21641 language=zh variant=zh-cn
21642 !! wikitext
21643 ;-{zh-cn:AAA -{zh-hans|foo:bar}- -{R|bat:baz}-}-:def
21644 !! html/php
21645 <dl><dt>AAA foo:bar bat:baz</dt>
21646 <dd>def</dd></dl>
21647
21648 !! html/parsoid
21649 <dl>
21650 <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>
21651 <dd>def</dd>
21652 </dl>
21653 !! end
21654
21655 !! test
21656 T153140: Don't break table handling if language converter markup is in the cell.
21657 !! options
21658 language=sr variant=sr-ec
21659 !! wikitext
21660 {|
21661 |-
21662 | -{R|B}-
21663 |}
21664 !! html/php
21665 <table>
21666
21667 <tr>
21668 <td> B
21669 </td></tr></table>
21670
21671 !! html/parsoid
21672 <table>
21673
21674 <tr>
21675 <td> B
21676 </td></tr></table>
21677
21678 !! end
21679
21680 !! test
21681 T2529: Uncovered bullet
21682 !! wikitext
21683 * Foo {{bullet}}
21684 !! html
21685 <ul><li> Foo </li>
21686 <li> Bar</li></ul>
21687
21688 !! end
21689
21690 # Plain MediaWiki does not remove empty lists, but tidy actually does.
21691 # Templates in Wikipedia rely on this behavior, as tidy has always been
21692 # enabled there. These tests are normally run *without* tidy, so specify the
21693 # full output here.
21694 # To test realistic parsing behavior, apply a tidy-like transformation to both
21695 # the expected output and your parser's output.
21696 !! test
21697 T2529: Uncovered bullet leaving empty list, normally removed by tidy
21698 !! wikitext
21699 ******* Foo {{bullet}}
21700 !! html
21701 <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>
21702 <li> Bar</li></ul>
21703
21704 !! end
21705
21706 !! test
21707 T2529: Uncovered table already at line-start
21708 !! wikitext
21709 x
21710
21711 {{table}}
21712 y
21713 !! html
21714 <p>x
21715 </p>
21716 <table>
21717 <tr>
21718 <td> 1 </td>
21719 <td> 2
21720 </td></tr>
21721 <tr>
21722 <td> 3 </td>
21723 <td> 4
21724 </td></tr></table>
21725 <p>y
21726 </p>
21727 !! end
21728
21729 !! test
21730 T2529: Uncovered bullet in parser function result
21731 !! wikitext
21732 * Foo {{lc:{{bullet}} }}
21733 !! html
21734 <ul><li> Foo </li>
21735 <li> bar</li></ul>
21736
21737 !! end
21738
21739 !! test
21740 T7678: Double-parsed template argument
21741 !! wikitext
21742 {{lc:{{{1}}}|hello}}
21743 !! html
21744 <p>{{{1}}}
21745 </p>
21746 !! end
21747
21748 !! test
21749 T7678: Double-parsed template invocation
21750 !! wikitext
21751 {{lc:{{paramtest {{!}} param = hello }} }}
21752 !! html
21753 <p>{{paramtest | param = hello }}
21754 </p>
21755 !! end
21756
21757 !! test
21758 Case insensitivity of parser functions for non-ASCII characters (T10143)
21759 !! options
21760 language=cs
21761 title=[[Main Page]]
21762 !! wikitext
21763 {{PRVNÍVELKÉ:ěščř}}
21764 {{prvnívelké:ěščř}}
21765 {{PRVNÍMALÉ:ěščř}}
21766 {{prvnímalé:ěščř}}
21767 {{MALÁ:ěščř}}
21768 {{malá:ěščř}}
21769 {{VELKÁ:ěščř}}
21770 {{velká:ěščř}}
21771 !! html
21772 <p>Ěščř
21773 Ěščř
21774 ěščř
21775 ěščř
21776 ěščř
21777 ěščř
21778 ĚŠČŘ
21779 ĚŠČŘ
21780 </p>
21781 !! end
21782
21783 !! test
21784 Morwen/13: Unclosed link followed by heading
21785 !! wikitext
21786 [[link
21787 ==heading==
21788 !! html
21789 <p>[[link
21790 </p>
21791 <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>
21792
21793 !! end
21794
21795 !! test
21796 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
21797 !! wikitext
21798 {{foo|
21799 =heading=
21800 !! html
21801 <p>{{foo|
21802 </p>
21803 <h1><span class="mw-headline" id="heading">heading</span></h1>
21804
21805 !! end
21806
21807 !! test
21808 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
21809 !! wikitext
21810 {{foo|
21811 ==heading==
21812 !! html
21813 <p>{{foo|
21814 </p>
21815 <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>
21816
21817 !! end
21818
21819 !! test
21820 Tildes in comments
21821 !! options
21822 pst
21823 !! wikitext
21824 <!-- ~~~~ -->
21825 !! html/php
21826 <!-- ~~~~ -->
21827 !! end
21828
21829 !! test
21830 Paragraphs inside divs (no extra line breaks)
21831 !! wikitext
21832 <div>Line one
21833
21834 Line two</div>
21835 !! html
21836 <div>Line one
21837 Line two</div>
21838
21839 !! end
21840
21841 !! test
21842 Paragraphs inside divs (extra line break on open)
21843 !! wikitext
21844 <div>
21845 Line one
21846
21847 Line two</div>
21848 !! html
21849 <div>
21850 <p>Line one
21851 </p>
21852 Line two</div>
21853
21854 !! end
21855
21856 !! test
21857 Paragraphs inside divs (extra line break on close)
21858 !! wikitext
21859 <div>Line one
21860
21861 Line two
21862 </div>
21863 !! html
21864 <div>Line one
21865 <p>Line two
21866 </p>
21867 </div>
21868
21869 !! end
21870
21871 !! test
21872 Paragraphs inside divs (extra line break on open and close)
21873 !! wikitext
21874 <div>
21875 Line one
21876
21877 Line two
21878 </div>
21879 !! html
21880 <div>
21881 <p>Line one
21882 </p><p>Line two
21883 </p>
21884 </div>
21885
21886 !! end
21887
21888 !! test
21889 Nesting tags, paragraphs on lines which begin with <div>
21890 !! wikitext
21891 <div></div><strong>A
21892 B</strong>
21893 !! html/php+tidy
21894 <p><strong>A</strong></p>
21895 <p><strong>B</strong></p>
21896 !! html/parsoid
21897 <div></div>
21898 <p><strong>A
21899 B</strong>
21900 </p>
21901 !! end
21902
21903 # T8200: <blockquote> should behave like <div> with respect to line breaks
21904 !! test
21905 T8200: paragraphs inside blockquotes (no extra line breaks)
21906 !! wikitext
21907 <blockquote>Line one
21908
21909 Line two</blockquote>
21910 !! html
21911 <blockquote>Line one
21912 Line two</blockquote>
21913
21914 !! html+tidy
21915 <blockquote>
21916 <p>Line one Line two</p>
21917 </blockquote>
21918 !! end
21919
21920 !! test
21921 T8200: paragraphs inside blockquotes (extra line break on open)
21922 !! wikitext
21923 <blockquote>
21924 Line one
21925
21926 Line two</blockquote>
21927 !! html
21928 <blockquote>
21929 <p>Line one
21930 </p>
21931 Line two</blockquote>
21932
21933 !! html+tidy
21934 <blockquote>
21935 <p>Line one</p>
21936 Line two</blockquote>
21937 !! end
21938
21939 !! test
21940 T8200: paragraphs inside blockquotes (extra line break on close)
21941 !! wikitext
21942 <blockquote>Line one
21943
21944 Line two
21945 </blockquote>
21946 !! html
21947 <blockquote>Line one
21948 <p>Line two
21949 </p>
21950 </blockquote>
21951
21952 !! html+tidy
21953 <blockquote>
21954 <p>Line one</p>
21955 <p>Line two</p>
21956 </blockquote>
21957 !! end
21958
21959 !! test
21960 T8200: paragraphs inside blockquotes (extra line break on open and close)
21961 !! wikitext
21962 <blockquote>
21963 Line one
21964
21965 Line two
21966 </blockquote>
21967 !! html
21968 <blockquote>
21969 <p>Line one
21970 </p><p>Line two
21971 </p>
21972 </blockquote>
21973
21974 !! html+tidy
21975 <blockquote>
21976 <p>Line one</p>
21977 <p>Line two</p>
21978 </blockquote>
21979 !! end
21980
21981 !! test
21982 Paragraphs inside blockquotes/divs (no extra line breaks)
21983 !! wikitext
21984 <blockquote><div>Line one
21985
21986 Line two</div></blockquote>
21987 !! html
21988 <blockquote><div>Line one
21989 Line two</div></blockquote>
21990
21991 !! end
21992
21993 !! test
21994 Paragraphs inside blockquotes/divs (extra line break on open)
21995 !! wikitext
21996 <blockquote><div>
21997 Line one
21998
21999 Line two</div></blockquote>
22000 !! html
22001 <blockquote><div>
22002 <p>Line one
22003 </p>
22004 Line two</div></blockquote>
22005
22006 !! end
22007
22008 !! test
22009 Paragraphs inside blockquotes/divs (extra line break on close)
22010 !! wikitext
22011 <blockquote><div>Line one
22012
22013 Line two
22014 </div></blockquote>
22015 !! html
22016 <blockquote><div>Line one
22017 <p>Line two
22018 </p>
22019 </div></blockquote>
22020
22021 !! end
22022
22023 !! test
22024 Paragraphs inside blockquotes/divs (extra line break on open and close)
22025 !! wikitext
22026 <blockquote><div>
22027 Line one
22028
22029 Line two
22030 </div></blockquote>
22031 !! html
22032 <blockquote><div>
22033 <p>Line one
22034 </p><p>Line two
22035 </p>
22036 </div></blockquote>
22037
22038 !! end
22039
22040 !! test
22041 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
22042 !! options
22043 wgLinkHolderBatchSize=0
22044 !! wikitext
22045 [[meatball:1]]
22046 [[meatball:2]]
22047 [[meatball:3]]
22048 !! html
22049 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
22050 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
22051 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
22052 </p>
22053 !! end
22054
22055 !! test
22056 Free external link invading image caption
22057 !! wikitext
22058 [[Image:Foobar.jpg|thumb|http://x|hello]]
22059 !! html
22060 <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>
22061
22062 !! end
22063
22064 !! test
22065 T17196: localised external link numbers
22066 !! options
22067 language=fa
22068 !! wikitext
22069 [http://en.wikipedia.org/]
22070 !! html/php
22071 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
22072 </p>
22073 !! html/parsoid
22074 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/"></a></p>
22075 !! end
22076
22077 !! test
22078 Multibyte character in padleft
22079 !! wikitext
22080 {{padleft:-Hello|7|Æ}}
22081 !! html
22082 <p>Æ-Hello
22083 </p>
22084 !! end
22085
22086 !! test
22087 Multibyte character in padright
22088 !! wikitext
22089 {{padright:Hello-|7|Æ}}
22090 !! html
22091 <p>Hello-Æ
22092 </p>
22093 !! end
22094
22095 !!test
22096 formatdate parser function
22097 !! wikitext
22098 {{#formatdate:2009-03-24}}
22099 !! html
22100 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
22101 </p>
22102 !! end
22103
22104 !!test
22105 formatdate parser function, with default format
22106 !! wikitext
22107 {{#formatdate:2009-03-24|mdy}}
22108 !! html
22109 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
22110 </p>
22111 !! end
22112
22113 !! test
22114 Spacing of numbers in formatted dates
22115 !! wikitext
22116 {{#formatdate:January 15}}
22117 !! html
22118 <p><span class="mw-formatted-date" title="01-15">January 15</span>
22119 </p>
22120 !! end
22121
22122 !! test
22123 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
22124 !! options
22125 language=nl title=[[MediaWiki:Common.css]]
22126 !! wikitext
22127 {{#formatdate:2009-03-24|dmy}}
22128 !! html
22129 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
22130 </p>
22131 !! end
22132
22133 #
22134 #
22135 #
22136
22137 #
22138 # Edit comments
22139 #
22140
22141 !! test
22142 Edit comment with link
22143 !! options
22144 comment
22145 !! wikitext
22146 I like the [[Main Page]] a lot
22147 !! html/php
22148 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
22149 !!end
22150
22151 !! test
22152 Edit comment with link and link text
22153 !! options
22154 comment
22155 !! wikitext
22156 I like the [[Main Page|best pages]] a lot
22157 !! html/php
22158 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
22159 !!end
22160
22161 !! test
22162 Edit comment with link and link text with suffix
22163 !! options
22164 comment
22165 !! wikitext
22166 I like the [[Main Page|best page]]s a lot
22167 !! html/php
22168 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
22169 !!end
22170
22171 !! test
22172 Edit comment with section link (non-local, eg in history list)
22173 !! options
22174 comment title=[[Main Page]]
22175 !! wikitext
22176 /* External links */ removed bogus entries
22177 !! html/php
22178 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
22179 !!end
22180
22181 !! test
22182 Edit comment with section link and text before it (non-local, eg in history list)
22183 !! options
22184 comment title=[[Main Page]]
22185 !! wikitext
22186 pre-comment text /* External links */ removed bogus entries
22187 !! html/php
22188 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>
22189 !!end
22190
22191 !! test
22192 Edit comment with section link (local, eg in diff view)
22193 !! options
22194 comment local title=[[Main Page]]
22195 !! wikitext
22196 /* External links */ removed bogus entries
22197 !! html/php
22198 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
22199 !!end
22200
22201 !! test
22202 Edit comment with subpage link (T16080)
22203 !! options
22204 comment
22205 subpage
22206 title=[[Subpage test]]
22207 !! wikitext
22208 Poked at a [[/subpage]] here...
22209 !! html/php
22210 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
22211 !!end
22212
22213 !! test
22214 Edit comment with subpage link and link text (T16080)
22215 !! options
22216 comment
22217 subpage
22218 title=[[Subpage test]]
22219 !! wikitext
22220 Poked at a [[/subpage|neat little page]] here...
22221 !! html/php
22222 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
22223 !!end
22224
22225 !! test
22226 Edit comment with bogus subpage link in non-subpage NS (T16080)
22227 !! options
22228 comment
22229 title=[[Subpage test]]
22230 !! wikitext
22231 Poked at a [[/subpage]] here...
22232 !! html/php
22233 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...
22234 !!end
22235
22236 !! test
22237 Edit comment with bare anchor link (local, as on diff)
22238 !! options
22239 comment
22240 local
22241 title=[[Main Page]]
22242 !! wikitext
22243 [[#section]]
22244 !! html/php
22245 <a href="#section">#section</a>
22246 !! end
22247
22248 !! test
22249 Edit comment with bare anchor link (non-local, as on history)
22250 !! options
22251 comment
22252 title=[[Main Page]]
22253 !! wikitext
22254 [[#section]]
22255 !! html/php
22256 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
22257 !! end
22258
22259 !! test
22260 Anchor starting with underscore
22261 !! options
22262 title=[[Foo]]
22263 !! wikitext
22264 [[#_ref|One]]
22265 !! html/php
22266 <p><a href="#_ref">One</a>
22267 </p>
22268 !! html/parsoid
22269 <p><a rel="mw:WikiLink" href="./Foo#_ref" data-parsoid='{"stx":"piped","a":{"href":"./Foo#_ref"},"sa":{"href":"#_ref"}}'>One</a></p>
22270 !! end
22271
22272 !! test
22273 Id starting with underscore
22274 !! wikitext
22275 <div id="_ref"></div>
22276 !! html/*
22277 <div id="_ref"></div>
22278
22279 !! end
22280
22281 !! test
22282 Edit comment with link with more than one pipe (T99346)
22283 !! options
22284 comment
22285 !! wikitext
22286 [[Main Page|Many|pipes]]
22287 !! html/php
22288 <a href="/wiki/Main_Page" title="Main Page">Many|pipes</a>
22289 !! end
22290
22291 !! test
22292 Complex edit comment with link with more than one pipe (T99346)
22293 !! options
22294 comment
22295 !! wikitext
22296 Created page with "<noinclude>[[Category:Requests for permissions/Bot|{{subst:#titleparts:{{subst:PAGENAME}}|1|3}}]]</noinclude> === [[User:MineoBot|]] 8=== {{Request for permissions/links|Mineo..."
22297 !! html/php
22298 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;
22299 !! end
22300
22301 !! test
22302 Space normalisation on autocomment (T24784)
22303 !! options
22304 comment
22305 title=[[Main Page]]
22306 !! wikitext
22307 /* __hello__world__ */
22308 !! html/php
22309 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
22310 !! end
22311
22312 !! test
22313 percent-encoding and + signs in comments (T28410)
22314 !! options
22315 comment
22316 !! wikitext
22317 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
22318 !! html/php
22319 <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>
22320 !! end
22321
22322 # Parsoid doesn't support this yet: see T75581
22323 # but it *should* omit the 'src' attribute if the image is bad.
22324 # PHP side of tests was disabled in
22325 # mediawiki/core:6bd31e7d95161a6e88fa86df60871051da997c3c
22326 # because of issues in the PHP parserTests infrastructure
22327 # (but the output below is indeed what the PHP side emits)
22328 !! test
22329 Bad images - basic functionality
22330 !! wikitext
22331 [[File:Bad.jpg]]
22332 !! DISABLED/html/php
22333 !! html/parsoid
22334 <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>
22335 !! end
22336
22337 !! test
22338 Bad images - T18039: text after bad image disappears
22339 !! wikitext
22340 Foo bar
22341 [[File:Bad.jpg]]
22342 Bar foo
22343 !! DISABLED/html/php
22344 <p>Foo bar
22345 </p><p>Bar foo
22346 </p>
22347 !! html/parsoid
22348 <p>Foo bar
22349 <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>
22350 Bar foo</p>
22351 !! end
22352
22353 !! test
22354 Verify that displaytitle works (T24501) no displaytitle
22355 !! options
22356 showtitle
22357 !! config
22358 wgAllowDisplayTitle=true
22359 wgRestrictDisplayTitle=false
22360 !! wikitext
22361 this is not the the title
22362 !! html/php
22363 Parser test
22364 <p>this is not the the title
22365 </p>
22366 !! end
22367
22368 !! test
22369 Verify that displaytitle works (T24501) RestrictDisplayTitle=false
22370 !! options
22371 showtitle
22372 title=[[Screen]]
22373 !! config
22374 wgAllowDisplayTitle=true
22375 wgRestrictDisplayTitle=false
22376 !! wikitext
22377 this is not the the title
22378 {{DISPLAYTITLE:whatever}}
22379 !! html/php
22380 whatever
22381 <p>this is not the the title
22382 </p>
22383 !! end
22384
22385 !! test
22386 Verify that displaytitle works (T24501) RestrictDisplayTitle=true mismatch
22387 !! options
22388 showtitle
22389 title=[[Screen]]
22390 !! config
22391 wgAllowDisplayTitle=true
22392 wgRestrictDisplayTitle=true
22393 !! wikitext
22394 this is not the the title
22395 {{DISPLAYTITLE:whatever}}
22396 !! html/php
22397 Screen
22398 <p>this is not the the title
22399 </p>
22400 !! end
22401
22402 !! test
22403 Verify that displaytitle works (T24501) RestrictDisplayTitle=true matching
22404 !! options
22405 showtitle
22406 title=[[Screen]]
22407 !! config
22408 wgAllowDisplayTitle=true
22409 wgRestrictDisplayTitle=true
22410 !! wikitext
22411 this is not the the title
22412 {{DISPLAYTITLE:screen}}
22413 !! html/php
22414 screen
22415 <p>this is not the the title
22416 </p>
22417 !! end
22418
22419 !! test
22420 Verify that displaytitle works (T24501) AllowDisplayTitle=false
22421 !! options
22422 showtitle
22423 title=[[Screen]]
22424 !! config
22425 wgAllowDisplayTitle=false
22426 !! wikitext
22427 this is not the the title
22428 {{DISPLAYTITLE:screen}}
22429 !! html/php
22430 Screen
22431 <p>this is not the the title
22432 <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>
22433 </p>
22434 !! end
22435
22436 !! test
22437 Verify that displaytitle works (T24501) AllowDisplayTitle=false no DISPLAYTITLE
22438 !! options
22439 showtitle
22440 title=[[Screen]]
22441 !! config
22442 wgAllowDisplayTitle=false
22443 !! wikitext
22444 this is not the the title
22445 !! html/php
22446 Screen
22447 <p>this is not the the title
22448 </p>
22449 !! end
22450
22451 !! test
22452 Verify that displaytitle handles inline CSS styles (T28547) - rejected value
22453 !! options
22454 showtitle
22455 title=[[Screen]]
22456 !! config
22457 wgAllowDisplayTitle=true
22458 wgRestrictDisplayTitle=true
22459 !! wikitext
22460 this is not the the title
22461 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
22462 !! html/php
22463 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
22464 <p>this is not the the title
22465 </p>
22466 !! end
22467
22468 !! test
22469 Verify that displaytitle handles inline CSS styles (T28547) - accepted value
22470 !! options
22471 showtitle
22472 title=[[Screen]]
22473 !! config
22474 wgAllowDisplayTitle=true
22475 wgRestrictDisplayTitle=true
22476 !! wikitext
22477 this is not the the title
22478 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
22479 !! html/php
22480 <span style="color: red;">s</span>creen
22481 <p>this is not the the title
22482 </p>
22483 !! end
22484
22485 !! test
22486 Page status indicators: Empty name is invalid
22487 !! options
22488 showindicators
22489 !! wikitext
22490 <indicator name=" "></indicator>
22491 <indicator></indicator>
22492 !! html/php
22493 <p><span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
22494 <span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
22495 </p>
22496 !! end
22497
22498 !! test
22499 Page status indicators: Weird syntaxes that are okay
22500 !! options
22501 showindicators
22502 !! wikitext
22503 <indicator name="empty" />
22504 <indicator name="name"></indicator>
22505 !! html/php
22506 empty=
22507 name=
22508 <p><br />
22509 </p>
22510 !! end
22511
22512 !! test
22513 Page status indicators: Torture test
22514 !! options
22515 showindicators
22516 !! wikitext
22517 <indicator name="01">hello world</indicator>
22518 <indicator name="02">[[Main Page]]</indicator>
22519 <indicator name="03">[[File:Foobar.jpg|25px|link=]]</indicator>
22520 <indicator name="04">[[File:Foobar.jpg|25px]]</indicator>
22521 <indicator name="05">* foo
22522 * bar</indicator>
22523 <indicator name="06"><nowiki>foo</nowiki></indicator>
22524 <indicator name="07"> Preformatted</indicator>
22525 <indicator name="08"><div>Broken tag</indicator>
22526 <indicator name="09">{| class=wikitable
22527 | cell
22528 |}</indicator>
22529 <indicator name="10">Two
22530
22531 paragraphs</indicator>
22532 !! html/php
22533 01=hello world
22534 02=<a href="/wiki/Main_Page" title="Main Page">Main Page</a>
22535 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" />
22536 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>
22537 05=<ul><li> foo</li>
22538 <li> bar</li></ul>
22539
22540 06=foo
22541 07=<pre>Preformatted
22542 </pre>
22543 08=<div>Broken tag</div>
22544
22545 09=<table class="wikitable">
22546 <tr>
22547 <td> cell
22548 </td></tr></table>
22549
22550 10=<p>Two
22551 </p><p>paragraphs
22552 </p>
22553 <p><br />
22554 </p><p><br />
22555 </p><p><br />
22556 </p><p><br />
22557 </p><p><br />
22558 </p>
22559 !! end
22560
22561 !! test
22562 preload: check <noinclude> and <includeonly>
22563 !! options
22564 preload
22565 !! wikitext
22566 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
22567 !! html/php
22568 Hello kind world.
22569 !! end
22570
22571 !! test
22572 preload: check <onlyinclude>
22573 !! options
22574 preload
22575 !! wikitext
22576 Goodbye <onlyinclude>Hello world</onlyinclude>
22577 !! html/php
22578 Hello world
22579 !! end
22580
22581 !! test
22582 preload: can pass tags through if we want to
22583 !! options
22584 preload
22585 !! wikitext
22586 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
22587 !! html/php
22588 <includeonly>Hello world</includeonly>
22589 !! end
22590
22591 !! test
22592 preload: check that it doesn't try to do tricks
22593 !! options
22594 preload
22595 !! wikitext
22596 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
22597 !! html/php
22598 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
22599 !! end
22600
22601 !! test
22602 Play a bit with r67090 and T5158
22603 !! wikitext
22604 <div style="width:50% !important">&nbsp;</div>
22605 <div style="width:50%&nbsp;!important">&nbsp;</div>
22606 <div style="width:50%&#160;!important">&nbsp;</div>
22607 <div style="border : solid;">&nbsp;</div>
22608 !! html/php
22609 <div style="width:50% !important">&#160;</div>
22610 <div style="width:50% !important">&#160;</div>
22611 <div style="width:50% !important">&#160;</div>
22612 <div style="border&#160;: solid;">&#160;</div>
22613
22614 !! html/parsoid
22615 <div style="width:50% !important" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
22616 <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>
22617 <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>
22618 <div style="border : solid;" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
22619
22620 !! end
22621
22622 !! test
22623 HTML5 data attributes
22624 !! wikitext
22625 <span data-foo="bar">Baz</span>
22626 <p data-abc-def_hij="">Quuz</p>
22627 !! html/php
22628 <p><span data-foo="bar">Baz</span>
22629 </p>
22630 <p data-abc-def_hij="">Quuz</p>
22631
22632 !! html/parsoid
22633 <p><span data-foo="bar" data-parsoid='{"stx":"html"}'>Baz</span></p>
22634 <p data-abc-def_hij="" data-parsoid='{"stx":"html"}'>Quuz</p>
22635 !! end
22636
22637 !! test
22638 Strip reserved data attributes
22639 !! wikitext
22640 <div data-mw="foo" data-parsoid="bar" data-mw-someext="baz" data-ok="fred" data-ooui="xyzzy" data-bad:ns="ns">d</div>
22641 !! html/php
22642 <div data-ok="fred">d</div>
22643
22644 !! html/parsoid
22645 <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>
22646 !! end
22647
22648 !! test
22649 percent-encoding and + signs in internal links (T28410)
22650 !! wikitext
22651 [[User:+%]] [[Page+title%]]
22652 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
22653 [[%]] [[+]] [[File:%+abc%39|foo|[[bar]]]]
22654 [[%33%45]] [[%33%45+]]
22655 !! html/php
22656 <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>
22657 <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>
22658 <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>
22659 <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>
22660 </p>
22661 !! html/parsoid
22662 <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>
22663 <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>
22664 <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>
22665 <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>
22666 !! end
22667
22668 !! test
22669 Special characters in embedded file links (T29679)
22670 !! wikitext
22671 [[File:Contains & ampersand.jpg]]
22672 [[File:Does not exist.jpg|Title with & ampersand]]
22673 !! html/php
22674 <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>
22675 <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>
22676 </p>
22677 !! html/parsoid
22678 <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>
22679 <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>
22680 !! end
22681
22682 !! test
22683 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
22684 !! wikitext
22685 Text&apos;s been normalized?
22686 !! html
22687 <p>Text&#39;s been normalized?
22688 </p>
22689 !! end
22690
22691 !! test
22692 T21052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
22693 !! wikitext
22694 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
22695 !! html
22696 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
22697 </p>
22698 !! end
22699
22700 !! test
22701 T21052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
22702 !! wikitext
22703 [http://www.example.org/ ideograms]
22704 !! html
22705 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
22706 </p>
22707 !! end
22708
22709 !! test
22710 T21052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
22711 !! wikitext
22712 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
22713 !! html
22714 <p><img src="http://www.example.org/pic.png" alt="pic.png"/> &lt;-- U+3000 (vim: ^Vu3000)
22715 </p>
22716 !! end
22717
22718 !! article
22719 Mediawiki:loop1
22720 !! text
22721 {{Identical|A}}
22722 !! endarticle
22723
22724 !! article
22725 Mediawiki:loop2
22726 !! text
22727 {{Identical|B}}
22728 !! endarticle
22729
22730 !! article
22731 Template:Identical
22732 !! text
22733 {{int:loop1}}
22734 {{int:loop2}}
22735 !! endarticle
22736
22737 !! test
22738 T33098 Template which includes system messages which includes the template
22739 !! wikitext
22740 {{Identical}}
22741 !! html
22742 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
22743 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
22744 </p>
22745 !! end
22746
22747 !! test
22748 T33490 Turkish: ucfirst 'blah'
22749 !! options
22750 language=tr
22751 !! wikitext
22752 {{ucfirst:blah}}
22753 !! html
22754 <p>Blah
22755 </p>
22756 !! end
22757
22758 !! test
22759 T33490 Turkish: ucfirst 'ix'
22760 !! options
22761 language=tr
22762 !! wikitext
22763 {{ucfirst:ix}}
22764 !! html
22765 <p>İx
22766 </p>
22767 !! end
22768
22769 !! test
22770 T33490 Turkish: lcfirst 'BLAH'
22771 !! options
22772 language=tr
22773 !! wikitext
22774 {{lcfirst:BLAH}}
22775 !! html
22776 <p>bLAH
22777 </p>
22778 !! end
22779
22780 !! test
22781 T33490 Turkish: ucfırst (with a dotless i)
22782 !! options
22783 language=tr
22784 !! wikitext
22785 {{ucfırst:blah}}
22786 !! html
22787 <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>
22788 </p>
22789 !! end
22790
22791 !! test
22792 T33490 ucfırst (with a dotless i) with English language
22793 !! options
22794 language=en
22795 !! wikitext
22796 {{ucfırst:blah}}
22797 !! html
22798 <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>
22799 </p>
22800 !! end
22801
22802 # Note that Parsoid doesn't emit an explicit TOC.
22803 # Note also that the html2wt direction tends to emit an extra newline
22804 # between the __TOC__ magicword and the first heading unless *both*
22805 # the <meta> and the <h2> have a data-parsoid attribute set (even if
22806 # it's "{}").
22807
22808 !! test
22809 T28375: TOC with italics
22810 !! options
22811 title=[[Main Page]]
22812 !! wikitext
22813 __TOC__
22814 == ''Lost'' episodes ==
22815 !! html/php
22816 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
22817 <ul>
22818 <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>
22819 </ul>
22820 </div>
22821
22822 <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>
22823
22824 !! html/parsoid
22825 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
22826 <h2 data-parsoid='{}'> <i>Lost</i> episodes </h2>
22827 !! end
22828
22829 !! test
22830 T28375: TOC with bold
22831 !! options
22832 title=[[Main Page]]
22833 !! wikitext
22834 __TOC__
22835 == '''should be bold''' then normal text ==
22836 !! html/php
22837 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
22838 <ul>
22839 <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>
22840 </ul>
22841 </div>
22842
22843 <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>
22844
22845 !! html/parsoid
22846 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
22847 <h2 data-parsoid='{}'> <b>should be bold</b> then normal text </h2>
22848 !! end
22849
22850 !! test
22851 T35845: Headings become cursive in TOC when they contain an image
22852 !! options
22853 title=[[Main Page]]
22854 !! wikitext
22855 __TOC__
22856 == Image [[Image:foobar.jpg]] ==
22857 !! html/php
22858 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
22859 <ul>
22860 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
22861 </ul>
22862 </div>
22863
22864 <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>
22865
22866 !! html/parsoid
22867 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
22868 <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>
22869 !! end
22870
22871 !! test
22872 T35845 (2): Headings become bold in TOC when they contain a blockquote
22873 !! options
22874 title=[[Main Page]]
22875 !! wikitext
22876 __TOC__
22877 == <blockquote>Quote</blockquote> ==
22878 !! html/php
22879 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
22880 <ul>
22881 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
22882 </ul>
22883 </div>
22884
22885 <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>
22886
22887 !! html/php+tidy
22888 <p></p>
22889 <div id="toc" class="toc">
22890 <div class="toctitle">
22891 <h2>Contents</h2>
22892 </div>
22893 <ul>
22894 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
22895 </ul>
22896 </div>
22897 <p></p>
22898 <h2><span class="mw-headline" id="Quote"></span></h2>
22899 <blockquote>
22900 <p><span class="mw-headline" id="Quote">Quote</span></p>
22901 </blockquote>
22902 <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>
22903 !! html/parsoid
22904 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
22905 <h2 data-parsoid='{}'> <blockquote>Quote</blockquote> </h2>
22906 !! end
22907
22908 !! test
22909 Unclosed tags in TOC
22910 !! options
22911 title=[[Main Page]]
22912 !! wikitext
22913 __TOC__
22914 == Proof: 2 < 3 ==
22915 <small>Hanc marginis exiguitas non caperet.</small>
22916 QED
22917 !! html/php
22918 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
22919 <ul>
22920 <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>
22921 </ul>
22922 </div>
22923
22924 <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>
22925 <p><small>Hanc marginis exiguitas non caperet.</small>
22926 QED
22927 </p>
22928 !! html/parsoid
22929 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
22930 <h2 data-parsoid='{}'> Proof: 2 &lt; 3 </h2>
22931 <p><small>Hanc marginis exiguitas non caperet.</small>
22932 QED</p>
22933 !! end
22934
22935 !! test
22936 Multiple tags in TOC
22937 !! wikitext
22938 __TOC__
22939 == <i>Foo</i> <b>Bar</b> ==
22940
22941 == <i>Foo</i> <blockquote>Bar</blockquote> ==
22942 !! html/php
22943 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
22944 <ul>
22945 <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>
22946 <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>
22947 </ul>
22948 </div>
22949
22950 <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>
22951 <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>
22952
22953 !! html/php+tidy
22954 <p></p>
22955 <div id="toc" class="toc">
22956 <div class="toctitle">
22957 <h2>Contents</h2>
22958 </div>
22959 <ul>
22960 <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>
22961 <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>
22962 </ul>
22963 </div>
22964 <p></p>
22965 <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>
22966 <h2><span class="mw-headline" id="Foo_Bar_2"><i>Foo</i></span></h2>
22967 <blockquote>
22968 <p><span class="mw-headline" id="Foo_Bar_2">Bar</span></p>
22969 </blockquote>
22970 <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>
22971 !! html/parsoid
22972 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
22973 <h2 data-parsoid='{}'> <i data-parsoid='{"stx":"html"}'>Foo</i> <b data-parsoid='{"stx":"html"}'>Bar</b> </h2>
22974 <h2> <i data-parsoid='{"stx":"html"}'>Foo</i> <blockquote>Bar</blockquote> </h2>
22975 !! end
22976
22977 # Don't expect Parsoid to roundtrip this until the php parser comes closer to
22978 # html5 tag parsing.
22979 !! test
22980 Tags with parameters in TOC
22981 !! options
22982 parsoid=wt2html
22983 !! wikitext
22984 __TOC__
22985 == <sup class="in-h2">Hello</sup> ==
22986
22987 == <sup class="a > b">Evilbye</sup> ==
22988 !! html/php
22989 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
22990 <ul>
22991 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
22992 <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>
22993 </ul>
22994 </div>
22995
22996 <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>
22997 <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>
22998
22999 !! html/parsoid
23000 <meta property="mw:PageProp/toc" />
23001 <h2> <sup class="in-h2" data-parsoid='{"stx":"html"}'>Hello</sup> </h2>
23002
23003 <h2> <sup class="a " data-parsoid='{"stx":"html"}'> b">Evilbye</sup> </h2>
23004 !! end
23005
23006 !! test
23007 span tags with directionality in TOC
23008 !! wikitext
23009 __TOC__
23010 == <span dir="ltr">C++</span> ==
23011
23012 == <span dir="rtl">זבנג!</span> ==
23013
23014 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
23015
23016 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
23017
23018 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
23019 !! html/php
23020 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
23021 <ul>
23022 <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>
23023 <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>
23024 <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>
23025 <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>
23026 <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>
23027 </ul>
23028 </div>
23029
23030 <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>
23031 <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>
23032 <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>
23033 <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>
23034 <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>
23035
23036 !! html/parsoid
23037 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
23038 <h2 data-parsoid='{}'> <span dir="ltr">C++</span> </h2>
23039 <h2> <span dir="rtl">זבנג!</span> </h2>
23040 <h2> <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> </h2>
23041 <h2> <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> </h2>
23042 <h2> <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> </h2>
23043 !! end
23044
23045 !! test
23046 T74884: bdi element in ToC
23047 !! wikitext
23048 __TOC__
23049 == <bdi>test</bdi> ==
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"><span class="tocnumber">1</span> <span class="toctext"><bdi>test</bdi></span></a></li>
23054 </ul>
23055 </div>
23056
23057 <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>
23058
23059 !! html/parsoid
23060 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
23061 <h2 data-parsoid='{}'> <bdi>test</bdi> </h2>
23062 !! end
23063
23064 !! test
23065 T35715: s/strike element in ToC
23066 !! wikitext
23067 __TOC__
23068 == <s>test</s> test <strike>test</strike> ==
23069 !! html/php
23070 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
23071 <ul>
23072 <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>
23073 </ul>
23074 </div>
23075
23076 <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>
23077
23078 !! html/parsoid
23079 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
23080 <h2 data-parsoid='{}'> <s>test</s> test <strike>test</strike> </h2>
23081 !! end
23082
23083 # Note that the html output does not have the <p></p>, but the
23084 # html+tidy output *does*. This is because the empty <p></p> is
23085 # removed by the sanitizer, but only when tidy is *not* enabled (!).
23086 !! test
23087 Empty <p> tag in TOC, removed by Sanitizer (T92892)
23088 !! wikitext
23089 __TOC__
23090 == x ==
23091 !! html/php
23092 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
23093 <ul>
23094 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
23095 </ul>
23096 </div>
23097
23098 <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>
23099
23100 !! html/php+tidy
23101 <p></p>
23102 <div id="toc" class="toc">
23103 <div class="toctitle">
23104 <h2>Contents</h2>
23105 </div>
23106 <ul>
23107 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
23108 </ul>
23109 </div>
23110 <p></p>
23111 <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>
23112 !! html/parsoid
23113 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
23114 <h2 data-parsoid='{}'> x </h2>
23115 !! end
23116
23117 !! article
23118 MediaWiki:T34057
23119 !! text
23120 == {{int:headline_sample}} ==
23121 !! endarticle
23122
23123 !! test
23124 T34057: Title needed when expanding <h> nodes.
23125 !! options
23126 title=[[Main Page]]
23127 !! wikitext
23128 {{int:T34057}}
23129 !! html
23130 <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>
23131
23132 !! end
23133
23134 !! test
23135 Strip marker in urlencode
23136 !! wikitext
23137 {{urlencode:x<nowiki/>y}}
23138 {{urlencode:x<nowiki/>y|wiki}}
23139 {{urlencode:x<nowiki/>y|path}}
23140 {{urlencode:x<pre id="one">two</pre>y}}
23141 !! html/php
23142 <p>xy
23143 xy
23144 xy
23145 xy
23146 </p>
23147 !! end
23148
23149 !! test
23150 Strip marker in lc
23151 !! wikitext
23152 {{lc:x<nowiki/>y}}
23153 !! html
23154 <p>xy
23155 </p>
23156 !! end
23157
23158 !! test
23159 Strip marker in uc
23160 !! wikitext
23161 {{uc:x<nowiki/>y}}
23162 !! html
23163 <p>XY
23164 </p>
23165 !! end
23166
23167 !! test
23168 Strip marker in formatNum
23169 !! wikitext
23170 {{formatnum:1<nowiki/>2}}
23171 {{formatnum:1<nowiki/>2|R}}
23172 !! html
23173 <p>12
23174 12
23175 </p>
23176 !! end
23177
23178 !! test
23179 Check noCommafy in formatNum
23180 !! options
23181 language=be-tarask
23182 !! wikitext
23183 {{formatnum:123456.78}}
23184 {{formatnum:123456.78|NOSEP}}
23185 !! html
23186 <p>123 456,78
23187 123456.78
23188 </p>
23189 !! end
23190
23191 !! test
23192 Wrong option for formatNum (T58199)
23193 !! wikitext
23194 {{formatnum:1,234.56|Random}}
23195 {{formatnum:1,234.56|EVERYTHING}}
23196 {{formatnum:1234.56|any argument that has the string 'NOSEP'}}
23197 !! html
23198 <p>1,234.56
23199 1,234.56
23200 1,234.56
23201 </p>
23202 !! end
23203
23204 !! test
23205 Strip marker in grammar
23206 !! options
23207 language=fi
23208 !! wikitext
23209 {{grammar:elative|foo<nowiki/>bar}}
23210 !! html
23211 <p>foobarista
23212 </p>
23213 !! end
23214
23215 !! test
23216 Strip marker in padleft
23217 !! wikitext
23218 {{padleft:|2|x<nowiki/>y}}
23219 !! html
23220 <p>xy
23221 </p>
23222 !! end
23223
23224 !! test
23225 Strip marker in padright
23226 !! wikitext
23227 {{padright:|2|x<nowiki/>y}}
23228 !! html
23229 <p>xy
23230 </p>
23231 !! end
23232
23233 !! test
23234 Strip marker in anchorencode
23235 !! wikitext
23236 {{anchorencode:x<nowiki/>y}}
23237 !! html
23238 <p>xy
23239 </p>
23240 !! end
23241
23242 !! test
23243 nowiki inside link inside heading (T20295)
23244 !! wikitext
23245 ==[[foo|x<nowiki>y</nowiki>z]]==
23246 !! html
23247 <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>
23248
23249 !! end
23250
23251 !! test
23252 new support for bdi element (T33817)
23253 !! wikitext
23254 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
23255 !! html
23256 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
23257
23258 !!end
23259
23260 !! test
23261 Ignore pipe between table row attributes
23262 !! wikitext
23263 {|
23264 | quux
23265 |- id=foo | style='color: red'
23266 | bar
23267 |}
23268 !! html
23269 <table>
23270 <tr>
23271 <td> quux
23272 </td></tr>
23273 <tr id="foo" style="color: red">
23274 <td> bar
23275 </td></tr></table>
23276
23277 !! end
23278
23279 !!test
23280 Language parser function
23281 !! wikitext
23282 {{#language:ar}}
23283 !! html
23284 <p>العربية
23285 </p>
23286 !! end
23287
23288 !!test
23289 Padleft and padright as substr
23290 !! wikitext
23291 {{padleft:|3|abcde}}
23292 {{padright:|3|abcde}}
23293 !! html
23294 <p>abc
23295 abc
23296 </p>
23297 !! end
23298
23299 !!test
23300 Special parser function
23301 !! wikitext
23302 {{#special:RandomPage}}
23303 {{#special:BaDtItLe}}
23304 {{#special:Foobar}}
23305 !! html
23306 <p>Special:Random
23307 Special:Badtitle
23308 Special:Foobar
23309 </p>
23310 !! end
23311
23312 !!test
23313 T36939 - Case insensitive link parsing ([HttP://])
23314 !! wikitext
23315 [HttP://MediaWiki.Org/]
23316 !! html/php
23317 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
23318 </p>
23319 !! html/parsoid
23320 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/"></a></p>
23321 !! end
23322
23323 !!test
23324 T36939 - Case insensitive link parsing ([HttP:// title])
23325 !! wikitext
23326 [HttP://MediaWiki.Org/ MediaWiki]
23327 !! html
23328 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
23329 </p>
23330 !! end
23331
23332 !!test
23333 T36939 - Case insensitive link parsing (HttP://)
23334 !! wikitext
23335 HttP://MediaWiki.Org/
23336 !! html/php
23337 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
23338 </p>
23339 !! html/parsoid
23340 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a></p>
23341 !! end
23342
23343 !!test
23344 Disable TOC
23345 !! options
23346 notoc
23347 !! wikitext
23348 Lead
23349 == Section 1 ==
23350 == Section 2 ==
23351 == Section 3 ==
23352 == Section 4 ==
23353 == Section 5 ==
23354 !! html
23355 <p>Lead
23356 </p>
23357
23358 <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>
23359 <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>
23360 <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>
23361 <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>
23362 <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>
23363
23364 !! end
23365
23366
23367 ###
23368 ### Parsoid-specific tests
23369 ### Parsoid-PHP parser incompatibilities
23370 ###
23371 !!test
23372 1. SOL-sensitive wikitext tokens as template-args
23373 !!options
23374 parsoid=wt2html,wt2wt
23375 !! wikitext
23376 {{echo|*a}}
23377 {{echo|#a}}
23378 {{echo|:a}}
23379 !! html
23380 <span about="#mwt1" typeof="mw:Transclusion">
23381 </span><ul about="#mwt1"><li>a</li>
23382 </ul>
23383 <span about="#mwt2" typeof="mw:Transclusion">
23384 </span><ol about="#mwt2"><li>a</li>
23385 </ol>
23386 <span about="#mwt3" typeof="mw:Transclusion">
23387 </span><dl about="#mwt3"><dd>a</dd>
23388 </dl>
23389 !!end
23390
23391 #### -----------------------------------------------------------------
23392 #### Parsoid-specific functionality tests
23393 #### -----------------------------------------------------------------
23394
23395 # T65642/T68749: Formatting elt fixup around images is cleaned up.
23396 # We know wt2wt will fail, but we expect selser to pass.
23397 # Due to the nature of our testing, wt2wt and selser tests will enter the
23398 # blacklist and we'll catch selser regressions based on changes to the
23399 # blacklist entries for selser tests.
23400 !! test
23401 1. Bad treebuilder fixup of formatting elt is cleaned up
23402 !! options
23403 parsoid=wt2html,wt2wt
23404 !! wikitext
23405 {|
23406 |
23407 <small>
23408 [[Image:Foobar.jpg|right|Test]]
23409 </small>
23410 |}
23411 !! html/parsoid
23412 <table>
23413 <tbody><tr><td>
23414 <small>
23415 <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>
23416 </small>
23417 </td></tr>
23418 </tbody></table>
23419 !! end
23420
23421 !! test
23422 2. Bad treebuilder fixup of formatting elt is cleaned up
23423 !! options
23424 parsoid=wt2html,wt2wt
23425 !! wikitext
23426 '''foo[[File:Foobar.jpg|thumb|caption]]bar'''
23427
23428 <small>[[Image:Foobar.jpg|right|300px]]</small>
23429 !! html/parsoid
23430
23431 <p><b>foo</b></p>
23432 <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>
23433 <p><b>bar</b></p>
23434 <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>
23435 !! end
23436
23437 !! test
23438 3. Bad treebuilder fixup of formatting elt is cleaned up
23439 !! options
23440 parsoid=wt2html,wt2wt
23441 !! wikitext
23442 <small>'''foo[[File:Foobar.jpg|thumb|caption]]bar'''</small>
23443 !! html/parsoid
23444 <p><small><b>foo</b></small></p>
23445 <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>
23446 <p><small><b>bar</b></small></p>
23447 !! end
23448
23449 !! test
23450 4. Bad treebuilder fixup of formatting elt is cleaned up: formatting tags around captionless images are ignored
23451 !! options
23452 parsoid=wt2html,wt2wt
23453 !! wikitext
23454 '''<small>[[Image:Foobar.jpg|right|300px]]</small>'''
23455 !! html/parsoid
23456 <p><b><small></small></b></p>
23457 <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>
23458 <p></p>
23459 !! end
23460
23461 #### ----------------------------------------------------------------
23462 #### Parsoid-only testing of Parsoid's impl of LST
23463 #### Not implemented yet, see
23464 #### https://www.mediawiki.org/wiki/Parsoid/HTML_based_LST
23465 #### ----------------------------------------------------------------
23466
23467 ## We still need to support serializing the older format while content is stored.
23468 !! test
23469 LST Sections: Backwards compatibility
23470 !! options
23471 parsoid={
23472 "suppressErrors": true,
23473 "modes": ["html2wt"]
23474 }
23475 !! wikitext
23476 <section begin="2011-05-16" />
23477 <section end="2014-04-10 (MW 1.23wmf22)" />
23478 !! html/parsoid
23479 <p><meta typeof="mw:Extension/LabeledSectionTransclusion/begin" content="2011-05-16"/>
23480 <meta typeof="mw:Extension/LabeledSectionTransclusion/end" content="2014-04-10 (MW 1.23wmf22)"/></p>
23481 !! end
23482
23483 !! test
23484 LST Sections: Newfangled approach
23485 !! wikitext
23486 <section begin="2011-05-16" />
23487 <section end="2014-04-10 (MW 1.23wmf22)" />
23488 !! html/parsoid
23489 <p><span typeof="mw:Extension/section" about="#mwt4" data-mw='{"name":"section","attrs":{"begin":"2011-05-16"},"body":null}'>
23490 </span>
23491 <span typeof="mw:Extension/section" about="#mwt6" data-mw='{"name":"section","attrs":{"end":"2014-04-10 (MW 1.23wmf22)"},"body":null}'>
23492 </span></p>
23493 !! end
23494
23495 #--------- Test stripping of empty nodes in template content ----------
23496
23497 !! test
23498 Empty LI and TR nodes should be stripped from template content
23499 !! wikitext
23500 {{EmptyLITest}}
23501 {{EmptyTRTest}}
23502 !! html/parsoid
23503 <ul about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyLITest","href":"./Template:EmptyLITest"},"params":{},"i":0}}]}'>
23504 <li>a</li>
23505 <li>b</li>
23506 </ul>
23507 <table about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRTest","href":"./Template:EmptyTRTest"},"params":{},"i":0}}]}'>
23508 <tbody>
23509 <tr>
23510 <td>foo</td>
23511 </tr>
23512 <tr>
23513 <td>bar</td>
23514 </tr>
23515 </tbody>
23516 </table>
23517 !! end
23518
23519 !! test
23520 Empty LI and TR nodes should not be stripped from top-level content
23521 !! wikitext
23522 * a
23523 *
23524 * b
23525 {|
23526 |-
23527 |-
23528 |foo
23529 |}
23530 !! html/parsoid
23531 <ul>
23532 <li> a</li>
23533 <li></li>
23534 <li> b</li>
23535 </ul>
23536 <table>
23537 <tbody>
23538 <tr></tr>
23539 <tr>
23540 <td>foo</td>
23541 </tr>
23542 </tbody>
23543 </table>
23544 !! end
23545
23546 !! test
23547 Empty TR nodes should not be stripped if they have any attributes set
23548 !! wikitext
23549 {{EmptyTRWithHTMLAttrTest}}
23550 !! html/parsoid
23551 <table about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRWithHTMLAttrTest","href":"./Template:EmptyTRWithHTMLAttrTest"},"params":{},"i":0}}]}'>
23552 <tr align="center"></tr>
23553 <tr><td>foo</td></tr>
23554 <tr align="center"></tr>
23555 <tr><td>bar</td></tr>
23556 </table>
23557 !! end
23558
23559 #### ----------------------------------------------------------------
23560 #### The following section of tests are primarily to test
23561 #### wikitext escaping capabilities of Parsoid. Given that
23562 #### escaping can be done any number of ways, the wikitext (input)
23563 #### is always adjusted to reflect how Parsoid adds nowiki
23564 #### escape tags.
23565 ####
23566 #### We are marking several tests as parsoid-only since the
23567 #### HTML in the result section is different from what the
23568 #### PHP parser generates for it.
23569 #### ----------------------------------------------------------------
23570
23571
23572 #### --------------- Headings ---------------
23573 #### 0. Unnested
23574 #### 1. Nested inside html <h1>=foo=</h1>
23575 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
23576 #### 3. Nested inside html with wikitext split by html tags
23577 #### 4. No escape needed
23578 #### 5. Empty headings <h1></h1>
23579 #### 6. Heading chars in SOL context
23580 #### ----------------------------------------
23581 !! test
23582 Headings: 0. Unnested
23583 !! options
23584 parsoid=html2wt
23585 !! html/parsoid
23586 <p>=foo=</p>
23587
23588 <p> =foo=
23589 <!--cmt-->
23590 =foo=</p>
23591
23592 <p>=foo<i>a</i>=</p>
23593 !! wikitext
23594 <nowiki>=foo=</nowiki>
23595
23596 <nowiki> </nowiki>=foo=
23597 <!--cmt-->
23598 <nowiki>=foo=</nowiki>
23599
23600 =foo''a''<nowiki>=</nowiki>
23601 !!end
23602
23603 # New headings and existing headings are handled differently
23604 !! test
23605 Headings: 1. Nested inside html
23606 !! options
23607 parsoid=html2wt
23608 !! html/parsoid
23609 <h1>=foo=</h1>
23610 <h2>=foo=</h2>
23611 <h3>=foo=</h3>
23612
23613 <h1 data-parsoid=''>=foo=</h1>
23614 <h2 data-parsoid=''>=foo=</h2>
23615 <h3 data-parsoid=''>=foo=</h3>
23616 <h4 data-parsoid=''>=foo=</h4>
23617 <h5 data-parsoid=''>=foo=</h5>
23618 <h6 data-parsoid=''>=foo=</h6>
23619 !! wikitext
23620 = =foo= =
23621
23622 == =foo= ==
23623
23624 === =foo= ===
23625
23626 =<nowiki>=foo=</nowiki>=
23627 ==<nowiki>=foo=</nowiki>==
23628 ===<nowiki>=foo=</nowiki>===
23629 ====<nowiki>=foo=</nowiki>====
23630 =====<nowiki>=foo=</nowiki>=====
23631 ======<nowiki>=foo=</nowiki>======
23632
23633 !!end
23634
23635 !! test
23636 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
23637 !! options
23638 parsoid=html2wt
23639 !! html/parsoid
23640 <h1>foo</h1>*bar
23641 <h1>foo</h1>=bar
23642 <h1>foo</h1>=bar=
23643 !! wikitext
23644 = foo =
23645 <nowiki>*</nowiki>bar
23646
23647 = foo =
23648 =bar
23649
23650 = foo =
23651 <nowiki>=bar=</nowiki>
23652 !!end
23653
23654 !! test
23655 Headings: 3. Nested inside html with wikitext split by html tags
23656 !! options
23657 parsoid=html2wt
23658 !! html/parsoid
23659 <h1>=<b>bold</b>foo=</h1>
23660 !! wikitext
23661 = ='''bold'''foo= =
23662 !!end
23663
23664 !! test
23665 Headings: 4a. No escaping needed (testing just h1 and h2)
23666 !! options
23667 parsoid=html2wt
23668 !! html/parsoid
23669 <h1>=foo</h1>
23670 <h1>foo=</h1>
23671 <h1> =foo= </h1>
23672 <h1>=foo= bar</h1>
23673 <h2>=foo</h2>
23674 <h2>foo=</h2>
23675 <h1>=</h1>
23676 <h1><i>=</i>foo=</h1>
23677 !! wikitext
23678 = =foo =
23679
23680 = foo= =
23681
23682 = =foo= =
23683
23684 = =foo= bar =
23685
23686 == =foo ==
23687
23688 == foo= ==
23689
23690 = = =
23691
23692 = ''=''foo= =
23693 !!end
23694
23695 !! test
23696 Headings: 4b. No escaping needed (inside p-tags)
23697 !! options
23698 parsoid=html2wt
23699 !! html/parsoid
23700 <p>===
23701 =foo= x
23702 =foo= <s></s>
23703 </p>
23704 !! wikitext
23705 ===
23706 =foo= x
23707 =foo= <s></s>
23708 !!end
23709
23710 !! test
23711 Headings: 5. Empty headings
23712 !! options
23713 parsoid=html2wt
23714 !! html/parsoid
23715 <h1 data-parsoid='{}'></h1>
23716
23717 <h2 data-parsoid='{}'></h2>
23718
23719 <h3 data-parsoid='{}'></h3>
23720
23721 <h4 data-parsoid='{}'></h4>
23722
23723 <h5 data-parsoid='{}'></h5>
23724
23725 <h6 data-parsoid='{}'></h6>
23726 !! wikitext
23727 =<nowiki/>=
23728
23729 ==<nowiki/>==
23730
23731 ===<nowiki/>===
23732
23733 ====<nowiki/>====
23734
23735 =====<nowiki/>=====
23736
23737 ======<nowiki/>======
23738 !!end
23739
23740 !! test
23741 Headings: 6a. Heading chars in SOL context (with trailing spaces)
23742 !! options
23743 parsoid=html2wt
23744 !! html/parsoid
23745 <p>=a=</p>
23746
23747 <p>=a=</p>
23748
23749 <p>=a=</p>
23750 !! wikitext
23751 <nowiki>=a=</nowiki>
23752
23753 <nowiki>=a=</nowiki>
23754
23755 <nowiki>=a=</nowiki>
23756 !!end
23757
23758 !! test
23759 Headings: 6b. Heading chars in SOL context (with trailing newlines)
23760 !! options
23761 parsoid=html2wt
23762 !! html/parsoid
23763 <p>=a=
23764 b</p>
23765
23766 <p>=a=
23767 b</p>
23768
23769 <p>=a=
23770 b</p>
23771 !! wikitext
23772 <nowiki>=a=</nowiki>
23773 b
23774
23775 <nowiki>=a=</nowiki>
23776 b
23777
23778 <nowiki>=a=</nowiki>
23779 b
23780 !!end
23781
23782 !! test
23783 Headings: 6c. Heading chars in SOL context (leading newline break)
23784 !! options
23785 parsoid=html2wt
23786 !! html/parsoid
23787 <p>a
23788 =b=</p>
23789 !! wikitext
23790 a
23791 <nowiki>=b=</nowiki>
23792 !!end
23793
23794 !! test
23795 Headings: 6d. Heading chars in SOL context (with interspersed comments)
23796 !! options
23797 parsoid=html2wt
23798 !! html/parsoid
23799 <!--c0--><p>=a=</p>
23800
23801 <!--c1--><p>=a=</p> <!--c2--> <!--c3-->
23802 !! wikitext
23803 <!--c0--><nowiki>=a=</nowiki>
23804
23805 <!--c1--><nowiki>=a=</nowiki> <!--c2--> <!--c3-->
23806 !!end
23807
23808 !! test
23809 Headings: 6d. Heading chars in SOL context (No escaping needed)
23810 !! options
23811 parsoid=html2wt
23812 !! html/parsoid
23813 =a=<div>b</div>
23814 !! wikitext
23815 =a=<div>b</div>
23816 !!end
23817
23818 !! test
23819 Headings: 7. Insert a newline between new content and headings
23820 !! options
23821 parsoid=html2wt
23822 !! html/parsoid
23823 <h2>NEW</h2>
23824 <p>new</p>
23825 <h2 data-parsoid='{}'>A</h2>
23826 <p data-parsoid='{}'>a</p>
23827 !! wikitext
23828 == NEW ==
23829 new
23830
23831 ==A==
23832 a
23833
23834 !! end
23835
23836 #### --------------- Lists ---------------
23837 #### 0. Outside nests (*foo, etc.)
23838 #### 1. Nested inside html <ul><li>*foo</li></ul>
23839 #### 2. Inside definition lists
23840 #### 3. Only bullets at start should be escaped
23841 #### 4. No escapes needed
23842 #### 5. No unnecessary escapes
23843 #### 6. Escape bullets in SOL position
23844 #### 7. Escape bullets in a multi-line context
23845 #### ----------------------------------------
23846
23847 !! test
23848 Lists: 0. Outside nests
23849 !! options
23850 parsoid=html2wt
23851 !! html/parsoid
23852 <p>*foo</p>
23853
23854 <p>#foo</p>
23855
23856 <p>;Foo:bar</p>
23857 !! wikitext
23858 <nowiki>*</nowiki>foo
23859
23860 <nowiki>#</nowiki>foo
23861
23862 <nowiki>;</nowiki>Foo<nowiki>:</nowiki>bar
23863 !!end
23864
23865 ## Making these next 3 tests Parsoid-only since they are html2wt tests
23866 ## to test wikitext escaping, and insignificant whitespace diffs
23867 ## cause PHP parser tests to barf
23868 !! test
23869 Lists: 1. Nested inside html (No unnecessary escapes)
23870 !! options
23871 parsoid=html2wt
23872 !! html/parsoid
23873 <ul>
23874 <li>*foo</li>
23875 <li>#foo</li>
23876 <li>:foo</li>
23877 <li>;foo</li>
23878 <li data-parsoid='{}'>*foo</li>
23879 <li data-parsoid='{}'>#foo</li>
23880 <li data-parsoid='{}'>:foo</li>
23881 <li data-parsoid='{}'>;foo</li>
23882 </ul>
23883
23884 <ol>
23885 <li>*foo</li>
23886 <li>#foo</li>
23887 <li>:foo</li>
23888 <li>;foo</li>
23889 <li data-parsoid='{}'>*foo</li>
23890 <li data-parsoid='{}'>#foo</li>
23891 <li data-parsoid='{}'>:foo</li>
23892 <li data-parsoid='{}'>;foo</li>
23893 </ol>
23894 !! wikitext
23895 * *foo
23896 * #foo
23897 * :foo
23898 * ;foo
23899 *<nowiki>*foo</nowiki>
23900 *<nowiki>#foo</nowiki>
23901 *<nowiki>:foo</nowiki>
23902 *<nowiki>;foo</nowiki>
23903
23904 # *foo
23905 # #foo
23906 # :foo
23907 # ;foo
23908 #<nowiki>*foo</nowiki>
23909 #<nowiki>#foo</nowiki>
23910 #<nowiki>:foo</nowiki>
23911 #<nowiki>;foo</nowiki>
23912 !!end
23913
23914 !! test
23915 Lists: 2. Inside definition lists
23916 !! options
23917 parsoid=html2wt
23918 !! html/parsoid
23919 <dl><dt>;foo</dt></dl>
23920 <dl><dt>:foo</dt></dl>
23921 <dl><dt>:foo</dt>
23922 <dd>bar</dd></dl>
23923 <dl><dd>:foo</dd></dl>
23924 !! wikitext
23925 ; ;foo
23926
23927 ; <nowiki>:foo</nowiki>
23928
23929 ; <nowiki>:foo</nowiki>
23930 : bar
23931
23932 : :foo
23933 !!end
23934
23935 !! test
23936 Lists: 3. Only bullets at start of text in wikitext-generated HTML should be escaped
23937 !! options
23938 parsoid=html2wt
23939 !! html/parsoid
23940 <ul>
23941 <li>*foo*bar</li>
23942 <li data-parsoid='{}'>*foo<i>it</i>*bar</li>
23943 </ul>
23944 !! wikitext
23945 * *foo*bar
23946 *<nowiki>*foo</nowiki>''it''*bar
23947 !!end
23948
23949 !! test
23950 Lists: 4. No escapes needed
23951 !! options
23952 parsoid=html2wt
23953 !! html/parsoid
23954 <ul>
23955 <li>foo*bar
23956 </li>
23957 </ul>
23958 <ul>
23959 <li><i>foo</i>*bar
23960 </li>
23961 </ul>
23962 <ul>
23963 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>: bar
23964 </li>
23965 </ul>
23966 <ul>
23967 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>*bar
23968 </li>
23969 </ul>
23970 !! wikitext
23971 *foo*bar
23972
23973 *''foo''*bar
23974
23975 *[[Foo]]: bar
23976
23977 *[[Foo]]*bar
23978 !!end
23979
23980 !! test
23981 Lists: 5. No unnecessary escapes
23982 !! options
23983 parsoid=html2wt
23984 !! html/parsoid
23985 <ul><li> bar <span>[[foo]]</span></li></ul>
23986 <ul><li> =bar <span>[[foo]]</span></li></ul>
23987 <ul><li> [[bar <span>[[foo]]</span></li></ul>
23988 <ul><li> ]]bar <span>[[foo]]</span></li></ul>
23989 <ul><li> =bar <span>foo]]</span>=</li></ul>
23990 <ul><li> <s></s>: a</li></ul>
23991 <ul><li> <i>* foo</i></li></ul>
23992
23993 !! wikitext
23994 * bar <span><nowiki>[[foo]]</nowiki></span>
23995
23996 * =bar <span><nowiki>[[foo]]</nowiki></span>
23997
23998 * [[bar <span><nowiki>[[foo]]</nowiki></span>
23999
24000 * ]]bar <span><nowiki>[[foo]]</nowiki></span>
24001
24002 * =bar <span>foo]]</span>=
24003
24004 * <s></s>: a
24005
24006 * ''* foo''
24007 !!end
24008
24009 !! test
24010 Lists: 6. Escape bullets in SOL position
24011 !! options
24012 parsoid=html2wt
24013 !! html/parsoid
24014 <p><!--cmt-->*foo</p>
24015 !! wikitext
24016 <!--cmt--><nowiki>*</nowiki>foo
24017 !!end
24018
24019 !! test
24020 Lists: 7. Escape bullets in a multi-line context
24021 !! options
24022 parsoid=html2wt
24023 !! html/parsoid
24024 <p>a
24025 *b
24026 </p>
24027 !! wikitext
24028 a
24029 <nowiki>*</nowiki>b
24030 !!end
24031
24032 !! test
24033 Lists: 8. Escape colons only if not present in tags
24034 !! options
24035 parsoid=html2wt
24036 !! html/parsoid
24037 <dl><dt>a:b<i>c:d</i></dt></dl>
24038 !! wikitext
24039 ; <nowiki>a:b</nowiki>''c:d''
24040 !! end
24041
24042 #### --------------- HRs ---------------
24043 #### 1. Single line
24044 #### -----------------------------------
24045
24046 !! test
24047 HRs: 1. Single line
24048 !! options
24049 parsoid=html2wt
24050 !! html/parsoid
24051 <hr />----
24052 <hr />=foo=
24053 <hr />*foo
24054 !! wikitext
24055 ----<nowiki>----</nowiki>
24056 ----=foo=
24057 ----*foo
24058 !! end
24059
24060 #### --------------- Tables ---------------
24061 #### 1a. Simple example
24062 #### 1b. No escaping needed (!foo)
24063 #### 1c. No escaping needed (|foo)
24064 #### 1d. No escaping needed (|}foo)
24065 ####
24066 #### 2a. Nested in td (<td>foo|bar</td>)
24067 #### 2b. Nested in td (<td>foo||bar</td>)
24068 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
24069 ####
24070 #### 3a. Nested in th (<th>foo!bar</th>)
24071 #### 3b. Nested in th (<th>foo!!bar</th>)
24072 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
24073 ####
24074 #### 4a. Escape -
24075 #### 4b. Escape +
24076 #### 4c. No escaping needed
24077 #### --------------------------------------
24078
24079 !! test
24080 Tables: 1a. Simple example
24081 !! options
24082 parsoid=html2wt
24083 !! html/parsoid
24084 <p>{|
24085 |}
24086 </p>
24087 !! wikitext
24088 <nowiki>{|</nowiki>
24089 |}
24090 !! end
24091
24092 !! test
24093 Tables: 1b. No escaping needed
24094 !! options
24095 parsoid=html2wt
24096 !! html/parsoid
24097 <p>!foo
24098 </p>
24099 !! wikitext
24100 !foo
24101 !! end
24102
24103 !! test
24104 Tables: 1c. No escaping needed
24105 !! options
24106 parsoid=html2wt
24107 !! html/parsoid
24108 <p>|foo
24109 </p>
24110 !! wikitext
24111 |foo
24112 !! end
24113
24114 !! test
24115 Tables: 1d. No escaping needed
24116 !! options
24117 parsoid=html2wt
24118 !! html/parsoid
24119 <p>|}foo
24120 </p>
24121 !! wikitext
24122 |}foo
24123 !! end
24124
24125 !! test
24126 Tables: 2a. Nested in td
24127 !! options
24128 parsoid=html2wt
24129 !! html/parsoid
24130 <table><tbody><tr>
24131 <td>foo|bar</td></tr>
24132 <tr><td>x<div>a|b</div></td>
24133 </tbody></table>
24134 !! wikitext
24135 {|
24136 |<nowiki>foo|bar</nowiki>
24137 |-
24138 |x<div><nowiki>a|b</nowiki></div>
24139 |}
24140 !! html/php+tidy
24141 <table>
24142 <tr>
24143 <td>foo|bar</td>
24144 </tr>
24145 <tr>
24146 <td>x
24147 <div>a|b</div>
24148 </td>
24149 </tr>
24150 </table>
24151 !! end
24152
24153 !! test
24154 Tables: 2b. Nested in td
24155 !! options
24156 parsoid=html2wt
24157 !! html/parsoid
24158 <table><tbody><tr>
24159 <td>foo||bar</td>
24160 <td>a<i>b||c</i></td>
24161 <td>a<i><div>b||c</div></i></td>
24162 </tr></tbody></table>
24163 !! wikitext
24164 {|
24165 |<nowiki>foo||bar</nowiki>
24166 |a''<nowiki>b||c</nowiki>''
24167 |a''<div><nowiki>b||c</nowiki></div>''
24168 |}
24169 !! html/php
24170 <table>
24171 <tr>
24172 <td>foo||bar
24173 </td>
24174 <td>a<i>b||c</i>
24175 </td>
24176 <td>a<i><div>b||c</div></i>
24177 </td></tr></table>
24178
24179 !! end
24180
24181 !! test
24182 Tables: 2c. Nested in td -- no escaping needed
24183 !! options
24184 parsoid=html2wt
24185 !! html/*
24186 <table>
24187 <tr>
24188 <td>foo!!bar
24189 </td></tr></table>
24190
24191 !! wikitext
24192 {|
24193 |foo!!bar
24194 |}
24195 !! end
24196
24197 !! test
24198 Tables: 3a. Nested in th
24199 !! options
24200 parsoid=html2wt
24201 !! html/*
24202 <table>
24203 <tr>
24204 <th>foo!bar
24205 </th></tr></table>
24206
24207 !! wikitext
24208 {|
24209 !foo!bar
24210 |}
24211 !! end
24212
24213 !! test
24214 Tables: 3b. Nested in th
24215 !! options
24216 parsoid=html2wt
24217 !! html/parsoid
24218 <table><tbody>
24219 <tr><th>foo!!bar</th>
24220 <th><i>foo|bar</i></th>
24221 <th><i>foo!!bar</i></th>
24222 <th><i><span>foo!!bar</span></i></th>
24223 </tr></tbody></table>
24224 !! wikitext
24225 {|
24226 !<nowiki>foo!!bar</nowiki>
24227 !''<nowiki>foo|bar</nowiki>''
24228 !''<nowiki>foo!!bar</nowiki>''
24229 !''<span><nowiki>foo!!bar</nowiki></span>''
24230 |}
24231 !! html/php
24232 <table>
24233 <tr>
24234 <th>foo!!bar
24235 </th>
24236 <th><i>foo|bar</i>
24237 </th>
24238 <th><i>foo!!bar</i>
24239 </th>
24240 <th><i><span>foo!!bar</span></i>
24241 </th></tr></table>
24242
24243 !! end
24244
24245 !! test
24246 Tables: 3c. Nested in th
24247 !! options
24248 parsoid=html2wt
24249 !! html/parsoid
24250 <table><tbody>
24251 <tr><th>foo||bar</th>
24252 <th><span typeof="mw:Nowiki">foo||bar</span></th>
24253 </tr></tbody></table>
24254 !! wikitext
24255 {|
24256 !<nowiki>foo||bar</nowiki>
24257 !<nowiki>foo||bar</nowiki>
24258 |}
24259 !! html/php
24260 <table>
24261 <tr>
24262 <th>foo||bar
24263 </th>
24264 <th>foo||bar
24265 </th></tr></table>
24266
24267 !! end
24268
24269 !! test
24270 Tables: 4a. Escape -
24271 !! options
24272 parsoid=html2wt
24273 !! html/*
24274 <table>
24275 <tr>
24276 <th>-bar
24277 </th></tr>
24278 <tr>
24279 <td>-bar
24280 </td></tr></table>
24281
24282 !! wikitext
24283 {|
24284 !-bar
24285 |-
24286 |<nowiki>-bar</nowiki>
24287 |}
24288 !! end
24289
24290 !! test
24291 Tables: 4b. Escape +
24292 !! options
24293 parsoid=html2wt
24294 !! html/*
24295 <table>
24296 <tr>
24297 <th>+bar
24298 </th></tr>
24299 <tr>
24300 <td>+bar
24301 </td></tr></table>
24302
24303 !! wikitext
24304 {|
24305 !+bar
24306 |-
24307 |<nowiki>+bar</nowiki>
24308 |}
24309 !! end
24310
24311 !! test
24312 Tables: 4c. No escaping needed
24313 !! options
24314 parsoid=html2wt
24315 !! html/parsoid
24316 <table><tbody>
24317 <tr><td>foo-bar</td><td>foo+bar</td></tr>
24318 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
24319 <tr><td>foo
24320 <p>bar|baz
24321 +bar
24322 -bar</p></td></tr>
24323 <tr><td>x
24324 <div>a|b</div></td>
24325 </tbody></table>
24326 !! wikitext
24327 {|
24328 |foo-bar
24329 |foo+bar
24330 |-
24331 |''foo''-bar
24332 |''foo''+bar
24333 |-
24334 |foo
24335 bar|baz
24336 +bar
24337 -bar
24338 |-
24339 |x
24340 <div>a|b</div>
24341 |}
24342 !! html/php
24343 <table>
24344 <tr>
24345 <td>foo-bar
24346 </td>
24347 <td>foo+bar
24348 </td></tr>
24349 <tr>
24350 <td><i>foo</i>-bar
24351 </td>
24352 <td><i>foo</i>+bar
24353 </td></tr>
24354 <tr>
24355 <td>foo
24356 <p>bar|baz
24357 +bar
24358 -bar
24359 </p>
24360 </td></tr>
24361 <tr>
24362 <td>x
24363 <div>a|b</div>
24364 </td></tr></table>
24365
24366 !! end
24367
24368 !! test
24369 Tables: 4d. No escaping needed
24370 !! options
24371 parsoid=html2wt
24372 !! html/parsoid
24373 <table>
24374 <tbody><tr><td><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>-bar</td>
24375 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>+1</td>
24376 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>-2</td></tr>
24377 </tbody></table>
24378 !! wikitext
24379 {|
24380 |[[Foo]]-bar
24381 ||+1
24382 ||-2
24383 |}
24384 !! html/php
24385 <table>
24386 <tr>
24387 <td><a href="/wiki/Foo" title="Foo">Foo</a>-bar
24388 </td>
24389 <td>+1
24390 </td>
24391 <td>-2
24392 </td></tr></table>
24393
24394 !! end
24395
24396 !! test
24397 T97430: Don't emit empty nowiki pairs around marker meta tags
24398 !! options
24399 parsoid=html2wt
24400 !! html/parsoid
24401 <p>*This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
24402 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.</p>
24403 !! wikitext
24404 <nowiki>*</nowiki>This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
24405 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.
24406 !! end
24407
24408 !! test
24409 Unclosed xmlish element in table line shouldn't eat end delimiters
24410 !! options
24411 parsoid=html2wt
24412 !! html/parsoid
24413 <table>
24414 <tbody><tr><td> &lt;foo</td>
24415 <td> bar></td></tr>
24416 </tbody></table>
24417 !! wikitext
24418 {|
24419 | <foo
24420 | bar>
24421 |}
24422 !! html/php
24423 <table>
24424 <tr>
24425 <td> &lt;foo
24426 </td>
24427 <td> bar&gt;
24428 </td></tr></table>
24429
24430 !! end
24431
24432 #### --------------- Links ----------------
24433 #### 1. Quote marks in link text
24434 #### 2. Wikilinks: Escapes needed
24435 #### 3. Wikilinks: No escapes needed
24436 #### 4. Extlinks: Escapes needed
24437 #### 5. Extlinks: No escapes needed
24438 #### --------------------------------------
24439 !! test
24440 Links 1. WikiLinks: No escapes needed
24441 !! options
24442 parsoid=html2wt
24443 !! html/parsoid
24444 <p><a rel="mw:WikiLink" href="Foo" title="Foo">Foo<i>boo</i></a>
24445 <a rel="mw:WikiLink" href="Foo" title="Foo">[Foobar]</a>
24446 <a rel="mw:WikiLink" href="Foo" title="Foo">x [Foobar] x</a></p>
24447 !! wikitext
24448 [[Foo|Foo''boo'']]
24449 [[Foo|[Foobar]]]
24450 [[Foo|x [Foobar] x]]
24451 !! html/php
24452 <p><a href="/wiki/Foo" title="Foo">Foo<i>boo</i></a>
24453 <a href="/wiki/Foo" title="Foo">[Foobar]</a>
24454 <a href="/wiki/Foo" title="Foo">x [Foobar] x</a>
24455 </p>
24456 !! end
24457
24458 !! test
24459 Links 2. WikiLinks: Escapes needed
24460 !! options
24461 parsoid=html2wt
24462 !! html/parsoid
24463 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
24464 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
24465 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
24466 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
24467 <a href="Foo" rel="mw:WikiLink">|Bar</a>
24468 <a href="Foo" rel="mw:WikiLink">]]bar</a>
24469 <a href="Foo" rel="mw:WikiLink">[[bar</a>
24470 <a href="Foo" rel="mw:WikiLink">x [[ y</a>
24471 <a href="Foo" rel="mw:WikiLink">x ]] y</a>
24472 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
24473 !! wikitext
24474 [[Foo|<nowiki>Foobar]</nowiki>]]
24475 [[Foo|x <nowiki>[http://google.com g]</nowiki> x]]
24476 [[Foo|<nowiki>[[Bar]]</nowiki>]]
24477 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
24478 [[Foo|<nowiki>|Bar</nowiki>]]
24479 [[Foo|<nowiki>]]bar</nowiki>]]
24480 [[Foo|<nowiki>[[bar</nowiki>]]
24481 [[Foo|<nowiki>x [[ y</nowiki>]]
24482 [[Foo|<nowiki>x ]] y</nowiki>]]
24483 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
24484 !! html/php
24485 <p><a href="/wiki/Foo" title="Foo">Foobar]</a>
24486 <a href="/wiki/Foo" title="Foo">x [http://google.com g] x</a>
24487 <a href="/wiki/Foo" title="Foo">[[Bar]]</a>
24488 <a href="/wiki/Foo" title="Foo">x [[Bar]] x</a>
24489 <a href="/wiki/Foo" title="Foo">|Bar</a>
24490 <a href="/wiki/Foo" title="Foo">]]bar</a>
24491 <a href="/wiki/Foo" title="Foo">[[bar</a>
24492 <a href="/wiki/Foo" title="Foo">x [[ y</a>
24493 <a href="/wiki/Foo" title="Foo">x ]] y</a>
24494 <a href="/wiki/Foo" title="Foo">x ]] y [[ z</a>
24495 </p>
24496 !! end
24497
24498 !! test
24499 Links 3. WikiLinks: No escapes needed
24500 !! options
24501 parsoid=html2wt
24502 !! html/parsoid
24503 <p><a rel="mw:WikiLink" href="Foo">[Foobar</a>
24504 <a rel="mw:WikiLink" href="Foo" title="Foo">foo|bar</a></p>
24505 !! wikitext
24506 [[Foo|[Foobar]]
24507 [[Foo|foo|bar]]
24508 !! html/php
24509 <p><a href="/wiki/Foo" title="Foo">[Foobar</a>
24510 <a href="/wiki/Foo" title="Foo">foo|bar</a>
24511 </p>
24512 !! end
24513
24514 !! test
24515 Links 4. ExtLinks: Escapes needed
24516 !! options
24517 parsoid=html2wt
24518 !! html/parsoid
24519 <p><a rel="mw:ExtLink" href="http://google.com">[google]</a>
24520 <a rel="mw:ExtLink" href="http://google.com">google]</a>
24521 <a rel="mw:ExtLink" href="http://google.com">goog] le</a></p>
24522 <p>[http://google.com]</p>
24523 <p>[http://google.com google]</p>
24524 <p>[<a rel="mw:ExtLink" href="http://google.com">http://google.com</a>]</p>
24525 <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>
24526 !! wikitext
24527 [http://google.com <nowiki>[google]</nowiki>]
24528 [http://google.com <nowiki>google]</nowiki>]
24529 [http://google.com <nowiki>goog] le</nowiki>]
24530
24531 <nowiki>[http://google.com]</nowiki>
24532
24533 <nowiki>[http://google.com google]</nowiki>
24534
24535 [http://google.com<nowiki>]</nowiki>
24536
24537 [{{echo|http://google.com}}<nowiki>]</nowiki>
24538 !! html/php
24539 <p><a rel="nofollow" class="external text" href="http://google.com">[google]</a>
24540 <a rel="nofollow" class="external text" href="http://google.com">google]</a>
24541 <a rel="nofollow" class="external text" href="http://google.com">goog] le</a>
24542 </p><p>[http://google.com]
24543 </p><p>[http://google.com google]
24544 </p><p>[<a rel="nofollow" class="external free" href="http://google.com">http://google.com</a>]
24545 </p><p>[<a rel="nofollow" class="external free" href="http://google.com">http://google.com</a>]
24546 </p>
24547 !! end
24548
24549 !! test
24550 Links 5. ExtLinks: No escapes needed
24551 !! options
24552 parsoid=html2wt
24553 !! html/parsoid
24554 <p><a rel="mw:ExtLink" href="http://google.com">[google</a></p>
24555 <p>[<a ref="mw:ExtLink" href="http://google.com"></a>]</p>
24556 !! wikitext
24557 [http://google.com [google]
24558
24559 [[http://google.com]]
24560 !! html/php
24561 <p><a rel="nofollow" class="external text" href="http://google.com">[google</a>
24562 </p><p>[<a rel="nofollow" class="external autonumber" href="http://google.com">[1]</a>]
24563 </p>
24564 !! end
24565
24566 !! test
24567 Links 6. Add <nowiki/>s between text-nodes and url-links when required (T66300)
24568 !! options
24569 parsoid=html2wt
24570 !! html/parsoid
24571 <p>x<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>y
24572 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>?x
24573 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>&amp;x
24574 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>'x
24575 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,x
24576 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.x
24577 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
24578 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>:x
24579 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
24580 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>!x
24581 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>=x
24582 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>(x)
24583 <a rel="mw:ExtLink" href="http://example.com(x" data-parsoid='{"stx":"url"}'>http://example.com(x</a>)
24584 </p>
24585 !! wikitext
24586 x<nowiki/>http://example.com<nowiki/>y
24587 http://example.com<nowiki/>?x
24588 http://example.com<nowiki/>&x
24589 http://example.com<nowiki/>'x
24590 http://example.com<nowiki/>,x
24591 http://example.com<nowiki/>.x
24592 http://example.com<nowiki/>;x
24593 http://example.com<nowiki/>:x
24594 http://example.com<nowiki/>;x
24595 http://example.com<nowiki/>!x
24596 http://example.com<nowiki/>=x
24597 http://example.com<nowiki/>(x)
24598 http://example.com(x<nowiki/>)
24599 !! end
24600
24601 !! test
24602 Links 7a. Don't add spurious <nowiki/>s between text-nodes and url-links (T66300)
24603 !! options
24604 parsoid=html2wt
24605 !! html/parsoid
24606 <p>x
24607 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>
24608 y
24609 "<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>"
24610 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>)
24611 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>) foo
24612 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,
24613 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>, foo
24614 </p>
24615 !! wikitext
24616 x
24617 http://example.com
24618 y
24619 "http://example.com"
24620 (http://example.com)
24621 (http://example.com) foo
24622 http://example.com,
24623 http://example.com, foo
24624 !! html/php
24625 <p>x
24626 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
24627 y
24628 "<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 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>) foo
24631 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
24632 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>, foo
24633 </p>
24634 !! end
24635
24636 !! test
24637 Links 7b. Don't add spurious <nowiki/>s between text-nodes and url-links (T66300)
24638 !! options
24639 parsoid=html2wt
24640 !! html/parsoid
24641 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.,;:!?\
24642 -<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:</p>
24643 !! wikitext
24644 http://example.com.,;:!?\
24645 -http://example.com:
24646 !! html/php
24647 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.,;:!?\
24648 -<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
24649 </p>
24650 !! end
24651
24652 !! test
24653 Links 8. Add <nowiki/>s between text-nodes and RFC-links when required (T66300)
24654 !! options
24655 parsoid=html2wt
24656 !! html/parsoid
24657 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>4
24658 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
24659 X<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y</p>
24660 !! wikitext
24661 RFC 123<nowiki/>4
24662 RFC 123<nowiki/>y
24663 X<nowiki/>RFC 123<nowiki/>y
24664 !! end
24665
24666 !! test
24667 Links 9. Don't add spurious <nowiki/>s between text-nodes and RFC-links (T66300)
24668 !! options
24669 parsoid=html2wt
24670 !! html/parsoid
24671 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>?foo
24672 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>&amp;foo
24673 -<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>-
24674 </p>
24675 !! wikitext
24676 RFC 123?foo
24677 RFC 123&foo
24678 -RFC 123-
24679 !! html/php
24680 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>?foo
24681 <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>&amp;foo
24682 -<a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>-
24683 </p>
24684 !! end
24685
24686 !! test
24687 Links 10. Add <nowiki/>s between text-nodes and PMID-links when required (T66300)
24688 !! options
24689 parsoid=html2wt
24690 !! html/parsoid
24691 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>4
24692 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
24693 X<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
24694 !! wikitext
24695 PMID 123<nowiki/>4
24696 PMID 123<nowiki/>y
24697 X<nowiki/>PMID 123<nowiki/>y
24698 !! end
24699
24700 !! test
24701 Links 11. Don't add spurious <nowiki/>s between text-nodes and PMID-links (T66300)
24702 !! options
24703 parsoid=html2wt
24704 !! html/parsoid
24705 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>?foo
24706 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>&foo
24707 -<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>-
24708 </p>
24709 !! wikitext
24710 PMID 123?foo
24711 PMID 123&foo
24712 -PMID 123-
24713 !! html/php
24714 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>?foo
24715 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>&amp;foo
24716 -<a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>-
24717 </p>
24718 !! end
24719
24720 !! test
24721 Links 12. Add <nowiki/>s between text-nodes and ISBN-links when required (T66300)
24722 !! options
24723 parsoid=html2wt
24724 !! html/parsoid
24725 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>1
24726 <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>x
24727 a<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>b
24728 </p>
24729 !! wikitext
24730 ISBN 1234567890<nowiki/>1
24731 ISBN 1234567890<nowiki/>x
24732 a<nowiki/>ISBN 1234567890<nowiki/>b
24733 !! end
24734
24735 !! test
24736 Links 13. Don't add spurious <nowiki/>s between text-nodes and ISBN-links (T66300)
24737 !! options
24738 parsoid=html2wt
24739 !! html/parsoid
24740 <p>-<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>'s
24741 !! wikitext
24742 -ISBN 1234567890's
24743 !! html/php
24744 <p>-<a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>'s
24745 </p>
24746 !! end
24747
24748 !! test
24749 Links 14. Protect link-like plain text. (Parsoid bug T78425)
24750 !! options
24751 parsoid=html2wt
24752 !! html/*
24753 <p>this is not a link: http://example.com
24754 </p>
24755 !! wikitext
24756 this is not a link: <nowiki>http://example.com</nowiki>
24757 !! end
24758
24759 !! test
24760 Links 15. Link trails can't become link prefixes.
24761 !! options
24762 language=is
24763 parsoid=html2wt
24764 !! html/parsoid
24765 <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>
24766 !! wikitext
24767 [[Söfnuður]]-[[00]]
24768 !! html/php
24769 <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>
24770 </p>
24771 !! end
24772
24773 #### --------------- Quotes ---------------
24774 #### 1. Quotes inside <b> and <i>
24775 #### 2. Link fragments separated by <i> and <b> tags
24776 #### 3. Link fragments inside <i> and <b>
24777 #### 4. No escaping needed
24778 #### --------------------------------------
24779 !! test
24780 1a. Quotes inside <b> and <i>
24781 !! options
24782 parsoid=html2wt
24783 !! html/*
24784 <p><i>'foo'</i>
24785 <i>''foo''</i>
24786 <i>'''foo'''</i>
24787 <i>foo</i>'s
24788 <b>'foo'</b>
24789 <b>''foo''</b>
24790 <b>'''foo'''</b>
24791 <b>foo'<i>bar'</i>baz</b>
24792 <b>foo</b>'s
24793 '<i>foo</i>
24794 <i>foo</i>'
24795 <i>foo'</i>'
24796 '<i>foo</i>'
24797 '<b>foo</b>
24798 <b>foo</b>'
24799 '<b>foo</b>'
24800 <i>fools'<span> errand</span></i>
24801 <i><span>fool</span>'s errand</i>
24802 '<i>foo</i> bar '<i>baz</i>
24803 a|!*#-:;+-~[]{}b'<i>x</i>
24804 </p>
24805 !! wikitext
24806 ''<nowiki/>'foo'''
24807 ''<nowiki>''foo''</nowiki>''
24808 ''<nowiki>'''foo'''</nowiki>''
24809 ''foo''<nowiki/>'s
24810 '''<nowiki/>'foo''''
24811 '''<nowiki>''foo''</nowiki>'''
24812 '''<nowiki>'''foo'''</nowiki>'''
24813 '''foo'<nowiki/>''bar'<nowiki/>''baz'''
24814 '''foo'''<nowiki/>'s
24815 '''foo''
24816 ''foo''<nowiki/>'
24817 ''foo'''<nowiki/>'
24818 '''foo''<nowiki/>'
24819 ''''foo'''
24820 '''foo'''<nowiki/>'
24821 ''''foo'''<nowiki/>'
24822 ''fools'<span> errand</span>''
24823 ''<span>fool</span>'s errand''
24824 '<nowiki/>''foo'' bar '''baz''
24825 a|!*#-:;+-~[]{}b'''x''
24826 !! end
24827
24828 !! test
24829 1b. Quotes inside <b> and <i> with other tags on same line
24830 !! options
24831 parsoid=html2wt
24832 !! html/parsoid
24833 '<i>a</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
24834 <i>a'</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
24835 <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>
24836 <a rel="mw:WikiLink" href="Foo" title="Foo">foo</a> x'<i><a href="Bar" rel="mw:WikiLink" title="Bar">bar</a></i>
24837 '<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>
24838 '<i>foo</i> <div title="name">test</div>
24839 '<i>foo</i> and <br data-parsoid='{"stx":"html","noClose":true}'/> bar
24840 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
24841 <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>
24842 </ol>
24843 !! wikitext
24844 '''a'' foo ''[[bar]]''
24845 ''a''' foo ''[[bar]]''
24846 ''a''' foo '''{{echo|[[bar]]}}'''
24847 [[foo]] x'''[[bar]]''
24848 '''foo'' <ref>test</ref>
24849 '''foo'' <div title="name">test</div>
24850 '''foo'' and <br> bar
24851 <references />
24852 !! end
24853
24854 !! test
24855 2. Link fragments separated by <i> and <b> tags
24856 !! options
24857 parsoid=html2wt
24858 !! html/parsoid
24859 <p>[[<i>foo</i>hello]]</p>
24860 <p>[[<b>foo</b>hello]]</p>
24861 !! wikitext
24862 [[''foo''<nowiki>hello]]</nowiki>
24863
24864 [['''foo'''<nowiki>hello]]</nowiki>
24865 !! end
24866
24867 # FIXME: Escaping one or both of [[ and ]] is also acceptable --
24868 # this is one of the shortcomings of this format
24869 !! test
24870 3. Link fragments inside <i> and <b>
24871 !! options
24872 parsoid=html2wt
24873 !! html/parsoid
24874 <p><i>[[foo</i>]]</p>
24875 <p><b>[[foo</b>]]</p>
24876 !! wikitext
24877 ''[[foo''<nowiki>]]</nowiki>
24878
24879 '''[[foo'''<nowiki>]]</nowiki>
24880 !! end
24881
24882 !! test
24883 4. No escaping needed
24884 !! options
24885 parsoid=html2wt
24886 !! html/parsoid
24887 <p>'<span><i>bar</i></span>'
24888 '<span><b>bar</b></span>'
24889 'a:b'foo
24890 </p>
24891 !! wikitext
24892 '<span>''bar''</span>'
24893 '<span>'''bar'''</span>'
24894 'a:b'foo
24895 !! end
24896
24897 #### ----------- Paragraphs ---------------
24898 #### 1. No unnecessary escapes
24899 #### --------------------------------------
24900
24901 !! test
24902 1. No unnecessary escapes
24903 !! options
24904 parsoid=html2wt
24905 !! html/parsoid
24906 <p>bar <span>[[foo]]</span>
24907 </p><p>=bar <span>[[foo]]</span>
24908 </p><p>[[bar <span>[[foo]]</span>
24909 </p><p>]]bar <span>[[foo]]</span>
24910 </p><p>=bar <span>foo]]</span>=
24911 </p>
24912 !! wikitext
24913 bar <span><nowiki>[[foo]]</nowiki></span>
24914
24915 =bar <span><nowiki>[[foo]]</nowiki></span>
24916
24917 [[bar <span><nowiki>[[foo]]</nowiki></span>
24918
24919 ]]bar <span><nowiki>[[foo]]</nowiki></span>
24920
24921 =bar <span>foo]]</span><nowiki>=</nowiki>
24922 !!end
24923
24924 #### ----------------------- PRE --------------------------
24925 #### 1. Leading whitespace in SOL context should be escaped
24926 #### ------------------------------------------------------
24927 !! test
24928 1. Leading whitespace in SOL context should be escaped
24929 !! options
24930 parsoid=html2wt
24931 !! html/parsoid
24932 <p> a</p>
24933
24934 <p> a</p>
24935
24936 <p> a(tab)</p>
24937
24938 <p> a
24939 <!--cmt-->
24940 a</p>
24941
24942 <p>a
24943 b</p>
24944
24945 <p>a
24946 b</p>
24947
24948 <p>a
24949 b</p>
24950 !! wikitext
24951 <nowiki> </nowiki>a
24952
24953 <nowiki> </nowiki> a
24954
24955 a(tab)
24956
24957 <nowiki> </nowiki> a
24958 <!--cmt-->
24959 <nowiki> </nowiki>a
24960
24961 a
24962 <nowiki> </nowiki>b
24963
24964 a
24965 b
24966
24967 a
24968 b
24969 !! html/php
24970 <p> a
24971 </p><p> a
24972 </p><p> a(tab)
24973 </p><p> a
24974 a
24975 </p><p>a
24976 b
24977 </p><p>a
24978 b
24979 </p><p>a
24980 b
24981 </p>
24982 !! end
24983
24984 !! test
24985 2. Leading whitespace in non-indent-pre contexts should not be escaped
24986 !! options
24987 parsoid=html2wt
24988 !! html/parsoid
24989 <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>
24990 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
24991 <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>
24992 b</span></li>
24993 </ol>
24994 !! wikitext
24995 foo <ref>''a''
24996 b</ref>
24997 <references />
24998 !! end
24999
25000 !! test
25001 3. Leading whitespace in indent-pre suppressing contexts should not be escaped
25002 !! options
25003 parsoid=html2wt
25004 !! html/parsoid
25005 <blockquote>
25006 <p>
25007 a
25008 <span>b</span>
25009 c</p>
25010 </blockquote>
25011 !! wikitext
25012 <blockquote>
25013 a
25014 <span>b</span>
25015 c
25016 </blockquote>
25017 !! end
25018
25019 !! test
25020 4. Leading whitespace in indent-pre suppressing contexts should not be escaped
25021 !! options
25022 parsoid=html2wt
25023 !! html/parsoid
25024 <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>
25025 !! wikitext
25026 [[File:Foobar.jpg|thumb|caption]]
25027 !! end
25028
25029 !! test
25030 5. Nowiki escaping should account for indent-pres
25031 !! options
25032 parsoid=html2wt
25033 !! html/parsoid
25034 <pre>==foo==</pre>
25035 !! wikitext
25036 ==foo==
25037 !! end
25038
25039 !!test
25040 T95794: nowiki escaping should account for leading space at start-of-line in an indent-pre block
25041 !! options
25042 parsoid=html2wt
25043 !! html/parsoid
25044 <pre>
25045 * foo
25046 * bar
25047 </pre>
25048 !! wikitext
25049 * foo
25050 * bar
25051 !! end
25052
25053 #### --------------- Behavior Switches --------------------
25054
25055 !! test
25056 1. Valid behavior switches should be escaped
25057 !! options
25058 parsoid=html2wt
25059 !! html/parsoid
25060 __TOC__
25061 <i>__TOC__</i>
25062 !! wikitext
25063 <nowiki>__TOC__</nowiki>
25064 ''<nowiki>__TOC__</nowiki>''
25065 !! end
25066
25067 !! test
25068 2. Invalid behavior switches should not be escaped
25069 !! options
25070 parsoid=html2wt
25071 !! html/parsoid
25072 __TOO__
25073 __|__
25074 !! wikitext
25075 __TOO__
25076 __|__
25077 !! end
25078
25079 # We use indent-pre as an indirect way to test for sol-transparent behavior.
25080 !! test
25081 Behavior switches should be SOL-transparent
25082 !! options
25083 parsoid=html2wt
25084 !! html/parsoid
25085 <meta property="mw:PageProp/toc" />
25086
25087 <!-- this one's bogus -->
25088 <pre>__TOO__</pre>
25089
25090 <pre data-parsoid='{}'><meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/> foo</pre>
25091
25092 <meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/><pre data-parsoid='{}'>bar</pre>
25093 !! wikitext
25094 __TOC__
25095
25096 <!-- this one's bogus -->
25097 __TOO__
25098
25099 __TOC__ foo
25100
25101 __TOC__
25102 bar
25103 !! end
25104
25105 #### --------------- HTML tags ---------------
25106 #### 1. a tags
25107 #### 2. other tags
25108 #### 3. multi-line html tag
25109 #### 4. extension tags
25110 #### -----------------------------------------
25111 !! test
25112 1. a tags
25113 !! options
25114 parsoid=html2wt
25115 !! html/parsoid
25116 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
25117 !! wikitext
25118 <a href="http://google.com">google</a>
25119 !! end
25120
25121 !! test
25122 2. other tags
25123 !! options
25124 parsoid=html2wt
25125 !! html/parsoid
25126 <ul><li> &lt;div&gt;foo&lt;/div&gt;</li>
25127 <li> &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;</li>
25128 <li> &lt;td&gt;</li></ul>
25129
25130 !! wikitext
25131 * <nowiki><div>foo</div></nowiki>
25132 * <nowiki><div style="color:red">foo</div></nowiki>
25133 * <nowiki><td></nowiki>
25134 !! end
25135
25136 !! test
25137 3. multi-line html tag
25138 !! options
25139 parsoid=html2wt
25140 !! html/parsoid
25141 <p>&lt;div
25142 &gt;foo&lt;/div
25143 &gt;
25144 </p>
25145 !! wikitext
25146 <nowiki><div
25147 >foo</div
25148 ></nowiki>
25149 !! end
25150
25151 !! test
25152 4. extension tags
25153 !! options
25154 parsoid=html2wt
25155 !! html/parsoid
25156 <p>&lt;ref&gt;foo&lt;/ref&gt;
25157 </p><p>&lt;ref&gt;bar
25158 </p><p>baz&lt;/ref&gt;
25159 </p>
25160 !! wikitext
25161 <nowiki><ref>foo</ref></nowiki>
25162
25163 <nowiki><ref>bar</nowiki>
25164
25165 baz<nowiki></ref></nowiki>
25166 !! end
25167
25168 #### --------------- Others ---------------
25169 !! test
25170 Escaping nowikis
25171 !! options
25172 parsoid=html2wt
25173 !! html/parsoid
25174 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
25175 </p>
25176 !! wikitext
25177 &lt;nowiki&gt;foo&lt;/nowiki&gt;
25178 !! end
25179
25180 ## The quote-char in the input is necessary for triggering the bug
25181 !! test
25182 (T54035) Nowiki-escaping should not get tripped by " :" in text
25183 !! options
25184 parsoid=html2wt
25185 !! html/parsoid
25186 <p>foo's bar :</p>
25187 !! wikitext
25188 foo's bar :
25189 !! end
25190
25191 #----------- End of wikitext escaping tests --------------
25192
25193 !! test
25194
25195 Tag-like HTML structures are passed through as text
25196 !! wikitext
25197 <x y>
25198
25199 <x.y>
25200
25201 <x-y>
25202
25203 1>2
25204
25205 x<y
25206
25207 a>b
25208
25209 1<d e>f
25210 !! html
25211 <p>&lt;x y&gt;
25212 </p><p>&lt;x.y&gt;
25213 </p><p>&lt;x-y&gt;
25214 </p><p>1&gt;2
25215 </p><p>x&lt;y
25216 </p><p>a&gt;b
25217 </p><p>1&lt;d e&gt;f
25218 </p>
25219 !! end
25220
25221 !! test
25222 HTML tag with necessary entities in attributes
25223 !! wikitext
25224 <span title="&amp;amp;">foo</span>
25225 !! html
25226 <p><span title="&amp;amp;">foo</span>
25227 </p>
25228 !! end
25229
25230 !! test
25231 HTML tag with 'unnecessary' entity encoding in attributes
25232 !! wikitext
25233 <span title="&amp;">foo</span>
25234 !! html
25235 <p><span title="&amp;">foo</span>
25236 </p>
25237 !! end
25238
25239 !! test
25240 HTML tag with broken attribute value quoting
25241 !! options
25242 parsoid=wt2html,html2html
25243 !! wikitext
25244 <span title="Hello world>Foo</span>
25245 !! html/php
25246 <p><span title="Hello world">Foo</span>
25247 </p>
25248 !! html/parsoid
25249 <p><span title="Hello world">Foo</span></p>
25250 !! end
25251
25252 !! test
25253 Self-closed tag with broken attribute value quoting
25254 !! options
25255 parsoid=wt2html,html2html
25256 !! wikitext
25257 <div title="Hello world />Foo
25258 !! html/php+tidy
25259 <div title="Hello world"></div>
25260 <p>Foo</p>
25261 !! html/parsoid
25262 <div title="Hello world " data-parsoid='{"stx":"html","selfClose":true}'></div><p>Foo</p>
25263 !! end
25264
25265 !! test
25266 Table with broken attribute value quoting
25267 !! options
25268 parsoid=wt2html,html2html
25269 !! wikitext
25270 {|
25271 | title="Hello world|Foo
25272 |}
25273 !! html/php
25274 <table>
25275 <tr>
25276 <td title="Hello world">Foo
25277 </td></tr></table>
25278
25279 !! html/parsoid
25280 <table>
25281 <tr>
25282 <td title="Hello world">Foo
25283 </td></tr></table>
25284
25285 !! end
25286
25287 !! test
25288 Table with broken attribute value quoting on consecutive lines
25289 !! options
25290 parsoid=wt2html,html2html
25291 !! wikitext
25292 {|
25293 | title="Hello world|Foo
25294 | style="color:red|Bar
25295 |}
25296 !! html/php
25297 <table>
25298 <tr>
25299 <td title="Hello world">Foo
25300 </td>
25301 <td style="color:red">Bar
25302 </td></tr></table>
25303
25304 !! html/parsoid
25305 <table><tbody>
25306 <tr>
25307 <td title="Hello world">Foo
25308 </td><td style="color: red">Bar
25309 </td></tr></tbody></table>
25310
25311 !! end
25312
25313 !!test
25314 Accept empty td cell attribute
25315 !! wikitext
25316 {|
25317 | align="center" | foo || |
25318 |}
25319 !! html
25320 <table>
25321 <tr>
25322 <td align="center"> foo </td>
25323 <td>
25324 </td></tr></table>
25325
25326 !!end
25327
25328 !!test
25329 Non-empty attributes in th-cells
25330 !! wikitext
25331 {|
25332 ! Foo !! style="color: red" | Bar
25333 |}
25334 !! html
25335 <table>
25336 <tr>
25337 <th> Foo </th>
25338 <th style="color: red"> Bar
25339 </th></tr></table>
25340
25341 !!end
25342
25343 !!test
25344 Accept empty attributes in th-cells
25345 !! wikitext
25346 {|
25347 !| foo !!| bar
25348 |}
25349 !! html
25350 <table>
25351 <tr>
25352 <th> foo </th>
25353 <th> bar
25354 </th></tr></table>
25355
25356 !!end
25357
25358 !!test
25359 Empty table rows go away
25360 !! wikitext
25361 {|
25362 | Hello
25363 | there
25364 |- class="foo"
25365 |-
25366 |}
25367 !! html
25368 <table>
25369 <tr>
25370 <td> Hello
25371 </td>
25372 <td> there
25373 </td></tr>
25374
25375 </table>
25376
25377 !! end
25378
25379 ###
25380 ### Parsoid-centric tests for testing RTing of inter-element separators
25381 ### Edge cases not tested by existing parser tests and specific to
25382 ### Parsoid-specific serialization strategies.
25383 ###
25384
25385 !!test
25386 RT-ed inter-element separators should be valid separators
25387 !! wikitext
25388 {|
25389 |- [[foo]]
25390 |}
25391 !! html/php
25392 <table>
25393
25394 </table>
25395
25396 !! html/parsoid
25397 <table>
25398 <tbody><tr data-parsoid='{"startTagSrc":"|-","a":{"[[foo]]":null},"sa":{"[[foo]]":""},"autoInsertedEnd":true}'></tr>
25399 </tbody></table>
25400 !!end
25401
25402 # Parsoid-only since PHP parser relies on Tidy for correct output
25403 !!test
25404 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
25405 !!options
25406 parsoid
25407 !! wikitext
25408 {|
25409 |<small>foo
25410 bar
25411 |}
25412
25413 {|
25414 |<small>foo<small>
25415 |}
25416 !! html
25417 <table>
25418 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'>foo
25419 <p>bar</p></small></td></tr>
25420 </tbody></table>
25421
25422 <table>
25423 <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>
25424 </tbody></table>
25425 !!end
25426
25427 # Note that the "style" attribute is really a template parameter here.
25428 # The = would have to be {{=}} if you wanted the literal.
25429 !!test
25430 Empty TD followed by TD with tpl-generated attribute
25431 !! wikitext
25432 {|
25433 |-
25434 |
25435 |{{echo|style='color:red'}}|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 !!test
25449 Indented table with an empty td
25450 !! wikitext
25451 {|
25452 |-
25453 |
25454 |foo
25455 |}
25456 !! html
25457 <table>
25458
25459 <tr>
25460 <td>
25461 </td>
25462 <td>foo
25463 </td></tr></table>
25464
25465 !!end
25466
25467 ## We have some newline diffs RT-ing this edge case
25468 ## and it is not important enough -- we seem to be emitting
25469 ## at most 2 newlines after a </tr> and this is unrelated to
25470 ## the issue from T85627 that this is testing.
25471 !!test
25472 Indented table with blank lines in between (T85627)
25473 !! options
25474 parsoid=wt2html
25475 !! wikitext
25476 {|
25477 |foo
25478
25479
25480 |}
25481 !! html
25482 <table>
25483
25484 <tr>
25485 <td>foo
25486 </td></tr></table>
25487
25488 !!end
25489
25490 !!test
25491 Indented block & table
25492 !! wikitext
25493 <div>foo</div>
25494 {|
25495 |foo
25496 |}
25497 !! html/php
25498 <div>foo</div>
25499 <table>
25500 <tr>
25501 <td>foo
25502 </td></tr></table>
25503
25504 !! html/parsoid
25505 <div data-parsoid='{"stx":"html"}'>foo</div>
25506 <table><tbody>
25507 <tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>foo</td></tr>
25508 </tbody></table>
25509 !!end
25510
25511 !! test
25512 Indent and comment before table row
25513 !! wikitext
25514 {|
25515 <!--hi-->|-
25516 | there
25517 |}
25518 !! html/php
25519 <table>
25520
25521 <tr>
25522 <td> there
25523 </td></tr></table>
25524
25525 !! html/parsoid
25526 <table>
25527 <!--hi--><tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
25528 <td data-parsoid='{"autoInsertedEnd":true}'> there</td></tr>
25529 </tbody></table>
25530 !! end
25531
25532 # Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext
25533 !!test
25534 Empty TR followed by a template-generated TR
25535 !!options
25536 parsoid
25537 !! wikitext
25538 {|
25539 |-
25540 {{echo|<tr><td>foo</td></tr>}}
25541 |}
25542 !! html
25543 <table>
25544 <tbody>
25545 <tr></tr>
25546 <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}}]}'>
25547 <td>foo</td></tr>
25548 </tbody></table>
25549 !!end
25550
25551 ## PHP and parsoid output differ for this, and since this is primarily
25552 ## for testing Parsoid's serializer, marking this Parsoid only
25553 !!test
25554 Empty TR followed by mixed-ws-comment line should RT correctly
25555 !!options
25556 parsoid
25557 !! wikitext
25558 {|
25559 |-
25560 <!--c-->
25561 |-
25562 <!--c--> <!--d-->
25563 |}
25564 !! html
25565 <table>
25566 <tbody>
25567 <tr></tr>
25568 <!--c-->
25569 <tr>
25570 <!--c--> </tr><!--d-->
25571 </tbody></table>
25572
25573 !!end
25574
25575 !!test
25576 Multi-line image caption generated by templates with/without trailing newlines
25577 !! wikitext
25578 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
25579 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
25580 !! html/parsoid
25581 <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>
25582 <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>
25583 !!end
25584
25585 !! test
25586 New element inserted (without intervening newlines) after an old sol-transparent node should serialize correctly
25587 !! options
25588 parsoid=html2wt
25589 !! html/parsoid
25590 <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>
25591
25592 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{}'/><h1>new heading</h1>
25593 !! wikitext
25594 <includeonly>foo</includeonly>
25595 new para
25596
25597 [[Category:Foo]]
25598
25599 = new heading =
25600 !! end
25601
25602 ## PHP emits broken html for this, and since this is primarily
25603 ## a Parsoid serializer test, marking this Parsoid only
25604 !!test
25605 Improperly nested inline or quotes tags with whitespace in between
25606 !! wikitext
25607 <span> <s>x</span> </s>
25608 ''' ''x''' ''
25609 !! html/parsoid
25610 <p><span> <s>x</s></span><s> </s>
25611 <b> <i>x</i></b><i> </i>
25612 </p>
25613 !!end
25614
25615 !!test
25616 Encapsulate protected attributes from wt
25617 !! wikitext
25618 <div typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
25619
25620 {| typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true"
25621 | ok
25622 |}
25623 !! html/parsoid
25624 <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>
25625
25626 <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">
25627 <tbody><tr><td data-parsoid='{"autoInsertedEnd":true}'> ok</td></tr>
25628 </tbody></table>
25629 !!end
25630
25631 ## Currently the p-wrapper is fragile in how it adds / removes transformations.
25632 ## Having nested or stray pre tags results in the attempt to add duplicates,
25633 ## causing an assertion fail. This test tries to prevent that situation.
25634 !!test
25635 Ensure ParagraphWrapper can deal with stray closing pre tags
25636 !!options
25637 parsoid=wt2html
25638 !! wikitext
25639 plain text</pre>
25640 !! html/parsoid
25641 plain text
25642 !!end
25643
25644 !!test
25645 1. Ensure fostered text content is wrapped in element nodes
25646 !!options
25647 parsoid=wt2html
25648 !! wikitext
25649 <table>hi</table><table>ho</table>
25650 !! html/parsoid
25651 <p>hi</p>
25652 <table></table>
25653 <p>ho</p>
25654 <table></table>
25655 !!end
25656
25657 !!test
25658 2. Ensure fostered text content is wrapped in element nodes (traps regressions around fostered marker on the element getting lost)
25659 !!options
25660 parsoid=wt2html,wt2wt
25661 !! wikitext
25662 <table>
25663 <tr> || ||
25664 <td> a
25665 </table>
25666 !! html/parsoid
25667 <p> || ||
25668 </p><table>
25669 <tbody><tr><td> a</td></tr>
25670 </tbody></table>
25671 !!end
25672
25673 !!test
25674 Encapsulation properly handles null DSR information from foster box
25675 !!options
25676 parsoid=wt2html,wt2wt
25677 !! wikitext
25678 {{echo|<table>foo<tr><td>bar</td></tr></table>}}
25679 !! html/parsoid
25680 <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>
25681 !!end
25682
25683 !!test
25684 1. Encapsulate foster-parented transclusion content
25685 !!options
25686 parsoid=wt2wt,wt2html
25687 !! wikitext
25688 <table>{{echo|foo<tr><td>bar</td></tr>}}</table>
25689 !! html/parsoid
25690 <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>
25691 <tbody>
25692 <tr>
25693 <td>bar</td>
25694 </tr>
25695 </tbody>
25696 </table>
25697 !!end
25698
25699 !!test
25700 2. Encapsulate foster-parented transclusion content
25701 !!options
25702 parsoid=wt2wt,wt2html
25703 !! wikitext
25704 <table><div>{{echo|foo}}</div><tr><td>bar</td></tr></table>
25705 !! html/parsoid
25706 <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>
25707 <table>
25708 <tbody>
25709 <tr>
25710 <td>bar</td>
25711 </tr>
25712 </tbody>
25713 </table>
25714 !!end
25715
25716 !!test
25717 3. 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 4. Encapsulate foster-parented transclusion content
25737 !!options
25738 parsoid=wt2wt,wt2html
25739 !! wikitext
25740 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
25741 !! html/parsoid
25742 <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;]}">
25743 <p>foo</p>
25744 </div>
25745 <table>
25746 <tbody>
25747 <tr>
25748 <td>bar</td>
25749 </tr>
25750 </tbody>
25751 </table>
25752 !!end
25753
25754 !!test
25755 5. Encapsulate foster-parented transclusion content
25756 !!options
25757 parsoid=wt2wt,wt2html
25758 !! wikitext
25759 <table><tr><td><div><p>{{echo|foo</p></div></td>foo}}</tr></table>
25760 !! html/parsoid
25761 <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>
25762 <table>
25763 <tbody>
25764 <tr>
25765 <td>
25766 <div>
25767 <p>foo</p>
25768 </div>
25769 </td>
25770 </tr>
25771 </tbody>
25772 </table>
25773 !!end
25774
25775 !!test
25776 6. Encapsulate foster-parented transclusion content
25777 !!options
25778 parsoid=wt2wt,wt2html
25779 !! wikitext
25780 <table><tr><td><div><p>{{echo|foo</p></div></td>foo</tr></table>}}<p>ok</p>
25781 !! html/parsoid
25782 <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>
25783 <table>
25784 <tbody>
25785 <tr>
25786 <td>
25787 <div>
25788 <p>foo</p>
25789 </div>
25790 </td>
25791 </tr>
25792 </tbody>
25793 </table>
25794 <p>ok</p>
25795 !!end
25796
25797 !!test
25798 7. Encapsulate foster-parented transclusion content
25799 !!options
25800 parsoid=wt2wt,wt2html
25801 !! wikitext
25802 <table>{{echo|<p>foo</p>}}<td>bar</td></table>
25803 !! html/parsoid
25804 <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>
25805 <table>
25806 <tbody>
25807 <tr>
25808 <td>bar</td>
25809 </tr>
25810 </tbody>
25811 </table>
25812 !!end
25813
25814 # Note that the wt is broken on purpose: the = should be {{=}} if you
25815 # don't want it to be a template parameter key.
25816 !!test
25817 8. Encapsulate foster-parented transclusion content
25818 !!options
25819 parsoid=wt2wt,wt2html
25820 !! wikitext
25821 {{echo|a
25822 }}{|{{echo|style='color:red'}}
25823 |-
25824 |b
25825 |}
25826 !! html/parsoid
25827 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\n"}},"i":0}}]}'>a</p>
25828 <span> </span>
25829 <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>
25830 <table>
25831 <tbody>
25832 <tr>
25833 <td>b</td>
25834 </tr>
25835 </tbody>
25836 </table>
25837 !!end
25838
25839 !!test
25840 9. Encapsulate foster-parented transclusion content
25841 !!options
25842 parsoid=wt2wt,wt2html
25843 !! wikitext
25844 <table>{{echo|hi</table>hello}}
25845 !! html/parsoid
25846 <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>
25847 !!end
25848
25849 !!test
25850 Table in fosterable position
25851 !!options
25852 parsoid=wt2html
25853 !! wikitext
25854 {{OpenTable}}
25855 <div>
25856 {|
25857 |}
25858 </div>
25859 |}
25860 !! html/parsoid
25861 <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">
25862 </span>
25863 <table about="#mwt1" data-parsoid='{"autoInsertedEnd":true}'></table>
25864
25865 <table>
25866 </table>
25867 !!end
25868
25869 # Parsoid only for T66747
25870 !! test
25871 Properly encapsulate empty-content transclusions in fosterable positions
25872 !! wikitext
25873 <table>
25874 {{#if:|
25875 <td>foo</td>
25876 }}
25877 </table>
25878 !! html/parsoid
25879 <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"}]]}'>
25880
25881 </table>
25882 !! end
25883
25884 !! test
25885 Always encapsulate foster box when template range is expanded to table
25886 !! options
25887 parsoid=wt2wt
25888 !! wikitext
25889 {|
25890 hello
25891 {{OpenTable}}
25892 |}
25893 !! html/parsoid
25894
25895 !! end
25896
25897 !! test
25898 T115289: Unclosed table
25899 !! wikitext
25900 {{echo|<table>}}<!--c-->[[Category:Two]]
25901 !! html/parsoid
25902 <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>
25903 !! end
25904
25905 !! test
25906 T115289: Don't migrate newlines out of tables with fostered content
25907 !! wikitext
25908 <table><td></td>{{echo|<tr>[[Category:One]]}}<!--c-->[[Category:Two]]
25909 !! html/parsoid
25910 <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>
25911 !! end
25912
25913 !! test
25914 T73074: More fostering fun
25915 !! wikitext
25916 <table><td></td>{{echo|<tr>}}<!--c-->[[Category:Two]]
25917 !! html/parsoid
25918 <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>
25919 !! end
25920
25921 !!test
25922 Support <object> element with .data attribute
25923 !!options
25924 parsoid=html2wt
25925 !! html/parsoid
25926 <object data="test.swf"></object>
25927 !! wikitext
25928 <object data="test.swf"></object>
25929 !!end
25930
25931 !! test
25932 Don't block XML namespace declaration
25933 !! wikitext
25934 <span xmlns:dct="http://purl.org/dc/terms/" property="dct:title">MediaWiki</span>
25935 !! html/php
25936 <p><span xmlns:dct="http&#58;//purl.org/dc/terms/" property="dct:title">MediaWiki</span>
25937 </p>
25938 !! html/parsoid
25939 <p><span xmlns:dct="http://purl.org/dc/terms/" data-x-property="dct:title" data-parsoid='{"stx":"html"}'>MediaWiki</span></p>
25940 !! end
25941
25942 # -----------------------------------------------------------------
25943 # The following section of tests are primarily to spec requirements
25944 # around Parsoid's serialization (old, new, edited content)
25945 #
25946 # All these tests are marked Parsoid html2wt and html2html only
25947 # ----------------------------------------------------------------
25948
25949 !! test
25950 Ignore rel attribute in a-tags during serialization to url-links
25951 !! options
25952 parsoid=html2wt
25953 !! html/parsoid
25954 <a href='http://en.wikipedia.org/wiki/Foobar'>http://en.wikipedia.org/wiki/Foobar</a>
25955 <a href='http://en.wikipedia.org/wiki/Foobar' rel='mw:ExtLink'>http://en.wikipedia.org/wiki/Foobar</a>
25956 <a href='http://en.wikipedia.org/wiki/Foobar' rel='mw:WikiLink'>http://en.wikipedia.org/wiki/Foobar</a>
25957 !! wikitext
25958 http://en.wikipedia.org/wiki/Foobar
25959 http://en.wikipedia.org/wiki/Foobar
25960 http://en.wikipedia.org/wiki/Foobar
25961 !! end
25962
25963 # 'mi' is a localinterwiki prefix as well as a language
25964 !! test
25965 Serialize interwiki links pointing to the current wiki as plain wiki links (T67869)
25966 !! options
25967 parsoid=html2wt
25968 !! html/parsoid
25969 <p><a rel="mw:ExtLink" href="http://mi.wikipedia.org/wiki/Foo">Foo</a></p>
25970 !! wikitext
25971 [[Foo]]
25972 !! end
25973
25974 !! test
25975 Parsoid should accept interwiki shortcuts
25976 !! options
25977 parsoid=html2wt
25978 !! html/parsoid
25979 <p><a rel='mw:WikiLink' href='./fr:Foo'>Foo</a>
25980 <a rel='mw:ExtLink' href='./fr:Foo'>Foo</a>
25981 <a href='./fr:Foo'>Foo</a></p>
25982 <p><a rel='mw:WikiLink' href='fr%3AFoo'>Foo</a>
25983 <a rel='mw:ExtLink' href='fr%3AFoo'>Foo</a>
25984 <a href='fr%3AFoo'>Foo</a></p>
25985 !! wikitext
25986 [[:fr:Foo|Foo]]
25987 [[:fr:Foo|Foo]]
25988 [[:fr:Foo|Foo]]
25989
25990 [[:fr:Foo|Foo]]
25991 [[:fr:Foo|Foo]]
25992 [[:fr:Foo|Foo]]
25993 !! end
25994
25995 !! test
25996 Parsoid should not accept invalid interwiki shortcuts
25997 !! options
25998 parsoid=html2wt
25999 !! html/parsoid
26000 <p><a rel='mw:WikiLink' href='news:Foo'>Foo</a>
26001 <a rel='mw:ExtLink' href='news:Foo'>Foo</a>
26002 <a href='news:Foo'>Foo</a></p>
26003 !! wikitext
26004 [news:Foo Foo]
26005 [news:Foo Foo]
26006 [news:Foo Foo]
26007 !! end
26008
26009 # See T93839
26010 !! test
26011 New wikilinks should be serialized properly
26012 !! options
26013 parsoid=html2wt
26014 !! html/parsoid
26015 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{}'>Foo</a>
26016 <a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>
26017 <a href="//en.wikipedia.org/wiki/Foo">//en.wikipedia.org/wiki/Foo</a>
26018 <a href="http://en.wikipedia.org/wiki/Foo">http://en.wikipedia.org/wiki/Foo</a>
26019 <a href="//en.wikipedia.org/wiki/Foo_bar">//en.wikipedia.org/wiki/Foo bar</a>
26020 !! wikitext
26021 [[Foo]]
26022 [[Foo]]
26023 [[:en:Foo|//en.wikipedia.org/wiki/Foo]]
26024 http://en.wikipedia.org/wiki/Foo
26025 [[:en:Foo_bar|//en.wikipedia.org/wiki/Foo bar]]
26026 !! end
26027
26028 !! test
26029 New wiki links (href variations)
26030 !! options
26031 parsoid=html2wt
26032 !! html/parsoid
26033 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
26034 <a rel="mw:WikiLink" href="Foo_bar">Foo_bar</a>
26035 <a rel="mw:WikiLink" href="Foo bar">Foo_bar</a>
26036 <a rel="mw:WikiLink" href="./Toxine_bact%C3%A9rienne">Toxine bactérienne</a>
26037 !! wikitext
26038 [[Foo_bar]]
26039 [[Foo_bar]]
26040 [[Foo_bar]]
26041 [[Toxine bactérienne]]
26042 !! end
26043
26044 !! test
26045 New wiki links (content string variations)
26046 !! options
26047 parsoid=html2wt
26048 !! html/parsoid
26049 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
26050 <a rel="mw:WikiLink" href="./Foo_bar">Foo bar</a>
26051 <a rel="mw:WikiLink" href="./Foo_bar">./Foo_bar</a>
26052 !! wikitext
26053 [[Foo_bar]]
26054 [[Foo bar]]
26055 [[Foo_bar|./Foo_bar]]
26056 !! end
26057
26058 !! test
26059 New category links (href variations)
26060 !! options
26061 parsoid=html2wt
26062 !! html/parsoid
26063 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne" />
26064 <link rel="mw:PageProp/Category" href="./Category:Toxine_bact%C3%A9rienne" />
26065 <link rel="mw:PageProp/Category" href="Category:Toxine_bact%C3%A9rienne" />
26066 !! wikitext
26067 [[Category:Toxine bactérienne]]
26068 [[Category:Toxine bactérienne]]
26069 [[Category:Toxine bactérienne]]
26070 !! end
26071
26072 !! test
26073 New sol transparent links don't need indent-pre nowiki protection
26074 !! options
26075 parsoid=html2wt
26076 language=de
26077 !! html/parsoid
26078 <link rel="mw:PageProp/redirect" href="./Main_Page">
26079 <!-- this is good --> <link rel="mw:PageProp/Category" href="./Category:Good" />
26080 <!-- this is great --> <link rel="mw:PageProp/Category" href="./Kategorie:Great" />
26081 !! wikitext
26082 #WEITERLEITUNG [[Main Page]]
26083 <!-- this is good --> [[Category:Good]]
26084 <!-- this is great --> [[Kategorie:Great]]
26085 !! end
26086
26087 !! test
26088 New interlanguage links (href variations)
26089 !! options
26090 parsoid=html2wt
26091 !! html/parsoid
26092 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine bactérienne" />
26093 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bactérienne" />
26094 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bact%C3%A9rienne" />
26095 !! wikitext
26096 [[es:Toxine bactérienne]]
26097 [[es:Toxine_bactérienne]]
26098 [[es:Toxine_bactérienne]]
26099 !! end
26100
26101 !! test
26102 Image: Modifying size of an image (1)
26103 !! options
26104 parsoid={
26105 "modes": ["wt2wt"],
26106 "changes": [
26107 ["img[height]", "attr", "height", "22"],
26108 ["img[width]", "attr", "width", "200"]
26109 ]
26110 }
26111 !! wikitext
26112 [[Image:Foobar.jpg|230x230px]]
26113 !! wikitext/edited
26114 [[Image:Foobar.jpg|200x200px]]
26115 !!end
26116
26117 !! test
26118 Image: Modifying size of an image (2)
26119 !! options
26120 parsoid={
26121 "modes": ["wt2wt"],
26122 "changes": [
26123 ["img[height]", "attr", "height", "100"],
26124 ["img[width]", "attr", "width", "500"]
26125 ]
26126 }
26127 !! wikitext
26128 [[Image:Foobar.jpg|230x230px]]
26129 !! wikitext/edited
26130 [[Image:Foobar.jpg|500x500px]]
26131 !!end
26132
26133 # Change in size is ignored so long as class='mw-default-size'
26134 !! test
26135 Image: Modifying size of an image (3)
26136 !! options
26137 parsoid={
26138 "modes": ["wt2wt"],
26139 "changes": [
26140 ["figure[class]", "removeClass", "mw-default-size"],
26141 ["figure img", "attr", "height", "19"],
26142 ["figure img", "attr", "width", "170"]
26143 ]
26144 }
26145 !! wikitext
26146 [[Image:Foobar.jpg|thumb]]
26147 !! wikitext/edited
26148 [[Image:Foobar.jpg|thumb|170x170px]]
26149 !!end
26150
26151 !! test
26152 Image: Modifying alignment of an image (T50665)
26153 !! options
26154 parsoid={
26155 "modes": ["wt2wt"],
26156 "changes": [
26157 ["figure[class]", "removeClass", "mw-halign-right"],
26158 ["figure[class]", "addClass", "mw-halign-left"]
26159 ]
26160 }
26161 !! wikitext
26162 [[Image:Foobar.jpg|thumb|caption|right]]
26163 !! wikitext/edited
26164 [[Image:Foobar.jpg|thumb|caption|left]]
26165 !! end
26166
26167 !! test
26168 Image: Modifying mw-default-size of an frameless image (T64805)
26169 !! options
26170 parsoid={
26171 "modes": ["wt2wt"],
26172 "changes": [
26173 ["figure.mw-default-size", "removeClass", "mw-default-size"]
26174 ]
26175 }
26176 !! wikitext
26177 [[Image:Foobar.jpg|frameless|right]]
26178 !! wikitext/edited
26179 [[Image:Foobar.jpg|frameless|right|220x220px]]
26180 !! end
26181
26182 !! test
26183 Image: Modifying valign of an image (T51221)
26184 !! options
26185 parsoid={
26186 "modes": ["wt2wt"],
26187 "changes": [
26188 ["*[typeof=\"mw:Image\"]", "removeClass", "mw-valign-middle"],
26189 ["*[typeof=\"mw:Image\"]", "addClass", "mw-valign-text-top"]
26190 ]
26191 }
26192 !! wikitext
26193 [[File:Foobar.jpg|20px|middle]]
26194 !! wikitext/edited
26195 [[File:Foobar.jpg|20px|text-top]]
26196 !! end
26197
26198 !! test
26199 Image: Modifying alt attribute of an image (T58400)
26200 !! options
26201 parsoid={
26202 "modes": ["wt2wt"],
26203 "changes": [
26204 ["img[alt]", "attr", "alt", "some alternate edited text"]
26205 ]
26206 }
26207 !! wikitext
26208 [[File:Foobar.jpg|thumb|some caption|alt=some alternate text]]
26209 !! wikitext/edited
26210 [[File:Foobar.jpg|thumb|some caption|alt=some alternate edited text]]
26211 !!end
26212
26213 !! test
26214 Image: Modifying caption of an image
26215 !! options
26216 parsoid={
26217 "modes": ["wt2wt"],
26218 "changes": [
26219 ["figcaption", "text", "new caption"]
26220 ]
26221 }
26222 !! wikitext
26223 [[Image:Foobar.jpg|thumb|original caption]]
26224 !! wikitext/edited
26225 [[Image:Foobar.jpg|thumb|new caption]]
26226 !!end
26227
26228 !! test
26229 Image: empty alt attribute (T50924)
26230 !! options
26231 parsoid
26232 !! wikitext
26233 [[File:Foobar.jpg|thumb|alt=|bar]]
26234 !! html
26235 <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>
26236 !! end
26237
26238 !! test
26239 Image: new attributes should be serialized in wiki's language for RTL languages (T53852)
26240 !! options
26241 parsoid=html2wt
26242 language=ar
26243 disabled
26244 !! html/parsoid
26245 <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>
26246 !! wikitext
26247 [[Imagen:Foobar.jpg|derecha|miniaturadeimagen]]
26248 !! end
26249
26250 !! test
26251 Image: Block level image should have \n before and after
26252 !! wikitext
26253 123
26254 [[File:Foobar.jpg|right|thumb|150x150px]]
26255 456
26256 !! html/parsoid
26257 <p>123</p>
26258 <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>
26259 <p>456</p>
26260 !!end
26261
26262 !! test
26263 Image: New block level image should have \n before and after (existing content)
26264 !! wikitext
26265 123
26266 [[File:Foobar.jpg|right|thumb|150x150px]]
26267 456
26268 !! html/parsoid
26269 <p>123</p>
26270 <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>
26271 <p>456</p>
26272 !!end
26273
26274 !! test
26275 Image: upright option (parsoid)
26276 !! wikitext
26277 [[File:Foobar.jpg|thumb|upright|caption]]
26278 [[File:Foobar.jpg|thumb|upright=0.5|caption]]
26279 [[File:Foobar.jpg|thumb|500x500px|upright=0.5|caption]]
26280 !! html/parsoid
26281 <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>
26282 <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>
26283 <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>
26284 !!end
26285
26286 !! test
26287 Image: upright option is ignored on inline and frame images (parsoid)
26288 !! wikitext
26289 [[File:Foobar.jpg|500x500px|upright=0.5|caption]]
26290 !! html/parsoid
26291 <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>
26292 !!end
26293
26294 !! test
26295 Image: from basic HTML (1)
26296 !! options
26297 parsoid=html2wt
26298 !! html/parsoid
26299 <span typeof="mw:Image">
26300 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
26301 </span>
26302 !! wikitext
26303 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
26304 !! end
26305
26306 !! test
26307 Image: from basic HTML (2)
26308 !! options
26309 parsoid=html2wt
26310 !! html/parsoid
26311 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
26312 !! wikitext
26313 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
26314 !! end
26315
26316 !! test
26317 Image: from basic HTML (3)
26318 !! options
26319 parsoid=html2wt
26320 !! html/parsoid
26321 <a href="Main"><img src="./File:Foobar.jpg" width=100 height=100 alt="Alt"></a>
26322 !! wikitext
26323 [[File:Foobar.jpg|link=Main|alt=Alt|100x100px]]
26324 !! end
26325
26326 !! test
26327 Image: from basic HTML (4)
26328 !! options
26329 parsoid=html2wt
26330 !! html/parsoid
26331 <img src="./File:Foobar.jpg">
26332 !! wikitext
26333 [[File:Foobar.jpg|link=]]
26334 !! end
26335
26336 !! test
26337 Image: Invalid title as link
26338 !! wikitext
26339 [[File:Foobar.jpg|link=<]]
26340 !! html/php
26341 <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>
26342 </p>
26343 !! html/parsoid
26344 <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>
26345 !! end
26346
26347 !! test
26348 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
26349 !! options
26350 parsoid=html2wt
26351 !! html/parsoid
26352 <ul>
26353 <li><p>foo</p></li>
26354 </ul>
26355 !! wikitext
26356 * foo
26357 !! end
26358
26359 !! test
26360 Lists: Serialize correctly even when list tags has unneeded whitespace between tags
26361 !! options
26362 parsoid=html2wt
26363 !! html/parsoid
26364 <ul> <li>foo</li></ul>
26365 !! wikitext
26366 * foo
26367 !! end
26368
26369 !! test
26370 Don't strip leading whitespace when handling indent-pre suppressing tags
26371 !! options
26372 parsoid=html2wt
26373 !! html/parsoid
26374 <table>
26375 <tr><td> indented row</td></tr>
26376 </table>
26377 <blockquote><p>
26378 <b>This is very bold of you!</b>
26379 </p>
26380 <table><tr><td>
26381 indented cell (no pre-wrapping!)
26382 </td></tr></table>
26383 </blockquote>
26384 <p>foo</p>
26385 <div>bar</div>
26386 !! wikitext
26387 {|
26388 | indented row
26389 |}
26390 <blockquote>
26391 '''This is very bold of you!'''
26392
26393 {|
26394 |
26395 indented cell (no pre-wrapping!)
26396 |}
26397 </blockquote>
26398 foo
26399 <div>bar</div>
26400 !! end
26401
26402 !! test
26403 Nowiki-wrap leading whitespace when handling indent-pre inducing tags
26404 !! options
26405 parsoid=html2wt
26406 !! html/parsoid
26407 <p>foo</p>
26408 <span>bar</span>
26409
26410 <span>foo2
26411 </span>bar2
26412
26413 <div>foo</div>
26414 <span>bar</span>
26415
26416 <div>
26417 <span>foo</span>
26418 </div>
26419 !! wikitext
26420 foo
26421
26422 <span>bar</span>
26423
26424 <span>foo2
26425 <nowiki> </nowiki></span>bar2
26426
26427 <div>foo</div>
26428 <nowiki> </nowiki><span>bar</span>
26429
26430 <div>
26431 <nowiki> </nowiki><span>foo</span>
26432 </div>
26433 !! end
26434
26435 !! test
26436 Lists: Dont insert newlines in a serialized list item.
26437 !! options
26438 parsoid=html2wt
26439 !! html/parsoid
26440 <ul><li>a<br>b</li><li>c</li></ul>
26441 !! wikitext
26442 * a<br>b
26443 * c
26444 !! end
26445
26446 !! test
26447 1. Headings: Force sol-transparent links and behavior switches to serialize before/after
26448 !! options
26449 parsoid={
26450 "modes": ["html2wt"],
26451 "scrubWikitext": false
26452 }
26453 !! html/parsoid
26454 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
26455 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
26456
26457 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
26458 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
26459
26460 <h2 data-parsoid='{}'>howdy<link href="./Category:A5" rel="mw:PageProp/Category" /></h2>
26461
26462 <h2><meta property="mw:PageProp/toc" /> ok</h2>
26463 !! wikitext
26464 == hello there [[Category:A1]] ==
26465
26466 == [[Category:A2]] hi pal ==
26467
26468 == <!--foo--> [[Category:A3]] how goes it ==
26469
26470 == it goes well [[Category:A4]] <!--bar--> ==
26471
26472 ==howdy [[Category:A5]]==
26473
26474 == __TOC__ ok ==
26475 !! end
26476
26477 !! test
26478 2. Headings: Force sol-transparent links and behavior switches to serialize before/after
26479 !! options
26480 parsoid={
26481 "modes": ["html2wt"],
26482 "scrubWikitext": true
26483 }
26484 !! html/parsoid
26485 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
26486 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
26487
26488 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
26489 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
26490
26491 <h2><meta property="mw:PageProp/toc" /> ok</h2>
26492 !! wikitext
26493 == hello there ==
26494 [[Category:A1]]
26495 [[Category:A2]]
26496
26497 == hi pal ==
26498
26499 <!--foo--> [[Category:A3]]
26500
26501 == how goes it ==
26502
26503 == it goes well ==
26504 [[Category:A4]] <!--bar-->
26505
26506 __TOC__
26507
26508 == ok ==
26509 !! end
26510
26511 !! test
26512 Headings: Don't hoist metas that come from templates
26513 !! options
26514 parsoid={
26515 "modes": ["html2wt"],
26516 "scrubWikitext": true
26517 }
26518 !! html/parsoid
26519 <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>
26520 !! wikitext
26521 == {{echo|foo [[Category:Foo]]}} ==
26522 !! end
26523
26524 !! test
26525 Headings: Category in ref isn't hoisted
26526 !! options
26527 parsoid={
26528 "modes": ["html2wt"],
26529 "scrubWikitext": true
26530 }
26531 !! html/parsoid
26532 <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>
26533
26534 <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>
26535 !! wikitext
26536 == foo <ref>bar
26537 [[Category:Baz]] </ref> ==
26538
26539 <references />
26540 !! end
26541
26542 !! test
26543 Parsoid: Serialize positional parameters with = in them as named parameter
26544 !! options
26545 parsoid=html2wt
26546 !! html/parsoid
26547 <p about="#mwt1" typeof="mw:Transclusion"
26548 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
26549
26550 <p about="#mwt1" typeof="mw:Transclusion"
26551 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}, "2":{"wt":"bar"}},"i":0}}]}'>foo</p>
26552
26553 <!--Orig params with data-parsoid has heuristics for handling = chars-->
26554 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
26555 <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>
26556 !! wikitext
26557 {{echo|1=f=oo}}
26558
26559 {{echo|1=f=oo|2=bar}}
26560
26561 <!--Orig params with data-parsoid has heuristics for handling = chars-->
26562 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
26563 {{echo|<nowiki>f=oo</nowiki>|bar}}
26564 !! end
26565
26566 !! test
26567 Parsoid: Serialize positional parameters with = in extlink as named parameter
26568 !! options
26569 parsoid=html2wt
26570 !! html/parsoid
26571 <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>
26572 !! wikitext
26573 {{echo|1=http://stuff?is=ok}}
26574 !! end
26575
26576 !! test
26577 Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
26578 !! options
26579 parsoid=html2wt
26580 !! html/parsoid
26581 <div>a<p>b</p></div>
26582 <div>a
26583 <p>b</p></div>
26584 <div>
26585 a
26586 <p>b</p></div>
26587 !! wikitext
26588 <div>a
26589 b
26590 </div>
26591 <div>a
26592 b
26593 </div>
26594 <div>
26595 a
26596
26597 b
26598 </div>
26599 !! end
26600
26601 !! test
26602 Substrings resembling wikitext in hrefs should not get nowiki escapes
26603 !! options
26604 parsoid=html2wt
26605 !! html/parsoid
26606 <a rel="mw:WikiLink" href="./Foo''bar''baz">Foo''bar''baz</a>
26607 !! wikitext
26608 [[Foo''bar''baz]]
26609 !! end
26610
26611 !! test
26612 Enforce single-line context in the serializer
26613 !! options
26614 parsoid=html2wt
26615 !! html/parsoid
26616 <h2>testing
26617 123</h2>
26618
26619 <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">
26620 </span><span about="#mwt1">you</span> </h2>
26621
26622 <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>
26623
26624 <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
26625 there</span></li></ol>
26626
26627 <ul><li>asd
26628 sdf</li></ul>
26629
26630 <ul><li>foo
26631 bar
26632 baz</li>
26633 <li>foo <b>bar</b>
26634 baz</li></ul>
26635
26636 <dl><dt>hi
26637 ho </dt><dd data-parsoid='{"stx":"row"}'> hi
26638 ho</dd></dl>
26639
26640 <dl><dd> <table>
26641 <tbody><tr><td> ha
26642 ha
26643 ha</td></tr>
26644 </tbody></table></dd></dl>
26645 !! wikitext
26646 == testing 123 ==
26647
26648 == hi {{bogus|there
26649 you}} ==
26650
26651 == foo <ref>hello
26652 there</ref> ==
26653
26654 <references />
26655
26656 * asd sdf
26657
26658 * foo bar baz
26659 * foo '''bar''' baz
26660
26661 ; hi ho : hi ho
26662
26663 : {|
26664 | ha
26665 ha
26666 ha
26667 |}
26668 !! end
26669
26670 !! test
26671 Serialize new placeholder space without spans
26672 !! options
26673 parsoid=html2wt
26674 !! html/parsoid
26675 <p>foo<span typeof="mw:Placeholder"> </span>: bar</p>
26676
26677 <p>foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span>: bar</p>
26678
26679 <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>
26680 !! wikitext
26681 foo : bar
26682
26683 foo : bar
26684
26685 <ref>foo : bar</ref>ok
26686 !! end
26687
26688
26689 #-----------------------
26690 # Tag minimization tests
26691 #-----------------------
26692
26693 !! test
26694 1. I/B quote minimization: wikitext-only tags should be combined
26695 !! options
26696 parsoid=html2wt
26697 !! html/parsoid
26698 <p><i>A</i><i>B</i></p>
26699 <p><b>A</b><b>B</b></p>
26700 <p><i>A</i><b><i>B</i></b></p>
26701 <p><b>A</b><i><b>B</b></i></p>
26702 <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
26703 <p><i><b>A</b></i><i><b>B</b></i></p>
26704 <p><i><b>A</b></i><b><i>B</i></b></p>
26705 <p><b><i>A</i></b><i><b>B</b></i></p>
26706 !! wikitext
26707 ''AB''
26708
26709 '''AB'''
26710
26711 ''A'''B'''''
26712
26713 '''A''B'''''
26714
26715 '''A''BC''D'''
26716
26717 '''''AB'''''
26718
26719 '''''AB'''''
26720
26721 '''''AB'''''
26722 !! end
26723
26724 !! test
26725 2. I/B quote minimization: wikitext and html tags should not be combined
26726 !! options
26727 parsoid=html2wt
26728 !! html/parsoid
26729 <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
26730 <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
26731 !! wikitext
26732 ''A''<i>B</i>
26733
26734 ''A''<nowiki/>'''<i>B</i>'''
26735 !! end
26736
26737 !! test
26738 3. I/B quote minimization: templated content stops minimization
26739 !! options
26740 parsoid=html2wt
26741 !! html/parsoid
26742 <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>
26743 <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>
26744 !! wikitext
26745 ''A''{{echo|''B''}}
26746
26747 ''A''{{echo|'''''B'''''}}
26748 !! end
26749
26750 !! test
26751 4. I/B quote minimization: new content should be mimimized with adjacent old content
26752 !! options
26753 parsoid=html2wt
26754 !! html/parsoid
26755 <p><i>A</i><i>B</i></p>
26756 <p><b>A</b><b>B</b></p>
26757 <p><i>A</i><b><i>B</i></b></p>
26758 !! wikitext
26759 ''AB''
26760
26761 '''AB'''
26762
26763 ''A'''B'''''
26764 !! end
26765
26766 !! test
26767 5a. Merge adjacent quote nodes if they've been edited
26768 !! options
26769 parsoid={
26770 "modes": ["wt2wt", "selser"],
26771 "changes": [
26772 ["p", "contents", "remove", ":contains('b')"]
26773 ]
26774 }
26775 !! wikitext
26776 ''a''b''c''
26777 !! wikitext/edited
26778 ''ac''
26779 !! end
26780
26781 !! test
26782 5b. Merge adjacent quote nodes if they've been edited
26783 !! options
26784 parsoid={
26785 "modes": ["wt2wt", "selser"],
26786 "changes": [
26787 ["#x", "remove"]
26788 ]
26789 }
26790 !! wikitext
26791 ''a''<span id="x">b</span>''c''
26792 !! wikitext/edited
26793 ''ac''
26794 !! end
26795
26796 !! test
26797 1. Merge adjacent link nodes as long as at least one element is new
26798 !! options
26799 parsoid={
26800 "modes": ["html2wt"],
26801 "scrubWikitext": true
26802 }
26803 !! html/parsoid
26804 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
26805 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
26806 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a data-parsoid="{}" rel="mw:WikiLink" href="./Football">ball</a>
26807 !! wikitext
26808 [[Football]]
26809 [[Football]]
26810 [[Football|Foot]][[Football|ball]]
26811 !! end
26812
26813 !! test
26814 2. Merge adjacent link nodes and enable additional normalizations
26815 !! options
26816 parsoid={
26817 "modes": ["html2wt"],
26818 "scrubWikitext": true
26819 }
26820 !! html/parsoid
26821 <a rel="mw:WikiLink" href="./Football"><i>Foot</i></a><a rel="mw:WikiLink" href="./Football"><i>ball</i></a>
26822 !! wikitext
26823 [[Football|''Football'']]
26824 !! end
26825
26826 !! test
26827 3. Don't merge adjacent link nodes if scrubWikitext is false
26828 !! options
26829 parsoid={
26830 "modes": ["html2wt"],
26831 "scrubWikitext": false
26832 }
26833 !! html/parsoid
26834 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
26835 !! wikitext
26836 [[Football|Foot]][[Football|ball]]
26837 !! end
26838
26839 #------------------------------
26840 # End of tag minimization tests
26841 #------------------------------
26842
26843 !!test
26844 T56262: New entities
26845 !! options
26846 parsoid=html2wt
26847 !! html/parsoid
26848 <span typeof="mw:Entity">&nbsp;</span>
26849 !! wikitext
26850 &nbsp;
26851 !! end
26852
26853 ## Note that there is no wikitext output for 'unknownproperty' ##
26854 ## Unknown magic words are silently dropped ##
26855
26856 !! test
26857 Magic words
26858 !! options
26859 parsoid=html2wt
26860 !! html/parsoid
26861 <meta property='mw:PageProp/toc' />
26862 <meta property='mw:PageProp/notoc' />
26863 <meta property='mw:PageProp/forcetoc' />
26864 <meta property='mw:PageProp/index' />
26865 <meta property='mw:PageProp/noindex' />
26866 <meta property='mw:PageProp/nogallery' />
26867 <meta property='mw:PageProp/noeditsection' />
26868 <meta property='mw:PageProp/notitleconvert' />
26869 <meta property='mw:PageProp/nocontentconvert' />
26870 <meta property='mw:PageProp/unknownproperty' />
26871 !! wikitext
26872 __TOC__
26873 __NOTOC__
26874 __FORCETOC__
26875 __INDEX__
26876 __NOINDEX__
26877 __NOGALLERY__
26878 __NOEDITSECTION__
26879 __NOTITLECONVERT__
26880 __NOCONTENTCONVERT__
26881 !! end
26882
26883 !! test
26884 Consecutive <pre>s should not get merged
26885 !! options
26886 parsoid=html2wt,html2html
26887 !! html/parsoid
26888 <pre>a</pre><pre>b</pre>
26889
26890 <pre>c
26891 </pre><pre>
26892 d</pre>
26893
26894 <pre>e
26895
26896 </pre><pre>
26897
26898 f</pre>
26899 !! wikitext
26900 a
26901
26902 b
26903
26904 c
26905
26906 d
26907
26908 e
26909
26910
26911
26912 f
26913 !! end
26914
26915 !! test
26916 Edited ISBN links not serializable as ISBN links should serialize as wikilinks
26917 !! options
26918 parsoid=html2wt
26919 !! html/parsoid
26920 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink">ISBN 1234567895</a>
26921 !! wikitext
26922 [[Special:BookSources/1234567890|ISBN 1234567895]]
26923 !! end
26924
26925 !! test
26926 Edited RFC links not serializable as RFC links should serialize as extlinks
26927 !! options
26928 parsoid=html2wt
26929 !! html/parsoid
26930 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink">New RFC</a>
26931 !! wikitext
26932 [//tools.ietf.org/html/rfc123 New RFC]
26933 !! end
26934
26935 !! test
26936 Edited PMID links not serializable as PMID links should serialize as extlinks
26937 !! options
26938 parsoid=html2wt
26939 !! html/parsoid
26940 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink">New PMID</a>
26941 !! wikitext
26942 [//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract New PMID]
26943 !! end
26944
26945 !! test
26946 WTS of autolinks with trailing/surrounding context
26947 !! options
26948 parsoid=html2wt
26949 !! html/parsoid
26950 <p><a href="http://cscott.net">http://cscott.net</a><b>foo</b></p>
26951 <p><a href="http://cscott.net">http://cscott.net</a><b data-parsoid='{"stx":"html"}'>foo</b></p>
26952 <p><b><a href="http://cscott.net">http://cscott.net</a></b></p>
26953 <p><b><a href="http://cscott.net">http://cscott.net</a> </b></p>
26954 <p><b><a href="http://cscott.net">http://cscott.net</a>x</b></p>
26955 <p><a href="http://cscott.net">http://cscott.net</a>x</p>
26956 !! wikitext
26957 http://cscott.net'''foo'''
26958
26959 http://cscott.net<b>foo</b>
26960
26961 '''http://cscott.net'''
26962
26963 '''http://cscott.net '''
26964
26965 '''http://cscott.net<nowiki/>x'''
26966
26967 http://cscott.net<nowiki/>x
26968 !! end
26969
26970 !! test
26971 WTS of autolinks with nowikis (round-trip)
26972 !! wikitext
26973 x<nowiki/>http://cscott.net<nowiki/>x
26974 !! html/parsoid
26975 <p>x<a rel="mw:ExtLink" href="http://cscott.net">http://cscott.net</a>x</p>
26976 !! end
26977
26978 # this is the "easy" test because it leaves in place all the
26979 # data-parsoid information indicating this is an autolink
26980 !! test
26981 WTS of autolinks with escapes (editing)
26982 !! options
26983 parsoid={
26984 "modes": ["wt2wt"],
26985 "changes": [
26986 [ "span", "remove" ]
26987 ]
26988 }
26989 !! wikitext
26990 x<nowiki/>http://cscott.net<nowiki/>x
26991 !! wikitext/edited
26992 x<nowiki/>http://cscott.net<nowiki/>x
26993 !! end
26994
26995 !! test
26996 WTS of edited autolink-like text (T103364)
26997 !! options
26998 parsoid={
26999 "modes": ["wt2wt"],
27000 "changes": [
27001 [ "span[typeof]", "removeAttr", "typeof" ]
27002 ]
27003 }
27004 !! wikitext
27005 Not a link: <nowiki>http://example.com</nowiki>.
27006 !! wikitext/edited
27007 Not a link: <span><nowiki>http://example.com</nowiki></span>.
27008 !! end
27009
27010 !! test
27011 WTS of newly-authored autolink-like text (T103364)
27012 !! options
27013 parsoid=html2wt
27014 !! html/parsoid
27015 <p>http://example.com is not a link.</p>
27016 !! wikitext
27017 <nowiki>http://example.com</nowiki> is not a link.
27018 !! end
27019
27020 !! test
27021 WTS of autolink-like text after an autolink (T108563)
27022 !! options
27023 parsoid=html2wt
27024 !! html/parsoid
27025 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a> http://example.com is not a link.</p>
27026 !! wikitext
27027 http://example.com <nowiki>http://example.com</nowiki> is not a link.
27028 !! end
27029
27030 !! test
27031 Magic links inside links (not autolinked)
27032 !! wikitext
27033 [[Foo|http://example.com]]
27034 [[Foo|RFC 1234]]
27035 [[Foo|PMID 1234]]
27036 [[Foo|ISBN 123456789x]]
27037
27038 [http://foo.com http://example.com]
27039 [http://foo.com RFC 1234]
27040 [http://foo.com PMID 1234]
27041 [http://foo.com ISBN 123456789x]
27042 !! html+tidy
27043 <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>
27044 <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>
27045 !! html/parsoid
27046 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">http://example.com</a>
27047 <a rel="mw:WikiLink" href="./Foo" title="Foo">RFC 1234</a>
27048 <a rel="mw:WikiLink" href="./Foo" title="Foo">PMID 1234</a>
27049 <a rel="mw:WikiLink" href="./Foo" title="Foo">ISBN 123456789x</a></p>
27050
27051 <p><a rel="mw:ExtLink" href="http://foo.com">http://example.com</a>
27052 <a rel="mw:ExtLink" href="http://foo.com">RFC 1234</a>
27053 <a rel="mw:ExtLink" href="http://foo.com">PMID 1234</a>
27054 <a rel="mw:ExtLink" href="http://foo.com">ISBN 123456789x</a></p>
27055 !! end
27056
27057 !! test
27058 Magic links inside image captions (autolinked)
27059 !! wikitext
27060 [[File:Foobar.jpg|thumb|http://example.com]]
27061 [[File:Foobar.jpg|thumb|RFC 1234]]
27062 [[File:Foobar.jpg|thumb|PMID 1234]]
27063 [[File:Foobar.jpg|thumb|ISBN 123456789x]]
27064 !! html+tidy
27065 <div class="thumb tright">
27066 <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>
27067 <div class="thumbcaption">
27068 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
27069 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></div>
27070 </div>
27071 </div>
27072 <div class="thumb tright">
27073 <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>
27074 <div class="thumbcaption">
27075 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
27076 <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a></div>
27077 </div>
27078 </div>
27079 <div class="thumb tright">
27080 <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>
27081 <div class="thumbcaption">
27082 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
27083 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a></div>
27084 </div>
27085 </div>
27086 <div class="thumb tright">
27087 <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>
27088 <div class="thumbcaption">
27089 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
27090 <a href="/wiki/Special:BookSources/123456789X" class="internal mw-magiclink-isbn">ISBN 123456789x</a></div>
27091 </div>
27092 </div>
27093 !! html/parsoid
27094 <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>
27095 <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>
27096 <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>
27097 <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>
27098 !! end
27099
27100 !! test
27101 WTS of magic word text (T109371)
27102 !! options
27103 parsoid=html2wt
27104 !! html/parsoid
27105 <p>RFC 1234</p>
27106 <p><a href="http://foo.com" rel="mw:ExtLink">RFC 1234</a></p>
27107 <p><a href="./Foo" rel="mw:WikiLink">RFC 1234</a></p>
27108 !! wikitext
27109 <nowiki>RFC 1234</nowiki>
27110
27111 [http://foo.com RFC 1234]
27112
27113 [[Foo|RFC 1234]]
27114 !! end
27115
27116 !! test
27117 Edited Redirect link should emit a non-piped wikitext link
27118 !! options
27119 parsoid=html2wt
27120 !! html/parsoid
27121 <link rel="mw:PageProp/redirect" href="Bar" data-parsoid='{"a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>
27122 !! wikitext
27123 #REDIRECT [[Bar]]
27124 !! end
27125
27126 !! test
27127 T75121: Infer extension name from typeOf if data-mw is not present
27128 !! options
27129 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
27130 !! html/parsoid
27131 <div typeOf="mw:Extension/foo"></div>
27132 !! wikitext
27133 <foo />
27134 !! end
27135
27136 # Note that the <p> wrapping isn't present in PHP parser output
27137 # The important thing for this test is that P-wrapping doesn't
27138 # interfere with the <nowiki> protection for leading - in <td>
27139 # (which isn't necessary for <th>).
27140 !! test
27141 T88318: p-wrapped dash in table.
27142 !! options
27143 parsoid=html2wt,wt2wt
27144 !! html/parsoid
27145 <table><tbody>
27146 <tr><th><p>-</p></th><th><p>- </p></th></tr>
27147 <tr><td><p>-</p></td><td><p>- </p></td></tr>
27148 <tr><td><small>-</small></td><td><br/><p>-</p></td><td><br/>-</td></tr>
27149 </tbody></table>
27150 !! wikitext
27151 {|
27152 !-
27153 !-
27154 |-
27155 |<nowiki>-</nowiki>
27156 |<nowiki>- </nowiki>
27157 |-
27158 |<small>-</small>
27159 |<br>
27160 -
27161 |<br>
27162 -
27163 |}
27164 !! html/php+tidy
27165 <table>
27166 <tr>
27167 <th>-</th>
27168 <th>-</th>
27169 </tr>
27170 <tr>
27171 <td>-</td>
27172 <td>-</td>
27173 </tr>
27174 <tr>
27175 <td><small>-</small></td>
27176 <td><br />
27177 <p>-</p>
27178 </td>
27179 <td><br />
27180 <p>-</p>
27181 </td>
27182 </tr>
27183 </table>
27184 !! end
27185
27186 !! test
27187 T149209: WTS: Handle newlines in table cells properly
27188 !! options
27189 parsoid=html2wt
27190 !! html/parsoid
27191 <table>
27192 <tbody>
27193 <tr><td>a
27194 b
27195 </td><td data-parsoid='{"stx_v":"row"}'>c</td></tr>
27196 <tr><td><p>x</p>
27197 </td><td data-parsoid='{"stx_v":"row", "startTagSrc": "{{!}}{{!}}"}'>y</td></tr>
27198 </tbody></table>
27199 <table>
27200 <tbody>
27201 <tr><th>a
27202 b
27203 </th><th data-parsoid='{"stx_v":"row"}'>c</th></tr>
27204 <tr><th><p>x</h>
27205 </th><th data-parsoid='{"stx_v":"row"}'>y</th></tr>
27206 </tbody></table>
27207 !! wikitext
27208 {|
27209 |a
27210 b
27211 |c
27212 |-
27213 |x
27214 {{!}}y
27215 |}
27216 {|
27217 !a
27218 b
27219 !c
27220 |-
27221 !x
27222 !y
27223 |}
27224 !! end
27225
27226 !! test
27227 T149209: Selser: Handle newlines in table cells properly
27228 !! options
27229 parsoid={
27230 "modes": ["selser"],
27231 "changes": [
27232 [ "#h1", "html", "a\nb\n" ],
27233 [ "#h2", "html", "a\nb\n" ],
27234 [ "#c1", "html", "a\nb\n" ],
27235 [ "#c2", "html", "<p>a</p>" ],
27236 [ "#c3", "html", "<p>a</p>" ],
27237 [ "#c4", "html", "edit-me<p>a</p>" ]
27238 ]
27239 }
27240 !! wikitext
27241 {|
27242 ! id="h1" |edit-me!!1
27243 |-
27244 ! id="h2" |edit-me||2
27245 |-
27246 | id="c1" |edit-me||3
27247 |-
27248 | id="c2" |edit-me||4
27249 |-
27250 | id="c3" |edit-me||p||q||r
27251 |-
27252 | id="c4" |edit-me||p||q||r
27253 |}
27254 !! wikitext/edited
27255 {|
27256 ! id="h1" |a
27257 b
27258 !1
27259 |-
27260 ! id="h2" |a
27261 b
27262 !2
27263 |-
27264 | id="c1" |a
27265 b
27266 |3
27267 |-
27268 | id="c2" |a
27269 |4
27270 |-
27271 | id="c3" |a
27272 |p||q||r
27273 |-
27274 | id="c4" |edit-me
27275 a
27276 |p||q||r
27277 |}
27278 !! end
27279
27280 !! test
27281 HTML id attribute with Parsoid-like element ids should not be serialized to wikitext
27282 !! options
27283 parsoid=html2wt
27284 !! html/parsoid
27285 <table id='mwAb'>
27286 <td id='mwAc'>foo</td>
27287 <td id='serialize-this'>bar</td>
27288 </table>
27289 !! wikitext
27290 {|
27291 |foo
27292 | id="serialize-this" |bar
27293 |}
27294 !! end
27295
27296 !! test
27297 Parsoid-like element ids should not be serialized to wikitext unless shadowed
27298 !! options
27299 parsoid=html2wt
27300 !! html/parsoid
27301 <div id="mwAQ" data-parsoid='{"stx":"html","a":{"id":"mwAQ"},"sa":{"id":"hello"}}'>ok</div>
27302 !! wikitext
27303 <div id="hello">ok</div>
27304 !! end
27305
27306 !! test
27307 WTS change modes
27308 !! options
27309 parsoid={
27310 "modes": ["wt2wt"],
27311 "changes": [
27312 [ "#xyz", "before", "<b>before</b> stuff " ],
27313 [ "#xyz", "after", " stuff <i>after</i>" ],
27314 [ "#xyz", "html", "x <b>y</b> z" ]
27315 ]
27316 }
27317 !! wikitext
27318 <span id="xyz">hello</span>
27319 !! wikitext/edited
27320 '''before''' stuff <span id="xyz">x '''y''' z</span> stuff ''after''
27321 !! end
27322
27323 !! test
27324 Never serialize a-tag as html, regardless of what data-parsoid has to say
27325 !! options
27326 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
27327 !! html/parsoid
27328 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"html"}'>Foo</a>
27329 !! wikitext
27330 [[Foo]]
27331 !! end
27332
27333 ## SSS FIXME: This is broken output nevertheless.
27334 ## What might be a reasonable non-broken output for this?
27335 ## This is an edge case unlikely to be seen in production
27336 ## that I am not wasting more time on this right now.
27337 !! test
27338 Never serialize a-tag as html, no matter what attributes it has
27339 !! options
27340 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
27341 !! html/parsoid
27342 <a bad='true' href='http://boo.org'><img src='http://boohoo.org' /></a>
27343 !! wikitext
27344 [http://boo.org http://boohoo.org]
27345 !! end
27346
27347 # Misnested is an indication that selser can reuse the source but these have
27348 # shown to sneak through on occasion. See T101768.
27349 # The original wikitext here is: [http://test.com [[one]] two three]
27350 !! test
27351 Strip span tags added to mark misnested links
27352 !! options
27353 parsoid=html2wt
27354 !! html/parsoid
27355 <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>
27356 !! wikitext
27357 [http://test.com][[one]] two three
27358 !! end
27359
27360 !! test
27361 Catch regression when unpacking misnested links
27362 !! options
27363 parsoid=wt2html
27364 !! wikitext
27365 {{echo|hi}}[http://example.com [[ho]]]
27366 !! html/parsoid
27367 <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>
27368 !! end
27369
27370 !! test
27371 Use data-parsoid.firstWikitextNode to compute newline constraints for template content
27372 !! options
27373 parsoid=html2wt
27374 !! html/parsoid
27375 <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|}"]}'>
27376 <tbody><tr><td>d
27377 </td></tr>
27378 </tbody></table>
27379 !! wikitext
27380 {{echo|a}}
27381 {|{{echo|c
27382 {{!}}d
27383 }}
27384 |}
27385 !! end
27386
27387 ## This test verifies the presence and computation of this attribute indirectly
27388 ## by making an edit and ensuring that the serialization is correct (which it would be
27389 ## only if firstWikitextNode is properly set).
27390 !! test
27391 data-parsoid.firstWikitextNode should be computed properly in the presence of fostered content
27392 !! options
27393 parsoid= {
27394 "modes": ["wt2wt"],
27395 "changes": [
27396 [ "div#x", "remove" ],
27397 [ "div", "before", "<div>new</div>" ]
27398 ]
27399 }
27400 !! wikitext
27401 <div id="x">foo</div>
27402 {|
27403 {{echo|<div>boo</div>
27404 {{!}}b}}
27405 |c
27406 |}
27407 !! wikitext/edited
27408
27409 <div>new</div>
27410 {|
27411 {{echo|<div>boo</div>
27412 {{!}}b}}
27413 |c
27414 |}
27415 !! end
27416
27417 # --------------------------------------------
27418 # Tests spec'ing wikitext serialization norms |
27419 # --------------------------------------------
27420
27421 !! test
27422 Serialize multi-line indent-pre starting with wikitext syntax
27423 !! options
27424 parsoid=html2wt
27425 !! html/parsoid
27426 <pre>* 1
27427 ** 2
27428 * 3</pre>
27429 !! wikitext
27430 * 1
27431 ** 2
27432 * 3
27433 !! end
27434
27435 !! test
27436 1. Categories should always be serialized on their own line
27437 !! options
27438 parsoid=html2wt
27439 !! html/parsoid
27440 foo<link rel="mw:PageProp/Category" href="./Category:Foo">bar
27441 !! wikitext
27442 foo
27443 [[Category:Foo]]
27444 bar
27445 !! end
27446
27447 !! test
27448 2. Categories that are part of templates should not introduce a line break
27449 !! wikitext
27450 foo {{echo|<span>bar</span> [[Category:baz]]}} bar
27451 !! html/parsoid
27452 <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>
27453 !! end
27454
27455 # Careful while editing these next 2 tests. There are \u200f characters
27456 # before and after the <link> tags in the HTML and following some
27457 # of the categories in wikitext
27458 # Do not remove these characters in edits.
27459 #
27460 # As part of the serialization, these bidi characters will get stripped.
27461 !! test
27462 RTL (\u200f) and LTR (\u200e) markers around category tags should be stripped
27463 !! options
27464 parsoid={
27465 "modes": ["html2wt"],
27466 "scrubWikitext": true
27467 }
27468 !! html/parsoid
27469 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏
27470 ‏<link rel="mw:PageProp/Category" href="./קטגוריה:_שיטות_משפט" />‏</p>
27471 !! wikitext
27472 [[קטגוריה:טקסים]]
27473 [[קטגוריה: שיטות משפט]]
27474 !! end
27475
27476 !! test
27477 RTL (\u200f) and LTR (\u200e) markers should not be stripped if followed by a text node
27478 !! options
27479 parsoid={
27480 "modes": ["html2wt"],
27481 "scrubWikitext": true
27482 }
27483 !! html/parsoid
27484 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏y</p>
27485 !! wikitext
27486 [[קטגוריה:טקסים]]
27487 ‏y
27488 !! end
27489
27490 !! test
27491 Lists: Add space after bullets
27492 !! options
27493 parsoid=html2wt
27494 !! html/parsoid
27495 <ul>
27496 <li>foo</li>
27497 <li> bar</li>
27498 <li><span> baz</span></li>
27499 </ul>
27500 !! wikitext
27501 * foo
27502 * bar
27503 * <span> baz</span>
27504 !! end
27505
27506 !! test
27507 1. Headings: Add space before/after == (T53744)
27508 !! options
27509 parsoid=html2wt
27510 !! html/parsoid
27511 <h2>foo</h2>
27512 <h2> bar</h2>
27513 <h2>baz </h2>
27514 <h2><span> baz</span></h2>
27515 !! wikitext
27516 == foo ==
27517
27518 == bar ==
27519
27520 == baz ==
27521
27522 == <span> baz</span> ==
27523 !! end
27524
27525 !! test
27526 2. Headings: Add space before/after == even after hoisted content
27527 !! options
27528 parsoid={
27529 "modes": ["html2wt"],
27530 "scrubWikitext": true
27531 }
27532 !! html/parsoid
27533 <h2> <link href="./Category:A2" rel="mw:PageProp/Category" />ok</h2>
27534 !! wikitext
27535 [[Category:A2]]
27536
27537 == ok ==
27538 !! end
27539
27540 !! test
27541 1. Headings: suppress newly created empty headings
27542 !! options
27543 parsoid={
27544 "modes": ["html2wt"],
27545 "scrubWikitext": true
27546 }
27547 !! html/parsoid
27548 <h2></h2>
27549 !! wikitext
27550 !! end
27551
27552 !! test
27553 2. Headings: don't suppress empty headings if scrubWikitext is false
27554 !! options
27555 parsoid=html2wt
27556 !! html/parsoid
27557 <h2></h2>
27558 !! wikitext
27559 ==<nowiki/>==
27560 !! end
27561
27562 !! test
27563 3. Headings: suppress empty headings on edits
27564 !! options
27565 parsoid={
27566 "modes": ["selser"],
27567 "scrubWikitext": true,
27568 "changes": [
27569 [ "#x", "remove"]
27570 ]
27571 }
27572 !! wikitext
27573 ==<span id="x">foo</span>==
27574 !! wikitext/edited
27575 !! end
27576
27577 !! test
27578 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = true)
27579 !! options
27580 parsoid={
27581 "modes": ["html2wt"],
27582 "scrubWikitext": true
27583 }
27584 !! html/parsoid
27585 <h2>foo<br/>bar</h2>
27586 <h2>foo <span><br/>bar</span> baz</h2>
27587 !! wikitext
27588 == foo bar ==
27589
27590 == foo <span> bar</span> baz ==
27591 !! end
27592
27593 !! test
27594 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = false)
27595 !! options
27596 parsoid={
27597 "modes": ["html2wt"],
27598 "scrubWikitext": false
27599 }
27600 !! html/parsoid
27601 <h2>foo<br/>bar</h2>
27602 !! wikitext
27603 == foo<br> bar ==
27604 !! end
27605
27606 !! test
27607 1. WT Quote Tags: suppress newly created empty style tags
27608 !! options
27609 parsoid={
27610 "modes": ["html2wt"],
27611 "scrubWikitext": true
27612 }
27613 !! html/parsoid
27614 <i></i><b></b>
27615 !! wikitext
27616 !! end
27617
27618 !! test
27619 2. WT Quote Tags: don't suppress empty style tags if scrubWikitext is false
27620 !! options
27621 parsoid=html2wt
27622 !! html/parsoid
27623 <i></i><b></b>
27624 !! wikitext
27625 ''<nowiki/>'''''<nowiki/>'''
27626 !! end
27627
27628 !! test
27629 3. WT Quote Tags: suppress empty style tags on edits
27630 !! options
27631 parsoid={
27632 "modes": ["selser"],
27633 "scrubWikitext": true,
27634 "changes": [
27635 [ "#x", "remove"]
27636 ]
27637 }
27638 !! wikitext
27639 '''<span id="x">foo</span>'''
27640 !! wikitext/edited
27641 !! end
27642
27643 !! test
27644 1. Anchors: suppress newly created empty anchors
27645 !! options
27646 parsoid={
27647 "modes": ["html2wt"],
27648 "scrubWikitext": true
27649 }
27650 !! html/parsoid
27651 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
27652 !! wikitext
27653 !! end
27654
27655 !! test
27656 2. Anchors: don't suppress empty anchors if scrubWikitext is false
27657 !! options
27658 parsoid={
27659 "modes": ["html2wt"],
27660 "scrubWikitext": false
27661 }
27662 !! html/parsoid
27663 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
27664 !! wikitext
27665 [[Test|<nowiki/>]]
27666 !! end
27667
27668 !! test
27669 3. Anchors: suppress empty anchors on edits
27670 !! options
27671 parsoid={
27672 "modes": ["selser"],
27673 "scrubWikitext": true,
27674 "changes": [
27675 [ "#x", "remove"]
27676 ]
27677 }
27678 !! wikitext
27679 [[Test|<span id="x">foo</span>]]
27680 !! wikitext/edited
27681 !! end
27682
27683 !! test
27684 3a. Anchors: do not suppress numbered extlinks
27685 !! options
27686 parsoid={
27687 "modes": ["wt2wt"],
27688 "scrubWikitext": true
27689 }
27690 !! wikitext
27691 [http://foo.com]
27692 !! html/parsoid
27693 <a rel="mw:ExtLink" href="http://foo.com"></a>
27694 !! end
27695
27696 !! test
27697 3b. Anchors: do not suppress numbered extlinks
27698 !! options
27699 parsoid={
27700 "modes": ["wt2wt"],
27701 "scrubWikitext": true,
27702 "changes": [
27703 [ "#x", "remove"]
27704 ]
27705 }
27706 !! wikitext
27707 [http://foo.com <span id="x">foo</span>]
27708 !! wikitext/edited
27709 [http://foo.com]
27710 !! end
27711
27712 !!test
27713 Normalizations should be restricted to edited content
27714 !!options
27715 parsoid={
27716 "modes": ["selser"],
27717 "scrubWikitext": true,
27718 "changes": [
27719 [ "h1", "before", "<i></i>"]
27720 ]
27721 }
27722 !!wikitext
27723 a
27724 = =
27725 b
27726 !!wikitext/edited
27727 a
27728 = =
27729 b
27730 !!end
27731
27732 !! test
27733 1. Multiple normalizations (html2wt)
27734 !! options
27735 parsoid={
27736 "modes": ["html2wt"],
27737 "scrubWikitext": true
27738 }
27739 !! html
27740 <h2><i></i></h2>
27741 <p><a href='Foo' rel='mw:WikiLink'>foo<i></i>
27742 </a><b><i></i></b>x</p>
27743 !! wikitext
27744
27745 [[foo]]
27746 x
27747
27748 !! end
27749
27750 !! test
27751 2. Multiple normalizations (selser)
27752 !! options
27753 parsoid={
27754 "modes": ["selser"],
27755 "scrubWikitext": true,
27756 "changes": [
27757 [ "#x", "after", "<h1><i></i></h1>\n<p> x<b></b></p>"]
27758 ]
27759 }
27760 !! wikitext
27761 <span id="x">foo</span>
27762 !! wikitext/edited
27763 <span id="x">foo</span>
27764
27765 x
27766 !! end
27767
27768 !! test
27769 1. Indent Pre Nowiki: suppress whitespace at the start of new paragraph
27770 !! options
27771 parsoid={
27772 "modes": ["html2wt"],
27773 "scrubWikitext": true
27774 }
27775 !! html/parsoid
27776 <p> hi</p>
27777 <p> hello</p>
27778 !! wikitext
27779 hi
27780
27781 hello
27782 !! end
27783
27784 !! test
27785 2. Indent Pre Nowiki: don't suppress whitespace at the start of new paragraph if scrubWikitext is false
27786 !! options
27787 parsoid=html2wt
27788 !! html/parsoid
27789 <p> hi</p>
27790 <p> hello</p>
27791 !! wikitext
27792 <nowiki> </nowiki>hi
27793
27794 <nowiki> </nowiki> hello
27795 !! end
27796
27797 !! test
27798 3. Indent Pre Nowiki: suppress whitespace after newlines in new paragraph or table cell
27799 !! options
27800 parsoid={
27801 "modes": ["html2wt"],
27802 "scrubWikitext": true
27803 }
27804 !! html/parsoid
27805 <p>Foo
27806 bar
27807 baz</p>
27808
27809 <table><tr><td>Foo
27810 bar
27811 baz bang</td></tr></table>
27812
27813 <p><!--boo--> foo
27814 bar</p>
27815
27816 <p> foo
27817 bar<span>boo</span></p>
27818 !! wikitext
27819 Foo
27820 bar
27821 baz
27822
27823 {|
27824 |Foo
27825 bar
27826 baz bang
27827 |}
27828
27829 <!--boo-->foo
27830 bar
27831
27832 foo
27833 bar<span>boo</span>
27834 !! end
27835
27836 !! test
27837 4. Indent Pre Nowiki: suppress leading whitespace in edited paragraphs
27838 !! options
27839 parsoid={
27840 "modes": ["selser"],
27841 "scrubWikitext": true,
27842 "changes": [
27843 [ "p", "html", " a\n b" ]
27844 ]
27845 }
27846 !! wikitext
27847 xyz
27848 !! wikitext/edited
27849 a
27850 b
27851 !! end
27852
27853 !! test
27854 1. New links that end in spaces
27855 !! options
27856 parsoid={
27857 "modes": ["html2wt"],
27858 "scrubWikitext": false
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 ]]<nowiki/>is the capital of Germany.
27866
27867 [[Foo ]]'''bar'''
27868
27869 [[Boston ]] is a city.
27870 !! end
27871
27872 !! test
27873 2. New links that end in spaces
27874 !! options
27875 parsoid={
27876 "modes": ["html2wt"],
27877 "scrubWikitext": true
27878 }
27879 !! html/parsoid
27880 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
27881 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
27882 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
27883 !! wikitext
27884 [[Berlin]] is the capital of Germany.
27885
27886 [[Foo]] '''bar'''
27887
27888 [[Boston]] is a city.
27889 !! end
27890
27891 !! test
27892 1. Table cells with escapable prefixes
27893 !! options
27894 parsoid={
27895 "modes": ["html2wt"],
27896 "scrubWikitext": false
27897 }
27898 !! html
27899 <table>
27900 <tr><td>a</td></tr>
27901 <tr><td>-</td></tr>
27902 <tr><td>+</td></tr>
27903 </table>
27904 !! wikitext
27905 {|
27906 |a
27907 |-
27908 |<nowiki>-</nowiki>
27909 |-
27910 |<nowiki>+</nowiki>
27911 |}
27912 !! end
27913
27914 !! test
27915 2. Table cells with escapable prefixes
27916 !! options
27917 parsoid={
27918 "modes": ["html2wt"],
27919 "scrubWikitext": true
27920 }
27921 !! html
27922 <table>
27923 <tr><td>a</td></tr>
27924 <tr><td>-</td></tr>
27925 <tr><td>+</td></tr>
27926 </table>
27927 !! wikitext
27928 {|
27929 |a
27930 |-
27931 | -
27932 |-
27933 | +
27934 |}
27935 !! end
27936
27937 !! test
27938 3a. Table cells with escapable prefixes after edits
27939 !! options
27940 parsoid={
27941 "modes": ["selser"],
27942 "scrubWikitext": true,
27943 "changes": [
27944 [ "table tbody tr:first-child td:first-child", "remove"]
27945 ]
27946 }
27947 !! wikitext
27948 {|
27949 |a||-
27950 |}
27951 !! wikitext/edited
27952 {|
27953 | -
27954 |}
27955 !! end
27956
27957 !! test
27958 3b. Table cells with escapable prefixes after edits
27959 !! options
27960 parsoid={
27961 "modes": ["selser"],
27962 "scrubWikitext": true,
27963 "changes": [
27964 [ "table tbody tr:first-child td:first-child", "html", "-" ],
27965 [ "#x", "remove" ]
27966 ]
27967 }
27968 !! wikitext
27969 {|
27970 |pqr
27971 |<span id="x">foo</span>+
27972 |}
27973 !! wikitext/edited
27974 {|
27975 | -
27976 | +
27977 |}
27978 !! end
27979
27980 # FIXME: This test will fail because
27981 # normalization doesn't realize that the id attribute
27982 # will eliminate the escapable scenario
27983 !! test
27984 4a. Table cells without escapable prefixes after edits
27985 !! options
27986 parsoid={
27987 "modes": ["selser"],
27988 "scrubWikitext": true,
27989 "changes": [
27990 [ "#x", "html", "-" ]
27991 ]
27992 }
27993 !! wikitext
27994 {|
27995 | id="x" |abcd
27996 |}
27997 !! wikitext/edited
27998 {|
27999 | id="x" |-
28000 |}
28001 !! end
28002
28003 ## This tests normalizer's ability to discriminate between
28004 ## cells having identical content.
28005 !! test
28006 4b. Table cells without escapable prefixes after edits
28007 !! options
28008 parsoid={
28009 "modes": ["selser"],
28010 "scrubWikitext": true,
28011 "changes": [
28012 [ "td", "html", "-" ]
28013 ]
28014 }
28015 !! wikitext
28016 {|
28017 |a||b
28018 |}
28019 !! wikitext/edited
28020 {|
28021 | -||-
28022 |}
28023 !! end
28024
28025 ## This tests normalizer's ability to not be tripped by
28026 ## comments (and whitespace)
28027 !! test
28028 4c. Table cells without escapable prefixes after edits
28029 !! options
28030 parsoid={
28031 "modes": ["selser"],
28032 "scrubWikitext": true,
28033 "changes": [
28034 [ "table tbody tr td:first-child", "remove" ]
28035 ]
28036 }
28037 !! wikitext
28038 {|
28039 |-
28040 <!--foo--> |a||-
28041 |}
28042 !! wikitext/edited
28043 {|
28044 |-
28045 <!--foo--> | -
28046 |}
28047 !! end
28048
28049 ## This tests normalizer's ability to handle HTML cells
28050 !! test
28051 4d. Table cells without escapable prefixes after edits
28052 !! options
28053 parsoid={
28054 "modes": ["selser"],
28055 "scrubWikitext": true,
28056 "changes": [
28057 [ "td", "html", "-" ]
28058 ]
28059 }
28060 !! wikitext
28061 <table>
28062 <tr><td>a</td></tr>
28063 </table>
28064 !! wikitext/edited
28065 <table>
28066 <tr><td>-</td></tr>
28067 </table>
28068 !! end
28069
28070 ## T111151 Remove font elements without attributes
28071 !! test
28072 5a. font tags without attributes should be dropped in scrubWikitext mode
28073 !! options
28074 parsoid={
28075 "modes": ["html2wt"],
28076 "scrubWikitext": true
28077 }
28078 !! html
28079 <font>foo</font>
28080 <font><font>bar</font></font>
28081 <font class="x">boo</font>
28082 !! wikitext
28083 foo
28084 bar
28085 <font class="x">boo</font>
28086 !! end
28087
28088 !! test
28089 5b. font tags should not be dropped without scrubWikitext being enabled
28090 !! options
28091 parsoid={
28092 "modes": ["html2wt"],
28093 "scrubWikitext": false
28094 }
28095 !! html
28096 <font>foo</font>
28097 !! wikitext
28098 <font>foo</font>
28099 !! end
28100
28101 !! test
28102 Escape nowiki DOM elements
28103 !! options
28104 parsoid=html2wt
28105 !! html/parsoid
28106 <nowiki><i>foo</i></nowiki>
28107 !! wikitext
28108 &lt;nowiki&gt;''foo''&lt;/nowiki&gt;
28109 !! end
28110
28111 # This is meant to be an interim fix while we go about figuring out
28112 # how to not introduce these trailing <nowiki/>s in the first place.
28113 !! test
28114 T115717: Strip trailing <nowiki/>s (without affecting valid uses)
28115 !! options
28116 parsoid=html2wt
28117 !! html/parsoid
28118 <p>x<meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/>
28119 y</p>
28120 <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>
28121 <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>
28122 !! wikitext
28123 x
28124 y
28125
28126 {{echo|
28127 1 = <nowiki/>}}
28128
28129 {{echo|
28130 1 = <nowiki/>
28131 }}
28132 !! end
28133
28134 # ---------------------------------------------------
28135 # End of tests spec'ing wikitext serialization norms |
28136 # ---------------------------------------------------
28137
28138 # T104032
28139 !! test
28140 Bare inline nodes not wrapped inside p-tags should be treated as p-wrapped
28141 !! options
28142 parsoid=html2wt
28143 !! html/parsoid
28144 a<p>b</p>
28145 <b>c</b><p>d</p>
28146 <table><tr>
28147 <td>a<p>b</p></td>
28148 <td><b>c</b><p>d</p></td>
28149 </tr></table>
28150 !! wikitext
28151 a
28152
28153 b
28154
28155 '''c'''
28156
28157 d
28158 {|
28159 |a
28160 b
28161 |'''c'''
28162 d
28163 |}
28164 !! end
28165
28166 !! test
28167 Anchor without href scenarios
28168 !! options
28169 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
28170 !! html/parsoid
28171 <a class="bc"></a>
28172 <a class="no">dice</a>
28173 <a name="foo"></a>
28174 !! wikitext
28175
28176 dice
28177 <span name="foo"></span>
28178 !! end
28179
28180 !! test
28181 New transclusion added after a list should be serialized after the list
28182 !! options
28183 parsoid=html2wt
28184 !! html/parsoid
28185 <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>
28186 !! wikitext
28187 * a
28188 {{echo|foo}}
28189 !! end
28190
28191 # -----------------------------------------------------------------
28192 # End of section for Parsoid-only html2wt tests for serialization
28193 # of new content
28194 # -----------------------------------------------------------------
28195
28196 # -----------------------------------------------------------------
28197 # The following section of tests are primarily to spec behavior of
28198 # the selective serializer. All these tests have manual selser
28199 # changes. The automated selser changes for all tests handle the
28200 # wide variation of changes, but these tests here capture specs
28201 # deterministically.
28202 # ----------------------------------------------------------------
28203
28204 ## T90517
28205 !! test
28206 Selser: New comments should not be lost
28207 !! options
28208 parsoid={
28209 "modes": ["selser"],
28210 "changes": [
28211 [ "#a", "after", "<!--c1-->" ],
28212 [ "#b", "before", "<!--c2-->" ]
28213 ]
28214 }
28215 !! wikitext
28216 <span id="a">a</span>
28217
28218 <span id="b">b</span>
28219 !! wikitext/edited
28220 <span id="a">a</span><!--c1-->
28221
28222 <!--c2--><span id="b">b</span>
28223 !! end
28224
28225 ## T89383
28226 !! test
28227 Selser: Check for validity of DSR before using it
28228 !! options
28229 parsoid={
28230 "modes": ["selser"],
28231 "changes": [
28232 [ "#a", "before", "<meta property='mw:PageProp/displaytitle' content='foo'>" ]
28233 ]
28234 }
28235 !! wikitext
28236 <span id="a">a</span>
28237 !! wikitext/edited
28238 {{DISPLAYTITLE:foo}}
28239 <span id="a">a</span>
28240 !! end
28241
28242 !! test
28243 1. DOMDiff: Changes to <ref> content should be looked up using id
28244 !! options
28245 parsoid={
28246 "modes": ["selser"],
28247 "changes": [
28248 ["#X", "after", "bar"],
28249 ["#Y", "after", "baz"]
28250 ]
28251 }
28252 !! wikitext
28253 X <ref><span id="X">foo</span></ref>
28254 Y <ref name="a" />
28255 <references>
28256 <ref name="a"><span id="Y">foo</span></ref>
28257 </references>
28258 !! wikitext/edited
28259 X <ref><span id="X">foo</span>bar</ref>
28260 Y <ref name="a" />
28261 <references>
28262 <ref name="a"><span id="Y">foo</span>baz</ref>
28263 </references>
28264 !! end
28265
28266 !! test
28267 2. DOMDiff: Changes to <ref> content should be looked up using id
28268 !! options
28269 parsoid={
28270 "modes": ["selser"],
28271 "changes": [
28272 ["#Z", "after", "bar"]
28273 ]
28274 }
28275 !! wikitext
28276 A <ref>foo bar for a</ref>
28277 B <ref group="X" name="b" />
28278
28279 <references />
28280
28281 <references group="X">
28282 <ref name="b"><span id="Z">foo</span></ref>
28283 </references>
28284 !! wikitext/edited
28285 A <ref>foo bar for a</ref>
28286 B <ref group="X" name="b" />
28287
28288 <references />
28289
28290 <references group="X">
28291 <ref name="b"><span id="Z">foo</span>bar</ref>
28292 </references>
28293 !! end
28294
28295 !! test
28296 DOMDiff: Edits to content nested in elements with templated attributes should not be lost (T139388)
28297 !! options
28298 parsoid={
28299 "modes": ["selser"],
28300 "changes": [
28301 [ "div:first-child", "text", "bar" ]
28302 ]
28303 }
28304 !! wikitext
28305 <div style="{{1x|color:red;}}%">foo</div>
28306 !! wikitext/edited
28307 <div style="{{1x|color:red;}}%">bar</div>
28308 !! end
28309
28310 !! test
28311 Empty LI (T49673)
28312 !! wikitext
28313 * a
28314 *
28315 *
28316 * b
28317 !! html/php+tidy
28318 <ul>
28319 <li>a</li>
28320 <li class="mw-empty-elt"></li>
28321 <li class="mw-empty-elt"></li>
28322 <li>b</li>
28323 </ul>
28324 !! end
28325
28326 !! test
28327 Thumbnail output
28328 !! wikitext
28329 [[File:Thumb.png|thumb]]
28330 !! html/php+tidy
28331 <div class="thumb tright">
28332 <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>
28333 <div class="thumbcaption">
28334 <div class="magnify"><a href="/wiki/File:Thumb.png" class="internal" title="Enlarge"></a></div>
28335 </div>
28336 </div>
28337 </div>
28338 !! end
28339
28340 !! test
28341 unclosed internal link XSS (T137264)
28342 !! wikitext
28343 [[#%3Cscript%3Ealert(1)%3C/script%3E|
28344 !! html/php
28345 <p>[[#&lt;script&gt;alert(1)&lt;/script&gt;|
28346 </p>
28347 !! html/parsoid
28348 <p>[[#%3Cscript%3Ealert(1)%3C/script%3E|</p>
28349 !! end
28350
28351 !! test
28352 Validating that <style> isn't eaten by tidy (T167349)
28353 !! options
28354 # Use $wgRawHtml to inject a <style> tag, since you normally can't in wikitext
28355 wgRawHtml=1
28356 !! wikitext
28357 <div class="foo">
28358 <html><style>.foo::before { content: "<foo>"; }</style></html>
28359 <html><style data-mw-foobar="baz">.foo::after { content: "<bar>"; }</style></html>
28360 </div>
28361 !! html+tidy
28362 <div class="foo">
28363 <style>.foo::before { content: "<foo>"; }</style>
28364 <style data-mw-foobar="baz">.foo::after { content: "<bar>"; }</style>
28365 </div>
28366 !! end