Merge "ApiParse: Add Skin::getDefaultModules() in useskin mode"
[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 Broken templates
5336 !! options
5337 parsoid=wt2html
5338 !! wikitext
5339 {{echo|[[Foo|}}]]
5340
5341 [[Foo|{{echo|]]}}
5342 !! html/php
5343 <p>{{echo|<a href="/wiki/Foo" title="Foo">}}</a>
5344 </p><p>[[Foo|]]
5345 </p>
5346 !! html/parsoid
5347 <p>{{echo|<a rel="mw:WikiLink" href="./Foo" title="Foo">}}</a></p>
5348 <p>[[Foo|<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"]]"}},"i":0}}]}'>]]</span></p>
5349 !! end
5350
5351 !! test
5352 T4702: Mismatched <i>, <b> and <a> tags are invalid
5353 !! wikitext
5354 ''[http://example.com text'']
5355 [http://example.com '''text]'''
5356 ''Something [http://example.com in italic'']
5357 ''Something [http://example.com mixed''''', even bold]'''
5358 '''''Now [http://example.com both''''']
5359 !! html
5360 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
5361 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
5362 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
5363 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
5364 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
5365 </p>
5366 !! end
5367
5368
5369 !! test
5370 T6781: %26 in URL
5371 !! wikitext
5372 http://www.example.com/?title=AT%26T
5373 !! html/php
5374 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
5375 </p>
5376 !! html/parsoid
5377 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a></p>
5378 !! end
5379
5380 # According to https://www.w3.org/TR/2011/WD-html5-20110525/Overview.html#parsing-urls a plain
5381 # % is actually legal in HTML5. Any change in output would need testing though.
5382 !! test
5383 T6781, T7267: %25 in URL
5384 !! wikitext
5385 http://www.example.com/?title=100%25_Bran
5386 !! html/php
5387 <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>
5388 </p>
5389 !! html/parsoid
5390 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran">http://www.example.com/?title=100%25_Bran</a></p>
5391 !! end
5392
5393 !! test
5394 T6781, T7267: %28, %29 in URL
5395 !! wikitext
5396 http://www.example.com/?title=Ben-Hur_%281959_film%29
5397 !! html/php
5398 <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>
5399 </p>
5400 !! html/parsoid
5401 <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>
5402 !! end
5403
5404
5405 !! test
5406 T6781: %26 in autonumber URL
5407 !! wikitext
5408 [http://www.example.com/?title=AT%26T]
5409 !! html/php
5410 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
5411 </p>
5412 !! html/parsoid
5413 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T"></a></p>
5414 !! end
5415
5416 !! test
5417 T6781, T7267: %26 in autonumber URL
5418 !! wikitext
5419 [http://www.example.com/?title=100%25_Bran]
5420 !! html/php
5421 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
5422 </p>
5423 !! html/parsoid
5424 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran"></a></p>
5425 !! end
5426
5427 !! test
5428 T6781, T7267: %28, %29 in autonumber URL
5429 !! wikitext
5430 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
5431 !! html/php
5432 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
5433 </p>
5434 !! html/parsoid
5435 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29"></a></p>
5436 !! end
5437
5438
5439 !! test
5440 T6781: %26 in bracketed URL
5441 !! wikitext
5442 [http://www.example.com/?title=AT%26T link]
5443 !! html/php
5444 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
5445 </p>
5446 !! html/parsoid
5447 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">link</a></p>
5448 !! end
5449
5450 !! test
5451 T6781, T7267: %25 in bracketed URL
5452 !! wikitext
5453 [http://www.example.com/?title=100%25_Bran link]
5454 !! html
5455 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
5456 </p>
5457 !! end
5458
5459 !! test
5460 T6781, T7267: %28, %29 in bracketed URL
5461 !! wikitext
5462 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
5463 !! html/php
5464 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
5465 </p>
5466 !! html/parsoid
5467 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a></p>
5468 !! end
5469
5470 !! test
5471 External link containing a period in the anchor. (T65947)
5472 !! wikitext
5473 [//foo.org/bar#baz. bang]
5474
5475 [//foo.org/bar. bang]
5476 !! html/php
5477 <p><a rel="nofollow" class="external text" href="//foo.org/bar#baz.">bang</a>
5478 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar.">bang</a>
5479 </p>
5480 !! html/parsoid
5481 <p><a rel="mw:ExtLink" href="//foo.org/bar#baz.">bang</a></p>
5482 <p><a rel="mw:ExtLink" href="//foo.org/bar.">bang</a></p>
5483 !! end
5484
5485 !! test
5486 External link containing a single quote. (T65947)
5487 !! wikitext
5488 [//foo.org/bar'baz]
5489
5490 [//foo.org/bar'baz bang]
5491 !! html/php
5492 <p><a rel="nofollow" class="external autonumber" href="//foo.org/bar'baz">[1]</a>
5493 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar'baz">bang</a>
5494 </p>
5495 !! html/parsoid
5496 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz"></a></p>
5497 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz">bang</a></p>
5498 !! end
5499
5500 !! test
5501 External link containing double-single-quotes in text '' (T6598 sanity check)
5502 !! wikitext
5503 Some [http://example.com/ pretty ''italics'' and stuff]!
5504 !! html
5505 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
5506 </p>
5507 !! end
5508
5509 !! test
5510 External link containing double-single-quotes in text embedded in italics (T6598 sanity check)
5511 !! wikitext
5512 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
5513 !! html
5514 <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>
5515 </p>
5516 !! end
5517
5518 !! test
5519 External link containing double-single-quotes with no space separating the url from text in italics
5520 !! wikitext
5521 [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]].]
5522 !! html/php
5523 <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>
5524 </p>
5525 !! html/php+tidy
5526 <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>
5527 !! html/parsoid
5528 <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>
5529 !! end
5530
5531 !! test
5532 External link with comments in link text
5533 !! wikitext
5534 [http://www.google.com Google <!-- comment -->]
5535 !! html/php
5536 <p><a rel="nofollow" class="external text" href="http://www.google.com">Google </a>
5537 </p>
5538 !! html/parsoid
5539 <p><a rel="mw:ExtLink" href="http://www.google.com">Google <!-- comment --></a></p>
5540 !! end
5541
5542 !! test
5543 External link to bare IPv4 address
5544 !! wikitext
5545 [http://192.168.0.1 Link]
5546 !! html/php
5547 <p><a rel="nofollow" class="external text" href="http://192.168.0.1">Link</a>
5548 </p>
5549 !! html/parsoid
5550 <p><a rel="mw:ExtLink" href="http://192.168.0.1">Link</a></p>
5551 !! end
5552
5553 !! test
5554 URL-encoding in URL functions (single parameter)
5555 !! wikitext
5556 {{localurl:Some page|amp=&}}
5557 !! html
5558 <p>/index.php?title=Some_page&amp;amp=&amp;
5559 </p>
5560 !! end
5561
5562 !! test
5563 URL-encoding in URL functions (multiple parameters)
5564 !! wikitext
5565 {{localurl:Some page|q=?&amp=&}}
5566 !! html
5567 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
5568 </p>
5569 !! end
5570
5571 !! test
5572 Brackets in urls
5573 !! wikitext
5574 http://example.com/index.php?foozoid%5B%5D=bar
5575
5576 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
5577 !! html/php
5578 <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>
5579 </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>
5580 </p>
5581 !! html/parsoid
5582 <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>
5583
5584 <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>
5585 !! end
5586
5587 !! test
5588 IPv6 urls, autolink format (T23261)
5589 !! wikitext
5590 http://[2404:130:0:1000::187:2]/index.php
5591
5592 Examples from RFC 2373, section 2.2:
5593 * http://[1080::8:800:200C:417A]/unicast
5594 * http://[FF01::101]/multicast
5595 * http://[::1]/loopback
5596 * http://[::]/unspecified
5597 * http://[::13.1.68.3]/ipv4compat
5598 * http://[::FFFF:129.144.52.38]/ipv4compat
5599
5600 Examples from RFC 2732, section 2:
5601 * http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html
5602 * http://[1080:0:0:0:8:800:200C:417A]/index.html
5603 * http://[3ffe:2a00:100:7031::1]
5604 * http://[1080::8:800:200C:417A]/foo
5605 * http://[::192.9.5.5]/ipng
5606 * http://[::FFFF:129.144.52.38]:80/index.html
5607 * http://[2010:836B:4179::836B:4179]
5608
5609 !! html/php
5610 <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>
5611 </p><p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2373">RFC 2373</a>, section 2.2:
5612 </p>
5613 <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>
5614 <li> <a rel="nofollow" class="external free" href="http://[FF01::101]/multicast">http://[FF01::101]/multicast</a></li>
5615 <li> <a rel="nofollow" class="external free" href="http://[::1]/loopback">http://[::1]/loopback</a></li>
5616 <li> <a rel="nofollow" class="external free" href="http://[::]/unspecified">http://[::]/unspecified</a></li>
5617 <li> <a rel="nofollow" class="external free" href="http://[::13.1.68.3]/ipv4compat">http://[::13.1.68.3]/ipv4compat</a></li>
5618 <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>
5619 <p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2732">RFC 2732</a>, section 2:
5620 </p>
5621 <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>
5622 <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>
5623 <li> <a rel="nofollow" class="external free" href="http://[3ffe:2a00:100:7031::1]">http://[3ffe:2a00:100:7031::1]</a></li>
5624 <li> <a rel="nofollow" class="external free" href="http://[1080::8:800:200C:417A]/foo">http://[1080::8:800:200C:417A]/foo</a></li>
5625 <li> <a rel="nofollow" class="external free" href="http://[::192.9.5.5]/ipng">http://[::192.9.5.5]/ipng</a></li>
5626 <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>
5627 <li> <a rel="nofollow" class="external free" href="http://[2010:836B:4179::836B:4179]">http://[2010:836B:4179::836B:4179]</a></li></ul>
5628
5629 !! html/parsoid
5630 <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>
5631
5632 <p>Examples from <a href="//tools.ietf.org/html/rfc2373" rel="mw:ExtLink">RFC 2373</a>, section 2.2:</p>
5633 <ul><li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/unicast">http://[1080::8:800:200C:417A]/unicast</a></li>
5634 <li> <a rel="mw:ExtLink" href="http://[FF01::101]/multicast">http://[FF01::101]/multicast</a></li>
5635 <li> <a rel="mw:ExtLink" href="http://[::1]/loopback">http://[::1]/loopback</a></li>
5636 <li> <a rel="mw:ExtLink" href="http://[::]/unspecified">http://[::]/unspecified</a></li>
5637 <li> <a rel="mw:ExtLink" href="http://[::13.1.68.3]/ipv4compat">http://[::13.1.68.3]/ipv4compat</a></li>
5638 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]/ipv4compat">http://[::FFFF:129.144.52.38]/ipv4compat</a></li></ul>
5639
5640 <p>Examples from <a href="//tools.ietf.org/html/rfc2732" rel="mw:ExtLink">RFC 2732</a>, section 2:</p>
5641 <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>
5642 <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>
5643 <li> <a rel="mw:ExtLink" href="http://[3ffe:2a00:100:7031::1]">http://[3ffe:2a00:100:7031::1]</a></li>
5644 <li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/foo">http://[1080::8:800:200C:417A]/foo</a></li>
5645 <li> <a rel="mw:ExtLink" href="http://[::192.9.5.5]/ipng">http://[::192.9.5.5]/ipng</a></li>
5646 <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>
5647 <li> <a rel="mw:ExtLink" href="http://[2010:836B:4179::836B:4179]">http://[2010:836B:4179::836B:4179]</a></li></ul>
5648 !! end
5649
5650 !! test
5651 IPv6 urls, bracketed format (T23261)
5652 !! wikitext
5653 [http://[2404:130:0:1000::187:2]/index.php test]
5654
5655 Examples from RFC 2373, section 2.2:
5656 * [http://[1080::8:800:200C:417A] unicast]
5657 * [http://[FF01::101] multicast]
5658 * [http://[::1]/ loopback]
5659 * [http://[::] unspecified]
5660 * [http://[::13.1.68.3] ipv4compat]
5661 * [http://[::FFFF:129.144.52.38] ipv4compat]
5662
5663 Examples from RFC 2732, section 2:
5664 * [http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html 1]
5665 * [http://[1080:0:0:0:8:800:200C:417A]/index.html 2]
5666 * [http://[3ffe:2a00:100:7031::1] 3]
5667 * [http://[1080::8:800:200C:417A]/foo 4]
5668 * [http://[::192.9.5.5]/ipng 5]
5669 * [http://[::FFFF:129.144.52.38]:80/index.html 6]
5670 * [http://[2010:836B:4179::836B:4179] 7]
5671
5672 !! html/php
5673 <p><a rel="nofollow" class="external text" href="http://[2404:130:0:1000::187:2]/index.php">test</a>
5674 </p><p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2373">RFC 2373</a>, section 2.2:
5675 </p>
5676 <ul><li> <a rel="nofollow" class="external text" href="http://[1080::8:800:200C:417A]">unicast</a></li>
5677 <li> <a rel="nofollow" class="external text" href="http://[FF01::101]">multicast</a></li>
5678 <li> <a rel="nofollow" class="external text" href="http://[::1]/">loopback</a></li>
5679 <li> <a rel="nofollow" class="external text" href="http://[::]">unspecified</a></li>
5680 <li> <a rel="nofollow" class="external text" href="http://[::13.1.68.3]">ipv4compat</a></li>
5681 <li> <a rel="nofollow" class="external text" href="http://[::FFFF:129.144.52.38]">ipv4compat</a></li></ul>
5682 <p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2732">RFC 2732</a>, section 2:
5683 </p>
5684 <ul><li> <a rel="nofollow" class="external text" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">1</a></li>
5685 <li> <a rel="nofollow" class="external text" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">2</a></li>
5686 <li> <a rel="nofollow" class="external text" href="http://[3ffe:2a00:100:7031::1]">3</a></li>
5687 <li> <a rel="nofollow" class="external text" href="http://[1080::8:800:200C:417A]/foo">4</a></li>
5688 <li> <a rel="nofollow" class="external text" href="http://[::192.9.5.5]/ipng">5</a></li>
5689 <li> <a rel="nofollow" class="external text" href="http://[::FFFF:129.144.52.38]:80/index.html">6</a></li>
5690 <li> <a rel="nofollow" class="external text" href="http://[2010:836B:4179::836B:4179]">7</a></li></ul>
5691
5692 !! html/parsoid
5693 <p><a rel="mw:ExtLink" href="http://[2404:130:0:1000::187:2]/index.php">test</a></p>
5694
5695 <p>Examples from <a href="//tools.ietf.org/html/rfc2373" rel="mw:ExtLink">RFC 2373</a>, section 2.2:</p>
5696 <ul><li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]">unicast</a></li>
5697 <li> <a rel="mw:ExtLink" href="http://[FF01::101]">multicast</a></li>
5698 <li> <a rel="mw:ExtLink" href="http://[::1]/">loopback</a></li>
5699 <li> <a rel="mw:ExtLink" href="http://[::]">unspecified</a></li>
5700 <li> <a rel="mw:ExtLink" href="http://[::13.1.68.3]">ipv4compat</a></li>
5701 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]">ipv4compat</a></li></ul>
5702
5703 <p>Examples from <a href="//tools.ietf.org/html/rfc2732" rel="mw:ExtLink">RFC 2732</a>, section 2:</p>
5704 <ul><li> <a rel="mw:ExtLink" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">1</a></li>
5705 <li> <a rel="mw:ExtLink" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">2</a></li>
5706 <li> <a rel="mw:ExtLink" href="http://[3ffe:2a00:100:7031::1]">3</a></li>
5707 <li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/foo">4</a></li>
5708 <li> <a rel="mw:ExtLink" href="http://[::192.9.5.5]/ipng">5</a></li>
5709 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]:80/index.html">6</a></li>
5710 <li> <a rel="mw:ExtLink" href="http://[2010:836B:4179::836B:4179]">7</a></li></ul>
5711 !! end
5712
5713 !! test
5714 Non-extlinks in brackets
5715 !! wikitext
5716 [foo]
5717 [foo bar]
5718 [foo ''bar'']
5719 [fool's] errand
5720 [fool's errand]
5721 [{{echo|foo}}]
5722 [{{echo|foo}} bar]
5723 [{{echo|foo}} ''bar'']
5724 [{{echo|foo}}l's] errand
5725 [{{echo|foo}}l's errand]
5726 [url={{echo|foo}}]
5727 [url=http://example.com]
5728 [http:// bare protocols don't count]
5729 !! html/php
5730 <p>[foo]
5731 [foo bar]
5732 [foo <i>bar</i>]
5733 [fool's] errand
5734 [fool's errand]
5735 [foo]
5736 [foo bar]
5737 [foo <i>bar</i>]
5738 [fool's] errand
5739 [fool's errand]
5740 [url=foo]
5741 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
5742 [http:// bare protocols don't count]
5743 </p>
5744 !! html/parsoid
5745 <p>[foo]
5746 [foo bar]
5747 [foo <i>bar</i>]
5748 [fool's] errand
5749 [fool's errand]
5750 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}"}'>foo</span>]
5751 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}"}'>foo</span> bar]
5752 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}"}'>foo</span> <i>bar</i>]
5753 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}l&#39;s"}'>fool's</span>] errand
5754 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}l&#39;s"}'>fool's</span> errand]
5755 [<span typeof="mw:Placeholder" data-parsoid='{"src":"url={{echo|foo}}"}'>url=foo</span>]
5756 [url=<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>]
5757 [http:// bare protocols don't count]</p>
5758 !! end
5759
5760 !! test
5761 Percent encoding in external links
5762 !! wikitext
5763 [https://github.com/search?l=&q=ResourceLoader+%40wikimedia Search]
5764 !! html/php
5765 <p><a rel="nofollow" class="external text" href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a>
5766 </p>
5767 !! html/parsoid
5768 <p><a rel="mw:ExtLink"
5769 href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a></p>
5770 !! end
5771
5772 !! test
5773 Use url link syntax for links where the content is equal the link target
5774 !! wikitext
5775 http://example.com
5776 !! html/php
5777 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
5778 </p>
5779 !! html/parsoid
5780 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></p>
5781 !! end
5782
5783 !! test
5784 Parenthesis in external links, especially URL links
5785 !! wikitext
5786 http://example.com)
5787
5788 http://example.com/test)
5789
5790 http://example.com/(test)
5791
5792 http://example.com/((test)
5793
5794 (http://example.com/(test))
5795
5796 (http://example.com/(test)))))
5797
5798 http://example.com/a)b
5799
5800 [http://example.com) foo]
5801 !! html/php
5802 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5803 </p><p><a rel="nofollow" class="external free" href="http://example.com/test">http://example.com/test</a>)
5804 </p><p><a rel="nofollow" class="external free" href="http://example.com/(test)">http://example.com/(test)</a>
5805 </p><p><a rel="nofollow" class="external free" href="http://example.com/((test)">http://example.com/((test)</a>
5806 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test))">http://example.com/(test))</a>
5807 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test)))))">http://example.com/(test)))))</a>
5808 </p><p><a rel="nofollow" class="external free" href="http://example.com/a)b">http://example.com/a)b</a>
5809 </p><p><a rel="nofollow" class="external text" href="http://example.com)">foo</a>
5810 </p>
5811 !! html/parsoid
5812 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)</p>
5813 <p><a rel="mw:ExtLink" href="http://example.com/test">http://example.com/test</a>)</p>
5814 <p><a rel="mw:ExtLink" href="http://example.com/(test)">http://example.com/(test)</a></p>
5815 <p><a rel="mw:ExtLink" href="http://example.com/((test)">http://example.com/((test)</a></p>
5816 <p>(<a rel="mw:ExtLink" href="http://example.com/(test))">http://example.com/(test))</a></p>
5817 <p>(<a rel="mw:ExtLink" href="http://example.com/(test)))))">http://example.com/(test)))))</a></p>
5818 <p><a rel="mw:ExtLink" href="http://example.com/a)b">http://example.com/a)b</a></p>
5819 <p><a rel="mw:ExtLink" href="http://example.com)">foo</a></p>
5820 !! end
5821
5822 !! test
5823 Parenthesis in external links, w/ transclusion or comment
5824 !! wikitext
5825 (http://example.com/{{echo|hi}})
5826
5827 (http://example.com<!-- hi -->)
5828 !! html/php
5829 <p>(<a rel="nofollow" class="external free" href="http://example.com/hi">http://example.com/hi</a>)
5830 </p><p>(<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5831 </p>
5832 !! html/parsoid
5833 <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>
5834
5835 <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>
5836 !! end
5837
5838 !! test
5839 Serialize <a> tags with invalid link targets as plain text
5840 !! options
5841 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
5842 !! html/parsoid
5843 <a rel="mw:WikiLink" href="[[foo]]">text</a>
5844 <a rel="mw:WikiLink" href="[[foo]]">*text</a>
5845 <a rel="mw:WikiLink" href="[[foo]]">[[foo]]</a>
5846 <a rel="mw:WikiLink" href="[[foo]]">*a [[foo]]</a>
5847 !! wikitext
5848 text
5849 <nowiki>*</nowiki>text
5850 <nowiki>[[foo]]</nowiki>
5851 <nowiki>*</nowiki>a <nowiki>[[foo]]</nowiki>
5852 !! end
5853
5854 !! test
5855 mw:ExtLink -vs- mw:WikiLink (T94723)
5856 !! options
5857 parsoid=html2wt
5858 !! html/parsoid
5859 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"piped","a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>Bar</a>
5860 <a rel="mw:WikiLink" href="./Foo" title="Foo">Bar</a>
5861 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
5862 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
5863 <p>
5864 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
5865 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
5866 </p>
5867 !! wikitext
5868 [[Foo|Bar]]
5869 [[Foo|Bar]]
5870 [[wikipedia:Foo|Bar]]
5871 [[wikipedia:Foo|Bar]]
5872
5873 [[wikipedia:European_Robin|European Robin]]
5874 [[wikipedia:European_Robin|European Robin]]
5875 !! end
5876
5877 !! test
5878 mw:ExtLink linking to a interwiki URL can be round-tripped losslessly (T94723)
5879 !! options
5880 parsoid=wt2wt
5881 !! wikitext
5882 [http://en.wikipedia.org/wiki/European_Robin European Robin]
5883 !! html/parsoid
5884 THIS SECTION IS NOT USED (but Parsoid won't run the test without it)
5885 !! end
5886
5887
5888 ###
5889 ### Quotes
5890 ###
5891
5892 !! test
5893 Quotes
5894 !! wikitext
5895 Normal text. '''Bold text.''' Normal text. ''Italic text.''
5896
5897 Normal text. '''''Bold italic text.''''' Normal text.
5898 !! html
5899 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
5900 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
5901 </p>
5902 !! end
5903
5904
5905 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
5906 # parser strips. The wikitext contains just the first half of the bold
5907 # quote pair.
5908 !! test
5909 Unclosed and unmatched quotes
5910 !! wikitext
5911 '''''Bold italic text '''with bold deactivated''' in between.'''''
5912
5913 '''''Bold italic text ''with italic deactivated'' in between.'''''
5914
5915 '''Bold text..
5916
5917 ..spanning two paragraphs (should not work).'''
5918
5919 '''Bold tag left open
5920
5921 ''Italic tag left open
5922
5923 Normal text.
5924
5925 <!-- Unmatching number of opening, closing tags: -->
5926 '''This year''''s election ''should'' beat '''last year''''s.
5927
5928 ''Tom'''s car is bigger than ''Susan'''s.
5929
5930 Plain ''italic'''s plain
5931 !! html/php
5932 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
5933 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
5934 </p><p><b>Bold text..</b>
5935 </p><p>..spanning two paragraphs (should not work).
5936 </p><p><b>Bold tag left open</b>
5937 </p><p><i>Italic tag left open</i>
5938 </p><p>Normal text.
5939 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
5940 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
5941 </p><p>Plain <i>italic'</i>s plain
5942 </p>
5943 !! html/parsoid
5944 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
5945 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
5946 </p><p><b>Bold text..</b>
5947 </p><p>..spanning two paragraphs (should not work).<b></b>
5948 </p><p><b>Bold tag left open</b>
5949 </p><p><i>Italic tag left open</i>
5950 </p><p>Normal text.
5951 </p>
5952 <!-- Unmatching number of opening, closing tags: -->
5953 <p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
5954 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
5955 </p><p>Plain <i>italic'</i>s plain
5956 </p>
5957 !! end
5958
5959 ###
5960 ### Tables
5961 ###
5962 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
5963 ###
5964
5965 # This should not produce <table></table> as <table><tr><td></td></tr></table>
5966 # is the bare minimum required by the spec, see:
5967 # https://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
5968 # Parsoid team replies: empty table tags are legal in HTML5
5969 !! test
5970 A table with no data.
5971 !! options
5972 parsoid=wt2html
5973 !! wikitext
5974 {||}
5975 !! html/php
5976
5977 !! html/parsoid
5978 <table></table>
5979
5980 !! end
5981
5982 !! test
5983 A table with stray table end tags on start tag line (wt2html)
5984 !! options
5985 parsoid=wt2html
5986 !! wikitext
5987 {|style="color: red;"|}
5988
5989 {|style="color: red;" |}
5990 |foo
5991 |}
5992
5993 {|style="color: red;"|} id="foo"
5994 |foo
5995 |}
5996
5997 {|style="color: red;" |} id="foo"
5998 |foo
5999 |}
6000 !! html
6001 <table style="color: red;"></table>
6002
6003 <table style="color: red;">
6004 <tbody><tr>
6005 <td>foo</td>
6006 </tr></tbody>
6007 </table>
6008
6009 <table style="color: red;" id="foo">
6010 <tbody><tr>
6011 <td>foo</td>
6012 </tr></tbody>
6013 </table>
6014
6015 <table style="color: red;" id="foo">
6016 <tbody><tr>
6017 <td>foo</td>
6018 </tr></tbody>
6019 </table>
6020
6021 !! end
6022
6023 !! test
6024 A table with no data (take 2)
6025 !! wikitext
6026 {|
6027 |}
6028 !! html/parsoid
6029 <table></table>
6030 !! end
6031
6032 # A table with nothing but a caption is invalid XHTML, we might want to render
6033 # this as <p>caption</p>
6034 # Parsoid team replies: table with only a caption is legal in HTML5
6035 !! test
6036 A table with nothing but a caption
6037 !! wikitext
6038 {|
6039 |+ caption
6040 |}
6041 !! html/php
6042 <table>
6043 <caption> caption
6044 </caption><tr><td></td></tr></table>
6045
6046 !! html/parsoid
6047 <table><caption> caption</caption></table>
6048 !! end
6049
6050 !! test
6051 A table with caption with default-spaced attributes and a table row
6052 !! wikitext
6053 {|
6054 |+ style="color: red;" | caption1
6055 |-
6056 | foo
6057 |}
6058 !! html
6059 <table>
6060 <caption style="color: red;"> caption1
6061 </caption>
6062 <tr>
6063 <td> foo
6064 </td></tr></table>
6065
6066 !! end
6067
6068 !! test
6069 A table with captions with non-default spaced attributes and a table row
6070 !! wikitext
6071 {|
6072 |+style="color: red;"|caption2
6073 |+ style="color: red;"| caption3
6074 |-
6075 | foo
6076 |}
6077 !! html
6078 <table>
6079 <caption style="color: red;">caption2
6080 </caption>
6081 <caption style="color: red;"> caption3
6082 </caption>
6083 <tr>
6084 <td> foo
6085 </td></tr></table>
6086
6087 !! end
6088
6089 !! test
6090 Table td-cell syntax variations
6091 !! wikitext
6092 {|
6093 | foo bar foo | baz
6094 | foo bar foo || baz
6095 | style='color:red;' | baz
6096 | style='color:red;' || baz
6097 |}
6098 !! html
6099 <table>
6100 <tr>
6101 <td> baz
6102 </td>
6103 <td> foo bar foo </td>
6104 <td> baz
6105 </td>
6106 <td style="color:red;"> baz
6107 </td>
6108 <td> style='color:red;' </td>
6109 <td> baz
6110 </td></tr></table>
6111
6112 !! end
6113
6114 !! test
6115 Simple table
6116 !! wikitext
6117 {|
6118 | 1 || 2
6119 |-
6120 | 3 || 4
6121 |}
6122 !! html
6123 <table>
6124 <tr>
6125 <td> 1 </td>
6126 <td> 2
6127 </td></tr>
6128 <tr>
6129 <td> 3 </td>
6130 <td> 4
6131 </td></tr></table>
6132
6133 !! end
6134
6135 !! test
6136 Simple table but with multiple dashes for row wikitext
6137 !! wikitext
6138 {|
6139 | foo
6140 |-----
6141 | bar
6142 |}
6143 !! html
6144 <table>
6145 <tr>
6146 <td> foo
6147 </td></tr>
6148 <tr>
6149 <td> bar
6150 </td></tr></table>
6151
6152 !! end
6153
6154 !! test
6155 Multiplication table
6156 !! wikitext
6157 {| border="1" cellpadding="2"
6158 |+Multiplication table
6159 |-
6160 ! &times; !! 1 !! 2 !! 3
6161 |-
6162 ! 1
6163 | 1 || 2 || 3
6164 |-
6165 ! 2
6166 | 2 || 4 || 6
6167 |-
6168 ! 3
6169 | 3 || 6 || 9
6170 |-
6171 ! 4
6172 | 4 || 8 || 12
6173 |-
6174 ! 5
6175 | 5 || 10 || 15
6176 |}
6177 !! html
6178 <table border="1" cellpadding="2">
6179 <caption>Multiplication table
6180 </caption>
6181 <tr>
6182 <th> &#215; </th>
6183 <th> 1 </th>
6184 <th> 2 </th>
6185 <th> 3
6186 </th></tr>
6187 <tr>
6188 <th> 1
6189 </th>
6190 <td> 1 </td>
6191 <td> 2 </td>
6192 <td> 3
6193 </td></tr>
6194 <tr>
6195 <th> 2
6196 </th>
6197 <td> 2 </td>
6198 <td> 4 </td>
6199 <td> 6
6200 </td></tr>
6201 <tr>
6202 <th> 3
6203 </th>
6204 <td> 3 </td>
6205 <td> 6 </td>
6206 <td> 9
6207 </td></tr>
6208 <tr>
6209 <th> 4
6210 </th>
6211 <td> 4 </td>
6212 <td> 8 </td>
6213 <td> 12
6214 </td></tr>
6215 <tr>
6216 <th> 5
6217 </th>
6218 <td> 5 </td>
6219 <td> 10 </td>
6220 <td> 15
6221 </td></tr></table>
6222
6223 !! end
6224
6225 !! test
6226 Accept "||" in table headings
6227 !! wikitext
6228 {|
6229 !h1 || h2
6230 |}
6231 !! html
6232 <table>
6233 <tr>
6234 <th>h1 </th>
6235 <th> h2
6236 </th></tr></table>
6237
6238 !! end
6239
6240 !! test
6241 Accept "!!" in table data
6242 !! wikitext
6243 {|
6244 | Foo!! ||
6245 |}
6246 !! html
6247 <table>
6248 <tr>
6249 <td> Foo!! </td>
6250 <td>
6251 </td></tr></table>
6252
6253 !! html/parsoid
6254 <table>
6255 <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>
6256 </tbody></table>
6257 !! end
6258
6259 !! test
6260 Accept "||" in indented table headings
6261 !! wikitext
6262 :{|
6263 !h1 || h2
6264 |}
6265 !! html
6266 <dl><dd><table>
6267 <tr>
6268 <th>h1 </th>
6269 <th> h2
6270 </th></tr></table></dd></dl>
6271
6272 !! end
6273
6274 !! test
6275 Accept "!!" in templates
6276 !! wikitext
6277 {|
6278 !a {{echo|b!!c}}
6279 |}
6280 !! html/php
6281 <table>
6282 <tr>
6283 <th>a b</th>
6284 <th>c
6285 </th></tr></table>
6286
6287 !! html/parsoid
6288 <table>
6289 <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>
6290 !! end
6291
6292 !! test
6293 Accept "!!" in table headings after newline
6294 !! wikitext
6295 {|
6296 !a
6297 b!!c
6298 |}
6299 !! html/php
6300 <table>
6301 <tr>
6302 <th>a
6303 <p>b!!c
6304 </p>
6305 </th></tr></table>
6306
6307 !! html/parsoid
6308 <table>
6309 <tbody><tr><th>a
6310 <p>b!!c</p></th></tr>
6311 </tbody></table>
6312 !! end
6313
6314 !! test
6315 Accept "!!" in table data of mixed wikitext / html syntax
6316 !! wikitext
6317 {|
6318 !a
6319 <tr><td>b!!c</td></tr>
6320 |}
6321 !! html+tidy
6322 <table>
6323 <tr>
6324 <th>a</th>
6325 </tr>
6326 <tr>
6327 <td>b!!c</td>
6328 </tr>
6329 </table>
6330 !! html/parsoid
6331 <table>
6332 <tbody><tr><th>a</th></tr>
6333 <tr data-parsoid='{"stx":"html"}'><td data-parsoid='{"stx":"html"}'>b!!c</td></tr>
6334 </tbody></table>
6335 !! end
6336
6337 !! test
6338 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
6339 !! wikitext
6340 {|
6341 !| h1
6342 || a
6343 |}
6344 !! html
6345 <table>
6346 <tr>
6347 <th> h1
6348 </th>
6349 <td> a
6350 </td></tr></table>
6351
6352 !! end
6353
6354 !!test
6355 Accept "| !" at start of line in tables (ignore !-attribute)
6356 !! wikitext
6357 {|
6358 |-
6359 | !style="color:red" | bar
6360 |}
6361 !! html
6362 <table>
6363
6364 <tr>
6365 <td> bar
6366 </td></tr></table>
6367
6368 !!end
6369
6370 !!test
6371 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 +/-
6372 !! wikitext
6373 {|
6374 |-
6375 |style='color:red;'|+1
6376 |style='color:blue;'|-1
6377 |-
6378 | 1 || 2 || 3
6379 | 1 ||+2 ||-3
6380 |-
6381 | +1
6382 | -1
6383 |}
6384 !! html
6385 <table>
6386
6387 <tr>
6388 <td style="color:red;">+1
6389 </td>
6390 <td style="color:blue;">-1
6391 </td></tr>
6392 <tr>
6393 <td> 1 </td>
6394 <td> 2 </td>
6395 <td> 3
6396 </td>
6397 <td> 1 </td>
6398 <td>+2 </td>
6399 <td>-3
6400 </td></tr>
6401 <tr>
6402 <td> +1
6403 </td>
6404 <td> -1
6405 </td></tr></table>
6406
6407 !!end
6408
6409 !! test
6410 Table rowspan
6411 !! wikitext
6412 {| border=1
6413 | Cell 1, row 1
6414 |rowspan=2| Cell 2, row 1 (and 2)
6415 | Cell 3, row 1
6416 |-
6417 | Cell 1, row 2
6418 | Cell 3, row 2
6419 |}
6420 !! html
6421 <table border="1">
6422 <tr>
6423 <td> Cell 1, row 1
6424 </td>
6425 <td rowspan="2"> Cell 2, row 1 (and 2)
6426 </td>
6427 <td> Cell 3, row 1
6428 </td></tr>
6429 <tr>
6430 <td> Cell 1, row 2
6431 </td>
6432 <td> Cell 3, row 2
6433 </td></tr></table>
6434
6435 !! end
6436
6437 !! test
6438 Nested table
6439 !! wikitext
6440 {| border=1
6441 | &alpha;
6442 |
6443 {| bgcolor=#ABCDEF border=2
6444 |nested
6445 |-
6446 |table
6447 |}
6448 |the original table again
6449 |}
6450 !! html
6451 <table border="1">
6452 <tr>
6453 <td> &#945;
6454 </td>
6455 <td>
6456 <table bgcolor="#ABCDEF" border="2">
6457 <tr>
6458 <td>nested
6459 </td></tr>
6460 <tr>
6461 <td>table
6462 </td></tr></table>
6463 </td>
6464 <td>the original table again
6465 </td></tr></table>
6466
6467 !! end
6468
6469 !! test
6470 Invalid attributes in table cell (T3830)
6471 !! wikitext
6472 {|
6473 |Cell:|broken
6474 |}
6475 !! html
6476 <table>
6477 <tr>
6478 <td>broken
6479 </td></tr></table>
6480
6481 !! end
6482
6483 !! test
6484 Table cell attributes: Pipes protected by nowikis should be treated as a plain character
6485 !! wikitext
6486 {|
6487 | title="foo" |bar
6488 | title="foo<nowiki>|</nowiki>" |bar
6489 | title="foo<nowiki>|</nowiki>" bar
6490 |}
6491 !! html/php
6492 <table>
6493 <tr>
6494 <td title="foo">bar
6495 </td>
6496 <td title="foo&#124;">bar
6497 </td>
6498 <td> title="foo|" bar
6499 </td></tr></table>
6500
6501 !! html/parsoid
6502 <table>
6503 <tbody><tr><td title="foo">bar</td>
6504 <td title="foo|" data-parsoid='{"a":{"title":"foo|"},"sa":{"title":"foo&lt;nowiki>|&lt;/nowiki>"},"autoInsertedEnd":true}'>bar</td>
6505 <td> title="foo<span typeof="mw:Nowiki">|</span>" bar</td></tr>
6506 </tbody></table>
6507 !! end
6508
6509 # See: http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html
6510 # N.B. The "|}" to close the table is missing from the input, so parsoid's
6511 # *2wt modes will fail.
6512 !! test
6513 Table security: embedded pipes
6514 !! options
6515 parsoid=wt2html,html2html
6516 !! wikitext
6517 {|
6518 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
6519 !! html/php
6520 <table>
6521 <tr>
6522 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
6523 <td>]" onmouseover="alert(document.cookie)"&gt;test
6524 </td>
6525 </tr>
6526 </table>
6527
6528 !! html/parsoid
6529 <table><tbody>
6530 <tr>
6531 <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>
6532 !! end
6533
6534 !! test
6535 Element attributes with double ! should not be broken up by <th>
6536 !! wikitext
6537 {|
6538 ! hi <div class="!!">ha</div> ho
6539 |}
6540 !! html/php
6541 <table>
6542 <tr>
6543 <th> hi <div class="!!">ha</div> ho
6544 </th></tr></table>
6545
6546 !! html/parsoid
6547 <table>
6548 <tbody><tr><th> hi <div class="!!" data-parsoid='{"stx":"html"}'>ha</div> ho</th></tr>
6549 </tbody></table>
6550 !! end
6551
6552 !! test
6553 ! and || in element attributes should not be parsed as <th>/<td>
6554 !! wikitext
6555 {|
6556 | <div style="color: red !important;" data-contrived="put this here ||">hi</div>
6557 |}
6558 !! html/php
6559 <table>
6560 <tr>
6561 <td> <div style="color: red !important;" data-contrived="put this here &#124;&#124;">hi</div>
6562 </td></tr></table>
6563
6564 !! html/parsoid
6565 <table>
6566 <tbody><tr><td> <div style="color: red !important;" data-contrived="put this here ||" data-parsoid='{"stx":"html"}'>hi</div></td></tr>
6567 </tbody></table>
6568 !! end
6569
6570 # FIXME: The output seems broken. Filed as T110268.
6571 !! test
6572 ! and || in td attributes should not be parsed as <th>/<td>
6573 !! options
6574 parsoid=wt2html
6575 !! wikitext
6576 {|
6577 | style="color: red !important;" data-contrived="put this here ||" | foo
6578 |}
6579 !! html/php
6580 <table>
6581 <tr>
6582 <td> style="color: red !important;" data-contrived="put this here </td>
6583 <td> foo
6584 </td></tr></table>
6585
6586 !! html/parsoid
6587 <table>
6588 <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>
6589 </tbody></table>
6590 !! end
6591
6592 !! test
6593 Break on | in element attribute in template
6594 !! options
6595 parsoid=wt2html,html2html
6596 !! wikitext
6597 {{echo|1=<div class="hi|ho">ha</div>}}
6598 !! html/php
6599 <p>ho"&gt;ha&lt;/div&gt;
6600 </p>
6601 !! html/parsoid
6602 <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>
6603 !! end
6604
6605 !! test
6606 Break on | in element attribute name in template
6607 !! wikitext
6608 {{echo|<div cla|ss="hiho">ha</div>}}
6609 !! html/parsoid
6610 <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>
6611 !! end
6612
6613 !! test
6614 Don't break on | in extension attribute in template
6615 !! wikitext
6616 {{echo|<ref name="hi|ho">ha</ref>}}
6617
6618 <references />
6619 !! html/parsoid
6620 <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>
6621
6622 <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>
6623 !! end
6624
6625 ## We don't support roundtripping of these attributes in Parsoid.
6626 ## Selective serialization takes care of preventing dirty diffs.
6627 ## But, on edits, we dirty-diff the invalid attribute text.
6628 !! test
6629 Invalid text in table attributes should be discarded
6630 !! options
6631 parsoid=wt2html
6632 !! wikitext
6633 {| <span>boo</span> style='border:1px solid black'
6634 | <span>boo</span> style='color:blue' | 1
6635 |<span>boo</span> style='color:blue'| 2
6636 |}
6637 !! html/php
6638 <table style="border:1px solid black">
6639 <tr>
6640 <td style="color:blue"> 1
6641 </td>
6642 <td style="color:blue"> 2
6643 </td></tr></table>
6644
6645 !! html/parsoid
6646 <table style="border:1px solid black">
6647 <tr>
6648 <td style="color:blue"> 1</td>
6649 <td style="color:blue"> 2</td>
6650 </tr>
6651 </table>
6652 !! end
6653
6654 !! test
6655 Invalid text in table attributes should be preserved by selective serializer
6656 !! options
6657 parsoid={
6658 "modes": ["selser"],
6659 "changes": [
6660 ["td:first-child", "text", "abc"],
6661 ["td + td", "text", "xyz"]
6662 ]
6663 }
6664 !! wikitext
6665 {| <span>boo</span> style='border:1px solid black'
6666 | <span>boo</span> style='color:blue' | 1
6667 |<span>boo</span> style='color:blue'| 2
6668 |}
6669 !! wikitext/edited
6670 {| <span>boo</span> style='border:1px solid black'
6671 | <span>boo</span> style='color:blue' |abc
6672 |<span>boo</span> style='color:blue'|xyz
6673 |}
6674 !! end
6675
6676 !! test
6677 1. Template-generated table cell attributes and cell content
6678 !! wikitext
6679 {|
6680 |{{table_attribs}}
6681 | {{table_attribs}}
6682 || {{table_attribs_5}}
6683 | <!--foo--> <!--bar--> <!--baz--> {{table_attribs}}
6684 |align=center {{table_attribs}}
6685 | <!--foo--> align=center <!--bar--> {{table_attribs}}
6686 |}
6687 !! html
6688 <table>
6689 <tr>
6690 <td style="color:red;">Foo
6691 </td>
6692 <td style="color:red;">Foo
6693 </td>
6694 <td> style="color:red;"</td>
6695 <td>Bar
6696 </td>
6697 <td style="color:red;">Foo
6698 </td>
6699 <td align="center" style="color:red;">Foo
6700 </td>
6701 <td align="center" style="color:red;">Foo
6702 </td></tr></table>
6703
6704 !! end
6705
6706 !! test
6707 2. Template-generated table cell attributes and cell content
6708 !! wikitext
6709 {|
6710 |{{table_attribs_2}}
6711 |}
6712 !! html/php
6713 <table>
6714 <tr>
6715 <td style="color:red;">Foo
6716 </td>
6717 <td>Bar</td>
6718 <td>Baz
6719 </td></tr></table>
6720
6721 !! html/parsoid
6722 <table>
6723 <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>
6724 <td about="#mwt1">Bar</td><td about="#mwt1">Baz</td></tr>
6725 </tbody></table>
6726 !! end
6727
6728 !! test
6729 3. Template-generated table cell attributes and cell content
6730 !! wikitext
6731 {|
6732 !align=center {{table_header_cells}}
6733 |-
6734 |align=center {{table_cells}}
6735 |}
6736 !! html/php
6737 <table>
6738 <tr>
6739 <th align="center" style="color:red;">Foo</th>
6740 <th style="color:red;"><i>Bar</i></th>
6741 <th style="color:brown;"><i>Foo</i> and Baz
6742 </th></tr>
6743 <tr>
6744 <td align="center" style="color:red;">Foo</td>
6745 <td style="color:red;"><i>Bar</i></td>
6746 <td style="color:brown;"><i>Foo</i> and Baz
6747 </td></tr></table>
6748
6749 !! html/parsoid
6750 <table>
6751 <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>
6752 <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>
6753 </tbody></table>
6754 !! end
6755
6756 !! test
6757 4. Template-generated table cell attributes and cell content inside a templated table
6758 !! wikitext
6759 {{tbl-start}}
6760 !align=center {{table_header_cells}}
6761 |-
6762 |align=center {{table_cells}}
6763 {{tbl-end}}
6764 !! html/php
6765 <table>
6766 <tr>
6767 <th align="center" style="color:red;">Foo</th>
6768 <th style="color:red;"><i>Bar</i></th>
6769 <th style="color:brown;"><i>Foo</i> and Baz
6770 </th></tr>
6771 <tr>
6772 <td align="center" style="color:red;">Foo</td>
6773 <td style="color:red;"><i>Bar</i></td>
6774 <td style="color:brown;"><i>Foo</i> and Baz
6775 </td></tr></table>
6776
6777 !! html/parsoid
6778 <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}}]}'>
6779 <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>
6780 <tr>
6781 <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>
6782 </tbody></table>
6783 !! end
6784
6785 ## Edge case fix to prevent future regressions
6786 !! test
6787 T107652: <ref>s in templates that also generate table cell attributes should be rendered properly
6788 !! wikitext
6789 {|
6790 |{{table_attribs_7}}
6791 |}
6792 <references />
6793 !! html/parsoid
6794 <table>
6795 <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>
6796 </tbody></table>
6797 <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>
6798 !! end
6799
6800 !! test
6801 Table with row followed by newlines and table heading
6802 !! options
6803 parsoid=wt2html,html2html
6804 !! wikitext
6805 {|
6806 |-
6807
6808 ! foo
6809 |}
6810 !! html/*
6811 <table>
6812
6813
6814 <tr>
6815 <th> foo
6816 </th></tr></table>
6817
6818 !! end
6819
6820 !! test
6821 Table with empty line following the start tag
6822 !! options
6823 parsoid=wt2html,html2html
6824 !! wikitext
6825 {|
6826
6827 |-
6828 | foo
6829 |}
6830 !! html/*
6831 <table>
6832
6833
6834 <tr>
6835 <td> foo
6836 </td></tr></table>
6837
6838 !! end
6839
6840 !! test
6841 Table attributes with empty value
6842 !! options
6843 parsoid=wt2html,html2html
6844 !! wikitext
6845 {|
6846 | style=| hello
6847 |}
6848 !! html/php
6849 <table>
6850 <tr>
6851 <td style=""> hello
6852 </td></tr></table>
6853
6854 !! html/parsoid
6855 <table>
6856 <tbody><tr><td style=""> hello</td></tr>
6857 </tbody></table>
6858 !! end
6859
6860 !! test
6861 Wikitext table with a lot of comments
6862 !! wikitext
6863 {|
6864 <!-- c0 -->
6865 | foo
6866 <!-- c1 -->
6867 |-<!-- c2 -->
6868 <!-- c3 -->
6869 |<!-- c4 -->
6870 <!-- c5 -->
6871 |}
6872 !! html
6873 <table>
6874 <tr>
6875 <td> foo
6876 </td></tr>
6877 <tr>
6878 <td>
6879 </td></tr></table>
6880
6881 !! end
6882
6883 !! test
6884 Wikitext table comments represented in parsoid dom
6885 !! wikitext
6886 {|<!--c1--><!--c2-->
6887 |-<!--c3-->
6888 | x
6889 |}
6890 !! html/php+tidy
6891 <table>
6892 <tr>
6893 <td>x</td>
6894 </tr>
6895 </table>
6896 !! html/parsoid
6897 <table><!--c1--><!--c2-->
6898 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'><!--c3-->
6899 <td data-parsoid='{"autoInsertedEnd":true}'> x</td></tr>
6900 </tbody></table>
6901 !! end
6902
6903 !! test
6904 Wikitext table with double-line table cell
6905 !! wikitext
6906 {|
6907 |a
6908 b
6909 |}
6910 !! html
6911 <table>
6912 <tr>
6913 <td>a
6914 <p>b
6915 </p>
6916 </td></tr></table>
6917
6918 !! end
6919
6920 !! test
6921 Table cell with a single comment
6922 !! wikitext
6923 {|
6924 | <!-- c1 -->
6925 | a
6926 |}
6927 !! html
6928 <table>
6929 <tr>
6930 <td>
6931 </td>
6932 <td> a
6933 </td></tr></table>
6934
6935 !! end
6936
6937 !! test
6938 Table-cell after a comment-only-empty-line
6939 !! wikitext
6940 {|
6941 |a
6942 <!--c1-->
6943 <!--c2-->| b
6944 |}
6945 !! html
6946 <table>
6947 <tr>
6948 <td>a
6949 </td>
6950 <td> b
6951 </td></tr></table>
6952
6953 !! html/parsoid
6954 <table>
6955 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>a</td>
6956 <!--c1-->
6957 <!--c2--><td data-parsoid='{"autoInsertedEnd":true}'> b</td></tr>
6958 </tbody></table>
6959
6960 !! end
6961
6962 !! test
6963 Build table with {{!}}
6964 !! wikitext
6965 {{{!}} class="wikitable"
6966 ! header
6967 ! second header
6968 {{!}}- style="color:red;"
6969 {{!}} data {{!}}{{!}} style="color:red;" {{!}} second data
6970 {{!}}}
6971 !! html
6972 <table class="wikitable">
6973 <tr>
6974 <th> header
6975 </th>
6976 <th> second header
6977 </th></tr>
6978 <tr style="color:red;">
6979 <td> data </td>
6980 <td style="color:red;"> second data
6981 </td></tr></table>
6982
6983 !! end
6984
6985 !! test
6986 Build table with pipe as data
6987 !! wikitext
6988 {| class="wikitable"
6989 ! header
6990 ! second header
6991 |- style="color:red;"
6992 | data || style="color:red;" | second data
6993 |-
6994 | style="color:red;" | data with | || style="color:red;" | second data with |
6995 |-
6996 || data with | ||| second data with |
6997 |}
6998 !! html
6999 <table class="wikitable">
7000 <tr>
7001 <th> header
7002 </th>
7003 <th> second header
7004 </th></tr>
7005 <tr style="color:red;">
7006 <td> data </td>
7007 <td style="color:red;"> second data
7008 </td></tr>
7009 <tr>
7010 <td style="color:red;"> data with | </td>
7011 <td style="color:red;"> second data with |
7012 </td></tr>
7013 <tr>
7014 <td> data with | </td>
7015 <td> second data with |
7016 </td></tr></table>
7017
7018 !! end
7019
7020 !! test
7021 Build table with wikilink
7022 !! wikitext
7023 {| class="wikitable"
7024 ! header || second header
7025 |- style="color:red;"
7026 | data [[Main Page|linktext]] || second data [[Main Page|linktext]]
7027 |-
7028 | data || second data [[Main Page|link|text with pipe]]
7029 |}
7030 !! html
7031 <table class="wikitable">
7032 <tr>
7033 <th> header </th>
7034 <th> second header
7035 </th></tr>
7036 <tr style="color:red;">
7037 <td> data <a href="/wiki/Main_Page" title="Main Page">linktext</a> </td>
7038 <td> second data <a href="/wiki/Main_Page" title="Main Page">linktext</a>
7039 </td></tr>
7040 <tr>
7041 <td> data </td>
7042 <td> second data <a href="/wiki/Main_Page" title="Main Page">link|text with pipe</a>
7043 </td></tr></table>
7044
7045 !! end
7046
7047 # The expected HTML structure in this test is debatable. The PHP parser does
7048 # not parse this kind of table at all. The main focus for Parsoid is on
7049 # round-tripping, so this output is ok for now. TODO: revisit!
7050 !! test
7051 Wikitext table with html-syntax row
7052 !! wikitext
7053 {|
7054 |-
7055 <td>foo</td>
7056 |}
7057 !! html/parsoid
7058 <table>
7059 <tbody>
7060 <tr>
7061 <td>foo</td></tr></tbody></table>
7062 !! end
7063
7064 !! test
7065 Implicit <td> after a |-
7066 !! options
7067 parsoid=wt2html,html2html
7068 !! wikitext
7069 {|
7070 |-
7071 a
7072 |}
7073 !! html/php
7074 <table>
7075
7076 a
7077 </table>
7078
7079 !! html/php+tidy
7080 <p>a</p>
7081 !! html/parsoid
7082 <p data-parsoid='{"fostered":true,"autoInsertedEnd":true}'>a</p><table>
7083 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
7084
7085 </tr></tbody></table>
7086 !! end
7087
7088 !! test
7089 Lists should be recognized in an implicit <td> context
7090 !! options
7091 parsoid=wt2html,html2html
7092 !! wikitext
7093 {|
7094 |-
7095 *a
7096 |}
7097 !! html/php
7098 <table>
7099
7100 <ul><li>a</li></ul>
7101 </table>
7102
7103 !! html/php+tidy
7104 <ul>
7105 <li>a</li>
7106 </ul>
7107 !! html/parsoid
7108 <ul data-parsoid='{"fostered":true,"autoInsertedEnd":true}'><li>a</li></ul><table>
7109 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
7110
7111 </tr></tbody></table>
7112 !! end
7113
7114 !! test
7115 Table cells not properly parsed in an implicit-td context
7116 !! wikitext
7117 {|
7118 |-
7119 {{table_attribs_4}} || a || b
7120 |}
7121 !! html/php+tidy
7122 <table>
7123 <tr>
7124 <td style="background-color:#DC241f;" width="10px"></td>
7125 <td>a</td>
7126 <td>b</td>
7127 </tr>
7128 </table>
7129 !! html/parsoid
7130 <table>
7131 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
7132 <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>
7133 !! end
7134
7135 !! test
7136 Parsoid: Round-trip tables directly followed by content (T53219)
7137 !! options
7138 parsoid=wt2html,wt2wt
7139 !! wikitext
7140 {|
7141 |foo
7142 |} bar
7143
7144 {|
7145 |baz
7146 |}<b>quux</b>
7147 !! html+tidy
7148 <table>
7149 <tr>
7150 <td>foo</td>
7151 </tr>
7152 </table>
7153 <p>bar</p>
7154 <table>
7155 <tr>
7156 <td>baz</td>
7157 </tr>
7158 </table>
7159 <p><b>quux</b></p>
7160 !! end
7161
7162 !! test
7163 Parsoid: Default to a newline after tables in new content (T53219)
7164 !! options
7165 parsoid=html2wt
7166 !! html/parsoid
7167 <table><tbody>
7168 <tr><td>foo</td></tr></tbody></table> bar
7169 <table><tbody>
7170 <tr><td>baz</td></tr></tbody></table><b>quux</b>
7171 !! wikitext
7172 {|
7173 |foo
7174 |}
7175 <nowiki> </nowiki>bar
7176 {|
7177 |baz
7178 |}
7179 '''quux'''
7180 !! end
7181
7182 !! test
7183 Parsoid: newline inducing block nodes don't suppress <nowiki>
7184 !! options
7185 parsoid=html2wt
7186 !! html/parsoid
7187 a<h1>foo</h1>
7188 !! wikitext
7189 <nowiki> </nowiki>a
7190
7191 = foo =
7192 !! end
7193
7194 !! test
7195 Parsoid: Row-syntax table headings followed by comment & table cells
7196 !! options
7197 parsoid=wt2html,wt2wt
7198 !! wikitext
7199 {|
7200 ! foo || bar
7201 <!-- foo --> || baz || quux
7202 |}
7203 !! html/php
7204 <table>
7205 <tr>
7206 <th> foo </th>
7207 <th> bar
7208 </th>
7209 <td> baz </td>
7210 <td> quux
7211 </td></tr></table>
7212
7213 !! html/parsoid
7214 <table>
7215 <tbody><tr><th> foo </th><th> bar
7216 <!-- foo --> </th><td> baz </td><td> quux</td></tr>
7217 </tbody></table>
7218 !! end
7219
7220 !!test
7221 Parsoid: Recover better from broken table attributes
7222 !!options
7223 parsoid=wt2html
7224 !!wikitext
7225 {| class="foo
7226 | class="bar" |
7227 foo
7228 |}
7229 !!html/php+tidy
7230 <table class="foo">
7231 <tr>
7232 <td class="bar">
7233 <p>foo</p>
7234 </td>
7235 </tr>
7236 </table>
7237 !!html/parsoid
7238 <table class="foo">
7239 <tr>
7240 <td class="bar">
7241 <p>foo</p></td></tr>
7242 </tbody></table>
7243 !!end
7244
7245 !! test
7246 Tables: Digest broken attributes on table and tr tag
7247 !! options
7248 parsoid=wt2html
7249 !! wikitext
7250 {| || |} ++
7251 |- || || ++ --
7252 |- > [
7253 |}
7254 !! html
7255 <table>
7256 <tbody>
7257 <tr></tr>
7258 <tr></tr>
7259 </tbody></table>
7260 !! end
7261
7262 # T137406: Whitespace in the HTML
7263 !! test
7264 1. Generate correct wikitext for tables with thead/tbody/tfoot
7265 !! options
7266 parsoid=html2wt
7267 !! html/parsoid
7268 <table>
7269 <caption>Test</caption>
7270 <thead>
7271 <tr>
7272 <th>Month</th>
7273 <th>Savings</th>
7274 </tr>
7275 </thead>
7276 <tbody>
7277 <tr>
7278 <td>January</td>
7279 <td>$100</td>
7280 </tr>
7281 <tr>
7282 <td>February</td>
7283 <td>$80</td>
7284 </tr>
7285 </tbody>
7286 <tfoot>
7287 <tr>
7288 <td>Sum</td>
7289 <td>$180</td>
7290 </tr>
7291 </tfoot>
7292 </table>
7293 !! wikitext
7294 {|
7295 |+Test
7296 !Month
7297 !Savings
7298 |-
7299 |January
7300 |$100
7301 |-
7302 |February
7303 |$80
7304 |-
7305 |Sum
7306 |$180
7307 |}
7308 !! html/php+tidy
7309 <table>
7310 <caption>Test</caption>
7311 <tr>
7312 <th>Month</th>
7313 <th>Savings</th>
7314 </tr>
7315 <tr>
7316 <td>January</td>
7317 <td>$100</td>
7318 </tr>
7319 <tr>
7320 <td>February</td>
7321 <td>$80</td>
7322 </tr>
7323 <tr>
7324 <td>Sum</td>
7325 <td>$180</td>
7326 </tr>
7327 </table>
7328 !! end
7329
7330 # T137406: No whitespace in the HTML
7331 !! test
7332 2. Generate correct wikitext for tables with thead/tbody/tfoot
7333 !! options
7334 parsoid=html2wt
7335 !! html/parsoid
7336 <table><thead><tr><th>heading</th></tr></thead><tbody><tr><td>foo</td></tr></tbody></table>
7337 !! wikitext
7338 {|
7339 !heading
7340 |-
7341 |foo
7342 |}
7343 !! end
7344
7345 !! test
7346 Testing serialization after deletion in references
7347 !! options
7348 parsoid={
7349 "modes": ["wt2wt"],
7350 "changes": [
7351 ["#x", "remove"]
7352 ]
7353 }
7354 !! wikitext
7355 hi <ref><div id="x">ho</div></ref>
7356
7357 <references />
7358 !! wikitext/edited
7359 hi <ref></ref>
7360
7361 <references />
7362 !! end
7363
7364 !!test
7365 Testing serialization after deletion of table cells
7366 !!options
7367 parsoid={
7368 "modes": ["wt2wt", "selser"],
7369 "changes": [
7370 ["#x", "remove"]
7371 ]
7372 }
7373 !!wikitext
7374 {|
7375 !h1 !!h2 !!h3
7376 | id="x" |c1 {{!}}{{!}}{{!}}c2 |||c3
7377 |}
7378 !! wikitext/edited
7379 {|
7380 !h1 !!h2 !!h3
7381 |c2 |||c3
7382 |}
7383 !!end
7384
7385 !! test
7386 Testing selser after addition of new row before first row (T125419)
7387 !! options
7388 parsoid={
7389 "modes": ["wt2wt", "selser"],
7390 "changes": [
7391 [ "tr", "before", "<tr><td>X</td></tr>" ]
7392 ]
7393 }
7394 !! wikitext
7395 {|
7396 |a
7397 |}
7398 !! wikitext/edited
7399 {|
7400 |X
7401 |-
7402 |a
7403 |}
7404 !! end
7405
7406 !! test
7407 Serialize new table rows in a HTML table using HTML tags
7408 !! options
7409 parsoid={
7410 "modes": ["wt2wt", "selser"],
7411 "changes": [
7412 [ "tr", "before", "<tr><td>X</td></tr>" ]
7413 ]
7414 }
7415 !! wikitext
7416 <table><tr><td>a</td></tr></table>
7417 !! wikitext/edited
7418 <table><tr><td>X</td></tr><tr><td>a</td></tr></table>
7419 !! end
7420
7421 !! test
7422 Serialize new table cells in a HTML row using HTML tags
7423 !! options
7424 parsoid={
7425 "modes": ["wt2wt", "selser"],
7426 "changes": [
7427 [ "td", "before", "<td>X</td>" ]
7428 ]
7429 }
7430 !! wikitext
7431 <table><tr><td>a</td></tr></table>
7432 !! wikitext/edited
7433 <table><tr><td>X</td><td>a</td></tr></table>
7434 !! end
7435
7436 !! test
7437 Wikitext tables can be nested inside HTML tables
7438 !! options
7439 parsoid=html2wt
7440 !! html
7441 <table data-parsoid='{"stx":"html"}'>
7442 <tr><td>
7443 <table>
7444 <tr><td>foo</td></tr>
7445 </table>
7446 </td></tr>
7447 </table>
7448 !! wikitext
7449 <table>
7450 <tr><td>
7451 {|
7452 |foo
7453 |}
7454 </td></tr>
7455 </table>
7456 !! end
7457
7458 !! test
7459 Serialize wikitext list items as HTML list items when embedded in a HTML list
7460 !! options
7461 parsoid=html2wt
7462 !! html
7463 <ul data-parsoid='{"stx": "html"}'>
7464 <li data-parsoid='{}'>a</li>
7465 <li>b</li>
7466 </ul>
7467 !! wikitext
7468 <ul>
7469 <li>a</li>
7470 <li>b</li>
7471 </ul>
7472 !! end
7473
7474 # SSS FIXME: Is this actually a good thing given the
7475 # odd nested list output that is generated by MW?
7476 # <ul><li>foo<ul>..</ul></li></ul> instead of
7477 # <ul><li>foo</li><ul>..</ul></ul>
7478 !! test
7479 Wikitext lists can be nested inside HTML lists
7480 !! options
7481 parsoid=html2wt
7482 !! html
7483 <ul data-parsoid='{"stx": "html"}'>
7484 <li data-parsoid='{"stx": "html"}'>a
7485 <ul><li>b</li></ul>
7486 </li>
7487 </ul>
7488
7489 <ul data-parsoid='{"stx": "html"}'>
7490 <li>x
7491 <ul><li>y</li></ul>
7492 </li>
7493 </ul>
7494 !! wikitext
7495 <ul>
7496 <li>a
7497 * b
7498 </li>
7499 </ul>
7500
7501 <ul>
7502 <li>x
7503 * y
7504 </li>
7505 </ul>
7506 !! end
7507
7508 ###
7509 ### Internal links
7510 ###
7511 !! test
7512 Plain link, capitalized
7513 !! wikitext
7514 [[Main Page]]
7515 !! html
7516 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
7517 </p>
7518 !! end
7519
7520 !! test
7521 Plain link, uncapitalized
7522 !! wikitext
7523 [[main Page]]
7524 !! html
7525 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
7526 </p>
7527 !! end
7528
7529 !! test
7530 Piped link
7531 !! wikitext
7532 [[Main Page|The Main Page]]
7533 !! html
7534 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
7535 </p>
7536 !! end
7537
7538 !! test
7539 Piped link with comment in link text
7540 !! wikitext
7541 [[Main Page|The Main<!--front--> Page]]
7542 !! html
7543 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
7544 </p>
7545 !! end
7546
7547 !! test
7548 Piped link with multiple pipe characters in link text
7549 !! wikitext
7550 [[Main Page||The|Main|Page|]]
7551 !! html/php
7552 <p><a href="/wiki/Main_Page" title="Main Page">|The|Main|Page|</a>
7553 </p>
7554 !! html/parsoid
7555 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">|The|Main|Page|</a></p>
7556 !! end
7557
7558 !! test
7559 Piped link with no link text
7560 !! wikitext
7561 [[Thomas Bek (bishop of St David's)|]]
7562 !! html/php
7563 <p>[[Thomas Bek (bishop of St David's)|]]
7564 </p>
7565 !! html/parsoid
7566 <p>[[Thomas Bek (bishop of St David's)|]]</p>
7567 !! end
7568
7569 !! test
7570 Piped link with empty link text
7571 !! wikitext
7572 [[Main Page|<nowiki/>]] - empty nowiki
7573 [[Main Page| ]] - empty space
7574 [[Main Page|&nbsp;]] - empty non breaking space
7575 !! html/php
7576 <p><a href="/wiki/Main_Page" title="Main Page"></a> - empty nowiki
7577 <a href="/wiki/Main_Page" title="Main Page"> </a> - empty space
7578 <a href="/wiki/Main_Page" title="Main Page">&#160;</a> - empty non breaking space
7579 </p>
7580 !! html/parsoid
7581 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page"><span typeof="mw:Nowiki"></span></a> - empty nowiki
7582 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page"> </a> - empty space
7583 <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>
7584 !! end
7585
7586 !! test
7587 Broken link
7588 !! wikitext
7589 [[Zigzagzogzagzig]]
7590 !! html
7591 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
7592 </p>
7593 !! end
7594
7595 !! test
7596 Broken link with fragment
7597 !! wikitext
7598 [[Zigzagzogzagzig#zug]]
7599 !! html
7600 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
7601 </p>
7602 !! end
7603
7604 !! test
7605 Special page link with fragment
7606 !! wikitext
7607 [[Special:Version#anchor]]
7608 !! html
7609 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
7610 </p>
7611 !! end
7612
7613 !! test
7614 Nonexistent special page link with fragment
7615 !! wikitext
7616 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
7617 !! html
7618 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
7619 </p>
7620 !! end
7621
7622 !! test
7623 Link with prefix
7624 !! wikitext
7625 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
7626 !! html
7627 <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>
7628 </p>
7629 !! end
7630
7631 !! test
7632 Link with suffix
7633 !! wikitext
7634 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
7635 !! html
7636 <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>!!!
7637 </p>
7638 !! end
7639
7640 !! article
7641 prefixed article
7642 !! text
7643 Some text
7644 !! endarticle
7645
7646 !! test
7647 T45661: Piped links with identical prefixes
7648 !! wikitext
7649 [[prefixed article|prefixed articles with spaces]]
7650
7651 [[prefixed article|prefixed articlesaoeu]]
7652
7653 [[Main Page|Main Page test]]
7654 !! html
7655 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
7656 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
7657 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
7658 </p>
7659 !! end
7660
7661
7662 !! test
7663 Link with HTML entity in suffix / tail
7664 !! wikitext
7665 [[Main Page]]&quot;, [[Main Page]]&#97;
7666 !! html/php
7667 <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;
7668 </p>
7669 !! html/parsoid
7670 <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>
7671 !! end
7672
7673 !! test
7674 Link with 3 brackets
7675 !! wikitext
7676 [[[Main Page]]]
7677 Foo [[[Main Page]]]
7678 !! html
7679 <p>[[[Main Page]]]
7680 Foo [[[Main Page]]]
7681 </p>
7682 !! end
7683
7684 !! test
7685 Link with 4 brackets
7686 !! wikitext
7687 [[[[Main Page]]]]
7688 !! html
7689 <p>[[<a href="/wiki/Main_Page" title="Main Page">Main Page</a>]]
7690 </p>
7691 !! end
7692
7693 !! test
7694 Piped link with 3 brackets
7695 !! wikitext
7696 [[[main page|the main page]]]
7697 !! html
7698 <p>[[[main page|the main page]]]
7699 </p>
7700 !! end
7701
7702 !! test
7703 Piped link with extlink-like text
7704 !! wikitext
7705 [[Main Page|[bar]]]
7706 [[Main Page|This is a [bar]]]
7707 !! html/php
7708 <p><a href="/wiki/Main_Page" title="Main Page">[bar]</a>
7709 <a href="/wiki/Main_Page" title="Main Page">This is a [bar]</a>
7710 </p>
7711 !! html/parsoid
7712 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>[bar]</a>
7713 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>This is a [bar]</a></p>
7714 !! end
7715
7716 !! test
7717 Link with multiple pipes
7718 !! wikitext
7719 [[Main Page|The|Main|Page]]
7720 !! html
7721 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
7722 </p>
7723 !! end
7724
7725 !! test
7726 Anchor containing a #. (T65430)
7727 !! wikitext
7728 [[Main Page#And#Link]]
7729 !! html/php
7730 <p><a href="/wiki/Main_Page#And.23Link" title="Main Page">Main Page#And#Link</a>
7731 </p>
7732 !! html/parsoid
7733 <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>
7734 !! end
7735
7736 !! test
7737 Link to namespaces
7738 !! wikitext
7739 [[Talk:Parser testing]], [[Meta:Disclaimers]]
7740 !! html
7741 <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>
7742 </p>
7743 !! end
7744
7745 !! test
7746 Link with space in namespace
7747 !! wikitext
7748 [[User talk:Foo bar]]
7749 !! html
7750 <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>
7751 </p>
7752 !! end
7753
7754 !! article
7755 MemoryAlpha:AlphaTest
7756 !! text
7757 This is an article in the MemoryAlpha namespace
7758 (which shadows the memoryalpha interwiki link).
7759 !! endarticle
7760
7761 !! test
7762 Namespace takes precedence over interwiki link (T53680)
7763 !! wikitext
7764 [[MemoryAlpha:AlphaTest]]
7765 !! html
7766 <p><a href="/wiki/MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
7767 </p>
7768 !! end
7769
7770 # The previous test doesn't work correctly in html2*, due to not recognizing the
7771 # link as an internal one. This one checks for the correct behavior.
7772 !! test
7773 Link to namespace preferred over interwiki with correct rel attribute
7774 !! options
7775 parsoid=html2wt,html2html
7776 !! html/parsoid
7777 <p><a rel="mw:WikiLink" href="./MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a></p>
7778 !! wikitext
7779 [[MemoryAlpha:AlphaTest]]
7780 !! end
7781
7782 !! test
7783 Piped link to namespace
7784 !! wikitext
7785 [[Meta:Disclaimers|The disclaimers]]
7786 !! html
7787 <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>
7788 </p>
7789 !! end
7790
7791 !! test
7792 Link containing }
7793 !! wikitext
7794 [[Usually caused by a typo (oops}]]
7795 !! html
7796 <p>[[Usually caused by a typo (oops}]]
7797 </p>
7798 !! end
7799
7800 !! article
7801 7% Solution
7802 !! text
7803 Just a test of an article title containing a percent.
7804 !! endarticle
7805
7806 !! test
7807 Link containing % (not as a hex sequence)
7808 !! wikitext
7809 [[7% Solution]]
7810 [[7% Solution|7%25 Solution]]
7811 !! html/php
7812 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
7813 <a href="/wiki/7%25_Solution" title="7% Solution">7%25 Solution</a>
7814 </p>
7815 !! html/parsoid
7816 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a>
7817 <a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7%25 Solution</a></p>
7818 !! end
7819
7820 # note that the parsoid HTML is identical to the previous test output,
7821 # so the previous test ensures that the html2wt mode will generate the
7822 # "not as a hex sequence" wikitext.
7823 !! test
7824 Link containing % as a single hex sequence interpreted to char
7825 !! options
7826 parsoid=wt2wt,wt2html,html2html
7827 !! wikitext
7828 [[7%25 Solution]]
7829 [[7%25 Solution|7%25 Solution]]
7830 !! html/php
7831 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
7832 <a href="/wiki/7%25_Solution" title="7% Solution">7%25 Solution</a>
7833 </p>
7834 !! html/parsoid
7835 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a>
7836 <a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7%25 Solution</a></p>
7837 !!end
7838
7839 !! test
7840 Link containing % as a double hex sequence interpreted to hex sequence
7841 !! wikitext
7842 [[7%2525 Solution]]
7843 !! html
7844 <p>[[7%2525 Solution]]
7845 </p>
7846 !!end
7847
7848 ## Example for such a section: == < ==
7849 !! test
7850 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
7851 !! wikitext
7852 [[%23%3c]][[%23%3e]]
7853 !! html/php
7854 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
7855 </p>
7856 !! html/parsoid
7857 <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>
7858 !! end
7859
7860 !! test
7861 Link containing "<#" and ">#" as a hex sequences
7862 !! wikitext
7863 [[%3c%23]][[%3e%23]]
7864 !! html
7865 <p>[[%3c%23]][[%3e%23]]
7866 </p>
7867 !! end
7868
7869 !! test
7870 Link containing an equals sign
7871 !! wikitext
7872 [[Special:BookSources/isbn=4-00-026157-6]]
7873 !! html/php
7874 <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>
7875 </p>
7876 !! html/parsoid
7877 <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>
7878 !! end
7879
7880 !! article
7881 Foo~bar
7882 !! text
7883 Just a test of an article title containing a tilde.
7884 !! endarticle
7885
7886 # note that links containing signatures, like [[Foo~~~~]], are
7887 # massaged by the pre-save transform (PST) and so the tildes are never
7888 # seen by the parser.
7889 !! test
7890 Link containing a tilde
7891 !! wikitext
7892 [[Foo~bar]]
7893 !! html/php
7894 <p><a href="/wiki/Foo~bar" title="Foo~bar">Foo~bar</a>
7895 </p>
7896 !! html/parsoid
7897 <p><a rel="mw:WikiLink" href="./Foo~bar" title="Foo~bar">Foo~bar</a></p>
7898 !! end
7899
7900 !! test
7901 Link containing double-single-quotes '' (T6598)
7902 !! wikitext
7903 [[Lista d''e paise d''o munno]]
7904 !! html/php
7905 <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>
7906 </p>
7907 !! html/parsoid
7908 <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>
7909 !! end
7910
7911 !! test
7912 Link containing double quotes and spaces
7913 !! wikitext
7914 [[Cool "Gator"]]
7915 !! html/php
7916 <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>
7917 </p>
7918 !! html/parsoid
7919 <p><a rel="mw:WikiLink" href="./Cool_%22Gator%22" title='Cool "Gator"'>Cool "Gator"</a></p>
7920 !! end
7921
7922 !! test
7923 File containing double quotes and spaces
7924 !! wikitext
7925 [[File:Cool "Gator".png]]
7926 !! html/parsoid
7927 <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>
7928 !! end
7929
7930 !! test
7931 Redirect containing double quotes and spaces
7932 !! wikitext
7933 #REDIRECT [[Cool "Gator"]]
7934 !! html/parsoid
7935 <link rel="mw:PageProp/redirect" href="./Cool_%22Gator%22" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Cool_%22Gator%22"},"sa":{"href":"Cool \"Gator\""}}'/>
7936 !! end
7937
7938 !! test
7939 Link containing double-single-quotes '' in text (T6598 sanity check)
7940 !! wikitext
7941 Some [[Link|pretty ''italics'' and stuff]]!
7942 !! html/php
7943 <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>!
7944 </p>
7945 !! html/parsoid
7946 <p>Some <a rel="mw:WikiLink" href="./Link" title="Link">pretty <i>italics</i> and stuff</a>!</p>
7947 !! end
7948
7949 !! test
7950 Link containing double-single-quotes '' in text embedded in italics (T6598 sanity check)
7951 !! wikitext
7952 ''Some [[Link|pretty ''italics'' and stuff]]!''
7953 !! html
7954 <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>
7955 </p>
7956 !! end
7957
7958 !! test
7959 Link with double quotes in title part (literal) and alternate part (interpreted)
7960 !! wikitext
7961 [[File:Denys_Savchenko_''Pentecoste''.jpg]]
7962
7963 [[''Pentecoste'']]
7964
7965 [[''Pentecoste''|Pentecoste]]
7966
7967 [[''Pentecoste''|''Pentecoste'']]
7968 !! html/php
7969 <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>
7970 </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>
7971 </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>
7972 </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>
7973 </p>
7974 !! html/parsoid
7975 <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>
7976 <p><a rel="mw:WikiLink" href="./''Pentecoste''" title="''Pentecoste''">''Pentecoste''</a></p>
7977 <p><a rel="mw:WikiLink" href="./''Pentecoste''" title="''Pentecoste''">Pentecoste</a></p>
7978 <p><a rel="mw:WikiLink" href="./''Pentecoste''" title="''Pentecoste''"><i>Pentecoste</i></a></p>
7979 !! end
7980
7981 !! test
7982 Broken image links with HTML captions (T41700)
7983 !! wikitext
7984 [[File:Nonexistent|<script></script>]]
7985 [[File:Nonexistent|100x100px|<script></script>]]
7986 [[File:Nonexistent|&lt;]]
7987 [[File:Nonexistent|a<i>b</i>c]]
7988 !! html/php
7989 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
7990 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
7991 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
7992 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
7993 </p>
7994 !! html/parsoid
7995 <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>
7996 <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>
7997 <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>
7998 <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>
7999 !! end
8000
8001 !! test
8002 Plain link to URL
8003 !! wikitext
8004 [[http://www.example.com]]
8005 !! html/php
8006 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
8007 </p>
8008 !! html/parsoid
8009 <p>[<a rel="mw:ExtLink" href="http://www.example.com"></a>]</p>
8010 !! end
8011
8012 !! test
8013 Plain link to URL with link text
8014 !! wikitext
8015 [[http://www.example.com Link text]]
8016 !! html
8017 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
8018 </p>
8019 !! end
8020
8021 !! test
8022 Plain link to protocol-relative URL
8023 !! wikitext
8024 [[//www.example.com]]
8025 !! html/php
8026 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
8027 </p>
8028 !! html/parsoid
8029 <p>[<a rel="mw:ExtLink" href="//www.example.com"></a>]</p>
8030 !! end
8031
8032 !! test
8033 Plain link to protocol-relative URL with link text
8034 !! wikitext
8035 [[//www.example.com Link text]]
8036 !! html
8037 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
8038 </p>
8039 !! end
8040
8041 !! test
8042 Plain link to page with question mark in title
8043 !! wikitext
8044 [[A?b]]
8045
8046 [[A?b|Baz]]
8047 !! html
8048 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
8049 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
8050 </p>
8051 !! end
8052
8053
8054 # I'm fairly sure the expected result here is wrong.
8055 # We want these to be URL links, not pseudo-pages with URLs for titles....
8056 # However the current output is also pretty screwy.
8057 #
8058 # ----
8059 # I'm changing it to match the current output--it arguably makes more
8060 # sense in the light of the test above. Old expected result was:
8061 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
8062 #</p>
8063 # But I think this test is bordering on "garbage in, garbage out" anyway.
8064 # -- wtm
8065 !! test
8066 Piped link to URL
8067 !! wikitext
8068 Piped link to URL: [[http://www.example.com|an example URL]]
8069 !! html/php
8070 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
8071 </p>
8072 !! html/parsoid
8073 <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>
8074 !! end
8075
8076 !! test
8077 T2002: [[page|http://url/]] should link to page, not http://url/
8078 !! wikitext
8079 [[Main Page|http://url/]]
8080 !! html/php
8081 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
8082 </p>
8083 !! html/parsoid
8084 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">http://url/</a></p>
8085 !! end
8086
8087 # Parsoid does not mark self-links, by design.
8088 !! test
8089 T2337: Escaped self-links should be bold
8090 !! options
8091 title=[[Bug462]]
8092 !! wikitext
8093 [[Bu&#103;462]] [[Bug462]]
8094 !! html/php
8095 <p><a class="mw-selflink selflink">Bu&#103;462</a> <a class="mw-selflink selflink">Bug462</a>
8096 </p>
8097 !! html/php+tidy
8098 <p><a class="mw-selflink selflink">Bug462</a> <a class="mw-selflink selflink">Bug462</a></p>
8099 !! html/parsoid
8100 <p><a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a> <a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a></p>
8101 !! end
8102
8103 !! test
8104 Self-link to section should not be bold
8105 !! options
8106 title=[[Main Page]]
8107 !! wikitext
8108 [[Main Page#section]]
8109 !! html
8110 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
8111 </p>
8112 !! end
8113
8114 !! article
8115 00
8116 !! text
8117 This is 00.
8118 !! endarticle
8119
8120 !!test
8121 Self-link to numeric title
8122 !!options
8123 title=[[0]]
8124 !! wikitext
8125 [[0]]
8126 !! html
8127 <p><a class="mw-selflink selflink">0</a>
8128 </p>
8129 !!end
8130
8131 !!test
8132 Link to numeric-equivalent title
8133 !!options
8134 title=[[0]]
8135 !! wikitext
8136 [[00]]
8137 !! html
8138 <p><a href="/wiki/00" title="00">00</a>
8139 </p>
8140 !!end
8141
8142 !! test
8143 <nowiki> inside a link
8144 !! wikitext
8145 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
8146 !! html
8147 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
8148 </p>
8149 !! end
8150
8151 !! test
8152 Non-breaking spaces in title
8153 !! wikitext
8154 [[&nbsp; Main &nbsp; Page &nbsp;]]
8155 !! html
8156 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
8157 </p>
8158 !!end
8159
8160 !! test
8161 Internal link with ca linktrail, surrounded by bold apostrophes (T29473 primary issue)
8162 !! options
8163 language=ca
8164 !! wikitext
8165 '''[[Main Page]]'''
8166 !! html
8167 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
8168 </p>
8169 !! end
8170
8171 !! test
8172 Internal link with ca linktrail, surrounded by italic apostrophes (T29473 primary issue)
8173 !! options
8174 language=ca
8175 !! wikitext
8176 ''[[Main Page]]''
8177 !! html
8178 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
8179 </p>
8180 !! end
8181
8182 !! test
8183 Internal link with en linktrail: no apostrophes (T29473)
8184 !! options
8185 language=en
8186 !! wikitext
8187 [[Something]]'nice
8188 !! html
8189 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
8190 </p>
8191 !! end
8192
8193 !! test
8194 Internal link with ca linktrail with apostrophes (T29473)
8195 !! options
8196 language=ca
8197 !! wikitext
8198 [[Something]]'nice
8199 !! html
8200 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
8201 </p>
8202 !! end
8203
8204 !! test
8205 Internal link with kaa linktrail with apostrophes (T29473)
8206 !! options
8207 language=kaa
8208 !! wikitext
8209 [[Something]]'nice
8210 !! html
8211 <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>
8212 </p>
8213 !! end
8214
8215 !! test
8216 Link with multiple ":" in a subpage-supporting namespace (T65636)
8217 !! wikitext
8218 [[User:Foo/Test/63636:Bar|Test]]
8219 !! html/php
8220 <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>
8221 </p>
8222 !! html/parsoid
8223 <p><a rel="mw:WikiLink" href="./User:Foo/Test/63636:Bar" title="User:Foo/Test/63636:Bar">Test</a></p>
8224 !! end
8225
8226 ## Mainly a sanity check for Parsoid
8227 !! test
8228 Handle title parsing for subpages
8229 !! options
8230 title=[[/123123]]
8231 subpage
8232 !! wikitext
8233 123
8234 !! html/php
8235 <p>123
8236 </p>
8237 !! html/parsoid
8238 <p>123</p>
8239 !! end
8240
8241 !! article
8242 User:Test/123
8243 !! text
8244 test 123
8245 !! endarticle
8246
8247 !! test
8248 Link to a subpage from a namespace other than main
8249 !! options
8250 title=[[User:Test]]
8251 subpage
8252 !! wikitext
8253 [[/123]]
8254 !! html/php
8255 <p><a href="/wiki/User:Test/123" title="User:Test/123">/123</a>
8256 </p>
8257 !! html/parsoid
8258 <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>
8259 !! end
8260
8261 !! test
8262 Ensure that transclusion titles are not url-decoded
8263 !! options
8264 subpage title=[[Test]]
8265 parsoid=wt2html
8266 !! wikitext
8267 {{Bar%C3%A9}} {{/Bar%C3%A9}}
8268 !! html/php
8269 <p>{{Bar%C3%A9}} {{/Bar%C3%A9}}
8270 </p>
8271 !! html/parsoid
8272 <p>{{Bar%C3%A9}} {{/Bar%C3%A9}}</p>
8273 !! end
8274
8275 !! test
8276 Purely hash wikilink
8277 !! options
8278 title=[[User:Test/123]]
8279 subpage
8280 !! wikitext
8281 [[#a|b]]
8282 !! html/php
8283 <p><a href="#a">b</a>
8284 </p>
8285 !! html/parsoid
8286 <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>
8287 !! end
8288
8289 !! test
8290 1. Interaction of linktrail and template encapsulation
8291 !! wikitext
8292 {{echo|[[Foo]]}}l
8293 !! html/parsoid
8294 <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>
8295 !! end
8296
8297 !! test
8298 2. Interaction of linktrail and template encapsulation
8299 !! options
8300 parsoid
8301 !! wikitext
8302 {{echo|Some [[Fool]]}}s
8303 !! html
8304 <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>
8305 !! end
8306
8307 !! test
8308 3. Interaction of linktrail and template encapsulation
8309 !! options
8310 parsoid
8311 !! wikitext
8312 {{echo|Some [[Fool]]s are '''bold and foolish'''}}
8313 !! html
8314 <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>
8315 !! end
8316
8317 !! article
8318 Söfnuður
8319 !! text
8320 Test.
8321 !! endarticle
8322
8323 !! test
8324 Internal link with is link prefix
8325 !! options
8326 language=is
8327 !! wikitext
8328 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
8329 !! html
8330 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
8331 </p>
8332 !! end
8333
8334 !! article
8335 Mótmælendatrú
8336 !! text
8337 Test.
8338 !! endarticle
8339
8340 !! test
8341 Internal link with is link trail and link prefix
8342 !! options
8343 language=is
8344 !! wikitext
8345 [[mótmælendatrú|xxx]]ar
8346 [[mótmælendatrú]]ar
8347 mótmælenda[[söfnuður]]
8348 mótmælenda[[söfnuður|söfnuðir]]
8349 mótmælenda[[söfnuður|söfnuðir]]xxx
8350 !! html
8351 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
8352 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
8353 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
8354 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
8355 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
8356 </p>
8357 !! end
8358
8359 !! test
8360 Parsoid link trail escaping
8361 !! options
8362 parsoid=html2wt,html2html
8363 !! html/parsoid
8364 <p><a rel="mw:WikiLink" href="./Apple" title="Apple">apple</a>s</p>
8365 !! wikitext
8366 [[apple]]<nowiki/>s
8367 !! end
8368
8369 !! test
8370 Parsoid link prefix escaping
8371 !! options
8372 language=is
8373 parsoid=html2wt,html2html
8374 !! html/parsoid
8375 <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="./Söfnuður" title="Söfnuður">söfnuður</a></p>
8376 !! wikitext
8377 Aðrir mótmælenda<nowiki/>[[söfnuður]]
8378 !! end
8379
8380 !! test
8381 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
8382 !! wikitext
8383 [[Foo| bar]]
8384
8385 [[Foo| ''bar'']]
8386
8387 [http://wp.org foo]
8388
8389 [http://wp.org ''foo'']
8390 !! html
8391 <p><a href="/wiki/Foo" title="Foo"> bar</a>
8392 </p><p><a href="/wiki/Foo" title="Foo"> <i>bar</i></a>
8393 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
8394 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
8395 </p>
8396 !! end
8397
8398 !! test
8399 Parsoid: Scoped parsing should handle mixed transclusions and plain text
8400 !! wikitext
8401 [[Foo|{{echo|a}} b {{echo|c}}]]
8402 !! html/parsoid
8403 <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>
8404 !! end
8405
8406 !! test
8407 Link with angle bracket after anchor
8408 !! wikitext
8409 [[Foo#<bar>]]
8410 !! html/php
8411 <p><a href="/wiki/Foo#.3Cbar.3E" title="Foo">Foo#&lt;bar&gt;</a>
8412 </p>
8413 !! html/parsoid
8414 <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>
8415 !! end
8416
8417 ###
8418 ### Interwiki links (see maintenance/interwiki.sql)
8419 ###
8420
8421 !! test
8422 Inline interwiki link
8423 !! options
8424 parsoid=wt2html,wt2wt,html2html
8425 !! wikitext
8426 [[MeatBall:SoftSecurity]]
8427 !! html/php
8428 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
8429 </p>
8430 !! html/parsoid
8431 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a></p>
8432 !! end
8433
8434 !! test
8435 Inline interwiki link with empty title (T4372)
8436 !! options
8437 parsoid=wt2html,wt2wt,html2html
8438 !! wikitext
8439 [[MeatBall:]]
8440 !! html/php
8441 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
8442 </p>
8443 !! html/parsoid
8444 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?" title="meatball:">MeatBall:</a></p>
8445 !! end
8446
8447 !! test
8448 Interwiki link encoding conversion (T3636)
8449 !! wikitext
8450 *[[Wikipedia:ro:Olteni&#0355;a]]
8451 *[[Wikipedia:ro:Olteni&#355;a]]
8452 !! html
8453 <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>
8454 <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>
8455
8456 !! html+tidy
8457 <ul>
8458 <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>
8459 <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>
8460 </ul>
8461 !! end
8462
8463 !! test
8464 Interwiki link with fragment (T4130)
8465 !! wikitext
8466 [[MeatBall:SoftSecurity#foo]]
8467 !! html
8468 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
8469 </p>
8470 !! end
8471
8472 !! test
8473 Link scenarios with escaped fragments
8474 !! wikitext
8475 [[#Is this great?]]
8476 [[Foo#Is this great?]]
8477 [[meatball:Foo#Is this great?]]
8478 !! html/php
8479 <p><a href="#Is_this_great.3F">#Is this great?</a>
8480 <a href="/wiki/Foo#Is_this_great.3F" title="Foo">Foo#Is this great?</a>
8481 <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>
8482 </p>
8483 !! html/parsoid
8484 <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>
8485 <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>
8486 <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>
8487 !! end
8488
8489 # Ideally the wikipedia: prefix here should be proto-relative too
8490 # [CSA]: this is kind of a bogus test, as the PHP parser test doesn't
8491 # define the 'en' prefix, and originally the test used 'wikipedia',
8492 # which isn't a localinterwiki prefix hence the links to the 'en:Foo'
8493 # article.
8494 !! test
8495 Different interwiki prefixes mapping to the same URL
8496 !! wikitext
8497 [[:en:Foo]]
8498
8499 [[:en:Foo|Foo]]
8500
8501 [[wikipedia:Foo]]
8502
8503 [[:wikipedia:Foo|Foo]]
8504
8505 [[wikipedia:en:Foo]]
8506
8507 [[:wikipedia:en:Foo]]
8508
8509 [[ wikiPEdia :Foo]]
8510 !! html/parsoid
8511 <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>
8512
8513 <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>
8514
8515 <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>
8516
8517 <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>
8518
8519 <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>
8520
8521 <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>
8522
8523 <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>
8524 !! end
8525
8526 !! test
8527 Interwiki links that cannot be represented in wiki syntax
8528 !! wikitext
8529 [[meatball:ok]]
8530 [[meatball:ok#foo|ok with fragment]]
8531 [[meatball:ok_as_well?|ok ending with ? mark]]
8532 [http://de.wikipedia.org/wiki/Foo?action=history has query]
8533 [http://de.wikipedia.org/wiki/#foo is just fragment]
8534
8535 !! html/php
8536 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?ok" class="extiw" title="meatball:ok">meatball:ok</a>
8537 <a href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" class="extiw" title="meatball:ok">ok with fragment</a>
8538 <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>
8539 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
8540 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a>
8541 </p>
8542 !! html/parsoid
8543 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok" title="meatball:ok">meatball:ok</a>
8544 <a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" title="meatball:ok">ok with fragment</a>
8545 <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>
8546 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
8547 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a></p>
8548 !! end
8549
8550 !! test
8551 Interwiki links: trail
8552 !! wikitext
8553 [[wikipedia:Foo|Ba]]r
8554 !! html/php
8555 <p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
8556 </p>
8557 !! html/parsoid
8558 <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>
8559 !! end
8560
8561 !! test
8562 Local interwiki link
8563 !! options
8564 parsoid=wt2html,wt2wt,html2html
8565 !! wikitext
8566 [[local:Template:Foo]]
8567 !! html/php
8568 <p><a href="/wiki/Template:Foo" title="Template:Foo">local:Template:Foo</a>
8569 </p>
8570 !! html/parsoid
8571 <p><a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">local:Template:Foo</a></p>
8572 !! end
8573
8574 # Parsoid does not mark self-links, by design.
8575 !! test
8576 Local interwiki link: self-link to current page
8577 !! options
8578 title=[[Main Page]]
8579 parsoid=wt2html,wt2wt,html2html
8580 !! wikitext
8581 [[local:Main Page]]
8582 !! html/php
8583 <p><a class="mw-selflink selflink">local:Main Page</a>
8584 </p>
8585 !! html/parsoid
8586 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:Main Page</a></p>
8587 !! end
8588
8589 !! test
8590 Local interwiki link: prefix only (T66167)
8591 !! options
8592 parsoid=wt2html,wt2wt,html2html
8593 !! wikitext
8594 [[local:]]
8595 !! html/php
8596 <p><a href="/wiki/Main_Page" title="Main Page">local:</a>
8597 </p>
8598 !! html/parsoid
8599 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:</a></p>
8600 !! end
8601
8602 !! test
8603 Local interwiki link: with additional interwiki prefix (T63357)
8604 !! options
8605 parsoid=wt2html,wt2wt,html2html
8606 !! wikitext
8607 [[local:meatball:Hello]]
8608 !! html/php
8609 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?Hello" class="extiw" title="meatball:Hello">local:meatball:Hello</a>
8610 </p>
8611 !! html/parsoid
8612 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?Hello" title="meatball:Hello">local:meatball:Hello</a></p>
8613 !! end
8614
8615 !! test
8616 Multiple local interwiki link prefixes
8617 !! wikitext
8618 [[local:local:local:local:mi:local:Foo]]
8619 !! options
8620 parsoid=wt2html,wt2wt,html2html
8621 !! html/php
8622 <p><a href="/wiki/Foo" title="Foo">local:local:local:local:mi:local:Foo</a>
8623 </p>
8624 !! html/parsoid
8625 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">local:local:local:local:mi:local:Foo</a></p>
8626 !! end
8627
8628 ###
8629 ### Interlanguage links
8630 ### Language links (so that searching for '### language' matches..)
8631 ###
8632
8633 !! test
8634 Interlanguage link
8635 !! wikitext
8636 Blah blah blah
8637 [[zh:Chinese]]
8638 !! html/php
8639 <p>Blah blah blah
8640 </p>
8641 !! html/parsoid
8642 <p>Blah blah blah</p>
8643 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8644 !! end
8645
8646 ## parsoid html2wt will lose the space variations
8647 !! test
8648 Interlanguage link with spacing
8649 !! options
8650 parsoid=wt2html,wt2wt,html2html
8651 !! wikitext
8652 Blah blah blah
8653 [[ zh : Chinese ]]
8654 !! html/php
8655 <p>Blah blah blah
8656 </p>
8657 !! html/parsoid
8658 <p>Blah blah blah</p>
8659 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8660 !! end
8661
8662 !! test
8663 Double interlanguage link
8664 !! wikitext
8665 Blah blah blah
8666 [[es:Spanish]]
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://es.wikipedia.org/wiki/Spanish"/>
8674 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8675 !! end
8676
8677 ## parsoid html2wt will lose the space variations
8678 !! test
8679 Interlanguage link variations
8680 !! options
8681 parsoid=wt2html,wt2wt,html2html
8682 !! wikitext
8683 Blah blah blah
8684 [[ es :Spanish]]
8685 [[ ZH :Chinese]]
8686 [[es:Foo_bar]]
8687 !! html/php
8688 <p>Blah blah blah
8689 </p>
8690 !! html/parsoid
8691 <p>Blah blah blah</p>
8692 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish" />
8693 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese" />
8694 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar" />
8695 !! end
8696
8697 !! test
8698 Escaping of interlanguage links (T129218, T156308)
8699 !! wikitext
8700 Blah blah blah
8701 [[:es:Spanish]]
8702 [[ : zh : Chinese ]]
8703 !! html/php
8704 <p>Blah blah blah
8705 <a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">es:Spanish</a>
8706 <a href="http://zh.wikipedia.org/wiki/Chinese" class="extiw" title="zh:Chinese"> zh : Chinese </a>
8707 </p>
8708 !! html/parsoid
8709 <p>Blah blah blah
8710 <a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">es:Spanish</a>
8711 <a rel="mw:ExtLink" href="http://zh.wikipedia.org/wiki/Chinese" title="zh:Chinese"> zh : Chinese </a></p>
8712 !! end
8713
8714 ## parsoid html2wt will normalize the space to _
8715 !! test
8716 Space and question mark encoding in interlanguage links (T95473)
8717 !! options
8718 parsoid=wt2html,wt2wt,html2html
8719 !! wikitext
8720 Blah blah blah
8721 [[es:Foo bar?]]
8722 !! html/php
8723 <p>Blah blah blah
8724 </p>
8725 !! html/parsoid
8726 <p>Blah blah blah</p>
8727 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar%3F" />
8728 !! end
8729
8730 !! test
8731 Interlanguage link, with prefix links
8732 !! options
8733 language=ln
8734 !! wikitext
8735 Blah blah blah
8736 [[zh:Chinese]]
8737 !! html/php
8738 <p>Blah blah blah
8739 </p>
8740 !! html/parsoid
8741 <p>Blah blah blah</p>
8742 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8743 !! end
8744
8745 !! test
8746 Double interlanguage link, with prefix links (T10897)
8747 !! options
8748 language=ln
8749 !! wikitext
8750 Blah blah blah
8751 [[es:Spanish]]
8752 [[zh:Chinese]]
8753 !! html/php
8754 <p>Blah blah blah
8755 </p>
8756 !! html/parsoid
8757 <p>Blah blah blah</p>
8758 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
8759 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8760 !! end
8761
8762 !! test
8763 "Extra" interlanguage links (T34189 / gerrit 111390)
8764 !! wikitext
8765 Blah blah blah
8766 [[mul:Article]]
8767 !! html/php
8768 <p>Blah blah blah
8769 </p>
8770 !! html/parsoid
8771 <p>Blah blah blah</p>
8772 <link rel="mw:PageProp/Language" title="Multilingual" href="http://wikisource.org/wiki/Article"/>
8773 !! end
8774
8775 ## PHP parser tests script needs an update
8776 ## Parsoid html2wt will normalize output to [[:zh:Chinese]]
8777 !! test
8778 Language links render as inline links if $wgInterwikiMagic=false
8779 !! options
8780 wgInterwikiMagic=false
8781 parsoid=wt2html,wt2wt,html2html
8782 !! wikitext
8783 Blah blah blah
8784 [[zh:Chinese]]
8785 !! html/parsoid
8786 <p>Blah blah blah <a rel="mw:ExtLink" href="http://zh.wikipedia.org/wiki/Chinese" title="zh:Chinese">zh:Chinese</a></p>
8787 !! end
8788
8789 ## PHP parser tests script needs an update
8790 ## Parsoid html2wt will normalize output to [[:zh:Chinese]]
8791 !! test
8792 Language links render as inline links in the Talk namespace
8793 !! options
8794 title=Talk:Foo
8795 parsoid=wt2html,wt2wt,html2html
8796 !! wikitext
8797 Blah blah blah
8798 [[zh:Chinese]]
8799 !! html/parsoid
8800 <p>Blah blah blah <a rel="mw:ExtLink" href="http://zh.wikipedia.org/wiki/Chinese" title="zh:Chinese">zh:Chinese</a></p>
8801 !! end
8802
8803 !! test
8804 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
8805 !! options
8806 language=ln
8807 !! wikitext
8808 [[WW&nbsp;II]]
8809 !! html
8810 <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>
8811 </p>
8812 !! end
8813
8814 !! test
8815 Parsoid T55221: Wikilinks should be properly entity-escaped
8816 !! options
8817 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
8818 !! html/parsoid
8819 <p>He&amp;nbsp;llo <a href="./Foo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
8820 <p>He&amp;nbsp;llo <a href="./He&amp;nbsp;llo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
8821 !! wikitext
8822 He&amp;nbsp;llo [[Foo|He&amp;nbsp;llo]]
8823
8824 He&amp;nbsp;llo He&amp;nbsp;llo
8825 !! html/php
8826 <p>He&amp;nbsp;llo <a href="/wiki/Foo" title="Foo">He&amp;nbsp;llo</a>
8827 </p><p>He&amp;nbsp;llo He&amp;nbsp;llo
8828 </p>
8829 !! end
8830
8831 # html2wt will fail because of title normalization without data-parsoid
8832 !! test
8833 Parsoid: handle constructor well
8834 !! options
8835 parsoid=wt2html,wt2wt
8836 !! wikitext
8837 [[constructor]]
8838
8839 [[constructor:foo]]
8840 !! html/php
8841 <p><a href="/index.php?title=Constructor&amp;action=edit&amp;redlink=1" class="new" title="Constructor (page does not exist)">constructor</a>
8842 </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>
8843 </p>
8844 !! html/parsoid
8845 <p><a rel="mw:WikiLink" href="./Constructor" title="Constructor" data-parsoid='{"stx":"simple","a":{"href":"./Constructor"},"sa":{"href":"constructor"}}'>constructor</a></p>
8846
8847 <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>
8848 !! end
8849
8850 !! article
8851 ko:
8852 !! text
8853 Test.
8854 !! endarticle
8855
8856 # Note that `ko` isn't a known interlanguage prefix
8857 !! test
8858 Parsoid: recognize interlanguage links without a target page
8859 !! options
8860 ill
8861 !! wikitext
8862 [[es:]]
8863
8864 [[ko:]]
8865 !! html/php
8866 es:
8867 !! html/parsoid
8868 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/"/>
8869
8870 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
8871 !! end
8872
8873 # Note that `ko` isn't a known interwiki prefix
8874 !! test
8875 Parsoid: recognize interwiki links without a target page
8876 !! options
8877 parsoid=wt2html,wt2wt,html2html
8878 !! wikitext
8879 [[:es:]]
8880
8881 [[:ko:]]
8882 !! html/php
8883 <p><a href="http://es.wikipedia.org/wiki/" class="extiw" title="es:">es:</a>
8884 </p><p><a href="/wiki/Ko:" title="Ko:">ko:</a>
8885 </p>
8886 !! html/parsoid
8887 <p><a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/" title="es:">es:</a></p>
8888 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
8889 !! end
8890
8891 !! test
8892 Handle interwiki links pointing to the current wiki as plain wiki links (T47209)
8893 !! wikitext
8894 [[mi:Foo]]
8895 !! html/php
8896 <p><a href="/wiki/Foo" title="Foo">mi:Foo</a>
8897 </p>
8898 !! html/parsoid
8899 <p><a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo"},"sa":{"href":"mi:Foo"}}'>mi:Foo</a></p>
8900 !! end
8901
8902 !! test
8903 Interlanguage link with preceding local interwiki link (T70085)
8904 !! options
8905 parsoid=wt2html,wt2wt,html2html
8906 !! wikitext
8907 Blah blah blah
8908 [[local:es:Spanish]]
8909 !! html/php
8910 <p>Blah blah blah
8911 <a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">local:es:Spanish</a>
8912 </p>
8913 !! html/parsoid
8914 <p>Blah blah blah
8915 <a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">local:es:Spanish</a></p>
8916 !! end
8917
8918 !! test
8919 Looks like an interlanguage link, but is actually a local interwiki
8920 !! options
8921 parsoid=wt2html,wt2wt,html2html
8922 !! wikitext
8923 Blah blah blah
8924 [[mi:Template:Foo]]
8925 !! html/php
8926 <p>Blah blah blah
8927 <a href="/wiki/Template:Foo" title="Template:Foo">mi:Template:Foo</a>
8928 </p>
8929 !! html/parsoid
8930 <p>Blah blah blah
8931 <a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">mi:Template:Foo</a></p>
8932 !! end
8933
8934 ###
8935 ### Redirects, Parsoid-only
8936 ###
8937
8938 !! test
8939 1. Simple redirect to page
8940 !! wikitext
8941 #REDIRECT [[Main Page]]
8942 !! html/parsoid
8943 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8944 !! end
8945
8946 !! test
8947 2. Other redirect variants
8948 !! wikitext
8949 #REDIRECT [[Main_Page]]
8950 !! html/parsoid
8951 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Main_Page"},"sa":{"href":"Main_Page"}}'/>
8952 !! end
8953
8954 # Not a valid redirect in PHP (although perhaps it was, once upon a time)
8955 # This tests the Parsoid bail-out code.
8956 !! test
8957 3. Other redirect variants
8958 !! wikitext
8959 #REDIRECT [[<nowiki>[[Bar]]</nowiki>]]
8960 !! html/parsoid
8961 <ol><li data-parsoid>REDIRECT [[[[Bar]]]]</li></ol>
8962 !! end
8963
8964 !! test
8965 4. Redirect to a templated destination
8966 !! wikitext
8967 #REDIRECT [[{{echo|Foo}}bar]]
8968 !! html/parsoid
8969 <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"}]]}'/>
8970 !! end
8971
8972 !! test
8973 Empty redirect
8974 !! options
8975 parsoid=wt2html,wt2wt
8976 !! wikitext
8977 #REDIRECT [[]]
8978 !! html/parsoid
8979 <ol>
8980 <li>REDIRECT [[]]</li></ol>
8981 !! end
8982
8983 !! test
8984 Optional colon in #REDIRECT
8985 !! options
8986 # the colon is archaic syntax. we support it for wt2html, but we
8987 # don't care that it roundtrips back to the modern syntax.
8988 parsoid=wt2html,html2html
8989 !! wikitext
8990 #REDIRECT:[[Main Page]]
8991 !! html/parsoid
8992 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8993 !! end
8994
8995 !! test
8996 Whitespace in #REDIRECT with optional colon
8997 !! options
8998 # the colon and gratuitous whitespace is archaic syntax. we support
8999 # it for wt2html, but we don't care that it roundtrips back to the
9000 # modern syntax (without extra whitespace)
9001 parsoid=wt2html,html2html
9002 !! wikitext
9003
9004 #REDIRECT
9005 :
9006 [[Main Page]]
9007 !! html/parsoid
9008 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
9009 !! end
9010
9011 !! test
9012 Piped link in #REDIRECT
9013 !! options
9014 # content after piped link is ignored. we support this syntax,
9015 # but don't care that the piped link is lost when we roundtrip this.
9016 parsoid=wt2html
9017 !! wikitext
9018 #REDIRECT [[Main Page|bar]]
9019 !! html/parsoid
9020 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
9021 !! end
9022
9023 !! test
9024 Redirect to category (T104502)
9025 !! options
9026 parsoid=wt2html,wt2wt
9027 !! wikitext
9028 #REDIRECT [[Category:Foo]]
9029 !! html/parsoid
9030 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
9031 !! end
9032
9033 !! test
9034 Redirect to category with URL encoding (T104502)
9035 !! options
9036 parsoid=wt2html
9037 !! wikitext
9038 #REDIRECT [[Category%3AFoo]]
9039 !! html/parsoid
9040 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
9041 !! end
9042
9043 !! test
9044 Redirect to category page
9045 !! wikitext
9046 #REDIRECT [[:Category:Foo]]
9047 !! html/parsoid
9048 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
9049 !! end
9050
9051 !! test
9052 Redirect to image page (1)
9053 !! wikitext
9054 #REDIRECT [[File:Wiki.png]]
9055 !! html/parsoid
9056 <link rel="mw:PageProp/redirect" href="./File:Wiki.png"/>
9057 !! end
9058
9059 !! test
9060 Redirect to image page (2)
9061 !! wikitext
9062 #REDIRECT [[Image:Wiki.png]]
9063 !! html/parsoid
9064 <link rel="mw:PageProp/redirect" href="./File:Wiki.png" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./File:Wiki.png"},"sa":{"href":"Image:Wiki.png"}}'/>
9065 !! end
9066
9067 # html2wt disabled because wts serializes as "#REDIRECT [[:en:File:Wiki.png]]"
9068 # Next test confirms this.
9069 !! test
9070 Redirect to language (1) (T104918)
9071 !! options
9072 parsoid=wt2html,wt2wt,html2html
9073 !! wikitext
9074 #REDIRECT [[en:File:Wiki.png]]
9075 !! html/parsoid
9076 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
9077 !! end
9078
9079 !! test
9080 Redirect to language (2) (T104918)
9081 !! wikitext
9082 #REDIRECT [[:en:File:Wiki.png]]
9083 !! html/parsoid
9084 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
9085 !! end
9086
9087 !! test
9088 Redirect to interwiki (T104918)
9089 !! wikitext
9090 #REDIRECT [[meatball:File:Wiki.png]]
9091 !! html/parsoid
9092 <link rel="mw:PageProp/redirect" href="http://www.usemod.com/cgi-bin/mb.pl?File:Wiki.png"/>
9093 !! end
9094
9095 !! test
9096 Non-English #REDIRECT
9097 !! options
9098 language=is
9099 !! wikitext
9100 #TILVÍSUN [[Main Page]]
9101 !! html/parsoid
9102 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#TILVÍSUN ","a":{"href":"./Main_Page"},"sa":{"href":"Main Page"}}'/>
9103 !! end
9104
9105 !! test
9106 Redirect syntax under text isn't considered a redirect
9107 !! wikitext
9108 some text
9109 #redirect [[Main Page]]
9110 !! html/parsoid
9111 <p>some text</p>
9112 <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>
9113 !! end
9114
9115 # FIXME: Should hoist the redirect to the top of the page and ensure there
9116 # is only one.
9117 !! test
9118 New redirect
9119 !! options
9120 parsoid=html2wt
9121 !! html/parsoid
9122 <p>Foo<link rel="mw:PageProp/redirect" href="./Foo"/></p>
9123 !! wikitext
9124 Foo
9125 #REDIRECT [[Foo]]
9126 !! end
9127
9128 ##
9129 ## XHTML tidiness
9130 ###
9131
9132 !! test
9133 <br> to <br />
9134 !! wikitext
9135 1<br>2<br />3
9136 !! html
9137 <p>1<br />2<br />3
9138 </p>
9139 !! end
9140
9141 !! test
9142 Broken br tag sanitization
9143 !! wikitext
9144 </br>
9145 !! html/php
9146 <p>&lt;/br&gt;
9147 </p>
9148 !! end
9149
9150 # TODO: Fix html2html mode (T53055)!
9151 !! test
9152 Parsoid: Broken br tag recognition
9153 !! options
9154 parsoid=wt2html
9155 !! wikitext
9156 </br>
9157
9158 <br/ >
9159 !! html+tidy
9160 <p><br /></p>
9161 <p><br /></p>
9162 !! end
9163
9164 !! test
9165 Incorrecly removing closing slashes from correctly formed XHTML
9166 !! wikitext
9167 <br style="clear:both;" />
9168 !! html
9169 <p><br style="clear:both;" />
9170 </p>
9171 !! end
9172
9173 !! test
9174 Failing to transform badly formed HTML into correct XHTML
9175 !! wikitext
9176 <br style="clear: left;">
9177 <br style="clear: right;">
9178 <br style="clear: both;">
9179 !! html
9180 <p><br style="clear: left;" />
9181 <br style="clear: right;" />
9182 <br style="clear: both;" />
9183 </p>
9184 !!end
9185
9186 ## FIXME: Is Parsoid's acceptance of self-closing html-tags
9187 ## a feature or a bug? See https://phabricator.wikimedia.org/T76962
9188 !! test
9189 Handling html with a div self-closing tag
9190 !! wikitext
9191 <div title />
9192 <div title/>
9193 <div title/ >
9194 <div title=bar />
9195 <div title=bar/>
9196 <div title=bar/ >
9197 !! html/php
9198 <p>&lt;div title /&gt;
9199 &lt;div title/&gt;
9200 </p>
9201 <div>
9202 <p>&lt;div title=bar /&gt;
9203 &lt;div title=bar/&gt;
9204 </p>
9205 <div title="bar/"></div>
9206 </div>
9207
9208 !! html/parsoid
9209 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
9210 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
9211 <div title="" data-parsoid='{"stx":"html","selfClose":true,"brokenHTMLTag":true}'></div>
9212 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
9213 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
9214 <div title="bar/" data-parsoid='{"stx":"html","autoInsertedEnd":true}'></div>
9215 !! end
9216
9217 !! test
9218 Handling html with a br self-closing tag
9219 !! wikitext
9220 <br title />
9221 <br title/>
9222 <br title/ >
9223 <br title=bar />
9224 <br title=bar/>
9225 <br title=bar/ >
9226 !! html/php
9227 <p><br title="" />
9228 <br title="" />
9229 <br />
9230 <br title="bar" />
9231 <br title="bar" />
9232 <br title="bar/" />
9233 </p>
9234 !! html/parsoid
9235 <p><br title="" />
9236 <br title="" />
9237 <br title="" />
9238 <br title="bar" />
9239 <br title="bar" />
9240 <br title="bar/" />
9241 </p>
9242 !! end
9243
9244 !! test
9245 Horizontal ruler (should it add that extra space?)
9246 !! wikitext
9247 <hr>
9248 <hr >
9249 foo <hr
9250 > bar
9251 !! html+tidy
9252 <hr />
9253 <hr />
9254 <p>foo</p>
9255 <hr />
9256 <p>bar</p>
9257 !! end
9258
9259 !! test
9260 Horizontal ruler -- 4+ dashes render hr
9261 !! wikitext
9262 ----
9263 !! html
9264 <hr />
9265
9266 !! end
9267
9268 !! test
9269 Horizontal ruler -- eats additional dashes on the same line
9270 !! wikitext
9271 ---------
9272 !! html
9273 <hr />
9274
9275 !! end
9276
9277 !! test
9278 Horizontal ruler -- does not collapse dashes on consecutive lines
9279 !! wikitext
9280 ----
9281 ----
9282 !! html
9283 <hr />
9284 <hr />
9285
9286 !! end
9287
9288 !! test
9289 Horizontal ruler -- <4 dashes render as plain text
9290 !! wikitext
9291 ---
9292 !! html
9293 <p>---
9294 </p>
9295 !! end
9296
9297 !! test
9298 Horizontal ruler -- Supports content following dashes on same line
9299 !! wikitext
9300 ---- Foo
9301 !! html
9302 <hr /> Foo
9303
9304 !! html+tidy
9305 <hr />
9306 <p>Foo</p>
9307 !! end
9308
9309 ###
9310 ### Block-level elements
9311 ###
9312 !! test
9313 Common list
9314 !! wikitext
9315 *Common list
9316 * item 2
9317 *item 3
9318 !! html
9319 <ul><li>Common list</li>
9320 <li> item 2</li>
9321 <li>item 3</li></ul>
9322
9323 !! end
9324
9325 !! test
9326 Numbered list
9327 !! wikitext
9328 #Numbered list
9329 #item 2
9330 # item 3
9331 !! html
9332 <ol><li>Numbered list</li>
9333 <li>item 2</li>
9334 <li> item 3</li></ol>
9335
9336 !! end
9337
9338 !! test
9339 Mixed list
9340 !! wikitext
9341 *Mixed list
9342 *# with numbers
9343 ** and bullets
9344 *# and numbers
9345 *bullets again
9346 **bullet level 2
9347 ***bullet level 3
9348 ***#Number on level 4
9349 **bullet level 2
9350 **#Number on level 3
9351 **#Number on level 3
9352 *#number level 2
9353 *Level 1
9354 *** Level 3
9355 #** Level 3, but ordered
9356 !! html
9357 <ul><li>Mixed list
9358 <ol><li> with numbers</li></ol>
9359 <ul><li> and bullets</li></ul>
9360 <ol><li> and numbers</li></ol></li>
9361 <li>bullets again
9362 <ul><li>bullet level 2
9363 <ul><li>bullet level 3
9364 <ol><li>Number on level 4</li></ol></li></ul></li>
9365 <li>bullet level 2
9366 <ol><li>Number on level 3</li>
9367 <li>Number on level 3</li></ol></li></ul>
9368 <ol><li>number level 2</li></ol></li>
9369 <li>Level 1
9370 <ul><li><ul><li> Level 3</li></ul></li></ul></li></ul>
9371 <ol><li><ul><li><ul><li> Level 3, but ordered</li></ul></li></ul></li></ol>
9372
9373 !! end
9374
9375 !! test
9376 1. Nested mixed wikitext and html list
9377 !! wikitext
9378 * hi
9379 * <ul><li>ho</li></ul>
9380 * hi
9381 ** ho
9382 !! html/php
9383 <ul><li> hi</li>
9384 <li> <ul><li>ho</li></ul></li>
9385 <li> hi
9386 <ul><li> ho</li></ul></li></ul>
9387
9388 !! html/parsoid
9389 <ul><li> hi</li>
9390 <li> <ul data-parsoid='{"stx":"html"}'><li data-parsoid='{"stx":"html"}'>ho</li></ul></li>
9391 <li> hi
9392 <ul><li> ho</li></ul></li></ul>
9393 !! end
9394
9395 !! test
9396 2. Nested mixed wikitext and html list (incompatible)
9397 !! wikitext
9398 ; hi
9399 : {{echo|<li>ho</li>}}
9400 !! html/php
9401 <dl><dt> hi</dt>
9402 <dd> <li>ho</li></dd></dl>
9403
9404 !! html/parsoid
9405 <dl><dt> hi</dt>
9406 <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>
9407 !! end
9408
9409 !! test
9410 Nested lists 1
9411 !! wikitext
9412 *foo
9413 **bar
9414 !! html
9415 <ul><li>foo
9416 <ul><li>bar</li></ul></li></ul>
9417
9418 !! end
9419
9420 !! test
9421 Nested lists 2
9422 !! wikitext
9423 **foo
9424 *bar
9425 !! html
9426 <ul><li><ul><li>foo</li></ul></li>
9427 <li>bar</li></ul>
9428
9429 !! end
9430
9431 !! test
9432 Nested lists 3 (first element empty)
9433 !! wikitext
9434 *
9435 **bar
9436 !! html
9437 <ul><li>
9438 <ul><li>bar</li></ul></li></ul>
9439
9440 !! end
9441
9442 !! test
9443 Nested lists 4 (first element empty)
9444 !! wikitext
9445 **
9446 *bar
9447 !! html
9448 <ul><li><ul><li></li></ul></li>
9449 <li>bar</li></ul>
9450
9451 !! end
9452
9453 !! test
9454 Nested lists 5 (both elements empty)
9455 !! wikitext
9456 **
9457 *
9458 !! html
9459 <ul><li><ul><li></li></ul></li>
9460 <li></li></ul>
9461
9462 !! end
9463
9464 !! test
9465 Nested lists 6 (both elements empty)
9466 !! wikitext
9467 *
9468 **
9469 !! html
9470 <ul><li>
9471 <ul><li></li></ul></li></ul>
9472
9473 !! end
9474
9475 !! test
9476 Nested lists 7 (skip initial nesting levels)
9477 !! wikitext
9478 *** foo
9479 !! html
9480 <ul><li><ul><li><ul><li> foo</li></ul></li></ul></li></ul>
9481
9482 !! end
9483
9484 !! test
9485 Nested lists 8 (multiple nesting transitions)
9486 !! wikitext
9487 * foo
9488 *** bar
9489 ** baz
9490 * boo
9491 !! html
9492 <ul><li> foo
9493 <ul><li><ul><li> bar</li></ul></li>
9494 <li> baz</li></ul></li>
9495 <li> boo</li></ul>
9496
9497 !! end
9498
9499 !! test
9500 Nested lists 9 (extension interaction)
9501 !! options
9502 parsoid
9503 !! wikitext
9504 *<references />
9505 !! html/parsoid
9506 <ul><li data-parsoid='{}'><ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-parsoid='{}' data-mw='{"name":"references","attrs":{}}'></ol></li></ul>
9507 !! end
9508
9509 !! test
9510 1. Lists with start-of-line-transparent tokens before bullets: Comments
9511 !! wikitext
9512 *foo
9513 *<!--cmt-->bar
9514 <!--cmt-->*baz
9515 !! html
9516 <ul><li>foo</li>
9517 <li>bar</li>
9518 <li>baz</li></ul>
9519
9520 !! end
9521
9522 !! test
9523 2. Lists with start-of-line-transparent tokens before bullets: Template close
9524 !! wikitext
9525 *foo {{echo|bar
9526 }}*baz
9527 !! html
9528 <ul><li>foo bar</li>
9529 <li>baz</li></ul>
9530
9531 !! end
9532
9533 !! test
9534 List items are not parsed correctly following a <pre> block (T2785)
9535 !! wikitext
9536 * <pre>foo</pre>
9537 * <pre>bar</pre>
9538 * zar
9539 !! html/php
9540 <ul><li> <pre>foo</pre></li>
9541 <li> <pre>bar</pre></li>
9542 <li> zar</li></ul>
9543
9544 !! html/parsoid
9545 <ul><li> <pre typeof="mw:Extension/pre" about="#mwt2" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"foo"}}'>foo</pre></li>
9546 <li> <pre typeof="mw:Extension/pre" about="#mwt4" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"bar"}}'>bar</pre></li>
9547 <li> zar</li></ul>
9548 !! end
9549
9550 !! test
9551 List items from template
9552 !! wikitext
9553
9554 {{inner list}}
9555 * item 2
9556
9557 * item 0
9558 {{inner list}}
9559 * item 2
9560
9561 * item 0
9562 * notSOL{{inner list}}
9563 * item 2
9564 !! html
9565 <ul><li> item 1</li>
9566 <li> item 2</li></ul>
9567 <ul><li> item 0</li>
9568 <li> item 1</li>
9569 <li> item 2</li></ul>
9570 <ul><li> item 0</li>
9571 <li> notSOL</li>
9572 <li> item 1</li>
9573 <li> item 2</li></ul>
9574
9575 !! end
9576
9577 !! test
9578 List interrupted by empty line or heading
9579 !! wikitext
9580 * foo
9581
9582 ** bar
9583 == A heading ==
9584 * Another list item
9585 !! html
9586 <ul><li> foo</li></ul>
9587 <ul><li><ul><li> bar</li></ul></li></ul>
9588 <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>
9589 <ul><li> Another list item</li></ul>
9590
9591 !!end
9592
9593 !!test
9594 Multiple list tags generated by templates
9595 !! wikitext
9596 {{echo|<li>}}a
9597 {{echo|<li>}}b
9598 {{echo|<li>}}c
9599 !! html
9600 <li>a
9601 <li>b
9602 <li>c</li>
9603 </li>
9604 </li>
9605
9606 !! html+tidy
9607 <ul>
9608 <li>a</li>
9609 <li>b</li>
9610 <li>c</li>
9611 </ul>
9612 !!end
9613
9614 !!test
9615 Single-comment whitespace lines dont break lists, and neither do multi-comment whitespace lines
9616 !! wikitext
9617 *a
9618 <!--This line will NOT split the list-->
9619 *b
9620 <!--This line will NOT split the list either-->
9621 *c
9622 <!--foo--> <!----> <!--This line NOT split the list either-->
9623 *d
9624 !! html
9625 <ul><li>a</li>
9626 <li>b</li>
9627 <li>c</li>
9628 <li>d</li></ul>
9629
9630 !!end
9631
9632 !!test
9633 Replacing whitespace with tabs still doesn't break the list (gerrit 78327)
9634 !! wikitext
9635 *a
9636 <!--This line will NOT split the list-->
9637 *b
9638 <!--This line will NOT split the list either-->
9639 *c
9640 <!--foo--> <!----> <!--This line NOT split the list
9641 either-->
9642 *d
9643 !! html
9644 <ul><li>a</li>
9645 <li>b</li>
9646 <li>c</li>
9647 <li>d</li></ul>
9648
9649 !!end
9650
9651 !!test
9652 Test the li-hack
9653 (The PHP parser relies on Tidy for the hack)
9654 !!options
9655 parsoid=wt2html,wt2wt
9656 !! wikitext
9657 * foo
9658 * <li>li-hack
9659 * {{echo|<li>templated li-hack}}
9660 * <!--foo--> <li> unsupported li-hack with preceding comments
9661
9662 <ul>
9663 <li><li>not a li-hack
9664 </li>
9665 </ul>
9666 !! html+tidy
9667 <ul>
9668 <li>foo</li>
9669 <li>li-hack</li>
9670 <li>templated li-hack</li>
9671 <li>unsupported li-hack with preceding comments</li>
9672 </ul>
9673 <ul>
9674 <li>not a li-hack</li>
9675 </ul>
9676 !!end
9677
9678 !! test
9679 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
9680 !! options
9681 parsoid
9682 !! wikitext
9683 # foo
9684 ## bar
9685 * foo
9686 ** bar
9687 : foo
9688 :: bar
9689 !! html
9690 <ol>
9691 <li> foo<ol>
9692 <li> bar</li>
9693 </ol></li>
9694 </ol><ul>
9695 <li> foo<ul>
9696 <li> bar</li>
9697 </ul></li>
9698 </ul><dl>
9699 <dd> foo<dl>
9700 <dd> bar</dd>
9701 </dl></dd>
9702 </dl>
9703 !! end
9704
9705 !! test
9706 Parsoid: Test of whitespace serialization with Templated bullets
9707 !! options
9708 parsoid
9709 !! wikitext
9710 * {{bullet}}
9711 !! html
9712 <ul>
9713 <li> </li><li about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"bullet","href":"./Template:Bullet"},"params":{},"i":0}}]}'> Bar</li>
9714 </ul>
9715 !! end
9716
9717 # ------------------------------------------------------------------------
9718 # The next set of tests are about Parsoid's ability to handle badly nested
9719 # tags (parse, minimize scope of fixup, and roundtrip back)
9720 # ------------------------------------------------------------------------
9721
9722 !! test
9723 Unbalanced closing block tags break a list
9724 (php parser relies on Tidy to fix up)
9725 !! wikitext
9726 <div>
9727 *a</div><div>
9728 *b</div>
9729 !! html+tidy
9730 <div>
9731 <ul>
9732 <li>a</li>
9733 </ul>
9734 </div>
9735 <div>
9736 <ul>
9737 <li>b</li>
9738 </ul>
9739 </div>
9740 !! end
9741
9742 # Parsoid fails this test, but it might be tricky to support properly.
9743 # See T70395.
9744 !! test
9745 Unbalanced closing non-block tags don't break a list
9746 (php parser relies on Tidy to fix up)
9747 !! wikitext
9748 <span>
9749 *a</span><span>
9750 *b</span>
9751 !! html/php+tidy
9752 <ul>
9753 <li><span>a</span></li>
9754 <li><span>b</span></li>
9755 </ul>
9756 !! html/parsoid
9757 <span>
9758 <ul>
9759 <li>a<span></span>
9760 </li>
9761 <li>b
9762 </li>
9763 </ul>
9764 </span>
9765 !! end
9766
9767 !! test
9768 Unclosed formatting tags that straddle lists are closed and reopened
9769 (php parser relies on Tidy to fix up)
9770 !! options
9771 parsoid=wt2html,wt2wt,html2html
9772 !! wikitext
9773 # <s> a
9774 # b </s>
9775 !! html/php+tidy
9776 <ol>
9777 <li><s>a</s></li>
9778 <li><s>b</s></li>
9779 </ol>
9780 !! html/parsoid
9781 <ol><li> <s> a</s></li>
9782 <li><s> b </s></li></ol>
9783 !! end
9784
9785 # See T70395.
9786 !!test
9787 1. List embedded in a formatting tag
9788 !! wikitext
9789 <small>
9790 * foo
9791 </small>
9792 !! html/php+tidy
9793 <ul>
9794 <li><small>foo</small></li>
9795 </ul>
9796 !! html/parsoid
9797 <small>
9798 <ul>
9799 <li> foo</li>
9800 </ul>
9801 </small>
9802 !!end
9803
9804 ## Ugly Parsoid output here
9805 ## Not sure what the right output is.
9806 !!test
9807 2. List embedded in a formatting tag
9808 !! wikitext
9809 <small>
9810 *a
9811 *b</small>
9812 !! html/php+tidy
9813 <ul>
9814 <li><small>a</small></li>
9815 <li><small>b</small></li>
9816 </ul>
9817 !! html/parsoid
9818 <small></small>
9819 <ul><small>
9820 <li>a</li>
9821 </small>
9822 <li><small>b</small></li>
9823 </ul>
9824 !!end
9825
9826 # Ugly Parsoid and PHP parser output here
9827 # Not sure if we want to make this a test!
9828 #
9829 ## !!test
9830 ## 3. Unclosed formatting tags in list elements
9831 ## !! wikitext
9832 ## *<small>a
9833 ## *<small>b
9834 ## !! html/php+tidy
9835 ## <ul>
9836 ## <li><small>a</small></li>
9837 ## <li><small><small>b</small></small></li>
9838 ## </ul>
9839 ## !! html/parsoid
9840 ## <ul>
9841 ## <li><small>a</small></li>
9842 ## <small>
9843 ## <li><small>b</small></li>
9844 ## </small></ul>
9845 ## !!end
9846
9847 # This is a bug in the PHP parser + tidy combination.
9848 # (The </tr> tag gets parsed as text and html-escaped by PHP,
9849 # and then fostered out of the table by tidy.)
9850 # We believe the Parsoid output to be correct.
9851 !! test
9852 Table with missing opening <tr> tag
9853 !! options
9854 parsoid=wt2html,wt2wt
9855 !! wikitext
9856 <table>
9857 <td>foo</td>
9858 </tr>
9859 </table>
9860 !! html+tidy
9861 <table>
9862 <tr>
9863 <td>foo</td>
9864 </tr>
9865 </table>
9866 !! end
9867
9868 ###
9869 ### Magic Words
9870 ###
9871
9872 # Note that the current date is hard-coded as
9873 # 1970-01-01T00:02:03Z (a Thursday)
9874 # when running parser tests. The timezone is also fixed to GMT, so
9875 # local date will be identical to current date.
9876
9877 !! test
9878 Magic Word: {{CURRENTDAY}}
9879 !! wikitext
9880 {{CURRENTDAY}}
9881 !! html
9882 <p>1
9883 </p>
9884 !! end
9885
9886 !! test
9887 Magic Word: {{CURRENTDAY2}}
9888 !! wikitext
9889 {{CURRENTDAY2}}
9890 !! html
9891 <p>01
9892 </p>
9893 !! end
9894
9895 !! test
9896 Magic Word: {{CURRENTDAYNAME}}
9897 !! wikitext
9898 {{CURRENTDAYNAME}}
9899 !! html
9900 <p>Thursday
9901 </p>
9902 !! end
9903
9904 !! test
9905 Magic Word: {{CURRENTDOW}}
9906 !! wikitext
9907 {{CURRENTDOW}}
9908 !! html
9909 <p>4
9910 </p>
9911 !! end
9912
9913 !! test
9914 Magic Word: {{CURRENTMONTH}}
9915 !! wikitext
9916 {{CURRENTMONTH}}
9917 !! html
9918 <p>01
9919 </p>
9920 !! end
9921
9922 !! test
9923 Magic Word: {{CURRENTMONTH1}}
9924 !! wikitext
9925 {{CURRENTMONTH1}}
9926 !! html
9927 <p>1
9928 </p>
9929 !! end
9930
9931 !! test
9932 Magic Word: {{CURRENTMONTHABBREV}}
9933 !! wikitext
9934 {{CURRENTMONTHABBREV}}
9935 !! html
9936 <p>Jan
9937 </p>
9938 !! end
9939
9940 !! test
9941 Magic Word: {{CURRENTMONTHNAME}}
9942 !! wikitext
9943 {{CURRENTMONTHNAME}}
9944 !! html
9945 <p>January
9946 </p>
9947 !! end
9948
9949 !! test
9950 Magic Word: {{CURRENTMONTHNAMEGEN}}
9951 !! wikitext
9952 {{CURRENTMONTHNAMEGEN}}
9953 !! html
9954 <p>January
9955 </p>
9956 !! end
9957
9958 !! test
9959 Magic Word: {{CURRENTTIME}}
9960 !! wikitext
9961 {{CURRENTTIME}}
9962 !! html
9963 <p>00:02
9964 </p>
9965 !! end
9966
9967 !! test
9968 Magic Word: {{CURRENTHOUR}}
9969 !! wikitext
9970 {{CURRENTHOUR}}
9971 !! html
9972 <p>00
9973 </p>
9974 !! end
9975
9976 !! test
9977 Magic Word: {{CURRENTWEEK}} (T6594)
9978 !! wikitext
9979 {{CURRENTWEEK}}
9980 !! html
9981 <p>1
9982 </p>
9983 !! end
9984
9985 !! test
9986 Magic Word: {{CURRENTYEAR}}
9987 !! wikitext
9988 {{CURRENTYEAR}}
9989 !! html
9990 <p>1970
9991 </p>
9992 !! end
9993
9994 !! test
9995 Magic Word: {{CURRENTTIMESTAMP}}
9996 !! wikitext
9997 {{CURRENTTIMESTAMP}}
9998 !! html
9999 <p>19700101000203
10000 </p>
10001 !! end
10002
10003 !! test
10004 Magic Words LOCAL (UTC)
10005 !! wikitext
10006 * {{LOCALMONTH}}
10007 * {{LOCALMONTH1}}
10008 * {{LOCALMONTHNAME}}
10009 * {{LOCALMONTHNAMEGEN}}
10010 * {{LOCALMONTHABBREV}}
10011 * {{LOCALDAY}}
10012 * {{LOCALDAY2}}
10013 * {{LOCALDAYNAME}}
10014 * {{LOCALYEAR}}
10015 * {{LOCALTIME}}
10016 * {{LOCALHOUR}}
10017 * {{LOCALWEEK}}
10018 * {{LOCALDOW}}
10019 * {{LOCALTIMESTAMP}}
10020 !! html
10021 <ul><li> 01</li>
10022 <li> 1</li>
10023 <li> January</li>
10024 <li> January</li>
10025 <li> Jan</li>
10026 <li> 1</li>
10027 <li> 01</li>
10028 <li> Thursday</li>
10029 <li> 1970</li>
10030 <li> 00:02</li>
10031 <li> 00</li>
10032 <li> 1</li>
10033 <li> 4</li>
10034 <li> 19700101000203</li></ul>
10035
10036 !! end
10037
10038 !! test
10039 Magic Word: {{FULLPAGENAME}}
10040 !! options
10041 title=[[User:Ævar Arnfjörð Bjarmason]]
10042 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10043 !! wikitext
10044 {{FULLPAGENAME}}
10045 !! html/*
10046 <p>User:Ævar Arnfjörð Bjarmason
10047 </p>
10048 !! end
10049
10050 !! test
10051 Magic Word: {{FULLPAGENAMEE}}
10052 !! options
10053 title=[[User:Ævar Arnfjörð Bjarmason]]
10054 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10055 !! wikitext
10056 {{FULLPAGENAMEE}}
10057 !! html/*
10058 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10059 </p>
10060 !! end
10061
10062 !! test
10063 Magic Word: {{TALKSPACE}}
10064 !! options
10065 title=[[User:Ævar Arnfjörð Bjarmason]]
10066 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10067 !! wikitext
10068 {{TALKSPACE}}
10069 !! html/*
10070 <p>User talk
10071 </p>
10072 !! end
10073
10074 !! test
10075 Magic Word: {{TALKSPACE}}, same namespace
10076 !! options
10077 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10078 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10079 !! wikitext
10080 {{TALKSPACE}}
10081 !! html/*
10082 <p>User talk
10083 </p>
10084 !! end
10085
10086 !! test
10087 Magic Word: {{TALKSPACE}}, main namespace
10088 !! options
10089 title=[[Parser Test]]
10090 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10091 !! wikitext
10092 {{TALKSPACE}}
10093 !! html/*
10094 <p>Talk
10095 </p>
10096 !! end
10097
10098 !! test
10099 Magic Word: {{TALKSPACEE}}
10100 !! options
10101 title=[[User:Ævar Arnfjörð Bjarmason]]
10102 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10103 !! wikitext
10104 {{TALKSPACEE}}
10105 !! html/*
10106 <p>User_talk
10107 </p>
10108 !! end
10109
10110 !! test
10111 Magic Word: {{SUBJECTSPACE}}
10112 !! options
10113 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10114 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10115 !! wikitext
10116 {{SUBJECTSPACE}}
10117 !! html/*
10118 <p>User
10119 </p>
10120 !! end
10121
10122 !! test
10123 Magic Word: {{SUBJECTSPACE}}, same namespace
10124 !! options
10125 title=[[User:Ævar Arnfjörð Bjarmason]]
10126 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10127 !! wikitext
10128 {{SUBJECTSPACE}}
10129 !! html/*
10130 <p>User
10131 </p>
10132 !! end
10133
10134 !! test
10135 Magic Word: {{SUBJECTSPACE}}, main namespace
10136 !! options
10137 title=[[Parser Test]]
10138 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10139 !! wikitext
10140 {{SUBJECTSPACE}}
10141 !! html/*
10142
10143 !! end
10144
10145 !! test
10146 Magic Word: {{SUBJECTSPACEE}}
10147 !! options
10148 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10149 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10150 !! wikitext
10151 {{SUBJECTSPACEE}}
10152 !! html/*
10153 <p>User
10154 </p>
10155 !! end
10156
10157 !! test
10158 Magic Word: {{NAMESPACE}}
10159 !! options
10160 title=[[User:Ævar Arnfjörð Bjarmason]]
10161 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10162 !! wikitext
10163 {{NAMESPACE}}
10164 !! html/*
10165 <p>User
10166 </p>
10167 !! end
10168
10169 !! test
10170 Magic Word: {{NAMESPACEE}}
10171 !! options
10172 title=[[User:Ævar Arnfjörð Bjarmason]]
10173 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10174 !! wikitext
10175 {{NAMESPACEE}}
10176 !! html/*
10177 <p>User
10178 </p>
10179 !! end
10180
10181 !! test
10182 Magic Word: {{NAMESPACENUMBER}}
10183 !! options
10184 title=[[User:Ævar Arnfjörð Bjarmason]]
10185 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10186 !! wikitext
10187 {{NAMESPACENUMBER}}
10188 !! html/*
10189 <p>2
10190 </p>
10191 !! end
10192
10193 !! test
10194 Magic Word: {{SUBPAGENAME}}
10195 !! options
10196 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
10197 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10198 !! wikitext
10199 {{SUBPAGENAME}}
10200 !! html/*
10201 <p>sub ö
10202 </p>
10203 !! end
10204
10205 !! test
10206 Magic Word: {{SUBPAGENAMEE}}
10207 !! options
10208 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
10209 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10210 !! wikitext
10211 {{SUBPAGENAMEE}}
10212 !! html/*
10213 <p>sub_%C3%B6
10214 </p>
10215 !! end
10216
10217 !! test
10218 Magic Word: {{ROOTPAGENAME}}
10219 !! options
10220 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
10221 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10222 !! wikitext
10223 {{ROOTPAGENAME}}
10224 !! html/*
10225 <p>Ævar Arnfjörð Bjarmason
10226 </p>
10227 !! end
10228
10229 !! test
10230 Magic Word: {{ROOTPAGENAMEE}}
10231 !! options
10232 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
10233 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10234 !! wikitext
10235 {{ROOTPAGENAMEE}}
10236 !! html/*
10237 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10238 </p>
10239 !! end
10240
10241 !! test
10242 Magic Word: {{BASEPAGENAME}}
10243 !! options
10244 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
10245 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10246 !! wikitext
10247 {{BASEPAGENAME}}
10248 !! html/*
10249 <p>Ævar Arnfjörð Bjarmason
10250 </p>
10251 !! end
10252
10253 !! test
10254 Magic Word: {{BASEPAGENAMEE}}
10255 !! options
10256 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
10257 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10258 !! wikitext
10259 {{BASEPAGENAMEE}}
10260 !! html/*
10261 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10262 </p>
10263 !! end
10264
10265 !! test
10266 Magic Word: {{TALKPAGENAME}}
10267 !! options
10268 title=[[User:Ævar Arnfjörð Bjarmason]]
10269 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10270 !! wikitext
10271 {{TALKPAGENAME}}
10272 !! html/*
10273 <p>User talk:Ævar Arnfjörð Bjarmason
10274 </p>
10275 !! end
10276
10277 !! test
10278 Magic Word: {{TALKPAGENAMEE}}
10279 !! options
10280 title=[[User:Ævar Arnfjörð Bjarmason]]
10281 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10282 !! wikitext
10283 {{TALKPAGENAMEE}}
10284 !! html/*
10285 <p>User_talk:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10286 </p>
10287 !! end
10288
10289 !! test
10290 Magic Word: {{SUBJECTPAGENAME}}
10291 !! options
10292 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10293 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10294 !! wikitext
10295 {{SUBJECTPAGENAME}}
10296 !! html/*
10297 <p>User:Ævar Arnfjörð Bjarmason
10298 </p>
10299 !! end
10300
10301 !! test
10302 Magic Word: {{SUBJECTPAGENAMEE}}
10303 !! options
10304 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10305 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10306 !! wikitext
10307 {{SUBJECTPAGENAMEE}}
10308 !! html/*
10309 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10310 </p>
10311 !! end
10312
10313 !! test
10314 Magic Word: {{NUMBEROFFILES}}
10315 !! options
10316 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10317 !! wikitext
10318 {{NUMBEROFFILES}}
10319 !! html/*
10320 <p>7
10321 </p>
10322 !! end
10323
10324 !! test
10325 Magic Word: {{PAGENAME}}
10326 !! options
10327 title=[[User:Ævar Arnfjörð Bjarmason]]
10328 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10329 !! wikitext
10330 {{PAGENAME}}
10331 !! html/*
10332 <p>Ævar Arnfjörð Bjarmason
10333 </p>
10334 !! end
10335
10336 !! test
10337 Magic Word: {{PAGENAME}} with metacharacters
10338 !! options
10339 title=[['foo & bar = baz']]
10340 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10341 !! wikitext
10342 ''{{PAGENAME}}''
10343 !! html/php
10344 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
10345 </p>
10346 !! html+tidy
10347 <p><i>'foo &amp; bar = baz'</i></p>
10348 !! end
10349
10350 !! test
10351 Magic Word: {{PAGENAME}} with metacharacters (T28781)
10352 !! options
10353 title=[[*RFC 1234 http://example.com/]]
10354 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10355 !! wikitext
10356 {{PAGENAME}}
10357 !! html/php
10358 <p>&#42;RFC&#32;1234 http&#58;//example.com/
10359 </p>
10360 !! html+tidy
10361 <p>*RFC 1234 http://example.com/</p>
10362 !! end
10363
10364 !! test
10365 Magic Word: {{PAGENAMEE}}
10366 !! options
10367 title=[[User:Ævar Arnfjörð Bjarmason]]
10368 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10369 !! wikitext
10370 {{PAGENAMEE}}
10371 !! html/*
10372 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10373 </p>
10374 !! end
10375
10376 !! test
10377 Magic Word: {{PAGENAMEE}} with metacharacters (T28781)
10378 !! options
10379 title=[[*RFC 1234 http://example.com/]]
10380 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10381 !! wikitext
10382 {{PAGENAMEE}}
10383 !! html/php
10384 <p>&#42;RFC_1234_http&#58;//example.com/
10385 </p>
10386 !! html+tidy
10387 <p>*RFC_1234_http://example.com/</p>
10388 !! end
10389
10390 !! test
10391 Magic Word: {{REVISIONID}}
10392 !! options
10393 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10394 !! wikitext
10395 {{REVISIONID}}
10396 !! html/*
10397 <p>1337
10398 </p>
10399 !! end
10400
10401 !! test
10402 Magic Word: {{SCRIPTPATH}}
10403 !! options
10404 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10405 !! wikitext
10406 {{SCRIPTPATH}}
10407 !! html/*
10408
10409 !! end
10410
10411 !! test
10412 Magic Word: {{STYLEPATH}}
10413 !! options
10414 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10415 !! wikitext
10416 {{STYLEPATH}}
10417 !! html/*
10418 <p>/skins
10419 </p>
10420 !! end
10421
10422 !! test
10423 Magic Word: {{SERVER}}
10424 !! options
10425 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10426 !! wikitext
10427 {{SERVER}}
10428 !! html/*
10429 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
10430 </p>
10431 !! end
10432
10433 !! test
10434 Magic Word: {{SERVERNAME}}
10435 !! options
10436 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10437 !! wikitext
10438 {{SERVERNAME}}
10439 !! html/*
10440 <p>example.org
10441 </p>
10442 !! end
10443
10444 !! test
10445 Magic Word: {{SITENAME}}
10446 !! options
10447 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10448 !! wikitext
10449 {{SITENAME}}
10450 !! html/*
10451 <p>MediaWiki
10452 </p>
10453 !! end
10454
10455 !! test
10456 Magic Word: {{PAGELANGUAGE}}
10457 !! options
10458 language=fr
10459 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10460 !! wikitext
10461 {{PAGELANGUAGE}}
10462 !! html/*
10463 <p>fr
10464 </p>
10465 !! end
10466
10467 !! test
10468 Magic Word: {{PAGELANGUAGE}} on a page with no explicitly set language
10469 !! options
10470 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10471 !! wikitext
10472 {{PAGELANGUAGE}}
10473 !! html/*
10474 <p>en
10475 </p>
10476 !! end
10477
10478 !! test
10479 Case-sensitive magic words, when cased differently, should just be template transclusions
10480 !! wikitext
10481 {{CurrentMonth}}
10482 {{currentday}}
10483 {{cURreNTweEK}}
10484 {{currentHour}}
10485 !! html
10486 <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>
10487 <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>
10488 <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>
10489 <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>
10490 </p>
10491 !! end
10492
10493 !! test
10494 Case-insensitive magic words should still work with weird casing.
10495 !! wikitext
10496 {{sErVeRNaMe}}
10497 {{LCFirst:AOEU}}
10498 {{ucFIRST:aoeu}}
10499 {{SERver}}
10500 !! html
10501 <p>example.org
10502 aOEU
10503 Aoeu
10504 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
10505 </p>
10506 !! end
10507
10508 # From plwiki:PLOS_ONE
10509 !! test
10510 Parsoid: Page property magic word with magic word contents
10511 !! wikitext
10512 {{DISPLAYTITLE:''{{PAGENAME}}''}}
10513 !! html/parsoid
10514 <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>"}]]}'/>
10515 !! end
10516
10517 # NOTE: mw:ExpandedAttrs is not the best typeof here. mw:Transclusion is better.
10518 # But, this is a limitation of our representation and is documented in
10519 # TemplateHandler.js in processSpecialMagicWord
10520 !! test
10521 Parsoid: Template-generated DISPLAYTITLE
10522 !! wikitext
10523 {{{{echo|DISPLAYTITLE}}:Foo}}
10524 !! options
10525 showtitle
10526 !! config
10527 wgAllowDisplayTitle=true
10528 wgRestrictDisplayTitle=false
10529 !! html/php
10530 Foo
10531
10532 !! html/parsoid
10533 <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"}]]}'/>
10534 !! end
10535
10536 !! test
10537 Namespace 1 {{ns:1}}
10538 !! wikitext
10539 {{ns:1}}
10540 !! html
10541 <p>Talk
10542 </p>
10543 !! end
10544
10545 !! test
10546 Namespace 1 {{ns:01}}
10547 !! wikitext
10548 {{ns:01}}
10549 !! html
10550 <p>Talk
10551 </p>
10552 !! end
10553
10554 !! test
10555 Namespace 0 {{ns:0}} (T6783)
10556 !! wikitext
10557 {{ns:0}}
10558 !! html
10559
10560 !! end
10561
10562 !! test
10563 Namespace 0 {{ns:00}} (T6783)
10564 !! wikitext
10565 {{ns:00}}
10566 !! html
10567
10568 !! end
10569
10570 !! test
10571 Namespace -1 {{ns:-1}}
10572 !! wikitext
10573 {{ns:-1}}
10574 !! html
10575 <p>Special
10576 </p>
10577 !! end
10578
10579 !! test
10580 Namespace User {{ns:User}}
10581 !! wikitext
10582 {{ns:User}}
10583 !! html
10584 <p>User
10585 </p>
10586 !! end
10587
10588 !! test
10589 Namespace User talk {{ns:User_talk}}
10590 !! wikitext
10591 {{ns:User_talk}}
10592 !! html
10593 <p>User talk
10594 </p>
10595 !! end
10596
10597 !! test
10598 Namespace User talk {{ns:uSeR tAlK}}
10599 !! wikitext
10600 {{ns:uSeR tAlK}}
10601 !! html
10602 <p>User talk
10603 </p>
10604 !! end
10605
10606 !! test
10607 Namespace File {{ns:File}}
10608 !! wikitext
10609 {{ns:File}}
10610 !! html
10611 <p>File
10612 </p>
10613 !! end
10614
10615 !! test
10616 Namespace File {{ns:Image}}
10617 !! wikitext
10618 {{ns:Image}}
10619 !! html
10620 <p>File
10621 </p>
10622 !! end
10623
10624 !! test
10625 Namespace (lang=de) Benutzer {{ns:User}}
10626 !! options
10627 language=de
10628 !! wikitext
10629 {{ns:User}}
10630 !! html
10631 <p>Benutzer
10632 </p>
10633 !! end
10634
10635 !! test
10636 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
10637 !! options
10638 language=de
10639 !! wikitext
10640 {{ns:3}}
10641 !! html
10642 <p>Benutzer Diskussion
10643 </p>
10644 !! end
10645
10646 !! test
10647 Urlencode
10648 !! wikitext
10649 {{urlencode:hi world?!}}
10650 {{urlencode:hi world?!|WIKI}}
10651 {{urlencode:hi world?!|PATH}}
10652 {{urlencode:hi world?!|QUERY}}
10653 !! html/php
10654 <p>hi+world%3F%21
10655 hi_world%3F!
10656 hi%20world%3F%21
10657 hi+world%3F%21
10658 </p>
10659 !! end
10660
10661 !! test
10662 Magic Word: prioritize type info over data-parsoid
10663 !! options
10664 parsoid=html2wt
10665 !! html/parsoid
10666 <meta property="mw:PageProp/forcetoc" data-parsoid='{"magicSrc":"__NOTOC__"}'/>
10667 !! wikitext
10668 __FORCETOC__
10669 !! end
10670
10671 !! test
10672 Magic Word: serialize on separate line (parsoid)
10673 !! options
10674 parsoid=wt2wt,html2wt
10675 !! wikitext
10676 foo
10677 __NOTOC__
10678 bar
10679 !! html/parsoid
10680 foo<meta property="mw:PageProp/notoc"/>bar
10681 !! end
10682
10683 !! test
10684 Magic Word: rt non-english wikis
10685 !! options
10686 parsoid=wt2wt
10687 language=de
10688 !! wikitext
10689 __NOEDITSECTION__
10690 !! html/parsoid
10691 <meta property="mw:PageProp/noeditsection" data-parsoid='{"magicSrc":"__NOEDITSECTION__"}'/>
10692 !! end
10693
10694 !!test
10695 __proto__ is treated as normal wikitext (T105997)
10696 !!wikitext
10697 __proto__
10698 !!html
10699 <p>__proto__
10700 </p>
10701 !!end
10702
10703 ###
10704 ### Magic links
10705 ###
10706 !! test
10707 Magic links: internal link to RFC (T2479)
10708 !! wikitext
10709 [[RFC 123]]
10710 !! html/php
10711 <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>
10712 </p>
10713 !! html/parsoid
10714 <p><a rel="mw:WikiLink" href="./RFC_123" title="RFC 123">RFC 123</a></p>
10715 !! end
10716
10717 !! test
10718 Magic links: RFC (T2479)
10719 !! wikitext
10720 RFC 822
10721 !! html/php
10722 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
10723 </p>
10724 !! html/parsoid
10725 <p><a href="//tools.ietf.org/html/rfc822" rel="mw:ExtLink">RFC 822</a></p>
10726 !! end
10727
10728 !! test
10729 Magic links: RFC (T67278)
10730 !! wikitext
10731 This is RFC 822 but thisRFC 822 is not RFC 822linked.
10732 !! html/php
10733 <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.
10734 </p>
10735 !! html/parsoid
10736 <p>This is <a href="//tools.ietf.org/html/rfc822" rel="mw:ExtLink">RFC 822</a> but thisRFC 822 is not RFC 822linked.</p>
10737 !! end
10738
10739 !! test
10740 Magic links: RFC (w/ non-newline whitespace, T30950/T31025)
10741 !! wikitext
10742 RFC &nbsp;&#160;&#0160;&#xA0;&#Xa0; 822
10743 RFC
10744 822
10745 !! html/php
10746 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
10747 RFC
10748 822
10749 </p>
10750 !! html/parsoid
10751 <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>
10752 RFC
10753 822</p>
10754 !! end
10755
10756 !! test
10757 Magic links: ISBN (T3937)
10758 !! wikitext
10759 ISBN 0-306-40615-2
10760 !! html/php
10761 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
10762 </p>
10763 !! html/parsoid
10764 <p><a href="./Special:BookSources/0306406152" rel="mw:WikiLink">ISBN 0-306-40615-2</a></p>
10765 !! end
10766
10767 !! test
10768 Magic links: ISBN (T67278)
10769 !! wikitext
10770 This is ISBN 978-0-316-09811-3 but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.
10771 !! html/php
10772 <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.
10773 </p>
10774 !! html/parsoid
10775 <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>
10776 !! end
10777
10778 !! test
10779 Magic links: ISBN (w/ non-newline whitespace, T30950/T31025)
10780 !! wikitext
10781 ISBN &nbsp;&#160;&#0160;&#xA0;&#Xa0; 978&nbsp;0&#160;316&#0160;09811&#xA0;3
10782 ISBN
10783 9780316098113
10784 ISBN 978
10785 0316098113
10786 !! html/php
10787 <p><a href="/wiki/Special:BookSources/9780316098113" class="internal mw-magiclink-isbn">ISBN 978 0 316 09811 3</a>
10788 ISBN
10789 9780316098113
10790 ISBN 978
10791 0316098113
10792 </p>
10793 !! html/parsoid
10794 <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>
10795 ISBN
10796 9780316098113
10797 ISBN 978
10798 0316098113</p>
10799 !! end
10800
10801 !! test
10802 Magic links: PMID incorrectly converts space to underscore
10803 !! wikitext
10804 PMID 1234
10805 !! html/php
10806 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
10807 </p>
10808 !! html/parsoid
10809 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract" rel="mw:ExtLink">PMID 1234</a></p>
10810 !! end
10811
10812 !! test
10813 Magic links: PMID (T67278)
10814 !! wikitext
10815 This is PMID 1234 but thisPMID 1234 is not PMID 1234linked.
10816 !! html/php
10817 <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.
10818 </p>
10819 !! html/parsoid
10820 <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>
10821 !! end
10822
10823 !! test
10824 Magic links: PMID (w/ non-newline whitespace, T30950/T31025)
10825 !! wikitext
10826 PMID &nbsp;&#160;&#0160;&#xA0;&#Xa0; 1234
10827 PMID
10828 1234
10829 !! html/php
10830 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
10831 PMID
10832 1234
10833 </p>
10834 !! html/parsoid
10835 <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>
10836 PMID
10837 1234</p>
10838 !! end
10839
10840 # <nowiki> nodes shouldn't be inserted during html2wt by Parsoid,
10841 # since these are ExtLinkText, not MagicLinkText
10842 !! test
10843 Magic links: use appropriate serialization for "almost" magic links.
10844 !! wikitext
10845 X[[Special:BookSources/0978739256|foo]]
10846
10847 X[//tools.ietf.org/html/rfc1234 foo]
10848 !! html/php
10849 <p>X<a href="/wiki/Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a>
10850 </p><p>X<a rel="nofollow" class="external text" href="//tools.ietf.org/html/rfc1234">foo</a>
10851 </p>
10852 !! html/parsoid
10853 <p>X<a rel="mw:WikiLink" href="./Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a></p>
10854 <p>X<a rel="mw:ExtLink" href="//tools.ietf.org/html/rfc1234">foo</a></p>
10855 !! end
10856
10857 !! test
10858 Magic links: All disabled (T47942)
10859 !! options
10860 wgEnableMagicLinks={"ISBN":false, "PMID":false, "RFC":false}
10861 !! wikitext
10862 ISBN 0-306-40615-2
10863 PMID 1234
10864 RFC 4321
10865 !! html/php
10866 <p>ISBN 0-306-40615-2
10867 PMID 1234
10868 RFC 4321
10869 </p>
10870 !! end
10871
10872 ###
10873 ### Templates
10874 ####
10875
10876 !! test
10877 Nonexistent template
10878 !! wikitext
10879 {{thistemplatedoesnotexist}}
10880 !! html
10881 <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>
10882 </p>
10883 !! end
10884
10885 !! test
10886 Template with invalid target containing tags
10887 !! wikitext
10888 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
10889 !! html
10890 <p>{{a<b>b</b>|foo|a=b|a = b}}
10891 </p>
10892 !! end
10893
10894 !! test
10895 Template with invalid target containing unclosed tag
10896 !! wikitext
10897 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
10898 !! html
10899 <p>{{a<b>|foo|a=b|a = b}}</b>
10900 </p>
10901 !! end
10902
10903 !! test
10904 Template with invalid target containing wikilink
10905 !! wikitext
10906 {{[[Main Page]]}}
10907 !! html/php
10908 <p>{{<a href="/wiki/Main_Page" title="Main Page">Main Page</a>}}
10909 </p>
10910 !! html/parsoid
10911 <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>
10912 !! end
10913
10914 !! test
10915 Template with just whitespace in it, T70421
10916 !! wikitext
10917 {{echo|{{ }}}}
10918 !! html/parsoid
10919 <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>
10920 !! end
10921
10922 !! article
10923 Template:test
10924 !! text
10925 This is a test template
10926 !! endarticle
10927
10928 !! test
10929 Simple template
10930 !! wikitext
10931 {{test}}
10932 !! html
10933 <p>This is a test template
10934 </p>
10935 !! end
10936
10937 !! test
10938 Template with explicit namespace
10939 !! wikitext
10940 {{Template:test}}
10941 !! html
10942 <p>This is a test template
10943 </p>
10944 !! end
10945
10946
10947 !! article
10948 Template:paramtest
10949 !! text
10950 This is a test template with parameter {{{param}}}
10951 !! endarticle
10952
10953 !! test
10954 Template parameter
10955 !! wikitext
10956 {{paramtest|param=foo}}
10957 !! html
10958 <p>This is a test template with parameter foo
10959 </p>
10960 !! end
10961
10962 !! article
10963 Template:paramtestnum
10964 !! text
10965 [[{{{1}}}|{{{2}}}]]
10966 !! endarticle
10967
10968 !! test
10969 Template unnamed parameter
10970 !! wikitext
10971 {{paramtestnum|Main Page|the main page}}
10972 !! html
10973 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
10974 </p>
10975 !! end
10976
10977 !! article
10978 Template:templatesimple
10979 !! text
10980 (test)
10981 !! endarticle
10982
10983 !! article
10984 Template:templateredirect
10985 !! text
10986 #redirect [[Template:templatesimple]]
10987 !! endarticle
10988
10989 !! article
10990 Template:templateasargtestnum
10991 !! text
10992 {{{{{1}}}}}
10993 !! endarticle
10994
10995 !! article
10996 Template:templateasargtest
10997 !! text
10998 {{template{{{templ}}}}}
10999 !! endarticle
11000
11001 !! article
11002 Template:templateasargtest2
11003 !! text
11004 {{{{{templ}}}}}
11005 !! endarticle
11006
11007 !! test
11008 Template with template name as unnamed argument
11009 !! wikitext
11010 {{templateasargtestnum|templatesimple}}
11011 !! html
11012 <p>(test)
11013 </p>
11014 !! end
11015
11016 !! test
11017 Template with template name as argument
11018 !! wikitext
11019 {{templateasargtest|templ=simple}}
11020 !! html
11021 <p>(test)
11022 </p>
11023 !! end
11024
11025 !! test
11026 Template with template name as argument (2)
11027 !! wikitext
11028 {{templateasargtest2|templ=templatesimple}}
11029 !! html
11030 <p>(test)
11031 </p>
11032 !! end
11033
11034 !! article
11035 Template:templateasargtestdefault
11036 !! text
11037 {{{{{templ|templatesimple}}}}}
11038 !! endarticle
11039
11040 !! article
11041 Template:templa
11042 !! text
11043 '''templ'''
11044 !! endarticle
11045
11046 !! test
11047 Template with default value
11048 !! wikitext
11049 {{templateasargtestdefault}}
11050 !! html
11051 <p>(test)
11052 </p>
11053 !! end
11054
11055 !! test
11056 Template with default value (value set)
11057 !! wikitext
11058 {{templateasargtestdefault|templ=templa}}
11059 !! html
11060 <p><b>templ</b>
11061 </p>
11062 !! end
11063
11064 !! test
11065 Template redirect
11066 !! wikitext
11067 {{templateredirect}}
11068 !! html/php
11069 <p>(test)
11070 </p>
11071 !! html/parsoid
11072 <link rel="mw:PageProp/redirect" href="./Template:Templatesimple" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"templateredirect","href":"./Template:Templateredirect"},"params":{},"i":0}}]}'/>
11073 !! end
11074
11075 !! test
11076 Template with argument in separate line
11077 !! wikitext
11078 {{ templateasargtest |
11079 templ = simple }}
11080 !! html
11081 <p>(test)
11082 </p>
11083 !! end
11084
11085 !! test
11086 Template with complex template as argument
11087 !! wikitext
11088 {{paramtest|
11089 param ={{ templateasargtest |
11090 templ = simple }}}}
11091 !! html
11092 <p>This is a test template with parameter (test)
11093 </p>
11094 !! end
11095
11096 !! test
11097 Templates with templated name
11098 !! wikitext
11099 {{{{echo|echo}}|foo}}
11100 {{{{echo|inner list}} }}
11101 !! html
11102 <p>foo
11103 </p>
11104 <ul><li> item 1</li></ul>
11105
11106 !! html/parsoid
11107 <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>
11108 <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>
11109 !! end
11110
11111 # Parsoid markup is deliberate "broken". This is an edge case.
11112 # See long comment in TemplateHandler.js:convertAttribsToString.
11113 !! test
11114 Templates with invalid templated targets
11115 !! wikitext
11116 {{echo
11117 {{echo|foo}}
11118 }}
11119 !! html/php
11120 <p>{{echo
11121 foo
11122 }}
11123 </p>
11124 !! html/parsoid
11125 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo\n{{echo|foo}}\n"},"params":{},"i":0}}]}'>{{echo
11126 foo }}</p>
11127 !! end
11128
11129 !! test
11130 Template with thumb image (with link in description)
11131 !! wikitext
11132 {{paramtest|param=[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
11133 !! html/php
11134 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>
11135
11136 !! html+tidy
11137 <p>This is a test template with parameter</p>
11138 <div class="thumb tright">
11139 <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>
11140 <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>
11141 </div>
11142 </div>
11143 !! html/parsoid
11144 <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>
11145 !! end
11146
11147 !! article
11148 Template:complextemplate
11149 !! text
11150 {{{1}}} {{paramtest|
11151 param ={{{param}}}}}
11152 !! endarticle
11153
11154 !! test
11155 Template with complex arguments
11156 !! wikitext
11157 {{complextemplate|
11158 param ={{ templateasargtest |
11159 templ = simple }}|[[Template:complextemplate|link]]}}
11160 !! html
11161 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
11162 </p>
11163 !! end
11164
11165 !! test
11166 T2553: link with two variables in a piped link
11167 !! wikitext
11168 {|
11169 |[[{{{1}}}|{{{2}}}]]
11170 |}
11171 !! html/php
11172 <table>
11173 <tr>
11174 <td>[[{{{1}}}|{{{2}}}]]
11175 </td></tr></table>
11176
11177 !! html/parsoid
11178 <table>
11179 <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>
11180 </tbody></table>
11181 !! end
11182
11183 # See: T2553
11184 !! test
11185 Abort table cell attribute parsing on wikilink
11186 !! wikitext
11187 {|
11188 | testing [[one|two]] | three || four
11189 | testing one two | three || four
11190 | testing="[[one|two]]" | three || four
11191 |}
11192 !! html/php
11193 <table>
11194 <tr>
11195 <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>
11196 <td> four
11197 </td>
11198 <td> three </td>
11199 <td> four
11200 </td>
11201 <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>
11202 <td> four
11203 </td></tr></table>
11204
11205 !! html/parsoid
11206 <table>
11207 <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>
11208 <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>
11209 <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>
11210 </tbody></table>
11211 !! end
11212
11213 !! test
11214 Don't abort table cell attribute parsing if wikilink is found in template arg
11215 !! wikitext
11216 {|
11217 | Test {{#tag:ref|One two "[[three]]" four}}
11218 |}
11219 !! html/parsoid
11220 <table>
11221 <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>
11222 </tbody></table>
11223 !! end
11224
11225 !! test
11226 Magic variable as template parameter
11227 !! wikitext
11228 {{paramtest|param={{SITENAME}}}}
11229 !! html
11230 <p>This is a test template with parameter MediaWiki
11231 </p>
11232 !! end
11233
11234 !! article
11235 Template:linktest
11236 !! text
11237 [[{{{param}}}|link]]
11238 !! endarticle
11239
11240 !! test
11241 Template parameter as link source
11242 !! wikitext
11243 {{linktest|param=Main Page}}
11244 !! html
11245 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
11246 </p>
11247 !! end
11248
11249 !!article
11250 Template:paramtest2
11251 !! text
11252 including another template, {{paramtest|param={{{arg}}}}}
11253 !! endarticle
11254
11255 !! test
11256 Template passing argument to another template
11257 !! wikitext
11258 {{paramtest2|arg='hmm'}}
11259 !! html
11260 <p>including another template, This is a test template with parameter 'hmm'
11261 </p>
11262 !! end
11263
11264 !! article
11265 Template:Linktest2
11266 !! text
11267 Main Page
11268 !! endarticle
11269
11270 !! test
11271 Template as link source
11272 !! wikitext
11273 [[{{linktest2}}]]
11274
11275 [[{{linktest2}}|Main Page]]
11276
11277 [[{{linktest2}}]]Page
11278 !! html
11279 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
11280 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
11281 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
11282 </p>
11283 !! end
11284
11285
11286 !! article
11287 Template:loop1
11288 !! text
11289 {{loop2}}
11290 !! endarticle
11291
11292 !! article
11293 Template:loop2
11294 !! text
11295 {{loop1}}
11296 !! endarticle
11297
11298 !! test
11299 Template infinite loop
11300 !! wikitext
11301 {{loop1}}
11302 !! html
11303 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
11304 </p>
11305 !! end
11306
11307 !! test
11308 Template from main namespace
11309 !! wikitext
11310 {{:Main Page}}
11311 !! html
11312 <p>blah blah
11313 </p>
11314 !! end
11315
11316 !! article
11317 Template:table
11318 !! text
11319 {|
11320 | 1 || 2
11321 |-
11322 | 3 || 4
11323 |}
11324 !! endarticle
11325
11326 !! test
11327 T2529: Template with table, not included at beginning of line
11328 !! wikitext
11329 foo {{table}}
11330 !! html
11331 <p>foo
11332 </p>
11333 <table>
11334 <tr>
11335 <td> 1 </td>
11336 <td> 2
11337 </td></tr>
11338 <tr>
11339 <td> 3 </td>
11340 <td> 4
11341 </td></tr></table>
11342
11343 !! end
11344
11345 !! test
11346 T2523: Template shouldn't eat newline (or add an extra one before table)
11347 !! wikitext
11348 foo
11349 {{table}}
11350 !! html
11351 <p>foo
11352 </p>
11353 <table>
11354 <tr>
11355 <td> 1 </td>
11356 <td> 2
11357 </td></tr>
11358 <tr>
11359 <td> 3 </td>
11360 <td> 4
11361 </td></tr></table>
11362
11363 !! end
11364
11365 !! test
11366 T2041: Template parameters shown as broken links
11367 !! wikitext
11368 {{{parameter}}}
11369 !! html
11370 <p>{{{parameter}}}
11371 </p>
11372 !! end
11373
11374 !! test
11375 Template with targets containing wikilinks
11376 !! options
11377 parsoid=wt2html
11378 !! wikitext
11379 {{[[foo]]}}
11380
11381 {{[[{{echo|foo}}]]}}
11382
11383 {{{{echo|[[foo}}]]}}
11384 !! html/php
11385 <p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
11386 </p><p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
11387 </p><p>{{[[foo}}]]
11388 </p>
11389 !! html/parsoid
11390 <p>{{<a rel="mw:WikiLink" href="./Foo" title="Foo">foo</a>}}</p>
11391 <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>
11392 <p>{{<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[foo}}]]"}},"i":0}}]}'>[[foo}}]]</span></p>
11393 !! end
11394
11395 !! article
11396 Template:''
11397 !! text
11398 bar
11399 !! endarticle
11400
11401 !! test
11402 Templates: Double quotes as template target
11403 !! wikitext
11404 foo {{''}} baz
11405 !! html/php
11406 <p>foo bar baz
11407 </p>
11408 !! html/parsoid
11409 <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
11410 </p>
11411 !! end
11412
11413 ## This test is about making sure Parsoid's data-mw is well formed in the
11414 ## face of multiple templates with intersecting and overlapping ranges. The
11415 ## wikitext itself is wretched.
11416 !! test
11417 Templates with intersecting and overlapping ranges
11418 !! wikitext
11419 {|{{echo|
11420 <p>ha</p>}}
11421 {|{{echo|
11422 <p>ho</p>}}
11423 {{echo|{{!}}hi}}
11424 |}
11425 !! html/php+tidy
11426 <p>ha</p>
11427 <p>ho</p>
11428 <table>
11429 <tr>
11430 <td></td>
11431 </tr>
11432 <tr>
11433 <td>hi</td>
11434 </tr>
11435 </table>
11436 <table>
11437 <tr>
11438 <td></td>
11439 </tr>
11440 </table>
11441 !! html/parsoid
11442 <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":""}]]}'>
11443
11444 </table><p about="#mwt1">ho</p><table about="#mwt1" typeof="mw:ExpandedAttrs" data-mw='{"attribs":[[{"txt":"","html":""},{"html":""}]]}'>
11445
11446 <tbody><tr><td>hi</td></tr>
11447 </tbody></table>
11448 !! end
11449
11450 !! article
11451 Template:MSGNW test
11452 !! text
11453 ''None'' of '''this''' should be
11454 * interpreted
11455 but rather passed unmodified
11456 {{test}}
11457 <gallery>
11458 File:Foobar.jpg
11459 </gallery>
11460 <!-- comment -->
11461 !! endarticle
11462
11463 # hmm, fix this or just deprecate msgnw and document its behavior?
11464 !! test
11465 msgnw keyword
11466 !! wikitext
11467 {{msgnw:MSGNW test}}
11468 !! html/php
11469 <p>&#39;&#39;None&#39;&#39; of &#39;&#39;&#39;this&#39;&#39;&#39; should be
11470 &#42; interpreted
11471 &#32;but rather passed unmodified
11472 &#123;&#123;test&#125;&#125;
11473 &#60;gallery&#62;
11474 File:Foobar.jpg
11475 &#60;/gallery&#62;
11476 &#60;!-- comment --&#62;
11477 </p>
11478 !! end
11479
11480 !! test
11481 int keyword
11482 !! wikitext
11483 {{int:youhavenewmessages|lots of money|not!}}
11484 !! html
11485 <p>You have lots of money (not!).
11486 </p>
11487 !! end
11488
11489 !! test
11490 int keyword - non-existing message
11491 !! wikitext
11492 {{int:var}}
11493 !! html
11494 <p>⧼var⧽
11495 </p>
11496 !! end
11497
11498 !! article
11499 Template:Includes
11500 !! text
11501 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
11502 !! endarticle
11503
11504 !! test
11505 <includeonly> and <noinclude> being included
11506 !! wikitext
11507 {{Includes}}
11508 !! html
11509 <p>Foobar
11510 </p>
11511 !! end
11512
11513 !! article
11514 Template:Includes2
11515 !! text
11516 <onlyinclude>Foo</onlyinclude>bar
11517 !! endarticle
11518
11519 !! test
11520 <onlyinclude> being included
11521 !! wikitext
11522 {{Includes2}}
11523 !! html
11524 <p>Foo
11525 </p>
11526 !! end
11527
11528
11529 !! article
11530 Template:Includes3
11531 !! text
11532 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
11533 !! endarticle
11534
11535 !! test
11536 <onlyinclude> and <includeonly> being included
11537 !! wikitext
11538 {{Includes3}}
11539 !! html
11540 <p>Foo
11541 </p>
11542 !! end
11543
11544 !! test
11545 <includeonly> and <noinclude> on a page
11546 !! wikitext
11547 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
11548 !! html
11549 <p>Foozar
11550 </p>
11551 !! end
11552
11553 !! test
11554 Un-closed <noinclude>
11555 !! wikitext
11556 <noinclude>
11557 !! html
11558 !! end
11559
11560 !! test
11561 <onlyinclude> on a page
11562 !! wikitext
11563 <onlyinclude>Foo</onlyinclude>bar
11564 !! html
11565 <p>Foobar
11566 </p>
11567 !! end
11568
11569 !! test
11570 Un-closed <onlyinclude>
11571 !! wikitext
11572 <onlyinclude>
11573 !! html
11574 !! end
11575
11576 !!test
11577 Self-closed noinclude, includeonly, onlyinclude tags
11578 !! wikitext
11579 <noinclude />
11580 <includeonly />
11581 <onlyinclude />
11582 !! html
11583 <p><br />
11584 </p>
11585 !!end
11586
11587 !!test
11588 Unbalanced includeonly and noinclude tags
11589 !! wikitext
11590 {|
11591 |a</noinclude>
11592 |b</noinclude></noinclude>
11593 |c</noinclude></includeonly>
11594 |d</includeonly></includeonly>
11595 |}
11596 !! html
11597 <table>
11598 <tr>
11599 <td>a
11600 </td>
11601 <td>b
11602 </td>
11603 <td>c&lt;/includeonly&gt;
11604 </td>
11605 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
11606 </td></tr></table>
11607
11608 !!end
11609
11610 !! article
11611 Template:Includeonly section
11612 !! text
11613 <includeonly>
11614 ==Includeonly section==
11615 </includeonly>
11616 ==Section T-1==
11617 !!endarticle
11618
11619 !! test
11620 T8563: Edit link generation for section shown by <includeonly>
11621 !! wikitext
11622 {{includeonly section}}
11623 !! html
11624 <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>
11625 <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>
11626
11627 !! end
11628
11629 # Uses same input as the contents of [[Template:Includeonly section]]
11630 !! test
11631 T8563: Section extraction for section shown by <includeonly>
11632 !! options
11633 section=T-2
11634 !! wikitext
11635 <includeonly>
11636 ==Includeonly section==
11637 </includeonly>
11638 ==Section T-2==
11639 !! html
11640 ==Section T-2==
11641 !! end
11642
11643 !! test
11644 T8563: Edit link generation for section suppressed by <includeonly>
11645 !! wikitext
11646 <includeonly>
11647 ==Includeonly section==
11648 </includeonly>
11649 ==Section 1==
11650 !! html
11651 <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>
11652
11653 !! end
11654
11655 !! test
11656 T8563: Section extraction for section suppressed by <includeonly>
11657 !! options
11658 section=1
11659 !! wikitext
11660 <includeonly>
11661 ==Includeonly section==
11662 </includeonly>
11663 ==Section 1==
11664 !! html
11665 ==Section 1==
11666 !! end
11667
11668 !! test
11669 Un-closed <includeonly>
11670 !! wikitext
11671 <includeonly>
11672 !! html/php
11673 !! html/parsoid
11674 <meta typeof="mw:Includes/IncludeOnly" data-parsoid='{"src":"&lt;includeonly>"}'/>
11675 !! end
11676
11677 ## We used to, but no longer wt2wt this test since the default serializer
11678 ## will normalize the include directives to serialize on their own line.
11679 ## Selser will take care of preserving formatting in scenarios where they
11680 ## intermingled with other wikitext.
11681 !! test
11682 Includes and comments at SOL
11683 !! options
11684 parsoid=wt2html,html2html
11685 !! wikitext
11686 <!-- comment --><noinclude><!-- comment --></noinclude><!-- comment -->== hu ==
11687
11688 <noinclude>
11689 some
11690 </noinclude>* stuff
11691 * here
11692
11693 <includeonly>can have stuff</includeonly>=== here ===
11694
11695 !! html/php
11696 <h2><span class="mw-headline" id="hu">hu</span></h2>
11697 <p>some
11698 </p>
11699 <ul><li> stuff</li>
11700 <li> here</li></ul>
11701 <h3><span class="mw-headline" id="here">here</span></h3>
11702
11703 !! html/parsoid
11704 <!-- 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>
11705
11706 <meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/>
11707 <p>some</p>
11708 <meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"&lt;/noinclude>"}'/><ul><li> stuff</li>
11709 <li> here</li></ul>
11710
11711 <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>
11712
11713 !! end
11714
11715 # TODO: test with DOM fragment reuse!
11716 !! test
11717 Parsoid: DOM fragment reuse
11718 !! options
11719 parsoid=wt2wt,wt2html
11720 !! wikitext
11721 a{{echo|b<table></table>c}}d
11722
11723 a{{echo|b
11724 <table></table>
11725 c}}d
11726
11727 {{echo|a
11728
11729 <table></table>
11730
11731 b}}
11732 !! html
11733 <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>
11734
11735 <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">
11736 </span><table about="#mwt2" data-parsoid='{"stx":"html"}'></table><span about="#mwt2">
11737 </span><p about="#mwt2">cd</p>
11738
11739 <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">
11740
11741 </span><table about="#mwt3" data-parsoid='{"stx":"html"}'></table><span about="#mwt3">
11742
11743 </span><p about="#mwt3">b</p>
11744 !! end
11745
11746 !! test
11747 Parsoid: Merge double tds (T52603)
11748 !! options
11749 parsoid
11750 !! wikitext
11751 {|
11752 |{{echo|{{!}} foo}}
11753 |}
11754 !! html
11755 <table><tbody>
11756 <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>
11757 </tbody></table>
11758 !! end
11759
11760 !! test
11761 Parsoid: Merge double tds in nested transclusion content (T52603)
11762 !! options
11763 parsoid
11764 !! wikitext
11765 {{echo|<div>}}
11766 {|
11767 |{{echo|{{!}} foo}}
11768 |}
11769 {{echo|</div>}}
11770 !! html
11771 <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}}]}'>
11772 <table><tbody>
11773 <tr><td data-mw='{"parts":["|"]}'> foo</td></tr>
11774 </tbody></table>
11775 </div>
11776 !! end
11777
11778 ###
11779 ### <includeonly> and <noinclude> in attributes
11780 ###
11781 !!test
11782 0. includeonly around the entire attribute
11783 !! wikitext
11784 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
11785 !! html
11786 <p><span id="v2">bar</span>
11787 </p>
11788 !!end
11789
11790 !!test
11791 1. includeonly in html attr key
11792 !! wikitext
11793 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
11794 !! html
11795 <p><span id="foo">bar</span>
11796 </p>
11797 !!end
11798
11799 !!test
11800 2. includeonly in html attr value
11801 !! wikitext
11802 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
11803 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
11804 !! html
11805 <p><span id="v1">bar</span>
11806 <span id="v1">bar</span>
11807 </p>
11808 !!end
11809
11810 !!test
11811 3. includeonly in part of an attr value
11812 !! wikitext
11813 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
11814 !! html
11815 <p><span style="color:red;">bar</span>
11816 </p>
11817 !!end
11818
11819 !!test
11820 4. includeonly in table attributes
11821 !! wikitext
11822 {|
11823 |- <noinclude>
11824 |-
11825 |a
11826 </noinclude>
11827 |- <includeonly>
11828 |-
11829 |b
11830 </includeonly>
11831 |}
11832 !! html
11833 <table>
11834
11835
11836 <tr>
11837 <td>a
11838 </td></tr>
11839 </table>
11840
11841 !!end
11842
11843 ###
11844 ### Preprocessor precedence tests
11845 ### See: https://www.mediawiki.org/wiki/Preprocessor_ABNF
11846 ###
11847 ##{{[[-{{{{{{[[Foo|bar}}]]}-}}}}}]]
11848 !! test
11849 Preprocessor precedence 1: link is rightmost opening
11850 !! wikitext
11851 {{[[Foo|bar}}]]
11852
11853 But close-brace is not a valid character in a link title:
11854 {{[[Foo}}|bar]]
11855
11856 However, we can still tell this was handled as a link in the preprocessor:
11857 {{echo|[[Foo}}|bar]]|bat}}
11858 !! html
11859 <p>{{<a href="/wiki/Foo" title="Foo">bar}}</a>
11860 </p><p>But close-brace is not a valid character in a link title:
11861 {{[[Foo}}|bar]]
11862 </p><p>However, we can still tell this was handled as a link in the preprocessor:
11863 [[Foo}}|bar]]
11864 </p>
11865 !! end
11866
11867 !! test
11868 Preprocessor precedence 2: template is rightmost opening
11869 !! options
11870 language=zh
11871 !! wikitext
11872 -{{echo|foo}-}}-
11873 !! html
11874 <p>-foo}--
11875 </p>
11876 !! end
11877
11878 !! test
11879 Preprocessor precedence 3: language converter is rightmost opening
11880 !! options
11881 language=zh
11882 !! wikitext
11883 {{echo|hi}}
11884
11885 {{-{R|echo|hi}}}-
11886
11887 [[-{R|raw]]}-
11888 !! html
11889 <p>hi
11890 </p><p>{{echo|hi}}
11891 </p><p>[[raw]]
11892 </p>
11893 !! end
11894
11895 !! test
11896 Preprocessor precedence 4: left-most angle bracket
11897 !! options
11898 language=zh
11899 !! wikitext
11900 <!--{raw}-->
11901 !! html
11902 !! end
11903
11904 !! article
11905 Template:Precedence5
11906 !! text
11907 {{{{{1}}}}}
11908 !! endarticle
11909
11910 !! test
11911 Preprocessor precedence 5: tplarg takes precedence over template
11912 !! wikitext
11913 {{Precedence5|Bullet}}
11914 !! html
11915 <ul><li> Bar</li></ul>
11916
11917 !! end
11918
11919 !! test
11920 Preprocessor precedence 6: broken link is rightmost opening
11921 !! wikitext
11922 {{echo|[[Foo}}
11923
11924 {{echo|[[Foo|bar|bat=baz}}
11925 !! html
11926 <p>{{echo|[[Foo}}
11927 </p><p>{{echo|[[Foo|bar|bat=baz}}
11928 </p>
11929 !! end
11930
11931 # This next test exposes a difference between PHP and Parsoid:
11932 # Given [[Foo|{{echo|Bar]]x}}y]]z:
11933 # 1) Both PHP and Parsoid ignore the `]]` inside the `echo` in the
11934 # "preprocessor" stage. The `{{echo` extends until the `x}}`, and the
11935 # outer `[[Foo` extends until the `y]]`
11936 # 2a) But then the PHP preprocessor emits `[[Foo|Bar]]xy]]z` as an
11937 # intermediate result (after template expansion), and link processing
11938 # happens on this intermediate result, which moves the wikilink
11939 # boundary leftward to `[[Foo|Bar]]`
11940 # 2b) Parsoid works in a single step, so it's going to keep the
11941 # wikilink as extending to the `y]]`
11942 # 3a) Then PHP does linktrail processing which slurps up the trailing
11943 # `xy` inside the link.
11944 # 3b) Parsoid will do linktrail processing to slurp up the trailing
11945 # `z` inside the link.
11946 # This is "correct" behavior. Parsoid's basic worldview is that the
11947 # `]]` inside the template shouldn't be allowed to leak out to affect
11948 # the surrounding wikilink. PHP may match Parsoid (in the future)
11949 # if you use {{#balance}} (T114445).
11950
11951 !! test
11952 Preprocessor precedence 7: broken template is rightmost opening
11953 !! wikitext
11954 [[Foo|{{echo|Bar]]
11955
11956 [[Foo|{{echo|Bar]]-x}}-y]]-z
11957
11958 Careful: linktrails can move the end of the wikilink:
11959 [[Foo|{{echo|y']]a}}l]]l
11960 !! html
11961 <p><a href="/wiki/Foo" title="Foo">{{echo|Bar</a>
11962 </p><p><a href="/wiki/Foo" title="Foo">Bar</a>-x-y]]-z
11963 </p><p>Careful: linktrails can move the end of the wikilink:
11964 <a href="/wiki/Foo" title="Foo">y'al</a>]]l
11965 </p>
11966 !! end
11967
11968 !! test
11969 Preprocessor precedence 8: broken language converter is rightmost opening
11970 !! options
11971 language=zh
11972 !! wikitext
11973 [[Foo-{R|raw]]
11974 !! html
11975 <p>[[Foo-{R|raw]]
11976 </p>
11977 !! end
11978
11979 !! article
11980 Template:Preprocessor_precedence_9
11981 !! text
11982 ;4: {{{{1}}}}
11983 ;5: {{{{{2}}}}}
11984 ;6: {{{{{{3}}}}}}
11985 ;7: {{{{{{{4}}}}}}}
11986 !! endarticle
11987
11988 !! test
11989 Preprocessor precedence 9: groups of braces
11990 !! wikitext
11991 {{Preprocessor precedence 9|Four|Bullet|1|2}}
11992 !! html
11993 <dl><dt>4</dt>
11994 <dd> {Four}</dd>
11995 <dt>5</dt>
11996 <dd> </dd></dl>
11997 <ul><li> Bar</li></ul>
11998 <dl><dt>6</dt>
11999 <dd> Four</dd>
12000 <dt>7</dt>
12001 <dd> {Bullet}</dd></dl>
12002
12003 !! end
12004
12005 !! article
12006 Template:Preprocessor_precedence_10
12007 !! text
12008 ;1: -{R|raw}-
12009 ;2: -{{Bullet}}-
12010 ;3: -{{{1}}}-
12011 ;4: -{{{{2}}}}-
12012 ;5: -{{{{{3}}}}}-
12013 ;6: -{{{{{{4}}}}}}-
12014 ;7: -{{{{{{{5}}}}}}}-
12015 !! endarticle
12016
12017 !! test
12018 Preprocessor precedence 10: groups of braces with leading dash
12019 !! options
12020 language=zh
12021 !! wikitext
12022 {{Preprocessor precedence 10|Three|raw2|Bullet|1|2}}
12023 !! html
12024 <dl><dt>1</dt>
12025 <dd> raw</dd>
12026 <dt>2</dt>
12027 <dd> -</dd></dl>
12028 <ul><li> Bar-</li></ul>
12029 <dl><dt>3</dt>
12030 <dd> -Three-</dd>
12031 <dt>4</dt>
12032 <dd> raw2</dd>
12033 <dt>5</dt>
12034 <dd> -</dd></dl>
12035 <ul><li> Bar-</li></ul>
12036 <dl><dt>6</dt>
12037 <dd> -Three-</dd>
12038 <dt>7</dt>
12039 <dd> raw2</dd></dl>
12040
12041 !! end
12042
12043 !! test
12044 Preprocessor precedence 11: found during visual diff testing
12045 !! wikitext
12046 {{#tag:span|-{{#tag:span|-{{echo|x}}}}}}
12047
12048 {{echo|-{{echo|-{{echo|x}}}}}}
12049
12050 {{echo|-{{echo|x}}}}
12051 !! html
12052 <p><span>-<span>-x</span></span>
12053 </p><p>--x
12054 </p><p>-x
12055 </p>
12056 !! end
12057
12058 !! test
12059 Preprocessor precedence 12: broken language converter closed by brace.
12060 !! wikitext
12061 This form breaks the template, which is unfortunate:
12062 * {{echo|foo-{bar}bat}}
12063
12064 But if the broken language converter markup is inside an extension
12065 tag, nothing bad happens:
12066 * <nowiki>foo-{bar}bat</nowiki>
12067 * {{echo|<nowiki>foo-{bar}bat</nowiki>}}
12068 * <pre>foo-{bar}bat</pre>
12069 * {{echo|<pre>foo-{bar}bat</pre>}}
12070
12071 <tag>foo-{bar}bat</tag>
12072 {{echo|<tag>foo-{bar}bat</tag>}}
12073
12074 !! html+tidy
12075 <p>This form breaks the template, which is unfortunate:</p>
12076 <ul>
12077 <li>{{echo|foo-{bar}bat}}</li>
12078 </ul>
12079 <p>But if the broken language converter markup is inside an extension tag, nothing bad happens:</p>
12080 <ul>
12081 <li>foo-{bar}bat</li>
12082 <li>foo-{bar}bat</li>
12083 <li>
12084 <pre>
12085 foo-{bar}bat
12086 </pre></li>
12087 <li>
12088 <pre>
12089 foo-{bar}bat
12090 </pre></li>
12091 </ul>
12092 <pre>
12093 'foo-{bar}bat'
12094 array (
12095 )
12096 </pre>
12097 <pre>
12098 'foo-{bar}bat'
12099 array (
12100 )
12101 </pre>
12102 !! end
12103
12104 !! test
12105 Preprocessor precedence, 13: broken language converter in external link
12106 !! wikitext
12107 * [http://example.com/-{foo Example in URL]
12108 * [http://example.com Example in -{link} description]
12109 * {{echo|[http://example.com/-{foo Breaks template, however]}}
12110 !! html+tidy
12111 <ul>
12112 <li><a rel="nofollow" class="external text" href="http://example.com/-{foo">Example in URL</a></li>
12113 <li><a rel="nofollow" class="external text" href="http://example.com">Example in -{link} description</a></li>
12114 <li>{{echo|<a rel="nofollow" class="external text" href="http://example.com/-{foo">Breaks template, however</a>}}</li>
12115 </ul>
12116 !! end
12117
12118 !! test
12119 Preprocessor precedence, 14: broken language converter in comment
12120 !! wikitext
12121 * <!--{{foo}}--> ...should be ok
12122 * <!---{{foo}}--> ...extra dashes
12123 * {{echo|foo<!-- -{bar} -->bat}} ...should be ok
12124 !! html+tidy
12125 <ul>
12126 <li>...should be ok</li>
12127 <li>...extra dashes</li>
12128 <li>foobat ...should be ok</li>
12129 </ul>
12130 !! end
12131
12132 !! test
12133 Preprocessor precedence, 15: broken brace markup in headings
12134 !! wikitext
12135 __NOTOC__ __NOEDITSECTION__
12136 ===1 foo[bar 1===
12137 1
12138 ===2 foo[[bar 2===
12139 2
12140 ===3 foo{bar 3===
12141 3
12142 ===4 foo{{bar 4===
12143 4
12144 ===5 foo{{{bar 5===
12145 5
12146 ===6 foo-{bar 6===
12147 6
12148 !! html+tidy
12149 <h3><span class="mw-headline" id="1_foo.5Bbar_1">1 foo[bar 1</span></h3>
12150 <p>1</p>
12151 <h3><span class="mw-headline" id="2_foo.5B.5Bbar_2">2 foo[[bar 2</span></h3>
12152 <p>2</p>
12153 <h3><span class="mw-headline" id="3_foo.7Bbar_3">3 foo{bar 3</span></h3>
12154 <p>3</p>
12155 <h3><span class="mw-headline" id="4_foo.7B.7Bbar_4">4 foo{{bar 4</span></h3>
12156 <p>4</p>
12157 <h3><span class="mw-headline" id="5_foo.7B.7B.7Bbar_5">5 foo{{{bar 5</span></h3>
12158 <p>5</p>
12159 <h3><span class="mw-headline" id="6_foo-.7Bbar_6">6 foo-{bar 6</span></h3>
12160 <p>6</p>
12161 !! end
12162
12163 ###
12164 ### Token Stream Patcher tests
12165 ###
12166 ### These tests won't always pass wt2wt and other modes because
12167 ### on serialization, the table will be output on a new line.
12168 ### For now, we are blacklisting them, and using this to test selser.
12169 ###
12170
12171 !!test
12172 1. Table tag in SOL posn. should get reparsed correctly with valid TSR
12173 !!options
12174 parsoid=wt2html,wt2wt
12175 !!wikitext
12176 {{echo|}}{| width = '100%'
12177 |foo
12178 |}
12179 !!html/parsoid
12180 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":""}},"i":0}}]}'></span><table width="100%">
12181 <tbody><tr><td>foo</td></tr>
12182 </tbody></table>
12183 !!end
12184
12185 ## We used to, but no longer wt2wt this test since the default serializer
12186 ## will normalize the include directives to serialize on their own line.
12187 ## Selser will take care of preserving formatting in scenarios where they
12188 ## intermingled with other wikitext.
12189 !!test
12190 2. Table tag in SOL posn. should get reparsed correctly with valid TSR
12191 !!options
12192 parsoid=wt2html
12193 !!wikitext
12194 <includeonly>a</includeonly>{| {{{b}}}
12195 |c
12196 |}
12197 !!html/parsoid
12198 <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":""}]]}'>
12199 <tbody><tr><td>c</td></tr>
12200 </tbody></table>
12201 !!end
12202
12203 !! test
12204 Table wikitext syntax outside wiki-tables
12205 !! wikitext
12206 a
12207 |+ not a caption
12208 ! not a table heading
12209 |- not a table row
12210 | not a table cell
12211 | class="foo bar" | baz
12212 b
12213 |}
12214 |-
12215 c
12216 !! html
12217 <p>a
12218 |+ not a caption
12219 ! not a table heading
12220 |- not a table row
12221 | not a table cell
12222 | class="foo bar" | baz
12223 b
12224 |}
12225 |-
12226 c
12227 </p>
12228 !! end
12229
12230 ###
12231 ### Testing parsing of templates where a template arg
12232 ### has the same name as the template itself.
12233 ###
12234
12235 !! article
12236 Template:quote
12237 !! text
12238 {{{quote|{{{1}}}}}}
12239 !! endarticle
12240
12241 !!test
12242 Templates: Template Name/Arg clash: 1. Use of positional param
12243 !! wikitext
12244 {{quote|foo}}
12245 !! html
12246 <p>foo
12247 </p>
12248 !!end
12249
12250 !!test
12251 Templates: Template Name/Arg clash: 2. Use of named param
12252 !! wikitext
12253 {{quote|quote=foo}}
12254 !! html
12255 <p>foo
12256 </p>
12257 !!end
12258
12259 !!test
12260 Templates: Template Name/Arg clash: 3. Use of named param with empty input
12261 !! wikitext
12262 {{quote|quote}}
12263 !! html
12264 <p>quote
12265 </p>
12266 !!end
12267
12268 ###
12269 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
12270 ###
12271
12272 !!test
12273 Templates: 1. Simple use
12274 !! wikitext
12275 {{echo|Foo}}
12276 !! html
12277 <p>Foo
12278 </p>
12279 !!end
12280
12281 !!test
12282 Templates: 2. Inside a block tag
12283 !! wikitext
12284 <div>{{echo|Foo}}</div>
12285 <blockquote>{{echo|Foo}}</blockquote>
12286 !! html
12287 <div>Foo</div>
12288 <blockquote>Foo</blockquote>
12289
12290 !! html+tidy
12291 <div>Foo</div>
12292 <blockquote>
12293 <p>Foo</p>
12294 </blockquote>
12295 !!end
12296
12297 !!test
12298 Templates: P-wrapping: 1a. Templates on consecutive lines
12299 !! wikitext
12300 {{echo|Foo}}
12301 {{echo|bar}}
12302 !! html
12303 <p>Foo
12304 bar
12305 </p>
12306 !!end
12307
12308 !!test
12309 Templates: P-wrapping: 1b. Templates on consecutive lines
12310 !! wikitext
12311 Foo
12312
12313 {{echo|bar}}
12314 {{echo|baz}}
12315 !! html
12316 <p>Foo
12317 </p><p>bar
12318 baz
12319 </p>
12320 !!end
12321
12322 !!test
12323 Templates: P-wrapping: 1c. Templates on consecutive lines
12324 !! wikitext
12325 {{echo|Foo}}
12326 {{echo|bar}} <div>baz</div>
12327 !! html
12328 <p>Foo
12329 </p>
12330 bar <div>baz</div>
12331
12332 !! html+tidy
12333 <p>Foo</p>
12334 <p>bar</p>
12335 <div>baz</div>
12336 !! end
12337
12338 !!test
12339 Templates: P-wrapping: 1d. Template preceded by comment-only line
12340 !!options
12341 parsoid
12342 !! wikitext
12343 <!-- foo -->
12344 {{echo|Bar}}
12345 !! html
12346 <!-- foo -->
12347
12348 <p about="#mwt223" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Bar"}},"i":0}}]}'>Bar</p>
12349 !!end
12350
12351 !!test
12352 Templates: Inline Text: 1. Multiple template uses
12353 !! wikitext
12354 {{echo|Foo}}bar{{echo|baz}}
12355 !! html
12356 <p>Foobarbaz
12357 </p>
12358 !!end
12359
12360 !!test
12361 Templates: Inline Text: 2. Back-to-back template uses
12362 !! wikitext
12363 {{echo|Foo}}{{echo|bar}}
12364 !! html
12365 <p>Foobar
12366 </p>
12367 !!end
12368
12369 !!test
12370 Templates: Block Tags: 1. Multiple template uses
12371 !! wikitext
12372 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
12373 !! html
12374 <div>Foo</div><div>bar</div><div>baz</div>
12375
12376 !!end
12377
12378 !!test
12379 Templates: Block Tags: 2. Back-to-back template uses
12380 !! wikitext
12381 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
12382 !! html
12383 <div>Foo</div><div>bar</div>
12384
12385 !!end
12386
12387 # This is an edge case relating to paragraph wrapping.
12388 !!test
12389 Templates: Correctly encapsulate templates producing </p> tag without a corresponding <p> tag
12390 !! wikitext
12391 {{echo|a
12392 b</p>}}
12393 !! html/parsoid
12394 <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
12395 b</p>
12396 !!end
12397
12398 !!test
12399 Templates: Links: 1. Simple example
12400 !! wikitext
12401 {{echo|[[Foo|bar]]}}
12402 !! html
12403 <p><a href="/wiki/Foo" title="Foo">bar</a>
12404 </p>
12405 !!end
12406
12407 !!test
12408 Templates: Links: 2. Generation of link href
12409 !! wikitext
12410 [[{{echo|Foo}}|bar]]
12411 !! html
12412 <p><a href="/wiki/Foo" title="Foo">bar</a>
12413 </p>
12414 !!end
12415
12416 !!test
12417 Templates: Links: 3. Generation of part of a link href
12418 !! wikitext
12419 [[Fo{{echo|o}}|bar]]
12420
12421 [[Foo{{echo|bar}}]]
12422
12423 [[Foo{{echo|bar}}baz]]
12424
12425 [[Foo{{echo|bar}}|bar]]
12426
12427 [[:Foo{{echo|bar}}]]
12428
12429 [[:Foo{{echo|bar}}|bar]]
12430 !! html
12431 <p><a href="/wiki/Foo" title="Foo">bar</a>
12432 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
12433 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
12434 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
12435 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
12436 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
12437 </p>
12438 !!end
12439
12440 !!test
12441 Templates: Links: 4. Multiple templates generating link href
12442 !! wikitext
12443 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
12444 !! html
12445 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
12446 </p>
12447 !!end
12448
12449 !!test
12450 Templates: Links: 5. Generation of link text
12451 !! wikitext
12452 [[Foo|{{echo|bar}}]]
12453 !! html
12454 <p><a href="/wiki/Foo" title="Foo">bar</a>
12455 </p>
12456 !!end
12457
12458 !!test
12459 Templates: Links: 5. Nested templates (only outermost template should be marked)
12460 !! wikitext
12461 {{echo|[[{{echo|Foo}}|bar]]}}
12462 !! html
12463 <p><a href="/wiki/Foo" title="Foo">bar</a>
12464 </p>
12465 !!end
12466
12467 !!test
12468 Templates: HTML Tag: 1. Generation of HTML attr. key
12469 !! wikitext
12470 <div {{echo|style}}="color:red;">foo</div>
12471 !! html
12472 <div style="color:red;">foo</div>
12473
12474 !!end
12475
12476 !!test
12477 Templates: HTML Tag: 2. Generation of HTML attr. value
12478 !! wikitext
12479 <div style={{echo|'color:red;'}}>foo</div>
12480 !! html
12481 <div style="color:red;">foo</div>
12482
12483 !!end
12484
12485 !!test
12486 Templates: HTML Tag: 3. Generation of HTML attr key and value
12487 !! wikitext
12488 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
12489 !! html
12490 <div style="color:red;">foo</div>
12491
12492 !!end
12493
12494 !!test
12495 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
12496 !! wikitext
12497 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
12498 !! html
12499 <div title="This is a long title with just one piece templated">foo</div>
12500
12501 !!end
12502
12503 !!test
12504 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
12505 !! wikitext
12506 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
12507 !! html
12508 <div title="This is a long title with just one piece templated">foo</div>
12509
12510 !!end
12511
12512 !!test
12513 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
12514 !! wikitext
12515 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
12516 !! html
12517 <div title="This is a long title with just one piece templated">foo</div>
12518
12519 !!end
12520
12521 # SSS FIXME: While it is great we added support for all this,
12522 # do we want to make this part of the spec? Maybe we want to
12523 # deprecate this kind of usage in the future?
12524 !!test
12525 Templates: HTML Tag: 7. Generation of partial attribute key string
12526 !! wikitext
12527 <div st{{echo|yle}}="color:red;">foo</div>
12528 !! html
12529 <div style="color:red;">foo</div>
12530
12531 !!end
12532
12533 !! test
12534 Templates: HTML Tag: 8. Template-generated attribute (k=v)
12535 !! wikitext
12536 <div {{echo|1=id="v1"}}>bar</div>
12537 !! html
12538 <div id="v1">bar</div>
12539
12540 !!end
12541
12542 !! test
12543 Templates: HTML Tag: 9. Multiple template-generated attributes
12544 !! wikitext
12545 <div {{echo|1=id="v1" title="foo"}}>bar</div>
12546 !! html
12547 <div id="v1" title="foo">bar</div>
12548
12549 !!end
12550
12551 !! test
12552 Templates: Support for templates generating attributes and content
12553 !! wikitext
12554 {| {{mixed_attr_content_template}}
12555 |-
12556 |bar
12557 |}
12558 !! html/php
12559 <table style="color:red;" title="T48811">
12560
12561 <tr>
12562 <td>foo
12563 </td></tr>
12564 <tr>
12565 <td>bar
12566 </td></tr></table>
12567
12568 !! html/parsoid
12569 <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|}"]}'>
12570 <tbody><tr>
12571 <td>foo</td></tr>
12572 <tr>
12573 <td>bar</td></tr>
12574 </tbody></table>
12575 !!end
12576
12577 !! test
12578 1. Entities and nowikis inside templated attributes should be handled correctly
12579 !! wikitext
12580 <div {{echo|style{{=}}"background:&#35;f9f9f9;"}}>foo</div>
12581 !! html/php
12582 <div style="background:#f9f9f9;">foo</div>
12583
12584 !! html/parsoid
12585 <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>
12586 !! end
12587
12588 !! test
12589 2. Entities and nowikis inside templated attributes should be handled correctly
12590 !! wikitext
12591 {|
12592 |{{table_attribs_3}}
12593 |}
12594 !! html/php
12595 <table>
12596 <tr>
12597 <td style="background:#f9f9f9;">Foo
12598 </td></tr></table>
12599
12600 !! html/parsoid
12601 <table>
12602 <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>
12603 </tbody></table>
12604 !! end
12605
12606 !! test
12607 3. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
12608 !! wikitext
12609 {{tbl-start}}
12610 |{{table_attribs_3}}
12611 {{tbl-end}}
12612 !! html/php
12613 <table>
12614 <tr>
12615 <td style="background:#f9f9f9;">Foo
12616 </td></tr></table>
12617
12618 !! html/parsoid
12619 <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}}]}'>
12620 <tbody><tr><td style="background:#f9f9f9;">Foo</td></tr>
12621 </tbody></table>
12622 !! end
12623
12624 # T107622
12625 !! test
12626 4. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
12627 !! wikitext
12628 {|
12629 | {{table_attribs_6}} hi
12630 |}
12631 !! html/php
12632 <table>
12633 <tr>
12634 <td style="background: red;"> hi
12635 </td></tr></table>
12636
12637 !! html/parsoid
12638 <table>
12639 <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>
12640 </tbody></table>
12641 !! end
12642
12643 !!test
12644 Templates: HTML Tables: 1. Generating start of a HTML table
12645 !! wikitext
12646 {{echo|<table><tr><td>foo</td>}}</tr></table>
12647 !! html
12648 <table><tr><td>foo</td></tr></table>
12649
12650 !!end
12651
12652 !!test
12653 Templates: HTML Tables: 2a. Generating middle of a HTML table
12654 !! wikitext
12655 <table><tr>{{echo|<td>foo</td>}}</tr></table>
12656 !! html
12657 <table><tr><td>foo</td></tr></table>
12658
12659 !!end
12660
12661 !!test
12662 Templates: HTML Tables: 2b. Generating middle of a HTML table
12663 !! wikitext
12664 <table>{{echo|<tr><td>foo</td></tr>}}</table>
12665 !! html
12666 <table><tr><td>foo</td></tr></table>
12667
12668 !!end
12669
12670 !!test
12671 Templates: HTML Tables: 3. Generating end of a HTML table
12672 !! wikitext
12673 <table><tr>{{echo|<td>foo</td></tr></table>}}
12674 !! html
12675 <table><tr><td>foo</td></tr></table>
12676
12677 !!end
12678
12679 !!test
12680 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
12681 !! wikitext
12682 {{echo|<table>}}<tr><td>foo</td></tr></table>
12683 !! html
12684 <table><tr><td>foo</td></tr></table>
12685
12686 !!end
12687
12688 !!test
12689 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
12690 !! wikitext
12691 <table>{{echo|<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: 4c. Generating a single tag 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: 4d. Generating a single tag of a HTML table
12708 !! wikitext
12709 <table><tr><td>foo{{echo|</td>}}</tr></table>
12710 !! html
12711 <table><tr><td>foo</td></tr></table>
12712
12713 !!end
12714
12715 !!test
12716 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
12717 !! wikitext
12718 <table><tr><td>foo</td>{{echo|</tr>}}</table>
12719 !! html
12720 <table><tr><td>foo</td></tr></table>
12721
12722 !!end
12723
12724 !!test
12725 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
12726 !! wikitext
12727 <table><tr><td>foo</td></tr>{{echo|</table>}}
12728 !! html
12729 <table><tr><td>foo</td></tr></table>
12730
12731 !!end
12732
12733 !!test
12734 Templates: HTML Tables: 5. Proper fostering of categories from inside
12735 !!options
12736 parsoid=wt2html,wt2wt
12737 !! wikitext
12738 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
12739 <!--Two categories (T52330)-->
12740 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
12741 !! html
12742 <link rel="mw:PageProp/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
12743 <!--Two categories (T52330)-->
12744 <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>
12745 !!end
12746
12747 !!test
12748 Templates: Wiki Tables: 1a. Fostering of entire template content
12749 !! wikitext
12750 {|
12751 {{echo|a}}
12752 |}
12753 !! html
12754 <table>
12755 a
12756 <tr><td></td></tr></table>
12757
12758 !! html+tidy
12759 <p>a</p>
12760 <table>
12761 <tr>
12762 <td></td>
12763 </tr>
12764 </table>
12765 !! end
12766
12767 !!test
12768 Templates: Wiki Tables: 1b. Fostering of entire template content
12769 !! wikitext
12770 {|
12771 {{echo|<div>}}
12772 foo
12773 {{echo|</div>}}
12774 |}
12775 !! html
12776 <table>
12777 <div>
12778 <p>foo
12779 </p>
12780 </div>
12781 <tr><td></td></tr></table>
12782
12783 !! html+tidy
12784 <div>
12785 <p>foo</p>
12786 </div>
12787 <table>
12788 <tr>
12789 <td></td>
12790 </tr>
12791 </table>
12792 !! end
12793
12794 !!test
12795 Templates: Wiki Tables: 2. Fostering of partial template content
12796 !! wikitext
12797 {|
12798 {{echo|a
12799 <div>b</div>}}
12800 |}
12801 !! html
12802 <table>
12803 a
12804 <div>b</div>
12805 <tr><td></td></tr></table>
12806
12807 !! html+tidy
12808 <p>a</p>
12809 <div>b</div>
12810 <table>
12811 <tr>
12812 <td></td>
12813 </tr>
12814 </table>
12815 !! end
12816
12817 !!test
12818 Templates: Wiki Tables: 3. td-content via multiple templates
12819 !! wikitext
12820 {|
12821 {{echo|{{pipe}}a}}{{echo|b}}
12822 |}
12823 !! html
12824 <table>
12825 <tr>
12826 <td>ab
12827 </td></tr></table>
12828
12829 !!end
12830
12831 !!test
12832 Templates: Wiki Tables: 4. Templated tags, no content
12833 !! wikitext
12834 {{tbl-start}}
12835 {{tbl-end}}
12836 !! html
12837 <table>
12838 <tr><td></td></tr></table>
12839
12840 !!end
12841
12842 !!test
12843 Templates: Wiki Tables: 5. Templated tags, regular td-tags
12844 !! wikitext
12845 {{tbl-start}}
12846 |foo
12847 {{tbl-end}}
12848 !! html
12849 <table>
12850 <tr>
12851 <td>foo
12852 </td></tr></table>
12853
12854 !!end
12855
12856 !!test
12857 Templates: Wiki Tables: 6. Templated tags, templated td-tags
12858 !! wikitext
12859 {{tbl-start}}
12860 {{!}}foo
12861 {{tbl-end}}
12862 !! html
12863 <table>
12864 <tr>
12865 <td>foo
12866 </td></tr></table>
12867
12868 !!end
12869
12870 ## This test case is very specific to Parsoid's internals
12871 ## and is hence only tested for Parsoid's code. Parsoid uses
12872 ## a <meta> marker tag for <ref> tags and they are expanded
12873 ## much later. We are verifying that this <meta> tag usage
12874 ## doesn't prevent foster parenting.
12875 !!test
12876 Templates: Wiki Tables: 7. Fosterable <ref>s should get fostered
12877 !!wikitext
12878 {{PartialTable}}<ref>foo</ref>
12879 |}
12880
12881 <references />
12882 !!html/parsoid
12883 <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">
12884 <tbody>
12885 </tbody></table>
12886
12887 <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>
12888 !!end
12889
12890 !! test
12891 Templates: Wiki Tables: 8. Fosterable meta-tags should get fostered
12892 !! wikitext
12893 {{echo|
12894 {{{!}}
12895 {{!}}-}}
12896 <onlyinclude>
12897 |foo
12898 </onlyinclude>
12899 {{!}}}
12900 !! html/parsoid
12901 <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{{!}}}"]}'>
12902 </span><meta typeof="mw:Includes/OnlyInclude" about="#mwt1"/><table about="#mwt1">
12903 <tbody><tr>
12904
12905 <td>foo
12906 <meta typeof="mw:Includes/OnlyInclude/End"/></td></tr>
12907 </tbody></table>
12908 !! end
12909
12910 !!test
12911 Templates: Lists: Multi-line list-items via templates
12912 !! wikitext
12913 *{{echo|a {{nonexistent|
12914 unused}}}}
12915 *{{echo|b {{nonexistent|
12916 unused}}}}
12917 !! html
12918 <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>
12919 <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>
12920
12921 !!end
12922
12923 !!test
12924 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
12925 !! wikitext
12926 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
12927 !! html
12928 <p><i>ab</i>c<i>d</i>e
12929 </p>
12930 !!end
12931
12932 !!test
12933 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
12934 (PHP parser generates misnested html)
12935 !! wikitext
12936 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
12937 !! html/parsoid
12938 <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>
12939 !!end
12940
12941 !!test
12942 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
12943 (PHP parser generates misnested html; Parsoid html2wt mode adds newlines between {{echo}}s)
12944 !! options
12945 parsoid=wt2html,wt2wt
12946 !! wikitext
12947 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
12948 !! html
12949 <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>
12950 <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>
12951 <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>
12952 !!end
12953
12954 !!test
12955 Templates: Ugly nesting: 4. Divs opened/closed across templates
12956 !! wikitext
12957 a<div>b{{echo|c</div>d}}e
12958 !! html
12959 a<div>bc</div>de
12960
12961 !! html+tidy
12962 <p>a</p>
12963 <div>bc</div>
12964 <p>de</p>
12965 !! end
12966
12967 !!test
12968 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
12969 (Parsoid-centric)
12970 !! options
12971 parsoid
12972 !! wikitext
12973 {|
12974 |{{echo|foo</table>}}
12975 |bar
12976 |}
12977 !! html
12978 <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|}"]}'>
12979
12980 <tbody>
12981 <tr>
12982 <td>foo</td></tr></tbody></table><span about="#mwt1">
12983 </span><span about="#mwt1">|bar</span><span about="#mwt1">
12984 |}</span>
12985 !!end
12986
12987 !!test
12988 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
12989 (Parsoid-centric)
12990 !! options
12991 parsoid
12992 !! wikitext
12993 <table>
12994 <tr>
12995 <td>
12996 <table>
12997 <tr>
12998 <td>1. {{echo|foo </table>}}</td>
12999 <td> bar </td>
13000 <td>2. {{echo|baz </table>}}</td>
13001 </tr>
13002 <tr>
13003 <td>abc</td>
13004 </tr>
13005 </table>
13006 </td>
13007 </tr>
13008 <tr>
13009 <td>xyz</td>
13010 </tr>
13011 </table>
13012 !! html
13013 <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>"]}'>
13014 <tbody><tr>
13015 <td>
13016 <table>
13017 <tbody><tr>
13018 <td>1. foo </td></tr></tbody></table></td>
13019 <td> bar </td>
13020 <td>2. baz </td></tr></tbody></table><span about="#mwt2">
13021 </span><span about="#mwt2">
13022 </span><span about="#mwt2">
13023 </span><span about="#mwt2">abc</span><span about="#mwt2">
13024 </span><span about="#mwt2">
13025 </span><span about="#mwt2">
13026 </span><span about="#mwt2">
13027 </span><span about="#mwt2">
13028 </span><span about="#mwt2">
13029 </span><span about="#mwt2">xyz</span><span about="#mwt2">
13030 </span><span about="#mwt2">
13031 </span>
13032 !!end
13033
13034 !! test
13035 Templates: Ugly templates: 3. newline-only template parameter
13036 !! wikitext
13037 foo {{echo|
13038 }}
13039 !! html
13040 <p>foo
13041 </p>
13042 !! end
13043
13044 # This looks like a bug: a single newline triggers p/br for some reason.
13045 !! test
13046 Templates: Ugly templates: 4. newline-only template parameter inconsistency
13047 !! wikitext
13048 {{echo|
13049 }}
13050 !! html
13051 <p><br />
13052 </p>
13053 !! end
13054
13055 # T66017 -- ugly wikitext with fostered content generates two template ranges that
13056 # have a true overlap (T1-start - T2-start - T1-end - T2-end).
13057 !! test
13058 Templates: Ugly templates: 5. Template encapsulation test: Non-trivial overlap of template ranges is properly handled
13059 !! wikitext
13060 {{echo|<table>}}
13061 {{echo|<div>foo}}
13062 {{echo|</table>}}
13063 !! html/parsoid
13064 <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
13065 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
13066 </table>
13067 !! end
13068
13069 # T66017 -- ugly wikitext with fostered content generates two template ranges
13070 # that are "identical" and generate nesting cycles in the algorithm
13071 !! test
13072 Templates: Ugly templates: 6. Template encapsulation test: Cyclical nesting of template ranges is properly handled
13073 !! wikitext
13074 {{echo|<table><tr><td><table>}}
13075 {{echo|<div>}}
13076 {{echo|</div>}}
13077 !! html/parsoid
13078 <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"}'>
13079 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
13080 </table></td></tr></tbody></table>
13081 !! end
13082
13083 !! test
13084 Templates: Parameters substituted at the top-level
13085 !! wikitext
13086 {{{foo|''who'' {{echo|me}}? '''never!'''}}}
13087
13088 {{{foo|bar|baz}}}
13089 !! html/php
13090 <p><i>who</i> me? <b>never!</b>
13091 </p><p>bar
13092 </p>
13093 !! html/parsoid
13094 <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>
13095
13096 <p about="#mwt3" typeof="mw:Param" data-mw='{"parts":[{"templatearg":{"target":{"wt":"foo"},"params":{"1":{"wt":"bar"},"2":{"wt":"baz"}},"i":0}}]}'>bar</p>
13097 !! end
13098
13099 !!test
13100 Parser Functions: 1. Simple example
13101 !! wikitext
13102 {{uc:foo}}
13103 !! html
13104 <p>FOO
13105 </p>
13106 !!end
13107
13108 !!test
13109 Parser Functions: 2. Nested use (only outermost should be marked up)
13110 !! wikitext
13111 {{uc:{{lc:FOO}}}}
13112 !! html
13113 <p>FOO
13114 </p>
13115 !!end
13116
13117 ###
13118 ### Pre-save transform tests
13119 ###
13120 !! test
13121 pre-save transform: subst:
13122 !! options
13123 pst
13124 !! wikitext
13125 {{subst:test}}
13126 !! html/php
13127 This is a test template
13128 !! end
13129
13130 !! test
13131 pre-save transform: normal template
13132 !! options
13133 pst
13134 !! wikitext
13135 {{test}}
13136 !! html/php
13137 {{test}}
13138 !! end
13139
13140 !! test
13141 pre-save transform: nonexistent template
13142 !! options
13143 pst
13144 !! wikitext
13145 {{thistemplatedoesnotexist}}
13146 !! html/php
13147 {{thistemplatedoesnotexist}}
13148 !! end
13149
13150 !! test
13151 pre-save transform: subst magic variables
13152 !! options
13153 pst
13154 !! wikitext
13155 {{subst:SITENAME}}
13156 !! html/php
13157 MediaWiki
13158 !! end
13159
13160 # This is T2089, which I fixed. -- wtm
13161 !! test
13162 pre-save transform: subst: templates with parameters
13163 !! options
13164 pst
13165 !! wikitext
13166 {{subst:paramtest|param="something else"}}
13167 !! html/php
13168 This is a test template with parameter "something else"
13169 !! end
13170
13171 !! article
13172 Template:nowikitest
13173 !! text
13174 <nowiki>'''not wiki'''</nowiki>
13175 !! endarticle
13176
13177 !! test
13178 pre-save transform: nowiki in subst (T3188)
13179 !! options
13180 pst
13181 !! wikitext
13182 {{subst:nowikitest}}
13183 !! html/php
13184 <nowiki>'''not wiki'''</nowiki>
13185 !! end
13186
13187 !! article
13188 Template:commenttest
13189 !! text
13190 This template has <!-- a comment --> in it.
13191 !! endarticle
13192
13193 !! test
13194 pre-save transform: comment in subst (T3936)
13195 !! options
13196 pst
13197 !! wikitext
13198 {{subst:commenttest}}
13199 !! html/php
13200 This template has <!-- a comment --> in it.
13201 !! end
13202
13203 !! test
13204 pre-save transform: unclosed tag
13205 !! options
13206 pst
13207 !! wikitext
13208 <nowiki>'''not wiki'''
13209 !! html/php
13210 <nowiki>'''not wiki'''
13211 !! end
13212
13213 !! test
13214 pre-save transform: mixed tag case
13215 !! options
13216 pst
13217 !! wikitext
13218 <NOwiki>'''not wiki'''</noWIKI>
13219 !! html/php
13220 <NOwiki>'''not wiki'''</noWIKI>
13221 !! end
13222
13223 !! test
13224 pre-save transform: unclosed comment in <nowiki>
13225 !! options
13226 pst
13227 !! wikitext
13228 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
13229 !! html/php
13230 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
13231 !!end
13232
13233 # Leading @ in this template definition works around a limitation
13234 # in parsoid's parserTests which otherwise strips the <span> from the
13235 # result (confusing it for a template wrapper)
13236 !! article
13237 Template:dangerous
13238 !!text
13239 @<span onmouseover="alert('crap')">Oh no</span>
13240 !!endarticle
13241
13242 !!test
13243 (confirming safety of fix for subst T3936)
13244 !! wikitext
13245 {{Template:dangerous}}
13246 !! html
13247 <p>@<span>Oh no</span>
13248 </p>
13249 !! end
13250
13251 !! test
13252 pre-save transform: comment containing gallery (T7024)
13253 !! options
13254 pst
13255 !! wikitext
13256 <!-- <gallery>data</gallery> -->
13257 !! html/php
13258 <!-- <gallery>data</gallery> -->
13259 !!end
13260
13261 !! test
13262 pre-save transform: comment containing extension
13263 !! options
13264 pst
13265 !! wikitext
13266 <!-- <tag>data</tag> -->
13267 !! html/php
13268 <!-- <tag>data</tag> -->
13269 !!end
13270
13271 !! test
13272 pre-save transform: comment containing nowiki
13273 !! options
13274 pst
13275 !! wikitext
13276 <!-- <nowiki>data</nowiki> -->
13277 !! html/php
13278 <!-- <nowiki>data</nowiki> -->
13279 !!end
13280
13281 !! test
13282 pre-save transform: <noinclude> in subst (T5298)
13283 !! options
13284 pst
13285 !! wikitext
13286 {{subst:Includes}}
13287 !! html/php
13288 Foobar
13289 !! end
13290
13291 !! test
13292 pre-save transform: <onlyinclude> in subst (T5298)
13293 !! options
13294 pst
13295 !! wikitext
13296 {{subst:Includes2}}
13297 !! html/php
13298 Foo
13299 !! end
13300
13301 !! article
13302 Template:SubstTest
13303 !!text
13304 {{<includeonly>subst:</includeonly>Includes}}
13305 !! endarticle
13306
13307 !! article
13308 Template:SafeSubstTest
13309 !! text
13310 {{<includeonly>safesubst:</includeonly>Includes}}
13311 !! endarticle
13312
13313 !! test
13314 T24297: safesubst: works during PST
13315 !! options
13316 pst
13317 !! wikitext
13318 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
13319 !! html/php
13320 FoobarFoobar
13321 !! end
13322
13323 !! test
13324 T24297: safesubst: works during normal parse
13325 !! wikitext
13326 {{SafeSubstTest}}
13327 !! html
13328 <p>Foobar
13329 </p>
13330 !! end
13331
13332 !! test
13333 subst: does not work during normal parse
13334 !! wikitext
13335 {{SubstTest}}
13336 !! html
13337 <p>{{subst:Includes}}
13338 </p>
13339 !! end
13340
13341 !! test
13342 pre-save transform: context links ("pipe trick")
13343 !! options
13344 pst
13345 !! wikitext
13346 [[Article (context)|]]
13347 [[Bar:Article|]]
13348 [[:Bar:Article|]]
13349 [[Bar:Article (context)|]]
13350 [[:Bar:Article (context)|]]
13351 [[|Article]]
13352 [[|Article (context)]]
13353 [[Bar:X (Y) Z|]]
13354 [[:Bar:X (Y) Z|]]
13355 !! html/php
13356 [[Article (context)|Article]]
13357 [[Bar:Article|Article]]
13358 [[:Bar:Article|Article]]
13359 [[Bar:Article (context)|Article]]
13360 [[:Bar:Article (context)|Article]]
13361 [[Article]]
13362 [[Article (context)]]
13363 [[Bar:X (Y) Z|X (Y) Z]]
13364 [[:Bar:X (Y) Z|X (Y) Z]]
13365 !! end
13366
13367 !! test
13368 pre-save transform: context links ("pipe trick") with interwiki prefix
13369 !! options
13370 pst
13371 !! wikitext
13372 [[interwiki:Article|]]
13373 [[:interwiki:Article|]]
13374 [[interwiki:Bar:Article|]]
13375 [[:interwiki:Bar:Article|]]
13376 !! html/php
13377 [[interwiki:Article|Article]]
13378 [[:interwiki:Article|Article]]
13379 [[interwiki:Bar:Article|Bar:Article]]
13380 [[:interwiki:Bar:Article|Bar:Article]]
13381 !! end
13382
13383 !! test
13384 pre-save transform: context links ("pipe trick") with parens in title
13385 !! options
13386 pst title=[[Somearticle (context)]]
13387 !! wikitext
13388 [[|Article]]
13389 !! html/php
13390 [[Article (context)|Article]]
13391 !! end
13392
13393 !! test
13394 pre-save transform: context links ("pipe trick") with comma in title
13395 !! options
13396 pst title=[[Someplace, Somewhere]]
13397 !! wikitext
13398 [[|Otherplace]]
13399 [[Otherplace, Elsewhere|]]
13400 [[Otherplace, Elsewhere, Anywhere|]]
13401 !! html/php
13402 [[Otherplace, Somewhere|Otherplace]]
13403 [[Otherplace, Elsewhere|Otherplace]]
13404 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
13405 !! end
13406
13407 !! test
13408 pre-save transform: context links ("pipe trick") with parens and comma
13409 !! options
13410 pst title=[[Someplace (IGNORED), Somewhere]]
13411 !! wikitext
13412 [[|Otherplace]]
13413 [[Otherplace (place), Elsewhere|]]
13414 !! html/php
13415 [[Otherplace, Somewhere|Otherplace]]
13416 [[Otherplace (place), Elsewhere|Otherplace]]
13417 !! end
13418
13419 !! test
13420 pre-save transform: context links ("pipe trick") with comma and parens
13421 !! options
13422 pst title=[[Who, me? (context)]]
13423 !! wikitext
13424 [[|Yes, you.]]
13425 [[Me, Myself, and I (1937 song)|]]
13426 !! html/php
13427 [[Yes, you. (context)|Yes, you.]]
13428 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
13429 !! end
13430
13431 !! test
13432 pre-save transform: context links ("pipe trick") with namespace
13433 !! options
13434 pst title=[[Ns:Somearticle]]
13435 !! wikitext
13436 [[|Article]]
13437 !! html/php
13438 [[Ns:Article|Article]]
13439 !! end
13440
13441 !! test
13442 pre-save transform: context links ("pipe trick") with namespace and parens
13443 !! options
13444 pst title=[[Ns:Somearticle (context)]]
13445 !! wikitext
13446 [[|Article]]
13447 !! html/php
13448 [[Ns:Article (context)|Article]]
13449 !! end
13450
13451 !! test
13452 pre-save transform: context links ("pipe trick") with namespace and comma
13453 !! options
13454 pst title=[[Ns:Somearticle, Context, Whatever]]
13455 !! wikitext
13456 [[|Article]]
13457 !! html/php
13458 [[Ns:Article, Context, Whatever|Article]]
13459 !! end
13460
13461 !! test
13462 pre-save transform: context links ("pipe trick") with namespace, comma and parens
13463 !! options
13464 pst title=[[Ns:Somearticle, Context (context)]]
13465 !! wikitext
13466 [[|Article]]
13467 !! html/php
13468 [[Ns:Article (context)|Article]]
13469 !! end
13470
13471 !! test
13472 pre-save transform: context links ("pipe trick") with namespace, parens and comma
13473 !! options
13474 pst title=[[Ns:Somearticle (IGNORED), Context]]
13475 !! wikitext
13476 [[|Article]]
13477 !! html/php
13478 [[Ns:Article, Context|Article]]
13479 !! end
13480
13481 !! test
13482 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, T32149)
13483 !! options
13484 pst
13485 !! wikitext
13486 [[Article(context)|]]
13487 [[Bar:Article(context)|]]
13488 [[:Bar:Article(context)|]]
13489 [[|Article(context)]]
13490 [[Bar:X(Y)Z|]]
13491 [[:Bar:X(Y)Z|]]
13492 !! html/php
13493 [[Article(context)|Article]]
13494 [[Bar:Article(context)|Article]]
13495 [[:Bar:Article(context)|Article]]
13496 [[Article(context)]]
13497 [[Bar:X(Y)Z|X(Y)Z]]
13498 [[:Bar:X(Y)Z|X(Y)Z]]
13499 !! end
13500
13501 !! test
13502 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, T32149)
13503 !! options
13504 pst
13505 !! wikitext
13506 [[Article (context)|]]
13507 [[Bar:Article (context)|]]
13508 [[:Bar:Article (context)|]]
13509 [[|Article (context)]]
13510 [[Bar:X (Y) Z|]]
13511 [[:Bar:X (Y) Z|]]
13512 !! html/php
13513 [[Article (context)|Article]]
13514 [[Bar:Article (context)|Article]]
13515 [[:Bar:Article (context)|Article]]
13516 [[Article (context)]]
13517 [[Bar:X (Y) Z|X (Y) Z]]
13518 [[:Bar:X (Y) Z|X (Y) Z]]
13519 !! end
13520
13521 !! test
13522 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, T32149)
13523 !! options
13524 pst
13525 !! wikitext
13526 [[Article(context)|]]
13527 [[Bar:Article(context)|]]
13528 [[:Bar:Article(context)|]]
13529 [[|Article(context)]]
13530 [[Bar:X(Y)Z|]]
13531 [[:Bar:X(Y)Z|]]
13532 !! html/php
13533 [[Article(context)|Article]]
13534 [[Bar:Article(context)|Article]]
13535 [[:Bar:Article(context)|Article]]
13536 [[Article(context)]]
13537 [[Bar:X(Y)Z|X(Y)Z]]
13538 [[:Bar:X(Y)Z|X(Y)Z]]
13539 !! end
13540
13541 !! test
13542 pre-save transform: context links ("pipe trick") with commas (T23660)
13543 !! options
13544 pst
13545 !! wikitext
13546 [[Article (context), context|]]
13547 [[Article (context),context|]]
13548 [[Bar:Article (context), context|]]
13549 [[Bar:Article (context),context|]]
13550 [[:Bar:Article (context), context|]]
13551 [[:Bar:Article (context),context|]]
13552 !! html/php
13553 [[Article (context), context|Article]]
13554 [[Article (context),context|Article]]
13555 [[Bar:Article (context), context|Article]]
13556 [[Bar:Article (context),context|Article]]
13557 [[:Bar:Article (context), context|Article]]
13558 [[:Bar:Article (context),context|Article]]
13559 !! end
13560
13561 !! test
13562 Parsoid: backwards pipe trick
13563 !! wikitext
13564 [[|'''bar''']]
13565 !! html/php
13566 <p>[[|<b>bar</b>]]
13567 </p>
13568 !! html/parsoid
13569 <p>[[|<b>bar</b>]]</p>
13570 !! end
13571
13572 !! test
13573 pre-save transform: trim trailing empty lines
13574 !! options
13575 pst
13576 !! wikitext
13577 Empty lines are trimmed
13578
13579
13580
13581
13582 !! html/php
13583 Empty lines are trimmed
13584 !! end
13585
13586 !! test
13587 pre-save transform: Signature expansion
13588 !! options
13589 pst
13590 !! wikitext
13591 * ~~~
13592 * <noinclude>~~~</noinclude>
13593 * <includeonly>~~~</includeonly>
13594 * <onlyinclude>~~~</onlyinclude>
13595 !! html/php
13596 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
13597 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
13598 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
13599 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
13600 !! end
13601
13602
13603 !! test
13604 pre-save transform: Signature expansion in nowiki tags (T2093)
13605 !! options
13606 pst disabled
13607 !! wikitext
13608 Shall not expand:
13609
13610 <nowiki>~~~~</nowiki>
13611
13612 <includeonly><nowiki>~~~~</nowiki></includeonly>
13613
13614 <noinclude><nowiki>~~~~</nowiki></noinclude>
13615
13616 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
13617
13618 {{subst:Foo}} shall be converted to FOO
13619
13620 As well as inside noinclude/onlyinclude
13621 <noinclude>{{subst:Foo}}</noinclude>
13622 <onlyinclude>{{subst:Foo}}</onlyinclude>
13623
13624 But not inside includeonly
13625 <includeonly>{{subst:Foo}}</includeonly>
13626 !! html/php
13627 Shall not expand:
13628
13629 <nowiki>~~~~</nowiki>
13630
13631 <includeonly><nowiki>~~~~</nowiki></includeonly>
13632
13633 <noinclude><nowiki>~~~~</nowiki></noinclude>
13634
13635 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
13636
13637 FOO shall be converted to FOO
13638
13639 As well as inside noinclude/onlyinclude
13640 <noinclude>FOO</noinclude>
13641 <onlyinclude>FOO</onlyinclude>
13642
13643 But not inside includeonly
13644 <includeonly>{{subst:Foo}}</includeonly>
13645 !! end
13646
13647 !! test
13648 Parsoid: Recognize nowiki with trailing space in tags
13649 !! options
13650 parsoid=wt2html
13651 !! wikitext
13652 <nowiki ><div>[[foo]]</nowiki >
13653
13654 a<nowiki / >b
13655
13656 c<nowiki />d
13657
13658 e<nowiki/ >f
13659 !! html
13660 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
13661 <p>ab</p>
13662 <p>cd</p>
13663 <p>ef</p>
13664 !! end
13665
13666 !! test
13667 Parsoid: Recognize nowiki with odd capitalization
13668 !! options
13669 parsoid=wt2html
13670 !! wikitext
13671 <noWikI ><div>[[foo]]</Nowiki >
13672 !! html
13673 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
13674 !! end
13675
13676
13677 !! test
13678 Parsoid: Escape nowiki with trailing space in tags
13679 !! options
13680 parsoid=html2wt
13681 !! html/parsoid
13682 <p>&lt;nowiki &gt; foo &lt/nowiki ></p>
13683 <p>a&lt;nowiki /&gt;b</p>
13684 <p>c&lt;nowiki/ &gt;d</p>
13685 !! wikitext
13686 &lt;nowiki &gt; foo &lt;/nowiki &gt;
13687
13688 a&lt;nowiki /&gt;b
13689
13690 c&lt;nowiki/ &gt;d
13691 !! end
13692
13693 !! test
13694 Parsoid: Escape weird noWikI capitalizations
13695 !! options
13696 parsoid=html2wt
13697 !! html/parsoid
13698 <p>&lt;noWikI &gt; foo &lt/NoWikI ></p>
13699 !! wikitext
13700 &lt;noWikI &gt; foo &lt;/NoWikI &gt;
13701 !! end
13702
13703 ###
13704 ### Message transform tests
13705 ###
13706 !! test
13707 message transform: magic variables
13708 !! options
13709 msg
13710 !! wikitext
13711 {{SITENAME}}
13712 !! html
13713 MediaWiki
13714 !! end
13715
13716 !! test
13717 message transform: should not transform wiki markup
13718 !! options
13719 msg
13720 !! wikitext
13721 ''test''
13722 !! html
13723 ''test''
13724 !! end
13725
13726 !! test
13727 message transform: <noinclude> in transcluded template (T6926)
13728 !! options
13729 msg
13730 !! wikitext
13731 {{Includes}}
13732 !! html
13733 Foobar
13734 !! end
13735
13736 !! test
13737 message transform: <onlyinclude> in transcluded template (T6926)
13738 !! options
13739 msg
13740 !! wikitext
13741 {{Includes2}}
13742 !! html
13743 Foo
13744 !! end
13745
13746 !! test
13747 {{#special:}} page name, known
13748 !! options
13749 msg
13750 !! wikitext
13751 {{#special:Recentchanges}}
13752 !! html
13753 Special:RecentChanges
13754 !! end
13755
13756 !! test
13757 {{#special:}} page name with subpage, known
13758 !! options
13759 msg
13760 !! wikitext
13761 {{#special:Recentchanges/param}}
13762 !! html
13763 Special:RecentChanges/param
13764 !! end
13765
13766 !! test
13767 {{#special:}} page name, unknown
13768 !! options
13769 msg
13770 !! wikitext
13771 {{#special:foobar nonexistent}}
13772 !! html
13773 Special:Foobar nonexistent
13774 !! end
13775
13776 !! test
13777 {{#speciale:}} page name, known
13778 !! options
13779 msg
13780 !! wikitext
13781 {{#speciale:Recentchanges}}
13782 !! html
13783 Special:RecentChanges
13784 !! end
13785
13786 !! test
13787 {{#speciale:}} page name with subpage, known
13788 !! options
13789 msg
13790 !! wikitext
13791 {{#speciale:Recentchanges/param}}
13792 !! html
13793 Special:RecentChanges/param
13794 !! end
13795
13796 !! test
13797 {{#speciale:}} page name, unknown
13798 !! options
13799 msg
13800 !! wikitext
13801 {{#speciale:foobar nonexistent}}
13802 !! html
13803 Special:Foobar_nonexistent
13804 !! end
13805
13806 ###
13807 ### Images
13808 ###
13809 ### For Parsoid-specific tests, see
13810 #### https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
13811
13812 !! test
13813 Simple image
13814 !! options
13815 parsoid=wt2html,wt2wt,html2html
13816 !! wikitext
13817 [[Image:foobar.jpg]]
13818 !! html/php
13819 <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>
13820 </p>
13821 !! html/parsoid
13822 <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>
13823 !! end
13824
13825 !! test
13826 Simple image (using File: namespace, now canonical)
13827 !! wikitext
13828 [[File:Foobar.jpg]]
13829 !! html/php
13830 <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>
13831 </p>
13832 !! html/parsoid
13833 <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>
13834 !! end
13835
13836 !! test
13837 Right-aligned image
13838 !! wikitext
13839 [[File:Foobar.jpg|right]]
13840 !! html/php
13841 <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>
13842
13843 !! html/parsoid
13844 <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>
13845 !! end
13846
13847 !! test
13848 Image with caption
13849 !! wikitext
13850 [[File:Foobar.jpg|right|Caption text]]
13851 !! html/php
13852 <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>
13853
13854 !! html/parsoid
13855 <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>
13856 !! end
13857
13858 !! test
13859 Image with caption, T55312 #1
13860 !! wikitext
13861 [[File:Foobar.jpg|right|Caption page stuff]]
13862 !! html/php
13863 <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>
13864
13865 !! html/parsoid
13866 <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>
13867 !! end
13868
13869 !! test
13870 Image with caption, T55312 #2
13871 !! wikitext
13872 [[File:Foobar.jpg|right|Caption page=]]
13873 !! html/php
13874 <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>
13875
13876 !! html/parsoid
13877 <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>
13878 !! end
13879
13880 !! test
13881 Image with caption, T55312 #3
13882 !! wikitext
13883 [[File:Foobar.jpg|right|Caption page=stuff]]
13884 !! html/php
13885 <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>
13886
13887 !! html/parsoid
13888 <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>
13889 !! end
13890
13891 !! test
13892 Allow empty links in image captions (T62753)
13893 !! options
13894 thumbsize=220
13895 !! wikitext
13896 [[File:Foobar.jpg|thumb|Caption [[Link1]]
13897 [[]]
13898 [[Link2]]
13899 ]]
13900 !! html/php
13901 <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>
13902
13903 !! html/parsoid
13904 <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>
13905 [[]]
13906 <a rel="mw:WikiLink" href="./Link2" title="Link2" data-parsoid='{"stx":"simple","a":{"href":"./Link2"},"sa":{"href":"Link2"}}'>Link2</a>
13907 </figcaption></figure>
13908 !! end
13909
13910 !! test
13911 Titles in unlinked images (T23454)
13912 !! wikitext
13913 [[File:Foobar.jpg|link=|stuff]]
13914 !! html/php
13915 <p><img alt="stuff" src="http://example.com/images/3/3a/Foobar.jpg" title="stuff" width="1941" height="220" />
13916 </p>
13917 !! end
13918
13919 !! test
13920 Link with empty target
13921 !! wikitext
13922 [[]]
13923 !! html
13924 <p>[[]]
13925 </p>
13926 !! end
13927
13928 !! test
13929 Image with link trail
13930 !! wikitext
13931 Linktrails should not work for images: [[File:Foobar.jpg]]s
13932 !! html/php
13933 <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
13934 </p>
13935 !! html/parsoid
13936 <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>
13937 !! end
13938
13939 !! test
13940 Image with empty attribute
13941 !! options
13942 parsoid=wt2html,wt2wt,html2html
13943 !! wikitext
13944 [[File:Foobar.jpg|right||Caption text]]
13945 !! html/php
13946 <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>
13947
13948 !! html/parsoid
13949 <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>
13950 !! end
13951
13952 !! test
13953 1. Block image with individual attributes from templates
13954 !! wikitext
13955 [[File:Foobar.jpg|thumb|{{echo|137px}}|This is a caption]]
13956 !! html/php
13957 <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>
13958
13959 !! html/parsoid
13960 <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>
13961 !! end
13962
13963 !! test
13964 2. Block Image with individual attributes from templates
13965 !! wikitext
13966 [[File:Foobar.jpg|{{echo|thumb}}|{{echo|137px}}|This is a caption]]
13967 !! html/php
13968 <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>
13969
13970 !! html/parsoid
13971 <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>
13972 !! end
13973
13974 !! test
13975 3. Inline image with individual attributes from templates
13976 !! wikitext
13977 [[File:Foobar.jpg|{{echo|50px}}]]
13978 !! html/php
13979 <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>
13980 </p>
13981 !! html/parsoid
13982 <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>
13983 !! end
13984
13985 ## Parsoid does not provide editing support for images where templates produce multiple image attributes.
13986 ## To signal this, we add a 'mw:Placeholder' type to such images. This could change in the future.
13987 !! test
13988 Image with multiple attributes from the same template
13989 !! wikitext
13990 [[File:Foobar.jpg|{{image_attribs}}]]
13991 !! html/php
13992 <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>
13993
13994 !! html/parsoid
13995 <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>
13996 !! end
13997
13998 !! test
13999 Image with link tails
14000 !! options
14001 thumbsize=220
14002 !! wikitext
14003 123[[File:Foobar.jpg]]456
14004 123[[File:Foobar.jpg|right]]456
14005 123[[File:Foobar.jpg|thumb]]456
14006 !! html/php
14007 <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
14008 </p>
14009 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
14010 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
14011
14012 !! html/php+tidy
14013 <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>
14014 <p>123</p>
14015 <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>
14016 <p>456 123</p>
14017 <div class="thumb tright">
14018 <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>
14019 <div class="thumbcaption">
14020 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
14021 </div>
14022 </div>
14023 </div>
14024 <p>456</p>
14025 !! html/parsoid
14026 <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>
14027 <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>
14028 <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>
14029 !! end
14030
14031 !! test
14032 Image with multiple captions -- only last one is accepted
14033 !! wikitext
14034 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
14035 !! html/php
14036 <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>
14037
14038 !! html/parsoid
14039 <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>
14040 !! end
14041
14042 !! test
14043 Image with multiple widths -- use last
14044 !! wikitext
14045 [[File:Foobar.jpg|200px|300px|caption]]
14046 !! html/php
14047 <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>
14048 </p>
14049 !! html/parsoid
14050 <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>
14051 !! end
14052
14053 !! test
14054 Image with multiple alignments -- use first (T50664)
14055 !! options
14056 thumbsize=220
14057 !! wikitext
14058 [[File:Foobar.jpg|thumb|left|right|center|caption]]
14059
14060 [[File:Foobar.jpg|middle|text-top|caption]]
14061 !! html/php
14062 <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>
14063 <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>
14064 </p>
14065 !! html/parsoid
14066 <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>
14067 <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>
14068 !! end
14069
14070 !! test
14071 Image with width attribute at different positions
14072 !! wikitext
14073 [[File:Foobar.jpg|200px|right|Caption]]
14074 [[File:Foobar.jpg|right|200px|Caption]]
14075 [[File:Foobar.jpg|right|Caption|200px]]
14076 !! html/php
14077 <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>
14078 <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>
14079 <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>
14080
14081 !! html/parsoid
14082 <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>
14083 <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>
14084 <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>
14085 !! end
14086
14087 # a sad bit of backward-compatibility
14088 !! test
14089 Image with size specified with pxpx (T15500, T53628)
14090 !! options
14091 parsoid=wt2html,wt2wt,html2html
14092 !! wikitext
14093 [[File:Foobar.jpg|20pxpx]]
14094 [[File:Foobar.jpg|200x20pxpx]]
14095 !! html/php
14096 <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>
14097 <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>
14098 </p>
14099 !! html/parsoid
14100 <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>
14101 !! end
14102
14103 !! test
14104 Image with link parameter, wiki target
14105 !! wikitext
14106 [[File:Foobar.jpg|link=Main Page]]
14107 !! html/php
14108 <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>
14109 </p>
14110 !! html/parsoid
14111 <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>
14112 !! end
14113
14114 # parsoid T51293 (part 1)
14115 !! test
14116 Image with link parameter, URL target
14117 !! wikitext
14118 [[File:Foobar.jpg|link=http://example.com/]]
14119 !! html/php
14120 <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>
14121 </p>
14122 !! html/parsoid
14123 <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>
14124 !! end
14125
14126 # parsoid T51293 (part 2)
14127 !! test
14128 Image with link parameter, protocol-less URL target
14129 !! wikitext
14130 [[File:Foobar.jpg|link=//example.com/]]
14131 !! html/php
14132 <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>
14133 </p>
14134 !! html/parsoid
14135 <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>
14136 !! end
14137
14138 !! test
14139 Escaping non-block captions (T107435)
14140 !! options
14141 parsoid={
14142 "modes": ["wt2wt"],
14143 "changes": [
14144 ["[typeof~='mw:Image']", "attr", "data-mw", "{\"caption\": \"|\"}"]
14145 ]
14146 }
14147 !! wikitext
14148 [[Image:Foobar.jpg|caption]]
14149 !! wikitext/edited
14150 [[Image:Foobar.jpg|<nowiki>|</nowiki>]]
14151 !! end
14152
14153 # wgExternalLinkTarget not supported by Parsoid
14154 !! test
14155 Image with link parameter, wgExternalLinkTarget
14156 !! wikitext
14157 [[Image:foobar.jpg|link=http://example.com/]]
14158 !! config
14159 wgExternalLinkTarget='foobar'
14160 !! html/php
14161 <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>
14162 </p>
14163 !! end
14164
14165 !! test
14166 Image with link parameter, wgNoFollowLinks set to false
14167 !! wikitext
14168 [[Image:foobar.jpg|link=http://example.com/]]
14169 !! config
14170 wgNoFollowLinks=false
14171 !! html
14172 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
14173 </p>
14174 !! end
14175
14176 !! test
14177 Image with link parameter, wgNoFollowDomainExceptions
14178 !! wikitext
14179 [[Image:foobar.jpg|link=http://example.com/]]
14180 !! config
14181 wgNoFollowDomainExceptions='example.com'
14182 !! html
14183 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
14184 </p>
14185 !! end
14186
14187 # wgExternalLinkTarget not supported by Parsoid
14188 !! test
14189 Image with link parameter, wgExternalLinkTarget, unnamed parameter
14190 !! wikitext
14191 [[Image:foobar.jpg|link=http://example.com/|Title]]
14192 !! config
14193 wgExternalLinkTarget='foobar'
14194 !! html/php
14195 <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>
14196 </p>
14197 !! end
14198
14199 !! test
14200 Image with empty link parameter
14201 !! wikitext
14202 [[File:Foobar.jpg|link=]]
14203 !! html/php
14204 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
14205 </p>
14206 !! html/parsoid
14207 <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>
14208 !! end
14209
14210 !! test
14211 Image with link parameter (wiki target) and unnamed parameter
14212 !! wikitext
14213 [[File:Foobar.jpg|link=Main_Page|Title]]
14214 !! html/php
14215 <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>
14216 </p>
14217 !! html/parsoid
14218 <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>
14219 !! end
14220
14221 !! test
14222 Image with link parameter (URL target) and unnamed parameter
14223 !! wikitext
14224 [[File:Foobar.jpg|link=http://example.com/|Title]]
14225 !! html/php
14226 <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>
14227 </p>
14228 !! html/parsoid
14229 <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>
14230 !! end
14231
14232 !! test
14233 Thumbnail image with link parameter
14234 !! options
14235 thumbsize=220
14236 parsoid=wt2html,wt2wt,html2html
14237 !! wikitext
14238 [[File:Foobar.jpg|thumb|link=http://example.com/|Title]]
14239 !! html/php
14240 <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>
14241
14242 !! html/parsoid
14243 <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>
14244 !! end
14245
14246 !! test
14247 Manually-specified thumbnail image
14248 !! options
14249 thumbsize=220
14250 !! wikitext
14251 [[File:Foobar.jpg|thumbnail=Thumb.png|Title]]
14252 !! html/php
14253 <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>
14254
14255 !! html/parsoid
14256 <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>
14257 !! end
14258
14259 !! test
14260 Manually-specified thumbnail image with explicit link to wiki page
14261 !! options
14262 thumbsize=220
14263 parsoid=wt2html,wt2wt,html2html
14264 !! wikitext
14265 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|Title]]
14266 !! html/php
14267 <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>
14268
14269 !! html/parsoid
14270 <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>
14271 !! end
14272
14273 !! test
14274 Manually-specified thumbnail image with explicit link to url
14275 !! options
14276 thumbsize=220
14277 parsoid=wt2html,wt2wt,html2html
14278 !! wikitext
14279 [[File:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
14280 !! html/php
14281 <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>
14282
14283 !! html/parsoid
14284 <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>
14285 !! end
14286
14287 !! test
14288 Manually-specified thumbnail image with explicit no link
14289 !! options
14290 thumbsize=220
14291 parsoid=wt2html,wt2wt,html2html
14292 !! wikitext
14293 [[File:Foobar.jpg|thumb=Thumb.png|link=|Title]]
14294 !! html/php
14295 <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>
14296
14297 !! html/parsoid
14298 <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>
14299 !! end
14300
14301 !! test
14302 Manually-specified thumbnail image with explicit link and alt text
14303 !! options
14304 thumbsize=220
14305 parsoid=wt2html,wt2wt,html2html
14306 !! wikitext
14307 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|alt=alttext|Title]]
14308 !! html/php
14309 <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>
14310
14311 !! html/parsoid
14312 <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>
14313 !! end
14314
14315 !! test
14316 Image with frame and link
14317 !! options
14318 parsoid=wt2html,wt2wt,html2html
14319 !! wikitext
14320 [[File:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
14321 !! html/php
14322 <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>
14323
14324 !! html/parsoid
14325 <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>
14326 !! end
14327
14328 !! test
14329 Image with frame and link and explicit alt
14330 !! options
14331 parsoid=wt2html,wt2wt,html2html
14332 !! wikitext
14333 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
14334 !! html/php
14335 <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>
14336
14337 !! html/parsoid
14338 <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>
14339 !! end
14340
14341 !! test
14342 Image with wiki markup in implicit alt
14343 !! wikitext
14344 [[Image:Foobar.jpg|testing '''bold''' in alt]]
14345
14346 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
14347 !! html/php
14348 <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>
14349 </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>
14350 </p>
14351 !! html/parsoid
14352 <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>
14353
14354 <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>
14355 !! end
14356
14357 !! test
14358 Alt image option should handle most kinds of wikitext without barfing
14359 !! wikitext
14360 [[Image:Foobar.jpg|thumb|This is the image caption|alt=This is a [[link]] and a {{echo|''bold template''}}.]]
14361 !! html/php
14362 <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>
14363
14364 !! html/parsoid
14365 <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>
14366 !! end
14367
14368 ###################
14369 # Conflicting image format options.
14370 # First option specified should 'win'.
14371 # All three cases in each test should be identical.
14372
14373 !! test
14374 Image with 'frameless' first.
14375 !! options
14376 parsoid=wt2html,wt2wt,html2html
14377 !! wikitext
14378 [[File:Foobar.jpg|frameless|caption]]
14379
14380 [[File:Foobar.jpg|frameless|frame|caption]]
14381
14382 [[File:Foobar.jpg|frameless|thumb|caption]]
14383 !! html/php
14384 <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>
14385 </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>
14386 </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>
14387 </p>
14388 !! html/parsoid
14389 <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>
14390 <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>
14391 <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>
14392 !! end
14393
14394 !! test
14395 Image with 'frame' first.
14396 !! options
14397 parsoid=wt2html,wt2wt,html2html
14398 !! wikitext
14399 [[File:Foobar.jpg|frame|caption]]
14400 [[File:Foobar.jpg|frame|frameless|caption]]
14401 [[File:Foobar.jpg|frame|thumb|caption]]
14402 !! html/php
14403 <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>
14404 <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>
14405 <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>
14406
14407 !! html/parsoid
14408 <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>
14409 <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>
14410 <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>
14411 !! end
14412
14413 !! test
14414 Image with 'thumb' first.
14415 !! options
14416 parsoid=wt2html,wt2wt,html2html
14417 !! wikitext
14418 [[File:Foobar.jpg|thumb|caption]]
14419 [[File:Foobar.jpg|thumb|frameless|caption]]
14420 [[File:Foobar.jpg|thumb|frame|caption]]
14421 !! html/php
14422 <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>
14423 <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>
14424 <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>
14425
14426 !! html/parsoid
14427 <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>
14428 <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>
14429 <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>
14430 !! end
14431
14432 ###################
14433 # Image sizing.
14434 # See https://www.mediawiki.org/wiki/Help:Images#Size_and_frame
14435 # and https://phabricator.wikimedia.org/T64258
14436 # Foobar has actual size of 1941x220
14437 # 1. Thumbs & frameless always reduce, can't be enlarged unless it's
14438 # a scalable format.
14439 # 2. Framed images always ignore size options; always render at default size.
14440 # 3. "Unspecified format" and border are the only types which can be
14441 # enlarged.
14442
14443 !! test
14444 Image: "unspecified format" and border enlarge
14445 !! options
14446 parsoid=wt2html,wt2wt,html2html
14447 !! wikitext
14448 [[File:Foobar.jpg|2000px]]
14449
14450 [[File:Foobar.jpg|border|2000px]]
14451 !! html/php
14452 <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>
14453 </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>
14454 </p>
14455 !! html/parsoid
14456 <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>
14457 <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>
14458 !! end
14459
14460 !! test
14461 Image: "unspecified format" and border reduce
14462 !! options
14463 parsoid=wt2html,wt2wt,html2html
14464 !! wikitext
14465 [[File:Foobar.jpg|1000px]]
14466
14467 [[File:Foobar.jpg|border|1000px]]
14468 !! html/php
14469 <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>
14470 </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>
14471 </p>
14472 !! html/parsoid
14473 <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>
14474 <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>
14475 !! end
14476
14477 !! test
14478 Image: thumbs reduce
14479 !! options
14480 parsoid=wt2html,wt2wt,html2html
14481 !! wikitext
14482 [[File:Foobar.jpg|thumb|50px]]
14483 !! html/php
14484 <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>
14485
14486 !! html/parsoid
14487 <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>
14488 !! end
14489
14490 !! test
14491 Image: bitmap thumbs can't be enlarged past original size, but vector can.
14492 !! options
14493 parsoid=wt2html,wt2wt,html2html
14494 !! wikitext
14495 [[File:Foobar.jpg|thumb|2000px]]
14496
14497 [[File:Foobar.svg|thumb|2000px]]
14498 !! html/php
14499 <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>
14500 <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>
14501
14502 !! html/parsoid
14503 <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>
14504 <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>
14505 !! end
14506
14507 !! test
14508 Image: frameless can reduce in size
14509 !! options
14510 parsoid=wt2html,wt2wt,html2html
14511 !! wikitext
14512 [[File:Foobar.jpg|frameless|50px]]
14513 !! html/php
14514 <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>
14515 </p>
14516 !! html/parsoid
14517 <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>
14518 !! end
14519
14520 !! test
14521 Image: bitmap frameless can't be enlarged past original size, but vector can
14522 !! options
14523 parsoid=wt2html,wt2wt,html2html
14524 !! wikitext
14525 [[File:Foobar.jpg|frameless|2000px]]
14526
14527 [[File:Foobar.svg|frameless|2000px]]
14528 !! html/php
14529 <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>
14530 </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>
14531 </p>
14532 !! html/parsoid
14533 <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>
14534 <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>
14535 !! end
14536
14537 !! test
14538 Image: framed images are always unscaled.
14539 !! options
14540 parsoid=wt2html,wt2wt,html2html
14541 !! wikitext
14542 [[File:Foobar.jpg|frame]]
14543
14544 [[File:Foobar.jpg|frame|50px]]
14545
14546 [[File:Foobar.jpg|frame|50x50px]]
14547
14548 [[File:Foobar.jpg|frame|2000px]]
14549 !! html/php
14550 <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>
14551 <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>
14552 <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>
14553 <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>
14554
14555 !! html/parsoid
14556 <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>
14557 <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>
14558 <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>
14559 <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>
14560 !! end
14561
14562 ###################
14563
14564 !! test
14565 Link to image page- image page normally doesn't exists, hence edit link
14566 Add test with existing image page
14567 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
14568 !! wikitext
14569 [[:Image:test]]
14570 !! html
14571 <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>
14572 </p>
14573 !! end
14574
14575 !! test
14576 T20784 Link to non-existent image page with caption should use caption as link text
14577 !! wikitext
14578 [[:Image:test|caption]]
14579 !! html
14580 <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>
14581 </p>
14582 !! end
14583
14584 !! test
14585 Frameless image caption with a free URL
14586 !! wikitext
14587 [[File:Foobar.jpg|http://example.com]]
14588 !! html/php
14589 <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>
14590 </p>
14591 !! html/parsoid
14592 <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>
14593 !! end
14594
14595 !! test
14596 Thumbnail image caption with a free URL
14597 !! options
14598 thumbsize=220
14599 !! wikitext
14600 [[File:Foobar.jpg|thumb|http://example.com]]
14601 !! html/php
14602 <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>
14603
14604 !! html/parsoid
14605 <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>
14606 !! end
14607
14608 !! test
14609 Thumbnail image caption with a free URL and explicit alt
14610 !! options
14611 thumbsize=220
14612 parsoid=wt2html,wt2wt,html2html
14613 !! wikitext
14614 [[File:Foobar.jpg|thumb|http://example.com|alt=Alteration]]
14615 !! html/php
14616 <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>
14617
14618 !! html/parsoid
14619 <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>
14620 !! end
14621
14622 !! test
14623 SVG thumbnails with no language set
14624 !! options
14625 !! wikitext
14626 [[File:Foobar.svg|thumb|caption]]
14627 !! html/php
14628 <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>
14629
14630 !! html/parsoid
14631 <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>
14632 !! end
14633
14634 !! test
14635 SVG thumbnails with language de
14636 !! options
14637 parsoid=wt2html,wt2wt,html2html
14638 !! wikitext
14639 [[File:Foobar.svg|thumb|caption|lang=de]]
14640 !! html/php
14641 <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>
14642
14643 !! html/parsoid
14644 <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>
14645 !! end
14646
14647 !! test
14648 SVG thumbnails with invalid language code
14649 !! options
14650 parsoid=wt2html,wt2wt,html2html
14651 !! wikitext
14652 [[File:Foobar.svg|thumb|caption|lang=invalid.language.code]]
14653 !! html/php
14654 <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>
14655
14656 !! html/parsoid
14657 <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>
14658 !! end
14659
14660 !! test
14661 T3887: A ISBN with a thumbnail
14662 !! wikitext
14663 [[File:Foobar.jpg|thumb|ISBN 1235467890]]
14664 !! html/php
14665 <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>
14666
14667 !! html/parsoid
14668 <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>
14669 !! end
14670
14671 !! test
14672 T3887: A RFC with a thumbnail
14673 !! wikitext
14674 [[File:Foobar.jpg|thumb|This is RFC 12354]]
14675 !! html/php
14676 <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>
14677
14678 !! html/parsoid
14679 <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>
14680 !! end
14681
14682 !! test
14683 T3887: A mailto link with a thumbnail
14684 !! wikitext
14685 [[File:Foobar.jpg|thumb|Please mailto:nobody@example.com]]
14686 !! html/php
14687 <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>
14688
14689 !! html/parsoid
14690 <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>
14691 !! end
14692
14693 # Pending resolution to T2368
14694 !! test
14695 T2648: Frameless image caption with a link
14696 !! wikitext
14697 [[File:Foobar.jpg|text with a [[link]] in it]]
14698 !! html/php
14699 <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>
14700 </p>
14701 !! html/parsoid
14702 <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>
14703 !! end
14704
14705 !! test
14706 T2648: Frameless image caption with a link (suffix)
14707 !! wikitext
14708 [[File:Foobar.jpg|text with a [[link]]foo in it]]
14709 !! html/php
14710 <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>
14711 </p>
14712 !! html/parsoid
14713 <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>
14714 !! end
14715
14716 !! test
14717 T2648: Frameless image caption with an interwiki link
14718 !! wikitext
14719 [[File:Foobar.jpg|text with a [[MeatBall:Link]] in it]]
14720 !! html/php
14721 <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>
14722 </p>
14723 !! html/parsoid
14724 <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>
14725 !! end
14726
14727 !! test
14728 T2648: Frameless image caption with a piped interwiki link
14729 !! wikitext
14730 [[File:Foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
14731 !! html/php
14732 <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>
14733 </p>
14734 !! html/parsoid
14735 <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>
14736 !! end
14737
14738 !! test
14739 T107474: Frameless image caption with <nowiki>
14740 !! wikitext
14741 [[File:Foobar.jpg|<nowiki>text with a [[MeatBall:Link|link]] in it</nowiki>]]
14742 !! html/parsoid
14743 <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>
14744 !! end
14745
14746 !! test
14747 Escape HTML special chars in image alt text
14748 !! wikitext
14749 [[File:Foobar.jpg|& < > "]]
14750 !! html/php
14751 <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>
14752 </p>
14753 !! html/parsoid
14754 <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>
14755 !! end
14756
14757 !! test
14758 Escape HTML special chars in image alt text with LanguageConverter
14759 !! options
14760 language=zh
14761 !! wikitext
14762 [[File:Foobar.jpg|& < > "]]
14763 !! html/php
14764 <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>
14765 </p>
14766 !! html/parsoid
14767 <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>
14768 !! end
14769
14770 !! test
14771 Entities in file name and attributes
14772 !! wikitext
14773 [[File:7%25 solution.gif|manualthumb=7%25 solution.gif|link=7%25 solution|[[7%25 solution]]]]
14774 !! html/php
14775 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=7%25_solution.gif" class="new" title="File:7% solution.gif">7% solution</a>
14776 </p>
14777 !! html/parsoid
14778 <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>
14779 !! end
14780
14781 !! test
14782 T2499: Alt text should have &#1234;, not &amp;1234;
14783 !! wikitext
14784 [[File:Foobar.jpg|&#9792;]]
14785 !! html/php
14786 <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>
14787 </p>
14788 !! html/parsoid
14789 <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>
14790 !! end
14791
14792 !! test
14793 Broken image caption with link
14794 !! options
14795 parsoid=wt2html,wt2wt,html2html
14796 !! wikitext
14797 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
14798 !! html/php
14799 <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.
14800 </p>
14801 !! html/parsoid
14802 <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>
14803 !! end
14804
14805 !! test
14806 Image caption containing another image
14807 !! wikitext
14808 [[File:Foobar.jpg|thumb|This is a caption with another [[File:Thumb.png|image]] inside it!]]
14809 !! html/php
14810 <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>
14811
14812 !! html/parsoid
14813 <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>
14814 !! end
14815
14816 !! test
14817 Image: caption containing a newline
14818 !! wikitext
14819 [[File:Foobar.jpg|This
14820 *is some text]]
14821 !! html/php
14822 <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>
14823 </p>
14824 !! html/parsoid
14825 <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>
14826 !!end
14827
14828 !!test
14829 Image: caption containing leading space
14830 (The leading space should not trigger nowiki escaping in wt2wt mode)
14831 !! wikitext
14832 [[File:Foobar.jpg|thumb| bar]]
14833 !! html/php
14834 <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>
14835
14836 !! html/parsoid
14837 <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>
14838 !!end
14839
14840 !! test
14841 Image: caption containing a table
14842 !! options
14843 parsoid=wt2html,wt2wt,html2html
14844 !! wikitext
14845 [[Image:Foobar.jpg|thumb|200px|This is an example image thumbnail caption with a table
14846 {|
14847 ! Foo !! Bar
14848 |-
14849 | Foo1 || Bar1
14850 |}
14851 and some more text.]]
14852 !! html/php
14853 <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>
14854
14855 !! html/parsoid
14856 <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
14857 <table>
14858 <tbody>
14859 <tr><th>Foo </th><th>Bar</th></tr>
14860 <tr>
14861 <td>Foo1 </td>
14862 <td>Bar1</td></tr></tbody></table>and some more text.</figcaption></figure>
14863 !! end
14864
14865 !! test
14866 T5090: External links other than http: in image captions
14867 !! wikitext
14868 [[File:Foobar.jpg|thumb|200x200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
14869 !! html/php
14870 <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>
14871
14872 !! html/parsoid
14873 <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>
14874 !! end
14875
14876 !! test
14877 Custom class
14878 !! options
14879 parsoid=wt2html,wt2wt,html2html
14880 !! wikitext
14881 [[Image:foobar.jpg|a|class=b]]
14882 !! html/php
14883 <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>
14884 </p>
14885 !! html/parsoid
14886 <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>
14887 !! end
14888
14889 !! test
14890 Localized image handling (1).
14891 !! options
14892 parsoid=wt2html,wt2wt,html2html
14893 language=es
14894 !! wikitext
14895 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
14896 !! html/php
14897 <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>
14898
14899 !! html/parsoid
14900 <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>
14901 !! end
14902
14903 !! test
14904 Localized image handling (2).
14905 !! options
14906 thumbsize=220
14907 parsoid=wt2html,wt2wt,html2html
14908 language=es
14909 !! wikitext
14910 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
14911 !! html/php
14912 <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>
14913
14914 !! html/parsoid
14915 <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>
14916 !! end
14917
14918 !! test
14919 Localized image handling (3).
14920 !! options
14921 language=fa
14922 parsoid=html2wt
14923 !! html/parsoid
14924 <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>
14925 !! wikitext
14926 [[File:Foobar.jpg|بندانگشتی]]
14927 !! end
14928
14929 !! test
14930 "border", "frameless" and "class" attributes on an image.
14931 !! options
14932 thumbsize=220
14933 parsoid=wt2html,wt2wt,html2html
14934 !! wikitext
14935 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
14936 !! html/php
14937 <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>
14938 </p>
14939 !! html/parsoid
14940 <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>
14941 !! end
14942
14943 # Note that 'right' is the default alignment, despite the misspelled 'righ' below
14944 !! test
14945 Invalid image attributes (T64500)
14946 !! options
14947 thumbsize=220
14948 parsoid=wt2html,wt2wt,html2html
14949 !! wikitext
14950 [[File:Foobar.jpg|thumb|float|left|caption]]
14951
14952 [[File:Foobar.jpg|thumb|righ|caption]]
14953
14954 [[File:Foobar.jpg|bogus1|thumb|bogus2|left|bogus3|caption]]
14955 !! html/php
14956 <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>
14957 <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>
14958 <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>
14959
14960 !! html/parsoid
14961 <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>
14962 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>caption</figcaption></figure>
14963 <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>
14964 !! end
14965
14966 !! article
14967 File:Barfoo.jpg
14968 !! text
14969 #REDIRECT [[File:Barfoo.jpg]]
14970 !! endarticle
14971
14972 # FIXME: Parsoid should run this test -- but we'd need to teach the
14973 # mockAPI about the redirected Barfoo.jpg image.
14974 !! test
14975 Redirected image
14976 !! wikitext
14977 [[Image:Barfoo.jpg]]
14978 !! html/php
14979 <p><a href="/wiki/File:Barfoo.jpg" class="mw-redirect" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
14980 </p>
14981 !! end
14982
14983 !! test
14984 Missing image with uploads disabled
14985 !! options
14986 wgEnableUploads=0
14987 !! wikitext
14988 [[File:Foobaz.jpg]]
14989 !! html/php
14990 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
14991 </p>
14992 !! html/parsoid
14993 <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>
14994 !! end
14995
14996 # Parsoid-specific testing for images
14997 # https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
14998 # Currently imperfect due to a flaw in the Parsoid testrunner
14999 # Work in progress
15000 # THESE TESTS SHOULD BE MOVED UP and merged with the php-specific
15001 # image tests.
15002
15003 !! test
15004 Parsoid-specific image handling - simple image with size and middle alignment
15005 !! wikitext
15006 [[File:Foobar.jpg|middle|50px]]
15007 !! html/parsoid
15008 <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>
15009 !! end
15010
15011 !! test
15012 Parsoid-specific image handling - simple image with size, middle alignment,
15013 non-standard namespace alias
15014 !! options
15015 parsoid=wt2wt,wt2html,html2html
15016 !! wikitext
15017 [[Image:Foobar.jpg|middle|50px]]
15018 !! html/parsoid
15019 <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>
15020 !! end
15021
15022 !! test
15023 Parsoid-specific image handling - simple image with size and middle alignment
15024 (existing content)
15025 !! wikitext
15026 [[File:Foobar.jpg|50px|middle]]
15027 !! html/parsoid
15028 <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>
15029 !! end
15030
15031 !! test
15032 Parsoid-specific image handling - simple image with size and middle alignment
15033 and non-standard namespace name
15034 !! options
15035 parsoid=wt2html,wt2wt,html2html
15036 !! wikitext
15037 [[Image:Foobar.jpg|50px|middle]]
15038 !! html/parsoid
15039 <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>
15040 !! end
15041
15042 !! test
15043 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
15044 !! wikitext
15045 [[File:Foobar.jpg|500x10px|baseline|caption]]
15046 !! html/parsoid
15047 <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>
15048 !! end
15049
15050 !! test
15051 Parsoid-specific image handling - simple image with border and size spec
15052 !! wikitext
15053 [[File:Foobar.jpg|50px|border|caption]]
15054 !! html/parsoid
15055 <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>
15056 !! end
15057
15058 !! test
15059 Parsoid-specific image handling - thumbnail with halign, valign, and caption
15060 !! wikitext
15061 [[File:Foobar.jpg|left|baseline|thumb|caption content]]
15062 !! html/parsoid
15063 <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>
15064 !! end
15065
15066 !! test
15067 Parsoid-specific image handling - thumbnail with halign, valign, and caption
15068 (existing content)
15069 !! wikitext
15070 [[File:Foobar.jpg|thumb|left|baseline|caption content]]
15071 !! html/parsoid
15072 <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>
15073 !! end
15074
15075 !! test
15076 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
15077 !! wikitext
15078 [[Image:Foobar.jpg|right|middle|thumb|50x50px|caption]]
15079 !! html/parsoid
15080 <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>
15081 !! end
15082
15083 !! test
15084 Parsoid-specific image handling - thumbnail with specific size, halign,
15085 valign, and caption (existing content)
15086 !! wikitext
15087 [[File:Foobar.jpg|thumb|50x50px|right|middle|caption]]
15088 !! html/parsoid
15089 <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>
15090 !! end
15091
15092 !! test
15093 Parsoid-specific image handling - framed image with specific size and caption
15094 (size is ignored)
15095 !! options
15096 parsoid=wt2html,wt2wt,html2html
15097 !! wikitext
15098 [[File:Foobar.jpg|frame|500x50px|caption]]
15099 !! html/parsoid
15100 <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>
15101 !! end
15102
15103 !! test
15104 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption
15105 (size is ignored)
15106 !! options
15107 parsoid=wt2html,wt2wt,html2html
15108 !! wikitext
15109 [[File:Foobar.jpg|left|baseline|frame|500x50px|caption]]
15110 !! html/parsoid
15111 <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>
15112 !! end
15113
15114 !! test
15115 Parsoid-specific image handling - frameless image with specific size, border, and caption
15116 !! wikitext
15117 [[File:Foobar.jpg|frameless|442x50px|border|caption]]
15118 !! html/parsoid
15119 <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>
15120 !! end
15121
15122 !! test
15123 Parsoid-specific image handling - simple image with a formatted caption
15124 !! wikitext
15125 [[File:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
15126 !! html/parsoid
15127 <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>
15128 !! end
15129
15130 !! test
15131 Parsoid-specific image handling - caption with a template in it
15132 !! wikitext
15133 [[File:Foobar.jpg|thumb|200x23px|This caption has a {{echo|transclusion}} in it.]]
15134 !! html/parsoid
15135 <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>
15136 !! end
15137
15138 !! test
15139 Parsoid-specific image handling - caption with unbalanced tags in it
15140 !! options
15141 parsoid=wt2html,wt2wt,html2html
15142 !! wikitext
15143 foo
15144 [[File:Foobar.jpg|thumb|200x200px|This caption has a <center>unbalanced tag in it.]]
15145 bar
15146 !! html/parsoid
15147 <p>foo</p>
15148 <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>
15149 <p>bar</p>
15150 !! end
15151
15152 !! test
15153 Parsoid-specific image handling - empty caption (1)
15154 !! options
15155 parsoid=wt2html,wt2wt
15156 !! wikitext
15157 [[File:Foobar.jpg|thumb|]]
15158 !! html/parsoid
15159 <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>
15160 !! end
15161
15162 # empty captions don't get serialized unless we're in the "round trip" case
15163 !! test
15164 Parsoid-specific image handling - empty caption (2)
15165 !! options
15166 parsoid=html2wt
15167 !! html/parsoid
15168 <figure class="mw-default-size" typeof="mw:Image/Thumb">
15169 <a href="./File:Foobar.jpg">
15170 <img resource="./File:Foobar.jpg"
15171 src="//example.com/images/3/3a/Foobar.jpg"
15172 data-file-width="1941" data-file-height="220" data-file-type="bitmap"
15173 height="25" width="220"/>
15174 </a>
15175 <figcaption></figcaption>
15176 </figure>
15177 !! wikitext
15178 [[File:Foobar.jpg|thumb]]
15179 !! end
15180
15181 !! test
15182 Parsoid-specific image handling - whitespace caption
15183 !! wikitext
15184 [[File:Foobar.jpg|thumb| ]]
15185 !! html/parsoid
15186 <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>
15187 !! end
15188
15189 !! test
15190 Parsoid-specific image handling - lang option
15191 !! wikitext
15192 foo
15193 [[File:Foobar.svg|lang=de|caption]]
15194 bar
15195 !! html/parsoid
15196 <p>foo
15197 <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>
15198 bar</p>
15199 !! end
15200
15201 ## Edge case bugs in Parsoid from T93580
15202 !! test
15203 T93580: 1. Templated <ref> inside block images
15204 !! wikitext
15205 [[File:Foobar.jpg|thumb|Caption with templated ref: {{echo|<ref>foo</ref>}}]]
15206
15207 <references />
15208 !! html/parsoid
15209 <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>
15210
15211 <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>
15212 !! end
15213
15214 !! test
15215 T93580: 2. <ref> inside inline images
15216 !! wikitext
15217 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: <ref>foo</ref>]]
15218
15219 <references />
15220 !! html/parsoid
15221 <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>
15222
15223 <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>
15224 !! end
15225
15226 !! test
15227 T93580: 3. Templated <ref> inside inline images
15228 !! wikitext
15229 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: {{echo|<ref>{{echo|foo}}</ref>}}]]
15230
15231 <references />
15232 !! html/parsoid
15233 <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>
15234
15235 <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>
15236 !! end
15237
15238 ###
15239 ### Subpages
15240 ###
15241 !! article
15242 Subpage test/subpage
15243 !! text
15244 foo
15245 !! endarticle
15246
15247 !! test
15248 Subpage link
15249 !! options
15250 subpage title=[[Subpage test]]
15251 !! wikitext
15252 [[/subpage]]
15253 !! html
15254 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
15255 </p>
15256 !! end
15257
15258 !! test
15259 Subpage noslash link
15260 !! options
15261 subpage title=[[Subpage test]]
15262 !! wikitext
15263 [[/subpage/]]
15264 !! html
15265 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
15266 </p>
15267 !! end
15268
15269 !! article
15270 Subpage test/1/2/subpage
15271 !! text
15272 blah
15273 !! endarticle
15274
15275 !! test
15276 Relative subpage noslash link
15277 !! options
15278 parsoid=wt2wt,wt2html,html2html
15279 subpage title=[[Subpage test/1/2/3/4]]
15280 !! wikitext
15281 [[../../subpage/]]
15282
15283 [[../../subpage]]
15284 !! html/php
15285 <p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a>
15286 </p><p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage test/1/2/subpage</a>
15287 </p>
15288 !! html/parsoid
15289 <p><a rel="mw:WikiLink" href="./Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a></p>
15290 <p><a rel="mw:WikiLink" href="./Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
15291 !! end
15292
15293 !! test
15294 Parsoid: dot-slash prefixed wikilinks
15295 !! wikitext
15296 [[./foo]]
15297
15298 [[././bar]]
15299
15300 [[././baz/]]
15301 !! html/php
15302 <p>[[./foo]]
15303 </p><p>[[././bar]]
15304 </p><p>[[././baz/]]
15305 </p>
15306 !! html/parsoid
15307 <p>[[./foo]]
15308 </p><p>[[././bar]]
15309 </p><p>[[././baz/]]
15310 </p>
15311 !! end
15312
15313 !! test
15314 Render invalid page names as plain text (T53090)
15315 !! wikitext
15316 [[./../foo|bar]]
15317 [[foo�|bar]]
15318 [[foo/.|bar]]
15319 [[foo/..|bar]]
15320 [[foo~~~bar]]
15321 [[foo>bar]]
15322 [[foo[bar]]
15323 [[.]]
15324 [[..]]
15325 [[foo././bar]]
15326 [[foo[http://example.com]xyz]]
15327
15328 [[{{echo|./../foo}}|bar]]
15329 [[{{echo|foo/.}}|bar]]
15330 [[{{echo|foo/..}}|bar]]
15331 [[{{echo|foo~~~~bar}}]]
15332 [[{{echo|foo>bar}}]]
15333 [[{{echo|foo././bar}}]]
15334 [[{{echo|foo{bar}}]]
15335 [[{{echo|foo}bar}}]]
15336 [[{{echo|foo[bar}}]]
15337 [[{{echo|foo]bar}}]]
15338 [[{{echo|foo<bar}}]]
15339 !!html/php
15340 <p>[[./../foo|bar]]
15341 [[foo�|bar]]
15342 [[foo/.|bar]]
15343 [[foo/..|bar]]
15344 [[foo~~~bar]]
15345 [[foo&gt;bar]]
15346 [[foo[bar]]
15347 [[.]]
15348 [[..]]
15349 [[foo././bar]]
15350 [[foo<a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>xyz]]
15351 </p><p>[[./../foo|bar]]
15352 [[foo/.|bar]]
15353 [[foo/..|bar]]
15354 [[foo~~~~bar]]
15355 [[foo&gt;bar]]
15356 [[foo././bar]]
15357 [[foo{bar]]
15358 [[foo}bar]]
15359 [[foo[bar]]
15360 [[foo]bar]]
15361 [[foo&lt;bar]]
15362 </p>
15363 !!html/parsoid
15364 <p>[[./../foo|bar]]
15365 [[foo�|bar]]
15366 [[foo/.|bar]]
15367 [[foo/..|bar]]
15368 [[foo~~~bar]]
15369 [[foo>bar]]
15370 [[foo[bar]]
15371 [[.]]
15372 [[..]]
15373 [[foo././bar]]
15374 [[foo<a rel="mw:ExtLink" href="http://example.com"></a>xyz]]</p>
15375
15376 <p>[[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"./../foo"}},"i":0}}]}'>./../foo</span>|bar]]
15377 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/."}},"i":0}}]}'>foo/.</span>|bar]]
15378 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/.."}},"i":0}}]}'>foo/..</span>|bar]]
15379 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo~~~~bar"}},"i":0}}]}'>foo~~~~bar</span>]]
15380 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo>bar"}},"i":0}}]}'>foo>bar</span>]]
15381 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo././bar"}},"i":0}}]}'>foo././bar</span>]]
15382 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo{bar"}},"i":0}}]}'>foo{bar</span>]]
15383 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo}bar"}},"i":0}}]}'>foo}bar</span>]]
15384 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo[bar"}},"i":0}}]}'>foo[bar</span>]]
15385 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo]bar"}},"i":0}}]}'>foo]bar</span>]]
15386 [[<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>
15387 !!end
15388
15389 !! test
15390 Disabled subpages
15391 !! wikitext
15392 [[/subpage]]
15393 !! html
15394 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
15395 </p>
15396 !! end
15397
15398 !! test
15399 T2561: {{/Subpage}}
15400 !! options
15401 subpage title=[[Page]]
15402 !! wikitext
15403 {{/Subpage}}
15404 !! html
15405 <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>
15406 </p>
15407 !! end
15408
15409 ###
15410 ### Categories
15411 ###
15412 !! article
15413 Category:MediaWiki User's Guide
15414 !! text
15415 blah
15416 !! endarticle
15417
15418 !! test
15419 Link to category
15420 !! wikitext
15421 [[:Category:MediaWiki User's Guide]]
15422 !! html
15423 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
15424 </p>
15425 !! end
15426
15427 !! test
15428 Simple category
15429 !! options
15430 cat
15431 !! wikitext
15432 [[Category:MediaWiki User's Guide]]
15433 !! html/php
15434 cat=MediaWiki_User's_Guide sort=
15435 !! html/parsoid
15436 <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"}}'/>
15437 !! end
15438
15439 !! test
15440 PAGESINCATEGORY invalid title fatal (r33546 fix)
15441 !! wikitext
15442 {{PAGESINCATEGORY:<bogus>}}
15443 !! html
15444 <p>0
15445 </p>
15446 !! end
15447
15448 !! test
15449 Category with different sort key
15450 !! options
15451 cat
15452 !! wikitext
15453 [[Category:MediaWiki User's Guide|Foo]]
15454 !! html/php
15455 cat=MediaWiki_User's_Guide sort=Foo
15456 !! html/parsoid
15457 <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"}}'/>
15458 !! end
15459
15460 !! test
15461 Category with identical sort key
15462 !! options
15463 cat
15464 !! wikitext
15465 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
15466 !! html/php
15467 cat=MediaWiki_User's_Guide sort=MediaWiki User's Guide
15468 !! html/parsoid
15469 <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"}}'/>
15470 !! end
15471
15472 !! test
15473 Category with empty sort key
15474 !! options
15475 cat
15476 pst
15477 !! wikitext
15478 [[Category:MediaWiki User's Guide|]]
15479 !! html/php
15480 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
15481 !! end
15482
15483 !! test
15484 Category with empty sort key and parentheses
15485 !! options
15486 cat
15487 pst
15488 !! wikitext
15489 [[Category:Foo (bar)|]]
15490 !! html/php
15491 [[Category:Foo (bar)|Foo]]
15492 !! end
15493
15494 !! test
15495 Category with link tail
15496 !! options
15497 cat
15498 pst
15499 !! wikitext
15500 123[[Category:Foo]]456
15501 !! html/php
15502 123[[Category:Foo]]456
15503 !! end
15504
15505 !! test
15506 Category with template
15507 !! options
15508 cat
15509 pst
15510 !! wikitext
15511 [[Category:{{echo|Foo}}]]
15512 !! html/php
15513 [[Category:{{echo|Foo}}]]
15514 !! end
15515
15516 !! test
15517 Category with template in sort key
15518 !! options
15519 cat
15520 pst
15521 !! wikitext
15522 [[Category:Foo|{{echo|Bar}}]]
15523 !! html/php
15524 [[Category:Foo|{{echo|Bar}}]]
15525 !! end
15526
15527 !! test
15528 Category with template in sort key and title
15529 !! options
15530 cat
15531 pst
15532 !! wikitext
15533 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
15534 !! html/php
15535 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
15536 !! end
15537
15538 ## We used to, but no longer wt2wt this test since the default serializer
15539 ## will normalize all categories to serialize on their own line.
15540 ## This wikitext usage is going to be fairly uncommon in production and
15541 ## selser will take care of preserving formatting in those scenarios.
15542 !! test
15543 Category / paragraph interactions
15544 !! options
15545 parsoid=wt2html
15546 !! wikitext
15547 Foo [[Category:Baz]] Bar
15548
15549 Foo [[Category:Baz]]
15550 Bar
15551
15552 Foo
15553 [[Category:Baz]]
15554 Bar
15555
15556 Foo
15557 [[Category:Baz]] Bar
15558
15559 Foo
15560 [[Category:Baz]]
15561 [[Category:Baz]]
15562 [[Category:Baz]]
15563 Bar
15564
15565 [[Category:Baz]]
15566 [[Category:Baz]]
15567 [[Category:Baz]]
15568
15569 [[Category:Baz]]
15570 {{echo|[[Category:Baz]]}}
15571 [[Category:Baz]]
15572 !! html/php
15573 <p>Foo Bar
15574 </p><p>Foo
15575 Bar
15576 </p><p>Foo
15577 Bar
15578 </p><p>Foo Bar
15579 </p><p>Foo
15580 Bar
15581 </p>
15582 !! html/parsoid
15583 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
15584 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
15585 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
15586 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
15587 <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>
15588 <link rel="mw:PageProp/Category" href="./Category:Baz"/>
15589 !! end
15590
15591 ## We used to, but no longer wt2wt this test since the default serializer
15592 ## will normalize all categories to serialize on their own line.
15593 ## This wikitext usage is going to be fairly uncommon in production and
15594 ## selser will take care of preserving formatting in those scenarios.
15595 ##
15596 ## The whitespace on the empty line is part of the test. Please do not delete
15597 !! test
15598 1. Categories and newlines: All preceding newlines should be suppressed (courtesy T2087)
15599 !! options
15600 parsoid=wt2html
15601 !! wikitext
15602 This
15603
15604 [[Category:Foo]] and this should be part of same paragraph (not an indent-pre)
15605
15606 {{echo|[[Category:Foo]] and so should this!}}
15607 !! html/php
15608 <p>This and this should be part of same paragraph (not an indent-pre) and so should this!
15609 </p>
15610 !! html/parsoid
15611 <p>This
15612
15613 <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of same paragraph (not an indent-pre)
15614
15615 <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>
15616 !! end
15617
15618 ## Parsoid will not try to wt2wt this while preserving newlines because
15619 ## it suppresses excess newlines within list items -- and we don't want to
15620 ## introduce a special case just for categories, which is, in reality somewhat
15621 ## odd behavior -- categories are unlikely to be used in list items like this
15622 ## in top-level pages and are only likely to show up in template-generated
15623 ## list items where this RT-ing is a non-issue.
15624 ##
15625 ## The whitespace on the empty line is part of the test. Please do not delete
15626 !! test
15627 2. Categories and newlines: All preceding newlines should be suppressed (courtesy T2087)
15628 !! options
15629 parsoid=wt2html
15630 !! wikitext
15631 * This
15632
15633 [[Category:Foo]] and this should be part of the same list item
15634 * So should this
15635
15636 {{echo|[[Category:Foo]] and this should be part of the same list item}}
15637 !! html
15638 <ul><li>This and this should be part of the same list item</li>
15639 <li>So should this and this should be part of the same list item</li></ul>
15640 !! html/parsoid
15641 <ul>
15642 <li>This <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of the same list item</li>
15643 <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>
15644 </ul>
15645 !! end
15646
15647 ## Newlines and categories that follow the last item of a list
15648 ## are treated differently because this (list followed by categories)
15649 ## is an extremely common pattern on wikis.
15650 !! test
15651 3. Categories and newlines: newline suppression for last list item should RT properly
15652 !! wikitext
15653 * a
15654 * b
15655
15656 [[Category:Foo]]
15657
15658 [[Category:Bar]]
15659 [[Category:Baz]]
15660 !! html/parsoid
15661 <ul><li> a</li>
15662 <li> b</li></ul>
15663
15664 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
15665
15666 <link rel="mw:PageProp/Category" href="./Category:Bar" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
15667 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
15668 !! end
15669
15670 !! test
15671 4. Categories and newlines: newline suppression for last list item should RT properly
15672 !! wikitext
15673 * a
15674 **** b
15675
15676 [[Category:Foo]]
15677 !! html/parsoid
15678 <ul><li> a
15679 <ul><li><ul><li><ul><li> b</li></ul></li></ul></li></ul></li></ul>
15680
15681 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
15682 !! end
15683
15684 ## only wt2html for this to make sure the algo only applies to the rightmost path
15685 !! test
15686 5. Categories and newlines: migrateTrailingCategories dom pass should only run on the rightmost path of nested lists
15687 !! options
15688 parsoid=wt2html
15689 !! wikitext
15690 * a
15691 ** b
15692 [[Category:Foo]]
15693 * c
15694 ** d
15695 [[Category:Foo]]
15696 !! html/parsoid
15697 <ul><li> a
15698 <ul><li> b
15699 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/></li></ul></li>
15700 <li> c
15701 <ul><li> d</li></ul></li></ul>
15702 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
15703 !! end
15704
15705 ## We used to, but no longer wt2wt this test since the default serializer
15706 ## will normalize all categories to serialize on their own line.
15707 ## This wikitext usage is going to be fairly uncommon in production and
15708 ## selser will take care of preserving formatting in those scenarios.
15709 !! test
15710 6. Categories and newlines: migrateTrailingCategories dom pass should not migrate categories not preceded by newlines
15711 !! options
15712 parsoid=wt2html
15713 !! wikitext
15714 * a [[Category:Foo]]
15715 !! html/parsoid
15716 <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>
15717 !! end
15718
15719 # This test also demonstrates because of newline+category tunneling
15720 # through the list hander, template wrapping doesn't expand to the
15721 # containing list when the list item swallows the category.
15722 !! test
15723 7. Categories and newlines: migrateTrailingCategories dom pass should leave template content alone
15724 !! wikitext
15725 * {{echo|a
15726 [[Category:Foo]]}}
15727 !! html/parsoid
15728 <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
15729 </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>
15730 !! end
15731
15732 !! test
15733 8. Categories and newlines: migrateTrailingCategories dom pass should not get tripped by intervening templates
15734 !! wikitext
15735 * a
15736
15737 {{echo|[[Category:Foo]]
15738 [[Category:Bar]]}}
15739 [[Category:Baz]]
15740 !! html/parsoid
15741 <ul><li> a</li></ul>
15742
15743 <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">
15744 </span><link rel="mw:PageProp/Category" href="./Category:Bar" about="#mwt1" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
15745 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
15746 !! end
15747
15748 !! test
15749 Category links with multiple namespaces
15750 !! wikitext
15751 [[Category:Project:Foo]]
15752 !! html/parsoid
15753 <link rel="mw:PageProp/Category" href="./Category:Project:Foo" />
15754 !! end
15755
15756 !! test
15757 Parsoid: Serialize link to category page with colon escape
15758 !! options
15759 parsoid
15760 !! wikitext
15761
15762 [[:Category:Foo]]
15763 [[:Category:Foo|Bar]]
15764 !! html
15765 <p>
15766 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Category:Foo</a>
15767 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Bar</a>
15768 </p>
15769 !! end
15770
15771 # We used to, but no longer wt2wt this test since the default serializer
15772 # will normalize all categories to serialize on their own line.
15773 # This wikitext usage is going to be fairly uncommon in production and
15774 # selser will take care of preventing whitespace insertion if this
15775 # occurs in an article.
15776 #
15777 # html2html disabled for the same reason (whitespace insertion between
15778 # x and y).
15779 #
15780 # html2wt disabled because it localizes the "Category" namespace.
15781 !! test
15782 Link prefix/suffixes aren't applied to category links
15783 !! options
15784 parsoid=wt2html
15785 language=is
15786 !! wikitext
15787 x[[Category:Foo]]y
15788 !! html/php
15789 <p>xy
15790 </p>
15791 !! html/parsoid
15792 <p>x<link rel="mw:PageProp/Category" href="./Flokkur:Foo" data-parsoid=""/>y</p>
15793 !! end
15794
15795 !! test
15796 Parsoid: Serialize link to file page with colon escape
15797 !! options
15798 parsoid
15799 !! wikitext
15800
15801 [[:File:Foo.png]]
15802 [[:File:Foo.png|Bar]]
15803 !! html
15804 <p>
15805 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">File:Foo.png</a>
15806 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">Bar</a>
15807 </p>
15808 !! end
15809
15810 !! test
15811 Parsoid: Serialize a genuine category link without colon escape
15812 !! options
15813 parsoid
15814 !! wikitext
15815 [[Category:Foo]]
15816 [[Category:Foo|Bar]]
15817 !! html
15818 <link rel="mw:PageProp/Category" href="./Category:Foo">
15819 <link rel="mw:PageProp/Category" href="./Category:Foo#Bar">
15820 !! end
15821
15822 !! test
15823 Normalize hrefs properly before testing for invalid link targets (T72894)
15824 !! options
15825 parsoid=html2wt
15826 !! html/parsoid
15827 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne"/>
15828 !! wikitext
15829 [[Category:Toxine bactérienne]]
15830 !! end
15831
15832 !! test
15833 Parsoid: Defaultsort
15834 !! wikitext
15835 {{DEFAULTSORT:Foo}}
15836 !! html/parsoid
15837 <meta property="mw:PageProp/categorydefaultsort" content="Foo"/>
15838 !! end
15839
15840 # NOTE: mw:ExpandedAttrs is not the best typeof here. mw:Transclusion is better.
15841 # But, this is a limitation of our representation and is documented in
15842 # TemplateHandler.js in processSpecialMagicWord
15843 !! test
15844 Parsoid: Defaultsort (template-generated)
15845 !! wikitext
15846 {{{{echo|DEFAULTSORT}}:Foo}}
15847 !! html/parsoid
15848 <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"}]]}'/>
15849 !! end
15850
15851 ###
15852 ### Inter-language links
15853 ###
15854 !! test
15855 Interlanguage links
15856 !! options
15857 ill
15858 !! wikitext
15859 [[es:Alimento]]
15860 [[fr:Nourriture]]
15861 [[zh:食品]]
15862 !! html/php
15863 es:Alimento fr:Nourriture zh:食品
15864 !! html/parsoid
15865 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Alimento"/>
15866 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/Nourriture"/>
15867 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/食品"/>
15868 !! end
15869
15870 !! test
15871 Duplicate interlanguage links (T26502)
15872 !! options
15873 ill
15874 !! wikitext
15875 [[es:1]]
15876 [[es:2]]
15877 [[fr:1]]
15878 [[fr:2]]
15879 !! html/php
15880 es:1 fr:1
15881 !! html/parsoid
15882 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/1"/>
15883 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/2"/>
15884 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/1"/>
15885 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/2"/>
15886 !! end
15887
15888 ###
15889 ### Sections
15890 ###
15891 !! test
15892 Basic section headings
15893 !! wikitext
15894 == Headline 1 ==
15895 Some text
15896
15897 ==Headline 2==
15898 More
15899 ===Smaller headline===
15900 Blah blah
15901 !! html
15902 <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>
15903 <p>Some text
15904 </p>
15905 <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>
15906 <p>More
15907 </p>
15908 <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>
15909 <p>Blah blah
15910 </p>
15911 !! end
15912
15913 !! test
15914 Section headings with TOC
15915 !! wikitext
15916 == Headline 1 ==
15917 === Subheadline 1 ===
15918 ===== Skipping a level =====
15919 ====== Skipping a level ======
15920
15921 == Headline 2 ==
15922 Some text
15923 ===Another headline===
15924 !! html
15925 <div id="toc" class="toc"><div id="toctitle" class="toctitle"><h2>Contents</h2></div>
15926 <ul>
15927 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
15928 <ul>
15929 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
15930 <ul>
15931 <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>
15932 <ul>
15933 <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>
15934 </ul>
15935 </li>
15936 </ul>
15937 </li>
15938 </ul>
15939 </li>
15940 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
15941 <ul>
15942 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
15943 </ul>
15944 </li>
15945 </ul>
15946 </div>
15947
15948 <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>
15949 <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>
15950 <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>
15951 <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>
15952 <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>
15953 <p>Some text
15954 </p>
15955 <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>
15956
15957 !! end
15958
15959 !! test
15960 TOC anchors don't collide
15961 !! wikitext
15962 __FORCETOC__
15963 == Headline 2 ==
15964 == Headline ==
15965 == Headline 2 ==
15966 == Headline ==
15967 !! html/php
15968 <div id="toc" class="toc"><div id="toctitle" class="toctitle"><h2>Contents</h2></div>
15969 <ul>
15970 <li class="toclevel-1 tocsection-1"><a href="#Headline_2"><span class="tocnumber">1</span> <span class="toctext">Headline 2</span></a></li>
15971 <li class="toclevel-1 tocsection-2"><a href="#Headline"><span class="tocnumber">2</span> <span class="toctext">Headline</span></a></li>
15972 <li class="toclevel-1 tocsection-3"><a href="#Headline_2_2"><span class="tocnumber">3</span> <span class="toctext">Headline 2</span></a></li>
15973 <li class="toclevel-1 tocsection-4"><a href="#Headline_3"><span class="tocnumber">4</span> <span class="toctext">Headline</span></a></li>
15974 </ul>
15975 </div>
15976
15977 <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>
15978 <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>
15979 <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>
15980 <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>
15981
15982 !! end
15983
15984 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
15985 !! test
15986 Handling of sections up to level 6 and beyond
15987 !! wikitext
15988 = Level 1 Heading=
15989 == Level 2 Heading==
15990 === Level 3 Heading===
15991 ==== Level 4 Heading====
15992 ===== Level 5 Heading=====
15993 ====== Level 6 Heading======
15994 ======= Level 7 Heading=======
15995 ======== Level 8 Heading========
15996 ========= Level 9 Heading=========
15997 ========== Level 10 Heading==========
15998 !! html
15999 <div id="toc" class="toc"><div id="toctitle" class="toctitle"><h2>Contents</h2></div>
16000 <ul>
16001 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
16002 <ul>
16003 <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>
16004 <ul>
16005 <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>
16006 <ul>
16007 <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>
16008 <ul>
16009 <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>
16010 <ul>
16011 <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>
16012 <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>
16013 <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>
16014 <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>
16015 <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>
16016 </ul>
16017 </li>
16018 </ul>
16019 </li>
16020 </ul>
16021 </li>
16022 </ul>
16023 </li>
16024 </ul>
16025 </li>
16026 </ul>
16027 </div>
16028
16029 <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>
16030 <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>
16031 <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>
16032 <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>
16033 <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>
16034 <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>
16035 <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>
16036 <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>
16037 <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>
16038 <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>
16039
16040 !! end
16041
16042 !! test
16043 TOC regression (T11764)
16044 !! wikitext
16045 == title 1 ==
16046 === title 1.1 ===
16047 ==== title 1.1.1 ====
16048 === title 1.2 ===
16049 == title 2 ==
16050 === title 2.1 ===
16051 !! html
16052 <div id="toc" class="toc"><div id="toctitle" class="toctitle"><h2>Contents</h2></div>
16053 <ul>
16054 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
16055 <ul>
16056 <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>
16057 <ul>
16058 <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>
16059 </ul>
16060 </li>
16061 <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>
16062 </ul>
16063 </li>
16064 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
16065 <ul>
16066 <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>
16067 </ul>
16068 </li>
16069 </ul>
16070 </div>
16071
16072 <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>
16073 <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>
16074 <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>
16075 <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>
16076 <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>
16077 <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>
16078
16079 !! end
16080
16081 !! test
16082 TOC for heading containing <span id="..."></span> (T96153)
16083 !! wikitext
16084 __FORCETOC__
16085 ==<span id="old-anchor"></span>New title==
16086 !! html/php
16087 <div id="toc" class="toc"><div id="toctitle" class="toctitle"><h2>Contents</h2></div>
16088 <ul>
16089 <li class="toclevel-1 tocsection-1"><a href="#New_title"><span class="tocnumber">1</span> <span class="toctext">New title</span></a></li>
16090 </ul>
16091 </div>
16092
16093 <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>
16094
16095 !! end
16096
16097 !! test
16098 TOC with wgMaxTocLevel=3 (T8204)
16099 !! options
16100 wgMaxTocLevel=3
16101 !! wikitext
16102 == title 1 ==
16103 === title 1.1 ===
16104 ==== title 1.1.1 ====
16105 === title 1.2 ===
16106 == title 2 ==
16107 === title 2.1 ===
16108 !! html
16109 <div id="toc" class="toc"><div id="toctitle" class="toctitle"><h2>Contents</h2></div>
16110 <ul>
16111 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
16112 <ul>
16113 <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>
16114 <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>
16115 </ul>
16116 </li>
16117 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
16118 <ul>
16119 <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>
16120 </ul>
16121 </li>
16122 </ul>
16123 </div>
16124
16125 <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>
16126 <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>
16127 <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>
16128 <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>
16129 <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>
16130 <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>
16131
16132 !! end
16133
16134 !! test
16135 TOC with wgMaxTocLevel=3 and two level four headings (T8204)
16136 !! options
16137 wgMaxTocLevel=3
16138 !! wikitext
16139 ==Section 1==
16140 ===Section 1.1===
16141 ====Section 1.1.1====
16142 ====Section 1.1.1.1====
16143 ==Section 2==
16144 !! html
16145 <div id="toc" class="toc"><div id="toctitle" class="toctitle"><h2>Contents</h2></div>
16146 <ul>
16147 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
16148 <ul>
16149 <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>
16150 </ul>
16151 </li>
16152 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
16153 </ul>
16154 </div>
16155
16156 <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>
16157 <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>
16158 <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>
16159 <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>
16160 <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>
16161
16162 !! end
16163
16164
16165 !! test
16166 Resolving duplicate section names
16167 !! wikitext
16168 == Foo bar ==
16169 == Foo bar ==
16170 !! html
16171 <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>
16172 <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>
16173
16174 !! end
16175
16176 !! test
16177 Resolving duplicate section names with differing case (T12721)
16178 !! wikitext
16179 == Foo bar ==
16180 == Foo Bar ==
16181 !! html
16182 <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>
16183 <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>
16184
16185 !! end
16186
16187 !! article
16188 Template:sections
16189 !! text
16190 ===Section 1===
16191 ==Section 2==
16192 !! endarticle
16193
16194 !! test
16195 Template with sections, __NOTOC__
16196 !! wikitext
16197 __NOTOC__
16198 ==Section 0==
16199 {{sections}}
16200 ==Section 4==
16201 !! html
16202 <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>
16203 <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>
16204 <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>
16205 <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>
16206
16207 !! end
16208
16209 !! test
16210 __NOEDITSECTION__ keyword
16211 !! wikitext
16212 __NOEDITSECTION__
16213 ==Section 1==
16214 ==Section 2==
16215 !! html
16216 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
16217 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
16218
16219 !! end
16220
16221 !! test
16222 Link inside a section heading
16223 !! wikitext
16224 ==Section with a [[Main Page|link]] in it==
16225 !! html
16226 <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>
16227
16228 !! end
16229
16230 !! test
16231 TOC regression (T14077)
16232 !! wikitext
16233 __TOC__
16234 == title 1 ==
16235 === title 1.1 ===
16236 == title 2 ==
16237 !! html
16238 <div id="toc" class="toc"><div id="toctitle" class="toctitle"><h2>Contents</h2></div>
16239 <ul>
16240 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
16241 <ul>
16242 <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>
16243 </ul>
16244 </li>
16245 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
16246 </ul>
16247 </div>
16248
16249 <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>
16250 <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>
16251 <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>
16252
16253 !! end
16254
16255 !! test
16256 T3219 URL next to image (good)
16257 !! wikitext
16258 http://example.com [[File:Foobar.jpg]]
16259 !! html/php
16260 <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>
16261 </p>
16262 !! html/parsoid
16263 <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>
16264 !!end
16265
16266 !! test
16267 Short headings with trailing space should match behavior of Parser::doHeadings (T21910)
16268 !! wikitext
16269 ===
16270 The line above must have a trailing space!
16271 === <!--
16272 --> <!-- -->
16273 But just in case it doesn't...
16274 !! html
16275 <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>
16276 <p>The line above must have a trailing space!
16277 </p>
16278 <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>
16279 <p>But just in case it doesn't...
16280 </p>
16281 !! end
16282
16283 !! test
16284 Header with special characters (T27462)
16285 !! wikitext
16286 The tooltips shall not show entities to the user (ie. be double escaped)
16287
16288 == text > text ==
16289 section 1
16290
16291 == text < text ==
16292 section 2
16293
16294 == text & text ==
16295 section 3
16296
16297 == text ' text ==
16298 section 4
16299
16300 == text " text ==
16301 section 5
16302 !! html
16303 <p>The tooltips shall not show entities to the user (ie. be double escaped)
16304 </p>
16305 <div id="toc" class="toc"><div id="toctitle" class="toctitle"><h2>Contents</h2></div>
16306 <ul>
16307 <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>
16308 <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>
16309 <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>
16310 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
16311 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
16312 </ul>
16313 </div>
16314
16315 <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>
16316 <p>section 1
16317 </p>
16318 <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>
16319 <p>section 2
16320 </p>
16321 <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>
16322 <p>section 3
16323 </p>
16324 <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>
16325 <p>section 4
16326 </p>
16327 <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>
16328 <p>section 5
16329 </p>
16330 !! end
16331
16332 !! test
16333 Header with space, plus and underscore as entity
16334 !! wikitext
16335 Id should not contain + for spaces
16336
16337 == Space between Text ==
16338 section 1
16339
16340 == Space-Entity&#32;between&#32;Text ==
16341 section 2
16342
16343 == Plus+between+Text ==
16344 section 3
16345
16346 == Plus-Entity&#43;between&#43;Text ==
16347 section 4
16348
16349 == Underscore_between_Text ==
16350 section 5
16351
16352 == Underscore-Entity&#95;between&#95;Text ==
16353 section 6
16354
16355 [[#Space between Text]]
16356 [[#Space-Entity&#32;between&#32;Text]]
16357 [[#Plus+between+Text]]
16358 [[#Plus-Entity&#43;between&#43;Text]]
16359 [[#Underscore_between_Text]]
16360 [[#Underscore-Entity&#95;between&#95;Text]]
16361 !! html
16362 <p>Id should not contain + for spaces
16363 </p>
16364 <div id="toc" class="toc"><div id="toctitle" class="toctitle"><h2>Contents</h2></div>
16365 <ul>
16366 <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>
16367 <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>
16368 <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>
16369 <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>
16370 <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>
16371 <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>
16372 </ul>
16373 </div>
16374
16375 <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>
16376 <p>section 1
16377 </p>
16378 <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>
16379 <p>section 2
16380 </p>
16381 <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>
16382 <p>section 3
16383 </p>
16384 <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>
16385 <p>section 4
16386 </p>
16387 <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>
16388 <p>section 5
16389 </p>
16390 <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>
16391 <p>section 6
16392 </p><p><a href="#Space_between_Text">#Space between Text</a>
16393 <a href="#Space-Entity_between_Text">#Space-Entity&#32;between&#32;Text</a>
16394 <a href="#Plus.2Bbetween.2BText">#Plus+between+Text</a>
16395 <a href="#Plus-Entity.2Bbetween.2BText">#Plus-Entity&#43;between&#43;Text</a>
16396 <a href="#Underscore_between_Text">#Underscore_between_Text</a>
16397 <a href="#Underscore-Entity_between_Text">#Underscore-Entity&#95;between&#95;Text</a>
16398 </p>
16399 !! end
16400
16401 !! test
16402 Headers with excess '=' characters
16403 (Are similar tests necessary beyond the 1st level?)
16404 !! wikitext
16405 =foo==
16406 ==foo=
16407 =''italic'' heading==
16408 ==''italic'' heading=
16409 !! html
16410 <div id="toc" class="toc"><div id="toctitle" class="toctitle"><h2>Contents</h2></div>
16411 <ul>
16412 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
16413 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
16414 <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>
16415 <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>
16416 </ul>
16417 </div>
16418
16419 <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>
16420 <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>
16421 <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>
16422 <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>
16423
16424 !! end
16425
16426 !! test
16427 HTML headers vs TOC (T25393)
16428 (__NOEDITSECTION__ for clearer output, doesn't matter here)
16429 !! wikitext
16430 <h1>Header 1</h1>
16431 == Header 1.1 ==
16432 == Header 1.2 ==
16433
16434 <h1>Header 2
16435 </h1>
16436 == Header 2.1 ==
16437 == Header 2.2 ==
16438 __NOEDITSECTION__
16439 !! html
16440 <div id="toc" class="toc"><div id="toctitle" class="toctitle"><h2>Contents</h2></div>
16441 <ul>
16442 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
16443 <ul>
16444 <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>
16445 <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>
16446 </ul>
16447 </li>
16448 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
16449 <ul>
16450 <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>
16451 <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>
16452 </ul>
16453 </li>
16454 </ul>
16455 </div>
16456
16457 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
16458 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
16459 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
16460 <h1><span class="mw-headline" id="Header_2">Header 2</span></h1>
16461 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
16462 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
16463
16464 !! end
16465
16466 !! test
16467 Single-line or multiline-comments can follow headings
16468 !! options
16469 parsoid=wt2html,wt2wt
16470 !! wikitext
16471 ==foo==<!---->
16472 ==bar==<!--c1-->
16473 ==baz==<!--
16474 c2
16475 c3-->
16476 !! html
16477 <h2><span class="mw-headline" id="foo">foo</span></h2>
16478 <h2><span class="mw-headline" id="bar">bar</span></h2>
16479 <h2><span class="mw-headline" id="baz">baz</span></h2>
16480
16481 !! end
16482
16483 !! test
16484 T3219 URL next to image (broken)
16485 !! wikitext
16486 http://example.com[[File:Foobar.jpg]]
16487 !! html/php
16488 <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>
16489 </p>
16490 !! html/parsoid
16491 <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>
16492 !!end
16493
16494 !! test
16495 T3186 news: in the middle of text
16496 !! wikitext
16497 http://en.wikinews.org/wiki/Wikinews:Workplace
16498 !! html
16499 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
16500 </p>
16501 !!end
16502
16503
16504 !! test
16505 Namespaced link must have a title
16506 !! wikitext
16507 [[Project:]]
16508 !! html
16509 <p>[[Project:]]
16510 </p>
16511 !!end
16512
16513 !! test
16514 Namespaced link must have a title (bad fragment version)
16515 !! wikitext
16516 [[Project:#fragment]]
16517 !! html
16518 <p>[[Project:#fragment]]
16519 </p>
16520 !!end
16521
16522
16523 ###
16524 ### HTML tags and HTML attributes
16525 ###
16526
16527 !! test
16528 div with no attributes
16529 !! wikitext
16530 <div>HTML rocks</div>
16531 !! html
16532 <div>HTML rocks</div>
16533
16534 !! end
16535
16536 !! test
16537 div with double-quoted attribute
16538 !! wikitext
16539 <div id="rock">HTML rocks</div>
16540 !! html
16541 <div id="rock">HTML rocks</div>
16542
16543 !! end
16544
16545 !! test
16546 div with single-quoted attribute
16547 !! wikitext
16548 <div id='rock'>HTML rocks</div>
16549 !! html
16550 <div id="rock">HTML rocks</div>
16551
16552 !! end
16553
16554 !! test
16555 div with unquoted attribute
16556 !! wikitext
16557 <div id=rock>HTML rocks</div>
16558 !! html
16559 <div id="rock">HTML rocks</div>
16560
16561 !! end
16562
16563 !! test
16564 div with illegal double attributes
16565 !! wikitext
16566 <div id="a" id="b">HTML rocks</div>
16567 !! html
16568 <div id="b">HTML rocks</div>
16569
16570 !!end
16571
16572 !! test
16573 div with empty attribute value, space before equals
16574 !! options
16575 parsoid=wt2html,html2html
16576 !! wikitext
16577 <div class =>HTML rocks</div>
16578 !! html/php
16579 <div class="">HTML rocks</div>
16580
16581 !! html/parsoid
16582 <div class="" data-parsoid='{"stx":"html"}'>HTML rocks</div>
16583 !! end
16584
16585 !! test
16586 div with multiple empty attribute values
16587 !! options
16588 parsoid=wt2html,html2html
16589 !! wikitext
16590 <div id= title=>HTML rocks</div>
16591 !! html/php
16592 <div id="title.3D">HTML rocks</div>
16593
16594 !! html/parsoid
16595 <div id="title.3D" data-parsoid='{"stx":"html"}'>HTML rocks</div>
16596 !! end
16597
16598 !! test
16599 table with multiple empty attribute values
16600 !! options
16601 parsoid=wt2html,html2html
16602 !! wikitext
16603 {| title= id=
16604 | hi
16605 |}
16606 !! html/php
16607 <table title="id=">
16608 <tr>
16609 <td> hi
16610 </td></tr></table>
16611
16612 !! html/parsoid
16613 <table title="id=">
16614 <tbody><tr><td> hi</td></tr>
16615 </tbody></table>
16616 !! end
16617
16618 !! test
16619 div with braces in attribute value
16620 !! wikitext
16621 <div title="{}">Foo</div>
16622 !! html/php
16623 <div title="&#123;&#125;">Foo</div>
16624
16625 !! html/parsoid
16626 <div title="{}">Foo</div>
16627 !! end
16628
16629 !! test
16630 div with empty attribute value, no space before equals
16631 !! options
16632 parsoid=wt2html,html2html
16633 !! wikitext
16634 <div class=>HTML rocks</div>
16635 !! html/php
16636 <div class="">HTML rocks</div>
16637
16638 !! html/parsoid
16639 <div class="">HTML rocks</div>
16640 !! end
16641
16642 !! test
16643 HTML multiple attributes correction
16644 !! wikitext
16645 <p class="error" class="awesome">Awesome!</p>
16646 !! html
16647 <p class="awesome">Awesome!</p>
16648
16649 !!end
16650
16651 !! test
16652 Table multiple attributes correction
16653 !! wikitext
16654 {|
16655 !+ class="error" class="awesome"| status
16656 |}
16657 !! html
16658 <table>
16659 <tr>
16660 <th class="awesome"> status
16661 </th></tr></table>
16662
16663 !!end
16664
16665 !! test
16666 DIV IN UPPERCASE
16667 !! wikitext
16668 <DIV ID="x">HTML ROCKS</DIV>
16669 !! html
16670 <div id="x">HTML ROCKS</div>
16671
16672 !!end
16673
16674 !! test
16675 Non-ASCII pseudo-tags are rendered as text
16676 !! wikitext
16677 <khyô>
16678 !! html
16679 <p>&lt;khyô&gt;
16680 </p>
16681 !! end
16682
16683 !! test
16684 Pseudo-tag with URL 'name' renders as url link
16685 !! wikitext
16686 <http://example.com/>
16687 !! html
16688 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
16689 </p>
16690 !! end
16691
16692 !! test
16693 text with amp in the middle of nowhere
16694 !! wikitext
16695 Remember AT&T?
16696 !! html
16697 <p>Remember AT&amp;T?
16698 </p>
16699 !! end
16700
16701 !! test
16702 text with character entity: eacute
16703 !! wikitext
16704 I always thought &eacute; was a cute letter.
16705 !! html
16706 <p>I always thought &#233; was a cute letter.
16707 </p>
16708 !! html+tidy
16709 <p>I always thought é was a cute letter.</p>
16710 !! end
16711
16712 !! test
16713 text with entity-escaped character entity-like string: eacute
16714 !! wikitext
16715 I always thought &amp;eacute; was a cute letter.
16716 !! html
16717 <p>I always thought &amp;eacute; was a cute letter.
16718 </p>
16719 !! end
16720
16721 !! test
16722 text with undefined character entity: xacute
16723 !! wikitext
16724 I always thought &xacute; was a cute letter.
16725 !! html
16726 <p>I always thought &amp;xacute; was a cute letter.
16727 </p>
16728 !! end
16729
16730 !! test
16731 HTML5 tags
16732 !! wikitext
16733 <data value="5">five</data>
16734 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
16735 <mark>This highlighted text</mark>
16736 !! html
16737 <p><data value="5">five</data>
16738 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
16739 <mark>This highlighted text</mark>
16740 </p>
16741 !! end
16742
16743 !! test
16744 HTML tag with leading space is parsed as text
16745 !! wikitext
16746 < div>foo< /div>
16747 !! html
16748 <p>&lt; div&gt;foo&lt; /div&gt;
16749 </p>
16750 !! end
16751
16752 ###
16753 ### Nesting tests (see T43545, T52604, T53081)
16754 ###
16755
16756 # This test case is fixed in Parsoid by domino 1.0.12. (T52604)
16757 # Note that html2wt is considerably more difficult if we use <b> in
16758 # the test case, instead of <small>
16759 !! test
16760 Ensure that HTML adoption agency algorithm is properly implemented.
16761 !! wikitext
16762 <small>X<small>Y</small>Z</small>
16763 !! html
16764 <p><small>X<small>Y</small>Z</small>
16765 </p>
16766 !! end
16767
16768 # This was T43545 in the PHP parser.
16769 # Note that tidy doesn't handle this correctly.
16770 !! test
16771 Nesting of <kbd>
16772 !! wikitext
16773 <kbd>X<kbd>Y</kbd>Z</kbd>
16774 !! html
16775 <p><kbd>X<kbd>Y</kbd>Z</kbd>
16776 </p>
16777 !! end
16778
16779 # The following cases were T53081 in the PHP parser.
16780 # Note that there are some other nestable tags (b, i, etc) which are
16781 # not covered; see T53081 for discussion.
16782
16783 # Note that tidy doesn't handle this correctly.
16784 !! test
16785 Nesting of <em>
16786 !! wikitext
16787 <em>X<em>Y</em>Z</em>
16788 !! html
16789 <p><em>X<em>Y</em>Z</em>
16790 </p>
16791 !! end
16792
16793 # Note that tidy doesn't handle this correctly.
16794 !! test
16795 Nesting of <strong>
16796 !! wikitext
16797 <strong>X<strong>Y</strong>Z</strong>
16798 !! html
16799 <p><strong>X<strong>Y</strong>Z</strong>
16800 </p>
16801 !! end
16802
16803 !! test
16804 Nesting of <q>
16805 !! wikitext
16806 <q>X<q>Y</q>Z</q>
16807 !! html+tidy
16808 <p><q>X<q>Y</q>Z</q></p>
16809 !! end
16810
16811 # Note that tidy doesn't handle this correctly.
16812 !! test
16813 Nesting of <ruby>
16814 !! wikitext
16815 <ruby>X<ruby>Y</ruby>Z</ruby>
16816 !! html
16817 <p><ruby>X<ruby>Y</ruby>Z</ruby>
16818 </p>
16819 !! end
16820
16821 # Note that tidy doesn't handle this correctly.
16822 !! test
16823 Nesting of <bdo>
16824 !! wikitext
16825 <bdo>X<bdo>Y</bdo>Z</bdo>
16826 !! html
16827 <p><bdo>X<bdo>Y</bdo>Z</bdo>
16828 </p>
16829 !! end
16830
16831
16832 ###
16833 ### Media links
16834 ###
16835
16836 !! test
16837 Media link
16838 !! wikitext
16839 [[Media:Foobar.jpg]]
16840 !! html/php
16841 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
16842 </p>
16843 !! html/parsoid
16844 <p><a rel="mw:MediaLink" href="//example.com/images/3/3a/Foobar.jpg" title="Foobar.jpg">Media:Foobar.jpg</a></p>
16845 !! end
16846
16847 !! test
16848 Media link with text
16849 !! wikitext
16850 [[Media:Foobar.jpg|A neat file to look at]]
16851 !! html/php
16852 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
16853 </p>
16854 !! html/parsoid
16855 <p><a rel="mw:MediaLink" href="//example.com/images/3/3a/Foobar.jpg" title="Foobar.jpg">A neat file to look at</a></p>
16856 !! end
16857
16858 # FIXME: this is still bad HTML tag nesting
16859 # FIXME: doBlockLevels won't wrap this in a paragraph because it contains a div
16860 !! test
16861 Media link with nasty text
16862 !! wikitext
16863 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
16864 !! html/php
16865 <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>
16866
16867 !! html+php/tidy
16868 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Safe Link</a></p>
16869 <div style="display:none">" onmouseover="alert(document.cookie)" onfoo="</div>
16870 !! html/parsoid
16871 <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>
16872
16873 !! end
16874
16875 !! test
16876 Media link to nonexistent file (T3702)
16877 !! wikitext
16878 [[Media:No such.jpg]]
16879 [[Media:No_such file.jpg]]
16880 !! html/php
16881 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
16882 <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>
16883 </p>
16884 !! html/parsoid
16885 <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>
16886 <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>
16887 !! end
16888
16889 !! test
16890 Image link to nonexistent file (T3850 - good)
16891 !! wikitext
16892 [[File:No_such.jpg]]
16893 !! html/php
16894 <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>
16895 </p>
16896 !! html/parsoid
16897 <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>
16898 !! end
16899
16900 !! test
16901 :Image link to nonexistent file (T3850 - bad)
16902 !! wikitext
16903 [[:Image:No such.jpg]]
16904 !! html/php
16905 <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>
16906 </p>
16907 !! html/parsoid
16908 <p><a rel="mw:WikiLink" href="./File:No_such.jpg" title="File:No such.jpg">Image:No such.jpg</a></p>
16909 !! end
16910
16911
16912
16913 !! test
16914 Character reference normalization in link text (T3938)
16915 !! wikitext
16916 [[Main Page|this&that]]
16917 !! html
16918 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
16919 </p>
16920 !!end
16921
16922 !! article
16923 אַ
16924 !! text
16925 Test for unicode normalization
16926
16927 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
16928 !! endarticle
16929
16930 !! test
16931 (T21451) Links should refer to the normalized form.
16932 !! wikitext
16933 [[&#xFB2E;]]
16934 [[&#x5d0;&#x5b7;]]
16935 [[&#x5d0;ַ]]
16936 [[א&#x5b7;]]
16937 [[אַ]]
16938 !! html
16939 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
16940 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
16941 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
16942 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
16943 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
16944 </p>
16945 !! end
16946
16947 !! test
16948 Empty attribute crash test (T4067)
16949 !! wikitext
16950 <font color="">foo</font>
16951 !! html
16952 <p><font color="">foo</font>
16953 </p>
16954 !! end
16955
16956 !! test
16957 Empty attribute crash test single-quotes (T4067)
16958 !! wikitext
16959 <font color=''>foo</font>
16960 !! html
16961 <p><font color="">foo</font>
16962 </p>
16963 !! end
16964
16965 !! test
16966 Attribute test: equals, then nothing
16967 !! options
16968 parsoid=wt2html,html2html
16969 !! wikitext
16970 <font color=>foo</font>
16971 !! html/php
16972 <p><font color="">foo</font>
16973 </p>
16974 !! html/parsoid
16975 <p><font color="" data-parsoid='{"stx":"html"}'>foo</font></p>
16976 !! end
16977
16978 !! test
16979 Attribute test: unquoted value
16980 !! options
16981 parsoid=wt2html,html2html
16982 !! wikitext
16983 <font color=x>foo</font>
16984 !! html/php
16985 <p><font color="x">foo</font>
16986 </p>
16987 !! html/parsoid
16988 <p><font color="x" data-parsoid='{"stx":"html"}'>foo</font></p>
16989 !! end
16990
16991 !! test
16992 Attribute test: unquoted but illegal value (hash)
16993 !! wikitext
16994 <font color=#x>foo</font>
16995 !! html
16996 <p><font color="#x">foo</font>
16997 </p>
16998 !! end
16999
17000 # Parsoid does not serialize to empty attribute syntax,
17001 # so wt2wt and html2wt cases are skipped
17002 !! test
17003 Attribute test: no value (T54330)
17004 !! options
17005 parsoid=wt2html,html2html
17006 !! wikitext
17007 <font color>foo</font>
17008 !! html/php
17009 <p><font color="">foo</font>
17010 </p>
17011 !! html/parsoid
17012 <p><font color="">foo</font></p>
17013 !! end
17014
17015 !! test
17016 T4095: link with three closing brackets
17017 !! wikitext
17018 [[Main Page]]]
17019 !! html/php
17020 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
17021 </p>
17022 !! html/parsoid
17023 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a>]</p>
17024 !! end
17025
17026 !! test
17027 T4095: link with pipe and three closing brackets
17028 !! wikitext
17029 [[Main Page|link]]]
17030 !! html/php
17031 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
17032 </p>
17033 !! html/parsoid
17034 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">link</a>]</p>
17035 !! end
17036
17037 !! test
17038 T4095: link with pipe and three closing brackets, version 2
17039 !! wikitext
17040 [[Main Page|[http://example.com/]]]
17041 !! html/php
17042 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
17043 </p>
17044 !! html/parsoid
17045 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">[http://example.com/]</a></p>
17046 !! end
17047
17048
17049 ###
17050 ### Safety
17051 ###
17052
17053 !! article
17054 Template:Dangerous attribute
17055 !! text
17056 " onmouseover="alert(document.cookie)
17057 !! endarticle
17058
17059 !! article
17060 Template:Dangerous style attribute
17061 !! text
17062 border-size: expression(alert(document.cookie))
17063 !! endarticle
17064
17065 !! article
17066 Template:Div style
17067 !! text
17068 <div style="float: right; {{{1}}}">Magic div</div>
17069 !! endarticle
17070
17071 !! test
17072 T4304: HTML attribute safety (safe template; regression T4309)
17073 !! wikitext
17074 <div title="{{test}}"></div>
17075 !! html/php
17076 <div title="This is a test template"></div>
17077
17078 !! html/parsoid
17079 <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>
17080 !! end
17081
17082 # Parsoid has enough context to handle this case
17083 !! test
17084 T4304: HTML attribute safety (dangerous template; 2309)
17085 !! wikitext
17086 <div title="{{dangerous attribute}}"></div>
17087 !! html/php
17088 <div title=""></div>
17089
17090 !! html/parsoid
17091 <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>
17092 !! end
17093
17094 !! test
17095 T4304: HTML attribute safety (dangerous style template; 2309)
17096 !! wikitext
17097 <div style="{{dangerous style attribute}}"></div>
17098 !! html/php
17099 <div style="/* insecure input */"></div>
17100
17101 !! html/parsoid
17102 <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>
17103 !! end
17104
17105 !! test
17106 T4304: HTML attribute safety (safe parameter; 2309)
17107 !! wikitext
17108 {{div style|width: 200px}}
17109 !! html/php
17110 <div style="float: right; width: 200px">Magic div</div>
17111
17112 !! html/parsoid
17113 <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>
17114 !! end
17115
17116 !! test
17117 T4304: HTML attribute safety (unsafe parameter; 2309)
17118 !! wikitext
17119 {{div style|width: expression(alert(document.cookie))}}
17120 !! html/php
17121 <div style="/* insecure input */">Magic div</div>
17122
17123 !! html/parsoid
17124 <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>
17125 !! end
17126
17127 ## Parsoid output here differs; needs investigation.
17128 !! test
17129 T4304: HTML attribute safety (unsafe breakout parameter; 2309)
17130 !! wikitext
17131 {{div style|"><script>alert(document.cookie)</script>}}
17132 !! html
17133 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
17134
17135 !! end
17136
17137 ## Parsoid output here differs; needs investigation.
17138 !! test
17139 T4304: HTML attribute safety (unsafe breakout parameter 2; 2309)
17140 !! wikitext
17141 {{div style|" ><script>alert(document.cookie)</script>}}
17142 !! html
17143 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
17144
17145 !! end
17146
17147 !! test
17148 T4304: HTML attribute safety (link)
17149 !! wikitext
17150 <div title="[[Main Page]]"></div>
17151 !! html
17152 <div title="&#91;&#91;Main Page]]"></div>
17153
17154 !! end
17155
17156 !! test
17157 T4304: HTML attribute safety (italics)
17158 !! wikitext
17159 <div title="''foobar''"></div>
17160 !! html
17161 <div title="&#39;&#39;foobar&#39;&#39;"></div>
17162
17163 !! end
17164
17165 !! test
17166 T4304: HTML attribute safety (bold)
17167 !! wikitext
17168 <div title="'''foobar'''"></div>
17169 !! html
17170 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
17171
17172 !! end
17173
17174 !! test
17175 T4304: HTML attribute safety (ISBN)
17176 !! wikitext
17177 <div title="ISBN 1234567890"></div>
17178 !! html
17179 <div title="&#73;SBN 1234567890"></div>
17180
17181 !! end
17182
17183 !! test
17184 T4304: HTML attribute safety (RFC)
17185 !! wikitext
17186 <div title="RFC 1234"></div>
17187 !! html
17188 <div title="&#82;FC 1234"></div>
17189
17190 !! end
17191
17192 !! test
17193 T4304: HTML attribute safety (PMID)
17194 !! wikitext
17195 <div title="PMID 1234567890"></div>
17196 !! html
17197 <div title="&#80;MID 1234567890"></div>
17198
17199 !! end
17200
17201 !! test
17202 T4304: HTML attribute safety (web link)
17203 !! wikitext
17204 <div title="http://example.com/"></div>
17205 !! html
17206 <div title="http&#58;//example.com/"></div>
17207
17208 !! end
17209
17210 !! test
17211 T4304: HTML attribute safety (named web link)
17212 !! wikitext
17213 <div title="[http://example.com/ link]"></div>
17214 !! html
17215 <div title="&#91;http&#58;//example.com/ link]"></div>
17216
17217 !! end
17218
17219 !! test
17220 T5244: HTML attribute safety (extension; safe)
17221 !! wikitext
17222 <div style="<nowiki>background:blue</nowiki>"></div>
17223 !! html/php
17224 <div style="background:blue"></div>
17225
17226 !! html/parsoid
17227 <div style="background:blue" data-parsoid='{"stx":"html","a":{"style":"background:blue"},"sa":{"style":"&lt;nowiki>background:blue&lt;/nowiki>"}}'></div>
17228 !! end
17229
17230 !! test
17231 T5244: HTML attribute safety (extension; unsafe)
17232 !! wikitext
17233 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
17234 !! html/php
17235 <div style="/* insecure input */"></div>
17236
17237 !! html/parsoid
17238 <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>
17239 !! end
17240
17241 # More MSIE fun discovered by Tom Gilder
17242
17243 !! test
17244 MSIE CSS safety test: spurious slash
17245 !! wikitext
17246 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
17247 !! html/php
17248 <div style="/* insecure input */">evil</div>
17249
17250 !! html/parsoid
17251 <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>
17252 !! end
17253
17254 !! test
17255 MSIE CSS safety test: hex code
17256 !! wikitext
17257 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
17258 !! html/php
17259 <div style="/* insecure input */">evil</div>
17260
17261 !! html/parsoid
17262 <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>
17263 !! end
17264
17265 !! test
17266 MSIE CSS safety test: comment in url
17267 !! wikitext
17268 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
17269 !! html/php
17270 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
17271
17272 !! html/parsoid
17273 <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>
17274 !! end
17275
17276 !! test
17277 MSIE CSS safety test: comment in expression
17278 !! wikitext
17279 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
17280 !! html/php
17281 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
17282
17283 !! html/parsoid
17284 <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>
17285 !! end
17286
17287 !! test
17288 CSS safety test (all browsers): vertical tab (T57332 / CVE-2013-4567)
17289 !! wikitext
17290 <p style="font-size: 100px; background-image:url\b(https://www.google.com/images/srpr/logo6w.png)">A</p>
17291 !! html/php
17292 <p style="/* invalid control char */">A</p>
17293
17294 !! html/parsoid
17295 <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>
17296 !! end
17297
17298 !! test
17299 MSIE 6 CSS safety test: Fullwidth (T57332)
17300 !! wikitext
17301 <p style="font-size: 100px; color: expression((title='XSSed'),'red')">A</p>
17302 <div style="top:EXPRESSION(alert())">B</div>
17303 !! html/php
17304 <p style="/* insecure input */">A</p>
17305 <div style="/* insecure input */">B</div>
17306
17307 !! html/parsoid
17308 <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>
17309 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"top:EXPRESSION(alert())"}}'>B</div>
17310 !! end
17311
17312 !! test
17313 MSIE 6 CSS safety test: IPA extensions (T57332)
17314 !! wikitext
17315 <div style="background-image:uʀʟ(javascript:alert())">A</div>
17316 <p style="font-size: 100px; color: expʀessɪoɴ((title='XSSed'),'red')">B</p>
17317 !! html/php
17318 <div style="/* insecure input */">A</div>
17319 <p style="/* insecure input */">B</p>
17320
17321 !! html/parsoid
17322 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"background-image:uʀʟ(javascript:alert())"}}'>A</div>
17323 <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>
17324 !! end
17325
17326 !! test
17327 MSIE 6 CSS safety test: sup/sub script (T57332)
17328 !! wikitext
17329 <div style="background-image:url⁽javascript:alert())">A</div>
17330 <div style="background-image:url₍javascript:alert())">B</div>
17331 <p style="font-size: 100px; color: expressioⁿ((title='XSSed'),'red')">C</p>
17332 !! html/php
17333 <div style="/* insecure input */">A</div>
17334 <div style="/* insecure input */">B</div>
17335 <p style="/* insecure input */">C</p>
17336
17337 !! html/parsoid
17338 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"background-image:url⁽javascript:alert())"}}'>A</div>
17339 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"background-image:url₍javascript:alert())"}}'>B</div>
17340 <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>
17341 !! end
17342
17343 !! test
17344 Opera -o-link CSS
17345 !! options
17346 parsoid=wt2html,html2html
17347 !! wikitext
17348 <div
17349 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;"
17350 style="-o-link:attr(title);-o-link-source:current">X</div>
17351 !! html/php
17352 <div title="data:text/html,&lt;img src=1 onerror=alert(1)&gt;" style="/* insecure input */">X</div>
17353
17354 !! html/parsoid
17355 <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>
17356 !! end
17357
17358 !! test
17359 MSIE 6 CSS safety test: Repetition markers (T57332)
17360 !! wikitext
17361 <p style="font-size: 100px; color: expres〱ion((title='XSSed'),'red')">A</p>
17362 <p style="font-size: 100px; color: expresゝion((title='XSSed'),'red')">B</p>
17363 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">C</p>
17364 <p style="font-size: 100px; color: expresヽion((title='XSSed'),'red')">D</p>
17365 <p style="font-size: 100px; color: expresﹽion((title='XSSed'),'red')">E</p>
17366 <p style="font-size: 100px; color: expresﹼion((title='XSSed'),'red')">F</p>
17367 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">G</p>
17368 !! html/php
17369 <p style="/* insecure input */">A</p>
17370 <p style="/* insecure input */">B</p>
17371 <p style="/* insecure input */">C</p>
17372 <p style="/* insecure input */">D</p>
17373 <p style="/* insecure input */">E</p>
17374 <p style="/* insecure input */">F</p>
17375 <p style="/* insecure input */">G</p>
17376
17377 !! html/parsoid
17378 <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>
17379 <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>
17380 <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>
17381 <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>
17382 <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>
17383 <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>
17384 <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>
17385 !! end
17386
17387 !! test
17388 Table attribute legitimate extension
17389 !! wikitext
17390 {|
17391 !+ style="<nowiki>color:blue</nowiki>"| status
17392 |}
17393 !! html
17394 <table>
17395 <tr>
17396 <th style="color:blue"> status
17397 </th></tr></table>
17398
17399 !!end
17400
17401 !! test
17402 Table attribute safety
17403 !! wikitext
17404 {|
17405 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
17406 |}
17407 !! html
17408 <table>
17409 <tr>
17410 <th style="/* insecure input */"> status
17411 </th></tr></table>
17412
17413 !! end
17414
17415 !! test
17416 CSS line continuation 1
17417 !! wikitext
17418 <div style="background-image: u\&#10;rl(test.jpg);"></div>
17419 !! html
17420 <div style="/* insecure input */"></div>
17421
17422 !! end
17423
17424 !! test
17425 CSS line continuation 2
17426 !! wikitext
17427 <div style="background-image: u\&#13;rl(test.jpg); "></div>
17428 !! html
17429 <div style="/* invalid control char */"></div>
17430
17431 !! end
17432
17433 !! article
17434 Template:Identity
17435 !! text
17436 {{{1}}}
17437 !! endarticle
17438
17439 !! test
17440 Expansion of multi-line templates in attribute values (T8255)
17441 !! wikitext
17442 <div style="background: {{identity|#00FF00}}">-</div>
17443 !! html
17444 <div style="background: #00FF00">-</div>
17445
17446 !! end
17447
17448 !! test
17449 Expansion of multi-line templates in attribute values (T8255 sanity check)
17450 !! wikitext
17451 <div style="background:
17452 #00FF00">-</div>
17453 !! html/php
17454 <div style="background: #00FF00">-</div>
17455
17456 !! html/parsoid
17457 <div style="background:
17458 #00FF00">-</div>
17459 !! end
17460
17461 !! test
17462 Expansion of multi-line templates in attribute values (T8255 sanity check 2)
17463 !! wikitext
17464 <div style="background: &#10;#00FF00">-</div>
17465 !! html
17466 <div style="background: &#10;#00FF00">-</div>
17467
17468 !! end
17469
17470 !! test
17471 Tags which are hidden from Tidy cannot pass through the Sanitizer
17472 !! wikitext
17473 <mw:toc><script>alert();</script></mw:toc>
17474 !! html+tidy
17475 <p>&lt;mw:toc&gt;&lt;script&gt;alert();&lt;/script&gt;&lt;/mw:toc&gt;</p>
17476 !! end
17477
17478 ###
17479 ### Parser hooks (see tests/parser/parserTestsParserHook.php for the <tag> extension)
17480 ###
17481
17482 !! test
17483 Parser hook: empty input
17484 !! wikitext
17485 <tag></tag>
17486 !! html/php
17487 <pre>
17488 ''
17489 array (
17490 )
17491 </pre>
17492
17493 !! html/parsoid
17494 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
17495 !! end
17496
17497 ## Don't expect parsoid to rt this form.
17498 !! test
17499 Parser hook: empty input using terminated empty elements
17500 !! options
17501 parsoid=wt2html,html2html
17502 !! wikitext
17503 <tag/>
17504 !! html/php
17505 <pre>
17506 NULL
17507 array (
17508 )
17509 </pre>
17510
17511 !! html/parsoid
17512 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":null}' data-parsoid='{}' about="#mwt2"></pre>
17513 !! end
17514
17515 !! test
17516 Parser hook: empty input using terminated empty elements (space before)
17517 !! wikitext
17518 <tag />
17519 !! html/php
17520 <pre>
17521 NULL
17522 array (
17523 )
17524 </pre>
17525
17526 !! html/parsoid
17527 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":null}' data-parsoid='{}' about="#mwt2"></pre>
17528 !! end
17529
17530 !! test
17531 Parser hook: basic input
17532 !! wikitext
17533 <tag>input</tag>
17534 !! html/php
17535 <pre>
17536 'input'
17537 array (
17538 )
17539 </pre>
17540
17541 !! html/parsoid
17542 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
17543 !! end
17544
17545 ## Don't expect parsoid to rt this form.
17546 !! test
17547 Parser hook: case insensitive
17548 !! options
17549 parsoid=wt2html,html2html
17550 !! wikitext
17551 <TAG>input</TAG>
17552 !! html/php
17553 <pre>
17554 'input'
17555 array (
17556 )
17557 </pre>
17558
17559 !! html/parsoid
17560 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
17561 !! end
17562
17563 ## Don't expect parsoid to rt this form.
17564 !! test
17565 Parser hook: case insensitive, redux
17566 !! options
17567 parsoid=wt2html,html2html
17568 !! wikitext
17569 <TaG>input</TAg>
17570 !! html/php
17571 <pre>
17572 'input'
17573 array (
17574 )
17575 </pre>
17576
17577 !! html/parsoid
17578 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
17579 !! end
17580
17581 !! test
17582 Parser hook: nested tags
17583 !! wikitext
17584 <tag><tag></tag></tag>
17585 !! html/php
17586 <pre>
17587 '<tag>'
17588 array (
17589 )
17590 </pre>&lt;/tag&gt;
17591
17592 !! html/parsoid
17593 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"&lt;tag>"}}' data-parsoid='{}' about="#mwt2"></pre>&lt;/tag>
17594 !! end
17595
17596 !! test
17597 Parser hook: basic arguments
17598 !! wikitext
17599 <tag width="200" height="100" depth="50" square=""></tag>
17600 !! html/php
17601 <pre>
17602 ''
17603 array (
17604 'width' => '200',
17605 'height' => '100',
17606 'depth' => '50',
17607 'square' => '',
17608 )
17609 </pre>
17610
17611 !! html/parsoid
17612 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
17613 !! end
17614
17615 ## Don't expect parsoid to rt this form.
17616 !! test
17617 Parser hook: basic arguments, variations
17618 !! options
17619 parsoid=wt2html,html2html
17620 !! wikitext
17621 <tag width=200 height = "100" depth = '50' square></tag>
17622 !! html/php
17623 <pre>
17624 ''
17625 array (
17626 'width' => '200',
17627 'height' => '100',
17628 'depth' => '50',
17629 'square' => '',
17630 )
17631 </pre>
17632
17633 !! html/parsoid
17634 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
17635 !! end
17636
17637 !! test
17638 Parser hook: argument containing a forward slash (T7344)
17639 !! wikitext
17640 <tag filename="/tmp/bla"></tag>
17641 !! html/php
17642 <pre>
17643 ''
17644 array (
17645 'filename' => '/tmp/bla',
17646 )
17647 </pre>
17648
17649 !! html/parsoid
17650 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"filename":"/tmp/bla"},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
17651 !! end
17652
17653 ## Don't expect parsoid to rt this form.
17654 !! test
17655 Parser hook: empty input using terminated empty elements (T4374)
17656 !! options
17657 parsoid=wt2html,html2html
17658 !! wikitext
17659 <tag foo=bar/>text
17660 !! html/php
17661 <pre>
17662 NULL
17663 array (
17664 'foo' => 'bar',
17665 )
17666 </pre>text
17667
17668 !! html/parsoid
17669 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"foo":"bar"},"body":null}' data-parsoid='{}' about="#mwt2"></pre>text
17670 !! end
17671
17672 ## </tag> should be output literally since there is no matching tag that begins it
17673 ## Don't expect parsoid to rt this form.
17674 !! test
17675 Parser hook: basic arguments using terminated empty elements (T4374)
17676 !! options
17677 parsoid=wt2html
17678 !! wikitext
17679 <tag width=200 height = "100" depth = '50' square/>
17680 other stuff
17681 </tag>
17682 !! html/php
17683 <pre>
17684 NULL
17685 array (
17686 'width' => '200',
17687 'height' => '100',
17688 'depth' => '50',
17689 'square' => '',
17690 )
17691 </pre>
17692 <p>other stuff
17693 &lt;/tag&gt;
17694 </p>
17695 !! html/parsoid
17696 <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
17697 &lt;/tag></p>
17698 !! end
17699
17700 ## Don't expect parsoid to rt this form.
17701 !! test
17702 Parser hook: Don't allow unclosed extension tags
17703 !! options
17704 parsoid=wt2html
17705 !! wikitext
17706 test <tag>123
17707
17708 this is a '''test'''
17709 !! html/php
17710 <p>test &lt;tag&gt;123
17711 </p><p>this is a <b>test</b>
17712 </p>
17713 !! html/parsoid
17714 <p>test &lt;tag>123</p>
17715
17716 <p>this is a <b>test</b></p>
17717 !! end
17718
17719 ###
17720 ### (see tests/parser/parserTestsParserHook.php for the <statictag> extension)
17721 ###
17722
17723 !! test
17724 Parser hook: static parser hook not inside a comment
17725 !! wikitext
17726 <statictag>hello, world</statictag>
17727
17728 <statictag action="flush" />
17729 !! html/php
17730 <p><br />
17731 hello, world
17732 </p>
17733 !! html/parsoid
17734 <p><span typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{},"body":{"extsrc":"hello, world"}}' data-parsoid='{}' about="#mwt2"></span></p>
17735 <p typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{"action":"flush"},"body":null}' data-parsoid='{}' about="#mwt4">hello, world</p>
17736 !! end
17737
17738 !! test
17739 Parser hook: static parser hook inside a comment
17740 !! wikitext
17741 <!-- <statictag>hello, world</statictag> -->
17742 <statictag action="flush" />
17743 !! html/php
17744 <p><br />
17745 </p>
17746 !! html/parsoid
17747 <!-- <statictag&#x3E;hello, world</statictag&#x3E; -->
17748 <p typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{"action":"flush"},"body":null}' data-parsoid='{}' about="#mwt2"></p>
17749 !! end
17750
17751 # Nested template calls; this case was broken by Parser.php rev 1.506,
17752 # since reverted.
17753
17754 !! article
17755 Template:One-parameter
17756 !! text
17757 (My parameter is: {{{1}}})
17758 !! endarticle
17759
17760 !! article
17761 Template:Map-one-parameter
17762 !! text
17763 {{{{{1}}}|{{{2}}}}}
17764 !! endarticle
17765
17766 !! test
17767 Nested template calls
17768 !! wikitext
17769 {{Map-one-parameter|One-parameter|param}}
17770 !! html
17771 <p>(My parameter is: param)
17772 </p>
17773 !! end
17774
17775
17776 ###
17777 ### Sanitizer
17778 ###
17779
17780 # HTML+Tidy effectively strips out the empty tags completely
17781 # But since Parsoid doesn't it wraps the <s></s> tags in p-tags
17782 # which Tidy would have done for the PHP parser had there been content inside it.
17783 !! test
17784 Sanitizer: Closing of open tags
17785 !! wikitext
17786 <s></s><table></table>
17787 !! html
17788 <s></s><table></table>
17789
17790 !! html/parsoid
17791 <p><s></s></p><table></table>
17792 !! end
17793
17794 !! test
17795 Sanitizer: Closing of open but not closed tags
17796 !! wikitext
17797 <s>foo
17798 !! html
17799 <p><s>foo</s>
17800 </p>
17801 !! end
17802
17803 !! test
17804 Sanitizer: Closing of closed but not open tags
17805 !! options
17806 parsoid=wt2html
17807 !! wikitext
17808 </s>
17809 !! html/php+tidy
17810 !! html/parsoid
17811 !! end
17812
17813 !! test
17814 Sanitizer: Closing of closed but not open table tags
17815 !! options
17816 parsoid=wt2html
17817 !! wikitext
17818 Table not started</td></tr></table>
17819 !! html/php+tidy
17820 <p>Table not started</p>
17821 !! html/parsoid
17822 <p>Table not started</p>
17823 !! end
17824
17825 !! test
17826 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
17827 !! wikitext
17828 <span id="æ: v">byte</span>[[#æ: v|backlink]]
17829 !! html/php
17830 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
17831 </p>
17832 !! html/parsoid
17833 <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>
17834 !! end
17835
17836 # In HTML5, the restrictions are that id must contain at least one character,
17837 # and must not contain any space characters.
17838 !! test
17839 Sanitizer: Validating the contents of the id attribute (T6515)
17840 !! options
17841 disabled
17842 !! wikitext
17843 <br id="" /><br id="a space" />
17844 !! html
17845 Something ...
17846 !! end
17847
17848 # In HTML5, id must be unique amongst all the ids in the element's home subtree.
17849 !! test
17850 Sanitizer: Validating id attribute uniqueness (T6515, T8301)
17851 !! options
17852 disabled
17853 !! wikitext
17854 <br id="foo" /><br id="foo" />
17855 !! html
17856 Something need to be done. foo-2 ?
17857 !! end
17858
17859 !! test
17860 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
17861 !! wikitext
17862 <div itemscope>
17863 <meta itemprop="hello" content="world">
17864 <meta http-equiv="refresh" content="5">
17865 <meta itemprop="hello" http-equiv="refresh" content="5">
17866 <link itemprop="hello" href="{{SERVER}}">
17867 <link rel="stylesheet" href="{{SERVER}}">
17868 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
17869 </div>
17870 !! html
17871 <div itemscope="">
17872 <p> <meta itemprop="hello" content="world" />
17873 &lt;meta http-equiv="refresh" content="5"&gt;
17874 <meta itemprop="hello" content="5" />
17875 <link itemprop="hello" href="http&#58;//example.org" />
17876 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
17877 <link itemprop="hello" href="http&#58;//example.org" />
17878 </p>
17879 </div>
17880
17881 !! end
17882
17883 !! test
17884 Language converter: output gets cut off unexpectedly (T7757)
17885 !! options
17886 language=zh
17887 !! wikitext
17888 this bit is safe: }-
17889
17890 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
17891
17892 then we get cut off here: }-
17893
17894 all additional text is vanished
17895 !! html
17896 <p>this bit is safe: }-
17897 </p><p>but if we add a conversion instance: xxx
17898 </p><p>then we get cut off here: }-
17899 </p><p>all additional text is vanished
17900 </p>
17901 !! end
17902
17903 !! test
17904 Self closed html pairs (T7487)
17905 !! wikitext
17906 <center><font id="bug" />Centered text</center>
17907 <div><font id="bug2" />In div text</div>
17908 !! html+tidy
17909 <center><font id="bug"></font>Centered text</center>
17910 <div><font id="bug2"></font>In div text</div>
17911 !! end
17912
17913 #
17914 #
17915 #
17916
17917 !! test
17918 Punctuation: nbsp before exclamation
17919 !! wikitext
17920 C'est grave !
17921 !! html
17922 <p>C'est grave&#160;!
17923 </p>
17924 !! end
17925
17926 !! test
17927 Punctuation: CSS !important (T13874)
17928 !! wikitext
17929 <div style="width:50% !important">important</div>
17930 !! html
17931 <div style="width:50% !important">important</div>
17932
17933 !!end
17934
17935 !! test
17936 Punctuation: CSS ! important (T13874; with space after)
17937 !! wikitext
17938 <div style="width:50% ! important">important</div>
17939 !! html
17940 <div style="width:50% ! important">important</div>
17941
17942 !!end
17943
17944 !! test
17945 HTML bullet list, closed tags (T7497)
17946 !! wikitext
17947 <ul>
17948 <li>One</li>
17949 <li>Two</li>
17950 </ul>
17951 !! html/php
17952 <ul>
17953 <li>One</li>
17954 <li>Two</li>
17955 </ul>
17956
17957 !! html/parsoid
17958 <ul data-parsoid='{"stx":"html"}'>
17959 <li data-parsoid='{"stx":"html"}'>One</li>
17960 <li data-parsoid='{"stx":"html"}'>Two</li>
17961 </ul>
17962
17963 !! end
17964
17965 !! test
17966 HTML bullet list, unclosed tags (T7497)
17967 !! wikitext
17968 <ul>
17969 <li>One
17970 <li>Two
17971 </ul>
17972 !! html/php+tidy
17973 <ul>
17974 <li>One</li>
17975 <li>Two</li>
17976 </ul>
17977 !! html/parsoid
17978 <ul data-parsoid='{"stx":"html"}'>
17979 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
17980 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
17981 </ul>
17982
17983 !! end
17984
17985 !! test
17986 HTML ordered list, closed tags (T7497)
17987 !! wikitext
17988 <ol>
17989 <li>One</li>
17990 <li>Two</li>
17991 </ol>
17992 !! html/php
17993 <ol>
17994 <li>One</li>
17995 <li>Two</li>
17996 </ol>
17997
17998 !! html/parsoid
17999 <ol data-parsoid='{"stx":"html"}'>
18000 <li data-parsoid='{"stx":"html"}'>One</li>
18001 <li data-parsoid='{"stx":"html"}'>Two</li>
18002 </ol>
18003
18004 !! end
18005
18006 !! test
18007 HTML ordered list, unclosed tags (T7497)
18008 !! options
18009 !! wikitext
18010 <ol>
18011 <li>One
18012 <li>Two
18013 </ol>
18014 !! html/php+tidy
18015 <ol>
18016 <li>One</li>
18017 <li>Two</li>
18018 </ol>
18019 !! html/parsoid
18020 <ol data-parsoid='{"stx":"html"}'>
18021 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
18022 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
18023 </ol>
18024
18025 !! end
18026
18027 !! test
18028 HTML nested bullet list, closed tags (T7497)
18029 !! wikitext
18030 <ul>
18031 <li>One</li>
18032 <li>Two:
18033 <ul>
18034 <li>Sub-one</li>
18035 <li>Sub-two</li>
18036 </ul>
18037 </li>
18038 </ul>
18039 !! html/php
18040 <ul>
18041 <li>One</li>
18042 <li>Two:
18043 <ul>
18044 <li>Sub-one</li>
18045 <li>Sub-two</li>
18046 </ul>
18047 </li>
18048 </ul>
18049
18050 !! html/parsoid
18051 <ul data-parsoid='{"stx":"html"}'>
18052 <li data-parsoid='{"stx":"html"}'>One</li>
18053 <li data-parsoid='{"stx":"html"}'>Two:
18054 <ul data-parsoid='{"stx":"html"}'>
18055 <li data-parsoid='{"stx":"html"}'>Sub-one</li>
18056 <li data-parsoid='{"stx":"html"}'>Sub-two</li>
18057 </ul>
18058 </li>
18059 </ul>
18060 !! end
18061
18062 !! test
18063 HTML nested bullet list, open tags (T7497)
18064 !! wikitext
18065 <ul>
18066 <li>One
18067 <li>Two:
18068 <ul>
18069 <li>Sub-one
18070 <li>Sub-two
18071 </ul>
18072 </ul>
18073 !! html/php+tidy
18074 <ul>
18075 <li>One</li>
18076 <li>Two:
18077 <ul>
18078 <li>Sub-one</li>
18079 <li>Sub-two</li>
18080 </ul>
18081 </li>
18082 </ul>
18083 !! html/parsoid
18084 <ul>
18085 <li>One
18086 </li>
18087 <li>Two:
18088 <ul>
18089 <li>Sub-one
18090 </li>
18091 <li>Sub-two
18092 </li>
18093 </ul>
18094 </li>
18095 </ul>
18096
18097 !! end
18098
18099 !! test
18100 HTML nested ordered list, closed tags (T7497)
18101 !! wikitext
18102 <ol>
18103 <li>One</li>
18104 <li>Two:
18105 <ol>
18106 <li>Sub-one</li>
18107 <li>Sub-two</li>
18108 </ol>
18109 </li>
18110 </ol>
18111 !! html
18112 <ol>
18113 <li>One</li>
18114 <li>Two:
18115 <ol>
18116 <li>Sub-one</li>
18117 <li>Sub-two</li>
18118 </ol>
18119 </li>
18120 </ol>
18121
18122 !! end
18123
18124 !! test
18125 HTML nested ordered list, open tags (T7497)
18126 !! wikitext
18127 <ol>
18128 <li>One
18129 <li>Two:
18130 <ol>
18131 <li>Sub-one
18132 <li>Sub-two
18133 </ol>
18134 </ol>
18135 !! html/php
18136 <ol>
18137 <li>One
18138 <li>Two:
18139 <ol>
18140 <li>Sub-one
18141 <li>Sub-two
18142 </ol>
18143 </ol>
18144
18145 !! html/parsoid
18146 <ol>
18147 <li>One
18148 </li>
18149 <li>Two:
18150 <ol>
18151 <li>Sub-one
18152 </li>
18153 <li>Sub-two
18154 </li>
18155 </ol>
18156 </li>
18157 </ol>
18158
18159 !! end
18160
18161 !! test
18162 HTML ordered list item with parameters oddity
18163 !! wikitext
18164 <ol><li id="fragment">One</li>
18165 </ol>
18166 !! html
18167 <ol><li id="fragment">One</li>
18168 </ol>
18169
18170 !! end
18171
18172 # parsoid doesn't explicitly mark autonumbered links, see T55505
18173 !!test
18174 T7918: autonumbering
18175 !! wikitext
18176 [http://first/] [http://second] [ftp://ftp]
18177
18178 ftp://inlineftp
18179
18180 [mailto:enclosed@mail.tld With target]
18181
18182 [mailto:enclosed@mail.tld]
18183
18184 mailto:inline@mail.tld
18185 !! html/php
18186 <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>
18187 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
18188 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
18189 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
18190 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
18191 </p>
18192 !! html/parsoid
18193 <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>
18194 <p><a rel="mw:ExtLink" href="ftp://inlineftp">ftp://inlineftp</a></p>
18195 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld">With target</a></p>
18196 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld"></a></p>
18197 <p><a rel="mw:ExtLink" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a></p>
18198 !! end
18199
18200
18201 #
18202 # Security and HTML correctness
18203 # From Nick Jenkins' fuzz testing
18204 #
18205
18206 !! test
18207 Fuzz testing: Parser13
18208 !! wikitext
18209 {|
18210 | http://a|
18211 !! html
18212 <table>
18213 <tr>
18214 <td>
18215 </td>
18216 </tr>
18217 </table>
18218
18219 !! end
18220
18221 !! test
18222 Fuzz testing: Parser14
18223 !! wikitext
18224 == onmouseover= ==
18225 http://__TOC__
18226 !! html
18227 <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>
18228 http://<div id="toc" class="toc"><div id="toctitle" class="toctitle"><h2>Contents</h2></div>
18229 <ul>
18230 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
18231 </ul>
18232 </div>
18233
18234
18235 !! html+tidy
18236 <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>
18237 <p>http://</p>
18238 <div id="toc" class="toc">
18239 <div id="toctitle" class="toctitle">
18240 <h2>Contents</h2>
18241 </div>
18242 <ul>
18243 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
18244 </ul>
18245 </div>
18246 <p></p>
18247 !! end
18248
18249 !! test
18250 Fuzz testing: Parser14-table
18251 !! options
18252 parsoid=wt2html,html2html
18253 !! wikitext
18254 ==a==
18255 {| STYLE=__TOC__
18256 !! html
18257 <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>
18258 <table style="&#95;_TOC&#95;_">
18259 <tr><td></td></tr>
18260 </table>
18261
18262 !! html+tidy
18263 <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>
18264 <table style="__TOC__">
18265 <tr>
18266 <td></td>
18267 </tr>
18268 </table>
18269 !! html/parsoid
18270 <h2>a</h2>
18271 <table style="__TOC__"></table>
18272 !! end
18273
18274 # Known to produce bogus xml (extra </td>)
18275 !! test
18276 Fuzz testing: Parser16
18277 !! wikitext
18278 {|
18279 !https://||||||
18280 !! html
18281 <table>
18282 <tr>
18283 <th>https://</th>
18284 <th></th>
18285 <th></th>
18286 <th>
18287 </td>
18288 </tr>
18289 </table>
18290
18291 !! html+tidy
18292 <table>
18293 <tr>
18294 <th>https://</th>
18295 <th></th>
18296 <th></th>
18297 <th></th>
18298 </tr>
18299 </table>
18300 !! end
18301
18302 !! test
18303 Fuzz testing: Parser21
18304 !! wikitext
18305 {|
18306 ! irc://{{ftp://a" onmouseover="alert('hello world');"
18307 |
18308 !! html
18309 <table>
18310 <tr>
18311 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
18312 </th>
18313 <td>
18314 </td>
18315 </tr>
18316 </table>
18317
18318 !! end
18319
18320 !! test
18321 Fuzz testing: Parser22
18322 !! wikitext
18323 http://===r:::https://b
18324
18325 {|
18326 !! html
18327 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
18328 </p>
18329 <table>
18330 <tr><td></td></tr>
18331 </table>
18332
18333 !! end
18334
18335 # Known to produce bad XML for now
18336 !! test
18337 Fuzz testing: Parser24
18338 !! options
18339 parsoid=wt2html
18340 !! wikitext
18341 {|
18342 {{{|
18343 <u CLASS=
18344 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
18345 <br style="onmouseover='alert(document.cookie);' " />
18346
18347 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
18348 |
18349 !! html/php
18350 <table>
18351 {{{|
18352 <u class="&#124;">}}}} &gt;
18353 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
18354
18355 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
18356 <tr>
18357 <td></u>
18358 </td>
18359 </tr>
18360 </table>
18361
18362 !! html/parsoid
18363 <p data-parsoid='{"fostered":true,"autoInsertedEnd":true}'>{{{|
18364 <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>"}'/>}}}} >
18365 <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}'>
18366
18367
18368
18369 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'></td></tr></tbody></table>
18370 !! end
18371
18372 # Note: the current result listed for this is not what the original one was,
18373 # but the original bug was JavaScript injection, which is fixed in any case.
18374 # It's not clear that the original result listed was any more correct than the
18375 # current one. Original result:
18376 # <p>{{{|
18377 # </p>
18378 # <li class="&#124;&#124;">
18379 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
18380 !!test
18381 Fuzz testing: Parser25 (T8055)
18382 !! wikitext
18383 {{{
18384 |
18385 <LI CLASS=||
18386 >
18387 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
18388 !! html/php
18389 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
18390 </p>
18391 !! html/parsoid
18392 <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"]}'>
18393 </span><p about="#mwt1">&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b></p>
18394 !! end
18395
18396 !!test
18397 Fuzz testing: URL adjacent extension (with space, clean)
18398 !! wikitext
18399 http://example.com <nowiki>junk</nowiki>
18400 !! html/php
18401 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
18402 </p>
18403 !! html/parsoid
18404 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a> <span typeof="mw:Nowiki">junk</span></p>
18405 !! end
18406
18407 !!test
18408 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
18409 !! wikitext
18410 http://example.com<nowiki>junk</nowiki>
18411 !! html/php
18412 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
18413 </p>
18414 !! html/parsoid
18415 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a><span typeof="mw:Nowiki">junk</span></p>
18416 !! end
18417
18418 !! test
18419 Fuzz testing: URL adjacent extension (no space, dirty; pre)
18420 !! wikitext
18421 http://example.com<pre>junk</pre>
18422 !! html/php
18423 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
18424
18425 !! html/php+tidy
18426 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></p>
18427 <pre>
18428 junk
18429 </pre>
18430 !! html/parsoid
18431 <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>
18432 !! end
18433
18434 !! test
18435 Fuzz testing: image with bogus manual thumbnail
18436 !! wikitext
18437 [[Image:foobar.jpg|thumbnail= ]]
18438 !! html/php
18439 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
18440
18441 !! html/parsoid
18442 <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>
18443 !! end
18444
18445 !! test
18446 Fuzz testing: encoded newline in generated HTML replacements (T8577)
18447 !! wikitext
18448 <pre dir="&#10;"></pre>
18449 !! html/php
18450 <pre dir="&#10;"></pre>
18451
18452 !! html/parsoid
18453 <pre typeof="mw:Extension/pre" about="#mwt2" dir="&amp;#10;" data-mw='{"name":"pre","attrs":{"dir":"&amp;#10;"},"body":{"extsrc":""}}'></pre>
18454 !! end
18455
18456 !! test
18457 Parsing optional HTML elements (T8171)
18458 !! options
18459 !! wikitext
18460 <table>
18461 <tr>
18462 <td> Some tabular data</td>
18463 <td> More tabular data ...
18464 <td> And yet som tabular data</td>
18465 </tr>
18466 </table>
18467 !! html
18468 <table>
18469 <tr>
18470 <td> Some tabular data</td>
18471 <td> More tabular data ...
18472 </td><td> And yet som tabular data</td>
18473 </tr>
18474 </table>
18475
18476 !! end
18477
18478 !! test
18479 Correct handling of <td>, <tr> (T8171)
18480 !! options
18481 !! wikitext
18482 <table>
18483 <tr>
18484 <td> Some tabular data</td>
18485 <td> More tabular data ...</td>
18486 <td> And yet som tabular data</td>
18487 </tr>
18488 </table>
18489 !! html
18490 <table>
18491 <tr>
18492 <td> Some tabular data</td>
18493 <td> More tabular data ...</td>
18494 <td> And yet som tabular data</td>
18495 </tr>
18496 </table>
18497
18498 !! end
18499
18500
18501 !! test
18502 Parsing crashing regression (fr:JavaScript)
18503 !! wikitext
18504 </body></x>
18505 !! html
18506 <p>&lt;/body&gt;&lt;/x&gt;
18507 </p>
18508 !! end
18509
18510 !! test
18511 Inline wiki vs wiki block nesting
18512 !! wikitext
18513 '''Bold paragraph
18514
18515 New wiki paragraph
18516 !! html
18517 <p><b>Bold paragraph</b>
18518 </p><p>New wiki paragraph
18519 </p>
18520 !! end
18521
18522 # FIXME: The current php output is documented
18523 # and desired output is the parsoid target.
18524 !! test
18525 Inline HTML vs wiki block nesting
18526 !! wikitext
18527 <b>Bold paragraph
18528
18529 New wiki paragraph
18530 !! html/php
18531 <p><b>Bold paragraph
18532 </p><p>New wiki paragraph</b>
18533 </p>
18534 !! html/parsoid
18535 <p><b>Bold paragraph</b>
18536 </p><p>New wiki paragraph
18537 </p>
18538 !! end
18539
18540 # Original result was this:
18541 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
18542 # </p>
18543 # While that might be marginally more intuitive, maybe, the six-apostrophe
18544 # construct is clearly pathological and the result stated here (which is what
18545 # the parser actually does) is about as reasonable as anything.
18546 !!test
18547 Mixing markup for italics and bold
18548 !! options
18549 !! wikitext
18550 '''bold''''''bold''bolditalics'''''
18551 !! html
18552 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
18553 </p>
18554 !! end
18555
18556
18557 !! article
18558 Xyzzyx
18559 !! text
18560 Article for special page transclusion test
18561 !! endarticle
18562
18563 !! test
18564 Special page transclusion
18565 !! options
18566 !! wikitext
18567 {{Special:Prefixindex/Xyzzyx}}
18568 !! html
18569 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
18570 </ul>
18571
18572 !! end
18573
18574 !! test
18575 Special page transclusion twice (T7021)
18576 !! options
18577 !! wikitext
18578 {{Special:Prefixindex/Xyzzyx}}
18579 {{Special:Prefixindex/Xyzzyx}}
18580 !! html
18581 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
18582 </ul>
18583 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
18584 </ul>
18585
18586 !! end
18587
18588 !! test
18589 Transclusion of default MediaWiki message
18590 !! wikitext
18591 {{MediaWiki:Mainpage}}
18592 !! html
18593 <p>Main Page
18594 </p>
18595 !! end
18596
18597 !! test
18598 Transclusion of nonexistent MediaWiki message
18599 !! wikitext
18600 {{MediaWiki:Mainpagexxx}}
18601 !! html
18602 <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>
18603 </p>
18604 !! end
18605
18606 !! test
18607 Transclusion of MediaWiki message with underscore
18608 !! wikitext
18609 {{MediaWiki:history_short}}
18610 !! html
18611 <p>History
18612 </p>
18613 !! end
18614
18615 !! test
18616 Transclusion of MediaWiki message with space
18617 !! wikitext
18618 {{MediaWiki:history short}}
18619 !! html
18620 <p>History
18621 </p>
18622 !! end
18623
18624 !! test
18625 Invalid header with following text
18626 !! wikitext
18627 = x = y
18628 !! html
18629 <p>= x = y
18630 </p>
18631 !! end
18632
18633
18634 !! test
18635 Section extraction test (section 0)
18636 !! options
18637 section=0
18638 !! wikitext
18639 start
18640 ==a==
18641 ===aa===
18642 ====aaa====
18643 ==b==
18644 ===ba===
18645 ===bb===
18646 ====bba====
18647 ===bc===
18648 ==c==
18649 ===ca===
18650 !! html/php
18651 start
18652 !! end
18653
18654 !! test
18655 Section extraction test (section 1)
18656 !! options
18657 section=1
18658 !! wikitext
18659 start
18660 ==a==
18661 ===aa===
18662 ====aaa====
18663 ==b==
18664 ===ba===
18665 ===bb===
18666 ====bba====
18667 ===bc===
18668 ==c==
18669 ===ca===
18670 !! html/php
18671 ==a==
18672 ===aa===
18673 ====aaa====
18674 !! end
18675
18676 !! test
18677 Section extraction test (section 2)
18678 !! options
18679 section=2
18680 !! wikitext
18681 start
18682 ==a==
18683 ===aa===
18684 ====aaa====
18685 ==b==
18686 ===ba===
18687 ===bb===
18688 ====bba====
18689 ===bc===
18690 ==c==
18691 ===ca===
18692 !! html/php
18693 ===aa===
18694 ====aaa====
18695 !! end
18696
18697 !! test
18698 Section extraction test (section 3)
18699 !! options
18700 section=3
18701 !! wikitext
18702 start
18703 ==a==
18704 ===aa===
18705 ====aaa====
18706 ==b==
18707 ===ba===
18708 ===bb===
18709 ====bba====
18710 ===bc===
18711 ==c==
18712 ===ca===
18713 !! html/php
18714 ====aaa====
18715 !! end
18716
18717 !! test
18718 Section extraction test (section 4)
18719 !! options
18720 section=4
18721 !! wikitext
18722 start
18723 ==a==
18724 ===aa===
18725 ====aaa====
18726 ==b==
18727 ===ba===
18728 ===bb===
18729 ====bba====
18730 ===bc===
18731 ==c==
18732 ===ca===
18733 !! html/php
18734 ==b==
18735 ===ba===
18736 ===bb===
18737 ====bba====
18738 ===bc===
18739 !! end
18740
18741 !! test
18742 Section extraction test (section 5)
18743 !! options
18744 section=5
18745 !! wikitext
18746 start
18747 ==a==
18748 ===aa===
18749 ====aaa====
18750 ==b==
18751 ===ba===
18752 ===bb===
18753 ====bba====
18754 ===bc===
18755 ==c==
18756 ===ca===
18757 !! html/php
18758 ===ba===
18759 !! end
18760
18761 !! test
18762 Section extraction test (section 6)
18763 !! options
18764 section=6
18765 !! wikitext
18766 start
18767 ==a==
18768 ===aa===
18769 ====aaa====
18770 ==b==
18771 ===ba===
18772 ===bb===
18773 ====bba====
18774 ===bc===
18775 ==c==
18776 ===ca===
18777 !! html/php
18778 ===bb===
18779 ====bba====
18780 !! end
18781
18782 !! test
18783 Section extraction test (section 7)
18784 !! options
18785 section=7
18786 !! wikitext
18787 start
18788 ==a==
18789 ===aa===
18790 ====aaa====
18791 ==b==
18792 ===ba===
18793 ===bb===
18794 ====bba====
18795 ===bc===
18796 ==c==
18797 ===ca===
18798 !! html/php
18799 ====bba====
18800 !! end
18801
18802 !! test
18803 Section extraction test (section 8)
18804 !! options
18805 section=8
18806 !! wikitext
18807 start
18808 ==a==
18809 ===aa===
18810 ====aaa====
18811 ==b==
18812 ===ba===
18813 ===bb===
18814 ====bba====
18815 ===bc===
18816 ==c==
18817 ===ca===
18818 !! html/php
18819 ===bc===
18820 !! end
18821
18822 !! test
18823 Section extraction test (section 9)
18824 !! options
18825 section=9
18826 !! wikitext
18827 start
18828 ==a==
18829 ===aa===
18830 ====aaa====
18831 ==b==
18832 ===ba===
18833 ===bb===
18834 ====bba====
18835 ===bc===
18836 ==c==
18837 ===ca===
18838 !! html/php
18839 ==c==
18840 ===ca===
18841 !! end
18842
18843 !! test
18844 Section extraction test (section 10)
18845 !! options
18846 section=10
18847 !! wikitext
18848 start
18849 ==a==
18850 ===aa===
18851 ====aaa====
18852 ==b==
18853 ===ba===
18854 ===bb===
18855 ====bba====
18856 ===bc===
18857 ==c==
18858 ===ca===
18859 !! html/php
18860 ===ca===
18861 !! end
18862
18863 !! test
18864 Section extraction test (nonexistent section 11)
18865 !! options
18866 section=11
18867 !! wikitext
18868 start
18869 ==a==
18870 ===aa===
18871 ====aaa====
18872 ==b==
18873 ===ba===
18874 ===bb===
18875 ====bba====
18876 ===bc===
18877 ==c==
18878 ===ca===
18879 !! html/php
18880 !! end
18881
18882 !! test
18883 Section extraction test with bogus heading (section 1)
18884 !! options
18885 section=1
18886 !! wikitext
18887 ==a==
18888 ==bogus== not a legal section
18889 ==b==
18890 !! html/php
18891 ==a==
18892 ==bogus== not a legal section
18893 !! end
18894
18895 !! test
18896 Section extraction test with bogus heading (section 2)
18897 !! options
18898 section=2
18899 !! wikitext
18900 ==a==
18901 ==bogus== not a legal section
18902 ==b==
18903 !! html/php
18904 ==b==
18905 !! end
18906
18907 !! test
18908 Section extraction test with comment after heading (section 1)
18909 !! options
18910 section=1
18911 !! wikitext
18912 ==a==
18913 ==b== <!-- -->
18914 ==c==
18915 !! html/php
18916 ==a==
18917 !! end
18918
18919 !! test
18920 Section extraction test with comment after heading (section 2)
18921 !! options
18922 section=2
18923 !! wikitext
18924 ==a==
18925 ==b== <!-- -->
18926 ==c==
18927 !! html/php
18928 ==b== <!-- -->
18929 !! end
18930
18931 !! test
18932 Section extraction test with bogus <nowiki> heading (section 1)
18933 !! options
18934 section=1
18935 !! wikitext
18936 ==a==
18937 ==bogus== <nowiki>not a legal section</nowiki>
18938 ==b==
18939 !! html/php
18940 ==a==
18941 ==bogus== <nowiki>not a legal section</nowiki>
18942 !! end
18943
18944 !! test
18945 Section extraction test with bogus <nowiki> heading (section 2)
18946 !! options
18947 section=2
18948 !! wikitext
18949 ==a==
18950 ==bogus== <nowiki>not a legal section</nowiki>
18951 ==b==
18952 !! html/php
18953 ==b==
18954 !! end
18955
18956 # Formerly testing for T4587, now resolved by the use of unmarked sections
18957 # instead of respecting commented sections
18958 !! test
18959 Section extraction prefixed by comment (section 1)
18960 !! options
18961 section=1
18962 !! wikitext
18963 <!-- -->==sec1==
18964 ==sec2==
18965 !! html/php
18966 ==sec2==
18967 !!end
18968
18969 !! test
18970 Section extraction prefixed by comment (section 2)
18971 !! options
18972 section=2
18973 !! wikitext
18974 <!-- -->==sec1==
18975 ==sec2==
18976 !! html/php
18977
18978 !!end
18979
18980 # Formerly testing for T4607, now resolved by the use of unmarked sections
18981 # instead of respecting HTML-style headings
18982 !! test
18983 Section extraction, mixed wiki and html (section 1)
18984 !! options
18985 section=1
18986 !! wikitext
18987 <h2>unmarked</h2>
18988 unmarked
18989 ==1==
18990 one
18991 ==2==
18992 two
18993 !! html/php
18994 ==1==
18995 one
18996 !! end
18997
18998 !! test
18999 Section extraction, mixed wiki and html (section 2)
19000 !! options
19001 section=2
19002 !! wikitext
19003 <h2>unmarked</h2>
19004 unmarked
19005 ==1==
19006 one
19007 ==2==
19008 two
19009 !! html/php
19010 ==2==
19011 two
19012 !! end
19013
19014
19015 # Formerly testing for T5342
19016 !! test
19017 Section extraction, heading surrounded by <noinclude>
19018 !! options
19019 section=1
19020 !! wikitext
19021 <noinclude>==unmarked==</noinclude>
19022 ==marked==
19023 !! html/php
19024 ==marked==
19025 !!end
19026
19027 # Test behavior of T21910
19028 !! test
19029 Sectiion with all-equals
19030 !! options
19031 section=2
19032 !! wikitext
19033 ===
19034 The line above must have a trailing space
19035 === <!--
19036 --> <!-- -->
19037 But just in case it doesn't...
19038 !! html/php
19039 === <!--
19040 --> <!-- -->
19041 But just in case it doesn't...
19042 !! end
19043
19044 !! test
19045 Section replacement test (section 0)
19046 !! options
19047 replace=0,"xxx"
19048 !! wikitext
19049 start
19050 ==a==
19051 ===aa===
19052 ====aaa====
19053 ==b==
19054 ===ba===
19055 ===bb===
19056 ====bba====
19057 ===bc===
19058 ==c==
19059 ===ca===
19060 !! html/php
19061 xxx
19062
19063 ==a==
19064 ===aa===
19065 ====aaa====
19066 ==b==
19067 ===ba===
19068 ===bb===
19069 ====bba====
19070 ===bc===
19071 ==c==
19072 ===ca===
19073 !! end
19074
19075 !! test
19076 Section replacement test (section 1)
19077 !! options
19078 replace=1,"xxx"
19079 !! wikitext
19080 start
19081 ==a==
19082 ===aa===
19083 ====aaa====
19084 ==b==
19085 ===ba===
19086 ===bb===
19087 ====bba====
19088 ===bc===
19089 ==c==
19090 ===ca===
19091 !! html/php
19092 start
19093 xxx
19094
19095 ==b==
19096 ===ba===
19097 ===bb===
19098 ====bba====
19099 ===bc===
19100 ==c==
19101 ===ca===
19102 !! end
19103
19104 !! test
19105 Section replacement test (section 2)
19106 !! options
19107 replace=2,"xxx"
19108 !! wikitext
19109 start
19110 ==a==
19111 ===aa===
19112 ====aaa====
19113 ==b==
19114 ===ba===
19115 ===bb===
19116 ====bba====
19117 ===bc===
19118 ==c==
19119 ===ca===
19120 !! html/php
19121 start
19122 ==a==
19123 xxx
19124
19125 ==b==
19126 ===ba===
19127 ===bb===
19128 ====bba====
19129 ===bc===
19130 ==c==
19131 ===ca===
19132 !! end
19133
19134 !! test
19135 Section replacement test (section 3)
19136 !! options
19137 replace=3,"xxx"
19138 !! wikitext
19139 start
19140 ==a==
19141 ===aa===
19142 ====aaa====
19143 ==b==
19144 ===ba===
19145 ===bb===
19146 ====bba====
19147 ===bc===
19148 ==c==
19149 ===ca===
19150 !! html/php
19151 start
19152 ==a==
19153 ===aa===
19154 xxx
19155
19156 ==b==
19157 ===ba===
19158 ===bb===
19159 ====bba====
19160 ===bc===
19161 ==c==
19162 ===ca===
19163 !! end
19164
19165 !! test
19166 Section replacement test (section 4)
19167 !! options
19168 replace=4,"xxx"
19169 !! wikitext
19170 start
19171 ==a==
19172 ===aa===
19173 ====aaa====
19174 ==b==
19175 ===ba===
19176 ===bb===
19177 ====bba====
19178 ===bc===
19179 ==c==
19180 ===ca===
19181 !! html/php
19182 start
19183 ==a==
19184 ===aa===
19185 ====aaa====
19186 xxx
19187
19188 ==c==
19189 ===ca===
19190 !! end
19191
19192 !! test
19193 Section replacement test (section 5)
19194 !! options
19195 replace=5,"xxx"
19196 !! wikitext
19197 start
19198 ==a==
19199 ===aa===
19200 ====aaa====
19201 ==b==
19202 ===ba===
19203 ===bb===
19204 ====bba====
19205 ===bc===
19206 ==c==
19207 ===ca===
19208 !! html/php
19209 start
19210 ==a==
19211 ===aa===
19212 ====aaa====
19213 ==b==
19214 xxx
19215
19216 ===bb===
19217 ====bba====
19218 ===bc===
19219 ==c==
19220 ===ca===
19221 !! end
19222
19223 !! test
19224 Section replacement test (section 6)
19225 !! options
19226 replace=6,"xxx"
19227 !! wikitext
19228 start
19229 ==a==
19230 ===aa===
19231 ====aaa====
19232 ==b==
19233 ===ba===
19234 ===bb===
19235 ====bba====
19236 ===bc===
19237 ==c==
19238 ===ca===
19239 !! html/php
19240 start
19241 ==a==
19242 ===aa===
19243 ====aaa====
19244 ==b==
19245 ===ba===
19246 xxx
19247
19248 ===bc===
19249 ==c==
19250 ===ca===
19251 !! end
19252
19253 !! test
19254 Section replacement test (section 7)
19255 !! options
19256 replace=7,"xxx"
19257 !! wikitext
19258 start
19259 ==a==
19260 ===aa===
19261 ====aaa====
19262 ==b==
19263 ===ba===
19264 ===bb===
19265 ====bba====
19266 ===bc===
19267 ==c==
19268 ===ca===
19269 !! html/php
19270 start
19271 ==a==
19272 ===aa===
19273 ====aaa====
19274 ==b==
19275 ===ba===
19276 ===bb===
19277 xxx
19278
19279 ===bc===
19280 ==c==
19281 ===ca===
19282 !! end
19283
19284 !! test
19285 Section replacement test (section 8)
19286 !! options
19287 replace=8,"xxx"
19288 !! wikitext
19289 start
19290 ==a==
19291 ===aa===
19292 ====aaa====
19293 ==b==
19294 ===ba===
19295 ===bb===
19296 ====bba====
19297 ===bc===
19298 ==c==
19299 ===ca===
19300 !! html/php
19301 start
19302 ==a==
19303 ===aa===
19304 ====aaa====
19305 ==b==
19306 ===ba===
19307 ===bb===
19308 ====bba====
19309 xxx
19310
19311 ==c==
19312 ===ca===
19313 !!end
19314
19315 !! test
19316 Section replacement test (section 9)
19317 !! options
19318 replace=9,"xxx"
19319 !! wikitext
19320 start
19321 ==a==
19322 ===aa===
19323 ====aaa====
19324 ==b==
19325 ===ba===
19326 ===bb===
19327 ====bba====
19328 ===bc===
19329 ==c==
19330 ===ca===
19331 !! html/php
19332 start
19333 ==a==
19334 ===aa===
19335 ====aaa====
19336 ==b==
19337 ===ba===
19338 ===bb===
19339 ====bba====
19340 ===bc===
19341 xxx
19342 !! end
19343
19344 !! test
19345 Section replacement test (section 10)
19346 !! options
19347 replace=10,"xxx"
19348 !! wikitext
19349 start
19350 ==a==
19351 ===aa===
19352 ====aaa====
19353 ==b==
19354 ===ba===
19355 ===bb===
19356 ====bba====
19357 ===bc===
19358 ==c==
19359 ===ca===
19360 !! html/php
19361 start
19362 ==a==
19363 ===aa===
19364 ====aaa====
19365 ==b==
19366 ===ba===
19367 ===bb===
19368 ====bba====
19369 ===bc===
19370 ==c==
19371 xxx
19372 !! end
19373
19374 !! test
19375 Section replacement test with initial whitespace (T15728)
19376 !! options
19377 replace=2,"xxx"
19378 !! wikitext
19379 Preformatted initial line
19380 ==a==
19381 ===a===
19382 !! html/php
19383 Preformatted initial line
19384 ==a==
19385 xxx
19386 !! end
19387
19388
19389 !! test
19390 Section extraction, heading followed by pre with 20 spaces (T8398)
19391 !! options
19392 section=1
19393 !! wikitext
19394 ==a==
19395 a
19396 !! html/php
19397 ==a==
19398 a
19399 !! end
19400
19401 !! test
19402 Section extraction, heading followed by pre with 19 spaces (T8398 sanity check)
19403 !! options
19404 section=1
19405 !! wikitext
19406 ==a==
19407 a
19408 !! html/php
19409 ==a==
19410 a
19411 !! end
19412
19413
19414 !! test
19415 Section extraction, <pre> around bogus header (T12309)
19416 !! options
19417 section=2
19418 !! wikitext
19419 == Section One ==
19420 <pre>
19421 =======
19422 </pre>
19423
19424 == Section Two ==
19425 stuff
19426 !! html/php
19427 == Section Two ==
19428 stuff
19429 !! end
19430
19431 !! test
19432 Section replacement, <pre> around bogus header (T12309)
19433 !! options
19434 replace=2,"xxx"
19435 !! wikitext
19436 == Section One ==
19437 <pre>
19438 =======
19439 </pre>
19440
19441 == Section Two ==
19442 stuff
19443 !! html/php
19444 == Section One ==
19445 <pre>
19446 =======
19447 </pre>
19448
19449 xxx
19450 !! end
19451
19452 !! test
19453 Handling of &#x0A; in URLs
19454 !! wikitext
19455 ** irc://&#x0A;a
19456 !! html/php
19457 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
19458
19459 !! html/parsoid
19460 <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>
19461 !! end
19462
19463 !! test
19464 Handling of %0A in URLs
19465 !! wikitext
19466 ** irc://%0Aa
19467 !! html/php
19468 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
19469
19470 !! html/parsoid
19471 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
19472 !! end
19473
19474 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
19475 !! test
19476 5 quotes, code coverage +1 line
19477 !! options
19478 parsoid=wt2html
19479 !! wikitext
19480 '''''
19481 !! html/php
19482 !! html/parsoid
19483 <p><b><i></i></b></p>
19484 !! end
19485
19486 # same html as previous, but wikitext adjusted to match parsoid html2wt
19487 # note that wt2html and html2html will put the <i> before the <b>
19488 !! test
19489 5 quotes, code coverage +1 line w/ nowiki (1)
19490 !! options
19491 parsoid=wt2wt,html2wt
19492 !! wikitext
19493 '''''<nowiki/>'''''
19494 !! html/php
19495 <p><i></i>
19496 </p>
19497 !! html/parsoid
19498 <p><b><i></i></b></p>
19499 !! end
19500
19501 # same as previous, just swapping the <i> and <b>
19502 !! test
19503 5 quotes, code coverage +1 line w/ nowiki (2)
19504 !! wikitext
19505 '''''<nowiki/>'''''
19506 !! html/php
19507 <p><i></i>
19508 </p>
19509 !! html/parsoid
19510 <p><i><b></b></i></p>
19511 !! end
19512
19513 !! test
19514 Special:Search page linking.
19515 !! wikitext
19516 {{Special:search}}
19517 !! html
19518 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
19519 </p>
19520 !! end
19521
19522 !! test
19523 {{!}} is a magic word
19524 !! wikitext
19525 {{!}} is a magic word there and {{!}} is still a magic word here
19526 | is not a magic word here but {{!}} is still a magic word here
19527 !! html/php
19528 <p>| is a magic word there and | is still a magic word here
19529 | is not a magic word here but | is still a magic word here
19530 </p>
19531 !! html/parsoid
19532 <p><span about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"!","href":"./Template:!"},"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":"!","href":"./Template:!"},"params":{},"i":0}}]}'>|</span> is still a magic word here
19533 | is not a magic word here but <span about="#mwt3" typeof="mw:Transclusion" data-parsoid='{"pi":[[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"!","href":"./Template:!"},"params":{},"i":0}}]}'>|</span> is still a magic word here</p>
19534
19535 !! end
19536
19537 !! test
19538 Say the magic word
19539 !! options
19540 title=[[Parser test]]
19541 !! wikitext
19542 * {{PAGENAME}}
19543 * {{PAGENAMEE}}
19544 * {{FULLPAGENAME}}
19545 * {{FULLPAGENAMEE}}
19546 * {{BASEPAGENAME}}
19547 * {{BASEPAGENAMEE}}
19548 * {{SUBPAGENAME}}
19549 * {{SUBPAGENAMEE}}
19550 * {{ROOTPAGENAME}}
19551 * {{ROOTPAGENAMEE}}
19552 * {{TALKPAGENAME}}
19553 * {{TALKPAGENAMEE}}
19554 * {{SUBJECTPAGENAME}}
19555 * {{SUBJECTPAGENAMEE}}
19556 * {{NAMESPACEE}}
19557 * {{NAMESPACE}}
19558 * {{NAMESPACENUMBER}}
19559 * {{TALKSPACE}}
19560 * {{TALKSPACEE}}
19561 * {{SUBJECTSPACE}}
19562 * {{SUBJECTSPACEE}}
19563 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
19564 !! html
19565 <ul><li> Parser test</li>
19566 <li> Parser_test</li>
19567 <li> Parser test</li>
19568 <li> Parser_test</li>
19569 <li> Parser test</li>
19570 <li> Parser_test</li>
19571 <li> Parser test</li>
19572 <li> Parser_test</li>
19573 <li> Parser test</li>
19574 <li> Parser_test</li>
19575 <li> Talk:Parser test</li>
19576 <li> Talk:Parser_test</li>
19577 <li> Parser test</li>
19578 <li> Parser_test</li>
19579 <li> </li>
19580 <li> </li>
19581 <li> 0</li>
19582 <li> Talk</li>
19583 <li> Talk</li>
19584 <li> </li>
19585 <li> </li>
19586 <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>
19587
19588 !! end
19589 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
19590
19591 !! test
19592 Gallery with valid attributes
19593 !! wikitext
19594 <gallery type="123" summary="345">
19595 File:File:Foobar.jpg
19596 </gallery>
19597 !! html/php
19598 <ul class="gallery mw-gallery-traditional" type="123">
19599 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19600 <div class="thumb" style="height: 150px;">File:Foobar.jpg</div>
19601 <div class="gallerytext">
19602 </div>
19603 </div></li>
19604 </ul>
19605
19606 !! html/parsoid
19607 <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"}}'>
19608 <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>
19609 </ul>
19610 !! end
19611
19612 ## Parsoid thinks the "centre" here is a property, not a caption.
19613 !! test
19614 Gallery
19615 !! options
19616 parsoid={
19617 "modes": ["wt2html"],
19618 "nativeGallery": true
19619 }
19620 !! wikitext
19621 <gallery>
19622 image1.png |
19623 image2.gif|||||
19624
19625 image3|
19626 image4 |300px| centre
19627 image5.svg| http://///////
19628 [[x|xx]]]]
19629 * image6
19630 </gallery>
19631 !! html/php
19632 <ul class="gallery mw-gallery-traditional">
19633 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19634 <div class="thumb" style="height: 150px;">Image1.png</div>
19635 <div class="gallerytext">
19636 </div>
19637 </div></li>
19638 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19639 <div class="thumb" style="height: 150px;">Image2.gif</div>
19640 <div class="gallerytext">
19641 </div>
19642 </div></li>
19643 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19644 <div class="thumb" style="height: 150px;">Image3</div>
19645 <div class="gallerytext">
19646 </div>
19647 </div></li>
19648 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19649 <div class="thumb" style="height: 150px;">Image4</div>
19650 <div class="gallerytext">
19651 <pre>centre
19652 </pre>
19653 </div>
19654 </div></li>
19655 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19656 <div class="thumb" style="height: 150px;">Image5.svg</div>
19657 <div class="gallerytext">
19658 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
19659 </p>
19660 </div>
19661 </div></li>
19662 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19663 <div class="thumb" style="height: 150px;">* image6</div>
19664 <div class="gallerytext">
19665 </div>
19666 </div></li>
19667 </ul>
19668
19669 !! html/parsoid
19670 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt3" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
19671 <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>
19672 <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>
19673 <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>
19674 <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>
19675 <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>
19676 <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>
19677 </ul>
19678 !! end
19679
19680 !! test
19681 Gallery (with options, html)
19682 !! options
19683 parsoid={
19684 "modes": ["wt2html", "html2html"],
19685 "nativeGallery": true
19686 }
19687 !! wikitext
19688 <gallery widths="70px" heights="40px" perrow="2" caption="Foo [[Main Page]]">
19689 File:Nonexistent.jpg|caption
19690 File:Nonexistent.jpg
19691 image:foobar.jpg|some '''caption''' [[Main Page]]
19692 image:foobar.jpg
19693 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
19694 </gallery>
19695 !! html/php
19696 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
19697 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
19698 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19699 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
19700 <div class="gallerytext">
19701 <p>caption
19702 </p>
19703 </div>
19704 </div></li>
19705 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19706 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
19707 <div class="gallerytext">
19708 </div>
19709 </div></li>
19710 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19711 <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>
19712 <div class="gallerytext">
19713 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
19714 </p>
19715 </div>
19716 </div></li>
19717 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19718 <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>
19719 <div class="gallerytext">
19720 </div>
19721 </div></li>
19722 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19723 <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>
19724 <div class="gallerytext">
19725 <p>blabla.
19726 </p>
19727 </div>
19728 </div></li>
19729 </ul>
19730
19731 !! html/parsoid
19732 <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":{}}'>
19733 <li class="gallerycaption">Foo <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a></li>
19734 <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>
19735 <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>
19736 <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>
19737 <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>
19738 <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>
19739 </ul>
19740 !! end
19741
19742 !! test
19743 Gallery (with options, extsrc)
19744 !! options
19745 parsoid={
19746 "nativeGallery": false
19747 }
19748 !! wikitext
19749 <gallery widths="70px" heights="40px" perrow="2" caption="Foo [[Main Page]]">
19750 File:Nonexistent.jpg|caption
19751 File:Nonexistent.jpg
19752 image:foobar.jpg|some '''caption''' [[Main Page]]
19753 image:foobar.jpg
19754 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
19755 </gallery>
19756 !! html/php
19757 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
19758 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
19759 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19760 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
19761 <div class="gallerytext">
19762 <p>caption
19763 </p>
19764 </div>
19765 </div></li>
19766 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19767 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
19768 <div class="gallerytext">
19769 </div>
19770 </div></li>
19771 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19772 <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>
19773 <div class="gallerytext">
19774 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
19775 </p>
19776 </div>
19777 </div></li>
19778 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19779 <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>
19780 <div class="gallerytext">
19781 </div>
19782 </div></li>
19783 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19784 <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>
19785 <div class="gallerytext">
19786 <p>blabla.
19787 </p>
19788 </div>
19789 </div></li>
19790 </ul>
19791
19792 !! html/parsoid
19793 <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"}}'>
19794 <li class="gallerycaption">Foo <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a></li>
19795 <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>
19796 <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>
19797 <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>
19798 <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>
19799 <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>
19800 </ul>
19801 !! end
19802
19803 !! test
19804 Gallery with link that has fragment
19805 !! options
19806 parsoid={
19807 "modes": ["wt2html", "html2html"],
19808 "nativeGallery": true
19809 }
19810 !! wikitext
19811 <gallery>
19812 image:foobar.jpg|link=Main_Page
19813 image:foobar.jpg|link=Main_Page#section
19814 image:foobar.jpg|link=Main Page#section|caption
19815 </gallery>
19816 !! html/php
19817 <ul class="gallery mw-gallery-traditional">
19818 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19819 <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>
19820 <div class="gallerytext">
19821 </div>
19822 </div></li>
19823 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19824 <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>
19825 <div class="gallerytext">
19826 </div>
19827 </div></li>
19828 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19829 <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>
19830 <div class="gallerytext">
19831 <p>caption
19832 </p>
19833 </div>
19834 </div></li>
19835 </ul>
19836
19837 !! html/parsoid
19838 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
19839 <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>
19840 <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>
19841 <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>
19842 </ul>
19843 !! end
19844
19845 ## Whoops, Parsoid shouldn't be parsing templates in the attribute caption!
19846 !! test
19847 Gallery with template inside caption
19848 !! options
19849 parsoid={
19850 "nativeGallery": true
19851 }
19852 !! wikitext
19853 <gallery caption="{{echo|hi}}">
19854 File:Foobar.jpg|{{echo|ho}}
19855 </gallery>
19856 !! html/php
19857 <ul class="gallery mw-gallery-traditional">
19858 <li class='gallerycaption'>{{echo|hi}}</li>
19859 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19860 <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>
19861 <div class="gallerytext">
19862 <p>ho
19863 </p>
19864 </div>
19865 </div></li>
19866 </ul>
19867
19868 !! html/parsoid
19869 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt6" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
19870 <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>
19871 <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>
19872 </ul>
19873 !! end
19874
19875 !! test
19876 Gallery with wikitext inside caption
19877 !! options
19878 parsoid={
19879 "nativeGallery": true
19880 }
19881 !! wikitext
19882 <gallery>
19883 File:Foobar.jpg|alt=galleryalt|[[File:Foobar.jpg|alt=inneralt|20x20px|desc]]
19884 File:Foobar.jpg|alt=galleryalt|{{Test|unamedParam|alt=param}}
19885 </gallery>
19886 !! html/php
19887 <ul class="gallery mw-gallery-traditional">
19888 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19889 <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>
19890 <div class="gallerytext">
19891 <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>
19892 </p>
19893 </div>
19894 </div></li>
19895 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19896 <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>
19897 <div class="gallerytext">
19898 <p>This is a test template
19899 </p>
19900 </div>
19901 </div></li>
19902 </ul>
19903
19904 !! html/parsoid
19905 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt6" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
19906 <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>
19907 <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>
19908 </ul>
19909 !! end
19910
19911 !! test
19912 Gallery (with showfilename option)
19913 !! options
19914 parsoid={
19915 "nativeGallery": true
19916 }
19917 !! wikitext
19918 <gallery showfilename="">
19919 File:Nonexistent.jpg|caption
19920 File:Nonexistent.jpg
19921 File:Foobar.jpg|some '''caption''' [[Main Page]]
19922 File:Foobar.jpg
19923 </gallery>
19924 !! html/php
19925 <ul class="gallery mw-gallery-traditional">
19926 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19927 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
19928 <div class="gallerytext">
19929 <p><a href="/wiki/File:Nonexistent.jpg" class="galleryfilename galleryfilename-truncate" title="File:Nonexistent.jpg">Nonexistent.jpg</a>
19930 caption
19931 </p>
19932 </div>
19933 </div></li>
19934 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19935 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
19936 <div class="gallerytext">
19937 <p><a href="/wiki/File:Nonexistent.jpg" class="galleryfilename galleryfilename-truncate" title="File:Nonexistent.jpg">Nonexistent.jpg</a>
19938 </p>
19939 </div>
19940 </div></li>
19941 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19942 <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>
19943 <div class="gallerytext">
19944 <p><a href="/wiki/File:Foobar.jpg" class="galleryfilename galleryfilename-truncate" title="File:Foobar.jpg">Foobar.jpg</a>
19945 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
19946 </p>
19947 </div>
19948 </div></li>
19949 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19950 <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>
19951 <div class="gallerytext">
19952 <p><a href="/wiki/File:Foobar.jpg" class="galleryfilename galleryfilename-truncate" title="File:Foobar.jpg">Foobar.jpg</a>
19953 </p>
19954 </div>
19955 </div></li>
19956 </ul>
19957
19958 !! html/parsoid
19959 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt3" data-mw='{"name":"gallery","attrs":{"showfilename":""},"body":{}}'>
19960 <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>
19961 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><span style="display: inline-block; height: 100%; vertical-align: middle;"></span><span 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>
19962 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><span style="display: inline-block; height: 100%; vertical-align: middle;"></span><span typeof="mw:Image" style="vertical-align: middle; display: inline-block;"><a href="./File:Foobar.jpg"><img 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>
19963 <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>
19964 </ul>
19965 !! end
19966
19967 ## Should Parsoid be preserving these variations?
19968 !! test
19969 Gallery (with namespace-less filenames)
19970 !! options
19971 parsoid={
19972 "modes": ["wt2html", "html2html"],
19973 "nativeGallery": true
19974 }
19975 !! wikitext
19976 <gallery>
19977 File:Nonexistent.jpg
19978 Nonexistent.jpg
19979 image:foobar.jpg
19980 foobar.jpg
19981 </gallery>
19982 !! html/php
19983 <ul class="gallery mw-gallery-traditional">
19984 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19985 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
19986 <div class="gallerytext">
19987 </div>
19988 </div></li>
19989 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19990 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
19991 <div class="gallerytext">
19992 </div>
19993 </div></li>
19994 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19995 <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>
19996 <div class="gallerytext">
19997 </div>
19998 </div></li>
19999 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20000 <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>
20001 <div class="gallerytext">
20002 </div>
20003 </div></li>
20004 </ul>
20005
20006 !! html/parsoid
20007 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20008 <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>
20009 <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>
20010 <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>
20011 <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>
20012 </ul>
20013 !! end
20014
20015 !! test
20016 Gallery override link with WikiLink (T36852)
20017 !! options
20018 parsoid={
20019 "nativeGallery": true
20020 }
20021 !! wikitext
20022 <gallery>
20023 File:Foobar.jpg|alt=galleryalt|link=InterWikiLink
20024 </gallery>
20025 !! html/php
20026 <ul class="gallery mw-gallery-traditional">
20027 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20028 <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>
20029 <div class="gallerytext">
20030 </div>
20031 </div></li>
20032 </ul>
20033
20034 !! html/parsoid
20035 <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":{}}'>
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="./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>
20037 </ul>
20038 !! end
20039
20040 !! test
20041 Gallery override link with absolute external link (T36852)
20042 !! options
20043 parsoid={
20044 "nativeGallery": true
20045 }
20046 !! wikitext
20047 <gallery>
20048 File:Foobar.jpg|alt=galleryalt|link=http://www.example.org
20049 </gallery>
20050 !! html/php
20051 <ul class="gallery mw-gallery-traditional">
20052 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20053 <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>
20054 <div class="gallerytext">
20055 </div>
20056 </div></li>
20057 </ul>
20058
20059 !! html/parsoid
20060 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20061 <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>
20062 </ul>
20063 !! end
20064
20065 !! test
20066 Gallery override link with absolute external link with LanguageConverter
20067 !! options
20068 language=zh
20069 !! input
20070 <gallery>
20071 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
20072 </gallery>
20073 !! result
20074 <ul class="gallery mw-gallery-traditional">
20075 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20076 <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>
20077 <div class="gallerytext">
20078 <p>caption
20079 </p>
20080 </div>
20081 </div></li>
20082 </ul>
20083
20084 !! end
20085
20086 !! test
20087 Gallery override link with malicious javascript (T36852)
20088 !! options
20089 parsoid={
20090 "modes": ["wt2html", "html2html"],
20091 "nativeGallery": true
20092 }
20093 !! wikitext
20094 <gallery>
20095 File:Foobar.jpg|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
20096 </gallery>
20097 !! html/php
20098 <ul class="gallery mw-gallery-traditional">
20099 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20100 <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>
20101 <div class="gallerytext">
20102 </div>
20103 </div></li>
20104 </ul>
20105
20106 !! html/parsoid
20107 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20108 <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>
20109 </ul>
20110 !! end
20111
20112 !! test
20113 Gallery with invalid title as link (T45964)
20114 !! options
20115 parsoid={
20116 "modes": ["wt2html", "html2html"],
20117 "nativeGallery": true
20118 }
20119 !! wikitext
20120 <gallery>
20121 File:Foobar.jpg|link=<
20122 </gallery>
20123 !! html/php
20124 <ul class="gallery mw-gallery-traditional">
20125 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20126 <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>
20127 <div class="gallerytext">
20128 </div>
20129 </div></li>
20130 </ul>
20131
20132 !! html/parsoid
20133 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20134 <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>
20135 </ul>
20136 !! end
20137
20138 !! test
20139 Serialize gallery without attrs in data-mw
20140 !! options
20141 parsoid={
20142 "modes": ["html2wt"],
20143 "nativeGallery": true
20144 }
20145 !! html/parsoid
20146 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","body":{}}'>
20147 <li class="gallerycaption">123</li>
20148 <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>
20149 </ul>
20150 !! wikitext
20151 <gallery caption="123">
20152 File:Test.png
20153 </gallery>
20154 !! end
20155
20156 !! test
20157 Gallery with class and style attributes
20158 !! options
20159 parsoid={
20160 "nativeGallery": true
20161 }
20162 !! wikitext
20163 <gallery class="center" style="text-align: center;">
20164 File:Foobar.jpg
20165 </gallery>
20166 !! html/php
20167 <ul class="gallery mw-gallery-traditional center" style="text-align: center;">
20168 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20169 <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>
20170 <div class="gallerytext">
20171 </div>
20172 </div></li>
20173 </ul>
20174
20175 !! html/parsoid
20176 <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":{}}'>
20177 <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>
20178 </ul>
20179 !! end
20180
20181 !! test
20182 Gallery in slideshow mode
20183 !! options
20184 parsoid={
20185 "nativeGallery": true
20186 }
20187 !! wikitext
20188 <gallery mode="slideshow" showthumbnails="">
20189 File:Foobar.jpg
20190 </gallery>
20191 !! html/php
20192 <ul class="gallery mw-gallery-slideshow" data-showthumbnails="1">
20193 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20194 <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>
20195 <div class="gallerytext">
20196 </div>
20197 </div></li>
20198 </ul>
20199
20200 !! html/parsoid
20201 <ul class="gallery mw-gallery-slideshow" data-showthumbnails="1" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{"mode":"slideshow","showthumbnails":""},"body":{}}'>
20202 <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>
20203 </ul>
20204 !! end
20205
20206 !! test
20207 HTML Hex character encoding (spells the word "JavaScript")
20208 !! options
20209 parsoid=wt2html,wt2wt,html2html
20210 !! wikitext
20211 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
20212 !! html/php
20213 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
20214 </p>
20215 !! html/php+tidy
20216 <p>JavaScript</p>
20217 !! html/parsoid
20218 <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>
20219 !! end
20220
20221 !! test
20222 HTML Hex character encoding bogus encoding (T28437 regression check)
20223 !! wikitext
20224 &#xsee;&#XSEE;
20225 !! html/php
20226 <p>&amp;#xsee;&amp;#XSEE;
20227 </p>
20228 !! html/parsoid
20229 <p>&amp;#xsee;&amp;#XSEE;</p>
20230 !! end
20231
20232 !! test
20233 HTML Hex character encoding mixed case
20234 !! options
20235 parsoid=wt2html,wt2wt,html2html
20236 !! wikitext
20237 &#xEE;&#Xee;
20238 !! html/php
20239 <p>&#xee;&#xee;
20240 </p>
20241 !! html/php+tidy
20242 <p>îî</p>
20243 !! html/parsoid
20244 <p><span typeof="mw:Entity">î</span><span typeof="mw:Entity">î</span></p>
20245 !! end
20246
20247 # See: https://www.w3.org/TR/html5/syntax.html#character-references
20248 # Note that U+000C (form feed) is not a valid XML character, so
20249 # it is banned even though allowed in HTML5.
20250 !! test
20251 Illegal character references (T106578)
20252 !! wikitext
20253 ; Null: &#00;
20254 ; FF: &#xC;
20255 ; CR: &#xD;
20256 ; Control (low): &#8;
20257 ; Control (high): &#x7F; &#x9F;
20258 ; Surrogate: &#xD83D;&#xDCA9;
20259 ; This is an okay astral character: &#x1F4A9;
20260 !! html+tidy
20261 <dl>
20262 <dt>Null</dt>
20263 <dd>&amp;#00;</dd>
20264 <dt>FF</dt>
20265 <dd>&amp;#xC;</dd>
20266 <dt>CR</dt>
20267 <dd>&amp;#xD;</dd>
20268 <dt>Control (low)</dt>
20269 <dd>&amp;#8;</dd>
20270 <dt>Control (high)</dt>
20271 <dd>&amp;#x7F; &amp;#x9F;</dd>
20272 <dt>Surrogate</dt>
20273 <dd>&amp;#xD83D;&amp;#xDCA9;</dd>
20274 <dt>This is an okay astral character</dt>
20275 <dd>💩</dd>
20276 </dl>
20277 !! end
20278
20279 !! test
20280 __FORCETOC__ override
20281 !! wikitext
20282 __NEWSECTIONLINK__
20283 __FORCETOC__
20284 !! html/php
20285 <p><br />
20286 </p>
20287 !! end
20288
20289 !! test
20290 ISBN code coverage
20291 !! wikitext
20292 ISBN 978-0-1234-56&#x20;789
20293 !! html
20294 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
20295 </p>
20296 !! html+tidy
20297 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a> 789</p>
20298 !! html/parsoid
20299 <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>
20300 !! end
20301
20302 !! test
20303 ISBN followed by 5 spaces
20304 !! wikitext
20305 ISBN
20306 !! html
20307 <p>ISBN
20308 </p>
20309 !! end
20310
20311 !! test
20312 Double ISBN
20313 !! wikitext
20314 ISBN ISBN 1234567890
20315 !! html/php
20316 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
20317 </p>
20318 !! html/parsoid
20319 <p>ISBN <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a></p>
20320 !! end
20321
20322 # Uppercase X and lowercase x as well
20323 !! test
20324 ISBN with an X
20325 !! wikitext
20326 ISBN 3-462-04561-X
20327 ISBN 3-462-04561-x
20328 ISBN 080442957X
20329 ISBN 080442957x
20330 ISBN 978080442957X
20331 ISBN 978080442957x
20332 !! html/php
20333 <p><a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-X</a>
20334 <a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-x</a>
20335 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957X</a>
20336 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957x</a>
20337 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957X</a>
20338 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957x</a>
20339 </p>
20340 !! html/parsoid
20341 <p><a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-X</a>
20342 <a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-x</a>
20343 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957X</a>
20344 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957x</a>
20345 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957X</a>
20346 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957x</a></p>
20347 !! end
20348
20349 !! test
20350 ISBN with empty prefix (parsoid test)
20351 !! wikitext
20352 ISBN 1234567890
20353 !! html/php
20354 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
20355 </p>
20356 !! html/parsoid
20357 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink">ISBN 1234567890</a></p>
20358 !! end
20359
20360 !! test
20361 T24905: <abbr> followed by ISBN followed by </a>
20362 !! wikitext
20363 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
20364 !! html/php
20365 <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>
20366 </p>
20367 !! html/parsoid
20368 <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>
20369 !! end
20370
20371 !! test
20372 Double RFC
20373 !! wikitext
20374 RFC RFC 1234
20375 !! html
20376 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
20377 </p>
20378 !! end
20379
20380 !! test
20381 Double RFC with a wiki link
20382 !! wikitext
20383 RFC [[RFC 1234]]
20384 !! html
20385 <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>
20386 </p>
20387 !! end
20388
20389 !! test
20390 RFC code coverage
20391 !! wikitext
20392 RFC 983&#x20;987
20393 !! html
20394 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
20395 </p>
20396 !! html+tidy
20397 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a> 987</p>
20398 !! end
20399
20400 !! test
20401 Centre-aligned image
20402 !! wikitext
20403 [[Image:foobar.jpg|centre]]
20404 !! html
20405 <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>
20406
20407 !!end
20408
20409 !! test
20410 None-aligned image
20411 !! wikitext
20412 [[Image:foobar.jpg|none]]
20413 !! html
20414 <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>
20415
20416 !!end
20417
20418 !! test
20419 Width + Height sized image (using px) (height is ignored)
20420 !! wikitext
20421 [[Image:foobar.jpg|640x480px]]
20422 !! html
20423 <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>
20424 </p>
20425 !!end
20426
20427 !! test
20428 Width-sized image (using px, no following whitespace)
20429 !! wikitext
20430 [[Image:foobar.jpg|640px]]
20431 !! html
20432 <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>
20433 </p>
20434 !!end
20435
20436 !! test
20437 Width-sized image (using px, with following whitespace - test regression from r39467)
20438 !! wikitext
20439 [[Image:foobar.jpg|640px ]]
20440 !! html
20441 <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>
20442 </p>
20443 !!end
20444
20445 !! test
20446 Width-sized image (using px, with preceding whitespace - test regression from r39467)
20447 !! wikitext
20448 [[Image:foobar.jpg| 640px]]
20449 !! html
20450 <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>
20451 </p>
20452 !!end
20453
20454 !! test
20455 Image with page parameter
20456 !! options
20457 djvu
20458 !! wikitext
20459 [[File:LoremIpsum.djvu|page=2]]
20460 !! html/php
20461 <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>
20462 </p>
20463 !! html/parsoid
20464 <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>
20465 !! end
20466
20467 !! test
20468 Another italics / bold test
20469 !! wikitext
20470 ''' ''x'
20471 !! html
20472 <pre>'<i> </i>x'
20473 </pre>
20474 !!end
20475
20476 # FIXME: The php output seems broken. It's interleaving some open/close tags.
20477 !! test
20478 dt/dd/dl test
20479 !! wikitext
20480 :;;;::
20481 !! html/php
20482 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dt></dl></dd></dl></dd></dl></dd></dl></dd></dl></dd></dl>
20483
20484 !! html/parsoid
20485 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dd></dl></dd></dl></dt></dl></dt></dl></dt></dl></dd></dl>
20486
20487 !!end
20488
20489 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
20490 !! test
20491 Images with the "|" character in the comment
20492 !! wikitext
20493 [[File:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
20494 !! html/php
20495 <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>
20496
20497 !! html/parsoid
20498 <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>
20499 !! end
20500
20501 !! test
20502 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
20503 !! wikitext
20504 <html><script>alert(1);</script></html>
20505 !! html
20506 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
20507 </p>
20508 !! end
20509
20510 !! test
20511 HTML with raw HTML ($wgRawHtml==true)
20512 !! options
20513 wgRawHtml=1
20514 !! wikitext
20515 <html><script>alert(1);</script></html>
20516 !! html
20517 <p><script>alert(1);</script>
20518 </p>
20519 !! end
20520
20521 !! test
20522 Parents of subpages, one level up
20523 !! options
20524 subpage title=[[Subpage test/L1/L2/L3]]
20525 !! wikitext
20526 [[../|L2]]
20527 !! html
20528 <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>
20529 </p>
20530 !! end
20531
20532
20533 !! test
20534 Parents of subpages, one level up, not named
20535 !! options
20536 subpage title=[[Subpage test/L1/L2/L3]]
20537 !! wikitext
20538 [[../]]
20539 !! html
20540 <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>
20541 </p>
20542 !! end
20543
20544
20545
20546 !! test
20547 Parents of subpages, two levels up
20548 !! options
20549 subpage title=[[Subpage test/L1/L2/L3]]
20550 !! wikitext
20551 [[../../|L1]]2
20552
20553 [[../../|L1]]l
20554 !! html
20555 <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
20556 </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>
20557 </p>
20558 !! end
20559
20560 !! test
20561 Parents of subpages, two levels up, without trailing slash or name.
20562 !! options
20563 subpage title=[[Subpage test/L1/L2/L3]]
20564 !! wikitext
20565 [[../..]]
20566 !! html
20567 <p>[[../..]]
20568 </p>
20569 !! end
20570
20571 !! test
20572 Parents of subpages, two levels up, with lots of extra trailing slashes.
20573 !! options
20574 subpage title=[[Subpage test/L1/L2/L3]]
20575 !! wikitext
20576 [[../../////]]
20577 !! html
20578 <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>
20579 </p>
20580 !! end
20581
20582 !! article
20583 Subpage test/L1/L2/L3Sibling
20584 !! text
20585 Sibling article
20586 !! endarticle
20587
20588 !! test
20589 Transclusion of a sibling page (one level up)
20590 !! options
20591 subpage title=[[Subpage test/L1/L2/L3]]
20592 !! wikitext
20593 {{../L3Sibling}}
20594 !! html
20595 <p>Sibling article
20596 </p>
20597 !! end
20598
20599 !! test
20600 Transclusion of a child page
20601 !! options
20602 subpage title=[[Subpage test/L1/L2]]
20603 !! wikitext
20604 {{/L3Sibling}}
20605 !! html
20606 <p>Sibling article
20607 </p>
20608 !! end
20609
20610 # This is wt2html only in Parsoid because we add <nowiki>
20611 # because of {{..}} and we don't expect to fix that to
20612 # eliminate the nowikis selective for {{..}} markup.
20613 !! test
20614 Non-transclusion because of too many up levels
20615 !! options
20616 subpage title=[[Subpage test/L1/L2/L3]]
20617 parsoid=wt2html
20618 !! wikitext
20619 {{../../../../More than parent}}
20620 !! html/php
20621 <p>{{../../../../More than parent}}
20622 </p>
20623 !! html/parsoid
20624 <p>{{../../../../More than parent}}</p>
20625 !! end
20626
20627 !! test
20628 Definition list code coverage
20629 !! wikitext
20630 ; title : def
20631 ; title : def
20632 ;title: def
20633 !! html/php
20634 <dl><dt> title &#160;</dt>
20635 <dd> def</dd>
20636 <dt> title&#160;</dt>
20637 <dd> def</dd>
20638 <dt>title</dt>
20639 <dd> def</dd></dl>
20640
20641 !! html/parsoid
20642 <dl><dt> title <span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
20643 <dt> title<span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
20644 <dt>title</dt><dd> def</dd></dl>
20645 !! end
20646
20647 !! test
20648 Don't fall for the self-closing div
20649 !! wikitext
20650 <div>hello world</div/>
20651 !! html
20652 <div>hello world</div>
20653
20654 !! end
20655
20656 !! test
20657 MSGNW magic word
20658 !! wikitext
20659 {{MSGNW:msg}}
20660 !! html/php
20661 <p>&#91;&#91;:Template:Msg&#93;&#93;
20662 </p>
20663 !! end
20664
20665 !! test
20666 RAW magic word
20667 !! wikitext
20668 {{RAW:QUERTY}}
20669 !! html
20670 <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>
20671 </p>
20672 !! end
20673
20674 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
20675 !! test
20676 Always escape literal '>' in output, not just after '<'
20677 !! wikitext
20678 ><>
20679 !! html
20680 <p>&gt;&lt;&gt;
20681 </p>
20682 !! end
20683
20684 !! test
20685 Template caching
20686 !! wikitext
20687 {{Test}}
20688 {{Test}}
20689 !! html
20690 <p>This is a test template
20691 This is a test template
20692 </p>
20693 !! end
20694
20695
20696 !! article
20697 MediaWiki:Fake
20698 !! text
20699 ==header==
20700 !! endarticle
20701
20702 !! test
20703 Inclusion of !userCanEdit() content
20704 !! wikitext
20705 {{MediaWiki:Fake}}
20706 !! html
20707 <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>
20708
20709 !! end
20710
20711
20712 !! test
20713 Out-of-order TOC heading levels
20714 !! wikitext
20715 ==2==
20716 ======6======
20717 ===3===
20718 =1=
20719 =====5=====
20720 ==2==
20721 !! html
20722 <div id="toc" class="toc"><div id="toctitle" class="toctitle"><h2>Contents</h2></div>
20723 <ul>
20724 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
20725 <ul>
20726 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
20727 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
20728 </ul>
20729 </li>
20730 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
20731 <ul>
20732 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
20733 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
20734 </ul>
20735 </li>
20736 </ul>
20737 </div>
20738
20739 <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>
20740 <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>
20741 <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>
20742 <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>
20743 <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>
20744 <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>
20745
20746 !! end
20747
20748
20749 !! test
20750 ISBN with a dummy number
20751 !! wikitext
20752 ISBN ---
20753 !! html
20754 <p>ISBN ---
20755 </p>
20756 !! end
20757
20758
20759 !! test
20760 ISBN with space-delimited number
20761 !! wikitext
20762 ISBN 92 9017 032 8
20763 !! html/php
20764 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
20765 </p>
20766 !! html/parsoid
20767 <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>
20768 !! end
20769
20770
20771 !! test
20772 ISBN with multiple spaces, no number
20773 !! wikitext
20774 ISBN foo
20775 !! html
20776 <p>ISBN foo
20777 </p>
20778 !! end
20779
20780
20781 !! test
20782 ISBN length
20783 !! wikitext
20784 ISBN 123456789
20785
20786 ISBN 1234567890
20787
20788 ISBN 12345678901
20789 !! html/php
20790 <p>ISBN 123456789
20791 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
20792 </p><p>ISBN 12345678901
20793 </p>
20794 !! html/parsoid
20795 <p>ISBN 123456789</p>
20796
20797 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a></p>
20798
20799 <p>ISBN 12345678901</p>
20800 !! end
20801
20802
20803 !! test
20804 ISBN with trailing year (T9110)
20805 !! wikitext
20806 ISBN 1-234-56789-0 - 2006
20807
20808 ISBN 1 234 56789 0 - 2006
20809 !! html/php
20810 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
20811 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
20812 </p>
20813 !! html/parsoid
20814 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1-234-56789-0</a> - 2006</p>
20815
20816 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1 234 56789 0</a> - 2006</p>
20817 !! end
20818
20819
20820 !! test
20821 anchorencode
20822 !! wikitext
20823 {{anchorencode:foo bar©#%n}}
20824 !! html
20825 <p>foo_bar.C2.A9.23.25n
20826 </p>
20827 !! end
20828
20829 !! test
20830 anchorencode trims spaces
20831 !! wikitext
20832 {{anchorencode: __pretty__please__}}
20833 !! html
20834 <p>pretty_please
20835 </p>
20836 !! end
20837
20838 !! test
20839 anchorencode deals with links
20840 !! wikitext
20841 {{anchorencode: [[hello|world]] [[hi]]}}
20842 !! html
20843 <p>world_hi
20844 </p>
20845 !! end
20846
20847 !! test
20848 anchorencode deals with templates
20849 !! wikitext
20850 {{anchorencode: {{Foo}} }}
20851 !! html
20852 <p>FOO
20853 </p>
20854 !! end
20855
20856 !! test
20857 anchorencode encodes like the TOC generator: (T20431)
20858 !! wikitext
20859 === _ +:.3A%3A&&amp;]] ===
20860 {{anchorencode: _ +:.3A%3A&&amp;]] }}
20861 __NOEDITSECTION__
20862 !! html
20863 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
20864 <p>.2B:.3A.253A.26.26.5D.5D
20865 </p>
20866 !! end
20867
20868 !! test
20869 T8200: blockquotes and paragraph formatting
20870 !! wikitext
20871 <blockquote>
20872 foo
20873 </blockquote>
20874
20875 bar
20876
20877 baz
20878 !! html
20879 <blockquote>
20880 <p>foo
20881 </p>
20882 </blockquote>
20883 <p>bar
20884 </p>
20885 <pre>baz
20886 </pre>
20887 !! end
20888
20889 !! test
20890 T10293: Use of center tag ruins paragraph formatting
20891 !! wikitext
20892 <center>
20893 foo
20894 </center>
20895
20896 bar
20897
20898 baz
20899 !! html
20900 <center>
20901 <p>foo
20902 </p>
20903 </center>
20904 <p>bar
20905 </p>
20906 <pre>baz
20907 </pre>
20908 !! end
20909
20910 !!test
20911 Parsing of overlapping (improperly nested) inline html tags
20912 !! wikitext
20913 <span><s>x</span></s>
20914 !! html/php
20915 <p><span><s>x&lt;/span&gt;</s></span>
20916 </p>
20917 !! html/parsoid
20918 <p><span><s>x</s></span>
20919 </p>
20920 !!end
20921
20922 ###
20923 ### Language variants related tests
20924 ###
20925 !! test
20926 Self-link in language variants
20927 !! options
20928 title=[[Dunav]] language=sr
20929 !! wikitext
20930 Both [[Dunav]] and [[Дунав]] are names for this river.
20931 !! html
20932 <p>Both <a class="mw-selflink selflink">Dunav</a> and <a class="mw-selflink selflink">Дунав</a> are names for this river.
20933 </p>
20934 !!end
20935
20936 !! article
20937 Дуна
20938 !! text
20939 content
20940 !! endarticle
20941
20942 !! test
20943 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
20944 !! options
20945 title=[[Duna]] language=sr
20946 !! wikitext
20947 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
20948 !! html
20949 <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.
20950 </p>
20951 !! end
20952
20953 !! test
20954 Link to a section of a variant of this title shouldn't be parsed as self-link
20955 !! options
20956 title=[[Duna]] language=sr
20957 !! wikitext
20958 [[Dуна]] is a self-link while [[Dunа#Foo]] and [[Dуна#Foo]] are not self-links.
20959 !! html
20960 <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.
20961 </p>
20962 !! end
20963
20964 !! test
20965 Link to pages in language variants
20966 !! options
20967 language=sr
20968 !! wikitext
20969 Main Page can be written as [[Маин Паге]]
20970 !! html
20971 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
20972 </p>
20973 !!end
20974
20975
20976 !! test
20977 Multiple links to pages in language variants
20978 !! options
20979 language=sr
20980 !! wikitext
20981 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
20982 !! html
20983 <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>.
20984 </p>
20985 !!end
20986
20987
20988 !! test
20989 Simple template in language variants
20990 !! options
20991 language=sr
20992 !! wikitext
20993 {{тест}}
20994 !! html
20995 <p>This is a test template
20996 </p>
20997 !! end
20998
20999
21000 !! test
21001 Template with explicit namespace in language variants
21002 !! options
21003 language=sr
21004 !! wikitext
21005 {{Template:тест}}
21006 !! html
21007 <p>This is a test template
21008 </p>
21009 !! end
21010
21011
21012 !! test
21013 Basic test for template parameter in language variants
21014 !! options
21015 language=sr
21016 !! wikitext
21017 {{парамтест|param=foo}}
21018 !! html
21019 <p>This is a test template with parameter foo
21020 </p>
21021 !! end
21022
21023 !! test
21024 Simple category in language variants
21025 !! options
21026 language=sr cat
21027 !! wikitext
21028 [[Category:МедиаWики Усер'с Гуиде]]
21029 !! html/php
21030 cat=МедиаWики_Усер'с_Гуиде sort=
21031 !! html/parsoid
21032 <link rel="mw:PageProp/Category" href="./Категорија:МедиаWики_Усер'с_Гуиде" data-parsoid='{"stx":"simple","a":{"href":"./Категорија:МедиаWики_Усер&#39;с_Гуиде"},"sa":{"href":"Category:МедиаWики Усер&#39;с Гуиде"}}'/>
21033 !! end
21034
21035 !! article
21036 Category:分类
21037 !! text
21038 blah
21039 !! endarticle
21040
21041 !! article
21042 Category:分類
21043 !! text
21044 blah
21045 !! endarticle
21046
21047 ## We used to, but no longer wt2wt this test since the default serializer
21048 ## will normalize all categories to serialize on their own line.
21049 ## This wikitext usage is going to be fairly uncommon in production and
21050 ## selser will take care of preserving formatting in those scenarios.
21051 !! test
21052 Don't convert blue categorylinks to another variant (T35210)
21053 !! options
21054 cat
21055 language=zh
21056 parsoid=wt2html
21057 !! wikitext
21058 [[A]][[Category:分类]]
21059 !! html/php
21060 cat=分类 sort=
21061 !! html/parsoid
21062 <p><a rel="mw:WikiLink" href="./A" title="A">A</a></p>
21063 <link rel="mw:PageProp/Category" href="./Category:分类"/>
21064 !! end
21065
21066 !! test
21067 Stripping -{}- tags (language variants)
21068 !! options
21069 language=sr
21070 !! wikitext
21071 Latin proverb: -{Ne nuntium necare}-
21072 !! html
21073 <p>Latin proverb: Ne nuntium necare
21074 </p>
21075 !! end
21076
21077
21078 !! test
21079 Prevent conversion with -{}- tags (language variants)
21080 !! options
21081 language=sr variant=sr-ec
21082 !! wikitext
21083 Latinski: -{Ne nuntium necare}-
21084 !! html
21085 <p>Латински: Ne nuntium necare
21086 </p>
21087 !! end
21088
21089
21090 !! test
21091 Prevent conversion of text with -{}- tags (language variants)
21092 !! options
21093 language=sr variant=sr-ec
21094 !! wikitext
21095 Latinski: -{Ne nuntium necare}-
21096 !! html
21097 <p>Латински: Ne nuntium necare
21098 </p>
21099 !! end
21100
21101
21102 !! test
21103 Prevent conversion of links with -{}- tags (language variants)
21104 !! options
21105 language=sr variant=sr-ec
21106 !! wikitext
21107 -{[[Main Page]]}-
21108 !! html
21109 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
21110 </p>
21111 !! end
21112
21113
21114 !! test
21115 -{}- tags within headlines (within html for parserConvert())
21116 !! options
21117 language=sr variant=sr-ec
21118 !! wikitext
21119 == -{Naslov}- ==
21120 !! html
21121 <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>
21122
21123 !! end
21124
21125
21126 !! test
21127 Explicit definition of language variant alternatives
21128 !! options
21129 language=zh variant=zh-tw
21130 !! wikitext
21131 -{zh:China;zh-tw:Taiwan}-, not China
21132 !! html
21133 <p>Taiwan, not China
21134 </p>
21135 !! end
21136
21137
21138 !! test
21139 Conversion around HTML tags
21140 !! options
21141 language=sr variant=sr-ec
21142 !! wikitext
21143 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
21144 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
21145 !! html
21146 <p>
21147 <span title="ЛаCтин">ски</span>
21148 </p>
21149 !! end
21150
21151
21152 !! test
21153 Explicit session-wise language variant mapping (A flag and - flag)
21154 !! options
21155 language=zh variant=zh-tw
21156 !! wikitext
21157 Taiwan is not China.
21158 But -{A|zh:China;zh-tw:Taiwan}- is China,
21159 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
21160 and -{China}- is China.
21161 !! html
21162 <p>Taiwan is not China.
21163 But Taiwan is Taiwan,
21164 (This should be stripped!)
21165 and China is China.
21166 </p>
21167 !! end
21168
21169 !! test
21170 Explicit session-wise language variant mapping (H flag for hide)
21171 !! options
21172 language=zh variant=zh-tw
21173 !! wikitext
21174 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
21175 Taiwan is China.
21176 !! html
21177 <p>(This should be stripped!)
21178 Taiwan is Taiwan.
21179 </p>
21180 !! end
21181
21182 !! test
21183 Adding explicit conversion rule for title (T flag)
21184 !! options
21185 language=zh variant=zh-tw showtitle
21186 !! wikitext
21187 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
21188 !! html
21189 Taiwan
21190 <p>Should be stripped!
21191 </p>
21192 !! end
21193
21194 !! test
21195 Testing that changing the language variant here in the tests actually works
21196 !! options
21197 language=zh variant=zh showtitle
21198 !! wikitext
21199 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
21200 !! html
21201 China
21202 <p>Should be stripped!
21203 </p>
21204 !! end
21205
21206 !! test
21207 Recursive conversion of alt and title attrs shouldn't clear converter state
21208 !! options
21209 language=zh variant=zh-cn showtitle
21210 !! wikitext
21211 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
21212 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
21213 !! html
21214 China
21215 <p>
21216 Should be stripped<span title="Exclamation">!</span>
21217 </p>
21218 !! end
21219
21220 !! test
21221 T26072: more test on conversion rule for title
21222 !! options
21223 language=zh variant=zh-tw showtitle
21224 !! wikitext
21225 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
21226 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
21227 !! html
21228 Taiwan
21229 <p>This should be stripped!
21230 This won't take interferes with the title rule.
21231 </p>
21232 !! end
21233
21234 !! test
21235 Partly disable title conversion if variant == main language code
21236 !! options
21237 language=zh variant=zh title=[[ZH]] showtitle
21238 !! wikitext
21239 -{T|zh-cn:CN;zh-tw:TW}-
21240 !! html
21241 ZH
21242 <p>
21243 </p>
21244 !! end
21245
21246 !! test
21247 Partly disable title conversion if variant == main language code, more
21248 !! options
21249 language=zh variant=zh title=[[ZH]] showtitle
21250 !! wikitext
21251 -{T|TW}-
21252 !! html
21253 ZH
21254 <p>
21255 </p>
21256 !! end
21257
21258 !! test
21259 Raw output of variant escape tags (R flag)
21260 !! options
21261 language=zh variant=zh-tw
21262 !! wikitext
21263 Raw: -{R|zh:China;zh-tw:Taiwan}-
21264 !! html
21265 <p>Raw: zh:China;zh-tw:Taiwan
21266 </p>
21267 !! end
21268
21269 !! test
21270 Nested markup inside raw output of variant escape tags (R flag)
21271 !! options
21272 language=zh variant=zh-tw
21273 !! wikitext
21274 Nested raw: -{R|nested -{zh:China;zh-tw:Taiwan}- nested}-
21275 !! html
21276 <p>Nested raw: nested Taiwan nested
21277 </p>
21278 !! end
21279
21280 !! test
21281 Templates inside raw output of variant escape tags (R flag)
21282 !! options
21283 language=zh variant=zh-tw
21284 !! wikitext
21285 Nested raw: -{R|nested {{echo|hi}} templates}-
21286 !! html
21287 <p>Nested raw: nested hi templates
21288 </p>
21289 !! end
21290
21291 !! test
21292 Strings evaluating false shouldn't be ignored by Language converter (T51072)
21293 !! options
21294 language=zh variant=zh-cn
21295 !! input
21296 -{zh-cn:0;zh-sg:1;zh-tw:2;zh-hk:3}-
21297 !! result
21298 <p>0
21299 </p>
21300 !! end
21301
21302 !! test
21303 Conversion rules from [numeric-only string] to [something else] (T48634)
21304 !! options
21305 language=zh variant=zh-cn
21306 !! input
21307 -{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
21308 !! result
21309 <p>D12345EE12345
21310 </p>
21311 !! end
21312
21313 !! test
21314 Bidirectional converter rule entries with an empty value should be ignored (T53551)
21315 !! options
21316 language=zh variant=zh-cn
21317 !! input
21318 -{H|zh-cn:foo;zh-tw:;}-foobar
21319 !! result
21320 <p>foobar
21321 </p>
21322 !! end
21323
21324 !! test
21325 Unidirectional converter rule entries with an empty "from" string should be ignored (T53551)
21326 !! options
21327 language=zh variant=zh-cn
21328 !! input
21329 -{H|=>zh-cn:foo;}-foobar
21330 !! result
21331 <p>foobar
21332 </p>
21333 !! end
21334
21335 !! test
21336 Empty converter rule entries shouldn't be inserted into the conversion table (T53551)
21337 !! options
21338 language=zh variant=zh-cn
21339 !! input
21340 -{H|}-foobar
21341 !! result
21342 <p>foobar
21343 </p>
21344 !! end
21345
21346 !! test
21347 Nested using of manual convert syntax
21348 !! options
21349 language=zh variant=zh-hk
21350 !! wikitext
21351 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
21352 !! html
21353 <p>Nested: Hello Hong Kong!
21354 </p>
21355 !! end
21356
21357 !! test
21358 HTML markups with conversion syntax in attribs, nested in other conversion blocks
21359 !! options
21360 language=zh variant=zh-cn
21361 !! wikitext
21362 -{zh;zh-hans;zh-hant|<span title="-{X}-">A</span>}-
21363 !! html
21364 <p><span title="X">A</span>
21365 </p>
21366 !! end
21367
21368 !! test
21369 HTML markups with conversion syntax in attribs, nested in other conversion blocks (not working yet)
21370 !! options
21371 language=zh variant=zh-cn disabled
21372 !! wikitext
21373 -{<span title="-{X}-">A</span>}-
21374 !! html
21375 <p><span title="X">A</span>
21376 </p>
21377 !! end
21378
21379 # Since Parsoid is starting to emit canonical wikitext for links,
21380 # [http://example.com http://example.com] will not RT back to that
21381 # form anymore.
21382 !! test
21383 Proper conversion of text in external links
21384 !! options
21385 language=sr variant=sr-ec
21386 parsoid=wt2html
21387 !! wikitext
21388 http://www.google.com
21389 gopher://www.google.com
21390 [http://www.google.com http://www.google.com]
21391 [gopher://www.google.com gopher://www.google.com]
21392 [https://www.google.com irc://www.google.com]
21393 [ftp://www.google.com www.google.com/ftp://dir]
21394 [//www.google.com www.google.com]
21395 !! html/php
21396 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
21397 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
21398 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
21399 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
21400 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
21401 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
21402 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
21403 </p>
21404 !! html/parsoid
21405 <p><a rel="mw:ExtLink" href="http://www.google.com">http://www.google.com</a>
21406 <a rel="mw:ExtLink" href="gopher://www.google.com">gopher://www.google.com</a>
21407 <a rel="mw:ExtLink" href="http://www.google.com">http://www.google.com</a>
21408 <a rel="mw:ExtLink" href="gopher://www.google.com">gopher://www.google.com</a>
21409 <a rel="mw:ExtLink" href="https://www.google.com">irc://www.google.com</a>
21410 <a rel="mw:ExtLink" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
21411 <a rel="mw:ExtLink" href="//www.google.com">www.гоогле.цом</a></p>
21412 !! end
21413
21414 !! test
21415 Do not convert roman numbers to language variants
21416 !! options
21417 language=sr variant=sr-ec
21418 !! wikitext
21419 Fridrih IV je car.
21420 !! html
21421 <p>Фридрих IV је цар.
21422 </p>
21423 !! end
21424
21425 !! test
21426 Unclosed language converter markup "-{"
21427 !! options
21428 language=sr
21429 !! wikitext
21430 -{T|hello
21431 !! html
21432 <p>-{T|hello
21433 </p>
21434 !! end
21435
21436 !! test
21437 Don't convert raw rule "-{R|=&gt;}-" to "=>"
21438 !! options
21439 language=sr
21440 !! wikitext
21441 -{R|=&gt;}-
21442 !! html
21443 <p>=&gt;
21444 </p>
21445 !!end
21446
21447 !! test
21448 Don't break link parsing if language converter markup is in the caption.
21449 !! options
21450 language=sr variant=sr-ec
21451 !! wikitext
21452 [[Main Page|-{R|main page}-]]
21453 !! html
21454 <p><a href="/wiki/Main_Page" title="Маин Паге">main page</a>
21455 </p>
21456 !! end
21457
21458 !! test
21459 T146304: Don't break template parsing if language converter markup is in the parameter.
21460 !! options
21461 language=sr variant=sr-ec
21462 !! wikitext
21463 {{echo|-{R|foo}-}}
21464 !! html/php
21465 <p>foo
21466 </p>
21467 !! end
21468
21469 !! test
21470 T146305: Don't break image parsing if language converter markup is in the caption.
21471 !! options
21472 language=sr
21473 !! wikitext
21474 [[File:Foobar.jpg|thumb|-{R|caption:}-]]
21475 !! html/php
21476 <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>
21477
21478 !! html/parsoid
21479 <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>
21480 !! end
21481
21482 !! test
21483 T146305: Don't break image parsing if nested language converter markup is in the caption.
21484 !! options
21485 language=zh variant=zh-cn
21486 !! wikitext
21487 [[File:Foobar.jpg|thumb|-{zh-cn:blog (hk: -{zh-hans|WEBJOURNAL}-, tw: -{zh-hans|WEBLOG}-)}-]]
21488 !! html/php
21489 <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>
21490
21491 !! html/parsoid
21492 <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>
21493 !! end
21494
21495 !! test
21496 Don't break gallery if language converter markup is inside.
21497 !! options
21498 language=zh
21499 !! wikitext
21500 <gallery>
21501 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=-{R|foo}-|-{R|bar}-]]|alt=-{R|bat}-
21502 File:foobar.jpg|{{Test|unamedParam|alt=-{R|param}-}}|alt=galleryalt
21503 </gallery>
21504 !! html
21505 <ul class="gallery mw-gallery-traditional">
21506 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21507 <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>
21508 <div class="gallerytext">
21509 <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>
21510 </p>
21511 </div>
21512 </div></li>
21513 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21514 <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>
21515 <div class="gallerytext">
21516 <p>This is a test template
21517 </p>
21518 </div>
21519 </div></li>
21520 </ul>
21521
21522 !! end
21523
21524 !! test
21525 T153135: Don't break list handling if language converter markup is in the item.
21526 !! options
21527 language=zh variant=zh-cn
21528 !! wikitext
21529 ;-{zh-cn:AAA;zh-tw:BBB}-
21530 ;-{R|foo:bar}-
21531 !! html/php
21532 <dl><dt>AAA</dt>
21533 <dt>foo:bar</dt></dl>
21534
21535 !! html/parsoid
21536 <dl>
21537 <dt><span typeof="mw:LanguageVariant" data-mw='{"bidir":[{"l":"zh-cn","t":"AAA"},{"l":"zh-tw","t":"BBB"}],"show":true}'></span></dt>
21538 <dt><span typeof="mw:LanguageVariant" data-mw='{"disabled":true,"show":true,"text":"foo:bar"}'></span></dt>
21539 </dl>
21540 !! end
21541
21542 // Note that parsoid does not protect colons unless language converter
21543 // markup is properly nested, because it is a backtracking parser.
21544 !! test
21545 T153135: Unclosed markup in definition list (code coverage)
21546 !! options
21547 language=zh variant=zh-cn
21548 !! wikitext
21549 ;<b>foo:bar
21550 ;-{zh-cn:AAA
21551 !! html/php
21552 <dl><dt><b>foo:bar</dt>
21553 <dt>-{zh-cn:AAA</b></dt></dl>
21554
21555 !! html/parsoid
21556 <dl>
21557 <dt><b>foo:bar</b></dt>
21558 <b>
21559 <dt>-{zh-cn</dt>
21560 <dd>AAA</dd>
21561 </b></dl>
21562 !! end
21563
21564 !! test
21565 T153135: Nested language converter markup in definition list (code coverage)
21566 !! options
21567 language=zh variant=zh-cn
21568 !! wikitext
21569 ;-{zh-cn:AAA -{zh-hans|foo:bar}- -{R|bat:baz}-}-:def
21570 !! html/php
21571 <dl><dt>AAA foo:bar bat:baz</dt>
21572 <dd>def</dd></dl>
21573
21574 !! html/parsoid
21575 <dl>
21576 <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>
21577 <dd>def</dd>
21578 </dl>
21579 !! end
21580
21581 !! test
21582 T153140: Don't break table handling if language converter markup is in the cell.
21583 !! options
21584 language=sr variant=sr-ec
21585 !! wikitext
21586 {|
21587 |-
21588 | -{R|B}-
21589 |}
21590 !! html/php
21591 <table>
21592
21593 <tr>
21594 <td> B
21595 </td></tr></table>
21596
21597 !! html/parsoid
21598 <table>
21599
21600 <tr>
21601 <td> B
21602 </td></tr></table>
21603
21604 !! end
21605
21606 !! test
21607 T2529: Uncovered bullet
21608 !! wikitext
21609 * Foo {{bullet}}
21610 !! html
21611 <ul><li> Foo </li>
21612 <li> Bar</li></ul>
21613
21614 !! end
21615
21616 # Plain MediaWiki does not remove empty lists, but tidy actually does.
21617 # Templates in Wikipedia rely on this behavior, as tidy has always been
21618 # enabled there. These tests are normally run *without* tidy, so specify the
21619 # full output here.
21620 # To test realistic parsing behavior, apply a tidy-like transformation to both
21621 # the expected output and your parser's output.
21622 !! test
21623 T2529: Uncovered bullet leaving empty list, normally removed by tidy
21624 !! wikitext
21625 ******* Foo {{bullet}}
21626 !! html
21627 <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>
21628 <li> Bar</li></ul>
21629
21630 !! end
21631
21632 !! test
21633 T2529: Uncovered table already at line-start
21634 !! wikitext
21635 x
21636
21637 {{table}}
21638 y
21639 !! html
21640 <p>x
21641 </p>
21642 <table>
21643 <tr>
21644 <td> 1 </td>
21645 <td> 2
21646 </td></tr>
21647 <tr>
21648 <td> 3 </td>
21649 <td> 4
21650 </td></tr></table>
21651 <p>y
21652 </p>
21653 !! end
21654
21655 !! test
21656 T2529: Uncovered bullet in parser function result
21657 !! wikitext
21658 * Foo {{lc:{{bullet}} }}
21659 !! html
21660 <ul><li> Foo </li>
21661 <li> bar</li></ul>
21662
21663 !! end
21664
21665 !! test
21666 T7678: Double-parsed template argument
21667 !! wikitext
21668 {{lc:{{{1}}}|hello}}
21669 !! html
21670 <p>{{{1}}}
21671 </p>
21672 !! end
21673
21674 !! test
21675 T7678: Double-parsed template invocation
21676 !! wikitext
21677 {{lc:{{paramtest {{!}} param = hello }} }}
21678 !! html
21679 <p>{{paramtest | param = hello }}
21680 </p>
21681 !! end
21682
21683 !! test
21684 Case insensitivity of parser functions for non-ASCII characters (T10143)
21685 !! options
21686 language=cs
21687 title=[[Main Page]]
21688 !! wikitext
21689 {{PRVNÍVELKÉ:ěščř}}
21690 {{prvnívelké:ěščř}}
21691 {{PRVNÍMALÉ:ěščř}}
21692 {{prvnímalé:ěščř}}
21693 {{MALÁ:ěščř}}
21694 {{malá:ěščř}}
21695 {{VELKÁ:ěščř}}
21696 {{velká:ěščř}}
21697 !! html
21698 <p>Ěščř
21699 Ěščř
21700 ěščř
21701 ěščř
21702 ěščř
21703 ěščř
21704 ĚŠČŘ
21705 ĚŠČŘ
21706 </p>
21707 !! end
21708
21709 !! test
21710 Morwen/13: Unclosed link followed by heading
21711 !! wikitext
21712 [[link
21713 ==heading==
21714 !! html
21715 <p>[[link
21716 </p>
21717 <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>
21718
21719 !! end
21720
21721 !! test
21722 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
21723 !! wikitext
21724 {{foo|
21725 =heading=
21726 !! html
21727 <p>{{foo|
21728 </p>
21729 <h1><span class="mw-headline" id="heading">heading</span></h1>
21730
21731 !! end
21732
21733 !! test
21734 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
21735 !! wikitext
21736 {{foo|
21737 ==heading==
21738 !! html
21739 <p>{{foo|
21740 </p>
21741 <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>
21742
21743 !! end
21744
21745 !! test
21746 Tildes in comments
21747 !! options
21748 pst
21749 !! wikitext
21750 <!-- ~~~~ -->
21751 !! html/php
21752 <!-- ~~~~ -->
21753 !! end
21754
21755 !! test
21756 Paragraphs inside divs (no extra line breaks)
21757 !! wikitext
21758 <div>Line one
21759
21760 Line two</div>
21761 !! html
21762 <div>Line one
21763 Line two</div>
21764
21765 !! end
21766
21767 !! test
21768 Paragraphs inside divs (extra line break on open)
21769 !! wikitext
21770 <div>
21771 Line one
21772
21773 Line two</div>
21774 !! html
21775 <div>
21776 <p>Line one
21777 </p>
21778 Line two</div>
21779
21780 !! end
21781
21782 !! test
21783 Paragraphs inside divs (extra line break on close)
21784 !! wikitext
21785 <div>Line one
21786
21787 Line two
21788 </div>
21789 !! html
21790 <div>Line one
21791 <p>Line two
21792 </p>
21793 </div>
21794
21795 !! end
21796
21797 !! test
21798 Paragraphs inside divs (extra line break on open and close)
21799 !! wikitext
21800 <div>
21801 Line one
21802
21803 Line two
21804 </div>
21805 !! html
21806 <div>
21807 <p>Line one
21808 </p><p>Line two
21809 </p>
21810 </div>
21811
21812 !! end
21813
21814 !! test
21815 Nesting tags, paragraphs on lines which begin with <div>
21816 !! wikitext
21817 <div></div><strong>A
21818 B</strong>
21819 !! html/php+tidy
21820 <p><strong>A</strong></p>
21821 <p><strong>B</strong></p>
21822 !! html/parsoid
21823 <div></div>
21824 <p><strong>A
21825 B</strong>
21826 </p>
21827 !! end
21828
21829 # T8200: <blockquote> should behave like <div> with respect to line breaks
21830 !! test
21831 T8200: paragraphs inside blockquotes (no extra line breaks)
21832 !! wikitext
21833 <blockquote>Line one
21834
21835 Line two</blockquote>
21836 !! html
21837 <blockquote>Line one
21838 Line two</blockquote>
21839
21840 !! html+tidy
21841 <blockquote>
21842 <p>Line one Line two</p>
21843 </blockquote>
21844 !! end
21845
21846 !! test
21847 T8200: paragraphs inside blockquotes (extra line break on open)
21848 !! wikitext
21849 <blockquote>
21850 Line one
21851
21852 Line two</blockquote>
21853 !! html
21854 <blockquote>
21855 <p>Line one
21856 </p>
21857 Line two</blockquote>
21858
21859 !! html+tidy
21860 <blockquote>
21861 <p>Line one</p>
21862 Line two</blockquote>
21863 !! end
21864
21865 !! test
21866 T8200: paragraphs inside blockquotes (extra line break on close)
21867 !! wikitext
21868 <blockquote>Line one
21869
21870 Line two
21871 </blockquote>
21872 !! html
21873 <blockquote>Line one
21874 <p>Line two
21875 </p>
21876 </blockquote>
21877
21878 !! html+tidy
21879 <blockquote>
21880 <p>Line one</p>
21881 <p>Line two</p>
21882 </blockquote>
21883 !! end
21884
21885 !! test
21886 T8200: paragraphs inside blockquotes (extra line break on open and close)
21887 !! wikitext
21888 <blockquote>
21889 Line one
21890
21891 Line two
21892 </blockquote>
21893 !! html
21894 <blockquote>
21895 <p>Line one
21896 </p><p>Line two
21897 </p>
21898 </blockquote>
21899
21900 !! html+tidy
21901 <blockquote>
21902 <p>Line one</p>
21903 <p>Line two</p>
21904 </blockquote>
21905 !! end
21906
21907 !! test
21908 Paragraphs inside blockquotes/divs (no extra line breaks)
21909 !! wikitext
21910 <blockquote><div>Line one
21911
21912 Line two</div></blockquote>
21913 !! html
21914 <blockquote><div>Line one
21915 Line two</div></blockquote>
21916
21917 !! end
21918
21919 !! test
21920 Paragraphs inside blockquotes/divs (extra line break on open)
21921 !! wikitext
21922 <blockquote><div>
21923 Line one
21924
21925 Line two</div></blockquote>
21926 !! html
21927 <blockquote><div>
21928 <p>Line one
21929 </p>
21930 Line two</div></blockquote>
21931
21932 !! end
21933
21934 !! test
21935 Paragraphs inside blockquotes/divs (extra line break on close)
21936 !! wikitext
21937 <blockquote><div>Line one
21938
21939 Line two
21940 </div></blockquote>
21941 !! html
21942 <blockquote><div>Line one
21943 <p>Line two
21944 </p>
21945 </div></blockquote>
21946
21947 !! end
21948
21949 !! test
21950 Paragraphs inside blockquotes/divs (extra line break on open and close)
21951 !! wikitext
21952 <blockquote><div>
21953 Line one
21954
21955 Line two
21956 </div></blockquote>
21957 !! html
21958 <blockquote><div>
21959 <p>Line one
21960 </p><p>Line two
21961 </p>
21962 </div></blockquote>
21963
21964 !! end
21965
21966 !! test
21967 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
21968 !! options
21969 wgLinkHolderBatchSize=0
21970 !! wikitext
21971 [[meatball:1]]
21972 [[meatball:2]]
21973 [[meatball:3]]
21974 !! html
21975 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
21976 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
21977 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
21978 </p>
21979 !! end
21980
21981 !! test
21982 Free external link invading image caption
21983 !! wikitext
21984 [[Image:Foobar.jpg|thumb|http://x|hello]]
21985 !! html
21986 <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>
21987
21988 !! end
21989
21990 !! test
21991 T17196: localised external link numbers
21992 !! options
21993 language=fa
21994 !! wikitext
21995 [http://en.wikipedia.org/]
21996 !! html/php
21997 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
21998 </p>
21999 !! html/parsoid
22000 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/"></a></p>
22001 !! end
22002
22003 !! test
22004 Multibyte character in padleft
22005 !! wikitext
22006 {{padleft:-Hello|7|Æ}}
22007 !! html
22008 <p>Æ-Hello
22009 </p>
22010 !! end
22011
22012 !! test
22013 Multibyte character in padright
22014 !! wikitext
22015 {{padright:Hello-|7|Æ}}
22016 !! html
22017 <p>Hello-Æ
22018 </p>
22019 !! end
22020
22021 !!test
22022 formatdate parser function
22023 !! wikitext
22024 {{#formatdate:2009-03-24}}
22025 !! html
22026 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
22027 </p>
22028 !! end
22029
22030 !!test
22031 formatdate parser function, with default format
22032 !! wikitext
22033 {{#formatdate:2009-03-24|mdy}}
22034 !! html
22035 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
22036 </p>
22037 !! end
22038
22039 !! test
22040 Spacing of numbers in formatted dates
22041 !! wikitext
22042 {{#formatdate:January 15}}
22043 !! html
22044 <p><span class="mw-formatted-date" title="01-15">January 15</span>
22045 </p>
22046 !! end
22047
22048 !! test
22049 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
22050 !! options
22051 language=nl title=[[MediaWiki:Common.css]]
22052 !! wikitext
22053 {{#formatdate:2009-03-24|dmy}}
22054 !! html
22055 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
22056 </p>
22057 !! end
22058
22059 #
22060 #
22061 #
22062
22063 #
22064 # Edit comments
22065 #
22066
22067 !! test
22068 Edit comment with link
22069 !! options
22070 comment
22071 !! wikitext
22072 I like the [[Main Page]] a lot
22073 !! html/php
22074 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
22075 !!end
22076
22077 !! test
22078 Edit comment with link and link text
22079 !! options
22080 comment
22081 !! wikitext
22082 I like the [[Main Page|best pages]] a lot
22083 !! html/php
22084 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
22085 !!end
22086
22087 !! test
22088 Edit comment with link and link text with suffix
22089 !! options
22090 comment
22091 !! wikitext
22092 I like the [[Main Page|best page]]s a lot
22093 !! html/php
22094 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
22095 !!end
22096
22097 !! test
22098 Edit comment with section link (non-local, eg in history list)
22099 !! options
22100 comment title=[[Main Page]]
22101 !! wikitext
22102 /* External links */ removed bogus entries
22103 !! html/php
22104 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
22105 !!end
22106
22107 !! test
22108 Edit comment with section link and text before it (non-local, eg in history list)
22109 !! options
22110 comment title=[[Main Page]]
22111 !! wikitext
22112 pre-comment text /* External links */ removed bogus entries
22113 !! html/php
22114 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>
22115 !!end
22116
22117 !! test
22118 Edit comment with section link (local, eg in diff view)
22119 !! options
22120 comment local title=[[Main Page]]
22121 !! wikitext
22122 /* External links */ removed bogus entries
22123 !! html/php
22124 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
22125 !!end
22126
22127 !! test
22128 Edit comment with subpage link (T16080)
22129 !! options
22130 comment
22131 subpage
22132 title=[[Subpage test]]
22133 !! wikitext
22134 Poked at a [[/subpage]] here...
22135 !! html/php
22136 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
22137 !!end
22138
22139 !! test
22140 Edit comment with subpage link and link text (T16080)
22141 !! options
22142 comment
22143 subpage
22144 title=[[Subpage test]]
22145 !! wikitext
22146 Poked at a [[/subpage|neat little page]] here...
22147 !! html/php
22148 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
22149 !!end
22150
22151 !! test
22152 Edit comment with bogus subpage link in non-subpage NS (T16080)
22153 !! options
22154 comment
22155 title=[[Subpage test]]
22156 !! wikitext
22157 Poked at a [[/subpage]] here...
22158 !! html/php
22159 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...
22160 !!end
22161
22162 !! test
22163 Edit comment with bare anchor link (local, as on diff)
22164 !! options
22165 comment
22166 local
22167 title=[[Main Page]]
22168 !! wikitext
22169 [[#section]]
22170 !! html/php
22171 <a href="#section">#section</a>
22172 !! end
22173
22174 !! test
22175 Edit comment with bare anchor link (non-local, as on history)
22176 !! options
22177 comment
22178 title=[[Main Page]]
22179 !! wikitext
22180 [[#section]]
22181 !! html/php
22182 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
22183 !! end
22184
22185 !! test
22186 Anchor starting with underscore
22187 !! options
22188 title=[[Foo]]
22189 !! wikitext
22190 [[#_ref|One]]
22191 !! html/php
22192 <p><a href="#_ref">One</a>
22193 </p>
22194 !! html/parsoid
22195 <p><a rel="mw:WikiLink" href="./Foo#_ref" data-parsoid='{"stx":"piped","a":{"href":"./Foo#_ref"},"sa":{"href":"#_ref"}}'>One</a></p>
22196 !! end
22197
22198 !! test
22199 Id starting with underscore
22200 !! wikitext
22201 <div id="_ref"></div>
22202 !! html/*
22203 <div id="_ref"></div>
22204
22205 !! end
22206
22207 !! test
22208 Edit comment with link with more than one pipe (T99346)
22209 !! options
22210 comment
22211 !! wikitext
22212 [[Main Page|Many|pipes]]
22213 !! html/php
22214 <a href="/wiki/Main_Page" title="Main Page">Many|pipes</a>
22215 !! end
22216
22217 !! test
22218 Complex edit comment with link with more than one pipe (T99346)
22219 !! options
22220 comment
22221 !! wikitext
22222 Created page with "<noinclude>[[Category:Requests for permissions/Bot|{{subst:#titleparts:{{subst:PAGENAME}}|1|3}}]]</noinclude> === [[User:MineoBot|]] 8=== {{Request for permissions/links|Mineo..."
22223 !! html/php
22224 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;
22225 !! end
22226
22227 !! test
22228 Space normalisation on autocomment (T24784)
22229 !! options
22230 comment
22231 title=[[Main Page]]
22232 !! wikitext
22233 /* __hello__world__ */
22234 !! html/php
22235 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
22236 !! end
22237
22238 !! test
22239 percent-encoding and + signs in comments (T28410)
22240 !! options
22241 comment
22242 !! wikitext
22243 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
22244 !! html/php
22245 <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>
22246 !! end
22247
22248 # Parsoid doesn't support this yet: see T75581
22249 # but it *should* omit the 'src' attribute if the image is bad.
22250 # PHP side of tests was disabled in
22251 # mediawiki/core:6bd31e7d95161a6e88fa86df60871051da997c3c
22252 # because of issues in the PHP parserTests infrastructure
22253 # (but the output below is indeed what the PHP side emits)
22254 !! test
22255 Bad images - basic functionality
22256 !! wikitext
22257 [[File:Bad.jpg]]
22258 !! DISABLED/html/php
22259 !! html/parsoid
22260 <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>
22261 !! end
22262
22263 !! test
22264 Bad images - T18039: text after bad image disappears
22265 !! wikitext
22266 Foo bar
22267 [[File:Bad.jpg]]
22268 Bar foo
22269 !! DISABLED/html/php
22270 <p>Foo bar
22271 </p><p>Bar foo
22272 </p>
22273 !! html/parsoid
22274 <p>Foo bar
22275 <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>
22276 Bar foo</p>
22277 !! end
22278
22279 !! test
22280 Verify that displaytitle works (T24501) no displaytitle
22281 !! options
22282 showtitle
22283 !! config
22284 wgAllowDisplayTitle=true
22285 wgRestrictDisplayTitle=false
22286 !! wikitext
22287 this is not the the title
22288 !! html/php
22289 Parser test
22290 <p>this is not the the title
22291 </p>
22292 !! end
22293
22294 !! test
22295 Verify that displaytitle works (T24501) RestrictDisplayTitle=false
22296 !! options
22297 showtitle
22298 title=[[Screen]]
22299 !! config
22300 wgAllowDisplayTitle=true
22301 wgRestrictDisplayTitle=false
22302 !! wikitext
22303 this is not the the title
22304 {{DISPLAYTITLE:whatever}}
22305 !! html/php
22306 whatever
22307 <p>this is not the the title
22308 </p>
22309 !! end
22310
22311 !! test
22312 Verify that displaytitle works (T24501) RestrictDisplayTitle=true mismatch
22313 !! options
22314 showtitle
22315 title=[[Screen]]
22316 !! config
22317 wgAllowDisplayTitle=true
22318 wgRestrictDisplayTitle=true
22319 !! wikitext
22320 this is not the the title
22321 {{DISPLAYTITLE:whatever}}
22322 !! html/php
22323 Screen
22324 <p>this is not the the title
22325 </p>
22326 !! end
22327
22328 !! test
22329 Verify that displaytitle works (T24501) RestrictDisplayTitle=true matching
22330 !! options
22331 showtitle
22332 title=[[Screen]]
22333 !! config
22334 wgAllowDisplayTitle=true
22335 wgRestrictDisplayTitle=true
22336 !! wikitext
22337 this is not the the title
22338 {{DISPLAYTITLE:screen}}
22339 !! html/php
22340 screen
22341 <p>this is not the the title
22342 </p>
22343 !! end
22344
22345 !! test
22346 Verify that displaytitle works (T24501) AllowDisplayTitle=false
22347 !! options
22348 showtitle
22349 title=[[Screen]]
22350 !! config
22351 wgAllowDisplayTitle=false
22352 !! wikitext
22353 this is not the the title
22354 {{DISPLAYTITLE:screen}}
22355 !! html/php
22356 Screen
22357 <p>this is not the the title
22358 <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>
22359 </p>
22360 !! end
22361
22362 !! test
22363 Verify that displaytitle works (T24501) AllowDisplayTitle=false no DISPLAYTITLE
22364 !! options
22365 showtitle
22366 title=[[Screen]]
22367 !! config
22368 wgAllowDisplayTitle=false
22369 !! wikitext
22370 this is not the the title
22371 !! html/php
22372 Screen
22373 <p>this is not the the title
22374 </p>
22375 !! end
22376
22377 !! test
22378 Verify that displaytitle handles inline CSS styles (T28547) - rejected value
22379 !! options
22380 showtitle
22381 title=[[Screen]]
22382 !! config
22383 wgAllowDisplayTitle=true
22384 wgRestrictDisplayTitle=true
22385 !! wikitext
22386 this is not the the title
22387 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
22388 !! html/php
22389 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
22390 <p>this is not the the title
22391 </p>
22392 !! end
22393
22394 !! test
22395 Verify that displaytitle handles inline CSS styles (T28547) - accepted value
22396 !! options
22397 showtitle
22398 title=[[Screen]]
22399 !! config
22400 wgAllowDisplayTitle=true
22401 wgRestrictDisplayTitle=true
22402 !! wikitext
22403 this is not the the title
22404 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
22405 !! html/php
22406 <span style="color: red;">s</span>creen
22407 <p>this is not the the title
22408 </p>
22409 !! end
22410
22411 !! test
22412 Page status indicators: Empty name is invalid
22413 !! options
22414 showindicators
22415 !! wikitext
22416 <indicator name=" "></indicator>
22417 <indicator></indicator>
22418 !! html/php
22419 <p><span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
22420 <span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
22421 </p>
22422 !! end
22423
22424 !! test
22425 Page status indicators: Weird syntaxes that are okay
22426 !! options
22427 showindicators
22428 !! wikitext
22429 <indicator name="empty" />
22430 <indicator name="name"></indicator>
22431 !! html/php
22432 empty=
22433 name=
22434 <p><br />
22435 </p>
22436 !! end
22437
22438 !! test
22439 Page status indicators: Torture test
22440 !! options
22441 showindicators
22442 !! wikitext
22443 <indicator name="01">hello world</indicator>
22444 <indicator name="02">[[Main Page]]</indicator>
22445 <indicator name="03">[[File:Foobar.jpg|25px|link=]]</indicator>
22446 <indicator name="04">[[File:Foobar.jpg|25px]]</indicator>
22447 <indicator name="05">* foo
22448 * bar</indicator>
22449 <indicator name="06"><nowiki>foo</nowiki></indicator>
22450 <indicator name="07"> Preformatted</indicator>
22451 <indicator name="08"><div>Broken tag</indicator>
22452 <indicator name="09">{| class=wikitable
22453 | cell
22454 |}</indicator>
22455 <indicator name="10">Two
22456
22457 paragraphs</indicator>
22458 !! html/php
22459 01=hello world
22460 02=<a href="/wiki/Main_Page" title="Main Page">Main Page</a>
22461 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" />
22462 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>
22463 05=<ul><li> foo</li>
22464 <li> bar</li></ul>
22465
22466 06=foo
22467 07=<pre>Preformatted
22468 </pre>
22469 08=<div>Broken tag</div>
22470
22471 09=<table class="wikitable">
22472 <tr>
22473 <td> cell
22474 </td></tr></table>
22475
22476 10=<p>Two
22477 </p><p>paragraphs
22478 </p>
22479 <p><br />
22480 </p><p><br />
22481 </p><p><br />
22482 </p><p><br />
22483 </p><p><br />
22484 </p>
22485 !! end
22486
22487 !! test
22488 preload: check <noinclude> and <includeonly>
22489 !! options
22490 preload
22491 !! wikitext
22492 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
22493 !! html/php
22494 Hello kind world.
22495 !! end
22496
22497 !! test
22498 preload: check <onlyinclude>
22499 !! options
22500 preload
22501 !! wikitext
22502 Goodbye <onlyinclude>Hello world</onlyinclude>
22503 !! html/php
22504 Hello world
22505 !! end
22506
22507 !! test
22508 preload: can pass tags through if we want to
22509 !! options
22510 preload
22511 !! wikitext
22512 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
22513 !! html/php
22514 <includeonly>Hello world</includeonly>
22515 !! end
22516
22517 !! test
22518 preload: check that it doesn't try to do tricks
22519 !! options
22520 preload
22521 !! wikitext
22522 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
22523 !! html/php
22524 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
22525 !! end
22526
22527 !! test
22528 Play a bit with r67090 and T5158
22529 !! wikitext
22530 <div style="width:50% !important">&nbsp;</div>
22531 <div style="width:50%&nbsp;!important">&nbsp;</div>
22532 <div style="width:50%&#160;!important">&nbsp;</div>
22533 <div style="border : solid;">&nbsp;</div>
22534 !! html/php
22535 <div style="width:50% !important">&#160;</div>
22536 <div style="width:50% !important">&#160;</div>
22537 <div style="width:50% !important">&#160;</div>
22538 <div style="border&#160;: solid;">&#160;</div>
22539
22540 !! html/parsoid
22541 <div style="width:50% !important" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
22542 <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>
22543 <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>
22544 <div style="border : solid;" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
22545
22546 !! end
22547
22548 !! test
22549 HTML5 data attributes
22550 !! wikitext
22551 <span data-foo="bar">Baz</span>
22552 <p data-abc-def_hij="">Quuz</p>
22553 !! html/php
22554 <p><span data-foo="bar">Baz</span>
22555 </p>
22556 <p data-abc-def_hij="">Quuz</p>
22557
22558 !! html/parsoid
22559 <p><span data-foo="bar" data-parsoid='{"stx":"html"}'>Baz</span></p>
22560 <p data-abc-def_hij="" data-parsoid='{"stx":"html"}'>Quuz</p>
22561 !! end
22562
22563 !! test
22564 Strip reserved data attributes
22565 !! wikitext
22566 <div data-mw="foo" data-parsoid="bar" data-mw-someext="baz" data-ok="fred" data-ooui="xyzzy" data-bad:ns="ns">d</div>
22567 !! html/php
22568 <div data-ok="fred">d</div>
22569
22570 !! html/parsoid
22571 <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>
22572 !! end
22573
22574 !! test
22575 percent-encoding and + signs in internal links (T28410)
22576 !! wikitext
22577 [[User:+%]] [[Page+title%]]
22578 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
22579 [[%]] [[+]] [[File:%+abc%39|foo|[[bar]]]]
22580 [[%33%45]] [[%33%45+]]
22581 !! html/php
22582 <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>
22583 <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>
22584 <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>
22585 <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>
22586 </p>
22587 !! html/parsoid
22588 <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>
22589 <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>
22590 <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>
22591 <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>
22592 !! end
22593
22594 !! test
22595 Special characters in embedded file links (T29679)
22596 !! wikitext
22597 [[File:Contains & ampersand.jpg]]
22598 [[File:Does not exist.jpg|Title with & ampersand]]
22599 !! html/php
22600 <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>
22601 <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>
22602 </p>
22603 !! html/parsoid
22604 <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>
22605 <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>
22606 !! end
22607
22608 !! test
22609 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
22610 !! wikitext
22611 Text&apos;s been normalized?
22612 !! html
22613 <p>Text&#39;s been normalized?
22614 </p>
22615 !! end
22616
22617 !! test
22618 T21052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
22619 !! wikitext
22620 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
22621 !! html
22622 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
22623 </p>
22624 !! end
22625
22626 !! test
22627 T21052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
22628 !! wikitext
22629 [http://www.example.org/ ideograms]
22630 !! html
22631 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
22632 </p>
22633 !! end
22634
22635 !! test
22636 T21052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
22637 !! wikitext
22638 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
22639 !! html
22640 <p><img src="http://www.example.org/pic.png" alt="pic.png"/> &lt;-- U+3000 (vim: ^Vu3000)
22641 </p>
22642 !! end
22643
22644 !! article
22645 Mediawiki:loop1
22646 !! text
22647 {{Identical|A}}
22648 !! endarticle
22649
22650 !! article
22651 Mediawiki:loop2
22652 !! text
22653 {{Identical|B}}
22654 !! endarticle
22655
22656 !! article
22657 Template:Identical
22658 !! text
22659 {{int:loop1}}
22660 {{int:loop2}}
22661 !! endarticle
22662
22663 !! test
22664 T33098 Template which includes system messages which includes the template
22665 !! wikitext
22666 {{Identical}}
22667 !! html
22668 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
22669 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
22670 </p>
22671 !! end
22672
22673 !! test
22674 T33490 Turkish: ucfirst 'blah'
22675 !! options
22676 language=tr
22677 !! wikitext
22678 {{ucfirst:blah}}
22679 !! html
22680 <p>Blah
22681 </p>
22682 !! end
22683
22684 !! test
22685 T33490 Turkish: ucfirst 'ix'
22686 !! options
22687 language=tr
22688 !! wikitext
22689 {{ucfirst:ix}}
22690 !! html
22691 <p>İx
22692 </p>
22693 !! end
22694
22695 !! test
22696 T33490 Turkish: lcfirst 'BLAH'
22697 !! options
22698 language=tr
22699 !! wikitext
22700 {{lcfirst:BLAH}}
22701 !! html
22702 <p>bLAH
22703 </p>
22704 !! end
22705
22706 !! test
22707 T33490 Turkish: ucfırst (with a dotless i)
22708 !! options
22709 language=tr
22710 !! wikitext
22711 {{ucfırst:blah}}
22712 !! html
22713 <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>
22714 </p>
22715 !! end
22716
22717 !! test
22718 T33490 ucfırst (with a dotless i) with English language
22719 !! options
22720 language=en
22721 !! wikitext
22722 {{ucfırst:blah}}
22723 !! html
22724 <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>
22725 </p>
22726 !! end
22727
22728 # Note that Parsoid doesn't emit an explicit TOC.
22729 # Note also that the html2wt direction tends to emit an extra newline
22730 # between the __TOC__ magicword and the first heading unless *both*
22731 # the <meta> and the <h2> have a data-parsoid attribute set (even if
22732 # it's "{}").
22733
22734 !! test
22735 T28375: TOC with italics
22736 !! options
22737 title=[[Main Page]]
22738 !! wikitext
22739 __TOC__
22740 == ''Lost'' episodes ==
22741 !! html/php
22742 <div id="toc" class="toc"><div id="toctitle" class="toctitle"><h2>Contents</h2></div>
22743 <ul>
22744 <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>
22745 </ul>
22746 </div>
22747
22748 <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>
22749
22750 !! html/parsoid
22751 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
22752 <h2 data-parsoid='{}'> <i>Lost</i> episodes </h2>
22753 !! end
22754
22755 !! test
22756 T28375: TOC with bold
22757 !! options
22758 title=[[Main Page]]
22759 !! wikitext
22760 __TOC__
22761 == '''should be bold''' then normal text ==
22762 !! html/php
22763 <div id="toc" class="toc"><div id="toctitle" class="toctitle"><h2>Contents</h2></div>
22764 <ul>
22765 <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>
22766 </ul>
22767 </div>
22768
22769 <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>
22770
22771 !! html/parsoid
22772 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
22773 <h2 data-parsoid='{}'> <b>should be bold</b> then normal text </h2>
22774 !! end
22775
22776 !! test
22777 T35845: Headings become cursive in TOC when they contain an image
22778 !! options
22779 title=[[Main Page]]
22780 !! wikitext
22781 __TOC__
22782 == Image [[Image:foobar.jpg]] ==
22783 !! html/php
22784 <div id="toc" class="toc"><div id="toctitle" class="toctitle"><h2>Contents</h2></div>
22785 <ul>
22786 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
22787 </ul>
22788 </div>
22789
22790 <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>
22791
22792 !! html/parsoid
22793 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
22794 <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>
22795 !! end
22796
22797 !! test
22798 T35845 (2): Headings become bold in TOC when they contain a blockquote
22799 !! options
22800 title=[[Main Page]]
22801 !! wikitext
22802 __TOC__
22803 == <blockquote>Quote</blockquote> ==
22804 !! html/php
22805 <div id="toc" class="toc"><div id="toctitle" class="toctitle"><h2>Contents</h2></div>
22806 <ul>
22807 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
22808 </ul>
22809 </div>
22810
22811 <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>
22812
22813 !! html/php+tidy
22814 <p></p>
22815 <div id="toc" class="toc">
22816 <div id="toctitle" class="toctitle">
22817 <h2>Contents</h2>
22818 </div>
22819 <ul>
22820 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
22821 </ul>
22822 </div>
22823 <p></p>
22824 <h2><span class="mw-headline" id="Quote"></span></h2>
22825 <blockquote>
22826 <p><span class="mw-headline" id="Quote">Quote</span></p>
22827 </blockquote>
22828 <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>
22829 !! html/parsoid
22830 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
22831 <h2 data-parsoid='{}'> <blockquote>Quote</blockquote> </h2>
22832 !! end
22833
22834 !! test
22835 Unclosed tags in TOC
22836 !! options
22837 title=[[Main Page]]
22838 !! wikitext
22839 __TOC__
22840 == Proof: 2 < 3 ==
22841 <small>Hanc marginis exiguitas non caperet.</small>
22842 QED
22843 !! html/php
22844 <div id="toc" class="toc"><div id="toctitle" class="toctitle"><h2>Contents</h2></div>
22845 <ul>
22846 <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>
22847 </ul>
22848 </div>
22849
22850 <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>
22851 <p><small>Hanc marginis exiguitas non caperet.</small>
22852 QED
22853 </p>
22854 !! html/parsoid
22855 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
22856 <h2 data-parsoid='{}'> Proof: 2 &lt; 3 </h2>
22857 <p><small>Hanc marginis exiguitas non caperet.</small>
22858 QED</p>
22859 !! end
22860
22861 !! test
22862 Multiple tags in TOC
22863 !! wikitext
22864 __TOC__
22865 == <i>Foo</i> <b>Bar</b> ==
22866
22867 == <i>Foo</i> <blockquote>Bar</blockquote> ==
22868 !! html/php
22869 <div id="toc" class="toc"><div id="toctitle" class="toctitle"><h2>Contents</h2></div>
22870 <ul>
22871 <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>
22872 <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>
22873 </ul>
22874 </div>
22875
22876 <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>
22877 <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>
22878
22879 !! html/php+tidy
22880 <p></p>
22881 <div id="toc" class="toc">
22882 <div id="toctitle" class="toctitle">
22883 <h2>Contents</h2>
22884 </div>
22885 <ul>
22886 <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>
22887 <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>
22888 </ul>
22889 </div>
22890 <p></p>
22891 <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>
22892 <h2><span class="mw-headline" id="Foo_Bar_2"><i>Foo</i></span></h2>
22893 <blockquote>
22894 <p><span class="mw-headline" id="Foo_Bar_2">Bar</span></p>
22895 </blockquote>
22896 <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>
22897 !! html/parsoid
22898 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
22899 <h2 data-parsoid='{}'> <i data-parsoid='{"stx":"html"}'>Foo</i> <b data-parsoid='{"stx":"html"}'>Bar</b> </h2>
22900 <h2> <i data-parsoid='{"stx":"html"}'>Foo</i> <blockquote>Bar</blockquote> </h2>
22901 !! end
22902
22903 # Don't expect Parsoid to roundtrip this until the php parser comes closer to
22904 # html5 tag parsing.
22905 !! test
22906 Tags with parameters in TOC
22907 !! options
22908 parsoid=wt2html
22909 !! wikitext
22910 __TOC__
22911 == <sup class="in-h2">Hello</sup> ==
22912
22913 == <sup class="a > b">Evilbye</sup> ==
22914 !! html/php
22915 <div id="toc" class="toc"><div id="toctitle" class="toctitle"><h2>Contents</h2></div>
22916 <ul>
22917 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
22918 <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>
22919 </ul>
22920 </div>
22921
22922 <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>
22923 <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>
22924
22925 !! html/parsoid
22926 <meta property="mw:PageProp/toc" />
22927 <h2> <sup class="in-h2" data-parsoid='{"stx":"html"}'>Hello</sup> </h2>
22928
22929 <h2> <sup class="a " data-parsoid='{"stx":"html"}'> b">Evilbye</sup> </h2>
22930 !! end
22931
22932 !! test
22933 span tags with directionality in TOC
22934 !! wikitext
22935 __TOC__
22936 == <span dir="ltr">C++</span> ==
22937
22938 == <span dir="rtl">זבנג!</span> ==
22939
22940 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
22941
22942 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
22943
22944 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
22945 !! html/php
22946 <div id="toc" class="toc"><div id="toctitle" class="toctitle"><h2>Contents</h2></div>
22947 <ul>
22948 <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>
22949 <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>
22950 <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>
22951 <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>
22952 <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>
22953 </ul>
22954 </div>
22955
22956 <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>
22957 <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>
22958 <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>
22959 <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>
22960 <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>
22961
22962 !! html/parsoid
22963 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
22964 <h2 data-parsoid='{}'> <span dir="ltr">C++</span> </h2>
22965 <h2> <span dir="rtl">זבנג!</span> </h2>
22966 <h2> <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> </h2>
22967 <h2> <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> </h2>
22968 <h2> <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> </h2>
22969 !! end
22970
22971 !! test
22972 T74884: bdi element in ToC
22973 !! wikitext
22974 __TOC__
22975 == <bdi>test</bdi> ==
22976 !! html/php
22977 <div id="toc" class="toc"><div id="toctitle" class="toctitle"><h2>Contents</h2></div>
22978 <ul>
22979 <li class="toclevel-1 tocsection-1"><a href="#test"><span class="tocnumber">1</span> <span class="toctext"><bdi>test</bdi></span></a></li>
22980 </ul>
22981 </div>
22982
22983 <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>
22984
22985 !! html/parsoid
22986 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
22987 <h2 data-parsoid='{}'> <bdi>test</bdi> </h2>
22988 !! end
22989
22990 !! test
22991 T35715: s/strike element in ToC
22992 !! wikitext
22993 __TOC__
22994 == <s>test</s> test <strike>test</strike> ==
22995 !! html/php
22996 <div id="toc" class="toc"><div id="toctitle" class="toctitle"><h2>Contents</h2></div>
22997 <ul>
22998 <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>
22999 </ul>
23000 </div>
23001
23002 <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>
23003
23004 !! html/parsoid
23005 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
23006 <h2 data-parsoid='{}'> <s>test</s> test <strike>test</strike> </h2>
23007 !! end
23008
23009 # Note that the html output does not have the <p></p>, but the
23010 # html+tidy output *does*. This is because the empty <p></p> is
23011 # removed by the sanitizer, but only when tidy is *not* enabled (!).
23012 !! test
23013 Empty <p> tag in TOC, removed by Sanitizer (T92892)
23014 !! wikitext
23015 __TOC__
23016 == x ==
23017 !! html/php
23018 <div id="toc" class="toc"><div id="toctitle" class="toctitle"><h2>Contents</h2></div>
23019 <ul>
23020 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
23021 </ul>
23022 </div>
23023
23024 <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>
23025
23026 !! html/php+tidy
23027 <p></p>
23028 <div id="toc" class="toc">
23029 <div id="toctitle" class="toctitle">
23030 <h2>Contents</h2>
23031 </div>
23032 <ul>
23033 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
23034 </ul>
23035 </div>
23036 <p></p>
23037 <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>
23038 !! html/parsoid
23039 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
23040 <h2 data-parsoid='{}'> x </h2>
23041 !! end
23042
23043 !! article
23044 MediaWiki:T34057
23045 !! text
23046 == {{int:headline_sample}} ==
23047 !! endarticle
23048
23049 !! test
23050 T34057: Title needed when expanding <h> nodes.
23051 !! options
23052 title=[[Main Page]]
23053 !! wikitext
23054 {{int:T34057}}
23055 !! html
23056 <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>
23057
23058 !! end
23059
23060 !! test
23061 Strip marker in urlencode
23062 !! wikitext
23063 {{urlencode:x<nowiki/>y}}
23064 {{urlencode:x<nowiki/>y|wiki}}
23065 {{urlencode:x<nowiki/>y|path}}
23066 {{urlencode:x<pre id="one">two</pre>y}}
23067 !! html/php
23068 <p>xy
23069 xy
23070 xy
23071 xy
23072 </p>
23073 !! end
23074
23075 !! test
23076 Strip marker in lc
23077 !! wikitext
23078 {{lc:x<nowiki/>y}}
23079 !! html
23080 <p>xy
23081 </p>
23082 !! end
23083
23084 !! test
23085 Strip marker in uc
23086 !! wikitext
23087 {{uc:x<nowiki/>y}}
23088 !! html
23089 <p>XY
23090 </p>
23091 !! end
23092
23093 !! test
23094 Strip marker in formatNum
23095 !! wikitext
23096 {{formatnum:1<nowiki/>2}}
23097 {{formatnum:1<nowiki/>2|R}}
23098 !! html
23099 <p>12
23100 12
23101 </p>
23102 !! end
23103
23104 !! test
23105 Check noCommafy in formatNum
23106 !! options
23107 language=be-tarask
23108 !! wikitext
23109 {{formatnum:123456.78}}
23110 {{formatnum:123456.78|NOSEP}}
23111 !! html
23112 <p>123 456,78
23113 123456.78
23114 </p>
23115 !! end
23116
23117 !! test
23118 Wrong option for formatNum (T58199)
23119 !! wikitext
23120 {{formatnum:1,234.56|Random}}
23121 {{formatnum:1,234.56|EVERYTHING}}
23122 {{formatnum:1234.56|any argument that has the string 'NOSEP'}}
23123 !! html
23124 <p>1,234.56
23125 1,234.56
23126 1,234.56
23127 </p>
23128 !! end
23129
23130 !! test
23131 Strip marker in grammar
23132 !! options
23133 language=fi
23134 !! wikitext
23135 {{grammar:elative|foo<nowiki/>bar}}
23136 !! html
23137 <p>foobarista
23138 </p>
23139 !! end
23140
23141 !! test
23142 Strip marker in padleft
23143 !! wikitext
23144 {{padleft:|2|x<nowiki/>y}}
23145 !! html
23146 <p>xy
23147 </p>
23148 !! end
23149
23150 !! test
23151 Strip marker in padright
23152 !! wikitext
23153 {{padright:|2|x<nowiki/>y}}
23154 !! html
23155 <p>xy
23156 </p>
23157 !! end
23158
23159 !! test
23160 Strip marker in anchorencode
23161 !! wikitext
23162 {{anchorencode:x<nowiki/>y}}
23163 !! html
23164 <p>xy
23165 </p>
23166 !! end
23167
23168 !! test
23169 nowiki inside link inside heading (T20295)
23170 !! wikitext
23171 ==[[foo|x<nowiki>y</nowiki>z]]==
23172 !! html
23173 <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>
23174
23175 !! end
23176
23177 !! test
23178 new support for bdi element (T33817)
23179 !! wikitext
23180 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
23181 !! html
23182 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
23183
23184 !!end
23185
23186 !! test
23187 Ignore pipe between table row attributes
23188 !! wikitext
23189 {|
23190 | quux
23191 |- id=foo | style='color: red'
23192 | bar
23193 |}
23194 !! html
23195 <table>
23196 <tr>
23197 <td> quux
23198 </td></tr>
23199 <tr id="foo" style="color: red">
23200 <td> bar
23201 </td></tr></table>
23202
23203 !! end
23204
23205 !!test
23206 Language parser function
23207 !! wikitext
23208 {{#language:ar}}
23209 !! html
23210 <p>العربية
23211 </p>
23212 !! end
23213
23214 !!test
23215 Padleft and padright as substr
23216 !! wikitext
23217 {{padleft:|3|abcde}}
23218 {{padright:|3|abcde}}
23219 !! html
23220 <p>abc
23221 abc
23222 </p>
23223 !! end
23224
23225 !!test
23226 Special parser function
23227 !! wikitext
23228 {{#special:RandomPage}}
23229 {{#special:BaDtItLe}}
23230 {{#special:Foobar}}
23231 !! html
23232 <p>Special:Random
23233 Special:Badtitle
23234 Special:Foobar
23235 </p>
23236 !! end
23237
23238 !!test
23239 T36939 - Case insensitive link parsing ([HttP://])
23240 !! wikitext
23241 [HttP://MediaWiki.Org/]
23242 !! html/php
23243 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
23244 </p>
23245 !! html/parsoid
23246 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/"></a></p>
23247 !! end
23248
23249 !!test
23250 T36939 - Case insensitive link parsing ([HttP:// title])
23251 !! wikitext
23252 [HttP://MediaWiki.Org/ MediaWiki]
23253 !! html
23254 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
23255 </p>
23256 !! end
23257
23258 !!test
23259 T36939 - Case insensitive link parsing (HttP://)
23260 !! wikitext
23261 HttP://MediaWiki.Org/
23262 !! html/php
23263 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
23264 </p>
23265 !! html/parsoid
23266 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a></p>
23267 !! end
23268
23269 !!test
23270 Disable TOC
23271 !! options
23272 notoc
23273 !! wikitext
23274 Lead
23275 == Section 1 ==
23276 == Section 2 ==
23277 == Section 3 ==
23278 == Section 4 ==
23279 == Section 5 ==
23280 !! html
23281 <p>Lead
23282 </p>
23283
23284 <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>
23285 <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>
23286 <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>
23287 <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>
23288 <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>
23289
23290 !! end
23291
23292
23293 ###
23294 ### Parsoid-specific tests
23295 ### Parsoid-PHP parser incompatibilities
23296 ###
23297 !!test
23298 1. SOL-sensitive wikitext tokens as template-args
23299 !!options
23300 parsoid=wt2html,wt2wt
23301 !! wikitext
23302 {{echo|*a}}
23303 {{echo|#a}}
23304 {{echo|:a}}
23305 !! html
23306 <span about="#mwt1" typeof="mw:Transclusion">
23307 </span><ul about="#mwt1"><li>a</li>
23308 </ul>
23309 <span about="#mwt2" typeof="mw:Transclusion">
23310 </span><ol about="#mwt2"><li>a</li>
23311 </ol>
23312 <span about="#mwt3" typeof="mw:Transclusion">
23313 </span><dl about="#mwt3"><dd>a</dd>
23314 </dl>
23315 !!end
23316
23317 #### -----------------------------------------------------------------
23318 #### Parsoid-specific functionality tests
23319 #### -----------------------------------------------------------------
23320
23321 # T65642/T68749: Formatting elt fixup around images is cleaned up.
23322 # We know wt2wt will fail, but we expect selser to pass.
23323 # Due to the nature of our testing, wt2wt and selser tests will enter the
23324 # blacklist and we'll catch selser regressions based on changes to the
23325 # blacklist entries for selser tests.
23326 !! test
23327 1. Bad treebuilder fixup of formatting elt is cleaned up
23328 !! options
23329 parsoid=wt2html,wt2wt
23330 !! wikitext
23331 {|
23332 |
23333 <small>
23334 [[Image:Foobar.jpg|right|Test]]
23335 </small>
23336 |}
23337 !! html/parsoid
23338 <table>
23339 <tbody><tr><td>
23340 <small>
23341 <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>
23342 </small>
23343 </td></tr>
23344 </tbody></table>
23345 !! end
23346
23347 !! test
23348 2. Bad treebuilder fixup of formatting elt is cleaned up
23349 !! options
23350 parsoid=wt2html,wt2wt
23351 !! wikitext
23352 '''foo[[File:Foobar.jpg|thumb|caption]]bar'''
23353
23354 <small>[[Image:Foobar.jpg|right|300px]]</small>
23355 !! html/parsoid
23356
23357 <p><b>foo</b></p>
23358 <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>
23359 <p><b>bar</b></p>
23360 <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>
23361 !! end
23362
23363 !! test
23364 3. Bad treebuilder fixup of formatting elt is cleaned up
23365 !! options
23366 parsoid=wt2html,wt2wt
23367 !! wikitext
23368 <small>'''foo[[File:Foobar.jpg|thumb|caption]]bar'''</small>
23369 !! html/parsoid
23370 <p><small><b>foo</b></small></p>
23371 <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>
23372 <p><small><b>bar</b></small></p>
23373 !! end
23374
23375 !! test
23376 4. Bad treebuilder fixup of formatting elt is cleaned up: formatting tags around captionless images are ignored
23377 !! options
23378 parsoid=wt2html,wt2wt
23379 !! wikitext
23380 '''<small>[[Image:Foobar.jpg|right|300px]]</small>'''
23381 !! html/parsoid
23382 <p><b><small></small></b></p>
23383 <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>
23384 <p></p>
23385 !! end
23386
23387 #### ----------------------------------------------------------------
23388 #### Parsoid-only testing of Parsoid's impl of LST
23389 #### Not implemented yet, see
23390 #### https://www.mediawiki.org/wiki/Parsoid/HTML_based_LST
23391 #### ----------------------------------------------------------------
23392
23393 ## We still need to support serializing the older format while content is stored.
23394 !! test
23395 LST Sections: Backwards compatibility
23396 !! options
23397 parsoid={
23398 "suppressErrors": true,
23399 "modes": ["html2wt"]
23400 }
23401 !! wikitext
23402 <section begin="2011-05-16" />
23403 <section end="2014-04-10 (MW 1.23wmf22)" />
23404 !! html/parsoid
23405 <p><meta typeof="mw:Extension/LabeledSectionTransclusion/begin" content="2011-05-16"/>
23406 <meta typeof="mw:Extension/LabeledSectionTransclusion/end" content="2014-04-10 (MW 1.23wmf22)"/></p>
23407 !! end
23408
23409 ## The unconventional output is the result of `usePHPPreProcessor` being
23410 ## disabled in parserTests.js. This test is mainly just to show <section> is
23411 ## recognized as an extension tag w/o a native handler.
23412 !! test
23413 LST Sections: Newfangled approach
23414 !! wikitext
23415 <section begin="2011-05-16" />
23416 <section end="2014-04-10 (MW 1.23wmf22)" />
23417 !! html/parsoid
23418 <p><span typeof="mw:Error mw:Extension/section" about="#mwt1" data-mw='{"name":"section","attrs":{"begin":"2011-05-16"},"body":null,"errors":[{"key":"mw-api-extexpand-error","message":"Could not expand extension source."}]}'>&lt;section begin="2011-05-16" /></span>
23419 <span typeof="mw:Error mw:Extension/section" about="#mwt2" data-mw='{"name":"section","attrs":{"end":"2014-04-10 (MW 1.23wmf22)"},"body":null,"errors":[{"key":"mw-api-extexpand-error","message":"Could not expand extension source."}]}'>&lt;section end="2014-04-10 (MW 1.23wmf22)" /></span></p>
23420 !! end
23421
23422 #--------- Test stripping of empty nodes in template content ----------
23423 !!test
23424 Empty LI and TR nodes should be stripped from template content
23425 !!wikitext
23426 {{EmptyLITest}}
23427 {{EmptyTRTest}}
23428 !!html/parsoid
23429 <ul about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyLITest","href":"./Template:EmptyLITest"},"params":{},"i":0}}]}'>
23430 <li>a</li>
23431 <li>b</li>
23432 </ul>
23433 <table about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRTest","href":"./Template:EmptyTRTest"},"params":{},"i":0}}]}'>
23434 <tbody>
23435 <tr>
23436 <td>foo</td>
23437 </tr>
23438 <tr>
23439 <td>bar</td>
23440 </tr>
23441 </tbody>
23442 </table>
23443 !!end
23444
23445 !!test
23446 Empty LI and TR nodes should not be stripped from top-level content
23447 !!wikitext
23448 * a
23449 *
23450 * b
23451 {|
23452 |-
23453 |-
23454 |foo
23455 |}
23456 !!html/parsoid
23457 <ul>
23458 <li> a</li>
23459 <li></li>
23460 <li> b</li>
23461 </ul>
23462 <table>
23463 <tbody>
23464 <tr></tr>
23465 <tr>
23466 <td>foo</td>
23467 </tr>
23468 </tbody>
23469 </table>
23470 !!end
23471
23472 !!test
23473 Empty TR nodes should not be stripped if they have any attributes set
23474 !!wikitext
23475 {{EmptyTRWithHTMLAttrTest}}
23476 !!html/parsoid
23477 <table about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRWithHTMLAttrTest","href":"./Template:EmptyTRWithHTMLAttrTest"},"params":{},"i":0}}]}'>
23478 <tr align="center"></tr>
23479 <tr><td>foo</td></tr>
23480 <tr align="center"></tr>
23481 <tr><td>bar</td></tr>
23482 </table>
23483 !!end
23484
23485 #### ----------------------------------------------------------------
23486 #### The following section of tests are primarily to test
23487 #### wikitext escaping capabilities of Parsoid. Given that
23488 #### escaping can be done any number of ways, the wikitext (input)
23489 #### is always adjusted to reflect how Parsoid adds nowiki
23490 #### escape tags.
23491 ####
23492 #### We are marking several tests as parsoid-only since the
23493 #### HTML in the result section is different from what the
23494 #### PHP parser generates for it.
23495 #### ----------------------------------------------------------------
23496
23497
23498 #### --------------- Headings ---------------
23499 #### 0. Unnested
23500 #### 1. Nested inside html <h1>=foo=</h1>
23501 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
23502 #### 3. Nested inside html with wikitext split by html tags
23503 #### 4. No escape needed
23504 #### 5. Empty headings <h1></h1>
23505 #### 6. Heading chars in SOL context
23506 #### ----------------------------------------
23507 !! test
23508 Headings: 0. Unnested
23509 !! options
23510 parsoid=html2wt
23511 !! html/parsoid
23512 <p>=foo=</p>
23513
23514 <p> =foo=
23515 <!--cmt-->
23516 =foo=</p>
23517
23518 <p>=foo<i>a</i>=</p>
23519 !! wikitext
23520 <nowiki>=foo=</nowiki>
23521
23522 <nowiki> </nowiki>=foo=
23523 <!--cmt-->
23524 <nowiki>=foo=</nowiki>
23525
23526 =foo''a''<nowiki>=</nowiki>
23527 !!end
23528
23529 # New headings and existing headings are handled differently
23530 !! test
23531 Headings: 1. Nested inside html
23532 !! options
23533 parsoid=html2wt
23534 !! html/parsoid
23535 <h1>=foo=</h1>
23536 <h2>=foo=</h2>
23537 <h3>=foo=</h3>
23538
23539 <h1 data-parsoid=''>=foo=</h1>
23540 <h2 data-parsoid=''>=foo=</h2>
23541 <h3 data-parsoid=''>=foo=</h3>
23542 <h4 data-parsoid=''>=foo=</h4>
23543 <h5 data-parsoid=''>=foo=</h5>
23544 <h6 data-parsoid=''>=foo=</h6>
23545 !! wikitext
23546 = =foo= =
23547
23548 == =foo= ==
23549
23550 === =foo= ===
23551
23552 =<nowiki>=foo=</nowiki>=
23553 ==<nowiki>=foo=</nowiki>==
23554 ===<nowiki>=foo=</nowiki>===
23555 ====<nowiki>=foo=</nowiki>====
23556 =====<nowiki>=foo=</nowiki>=====
23557 ======<nowiki>=foo=</nowiki>======
23558
23559 !!end
23560
23561 !! test
23562 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
23563 !! options
23564 parsoid=html2wt
23565 !! html/parsoid
23566 <h1>foo</h1>*bar
23567 <h1>foo</h1>=bar
23568 <h1>foo</h1>=bar=
23569 !! wikitext
23570 = foo =
23571 <nowiki>*</nowiki>bar
23572
23573 = foo =
23574 =bar
23575
23576 = foo =
23577 <nowiki>=bar=</nowiki>
23578 !!end
23579
23580 !! test
23581 Headings: 3. Nested inside html with wikitext split by html tags
23582 !! options
23583 parsoid=html2wt
23584 !! html/parsoid
23585 <h1>=<b>bold</b>foo=</h1>
23586 !! wikitext
23587 = ='''bold'''foo= =
23588 !!end
23589
23590 !! test
23591 Headings: 4a. No escaping needed (testing just h1 and h2)
23592 !! options
23593 parsoid=html2wt
23594 !! html/parsoid
23595 <h1>=foo</h1>
23596 <h1>foo=</h1>
23597 <h1> =foo= </h1>
23598 <h1>=foo= bar</h1>
23599 <h2>=foo</h2>
23600 <h2>foo=</h2>
23601 <h1>=</h1>
23602 <h1><i>=</i>foo=</h1>
23603 !! wikitext
23604 = =foo =
23605
23606 = foo= =
23607
23608 = =foo= =
23609
23610 = =foo= bar =
23611
23612 == =foo ==
23613
23614 == foo= ==
23615
23616 = = =
23617
23618 = ''=''foo= =
23619 !!end
23620
23621 !! test
23622 Headings: 4b. No escaping needed (inside p-tags)
23623 !! options
23624 parsoid=html2wt
23625 !! html/parsoid
23626 <p>===
23627 =foo= x
23628 =foo= <s></s>
23629 </p>
23630 !! wikitext
23631 ===
23632 =foo= x
23633 =foo= <s></s>
23634 !!end
23635
23636 !! test
23637 Headings: 5. Empty headings
23638 !! options
23639 parsoid=html2wt
23640 !! html/parsoid
23641 <h1 data-parsoid='{}'></h1>
23642
23643 <h2 data-parsoid='{}'></h2>
23644
23645 <h3 data-parsoid='{}'></h3>
23646
23647 <h4 data-parsoid='{}'></h4>
23648
23649 <h5 data-parsoid='{}'></h5>
23650
23651 <h6 data-parsoid='{}'></h6>
23652 !! wikitext
23653 =<nowiki/>=
23654
23655 ==<nowiki/>==
23656
23657 ===<nowiki/>===
23658
23659 ====<nowiki/>====
23660
23661 =====<nowiki/>=====
23662
23663 ======<nowiki/>======
23664 !!end
23665
23666 !! test
23667 Headings: 6a. Heading chars in SOL context (with trailing spaces)
23668 !! options
23669 parsoid=html2wt
23670 !! html/parsoid
23671 <p>=a=</p>
23672
23673 <p>=a=</p>
23674
23675 <p>=a=</p>
23676 !! wikitext
23677 <nowiki>=a=</nowiki>
23678
23679 <nowiki>=a=</nowiki>
23680
23681 <nowiki>=a=</nowiki>
23682 !!end
23683
23684 !! test
23685 Headings: 6b. Heading chars in SOL context (with trailing newlines)
23686 !! options
23687 parsoid=html2wt
23688 !! html/parsoid
23689 <p>=a=
23690 b</p>
23691
23692 <p>=a=
23693 b</p>
23694
23695 <p>=a=
23696 b</p>
23697 !! wikitext
23698 <nowiki>=a=</nowiki>
23699 b
23700
23701 <nowiki>=a=</nowiki>
23702 b
23703
23704 <nowiki>=a=</nowiki>
23705 b
23706 !!end
23707
23708 !! test
23709 Headings: 6c. Heading chars in SOL context (leading newline break)
23710 !! options
23711 parsoid=html2wt
23712 !! html/parsoid
23713 <p>a
23714 =b=</p>
23715 !! wikitext
23716 a
23717 <nowiki>=b=</nowiki>
23718 !!end
23719
23720 !! test
23721 Headings: 6d. Heading chars in SOL context (with interspersed comments)
23722 !! options
23723 parsoid=html2wt
23724 !! html/parsoid
23725 <!--c0--><p>=a=</p>
23726
23727 <!--c1--><p>=a=</p> <!--c2--> <!--c3-->
23728 !! wikitext
23729 <!--c0--><nowiki>=a=</nowiki>
23730
23731 <!--c1--><nowiki>=a=</nowiki> <!--c2--> <!--c3-->
23732 !!end
23733
23734 !! test
23735 Headings: 6d. Heading chars in SOL context (No escaping needed)
23736 !! options
23737 parsoid=html2wt
23738 !! html/parsoid
23739 =a=<div>b</div>
23740 !! wikitext
23741 =a=<div>b</div>
23742 !!end
23743
23744 !! test
23745 Headings: 7. Insert a newline between new content and headings
23746 !! options
23747 parsoid=html2wt
23748 !! html/parsoid
23749 <h2>NEW</h2>
23750 <p>new</p>
23751 <h2 data-parsoid='{}'>A</h2>
23752 <p data-parsoid='{}'>a</p>
23753 !! wikitext
23754 == NEW ==
23755 new
23756
23757 ==A==
23758 a
23759
23760 !! end
23761
23762 #### --------------- Lists ---------------
23763 #### 0. Outside nests (*foo, etc.)
23764 #### 1. Nested inside html <ul><li>*foo</li></ul>
23765 #### 2. Inside definition lists
23766 #### 3. Only bullets at start should be escaped
23767 #### 4. No escapes needed
23768 #### 5. No unnecessary escapes
23769 #### 6. Escape bullets in SOL position
23770 #### 7. Escape bullets in a multi-line context
23771 #### ----------------------------------------
23772
23773 !! test
23774 Lists: 0. Outside nests
23775 !! options
23776 parsoid=html2wt
23777 !! html/parsoid
23778 <p>*foo</p>
23779
23780 <p>#foo</p>
23781
23782 <p>;Foo:bar</p>
23783 !! wikitext
23784 <nowiki>*</nowiki>foo
23785
23786 <nowiki>#</nowiki>foo
23787
23788 <nowiki>;</nowiki>Foo<nowiki>:</nowiki>bar
23789 !!end
23790
23791 ## Making these next 3 tests Parsoid-only since they are html2wt tests
23792 ## to test wikitext escaping, and insignificant whitespace diffs
23793 ## cause PHP parser tests to barf
23794 !! test
23795 Lists: 1. Nested inside html (No unnecessary escapes)
23796 !! options
23797 parsoid=html2wt
23798 !! html/parsoid
23799 <ul>
23800 <li>*foo</li>
23801 <li>#foo</li>
23802 <li>:foo</li>
23803 <li>;foo</li>
23804 <li data-parsoid='{}'>*foo</li>
23805 <li data-parsoid='{}'>#foo</li>
23806 <li data-parsoid='{}'>:foo</li>
23807 <li data-parsoid='{}'>;foo</li>
23808 </ul>
23809
23810 <ol>
23811 <li>*foo</li>
23812 <li>#foo</li>
23813 <li>:foo</li>
23814 <li>;foo</li>
23815 <li data-parsoid='{}'>*foo</li>
23816 <li data-parsoid='{}'>#foo</li>
23817 <li data-parsoid='{}'>:foo</li>
23818 <li data-parsoid='{}'>;foo</li>
23819 </ol>
23820 !! wikitext
23821 * *foo
23822 * #foo
23823 * :foo
23824 * ;foo
23825 *<nowiki>*foo</nowiki>
23826 *<nowiki>#foo</nowiki>
23827 *<nowiki>:foo</nowiki>
23828 *<nowiki>;foo</nowiki>
23829
23830 # *foo
23831 # #foo
23832 # :foo
23833 # ;foo
23834 #<nowiki>*foo</nowiki>
23835 #<nowiki>#foo</nowiki>
23836 #<nowiki>:foo</nowiki>
23837 #<nowiki>;foo</nowiki>
23838 !!end
23839
23840 !! test
23841 Lists: 2. Inside definition lists
23842 !! options
23843 parsoid=html2wt
23844 !! html/parsoid
23845 <dl><dt>;foo</dt></dl>
23846 <dl><dt>:foo</dt></dl>
23847 <dl><dt>:foo</dt>
23848 <dd>bar</dd></dl>
23849 <dl><dd>:foo</dd></dl>
23850 !! wikitext
23851 ; ;foo
23852
23853 ; <nowiki>:foo</nowiki>
23854
23855 ; <nowiki>:foo</nowiki>
23856 : bar
23857
23858 : :foo
23859 !!end
23860
23861 !! test
23862 Lists: 3. Only bullets at start of text in wikitext-generated HTML should be escaped
23863 !! options
23864 parsoid=html2wt
23865 !! html/parsoid
23866 <ul>
23867 <li>*foo*bar</li>
23868 <li data-parsoid='{}'>*foo<i>it</i>*bar</li>
23869 </ul>
23870 !! wikitext
23871 * *foo*bar
23872 *<nowiki>*foo</nowiki>''it''*bar
23873 !!end
23874
23875 !! test
23876 Lists: 4. No escapes needed
23877 !! options
23878 parsoid=html2wt
23879 !! html/parsoid
23880 <ul>
23881 <li>foo*bar
23882 </li>
23883 </ul>
23884 <ul>
23885 <li><i>foo</i>*bar
23886 </li>
23887 </ul>
23888 <ul>
23889 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>: bar
23890 </li>
23891 </ul>
23892 <ul>
23893 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>*bar
23894 </li>
23895 </ul>
23896 !! wikitext
23897 *foo*bar
23898
23899 *''foo''*bar
23900
23901 *[[Foo]]: bar
23902
23903 *[[Foo]]*bar
23904 !!end
23905
23906 !! test
23907 Lists: 5. No unnecessary escapes
23908 !! options
23909 parsoid=html2wt
23910 !! html/parsoid
23911 <ul><li> bar <span>[[foo]]</span></li></ul>
23912 <ul><li> =bar <span>[[foo]]</span></li></ul>
23913 <ul><li> [[bar <span>[[foo]]</span></li></ul>
23914 <ul><li> ]]bar <span>[[foo]]</span></li></ul>
23915 <ul><li> =bar <span>foo]]</span>=</li></ul>
23916 <ul><li> <s></s>: a</li></ul>
23917 <ul><li> <i>* foo</i></li></ul>
23918
23919 !! wikitext
23920 * bar <span><nowiki>[[foo]]</nowiki></span>
23921
23922 * =bar <span><nowiki>[[foo]]</nowiki></span>
23923
23924 * [[bar <span><nowiki>[[foo]]</nowiki></span>
23925
23926 * ]]bar <span><nowiki>[[foo]]</nowiki></span>
23927
23928 * =bar <span>foo]]</span>=
23929
23930 * <s></s>: a
23931
23932 * ''* foo''
23933 !!end
23934
23935 !! test
23936 Lists: 6. Escape bullets in SOL position
23937 !! options
23938 parsoid=html2wt
23939 !! html/parsoid
23940 <p><!--cmt-->*foo</p>
23941 !! wikitext
23942 <!--cmt--><nowiki>*</nowiki>foo
23943 !!end
23944
23945 !! test
23946 Lists: 7. Escape bullets in a multi-line context
23947 !! options
23948 parsoid=html2wt
23949 !! html/parsoid
23950 <p>a
23951 *b
23952 </p>
23953 !! wikitext
23954 a
23955 <nowiki>*</nowiki>b
23956 !!end
23957
23958 !! test
23959 Lists: 8. Escape colons only if not present in tags
23960 !! options
23961 parsoid=html2wt
23962 !! html/parsoid
23963 <dl><dt>a:b<i>c:d</i></dt></dl>
23964 !! wikitext
23965 ; <nowiki>a:b</nowiki>''c:d''
23966 !! end
23967
23968 #### --------------- HRs ---------------
23969 #### 1. Single line
23970 #### -----------------------------------
23971
23972 !! test
23973 HRs: 1. Single line
23974 !! options
23975 parsoid=html2wt
23976 !! html/parsoid
23977 <hr />----
23978 <hr />=foo=
23979 <hr />*foo
23980 !! wikitext
23981 ----<nowiki>----</nowiki>
23982 ----=foo=
23983 ----*foo
23984 !! end
23985
23986 #### --------------- Tables ---------------
23987 #### 1a. Simple example
23988 #### 1b. No escaping needed (!foo)
23989 #### 1c. No escaping needed (|foo)
23990 #### 1d. No escaping needed (|}foo)
23991 ####
23992 #### 2a. Nested in td (<td>foo|bar</td>)
23993 #### 2b. Nested in td (<td>foo||bar</td>)
23994 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
23995 ####
23996 #### 3a. Nested in th (<th>foo!bar</th>)
23997 #### 3b. Nested in th (<th>foo!!bar</th>)
23998 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
23999 ####
24000 #### 4a. Escape -
24001 #### 4b. Escape +
24002 #### 4c. No escaping needed
24003 #### --------------------------------------
24004
24005 !! test
24006 Tables: 1a. Simple example
24007 !! options
24008 parsoid=html2wt
24009 !! html/parsoid
24010 <p>{|
24011 |}
24012 </p>
24013 !! wikitext
24014 <nowiki>{|</nowiki>
24015 |}
24016 !! end
24017
24018 !! test
24019 Tables: 1b. No escaping needed
24020 !! options
24021 parsoid=html2wt
24022 !! html/parsoid
24023 <p>!foo
24024 </p>
24025 !! wikitext
24026 !foo
24027 !! end
24028
24029 !! test
24030 Tables: 1c. No escaping needed
24031 !! options
24032 parsoid=html2wt
24033 !! html/parsoid
24034 <p>|foo
24035 </p>
24036 !! wikitext
24037 |foo
24038 !! end
24039
24040 !! test
24041 Tables: 1d. No escaping needed
24042 !! options
24043 parsoid=html2wt
24044 !! html/parsoid
24045 <p>|}foo
24046 </p>
24047 !! wikitext
24048 |}foo
24049 !! end
24050
24051 !! test
24052 Tables: 2a. Nested in td
24053 !! options
24054 parsoid=html2wt
24055 !! html/parsoid
24056 <table><tbody><tr>
24057 <td>foo|bar</td></tr>
24058 <tr><td>x<div>a|b</div></td>
24059 </tbody></table>
24060 !! wikitext
24061 {|
24062 |<nowiki>foo|bar</nowiki>
24063 |-
24064 |x<div><nowiki>a|b</nowiki></div>
24065 |}
24066 !! html/php+tidy
24067 <table>
24068 <tr>
24069 <td>foo|bar</td>
24070 </tr>
24071 <tr>
24072 <td>x
24073 <div>a|b</div>
24074 </td>
24075 </tr>
24076 </table>
24077 !! end
24078
24079 !! test
24080 Tables: 2b. Nested in td
24081 !! options
24082 parsoid=html2wt
24083 !! html/parsoid
24084 <table><tbody><tr>
24085 <td>foo||bar</td>
24086 <td>a<i>b||c</i></td>
24087 <td>a<i><div>b||c</div></i></td>
24088 </tr></tbody></table>
24089 !! wikitext
24090 {|
24091 |<nowiki>foo||bar</nowiki>
24092 |a''<nowiki>b||c</nowiki>''
24093 |a''<div><nowiki>b||c</nowiki></div>''
24094 |}
24095 !! html/php
24096 <table>
24097 <tr>
24098 <td>foo||bar
24099 </td>
24100 <td>a<i>b||c</i>
24101 </td>
24102 <td>a<i><div>b||c</div></i>
24103 </td></tr></table>
24104
24105 !! end
24106
24107 !! test
24108 Tables: 2c. Nested in td -- no escaping needed
24109 !! options
24110 parsoid=html2wt
24111 !! html/*
24112 <table>
24113 <tr>
24114 <td>foo!!bar
24115 </td></tr></table>
24116
24117 !! wikitext
24118 {|
24119 |foo!!bar
24120 |}
24121 !! end
24122
24123 !! test
24124 Tables: 3a. Nested in th
24125 !! options
24126 parsoid=html2wt
24127 !! html/*
24128 <table>
24129 <tr>
24130 <th>foo!bar
24131 </th></tr></table>
24132
24133 !! wikitext
24134 {|
24135 !foo!bar
24136 |}
24137 !! end
24138
24139 !! test
24140 Tables: 3b. Nested in th
24141 !! options
24142 parsoid=html2wt
24143 !! html/parsoid
24144 <table><tbody>
24145 <tr><th>foo!!bar</th>
24146 <th><i>foo|bar</i></th>
24147 <th><i>foo!!bar</i></th>
24148 <th><i><span>foo!!bar</span></i></th>
24149 </tr></tbody></table>
24150 !! wikitext
24151 {|
24152 !<nowiki>foo!!bar</nowiki>
24153 !''<nowiki>foo|bar</nowiki>''
24154 !''<nowiki>foo!!bar</nowiki>''
24155 !''<span><nowiki>foo!!bar</nowiki></span>''
24156 |}
24157 !! html/php
24158 <table>
24159 <tr>
24160 <th>foo!!bar
24161 </th>
24162 <th><i>foo|bar</i>
24163 </th>
24164 <th><i>foo!!bar</i>
24165 </th>
24166 <th><i><span>foo!!bar</span></i>
24167 </th></tr></table>
24168
24169 !! end
24170
24171 !! test
24172 Tables: 3c. Nested in th
24173 !! options
24174 parsoid=html2wt
24175 !! html/parsoid
24176 <table><tbody>
24177 <tr><th>foo||bar</th>
24178 <th><span typeof="mw:Nowiki">foo||bar</span></th>
24179 </tr></tbody></table>
24180 !! wikitext
24181 {|
24182 !<nowiki>foo||bar</nowiki>
24183 !<nowiki>foo||bar</nowiki>
24184 |}
24185 !! html/php
24186 <table>
24187 <tr>
24188 <th>foo||bar
24189 </th>
24190 <th>foo||bar
24191 </th></tr></table>
24192
24193 !! end
24194
24195 !! test
24196 Tables: 4a. Escape -
24197 !! options
24198 parsoid=html2wt
24199 !! html/*
24200 <table>
24201 <tr>
24202 <th>-bar
24203 </th></tr>
24204 <tr>
24205 <td>-bar
24206 </td></tr></table>
24207
24208 !! wikitext
24209 {|
24210 !-bar
24211 |-
24212 |<nowiki>-bar</nowiki>
24213 |}
24214 !! end
24215
24216 !! test
24217 Tables: 4b. Escape +
24218 !! options
24219 parsoid=html2wt
24220 !! html/*
24221 <table>
24222 <tr>
24223 <th>+bar
24224 </th></tr>
24225 <tr>
24226 <td>+bar
24227 </td></tr></table>
24228
24229 !! wikitext
24230 {|
24231 !+bar
24232 |-
24233 |<nowiki>+bar</nowiki>
24234 |}
24235 !! end
24236
24237 !! test
24238 Tables: 4c. No escaping needed
24239 !! options
24240 parsoid=html2wt
24241 !! html/parsoid
24242 <table><tbody>
24243 <tr><td>foo-bar</td><td>foo+bar</td></tr>
24244 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
24245 <tr><td>foo
24246 <p>bar|baz
24247 +bar
24248 -bar</p></td></tr>
24249 <tr><td>x
24250 <div>a|b</div></td>
24251 </tbody></table>
24252 !! wikitext
24253 {|
24254 |foo-bar
24255 |foo+bar
24256 |-
24257 |''foo''-bar
24258 |''foo''+bar
24259 |-
24260 |foo
24261 bar|baz
24262 +bar
24263 -bar
24264 |-
24265 |x
24266 <div>a|b</div>
24267 |}
24268 !! html/php
24269 <table>
24270 <tr>
24271 <td>foo-bar
24272 </td>
24273 <td>foo+bar
24274 </td></tr>
24275 <tr>
24276 <td><i>foo</i>-bar
24277 </td>
24278 <td><i>foo</i>+bar
24279 </td></tr>
24280 <tr>
24281 <td>foo
24282 <p>bar|baz
24283 +bar
24284 -bar
24285 </p>
24286 </td></tr>
24287 <tr>
24288 <td>x
24289 <div>a|b</div>
24290 </td></tr></table>
24291
24292 !! end
24293
24294 !! test
24295 Tables: 4d. No escaping needed
24296 !! options
24297 parsoid=html2wt
24298 !! html/parsoid
24299 <table>
24300 <tbody><tr><td><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>-bar</td>
24301 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>+1</td>
24302 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>-2</td></tr>
24303 </tbody></table>
24304 !! wikitext
24305 {|
24306 |[[Foo]]-bar
24307 ||+1
24308 ||-2
24309 |}
24310 !! html/php
24311 <table>
24312 <tr>
24313 <td><a href="/wiki/Foo" title="Foo">Foo</a>-bar
24314 </td>
24315 <td>+1
24316 </td>
24317 <td>-2
24318 </td></tr></table>
24319
24320 !! end
24321
24322 !! test
24323 T97430: Don't emit empty nowiki pairs around marker meta tags
24324 !! options
24325 parsoid=html2wt
24326 !! html/parsoid
24327 <p>*This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
24328 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.</p>
24329 !! wikitext
24330 <nowiki>*</nowiki>This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
24331 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.
24332 !! end
24333
24334 !! test
24335 Unclosed xmlish element in table line shouldn't eat end delimiters
24336 !! options
24337 parsoid=html2wt
24338 !! html/parsoid
24339 <table>
24340 <tbody><tr><td> &lt;foo</td>
24341 <td> bar></td></tr>
24342 </tbody></table>
24343 !! wikitext
24344 {|
24345 | <foo
24346 | bar>
24347 |}
24348 !! html/php
24349 <table>
24350 <tr>
24351 <td> &lt;foo
24352 </td>
24353 <td> bar&gt;
24354 </td></tr></table>
24355
24356 !! end
24357
24358 #### --------------- Links ----------------
24359 #### 1. Quote marks in link text
24360 #### 2. Wikilinks: Escapes needed
24361 #### 3. Wikilinks: No escapes needed
24362 #### 4. Extlinks: Escapes needed
24363 #### 5. Extlinks: No escapes needed
24364 #### --------------------------------------
24365 !! test
24366 Links 1. WikiLinks: No escapes needed
24367 !! options
24368 parsoid=html2wt
24369 !! html/parsoid
24370 <p><a rel="mw:WikiLink" href="Foo" title="Foo">Foo<i>boo</i></a>
24371 <a rel="mw:WikiLink" href="Foo" title="Foo">[Foobar]</a>
24372 <a rel="mw:WikiLink" href="Foo" title="Foo">x [Foobar] x</a></p>
24373 !! wikitext
24374 [[Foo|Foo''boo'']]
24375 [[Foo|[Foobar]]]
24376 [[Foo|x [Foobar] x]]
24377 !! html/php
24378 <p><a href="/wiki/Foo" title="Foo">Foo<i>boo</i></a>
24379 <a href="/wiki/Foo" title="Foo">[Foobar]</a>
24380 <a href="/wiki/Foo" title="Foo">x [Foobar] x</a>
24381 </p>
24382 !! end
24383
24384 !! test
24385 Links 2. WikiLinks: Escapes needed
24386 !! options
24387 parsoid=html2wt
24388 !! html/parsoid
24389 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
24390 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
24391 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
24392 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
24393 <a href="Foo" rel="mw:WikiLink">|Bar</a>
24394 <a href="Foo" rel="mw:WikiLink">]]bar</a>
24395 <a href="Foo" rel="mw:WikiLink">[[bar</a>
24396 <a href="Foo" rel="mw:WikiLink">x [[ y</a>
24397 <a href="Foo" rel="mw:WikiLink">x ]] y</a>
24398 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
24399 !! wikitext
24400 [[Foo|<nowiki>Foobar]</nowiki>]]
24401 [[Foo|x <nowiki>[http://google.com g]</nowiki> x]]
24402 [[Foo|<nowiki>[[Bar]]</nowiki>]]
24403 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
24404 [[Foo|<nowiki>|Bar</nowiki>]]
24405 [[Foo|<nowiki>]]bar</nowiki>]]
24406 [[Foo|<nowiki>[[bar</nowiki>]]
24407 [[Foo|<nowiki>x [[ y</nowiki>]]
24408 [[Foo|<nowiki>x ]] y</nowiki>]]
24409 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
24410 !! html/php
24411 <p><a href="/wiki/Foo" title="Foo">Foobar]</a>
24412 <a href="/wiki/Foo" title="Foo">x [http://google.com g] x</a>
24413 <a href="/wiki/Foo" title="Foo">[[Bar]]</a>
24414 <a href="/wiki/Foo" title="Foo">x [[Bar]] x</a>
24415 <a href="/wiki/Foo" title="Foo">|Bar</a>
24416 <a href="/wiki/Foo" title="Foo">]]bar</a>
24417 <a href="/wiki/Foo" title="Foo">[[bar</a>
24418 <a href="/wiki/Foo" title="Foo">x [[ y</a>
24419 <a href="/wiki/Foo" title="Foo">x ]] y</a>
24420 <a href="/wiki/Foo" title="Foo">x ]] y [[ z</a>
24421 </p>
24422 !! end
24423
24424 !! test
24425 Links 3. WikiLinks: No escapes needed
24426 !! options
24427 parsoid=html2wt
24428 !! html/parsoid
24429 <p><a rel="mw:WikiLink" href="Foo">[Foobar</a>
24430 <a rel="mw:WikiLink" href="Foo" title="Foo">foo|bar</a></p>
24431 !! wikitext
24432 [[Foo|[Foobar]]
24433 [[Foo|foo|bar]]
24434 !! html/php
24435 <p><a href="/wiki/Foo" title="Foo">[Foobar</a>
24436 <a href="/wiki/Foo" title="Foo">foo|bar</a>
24437 </p>
24438 !! end
24439
24440 !! test
24441 Links 4. ExtLinks: Escapes needed
24442 !! options
24443 parsoid=html2wt
24444 !! html/parsoid
24445 <p><a rel="mw:ExtLink" href="http://google.com">[google]</a>
24446 <a rel="mw:ExtLink" href="http://google.com">google]</a>
24447 <a rel="mw:ExtLink" href="http://google.com">goog] le</a></p>
24448 <p>[http://google.com]</p>
24449 <p>[http://google.com google]</p>
24450 <p>[<a rel="mw:ExtLink" href="http://google.com">http://google.com</a>]</p>
24451 <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>
24452 !! wikitext
24453 [http://google.com <nowiki>[google]</nowiki>]
24454 [http://google.com <nowiki>google]</nowiki>]
24455 [http://google.com <nowiki>goog] le</nowiki>]
24456
24457 <nowiki>[http://google.com]</nowiki>
24458
24459 <nowiki>[http://google.com google]</nowiki>
24460
24461 [http://google.com<nowiki>]</nowiki>
24462
24463 [{{echo|http://google.com}}<nowiki>]</nowiki>
24464 !! html/php
24465 <p><a rel="nofollow" class="external text" href="http://google.com">[google]</a>
24466 <a rel="nofollow" class="external text" href="http://google.com">google]</a>
24467 <a rel="nofollow" class="external text" href="http://google.com">goog] le</a>
24468 </p><p>[http://google.com]
24469 </p><p>[http://google.com google]
24470 </p><p>[<a rel="nofollow" class="external free" href="http://google.com">http://google.com</a>]
24471 </p><p>[<a rel="nofollow" class="external free" href="http://google.com">http://google.com</a>]
24472 </p>
24473 !! end
24474
24475 !! test
24476 Links 5. ExtLinks: No escapes needed
24477 !! options
24478 parsoid=html2wt
24479 !! html/parsoid
24480 <p><a rel="mw:ExtLink" href="http://google.com">[google</a></p>
24481 <p>[<a ref="mw:ExtLink" href="http://google.com"></a>]</p>
24482 !! wikitext
24483 [http://google.com [google]
24484
24485 [[http://google.com]]
24486 !! html/php
24487 <p><a rel="nofollow" class="external text" href="http://google.com">[google</a>
24488 </p><p>[<a rel="nofollow" class="external autonumber" href="http://google.com">[1]</a>]
24489 </p>
24490 !! end
24491
24492 !! test
24493 Links 6. Add <nowiki/>s between text-nodes and url-links when required (T66300)
24494 !! options
24495 parsoid=html2wt
24496 !! html/parsoid
24497 <p>x<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>y
24498 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>?x
24499 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>&amp;x
24500 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>'x
24501 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,x
24502 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.x
24503 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
24504 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>:x
24505 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
24506 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>!x
24507 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>=x
24508 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>(x)
24509 <a rel="mw:ExtLink" href="http://example.com(x" data-parsoid='{"stx":"url"}'>http://example.com(x</a>)
24510 </p>
24511 !! wikitext
24512 x<nowiki/>http://example.com<nowiki/>y
24513 http://example.com<nowiki/>?x
24514 http://example.com<nowiki/>&x
24515 http://example.com<nowiki/>'x
24516 http://example.com<nowiki/>,x
24517 http://example.com<nowiki/>.x
24518 http://example.com<nowiki/>;x
24519 http://example.com<nowiki/>:x
24520 http://example.com<nowiki/>;x
24521 http://example.com<nowiki/>!x
24522 http://example.com<nowiki/>=x
24523 http://example.com<nowiki/>(x)
24524 http://example.com(x<nowiki/>)
24525 !! end
24526
24527 !! test
24528 Links 7a. Don't add spurious <nowiki/>s between text-nodes and url-links (T66300)
24529 !! options
24530 parsoid=html2wt
24531 !! html/parsoid
24532 <p>x
24533 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>
24534 y
24535 "<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>"
24536 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>)
24537 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>) foo
24538 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,
24539 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>, foo
24540 </p>
24541 !! wikitext
24542 x
24543 http://example.com
24544 y
24545 "http://example.com"
24546 (http://example.com)
24547 (http://example.com) foo
24548 http://example.com,
24549 http://example.com, foo
24550 !! html/php
24551 <p>x
24552 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
24553 y
24554 "<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>"
24555 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
24556 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>) foo
24557 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
24558 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>, foo
24559 </p>
24560 !! end
24561
24562 !! test
24563 Links 7b. Don't add spurious <nowiki/>s between text-nodes and url-links (T66300)
24564 !! options
24565 parsoid=html2wt
24566 !! html/parsoid
24567 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.,;:!?\
24568 -<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:</p>
24569 !! wikitext
24570 http://example.com.,;:!?\
24571 -http://example.com:
24572 !! html/php
24573 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.,;:!?\
24574 -<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
24575 </p>
24576 !! end
24577
24578 !! test
24579 Links 8. Add <nowiki/>s between text-nodes and RFC-links when required (T66300)
24580 !! options
24581 parsoid=html2wt
24582 !! html/parsoid
24583 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>4
24584 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
24585 X<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y</p>
24586 !! wikitext
24587 RFC 123<nowiki/>4
24588 RFC 123<nowiki/>y
24589 X<nowiki/>RFC 123<nowiki/>y
24590 !! end
24591
24592 !! test
24593 Links 9. Don't add spurious <nowiki/>s between text-nodes and RFC-links (T66300)
24594 !! options
24595 parsoid=html2wt
24596 !! html/parsoid
24597 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>?foo
24598 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>&amp;foo
24599 -<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>-
24600 </p>
24601 !! wikitext
24602 RFC 123?foo
24603 RFC 123&foo
24604 -RFC 123-
24605 !! html/php
24606 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>?foo
24607 <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>&amp;foo
24608 -<a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>-
24609 </p>
24610 !! end
24611
24612 !! test
24613 Links 10. Add <nowiki/>s between text-nodes and PMID-links when required (T66300)
24614 !! options
24615 parsoid=html2wt
24616 !! html/parsoid
24617 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>4
24618 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
24619 X<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
24620 !! wikitext
24621 PMID 123<nowiki/>4
24622 PMID 123<nowiki/>y
24623 X<nowiki/>PMID 123<nowiki/>y
24624 !! end
24625
24626 !! test
24627 Links 11. Don't add spurious <nowiki/>s between text-nodes and PMID-links (T66300)
24628 !! options
24629 parsoid=html2wt
24630 !! html/parsoid
24631 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>?foo
24632 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>&foo
24633 -<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>-
24634 </p>
24635 !! wikitext
24636 PMID 123?foo
24637 PMID 123&foo
24638 -PMID 123-
24639 !! html/php
24640 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>?foo
24641 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>&amp;foo
24642 -<a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>-
24643 </p>
24644 !! end
24645
24646 !! test
24647 Links 12. Add <nowiki/>s between text-nodes and ISBN-links when required (T66300)
24648 !! options
24649 parsoid=html2wt
24650 !! html/parsoid
24651 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>1
24652 <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>x
24653 a<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>b
24654 </p>
24655 !! wikitext
24656 ISBN 1234567890<nowiki/>1
24657 ISBN 1234567890<nowiki/>x
24658 a<nowiki/>ISBN 1234567890<nowiki/>b
24659 !! end
24660
24661 !! test
24662 Links 13. Don't add spurious <nowiki/>s between text-nodes and ISBN-links (T66300)
24663 !! options
24664 parsoid=html2wt
24665 !! html/parsoid
24666 <p>-<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>'s
24667 !! wikitext
24668 -ISBN 1234567890's
24669 !! html/php
24670 <p>-<a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>'s
24671 </p>
24672 !! end
24673
24674 !! test
24675 Links 14. Protect link-like plain text. (Parsoid bug T78425)
24676 !! options
24677 parsoid=html2wt
24678 !! html/*
24679 <p>this is not a link: http://example.com
24680 </p>
24681 !! wikitext
24682 this is not a link: <nowiki>http://example.com</nowiki>
24683 !! end
24684
24685 !! test
24686 Links 15. Link trails can't become link prefixes.
24687 !! options
24688 language=is
24689 parsoid=html2wt
24690 !! html/parsoid
24691 <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>
24692 !! wikitext
24693 [[Söfnuður]]-[[00]]
24694 !! html/php
24695 <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>
24696 </p>
24697 !! end
24698
24699 #### --------------- Quotes ---------------
24700 #### 1. Quotes inside <b> and <i>
24701 #### 2. Link fragments separated by <i> and <b> tags
24702 #### 3. Link fragments inside <i> and <b>
24703 #### 4. No escaping needed
24704 #### --------------------------------------
24705 !! test
24706 1a. Quotes inside <b> and <i>
24707 !! options
24708 parsoid=html2wt
24709 !! html/*
24710 <p><i>'foo'</i>
24711 <i>''foo''</i>
24712 <i>'''foo'''</i>
24713 <i>foo</i>'s
24714 <b>'foo'</b>
24715 <b>''foo''</b>
24716 <b>'''foo'''</b>
24717 <b>foo'<i>bar'</i>baz</b>
24718 <b>foo</b>'s
24719 '<i>foo</i>
24720 <i>foo</i>'
24721 <i>foo'</i>'
24722 '<i>foo</i>'
24723 '<b>foo</b>
24724 <b>foo</b>'
24725 '<b>foo</b>'
24726 <i>fools'<span> errand</span></i>
24727 <i><span>fool</span>'s errand</i>
24728 '<i>foo</i> bar '<i>baz</i>
24729 a|!*#-:;+-~[]{}b'<i>x</i>
24730 </p>
24731 !! wikitext
24732 ''<nowiki/>'foo'''
24733 ''<nowiki>''foo''</nowiki>''
24734 ''<nowiki>'''foo'''</nowiki>''
24735 ''foo''<nowiki/>'s
24736 '''<nowiki/>'foo''''
24737 '''<nowiki>''foo''</nowiki>'''
24738 '''<nowiki>'''foo'''</nowiki>'''
24739 '''foo'<nowiki/>''bar'<nowiki/>''baz'''
24740 '''foo'''<nowiki/>'s
24741 '''foo''
24742 ''foo''<nowiki/>'
24743 ''foo'''<nowiki/>'
24744 '''foo''<nowiki/>'
24745 ''''foo'''
24746 '''foo'''<nowiki/>'
24747 ''''foo'''<nowiki/>'
24748 ''fools'<span> errand</span>''
24749 ''<span>fool</span>'s errand''
24750 '<nowiki/>''foo'' bar '''baz''
24751 a|!*#-:;+-~[]{}b'''x''
24752 !! end
24753
24754 !! test
24755 1b. Quotes inside <b> and <i> with other tags on same line
24756 !! options
24757 parsoid=html2wt
24758 !! html/parsoid
24759 '<i>a</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
24760 <i>a'</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
24761 <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>
24762 <a rel="mw:WikiLink" href="Foo" title="Foo">foo</a> x'<i><a href="Bar" rel="mw:WikiLink" title="Bar">bar</a></i>
24763 '<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>
24764 '<i>foo</i> <div title="name">test</div>
24765 '<i>foo</i> and <br data-parsoid='{"stx":"html","noClose":true}'/> bar
24766 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
24767 <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>
24768 </ol>
24769 !! wikitext
24770 '''a'' foo ''[[bar]]''
24771 ''a''' foo ''[[bar]]''
24772 ''a''' foo '''{{echo|[[bar]]}}'''
24773 [[foo]] x'''[[bar]]''
24774 '''foo'' <ref>test</ref>
24775 '''foo'' <div title="name">test</div>
24776 '''foo'' and <br> bar
24777 <references />
24778 !! end
24779
24780 !! test
24781 2. Link fragments separated by <i> and <b> tags
24782 !! options
24783 parsoid=html2wt
24784 !! html/parsoid
24785 <p>[[<i>foo</i>hello]]</p>
24786 <p>[[<b>foo</b>hello]]</p>
24787 !! wikitext
24788 [[''foo''<nowiki>hello]]</nowiki>
24789
24790 [['''foo'''<nowiki>hello]]</nowiki>
24791 !! end
24792
24793 # FIXME: Escaping one or both of [[ and ]] is also acceptable --
24794 # this is one of the shortcomings of this format
24795 !! test
24796 3. Link fragments inside <i> and <b>
24797 !! options
24798 parsoid=html2wt
24799 !! html/parsoid
24800 <p><i>[[foo</i>]]</p>
24801 <p><b>[[foo</b>]]</p>
24802 !! wikitext
24803 ''[[foo''<nowiki>]]</nowiki>
24804
24805 '''[[foo'''<nowiki>]]</nowiki>
24806 !! end
24807
24808 !! test
24809 4. No escaping needed
24810 !! options
24811 parsoid=html2wt
24812 !! html/parsoid
24813 <p>'<span><i>bar</i></span>'
24814 '<span><b>bar</b></span>'
24815 'a:b'foo
24816 </p>
24817 !! wikitext
24818 '<span>''bar''</span>'
24819 '<span>'''bar'''</span>'
24820 'a:b'foo
24821 !! end
24822
24823 #### ----------- Paragraphs ---------------
24824 #### 1. No unnecessary escapes
24825 #### --------------------------------------
24826
24827 !! test
24828 1. No unnecessary escapes
24829 !! options
24830 parsoid=html2wt
24831 !! html/parsoid
24832 <p>bar <span>[[foo]]</span>
24833 </p><p>=bar <span>[[foo]]</span>
24834 </p><p>[[bar <span>[[foo]]</span>
24835 </p><p>]]bar <span>[[foo]]</span>
24836 </p><p>=bar <span>foo]]</span>=
24837 </p>
24838 !! wikitext
24839 bar <span><nowiki>[[foo]]</nowiki></span>
24840
24841 =bar <span><nowiki>[[foo]]</nowiki></span>
24842
24843 [[bar <span><nowiki>[[foo]]</nowiki></span>
24844
24845 ]]bar <span><nowiki>[[foo]]</nowiki></span>
24846
24847 =bar <span>foo]]</span><nowiki>=</nowiki>
24848 !!end
24849
24850 #### ----------------------- PRE --------------------------
24851 #### 1. Leading whitespace in SOL context should be escaped
24852 #### ------------------------------------------------------
24853 !! test
24854 1. Leading whitespace in SOL context should be escaped
24855 !! options
24856 parsoid=html2wt
24857 !! html/parsoid
24858 <p> a</p>
24859
24860 <p> a</p>
24861
24862 <p> a(tab)</p>
24863
24864 <p> a
24865 <!--cmt-->
24866 a</p>
24867
24868 <p>a
24869 b</p>
24870
24871 <p>a
24872 b</p>
24873
24874 <p>a
24875 b</p>
24876 !! wikitext
24877 <nowiki> </nowiki>a
24878
24879 <nowiki> </nowiki> a
24880
24881 a(tab)
24882
24883 <nowiki> </nowiki> a
24884 <!--cmt-->
24885 <nowiki> </nowiki>a
24886
24887 a
24888 <nowiki> </nowiki>b
24889
24890 a
24891 b
24892
24893 a
24894 b
24895 !! html/php
24896 <p> a
24897 </p><p> a
24898 </p><p> a(tab)
24899 </p><p> a
24900 a
24901 </p><p>a
24902 b
24903 </p><p>a
24904 b
24905 </p><p>a
24906 b
24907 </p>
24908 !! end
24909
24910 !! test
24911 2. Leading whitespace in non-indent-pre contexts should not be escaped
24912 !! options
24913 parsoid=html2wt
24914 !! html/parsoid
24915 <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>
24916 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
24917 <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>
24918 b</span></li>
24919 </ol>
24920 !! wikitext
24921 foo <ref>''a''
24922 b</ref>
24923 <references />
24924 !! end
24925
24926 !! test
24927 3. Leading whitespace in indent-pre suppressing contexts should not be escaped
24928 !! options
24929 parsoid=html2wt
24930 !! html/parsoid
24931 <blockquote>
24932 <p>
24933 a
24934 <span>b</span>
24935 c</p>
24936 </blockquote>
24937 !! wikitext
24938 <blockquote>
24939 a
24940 <span>b</span>
24941 c
24942 </blockquote>
24943 !! end
24944
24945 !! test
24946 4. Leading whitespace in indent-pre suppressing contexts should not be escaped
24947 !! options
24948 parsoid=html2wt
24949 !! html/parsoid
24950 <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>
24951 !! wikitext
24952 [[File:Foobar.jpg|thumb|caption]]
24953 !! end
24954
24955 !! test
24956 5. Nowiki escaping should account for indent-pres
24957 !! options
24958 parsoid=html2wt
24959 !! html/parsoid
24960 <pre>==foo==</pre>
24961 !! wikitext
24962 ==foo==
24963 !! end
24964
24965 !!test
24966 T95794: nowiki escaping should account for leading space at start-of-line in an indent-pre block
24967 !! options
24968 parsoid=html2wt
24969 !! html/parsoid
24970 <pre>
24971 * foo
24972 * bar
24973 </pre>
24974 !! wikitext
24975 * foo
24976 * bar
24977 !! end
24978
24979 #### --------------- Behavior Switches --------------------
24980
24981 !! test
24982 1. Valid behavior switches should be escaped
24983 !! options
24984 parsoid=html2wt
24985 !! html/parsoid
24986 __TOC__
24987 <i>__TOC__</i>
24988 !! wikitext
24989 <nowiki>__TOC__</nowiki>
24990 ''<nowiki>__TOC__</nowiki>''
24991 !! end
24992
24993 !! test
24994 2. Invalid behavior switches should not be escaped
24995 !! options
24996 parsoid=html2wt
24997 !! html/parsoid
24998 __TOO__
24999 __|__
25000 !! wikitext
25001 __TOO__
25002 __|__
25003 !! end
25004
25005 # We use indent-pre as an indirect way to test for sol-transparent behavior.
25006 !! test
25007 Behavior switches should be SOL-transparent
25008 !! options
25009 parsoid=html2wt
25010 !! html/parsoid
25011 <meta property="mw:PageProp/toc" />
25012
25013 <!-- this one's bogus -->
25014 <pre>__TOO__</pre>
25015
25016 <pre data-parsoid='{}'><meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/> foo</pre>
25017
25018 <meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/><pre data-parsoid='{}'>bar</pre>
25019 !! wikitext
25020 __TOC__
25021
25022 <!-- this one's bogus -->
25023 __TOO__
25024
25025 __TOC__ foo
25026
25027 __TOC__
25028 bar
25029 !! end
25030
25031 #### --------------- HTML tags ---------------
25032 #### 1. a tags
25033 #### 2. other tags
25034 #### 3. multi-line html tag
25035 #### 4. extension tags
25036 #### -----------------------------------------
25037 !! test
25038 1. a tags
25039 !! options
25040 parsoid=html2wt
25041 !! html/parsoid
25042 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
25043 !! wikitext
25044 <a href="http://google.com">google</a>
25045 !! end
25046
25047 !! test
25048 2. other tags
25049 !! options
25050 parsoid=html2wt
25051 !! html/parsoid
25052 <ul><li> &lt;div&gt;foo&lt;/div&gt;</li>
25053 <li> &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;</li>
25054 <li> &lt;td&gt;</li></ul>
25055
25056 !! wikitext
25057 * <nowiki><div>foo</div></nowiki>
25058 * <nowiki><div style="color:red">foo</div></nowiki>
25059 * <nowiki><td></nowiki>
25060 !! end
25061
25062 !! test
25063 3. multi-line html tag
25064 !! options
25065 parsoid=html2wt
25066 !! html/parsoid
25067 <p>&lt;div
25068 &gt;foo&lt;/div
25069 &gt;
25070 </p>
25071 !! wikitext
25072 <nowiki><div
25073 >foo</div
25074 ></nowiki>
25075 !! end
25076
25077 !! test
25078 4. extension tags
25079 !! options
25080 parsoid=html2wt
25081 !! html/parsoid
25082 <p>&lt;ref&gt;foo&lt;/ref&gt;
25083 </p><p>&lt;ref&gt;bar
25084 </p><p>baz&lt;/ref&gt;
25085 </p>
25086 !! wikitext
25087 <nowiki><ref>foo</ref></nowiki>
25088
25089 <nowiki><ref>bar</nowiki>
25090
25091 baz<nowiki></ref></nowiki>
25092 !! end
25093
25094 #### --------------- Others ---------------
25095 !! test
25096 Escaping nowikis
25097 !! options
25098 parsoid=html2wt
25099 !! html/parsoid
25100 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
25101 </p>
25102 !! wikitext
25103 &lt;nowiki&gt;foo&lt;/nowiki&gt;
25104 !! end
25105
25106 ## The quote-char in the input is necessary for triggering the bug
25107 !! test
25108 (T54035) Nowiki-escaping should not get tripped by " :" in text
25109 !! options
25110 parsoid=html2wt
25111 !! html/parsoid
25112 <p>foo's bar :</p>
25113 !! wikitext
25114 foo's bar :
25115 !! end
25116
25117 #----------- End of wikitext escaping tests --------------
25118
25119 !! test
25120
25121 Tag-like HTML structures are passed through as text
25122 !! wikitext
25123 <x y>
25124
25125 <x.y>
25126
25127 <x-y>
25128
25129 1>2
25130
25131 x<y
25132
25133 a>b
25134
25135 1<d e>f
25136 !! html
25137 <p>&lt;x y&gt;
25138 </p><p>&lt;x.y&gt;
25139 </p><p>&lt;x-y&gt;
25140 </p><p>1&gt;2
25141 </p><p>x&lt;y
25142 </p><p>a&gt;b
25143 </p><p>1&lt;d e&gt;f
25144 </p>
25145 !! end
25146
25147 !! test
25148 HTML tag with necessary entities in attributes
25149 !! wikitext
25150 <span title="&amp;amp;">foo</span>
25151 !! html
25152 <p><span title="&amp;amp;">foo</span>
25153 </p>
25154 !! end
25155
25156 !! test
25157 HTML tag with 'unnecessary' entity encoding in attributes
25158 !! wikitext
25159 <span title="&amp;">foo</span>
25160 !! html
25161 <p><span title="&amp;">foo</span>
25162 </p>
25163 !! end
25164
25165 !! test
25166 HTML tag with broken attribute value quoting
25167 !! options
25168 parsoid=wt2html,html2html
25169 !! wikitext
25170 <span title="Hello world>Foo</span>
25171 !! html/php
25172 <p><span title="Hello world">Foo</span>
25173 </p>
25174 !! html/parsoid
25175 <p><span title="Hello world">Foo</span></p>
25176 !! end
25177
25178 !! test
25179 Self-closed tag with broken attribute value quoting
25180 !! options
25181 parsoid=wt2html,html2html
25182 !! wikitext
25183 <div title="Hello world />Foo
25184 !! html/php+tidy
25185 <div title="Hello world"></div>
25186 <p>Foo</p>
25187 !! html/parsoid
25188 <div title="Hello world " data-parsoid='{"stx":"html","selfClose":true}'></div><p>Foo</p>
25189 !! end
25190
25191 !! test
25192 Table with broken attribute value quoting
25193 !! options
25194 parsoid=wt2html,html2html
25195 !! wikitext
25196 {|
25197 | title="Hello world|Foo
25198 |}
25199 !! html/php
25200 <table>
25201 <tr>
25202 <td title="Hello world">Foo
25203 </td></tr></table>
25204
25205 !! html/parsoid
25206 <table>
25207 <tr>
25208 <td title="Hello world">Foo
25209 </td></tr></table>
25210
25211 !! end
25212
25213 !! test
25214 Table with broken attribute value quoting on consecutive lines
25215 !! options
25216 parsoid=wt2html,html2html
25217 !! wikitext
25218 {|
25219 | title="Hello world|Foo
25220 | style="color:red|Bar
25221 |}
25222 !! html/php
25223 <table>
25224 <tr>
25225 <td title="Hello world">Foo
25226 </td>
25227 <td style="color:red">Bar
25228 </td></tr></table>
25229
25230 !! html/parsoid
25231 <table><tbody>
25232 <tr>
25233 <td title="Hello world">Foo
25234 </td><td style="color: red">Bar
25235 </td></tr></tbody></table>
25236
25237 !! end
25238
25239 !!test
25240 Accept empty td cell attribute
25241 !! wikitext
25242 {|
25243 | align="center" | foo || |
25244 |}
25245 !! html
25246 <table>
25247 <tr>
25248 <td align="center"> foo </td>
25249 <td>
25250 </td></tr></table>
25251
25252 !!end
25253
25254 !!test
25255 Non-empty attributes in th-cells
25256 !! wikitext
25257 {|
25258 ! Foo !! style="color: red" | Bar
25259 |}
25260 !! html
25261 <table>
25262 <tr>
25263 <th> Foo </th>
25264 <th style="color: red"> Bar
25265 </th></tr></table>
25266
25267 !!end
25268
25269 !!test
25270 Accept empty attributes in th-cells
25271 !! wikitext
25272 {|
25273 !| foo !!| bar
25274 |}
25275 !! html
25276 <table>
25277 <tr>
25278 <th> foo </th>
25279 <th> bar
25280 </th></tr></table>
25281
25282 !!end
25283
25284 !!test
25285 Empty table rows go away
25286 !! wikitext
25287 {|
25288 | Hello
25289 | there
25290 |- class="foo"
25291 |-
25292 |}
25293 !! html
25294 <table>
25295 <tr>
25296 <td> Hello
25297 </td>
25298 <td> there
25299 </td></tr>
25300
25301 </table>
25302
25303 !! end
25304
25305 ###
25306 ### Parsoid-centric tests for testing RTing of inter-element separators
25307 ### Edge cases not tested by existing parser tests and specific to
25308 ### Parsoid-specific serialization strategies.
25309 ###
25310
25311 !!test
25312 RT-ed inter-element separators should be valid separators
25313 !! wikitext
25314 {|
25315 |- [[foo]]
25316 |}
25317 !! html/php
25318 <table>
25319
25320 </table>
25321
25322 !! html/parsoid
25323 <table>
25324 <tbody><tr data-parsoid='{"startTagSrc":"|-","a":{"[[foo]]":null},"sa":{"[[foo]]":""},"autoInsertedEnd":true}'></tr>
25325 </tbody></table>
25326 !!end
25327
25328 # Parsoid-only since PHP parser relies on Tidy for correct output
25329 !!test
25330 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
25331 !!options
25332 parsoid
25333 !! wikitext
25334 {|
25335 |<small>foo
25336 bar
25337 |}
25338
25339 {|
25340 |<small>foo<small>
25341 |}
25342 !! html
25343 <table>
25344 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'>foo
25345 <p>bar</p></small></td></tr>
25346 </tbody></table>
25347
25348 <table>
25349 <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>
25350 </tbody></table>
25351 !!end
25352
25353 # Note that the "style" attribute is really a template parameter here.
25354 # The = would have to be {{=}} if you wanted the literal.
25355 !!test
25356 Empty TD followed by TD with tpl-generated attribute
25357 !! wikitext
25358 {|
25359 |-
25360 |
25361 |{{echo|style='color:red'}}|foo
25362 |}
25363 !! html
25364 <table>
25365
25366 <tr>
25367 <td>
25368 </td>
25369 <td>foo
25370 </td></tr></table>
25371
25372 !!end
25373
25374 !!test
25375 Indented table with an empty td
25376 !! wikitext
25377 {|
25378 |-
25379 |
25380 |foo
25381 |}
25382 !! html
25383 <table>
25384
25385 <tr>
25386 <td>
25387 </td>
25388 <td>foo
25389 </td></tr></table>
25390
25391 !!end
25392
25393 ## We have some newline diffs RT-ing this edge case
25394 ## and it is not important enough -- we seem to be emitting
25395 ## at most 2 newlines after a </tr> and this is unrelated to
25396 ## the issue from T85627 that this is testing.
25397 !!test
25398 Indented table with blank lines in between (T85627)
25399 !! options
25400 parsoid=wt2html
25401 !! wikitext
25402 {|
25403 |foo
25404
25405
25406 |}
25407 !! html
25408 <table>
25409
25410 <tr>
25411 <td>foo
25412 </td></tr></table>
25413
25414 !!end
25415
25416 !!test
25417 Indented block & table
25418 !! wikitext
25419 <div>foo</div>
25420 {|
25421 |foo
25422 |}
25423 !! html/php
25424 <div>foo</div>
25425 <table>
25426 <tr>
25427 <td>foo
25428 </td></tr></table>
25429
25430 !! html/parsoid
25431 <div data-parsoid='{"stx":"html"}'>foo</div>
25432 <table><tbody>
25433 <tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>foo</td></tr>
25434 </tbody></table>
25435 !!end
25436
25437 !! test
25438 Indent and comment before table row
25439 !! wikitext
25440 {|
25441 <!--hi-->|-
25442 | there
25443 |}
25444 !! html/php
25445 <table>
25446
25447 <tr>
25448 <td> there
25449 </td></tr></table>
25450
25451 !! html/parsoid
25452 <table>
25453 <!--hi--><tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
25454 <td data-parsoid='{"autoInsertedEnd":true}'> there</td></tr>
25455 </tbody></table>
25456 !! end
25457
25458 # Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext
25459 !!test
25460 Empty TR followed by a template-generated TR
25461 !!options
25462 parsoid
25463 !! wikitext
25464 {|
25465 |-
25466 {{echo|<tr><td>foo</td></tr>}}
25467 |}
25468 !! html
25469 <table>
25470 <tbody>
25471 <tr></tr>
25472 <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}}]}'>
25473 <td>foo</td></tr>
25474 </tbody></table>
25475 !!end
25476
25477 ## PHP and parsoid output differ for this, and since this is primarily
25478 ## for testing Parsoid's serializer, marking this Parsoid only
25479 !!test
25480 Empty TR followed by mixed-ws-comment line should RT correctly
25481 !!options
25482 parsoid
25483 !! wikitext
25484 {|
25485 |-
25486 <!--c-->
25487 |-
25488 <!--c--> <!--d-->
25489 |}
25490 !! html
25491 <table>
25492 <tbody>
25493 <tr></tr>
25494 <!--c-->
25495 <tr>
25496 <!--c--> </tr><!--d-->
25497 </tbody></table>
25498
25499 !!end
25500
25501 !!test
25502 Multi-line image caption generated by templates with/without trailing newlines
25503 !! wikitext
25504 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
25505 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
25506 !! html/parsoid
25507 <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>
25508 <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>
25509 !!end
25510
25511 !! test
25512 New element inserted (without intervening newlines) after an old sol-transparent node should serialize correctly
25513 !! options
25514 parsoid=html2wt
25515 !! html/parsoid
25516 <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>
25517
25518 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{}'/><h1>new heading</h1>
25519 !! wikitext
25520 <includeonly>foo</includeonly>
25521 new para
25522
25523 [[Category:Foo]]
25524
25525 = new heading =
25526 !! end
25527
25528 ## PHP emits broken html for this, and since this is primarily
25529 ## a Parsoid serializer test, marking this Parsoid only
25530 !!test
25531 Improperly nested inline or quotes tags with whitespace in between
25532 !! wikitext
25533 <span> <s>x</span> </s>
25534 ''' ''x''' ''
25535 !! html/parsoid
25536 <p><span> <s>x</s></span><s> </s>
25537 <b> <i>x</i></b><i> </i>
25538 </p>
25539 !!end
25540
25541 !!test
25542 Encapsulate protected attributes from wt
25543 !! wikitext
25544 <div typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
25545
25546 {| typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true"
25547 | ok
25548 |}
25549 !! html/parsoid
25550 <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>
25551
25552 <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">
25553 <tbody><tr><td data-parsoid='{"autoInsertedEnd":true}'> ok</td></tr>
25554 </tbody></table>
25555 !!end
25556
25557 ## Currently the p-wrapper is fragile in how it adds / removes transformations.
25558 ## Having nested or stray pre tags results in the attempt to add duplicates,
25559 ## causing an assertion fail. This test tries to prevent that situation.
25560 !!test
25561 Ensure ParagraphWrapper can deal with stray closing pre tags
25562 !!options
25563 parsoid=wt2html
25564 !! wikitext
25565 plain text</pre>
25566 !! html/parsoid
25567 plain text
25568 !!end
25569
25570 !!test
25571 1. Ensure fostered text content is wrapped in element nodes
25572 !!options
25573 parsoid=wt2html
25574 !! wikitext
25575 <table>hi</table><table>ho</table>
25576 !! html/parsoid
25577 <p>hi</p>
25578 <table></table>
25579 <p>ho</p>
25580 <table></table>
25581 !!end
25582
25583 !!test
25584 2. Ensure fostered text content is wrapped in element nodes (traps regressions around fostered marker on the element getting lost)
25585 !!options
25586 parsoid=wt2html,wt2wt
25587 !! wikitext
25588 <table>
25589 <tr> || ||
25590 <td> a
25591 </table>
25592 !! html/parsoid
25593 <p> || ||
25594 </p><table>
25595 <tbody><tr><td> a</td></tr>
25596 </tbody></table>
25597 !!end
25598
25599 !!test
25600 Encapsulation properly handles null DSR information from foster box
25601 !!options
25602 parsoid=wt2html,wt2wt
25603 !! wikitext
25604 {{echo|<table>foo<tr><td>bar</td></tr></table>}}
25605 !! html/parsoid
25606 <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>
25607 !!end
25608
25609 !!test
25610 1. Encapsulate foster-parented transclusion content
25611 !!options
25612 parsoid=wt2wt,wt2html
25613 !! wikitext
25614 <table>{{echo|foo<tr><td>bar</td></tr>}}</table>
25615 !! html/parsoid
25616 <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>
25617 <tbody>
25618 <tr>
25619 <td>bar</td>
25620 </tr>
25621 </tbody>
25622 </table>
25623 !!end
25624
25625 !!test
25626 2. Encapsulate foster-parented transclusion content
25627 !!options
25628 parsoid=wt2wt,wt2html
25629 !! wikitext
25630 <table><div>{{echo|foo}}</div><tr><td>bar</td></tr></table>
25631 !! html/parsoid
25632 <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>
25633 <table>
25634 <tbody>
25635 <tr>
25636 <td>bar</td>
25637 </tr>
25638 </tbody>
25639 </table>
25640 !!end
25641
25642 !!test
25643 3. Encapsulate foster-parented transclusion content
25644 !!options
25645 parsoid=wt2wt,wt2html
25646 !! wikitext
25647 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
25648 !! html/parsoid
25649 <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;]}">
25650 <p>foo</p>
25651 </div>
25652 <table>
25653 <tbody>
25654 <tr>
25655 <td>bar</td>
25656 </tr>
25657 </tbody>
25658 </table>
25659 !!end
25660
25661 !!test
25662 4. Encapsulate foster-parented transclusion content
25663 !!options
25664 parsoid=wt2wt,wt2html
25665 !! wikitext
25666 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
25667 !! html/parsoid
25668 <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;]}">
25669 <p>foo</p>
25670 </div>
25671 <table>
25672 <tbody>
25673 <tr>
25674 <td>bar</td>
25675 </tr>
25676 </tbody>
25677 </table>
25678 !!end
25679
25680 !!test
25681 5. Encapsulate foster-parented transclusion content
25682 !!options
25683 parsoid=wt2wt,wt2html
25684 !! wikitext
25685 <table><tr><td><div><p>{{echo|foo</p></div></td>foo}}</tr></table>
25686 !! html/parsoid
25687 <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>
25688 <table>
25689 <tbody>
25690 <tr>
25691 <td>
25692 <div>
25693 <p>foo</p>
25694 </div>
25695 </td>
25696 </tr>
25697 </tbody>
25698 </table>
25699 !!end
25700
25701 !!test
25702 6. Encapsulate foster-parented transclusion content
25703 !!options
25704 parsoid=wt2wt,wt2html
25705 !! wikitext
25706 <table><tr><td><div><p>{{echo|foo</p></div></td>foo</tr></table>}}<p>ok</p>
25707 !! html/parsoid
25708 <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>
25709 <table>
25710 <tbody>
25711 <tr>
25712 <td>
25713 <div>
25714 <p>foo</p>
25715 </div>
25716 </td>
25717 </tr>
25718 </tbody>
25719 </table>
25720 <p>ok</p>
25721 !!end
25722
25723 !!test
25724 7. Encapsulate foster-parented transclusion content
25725 !!options
25726 parsoid=wt2wt,wt2html
25727 !! wikitext
25728 <table>{{echo|<p>foo</p>}}<td>bar</td></table>
25729 !! html/parsoid
25730 <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>
25731 <table>
25732 <tbody>
25733 <tr>
25734 <td>bar</td>
25735 </tr>
25736 </tbody>
25737 </table>
25738 !!end
25739
25740 # Note that the wt is broken on purpose: the = should be {{=}} if you
25741 # don't want it to be a template parameter key.
25742 !!test
25743 8. Encapsulate foster-parented transclusion content
25744 !!options
25745 parsoid=wt2wt,wt2html
25746 !! wikitext
25747 {{echo|a
25748 }}{|{{echo|style='color:red'}}
25749 |-
25750 |b
25751 |}
25752 !! html/parsoid
25753 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\n"}},"i":0}}]}'>a</p>
25754 <span> </span>
25755 <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>
25756 <table>
25757 <tbody>
25758 <tr>
25759 <td>b</td>
25760 </tr>
25761 </tbody>
25762 </table>
25763 !!end
25764
25765 !!test
25766 9. Encapsulate foster-parented transclusion content
25767 !!options
25768 parsoid=wt2wt,wt2html
25769 !! wikitext
25770 <table>{{echo|hi</table>hello}}
25771 !! html/parsoid
25772 <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>
25773 !!end
25774
25775 !!test
25776 Table in fosterable position
25777 !!options
25778 parsoid=wt2html
25779 !! wikitext
25780 {{OpenTable}}
25781 <div>
25782 {|
25783 |}
25784 </div>
25785 |}
25786 !! html/parsoid
25787 <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">
25788 </span>
25789 <table about="#mwt1" data-parsoid='{"autoInsertedEnd":true}'></table>
25790
25791 <table>
25792 </table>
25793 !!end
25794
25795 # Parsoid only for T66747
25796 !! test
25797 Properly encapsulate empty-content transclusions in fosterable positions
25798 !! wikitext
25799 <table>
25800 {{#if:|
25801 <td>foo</td>
25802 }}
25803 </table>
25804 !! html/parsoid
25805 <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"}]]}'>
25806
25807 </table>
25808 !! end
25809
25810 !! test
25811 Always encapsulate foster box when template range is expanded to table
25812 !! options
25813 parsoid=wt2wt
25814 !! wikitext
25815 {|
25816 hello
25817 {{OpenTable}}
25818 |}
25819 !! html/parsoid
25820
25821 !! end
25822
25823 !! test
25824 T115289: Unclosed table
25825 !! wikitext
25826 {{echo|<table>}}<!--c-->[[Category:Two]]
25827 !! html/parsoid
25828 <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>
25829 !! end
25830
25831 !! test
25832 T115289: Don't migrate newlines out of tables with fostered content
25833 !! wikitext
25834 <table><td></td>{{echo|<tr>[[Category:One]]}}<!--c-->[[Category:Two]]
25835 !! html/parsoid
25836 <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>
25837 !! end
25838
25839 !! test
25840 T73074: More fostering fun
25841 !! wikitext
25842 <table><td></td>{{echo|<tr>}}<!--c-->[[Category:Two]]
25843 !! html/parsoid
25844 <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>
25845 !! end
25846
25847 !!test
25848 Support <object> element with .data attribute
25849 !!options
25850 parsoid=html2wt
25851 !! html/parsoid
25852 <object data="test.swf"></object>
25853 !! wikitext
25854 <object data="test.swf"></object>
25855 !!end
25856
25857 !! test
25858 Don't block XML namespace declaration
25859 !! wikitext
25860 <span xmlns:dct="http://purl.org/dc/terms/" property="dct:title">MediaWiki</span>
25861 !! html/php
25862 <p><span xmlns:dct="http&#58;//purl.org/dc/terms/" property="dct:title">MediaWiki</span>
25863 </p>
25864 !! html/parsoid
25865 <p><span xmlns:dct="http://purl.org/dc/terms/" data-x-property="dct:title" data-parsoid='{"stx":"html"}'>MediaWiki</span></p>
25866 !! end
25867
25868 # -----------------------------------------------------------------
25869 # The following section of tests are primarily to spec requirements
25870 # around Parsoid's serialization (old, new, edited content)
25871 #
25872 # All these tests are marked Parsoid html2wt and html2html only
25873 # ----------------------------------------------------------------
25874
25875 !! test
25876 Ignore rel attribute in a-tags during serialization to url-links
25877 !! options
25878 parsoid=html2wt
25879 !! html/parsoid
25880 <a href='http://en.wikipedia.org/wiki/Foobar'>http://en.wikipedia.org/wiki/Foobar</a>
25881 <a href='http://en.wikipedia.org/wiki/Foobar' rel='mw:ExtLink'>http://en.wikipedia.org/wiki/Foobar</a>
25882 <a href='http://en.wikipedia.org/wiki/Foobar' rel='mw:WikiLink'>http://en.wikipedia.org/wiki/Foobar</a>
25883 !! wikitext
25884 http://en.wikipedia.org/wiki/Foobar
25885 http://en.wikipedia.org/wiki/Foobar
25886 http://en.wikipedia.org/wiki/Foobar
25887 !! end
25888
25889 # 'mi' is a localinterwiki prefix as well as a language
25890 !! test
25891 Serialize interwiki links pointing to the current wiki as plain wiki links (T67869)
25892 !! options
25893 parsoid=html2wt
25894 !! html/parsoid
25895 <p><a rel="mw:ExtLink" href="http://mi.wikipedia.org/wiki/Foo">Foo</a></p>
25896 !! wikitext
25897 [[Foo]]
25898 !! end
25899
25900 # See T93839
25901 !! test
25902 New wikilinks should be serialized properly
25903 !! options
25904 parsoid=html2wt
25905 !! html/parsoid
25906 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{}'>Foo</a>
25907 <a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>
25908 <a href="//en.wikipedia.org/wiki/Foo">//en.wikipedia.org/wiki/Foo</a>
25909 <a href="http://en.wikipedia.org/wiki/Foo">http://en.wikipedia.org/wiki/Foo</a>
25910 <a href="//en.wikipedia.org/wiki/Foo_bar">//en.wikipedia.org/wiki/Foo bar</a>
25911 !! wikitext
25912 [[Foo]]
25913 [[Foo]]
25914 [[:en:Foo|//en.wikipedia.org/wiki/Foo]]
25915 http://en.wikipedia.org/wiki/Foo
25916 [[:en:Foo_bar|//en.wikipedia.org/wiki/Foo bar]]
25917 !! end
25918
25919 !! test
25920 New wiki links (href variations)
25921 !! options
25922 parsoid=html2wt
25923 !! html/parsoid
25924 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
25925 <a rel="mw:WikiLink" href="Foo_bar">Foo_bar</a>
25926 <a rel="mw:WikiLink" href="Foo bar">Foo_bar</a>
25927 <a rel="mw:WikiLink" href="./Toxine_bact%C3%A9rienne">Toxine bactérienne</a>
25928 !! wikitext
25929 [[Foo_bar]]
25930 [[Foo_bar]]
25931 [[Foo_bar]]
25932 [[Toxine bactérienne]]
25933 !! end
25934
25935 !! test
25936 New wiki links (content string variations)
25937 !! options
25938 parsoid=html2wt
25939 !! html/parsoid
25940 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
25941 <a rel="mw:WikiLink" href="./Foo_bar">Foo bar</a>
25942 <a rel="mw:WikiLink" href="./Foo_bar">./Foo_bar</a>
25943 !! wikitext
25944 [[Foo_bar]]
25945 [[Foo bar]]
25946 [[Foo_bar|./Foo_bar]]
25947 !! end
25948
25949 !! test
25950 New category links (href variations)
25951 !! options
25952 parsoid=html2wt
25953 !! html/parsoid
25954 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne" />
25955 <link rel="mw:PageProp/Category" href="./Category:Toxine_bact%C3%A9rienne" />
25956 <link rel="mw:PageProp/Category" href="Category:Toxine_bact%C3%A9rienne" />
25957 !! wikitext
25958 [[Category:Toxine bactérienne]]
25959 [[Category:Toxine bactérienne]]
25960 [[Category:Toxine bactérienne]]
25961 !! end
25962
25963 !! test
25964 New sol transparent links don't need indent-pre nowiki protection
25965 !! options
25966 parsoid=html2wt
25967 language=de
25968 !! html/parsoid
25969 <link rel="mw:PageProp/redirect" href="./Main_Page">
25970 <!-- this is good --> <link rel="mw:PageProp/Category" href="./Category:Good" />
25971 <!-- this is great --> <link rel="mw:PageProp/Category" href="./Kategorie:Great" />
25972 !! wikitext
25973 #WEITERLEITUNG [[Main Page]]
25974 <!-- this is good --> [[Category:Good]]
25975 <!-- this is great --> [[Kategorie:Great]]
25976 !! end
25977
25978 !! test
25979 New interlanguage links (href variations)
25980 !! options
25981 parsoid=html2wt
25982 !! html/parsoid
25983 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine bactérienne" />
25984 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bactérienne" />
25985 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bact%C3%A9rienne" />
25986 !! wikitext
25987 [[es:Toxine bactérienne]]
25988 [[es:Toxine_bactérienne]]
25989 [[es:Toxine_bactérienne]]
25990 !! end
25991
25992 !! test
25993 Image: Modifying size of an image (1)
25994 !! options
25995 parsoid={
25996 "modes": ["wt2wt"],
25997 "changes": [
25998 ["img[height]", "attr", "height", "22"],
25999 ["img[width]", "attr", "width", "200"]
26000 ]
26001 }
26002 !! wikitext
26003 [[Image:Foobar.jpg|230x230px]]
26004 !! wikitext/edited
26005 [[Image:Foobar.jpg|200x200px]]
26006 !!end
26007
26008 !! test
26009 Image: Modifying size of an image (2)
26010 !! options
26011 parsoid={
26012 "modes": ["wt2wt"],
26013 "changes": [
26014 ["img[height]", "attr", "height", "100"],
26015 ["img[width]", "attr", "width", "500"]
26016 ]
26017 }
26018 !! wikitext
26019 [[Image:Foobar.jpg|230x230px]]
26020 !! wikitext/edited
26021 [[Image:Foobar.jpg|500x500px]]
26022 !!end
26023
26024 # Change in size is ignored so long as class='mw-default-size'
26025 !! test
26026 Image: Modifying size of an image (3)
26027 !! options
26028 parsoid={
26029 "modes": ["wt2wt"],
26030 "changes": [
26031 ["figure[class]", "removeClass", "mw-default-size"],
26032 ["figure img", "attr", "height", "19"],
26033 ["figure img", "attr", "width", "170"]
26034 ]
26035 }
26036 !! wikitext
26037 [[Image:Foobar.jpg|thumb]]
26038 !! wikitext/edited
26039 [[Image:Foobar.jpg|thumb|170x170px]]
26040 !!end
26041
26042 !! test
26043 Image: Modifying alignment of an image (T50665)
26044 !! options
26045 parsoid={
26046 "modes": ["wt2wt"],
26047 "changes": [
26048 ["figure[class]", "removeClass", "mw-halign-right"],
26049 ["figure[class]", "addClass", "mw-halign-left"]
26050 ]
26051 }
26052 !! wikitext
26053 [[Image:Foobar.jpg|thumb|caption|right]]
26054 !! wikitext/edited
26055 [[Image:Foobar.jpg|thumb|caption|left]]
26056 !! end
26057
26058 !! test
26059 Image: Modifying mw-default-size of an frameless image (T64805)
26060 !! options
26061 parsoid={
26062 "modes": ["wt2wt"],
26063 "changes": [
26064 ["figure.mw-default-size", "removeClass", "mw-default-size"]
26065 ]
26066 }
26067 !! wikitext
26068 [[Image:Foobar.jpg|frameless|right]]
26069 !! wikitext/edited
26070 [[Image:Foobar.jpg|frameless|right|220x220px]]
26071 !! end
26072
26073 !! test
26074 Image: Modifying valign of an image (T51221)
26075 !! options
26076 parsoid={
26077 "modes": ["wt2wt"],
26078 "changes": [
26079 ["*[typeof=\"mw:Image\"]", "removeClass", "mw-valign-middle"],
26080 ["*[typeof=\"mw:Image\"]", "addClass", "mw-valign-text-top"]
26081 ]
26082 }
26083 !! wikitext
26084 [[File:Foobar.jpg|20px|middle]]
26085 !! wikitext/edited
26086 [[File:Foobar.jpg|20px|text-top]]
26087 !! end
26088
26089 !! test
26090 Image: Modifying alt attribute of an image (T58400)
26091 !! options
26092 parsoid={
26093 "modes": ["wt2wt"],
26094 "changes": [
26095 ["img[alt]", "attr", "alt", "some alternate edited text"]
26096 ]
26097 }
26098 !! wikitext
26099 [[File:Foobar.jpg|thumb|some caption|alt=some alternate text]]
26100 !! wikitext/edited
26101 [[File:Foobar.jpg|thumb|some caption|alt=some alternate edited text]]
26102 !!end
26103
26104 !! test
26105 Image: Modifying caption of an image
26106 !! options
26107 parsoid={
26108 "modes": ["wt2wt"],
26109 "changes": [
26110 ["figcaption", "text", "new caption"]
26111 ]
26112 }
26113 !! wikitext
26114 [[Image:Foobar.jpg|thumb|original caption]]
26115 !! wikitext/edited
26116 [[Image:Foobar.jpg|thumb|new caption]]
26117 !!end
26118
26119 !! test
26120 Image: empty alt attribute (T50924)
26121 !! options
26122 parsoid
26123 !! wikitext
26124 [[File:Foobar.jpg|thumb|alt=|bar]]
26125 !! html
26126 <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>
26127 !! end
26128
26129 !! test
26130 Image: new attributes should be serialized in wiki's language for RTL languages (T53852)
26131 !! options
26132 parsoid=html2wt
26133 language=ar
26134 disabled
26135 !! html/parsoid
26136 <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>
26137 !! wikitext
26138 [[Imagen:Foobar.jpg|derecha|miniaturadeimagen]]
26139 !! end
26140
26141 !! test
26142 Image: Block level image should have \n before and after
26143 !! wikitext
26144 123
26145 [[File:Foobar.jpg|right|thumb|150x150px]]
26146 456
26147 !! html/parsoid
26148 <p>123</p>
26149 <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>
26150 <p>456</p>
26151 !!end
26152
26153 !! test
26154 Image: New block level image should have \n before and after (existing content)
26155 !! wikitext
26156 123
26157 [[File:Foobar.jpg|right|thumb|150x150px]]
26158 456
26159 !! html/parsoid
26160 <p>123</p>
26161 <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>
26162 <p>456</p>
26163 !!end
26164
26165 !! test
26166 Image: upright option (parsoid)
26167 !! wikitext
26168 [[File:Foobar.jpg|thumb|upright|caption]]
26169 [[File:Foobar.jpg|thumb|upright=0.5|caption]]
26170 [[File:Foobar.jpg|thumb|500x500px|upright=0.5|caption]]
26171 !! html/parsoid
26172 <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>
26173 <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>
26174 <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>
26175 !!end
26176
26177 !! test
26178 Image: upright option is ignored on inline and frame images (parsoid)
26179 !! wikitext
26180 [[File:Foobar.jpg|500x500px|upright=0.5|caption]]
26181 !! html/parsoid
26182 <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>
26183 !!end
26184
26185 !! test
26186 Image: from basic HTML (1)
26187 !! options
26188 parsoid=html2wt
26189 !! html/parsoid
26190 <span typeof="mw:Image">
26191 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
26192 </span>
26193 !! wikitext
26194 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
26195 !! end
26196
26197 !! test
26198 Image: from basic HTML (2)
26199 !! options
26200 parsoid=html2wt
26201 !! html/parsoid
26202 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
26203 !! wikitext
26204 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
26205 !! end
26206
26207 !! test
26208 Image: from basic HTML (3)
26209 !! options
26210 parsoid=html2wt
26211 !! html/parsoid
26212 <a href="Main"><img src="./File:Foobar.jpg" width=100 height=100 alt="Alt"></a>
26213 !! wikitext
26214 [[File:Foobar.jpg|link=Main|alt=Alt|100x100px]]
26215 !! end
26216
26217 !! test
26218 Image: from basic HTML (4)
26219 !! options
26220 parsoid=html2wt
26221 !! html/parsoid
26222 <img src="./File:Foobar.jpg">
26223 !! wikitext
26224 [[File:Foobar.jpg|link=]]
26225 !! end
26226
26227 !! test
26228 Image: Invalid title as link
26229 !! wikitext
26230 [[File:Foobar.jpg|link=<]]
26231 !! html/php
26232 <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>
26233 </p>
26234 !! html/parsoid
26235 <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>
26236 !! end
26237
26238 !! test
26239 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
26240 !! options
26241 parsoid=html2wt
26242 !! html/parsoid
26243 <ul>
26244 <li><p>foo</p></li>
26245 </ul>
26246 !! wikitext
26247 * foo
26248 !! end
26249
26250 !! test
26251 Lists: Serialize correctly even when list tags has unneeded whitespace between tags
26252 !! options
26253 parsoid=html2wt
26254 !! html/parsoid
26255 <ul> <li>foo</li></ul>
26256 !! wikitext
26257 * foo
26258 !! end
26259
26260 !! test
26261 Don't strip leading whitespace when handling indent-pre suppressing tags
26262 !! options
26263 parsoid=html2wt
26264 !! html/parsoid
26265 <table>
26266 <tr><td> indented row</td></tr>
26267 </table>
26268 <blockquote><p>
26269 <b>This is very bold of you!</b>
26270 </p>
26271 <table><tr><td>
26272 indented cell (no pre-wrapping!)
26273 </td></tr></table>
26274 </blockquote>
26275 <p>foo</p>
26276 <div>bar</div>
26277 !! wikitext
26278 {|
26279 | indented row
26280 |}
26281 <blockquote>
26282 '''This is very bold of you!'''
26283
26284 {|
26285 |
26286 indented cell (no pre-wrapping!)
26287 |}
26288 </blockquote>
26289 foo
26290 <div>bar</div>
26291 !! end
26292
26293 !! test
26294 Nowiki-wrap leading whitespace when handling indent-pre inducing tags
26295 !! options
26296 parsoid=html2wt
26297 !! html/parsoid
26298 <p>foo</p>
26299 <span>bar</span>
26300
26301 <span>foo2
26302 </span>bar2
26303
26304 <div>foo</div>
26305 <span>bar</span>
26306
26307 <div>
26308 <span>foo</span>
26309 </div>
26310 !! wikitext
26311 foo
26312
26313 <span>bar</span>
26314
26315 <span>foo2
26316 <nowiki> </nowiki></span>bar2
26317
26318 <div>foo</div>
26319 <nowiki> </nowiki><span>bar</span>
26320
26321 <div>
26322 <nowiki> </nowiki><span>foo</span>
26323 </div>
26324 !! end
26325
26326 !! test
26327 Lists: Dont insert newlines in a serialized list item.
26328 !! options
26329 parsoid=html2wt
26330 !! html/parsoid
26331 <ul><li>a<br>b</li><li>c</li></ul>
26332 !! wikitext
26333 * a<br>b
26334 * c
26335 !! end
26336
26337 !! test
26338 1. Headings: Force sol-transparent links and behavior switches to serialize before/after
26339 !! options
26340 parsoid={
26341 "modes": ["html2wt"],
26342 "scrubWikitext": false
26343 }
26344 !! html/parsoid
26345 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
26346 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
26347
26348 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
26349 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
26350
26351 <h2 data-parsoid='{}'>howdy<link href="./Category:A5" rel="mw:PageProp/Category" /></h2>
26352
26353 <h2><meta property="mw:PageProp/toc" /> ok</h2>
26354 !! wikitext
26355 == hello there [[Category:A1]] ==
26356
26357 == [[Category:A2]] hi pal ==
26358
26359 == <!--foo--> [[Category:A3]] how goes it ==
26360
26361 == it goes well [[Category:A4]] <!--bar--> ==
26362
26363 ==howdy [[Category:A5]]==
26364
26365 == __TOC__ ok ==
26366 !! end
26367
26368 !! test
26369 2. Headings: Force sol-transparent links and behavior switches to serialize before/after
26370 !! options
26371 parsoid={
26372 "modes": ["html2wt"],
26373 "scrubWikitext": true
26374 }
26375 !! html/parsoid
26376 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
26377 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
26378
26379 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
26380 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
26381
26382 <h2><meta property="mw:PageProp/toc" /> ok</h2>
26383 !! wikitext
26384 == hello there ==
26385 [[Category:A1]]
26386 [[Category:A2]]
26387
26388 == hi pal ==
26389
26390 <!--foo--> [[Category:A3]]
26391
26392 == how goes it ==
26393
26394 == it goes well ==
26395 [[Category:A4]] <!--bar-->
26396
26397 __TOC__
26398
26399 == ok ==
26400 !! end
26401
26402 !! test
26403 Headings: Don't hoist metas that come from templates
26404 !! options
26405 parsoid={
26406 "modes": ["html2wt"],
26407 "scrubWikitext": true
26408 }
26409 !! html/parsoid
26410 <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>
26411 !! wikitext
26412 == {{echo|foo [[Category:Foo]]}} ==
26413 !! end
26414
26415 !! test
26416 Headings: Category in ref isn't hoisted
26417 !! options
26418 parsoid={
26419 "modes": ["html2wt"],
26420 "scrubWikitext": true
26421 }
26422 !! html/parsoid
26423 <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>
26424
26425 <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>
26426 !! wikitext
26427 == foo <ref>bar
26428 [[Category:Baz]] </ref> ==
26429
26430 <references />
26431 !! end
26432
26433 !! test
26434 Parsoid: Serialize positional parameters with = in them as named parameter
26435 !! options
26436 parsoid=html2wt
26437 !! html/parsoid
26438 <p about="#mwt1" typeof="mw:Transclusion"
26439 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
26440
26441 <p about="#mwt1" typeof="mw:Transclusion"
26442 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}, "2":{"wt":"bar"}},"i":0}}]}'>foo</p>
26443
26444 <!--Orig params with data-parsoid has heuristics for handling = chars-->
26445 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
26446 <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>
26447 !! wikitext
26448 {{echo|1=f=oo}}
26449
26450 {{echo|1=f=oo|2=bar}}
26451
26452 <!--Orig params with data-parsoid has heuristics for handling = chars-->
26453 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
26454 {{echo|<nowiki>f=oo</nowiki>|bar}}
26455 !! end
26456
26457 !! test
26458 Parsoid: Serialize positional parameters with = in extlink as named parameter
26459 !! options
26460 parsoid=html2wt
26461 !! html/parsoid
26462 <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>
26463 !! wikitext
26464 {{echo|1=http://stuff?is=ok}}
26465 !! end
26466
26467 !! test
26468 Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
26469 !! options
26470 parsoid=html2wt
26471 !! html/parsoid
26472 <div>a<p>b</p></div>
26473 <div>a
26474 <p>b</p></div>
26475 <div>
26476 a
26477 <p>b</p></div>
26478 !! wikitext
26479 <div>a
26480 b
26481 </div>
26482 <div>a
26483 b
26484 </div>
26485 <div>
26486 a
26487
26488 b
26489 </div>
26490 !! end
26491
26492 !! test
26493 Substrings resembling wikitext in hrefs should not get nowiki escapes
26494 !! options
26495 parsoid=html2wt
26496 !! html/parsoid
26497 <a rel="mw:WikiLink" href="./Foo''bar''baz">Foo''bar''baz</a>
26498 !! wikitext
26499 [[Foo''bar''baz]]
26500 !! end
26501
26502 !! test
26503 Enforce single-line context in the serializer
26504 !! options
26505 parsoid=html2wt
26506 !! html/parsoid
26507 <h2>testing
26508 123</h2>
26509
26510 <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">
26511 </span><span about="#mwt1">you</span> </h2>
26512
26513 <h2> foo <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="./Main_Page#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span> </h2>
26514
26515 <ol class="references" typeof="mw:Extension/references" about="#mwt3" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="./Main_Page#cite_ref-1">↑</a></span> <span id="mw-reference-text-cite_note-1" class="mw-reference-text" data-parsoid="{}">hello
26516 there</span></li></ol>
26517
26518 <ul><li>asd
26519 sdf</li></ul>
26520
26521 <ul><li>foo
26522 bar
26523 baz</li>
26524 <li>foo <b>bar</b>
26525 baz</li></ul>
26526
26527 <dl><dt>hi
26528 ho </dt><dd data-parsoid='{"stx":"row"}'> hi
26529 ho</dd></dl>
26530
26531 <dl><dd> <table>
26532 <tbody><tr><td> ha
26533 ha
26534 ha</td></tr>
26535 </tbody></table></dd></dl>
26536 !! wikitext
26537 == testing 123 ==
26538
26539 == hi {{bogus|there
26540 you}} ==
26541
26542 == foo <ref>hello
26543 there</ref> ==
26544
26545 <references />
26546
26547 * asd sdf
26548
26549 * foo bar baz
26550 * foo '''bar''' baz
26551
26552 ; hi ho : hi ho
26553
26554 : {|
26555 | ha
26556 ha
26557 ha
26558 |}
26559 !! end
26560
26561 !! test
26562 Serialize new placeholder space without spans
26563 !! options
26564 parsoid=html2wt
26565 !! html/parsoid
26566 <p>foo<span typeof="mw:Placeholder"> </span>: bar</p>
26567
26568 <p>foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span>: bar</p>
26569
26570 <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>
26571 !! wikitext
26572 foo : bar
26573
26574 foo : bar
26575
26576 <ref>foo : bar</ref>ok
26577 !! end
26578
26579
26580 #-----------------------
26581 # Tag minimization tests
26582 #-----------------------
26583
26584 !! test
26585 1. I/B quote minimization: wikitext-only tags should be combined
26586 !! options
26587 parsoid=html2wt
26588 !! html/parsoid
26589 <p><i>A</i><i>B</i></p>
26590 <p><b>A</b><b>B</b></p>
26591 <p><i>A</i><b><i>B</i></b></p>
26592 <p><b>A</b><i><b>B</b></i></p>
26593 <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
26594 <p><i><b>A</b></i><i><b>B</b></i></p>
26595 <p><i><b>A</b></i><b><i>B</i></b></p>
26596 <p><b><i>A</i></b><i><b>B</b></i></p>
26597 !! wikitext
26598 ''AB''
26599
26600 '''AB'''
26601
26602 ''A'''B'''''
26603
26604 '''A''B'''''
26605
26606 '''A''BC''D'''
26607
26608 '''''AB'''''
26609
26610 '''''AB'''''
26611
26612 '''''AB'''''
26613 !! end
26614
26615 !! test
26616 2. I/B quote minimization: wikitext and html tags should not be combined
26617 !! options
26618 parsoid=html2wt
26619 !! html/parsoid
26620 <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
26621 <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
26622 !! wikitext
26623 ''A''<i>B</i>
26624
26625 ''A''<nowiki/>'''<i>B</i>'''
26626 !! end
26627
26628 !! test
26629 3. I/B quote minimization: templated content stops minimization
26630 !! options
26631 parsoid=html2wt
26632 !! html/parsoid
26633 <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>
26634 <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>
26635 !! wikitext
26636 ''A''{{echo|''B''}}
26637
26638 ''A''{{echo|'''''B'''''}}
26639 !! end
26640
26641 !! test
26642 4. I/B quote minimization: new content should be mimimized with adjacent old content
26643 !! options
26644 parsoid=html2wt
26645 !! html/parsoid
26646 <p><i>A</i><i>B</i></p>
26647 <p><b>A</b><b>B</b></p>
26648 <p><i>A</i><b><i>B</i></b></p>
26649 !! wikitext
26650 ''AB''
26651
26652 '''AB'''
26653
26654 ''A'''B'''''
26655 !! end
26656
26657 !! test
26658 5a. Merge adjacent quote nodes if they've been edited
26659 !! options
26660 parsoid={
26661 "modes": ["wt2wt", "selser"],
26662 "changes": [
26663 ["p", "contents", "remove", ":contains('b')"]
26664 ]
26665 }
26666 !! wikitext
26667 ''a''b''c''
26668 !! wikitext/edited
26669 ''ac''
26670 !! end
26671
26672 !! test
26673 5b. Merge adjacent quote nodes if they've been edited
26674 !! options
26675 parsoid={
26676 "modes": ["wt2wt", "selser"],
26677 "changes": [
26678 ["#x", "remove"]
26679 ]
26680 }
26681 !! wikitext
26682 ''a''<span id="x">b</span>''c''
26683 !! wikitext/edited
26684 ''ac''
26685 !! end
26686
26687 !! test
26688 1. Merge adjacent link nodes as long as at least one element is new
26689 !! options
26690 parsoid={
26691 "modes": ["html2wt"],
26692 "scrubWikitext": true
26693 }
26694 !! html/parsoid
26695 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
26696 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
26697 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a data-parsoid="{}" rel="mw:WikiLink" href="./Football">ball</a>
26698 !! wikitext
26699 [[Football]]
26700 [[Football]]
26701 [[Football|Foot]][[Football|ball]]
26702 !! end
26703
26704 !! test
26705 2. Merge adjacent link nodes and enable additional normalizations
26706 !! options
26707 parsoid={
26708 "modes": ["html2wt"],
26709 "scrubWikitext": true
26710 }
26711 !! html/parsoid
26712 <a rel="mw:WikiLink" href="./Football"><i>Foot</i></a><a rel="mw:WikiLink" href="./Football"><i>ball</i></a>
26713 !! wikitext
26714 [[Football|''Football'']]
26715 !! end
26716
26717 !! test
26718 3. Don't merge adjacent link nodes if scrubWikitext is false
26719 !! options
26720 parsoid={
26721 "modes": ["html2wt"],
26722 "scrubWikitext": false
26723 }
26724 !! html/parsoid
26725 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
26726 !! wikitext
26727 [[Football|Foot]][[Football|ball]]
26728 !! end
26729
26730 #------------------------------
26731 # End of tag minimization tests
26732 #------------------------------
26733
26734 !!test
26735 T56262: New entities
26736 !! options
26737 parsoid=html2wt
26738 !! html/parsoid
26739 <span typeof="mw:Entity">&nbsp;</span>
26740 !! wikitext
26741 &nbsp;
26742 !! end
26743
26744 ## Note that there is no wikitext output for 'unknownproperty' ##
26745 ## Unknown magic words are silently dropped ##
26746
26747 !! test
26748 Magic words
26749 !! options
26750 parsoid=html2wt
26751 !! html/parsoid
26752 <meta property='mw:PageProp/toc' />
26753 <meta property='mw:PageProp/notoc' />
26754 <meta property='mw:PageProp/forcetoc' />
26755 <meta property='mw:PageProp/index' />
26756 <meta property='mw:PageProp/noindex' />
26757 <meta property='mw:PageProp/nogallery' />
26758 <meta property='mw:PageProp/noeditsection' />
26759 <meta property='mw:PageProp/notitleconvert' />
26760 <meta property='mw:PageProp/nocontentconvert' />
26761 <meta property='mw:PageProp/unknownproperty' />
26762 !! wikitext
26763 __TOC__
26764 __NOTOC__
26765 __FORCETOC__
26766 __INDEX__
26767 __NOINDEX__
26768 __NOGALLERY__
26769 __NOEDITSECTION__
26770 __NOTITLECONVERT__
26771 __NOCONTENTCONVERT__
26772 !! end
26773
26774 !! test
26775 Consecutive <pre>s should not get merged
26776 !! options
26777 parsoid=html2wt,html2html
26778 !! html/parsoid
26779 <pre>a</pre><pre>b</pre>
26780
26781 <pre>c
26782 </pre><pre>
26783 d</pre>
26784
26785 <pre>e
26786
26787 </pre><pre>
26788
26789 f</pre>
26790 !! wikitext
26791 a
26792
26793 b
26794
26795 c
26796
26797 d
26798
26799 e
26800
26801
26802
26803 f
26804 !! end
26805
26806 !! test
26807 Edited ISBN links not serializable as ISBN links should serialize as wikilinks
26808 !! options
26809 parsoid=html2wt
26810 !! html/parsoid
26811 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink">ISBN 1234567895</a>
26812 !! wikitext
26813 [[Special:BookSources/1234567890|ISBN 1234567895]]
26814 !! end
26815
26816 !! test
26817 Edited RFC links not serializable as RFC links should serialize as extlinks
26818 !! options
26819 parsoid=html2wt
26820 !! html/parsoid
26821 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink">New RFC</a>
26822 !! wikitext
26823 [//tools.ietf.org/html/rfc123 New RFC]
26824 !! end
26825
26826 !! test
26827 Edited PMID links not serializable as PMID links should serialize as extlinks
26828 !! options
26829 parsoid=html2wt
26830 !! html/parsoid
26831 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink">New PMID</a>
26832 !! wikitext
26833 [//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract New PMID]
26834 !! end
26835
26836 !! test
26837 WTS of autolinks with trailing/surrounding context
26838 !! options
26839 parsoid=html2wt
26840 !! html/parsoid
26841 <p><a href="http://cscott.net">http://cscott.net</a><b>foo</b></p>
26842 <p><a href="http://cscott.net">http://cscott.net</a><b data-parsoid='{"stx":"html"}'>foo</b></p>
26843 <p><b><a href="http://cscott.net">http://cscott.net</a></b></p>
26844 <p><b><a href="http://cscott.net">http://cscott.net</a> </b></p>
26845 <p><b><a href="http://cscott.net">http://cscott.net</a>x</b></p>
26846 <p><a href="http://cscott.net">http://cscott.net</a>x</p>
26847 !! wikitext
26848 http://cscott.net'''foo'''
26849
26850 http://cscott.net<b>foo</b>
26851
26852 '''http://cscott.net'''
26853
26854 '''http://cscott.net '''
26855
26856 '''http://cscott.net<nowiki/>x'''
26857
26858 http://cscott.net<nowiki/>x
26859 !! end
26860
26861 !! test
26862 WTS of autolinks with nowikis (round-trip)
26863 !! wikitext
26864 x<nowiki/>http://cscott.net<nowiki/>x
26865 !! html/parsoid
26866 <p>x<a rel="mw:ExtLink" href="http://cscott.net">http://cscott.net</a>x</p>
26867 !! end
26868
26869 # this is the "easy" test because it leaves in place all the
26870 # data-parsoid information indicating this is an autolink
26871 !! test
26872 WTS of autolinks with escapes (editing)
26873 !! options
26874 parsoid={
26875 "modes": ["wt2wt"],
26876 "changes": [
26877 [ "span", "remove" ]
26878 ]
26879 }
26880 !! wikitext
26881 x<nowiki/>http://cscott.net<nowiki/>x
26882 !! wikitext/edited
26883 x<nowiki/>http://cscott.net<nowiki/>x
26884 !! end
26885
26886 !! test
26887 WTS of edited autolink-like text (T103364)
26888 !! options
26889 parsoid={
26890 "modes": ["wt2wt"],
26891 "changes": [
26892 [ "span[typeof]", "removeAttr", "typeof" ]
26893 ]
26894 }
26895 !! wikitext
26896 Not a link: <nowiki>http://example.com</nowiki>.
26897 !! wikitext/edited
26898 Not a link: <span><nowiki>http://example.com</nowiki></span>.
26899 !! end
26900
26901 !! test
26902 WTS of newly-authored autolink-like text (T103364)
26903 !! options
26904 parsoid=html2wt
26905 !! html/parsoid
26906 <p>http://example.com is not a link.</p>
26907 !! wikitext
26908 <nowiki>http://example.com</nowiki> is not a link.
26909 !! end
26910
26911 !! test
26912 WTS of autolink-like text after an autolink (T108563)
26913 !! options
26914 parsoid=html2wt
26915 !! html/parsoid
26916 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a> http://example.com is not a link.</p>
26917 !! wikitext
26918 http://example.com <nowiki>http://example.com</nowiki> is not a link.
26919 !! end
26920
26921 !! test
26922 Magic links inside links (not autolinked)
26923 !! wikitext
26924 [[Foo|http://example.com]]
26925 [[Foo|RFC 1234]]
26926 [[Foo|PMID 1234]]
26927 [[Foo|ISBN 123456789x]]
26928
26929 [http://foo.com http://example.com]
26930 [http://foo.com RFC 1234]
26931 [http://foo.com PMID 1234]
26932 [http://foo.com ISBN 123456789x]
26933 !! html+tidy
26934 <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>
26935 <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>
26936 !! html/parsoid
26937 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">http://example.com</a>
26938 <a rel="mw:WikiLink" href="./Foo" title="Foo">RFC 1234</a>
26939 <a rel="mw:WikiLink" href="./Foo" title="Foo">PMID 1234</a>
26940 <a rel="mw:WikiLink" href="./Foo" title="Foo">ISBN 123456789x</a></p>
26941
26942 <p><a rel="mw:ExtLink" href="http://foo.com">http://example.com</a>
26943 <a rel="mw:ExtLink" href="http://foo.com">RFC 1234</a>
26944 <a rel="mw:ExtLink" href="http://foo.com">PMID 1234</a>
26945 <a rel="mw:ExtLink" href="http://foo.com">ISBN 123456789x</a></p>
26946 !! end
26947
26948 !! test
26949 Magic links inside image captions (autolinked)
26950 !! wikitext
26951 [[File:Foobar.jpg|thumb|http://example.com]]
26952 [[File:Foobar.jpg|thumb|RFC 1234]]
26953 [[File:Foobar.jpg|thumb|PMID 1234]]
26954 [[File:Foobar.jpg|thumb|ISBN 123456789x]]
26955 !! html+tidy
26956 <div class="thumb tright">
26957 <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>
26958 <div class="thumbcaption">
26959 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
26960 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></div>
26961 </div>
26962 </div>
26963 <div class="thumb tright">
26964 <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>
26965 <div class="thumbcaption">
26966 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
26967 <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a></div>
26968 </div>
26969 </div>
26970 <div class="thumb tright">
26971 <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>
26972 <div class="thumbcaption">
26973 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
26974 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a></div>
26975 </div>
26976 </div>
26977 <div class="thumb tright">
26978 <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>
26979 <div class="thumbcaption">
26980 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
26981 <a href="/wiki/Special:BookSources/123456789X" class="internal mw-magiclink-isbn">ISBN 123456789x</a></div>
26982 </div>
26983 </div>
26984 !! html/parsoid
26985 <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>
26986 <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>
26987 <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>
26988 <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>
26989 !! end
26990
26991 !! test
26992 WTS of magic word text (T109371)
26993 !! options
26994 parsoid=html2wt
26995 !! html/parsoid
26996 <p>RFC 1234</p>
26997 <p><a href="http://foo.com" rel="mw:ExtLink">RFC 1234</a></p>
26998 <p><a href="./Foo" rel="mw:WikiLink">RFC 1234</a></p>
26999 !! wikitext
27000 <nowiki>RFC 1234</nowiki>
27001
27002 [http://foo.com RFC 1234]
27003
27004 [[Foo|RFC 1234]]
27005 !! end
27006
27007 !! test
27008 Edited Redirect link should emit a non-piped wikitext link
27009 !! options
27010 parsoid=html2wt
27011 !! html/parsoid
27012 <link rel="mw:PageProp/redirect" href="Bar" data-parsoid='{"a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>
27013 !! wikitext
27014 #REDIRECT [[Bar]]
27015 !! end
27016
27017 !! test
27018 T75121: Infer extension name from typeOf if data-mw is not present
27019 !! options
27020 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
27021 !! html/parsoid
27022 <div typeOf="mw:Extension/foo"></div>
27023 !! wikitext
27024 <foo />
27025 !! end
27026
27027 # Note that the <p> wrapping isn't present in PHP parser output
27028 # The important thing for this test is that P-wrapping doesn't
27029 # interfere with the <nowiki> protection for leading - in <td>
27030 # (which isn't necessary for <th>).
27031 !! test
27032 T88318: p-wrapped dash in table.
27033 !! options
27034 parsoid=html2wt,wt2wt
27035 !! html/parsoid
27036 <table><tbody>
27037 <tr><th><p>-</p></th><th><p>- </p></th></tr>
27038 <tr><td><p>-</p></td><td><p>- </p></td></tr>
27039 <tr><td><small>-</small></td><td><br/><p>-</p></td><td><br/>-</td></tr>
27040 </tbody></table>
27041 !! wikitext
27042 {|
27043 !-
27044 !-
27045 |-
27046 |<nowiki>-</nowiki>
27047 |<nowiki>- </nowiki>
27048 |-
27049 |<small>-</small>
27050 |<br>
27051 -
27052 |<br>
27053 -
27054 |}
27055 !! html/php+tidy
27056 <table>
27057 <tr>
27058 <th>-</th>
27059 <th>-</th>
27060 </tr>
27061 <tr>
27062 <td>-</td>
27063 <td>-</td>
27064 </tr>
27065 <tr>
27066 <td><small>-</small></td>
27067 <td><br />
27068 <p>-</p>
27069 </td>
27070 <td><br />
27071 <p>-</p>
27072 </td>
27073 </tr>
27074 </table>
27075 !! end
27076
27077 !! test
27078 T149209: WTS: Handle newlines in table cells properly
27079 !! options
27080 parsoid=html2wt
27081 !! html/parsoid
27082 <table>
27083 <tbody>
27084 <tr><td>a
27085 b
27086 </td><td data-parsoid='{"stx_v":"row"}'>c</td></tr>
27087 <tr><td><p>x</p>
27088 </td><td data-parsoid='{"stx_v":"row", "startTagSrc": "{{!}}{{!}}"}'>y</td></tr>
27089 </tbody></table>
27090 <table>
27091 <tbody>
27092 <tr><th>a
27093 b
27094 </th><th data-parsoid='{"stx_v":"row"}'>c</th></tr>
27095 <tr><th><p>x</h>
27096 </th><th data-parsoid='{"stx_v":"row"}'>y</th></tr>
27097 </tbody></table>
27098 !! wikitext
27099 {|
27100 |a
27101 b
27102 |c
27103 |-
27104 |x
27105 {{!}}y
27106 |}
27107 {|
27108 !a
27109 b
27110 !c
27111 |-
27112 !x
27113 !y
27114 |}
27115 !! end
27116
27117 !! test
27118 T149209: Selser: Handle newlines in table cells properly
27119 !! options
27120 parsoid={
27121 "modes": ["selser"],
27122 "changes": [
27123 [ "#h1", "html", "a\nb\n" ],
27124 [ "#h2", "html", "a\nb\n" ],
27125 [ "#c1", "html", "a\nb\n" ],
27126 [ "#c2", "html", "<p>a</p>" ],
27127 [ "#c3", "html", "<p>a</p>" ],
27128 [ "#c4", "html", "edit-me<p>a</p>" ]
27129 ]
27130 }
27131 !! wikitext
27132 {|
27133 ! id="h1" |edit-me!!1
27134 |-
27135 ! id="h2" |edit-me||2
27136 |-
27137 | id="c1" |edit-me||3
27138 |-
27139 | id="c2" |edit-me||4
27140 |-
27141 | id="c3" |edit-me||p||q||r
27142 |-
27143 | id="c4" |edit-me||p||q||r
27144 |}
27145 !! wikitext/edited
27146 {|
27147 ! id="h1" |a
27148 b
27149 !1
27150 |-
27151 ! id="h2" |a
27152 b
27153 !2
27154 |-
27155 | id="c1" |a
27156 b
27157 |3
27158 |-
27159 | id="c2" |a
27160 |4
27161 |-
27162 | id="c3" |a
27163 |p||q||r
27164 |-
27165 | id="c4" |edit-me
27166 a
27167 |p||q||r
27168 |}
27169 !! end
27170
27171 !! test
27172 HTML id attribute with Parsoid-like element ids should not be serialized to wikitext
27173 !! options
27174 parsoid=html2wt
27175 !! html/parsoid
27176 <table id='mwAb'>
27177 <td id='mwAc'>foo</td>
27178 <td id='serialize-this'>bar</td>
27179 </table>
27180 !! wikitext
27181 {|
27182 |foo
27183 | id="serialize-this" |bar
27184 |}
27185 !! end
27186
27187 !! test
27188 Parsoid-like element ids should not be serialized to wikitext unless shadowed
27189 !! options
27190 parsoid=html2wt
27191 !! html/parsoid
27192 <div id="mwAQ" data-parsoid='{"stx":"html","a":{"id":"mwAQ"},"sa":{"id":"hello"}}'>ok</div>
27193 !! wikitext
27194 <div id="hello">ok</div>
27195 !! end
27196
27197 !! test
27198 WTS change modes
27199 !! options
27200 parsoid={
27201 "modes": ["wt2wt"],
27202 "changes": [
27203 [ "#xyz", "before", "<b>before</b> stuff " ],
27204 [ "#xyz", "after", " stuff <i>after</i>" ],
27205 [ "#xyz", "html", "x <b>y</b> z" ]
27206 ]
27207 }
27208 !! wikitext
27209 <span id="xyz">hello</span>
27210 !! wikitext/edited
27211 '''before''' stuff <span id="xyz">x '''y''' z</span> stuff ''after''
27212 !! end
27213
27214 !! test
27215 Never serialize a-tag as html, regardless of what data-parsoid has to say
27216 !! options
27217 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
27218 !! html/parsoid
27219 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"html"}'>Foo</a>
27220 !! wikitext
27221 [[Foo]]
27222 !! end
27223
27224 ## SSS FIXME: This is broken output nevertheless.
27225 ## What might be a reasonable non-broken output for this?
27226 ## This is an edge case unlikely to be seen in production
27227 ## that I am not wasting more time on this right now.
27228 !! test
27229 Never serialize a-tag as html, no matter what attributes it has
27230 !! options
27231 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
27232 !! html/parsoid
27233 <a bad='true' href='http://boo.org'><img src='http://boohoo.org' /></a>
27234 !! wikitext
27235 [http://boo.org http://boohoo.org]
27236 !! end
27237
27238 # Misnested is an indication that selser can reuse the source but these have
27239 # shown to sneak through on occasion. See T101768.
27240 # The original wikitext here is: [http://test.com [[one]] two three]
27241 !! test
27242 Strip span tags added to mark misnested links
27243 !! options
27244 parsoid=html2wt
27245 !! html/parsoid
27246 <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>
27247 !! wikitext
27248 [http://test.com][[one]] two three
27249 !! end
27250
27251 !! test
27252 Catch regression when unpacking misnested links
27253 !! options
27254 parsoid=wt2html
27255 !! wikitext
27256 {{echo|hi}}[http://example.com [[ho]]]
27257 !! html/parsoid
27258 <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>
27259 !! end
27260
27261 !! test
27262 Use data-parsoid.firstWikitextNode to compute newline constraints for template content
27263 !! options
27264 parsoid=html2wt
27265 !! html/parsoid
27266 <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|}"]}'>
27267 <tbody><tr><td>d
27268 </td></tr>
27269 </tbody></table>
27270 !! wikitext
27271 {{echo|a}}
27272 {|{{echo|c
27273 {{!}}d
27274 }}
27275 |}
27276 !! end
27277
27278 ## This test verifies the presence and computation of this attribute indirectly
27279 ## by making an edit and ensuring that the serialization is correct (which it would be
27280 ## only if firstWikitextNode is properly set).
27281 !! test
27282 data-parsoid.firstWikitextNode should be computed properly in the presence of fostered content
27283 !! options
27284 parsoid= {
27285 "modes": ["wt2wt"],
27286 "changes": [
27287 [ "div#x", "remove" ],
27288 [ "div", "before", "<div>new</div>" ]
27289 ]
27290 }
27291 !! wikitext
27292 <div id="x">foo</div>
27293 {|
27294 {{echo|<div>boo</div>
27295 {{!}}b}}
27296 |c
27297 |}
27298 !! wikitext/edited
27299
27300 <div>new</div>
27301 {|
27302 {{echo|<div>boo</div>
27303 {{!}}b}}
27304 |c
27305 |}
27306 !! end
27307
27308 # --------------------------------------------
27309 # Tests spec'ing wikitext serialization norms |
27310 # --------------------------------------------
27311
27312 !! test
27313 Serialize multi-line indent-pre starting with wikitext syntax
27314 !! options
27315 parsoid=html2wt
27316 !! html/parsoid
27317 <pre>* 1
27318 ** 2
27319 * 3</pre>
27320 !! wikitext
27321 * 1
27322 ** 2
27323 * 3
27324 !! end
27325
27326 !! test
27327 1. Categories should always be serialized on their own line
27328 !! options
27329 parsoid=html2wt
27330 !! html/parsoid
27331 foo<link rel="mw:PageProp/Category" href="./Category:Foo">bar
27332 !! wikitext
27333 foo
27334 [[Category:Foo]]
27335 bar
27336 !! end
27337
27338 !! test
27339 2. Categories that are part of templates should not introduce a line break
27340 !! wikitext
27341 foo {{echo|<span>bar</span> [[Category:baz]]}} bar
27342 !! html/parsoid
27343 <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>
27344 !! end
27345
27346 # Careful while editing these next 2 tests. There are \u200f characters
27347 # before and after the <link> tags in the HTML and following some
27348 # of the categories in wikitext
27349 # Do not remove these characters in edits.
27350 #
27351 # As part of the serialization, these bidi characters will get stripped.
27352 !! test
27353 RTL (\u200f) and LTR (\u200e) markers around category tags should be stripped
27354 !! options
27355 parsoid={
27356 "modes": ["html2wt"],
27357 "scrubWikitext": true
27358 }
27359 !! html/parsoid
27360 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏
27361 ‏<link rel="mw:PageProp/Category" href="./קטגוריה:_שיטות_משפט" />‏</p>
27362 !! wikitext
27363 [[קטגוריה:טקסים]]
27364 [[קטגוריה: שיטות משפט]]
27365 !! end
27366
27367 !! test
27368 RTL (\u200f) and LTR (\u200e) markers should not be stripped if followed by a text node
27369 !! options
27370 parsoid={
27371 "modes": ["html2wt"],
27372 "scrubWikitext": true
27373 }
27374 !! html/parsoid
27375 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏y</p>
27376 !! wikitext
27377 [[קטגוריה:טקסים]]
27378 ‏y
27379 !! end
27380
27381 !! test
27382 Lists: Add space after bullets
27383 !! options
27384 parsoid=html2wt
27385 !! html/parsoid
27386 <ul>
27387 <li>foo</li>
27388 <li> bar</li>
27389 <li><span> baz</span></li>
27390 </ul>
27391 !! wikitext
27392 * foo
27393 * bar
27394 * <span> baz</span>
27395 !! end
27396
27397 !! test
27398 1. Headings: Add space before/after == (T53744)
27399 !! options
27400 parsoid=html2wt
27401 !! html/parsoid
27402 <h2>foo</h2>
27403 <h2> bar</h2>
27404 <h2>baz </h2>
27405 <h2><span> baz</span></h2>
27406 !! wikitext
27407 == foo ==
27408
27409 == bar ==
27410
27411 == baz ==
27412
27413 == <span> baz</span> ==
27414 !! end
27415
27416 !! test
27417 2. Headings: Add space before/after == even after hoisted content
27418 !! options
27419 parsoid={
27420 "modes": ["html2wt"],
27421 "scrubWikitext": true
27422 }
27423 !! html/parsoid
27424 <h2> <link href="./Category:A2" rel="mw:PageProp/Category" />ok</h2>
27425 !! wikitext
27426 [[Category:A2]]
27427
27428 == ok ==
27429 !! end
27430
27431 !! test
27432 1. Headings: suppress newly created empty headings
27433 !! options
27434 parsoid={
27435 "modes": ["html2wt"],
27436 "scrubWikitext": true
27437 }
27438 !! html/parsoid
27439 <h2></h2>
27440 !! wikitext
27441 !! end
27442
27443 !! test
27444 2. Headings: don't suppress empty headings if scrubWikitext is false
27445 !! options
27446 parsoid=html2wt
27447 !! html/parsoid
27448 <h2></h2>
27449 !! wikitext
27450 ==<nowiki/>==
27451 !! end
27452
27453 !! test
27454 3. Headings: suppress empty headings on edits
27455 !! options
27456 parsoid={
27457 "modes": ["selser"],
27458 "scrubWikitext": true,
27459 "changes": [
27460 [ "#x", "remove"]
27461 ]
27462 }
27463 !! wikitext
27464 ==<span id="x">foo</span>==
27465 !! wikitext/edited
27466 !! end
27467
27468 !! test
27469 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = true)
27470 !! options
27471 parsoid={
27472 "modes": ["html2wt"],
27473 "scrubWikitext": true
27474 }
27475 !! html/parsoid
27476 <h2>foo<br/>bar</h2>
27477 <h2>foo <span><br/>bar</span> baz</h2>
27478 !! wikitext
27479 == foo bar ==
27480
27481 == foo <span> bar</span> baz ==
27482 !! end
27483
27484 !! test
27485 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = false)
27486 !! options
27487 parsoid={
27488 "modes": ["html2wt"],
27489 "scrubWikitext": false
27490 }
27491 !! html/parsoid
27492 <h2>foo<br/>bar</h2>
27493 !! wikitext
27494 == foo<br> bar ==
27495 !! end
27496
27497 !! test
27498 1. WT Quote Tags: suppress newly created empty style tags
27499 !! options
27500 parsoid={
27501 "modes": ["html2wt"],
27502 "scrubWikitext": true
27503 }
27504 !! html/parsoid
27505 <i></i><b></b>
27506 !! wikitext
27507 !! end
27508
27509 !! test
27510 2. WT Quote Tags: don't suppress empty style tags if scrubWikitext is false
27511 !! options
27512 parsoid=html2wt
27513 !! html/parsoid
27514 <i></i><b></b>
27515 !! wikitext
27516 ''<nowiki/>'''''<nowiki/>'''
27517 !! end
27518
27519 !! test
27520 3. WT Quote Tags: suppress empty style tags on edits
27521 !! options
27522 parsoid={
27523 "modes": ["selser"],
27524 "scrubWikitext": true,
27525 "changes": [
27526 [ "#x", "remove"]
27527 ]
27528 }
27529 !! wikitext
27530 '''<span id="x">foo</span>'''
27531 !! wikitext/edited
27532 !! end
27533
27534 !! test
27535 1. Anchors: suppress newly created empty anchors
27536 !! options
27537 parsoid={
27538 "modes": ["html2wt"],
27539 "scrubWikitext": true
27540 }
27541 !! html/parsoid
27542 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
27543 !! wikitext
27544 !! end
27545
27546 !! test
27547 2. Anchors: don't suppress empty anchors if scrubWikitext is false
27548 !! options
27549 parsoid={
27550 "modes": ["html2wt"],
27551 "scrubWikitext": false
27552 }
27553 !! html/parsoid
27554 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
27555 !! wikitext
27556 [[Test|<nowiki/>]]
27557 !! end
27558
27559 !! test
27560 3. Anchors: suppress empty anchors on edits
27561 !! options
27562 parsoid={
27563 "modes": ["selser"],
27564 "scrubWikitext": true,
27565 "changes": [
27566 [ "#x", "remove"]
27567 ]
27568 }
27569 !! wikitext
27570 [[Test|<span id="x">foo</span>]]
27571 !! wikitext/edited
27572 !! end
27573
27574 !! test
27575 3a. Anchors: do not suppress numbered extlinks
27576 !! options
27577 parsoid={
27578 "modes": ["wt2wt"],
27579 "scrubWikitext": true
27580 }
27581 !! wikitext
27582 [http://foo.com]
27583 !! html/parsoid
27584 <a rel="mw:ExtLink" href="http://foo.com"></a>
27585 !! end
27586
27587 !! test
27588 3b. Anchors: do not suppress numbered extlinks
27589 !! options
27590 parsoid={
27591 "modes": ["wt2wt"],
27592 "scrubWikitext": true,
27593 "changes": [
27594 [ "#x", "remove"]
27595 ]
27596 }
27597 !! wikitext
27598 [http://foo.com <span id="x">foo</span>]
27599 !! wikitext/edited
27600 [http://foo.com]
27601 !! end
27602
27603 !!test
27604 Normalizations should be restricted to edited content
27605 !!options
27606 parsoid={
27607 "modes": ["selser"],
27608 "scrubWikitext": true,
27609 "changes": [
27610 [ "h1", "before", "<i></i>"]
27611 ]
27612 }
27613 !!wikitext
27614 a
27615 = =
27616 b
27617 !!wikitext/edited
27618 a
27619 = =
27620 b
27621 !!end
27622
27623 !! test
27624 1. Multiple normalizations (html2wt)
27625 !! options
27626 parsoid={
27627 "modes": ["html2wt"],
27628 "scrubWikitext": true
27629 }
27630 !! html
27631 <h2><i></i></h2>
27632 <p><a href='Foo' rel='mw:WikiLink'>foo<i></i>
27633 </a><b><i></i></b>x</p>
27634 !! wikitext
27635
27636 [[foo]]
27637 x
27638
27639 !! end
27640
27641 !! test
27642 2. Multiple normalizations (selser)
27643 !! options
27644 parsoid={
27645 "modes": ["selser"],
27646 "scrubWikitext": true,
27647 "changes": [
27648 [ "#x", "after", "<h1><i></i></h1>\n<p> x<b></b></p>"]
27649 ]
27650 }
27651 !! wikitext
27652 <span id="x">foo</span>
27653 !! wikitext/edited
27654 <span id="x">foo</span>
27655
27656 x
27657 !! end
27658
27659 !! test
27660 1. Indent Pre Nowiki: suppress whitespace at the start of new paragraph
27661 !! options
27662 parsoid={
27663 "modes": ["html2wt"],
27664 "scrubWikitext": true
27665 }
27666 !! html/parsoid
27667 <p> hi</p>
27668 <p> hello</p>
27669 !! wikitext
27670 hi
27671
27672 hello
27673 !! end
27674
27675 !! test
27676 2. Indent Pre Nowiki: don't suppress whitespace at the start of new paragraph if scrubWikitext is false
27677 !! options
27678 parsoid=html2wt
27679 !! html/parsoid
27680 <p> hi</p>
27681 <p> hello</p>
27682 !! wikitext
27683 <nowiki> </nowiki>hi
27684
27685 <nowiki> </nowiki> hello
27686 !! end
27687
27688 !! test
27689 3. Indent Pre Nowiki: suppress whitespace after newlines in new paragraph or table cell
27690 !! options
27691 parsoid={
27692 "modes": ["html2wt"],
27693 "scrubWikitext": true
27694 }
27695 !! html/parsoid
27696 <p>Foo
27697 bar
27698 baz</p>
27699
27700 <table><tr><td>Foo
27701 bar
27702 baz bang</td></tr></table>
27703
27704 <p><!--boo--> foo
27705 bar</p>
27706
27707 <p> foo
27708 bar<span>boo</span></p>
27709 !! wikitext
27710 Foo
27711 bar
27712 baz
27713
27714 {|
27715 |Foo
27716 bar
27717 baz bang
27718 |}
27719
27720 <!--boo-->foo
27721 bar
27722
27723 foo
27724 bar<span>boo</span>
27725 !! end
27726
27727 !! test
27728 4. Indent Pre Nowiki: suppress leading whitespace in edited paragraphs
27729 !! options
27730 parsoid={
27731 "modes": ["selser"],
27732 "scrubWikitext": true,
27733 "changes": [
27734 [ "p", "html", " a\n b" ]
27735 ]
27736 }
27737 !! wikitext
27738 xyz
27739 !! wikitext/edited
27740 a
27741 b
27742 !! end
27743
27744 !! test
27745 1. New links that end in spaces
27746 !! options
27747 parsoid={
27748 "modes": ["html2wt"],
27749 "scrubWikitext": false
27750 }
27751 !! html/parsoid
27752 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
27753 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
27754 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
27755 !! wikitext
27756 [[Berlin ]]<nowiki/>is the capital of Germany.
27757
27758 [[Foo ]]'''bar'''
27759
27760 [[Boston ]] is a city.
27761 !! end
27762
27763 !! test
27764 2. New links that end in spaces
27765 !! options
27766 parsoid={
27767 "modes": ["html2wt"],
27768 "scrubWikitext": true
27769 }
27770 !! html/parsoid
27771 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
27772 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
27773 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
27774 !! wikitext
27775 [[Berlin]] is the capital of Germany.
27776
27777 [[Foo]] '''bar'''
27778
27779 [[Boston]] is a city.
27780 !! end
27781
27782 !! test
27783 1. Table cells with escapable prefixes
27784 !! options
27785 parsoid={
27786 "modes": ["html2wt"],
27787 "scrubWikitext": false
27788 }
27789 !! html
27790 <table>
27791 <tr><td>a</td></tr>
27792 <tr><td>-</td></tr>
27793 <tr><td>+</td></tr>
27794 </table>
27795 !! wikitext
27796 {|
27797 |a
27798 |-
27799 |<nowiki>-</nowiki>
27800 |-
27801 |<nowiki>+</nowiki>
27802 |}
27803 !! end
27804
27805 !! test
27806 2. Table cells with escapable prefixes
27807 !! options
27808 parsoid={
27809 "modes": ["html2wt"],
27810 "scrubWikitext": true
27811 }
27812 !! html
27813 <table>
27814 <tr><td>a</td></tr>
27815 <tr><td>-</td></tr>
27816 <tr><td>+</td></tr>
27817 </table>
27818 !! wikitext
27819 {|
27820 |a
27821 |-
27822 | -
27823 |-
27824 | +
27825 |}
27826 !! end
27827
27828 !! test
27829 3a. Table cells with escapable prefixes after edits
27830 !! options
27831 parsoid={
27832 "modes": ["selser"],
27833 "scrubWikitext": true,
27834 "changes": [
27835 [ "table tbody tr:first-child td:first-child", "remove"]
27836 ]
27837 }
27838 !! wikitext
27839 {|
27840 |a||-
27841 |}
27842 !! wikitext/edited
27843 {|
27844 | -
27845 |}
27846 !! end
27847
27848 !! test
27849 3b. Table cells with escapable prefixes after edits
27850 !! options
27851 parsoid={
27852 "modes": ["selser"],
27853 "scrubWikitext": true,
27854 "changes": [
27855 [ "table tbody tr:first-child td:first-child", "html", "-" ],
27856 [ "#x", "remove" ]
27857 ]
27858 }
27859 !! wikitext
27860 {|
27861 |pqr
27862 |<span id="x">foo</span>+
27863 |}
27864 !! wikitext/edited
27865 {|
27866 | -
27867 | +
27868 |}
27869 !! end
27870
27871 # FIXME: This test will fail because
27872 # normalization doesn't realize that the id attribute
27873 # will eliminate the escapable scenario
27874 !! test
27875 4a. Table cells without escapable prefixes after edits
27876 !! options
27877 parsoid={
27878 "modes": ["selser"],
27879 "scrubWikitext": true,
27880 "changes": [
27881 [ "#x", "html", "-" ]
27882 ]
27883 }
27884 !! wikitext
27885 {|
27886 | id="x" |abcd
27887 |}
27888 !! wikitext/edited
27889 {|
27890 | id="x" |-
27891 |}
27892 !! end
27893
27894 ## This tests normalizer's ability to discriminate between
27895 ## cells having identical content.
27896 !! test
27897 4b. Table cells without escapable prefixes after edits
27898 !! options
27899 parsoid={
27900 "modes": ["selser"],
27901 "scrubWikitext": true,
27902 "changes": [
27903 [ "td", "html", "-" ]
27904 ]
27905 }
27906 !! wikitext
27907 {|
27908 |a||b
27909 |}
27910 !! wikitext/edited
27911 {|
27912 | -||-
27913 |}
27914 !! end
27915
27916 ## This tests normalizer's ability to not be tripped by
27917 ## comments (and whitespace)
27918 !! test
27919 4c. Table cells without escapable prefixes after edits
27920 !! options
27921 parsoid={
27922 "modes": ["selser"],
27923 "scrubWikitext": true,
27924 "changes": [
27925 [ "table tbody tr td:first-child", "remove" ]
27926 ]
27927 }
27928 !! wikitext
27929 {|
27930 |-
27931 <!--foo--> |a||-
27932 |}
27933 !! wikitext/edited
27934 {|
27935 |-
27936 <!--foo--> | -
27937 |}
27938 !! end
27939
27940 ## This tests normalizer's ability to handle HTML cells
27941 !! test
27942 4d. Table cells without escapable prefixes after edits
27943 !! options
27944 parsoid={
27945 "modes": ["selser"],
27946 "scrubWikitext": true,
27947 "changes": [
27948 [ "td", "html", "-" ]
27949 ]
27950 }
27951 !! wikitext
27952 <table>
27953 <tr><td>a</td></tr>
27954 </table>
27955 !! wikitext/edited
27956 <table>
27957 <tr><td>-</td></tr>
27958 </table>
27959 !! end
27960
27961 ## T111151 Remove font elements without attributes
27962 !! test
27963 5a. font tags without attributes should be dropped in scrubWikitext mode
27964 !! options
27965 parsoid={
27966 "modes": ["html2wt"],
27967 "scrubWikitext": true
27968 }
27969 !! html
27970 <font>foo</font>
27971 <font><font>bar</font></font>
27972 <font class="x">boo</font>
27973 !! wikitext
27974 foo
27975 bar
27976 <font class="x">boo</font>
27977 !! end
27978
27979 !! test
27980 5b. font tags should not be dropped without scrubWikitext being enabled
27981 !! options
27982 parsoid={
27983 "modes": ["html2wt"],
27984 "scrubWikitext": false
27985 }
27986 !! html
27987 <font>foo</font>
27988 !! wikitext
27989 <font>foo</font>
27990 !! end
27991
27992 !! test
27993 Escape nowiki DOM elements
27994 !! options
27995 parsoid=html2wt
27996 !! html/parsoid
27997 <nowiki><i>foo</i></nowiki>
27998 !! wikitext
27999 &lt;nowiki&gt;''foo''&lt;/nowiki&gt;
28000 !! end
28001
28002 # This is meant to be an interim fix while we go about figuring out
28003 # how to not introduce these trailing <nowiki/>s in the first place.
28004 !! test
28005 T115717: Strip trailing <nowiki/>s (without affecting valid uses)
28006 !! options
28007 parsoid=html2wt
28008 !! html/parsoid
28009 <p>x<meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/>
28010 y</p>
28011 <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>
28012 <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>
28013 !! wikitext
28014 x
28015 y
28016
28017 {{echo|
28018 1 = <nowiki/>}}
28019
28020 {{echo|
28021 1 = <nowiki/>
28022 }}
28023 !! end
28024
28025 # ---------------------------------------------------
28026 # End of tests spec'ing wikitext serialization norms |
28027 # ---------------------------------------------------
28028
28029 # T104032
28030 !! test
28031 Bare inline nodes not wrapped inside p-tags should be treated as p-wrapped
28032 !! options
28033 parsoid=html2wt
28034 !! html/parsoid
28035 a<p>b</p>
28036 <b>c</b><p>d</p>
28037 <table><tr>
28038 <td>a<p>b</p></td>
28039 <td><b>c</b><p>d</p></td>
28040 </tr></table>
28041 !! wikitext
28042 a
28043
28044 b
28045
28046 '''c'''
28047
28048 d
28049 {|
28050 |a
28051 b
28052 |'''c'''
28053 d
28054 |}
28055 !! end
28056
28057 !! test
28058 Anchor without href scenarios
28059 !! options
28060 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
28061 !! html/parsoid
28062 <a class="bc"></a>
28063 <a class="no">dice</a>
28064 <a name="foo"></a>
28065 !! wikitext
28066
28067 dice
28068 <span name="foo"></span>
28069 !! end
28070
28071 # -----------------------------------------------------------------
28072 # End of section for Parsoid-only html2wt tests for serialization
28073 # of new content
28074 # -----------------------------------------------------------------
28075
28076 # -----------------------------------------------------------------
28077 # The following section of tests are primarily to spec behavior of
28078 # the selective serializer. All these tests have manual selser
28079 # changes. The automated selser changes for all tests handle the
28080 # wide variation of changes, but these tests here capture specs
28081 # deterministically.
28082 # ----------------------------------------------------------------
28083
28084 ## T90517
28085 !! test
28086 Selser: New comments should not be lost
28087 !! options
28088 parsoid={
28089 "modes": ["selser"],
28090 "changes": [
28091 [ "#a", "after", "<!--c1-->" ],
28092 [ "#b", "before", "<!--c2-->" ]
28093 ]
28094 }
28095 !! wikitext
28096 <span id="a">a</span>
28097
28098 <span id="b">b</span>
28099 !! wikitext/edited
28100 <span id="a">a</span><!--c1-->
28101
28102 <!--c2--><span id="b">b</span>
28103 !! end
28104
28105 ## T89383
28106 !! test
28107 Selser: Check for validity of DSR before using it
28108 !! options
28109 parsoid={
28110 "modes": ["selser"],
28111 "changes": [
28112 [ "#a", "before", "<meta property='mw:PageProp/displaytitle' content='foo'>" ]
28113 ]
28114 }
28115 !! wikitext
28116 <span id="a">a</span>
28117 !! wikitext/edited
28118 {{DISPLAYTITLE:foo}}
28119 <span id="a">a</span>
28120 !! end
28121
28122 !! test
28123 1. DOMDiff: Changes to <ref> content should be looked up using id
28124 !! options
28125 parsoid={
28126 "modes": ["selser"],
28127 "changes": [
28128 ["#X", "after", "bar"],
28129 ["#Y", "after", "baz"]
28130 ]
28131 }
28132 !! wikitext
28133 X <ref><span id="X">foo</span></ref>
28134 Y <ref name="a" />
28135 <references>
28136 <ref name="a"><span id="Y">foo</span></ref>
28137 </references>
28138 !! wikitext/edited
28139 X <ref><span id="X">foo</span>bar</ref>
28140 Y <ref name="a" />
28141 <references>
28142 <ref name="a"><span id="Y">foo</span>baz</ref>
28143 </references>
28144 !! end
28145
28146 !! test
28147 2. DOMDiff: Changes to <ref> content should be looked up using id
28148 !! options
28149 parsoid={
28150 "modes": ["selser"],
28151 "changes": [
28152 ["#Z", "after", "bar"]
28153 ]
28154 }
28155 !! wikitext
28156 A <ref>foo bar for a</ref>
28157 B <ref group="X" name="b" />
28158
28159 <references />
28160
28161 <references group="X">
28162 <ref name="b"><span id="Z">foo</span></ref>
28163 </references>
28164 !! wikitext/edited
28165 A <ref>foo bar for a</ref>
28166 B <ref group="X" name="b" />
28167
28168 <references />
28169
28170 <references group="X">
28171 <ref name="b"><span id="Z">foo</span>bar</ref>
28172 </references>
28173 !! end
28174
28175 !! test
28176 DOMDiff: Edits to content nested in elements with templated attributes should not be lost (T139388)
28177 !! options
28178 parsoid={
28179 "modes": ["selser"],
28180 "changes": [
28181 [ "div:first-child", "text", "bar" ]
28182 ]
28183 }
28184 !! wikitext
28185 <div style="{{1x|color:red;}}%">foo</div>
28186 !! wikitext/edited
28187 <div style="{{1x|color:red;}}%">bar</div>
28188 !! end
28189
28190 !! test
28191 Empty LI (T49673)
28192 !! wikitext
28193 * a
28194 *
28195 *
28196 * b
28197 !! html/php+tidy
28198 <ul>
28199 <li>a</li>
28200 <li class="mw-empty-elt"></li>
28201 <li class="mw-empty-elt"></li>
28202 <li>b</li>
28203 </ul>
28204 !! end
28205
28206 !! test
28207 Thumbnail output
28208 !! wikitext
28209 [[File:Thumb.png|thumb]]
28210 !! html/php+tidy
28211 <div class="thumb tright">
28212 <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>
28213 <div class="thumbcaption">
28214 <div class="magnify"><a href="/wiki/File:Thumb.png" class="internal" title="Enlarge"></a></div>
28215 </div>
28216 </div>
28217 </div>
28218 !! end
28219
28220 !! test
28221 unclosed internal link XSS (T137264)
28222 !! wikitext
28223 [[#%3Cscript%3Ealert(1)%3C/script%3E|
28224 !! html/php
28225 <p>[[#&lt;script&gt;alert(1)&lt;/script&gt;|
28226 </p>
28227 !! html/parsoid
28228 <p>[[#%3Cscript%3Ealert(1)%3C/script%3E|</p>
28229 !! end