Merge "SpecialRecentchanges: Add class="mw-recentchanges-toplinks" to the "top links""
[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: Handle empty comment-and-ws-only lines correctly
2741 !! wikitext
2742 {{echo|foo
2743 <!--should be ignored-->
2744 <!--should be ignored as well-->
2745 bar}}
2746 !! html/php
2747 <p>foo
2748 bar
2749 </p>
2750 !! html/parsoid
2751 <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>
2752 !! end
2753
2754 !! test
2755 Templates: Handle comments in the target
2756 !! wikitext
2757 {{echo
2758 <!-- should be ignored -->
2759 |foo}}
2760
2761 {{echo
2762 <!-- should be ignored and spaces on next line should not trip us up (T147742) -->
2763 |foo}}
2764
2765 {{echo<!-- should be ignored -->
2766 |foo}}
2767
2768 {{echo<!-- should be ignored -->|foo}}
2769
2770 {{<!-- should be ignored -->echo|foo}}
2771 !! html/php
2772 <p>foo
2773 </p><p>foo
2774 </p><p>foo
2775 </p><p>foo
2776 </p><p>foo
2777 </p>
2778 !! html/parsoid
2779 <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>
2780
2781 <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>
2782
2783 <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>
2784
2785 <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>
2786
2787 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2788 !!end
2789
2790 !! test
2791 Templates: Handle comments in parameter names (T69657)
2792 !! wikitext
2793 {{echo|1
2794 <!-- should be ignored -->
2795 =foo}}
2796
2797 {{echo|
2798 <!-- should be ignored -->
2799 1 = foo}}
2800
2801 {{echo|1<!-- should be ignored -->=foo}}
2802
2803 {{echo|<!-- should be ignored -->1=foo}}
2804 !! html/php
2805 <p>foo
2806 </p><p>foo
2807 </p><p>foo
2808 </p><p>foo
2809 </p>
2810 !! html/parsoid
2811 <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>
2812
2813 <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>
2814
2815 <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>
2816
2817 <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>
2818 !!end
2819
2820 !! test
2821 Templates: Other wikitext in parameter names (T69657)
2822 !! wikitext
2823 {{echo|''1''=foo}}
2824 !! html/php
2825 <p>{{{1}}}
2826 </p>
2827 !! html/parsoid
2828 <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>
2829 !!end
2830
2831 #--------------------------------------------------------------------
2832 # Transclusion parameter escaping tests
2833 #--------------------------------------------------------------------
2834 !! test
2835 Templates: Parsoid parameter escaping test 1
2836 !! wikitext
2837 {{echo|[foo]|{{echo|[bar]}}}}
2838 !! html/php+tidy
2839 <p>[foo]</p>
2840 !! html/parsoid
2841 <p about="#mwt1" typeof="mw:Transclusion"
2842 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[foo]"},"2":{"wt":"{{echo|[bar]}}"}},"i":0}}]}'>[foo]</p>
2843 !! end
2844
2845 !! test
2846 Parsoid: Pipes in external links in template parameter
2847 !! wikitext
2848 {{echo|[{{echo|http://example.com}} link]}}
2849 !! html/php+tidy
2850 <p><a rel="nofollow" class="external text" href="http://example.com">link</a></p>
2851 !! html/parsoid
2852 <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>
2853 !! end
2854
2855 !! test
2856 Parsoid: pipe in transclusion parameter
2857 !! wikitext
2858 {{echo|http://foo.com/a&#124;b}}
2859 !! html/php+tidy
2860 <p><a rel="nofollow" class="external free" href="http://foo.com/a%7Cb">http://foo.com/a%7Cb</a></p>
2861 !! html/parsoid
2862 <p><a rel="mw:ExtLink" href="http://foo.com/a%7Cb" about="#mwt1"
2863 typeof="mw:Transclusion"
2864 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>
2865 !! end
2866
2867 !! test
2868 Parsoid: Pipe in external link target and content in template parameter
2869 !! options
2870 parsoid=html2wt,wt2wt
2871 !! wikitext
2872 {{echo|[http://foo.com/a&#124;b a&#124;b]}}
2873 !! html/php+tidy
2874 <p><a rel="nofollow" class="external text" href="http://foo.com/a%7Cb">a|b</a></p>
2875 !! html/parsoid
2876 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2877 typeof="mw:Transclusion"
2878 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},
2879 "params":{"1":{"wt":"[http://foo.com/a|b a|b]"}},"i":0}}]}'>a|b</a></p>
2880 !! end
2881
2882 !! test
2883 Parsoid: Pipe in template with nested template in external link target in template parameter (seriously)
2884 !! options
2885 parsoid
2886 !! wikitext
2887 {{echo|[{{fullurl:{{FULLPAGENAME}}|action=edit}} bar]}}
2888 !! html
2889 <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>
2890 !! end
2891
2892 !! test
2893 Templates: Don't escape already nowiki-escaped text in template parameters
2894 !! options
2895 parsoid=html2wt,wt2wt
2896 !! wikitext
2897 {{echo|foo<nowiki>|</nowiki>bar}}
2898 {{echo|<nowiki>&lt;div&gt;</nowiki>}}
2899 {{echo|<nowiki></nowiki>}}
2900 !! html/php+tidy
2901 <p>foo|bar &lt;div&gt;</p>
2902 !! html/parsoid
2903 <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>
2904 <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>
2905 <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>
2906 </p>
2907 !! end
2908
2909 ## T54824
2910 !! test
2911 Templates: '=' char in nested transclusions should not trigger nowiki escapes or conversion to named param
2912 !! options
2913 parsoid=html2wt,wt2wt
2914 !! wikitext
2915 {{echo|{{echo|1=bar}}}}
2916 !! html/php+tidy
2917 <p>bar</p>
2918 !! html/parsoid
2919 <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>
2920 !! end
2921
2922 ## T58733
2923 !! test
2924 Templates parameters with special tokenizing behavior dont get modified because of arg escaping
2925 !! wikitext
2926 {{echo|a : b}}
2927 !! html/php+tidy
2928 <p>a&#160;: b</p>
2929 !! html/parsoid
2930 <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>
2931 !! end
2932
2933 ## T73412
2934 !! test
2935 Templates: Preserve blank parameter names
2936 !! wikitext
2937 {{echo|=foo}}
2938 !! html/php+tidy
2939 <p>{{{1}}}</p>
2940 !! html/parsoid
2941 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"":{"wt":"foo"}},"i":0}}]}'>{{{1}}}</p>
2942 !! end
2943
2944 !! test
2945 Templates: Preserve blank parameter names in other positions
2946 !! wikitext
2947 {{blank_param|bar|=foo}}
2948 !! html/php+tidy
2949 <p>bar foo</p>
2950 !! html/parsoid
2951 <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
2952 foo</p>
2953 !! end
2954
2955 ###
2956 ### Parsoid-centric tests for testing RT edge cases for pre
2957 ###
2958
2959 !!test
2960 1a. Indent-Pre and Comments
2961 !! wikitext
2962 a
2963 <!--a-->
2964 c
2965 !! html
2966 <pre>a
2967 </pre>
2968 <p>c
2969 </p>
2970 !!end
2971
2972 !!test
2973 1b. Indent-Pre and Comments
2974 !! wikitext
2975 a
2976 <!--a-->
2977 c
2978 !! html
2979 <pre>a
2980 </pre>
2981 <p>c
2982 </p>
2983 !!end
2984
2985 !!test
2986 1c. Indent-Pre and Comments
2987 !! wikitext
2988 <!--a--> a
2989
2990 <!--a--> a
2991 !! html
2992 <pre> a
2993 </pre>
2994 <pre> a
2995 </pre>
2996 !!end
2997
2998 !!test
2999 1d. Indent-Pre and Comments
3000 (Pre-handler currently cannot distinguish between comment/ws order and normalizes them to [comment,ws] order)
3001 !! wikitext
3002 <!--a--> a
3003
3004 <!--b-->b
3005 !! html
3006 <pre>a
3007 </pre>
3008 <pre>b
3009 </pre>
3010 !!end
3011
3012 !!test
3013 2a. Indent-Pre and tables
3014 !! wikitext
3015 {|
3016 |-
3017 !h1!!h2
3018 |foo||bar
3019 |}
3020 !! html
3021 <table>
3022
3023 <tr>
3024 <th>h1</th>
3025 <th>h2
3026 </th>
3027 <td>foo</td>
3028 <td>bar
3029 </td></tr></table>
3030
3031 !!end
3032
3033 !!test
3034 2b. Indent-Pre and tables
3035 !! wikitext
3036 {|
3037 |-
3038 |foo
3039 |}
3040 !! html
3041 <table>
3042
3043 <tr>
3044 <td>foo
3045 </td></tr></table>
3046
3047 !!end
3048
3049 !!test
3050 2c. Indent-Pre and tables (T44252)
3051 !! wikitext
3052 {|
3053 |+ foo
3054 ! | bar
3055 |}
3056 !! html
3057 <table>
3058 <caption> foo
3059 </caption>
3060 <tr>
3061 <th> bar
3062 </th></tr></table>
3063
3064 !!end
3065
3066 !!test
3067 2d. Indent-Pre and tables
3068 !! wikitext
3069 a
3070 {|
3071 | b
3072 |}
3073 !! html/php
3074 <pre>a
3075 </pre>
3076 <table>
3077 <tr>
3078 <td> b
3079 </td></tr></table>
3080
3081 !! html/parsoid
3082 <pre>a</pre>
3083 <table>
3084 <tbody><tr><td> b</td></tr>
3085 </tbody></table>
3086 !!end
3087
3088 !!test
3089 2e. Indent-Pre and table-line syntax
3090 !! wikitext
3091 a
3092 | b
3093 | c
3094 !! html/php
3095 <pre>a
3096 | b
3097 | c
3098 </pre>
3099 !!end
3100
3101 !!test
3102 2f. Indent-pre started by table-line syntax
3103 !! wikitext
3104 a
3105 | b
3106 | c
3107 !! html/php
3108 <p>a
3109 </p>
3110 <pre>| b
3111 | c
3112 </pre>
3113 !! html/parsoid
3114 <p>a</p>
3115 <pre>
3116 | b
3117 | c</pre>
3118 !!end
3119
3120 !! test
3121 2g. Indented table markup mixed with indented pre content (proposed in T8200)
3122 !! wikitext
3123 <table>
3124 <tr>
3125 <td>
3126 Text that should be rendered preformatted
3127 </td>
3128 </tr>
3129 </table>
3130 !! html
3131 <table>
3132 <tr>
3133 <td>
3134 <pre>Text that should be rendered preformatted
3135 </pre>
3136 </td>
3137 </tr>
3138 </table>
3139
3140 !! end
3141
3142 !!test
3143 3a. Indent-Pre and block tags (single-line html)
3144 !! wikitext
3145 a <p> foo </p>
3146 b <div> foo </div>
3147 c <blockquote> foo </blockquote>
3148 <span> foo </span>
3149 !! html
3150 a <p> foo </p>
3151 b <div> foo </div>
3152 c <blockquote> foo </blockquote>
3153 <pre><span> foo </span>
3154 </pre>
3155 !! html/parsoid
3156 <p>a </p><p data-parsoid='{"stx":"html"}'> foo </p>
3157 <p>b </p><div data-parsoid='{"stx":"html"}'> foo </div>
3158 <p>c </p><blockquote data-parsoid='{"stx":"html"}'> foo </blockquote>
3159 <pre><span> foo </span>
3160 </pre>
3161 !! html+tidy
3162 <p>a</p>
3163 <p>foo</p>
3164 <p>b</p>
3165 <div>foo</div>
3166 <p>c</p>
3167 <blockquote>
3168 <p>foo</p>
3169 </blockquote>
3170 <pre>
3171 <span> foo </span>
3172 </pre>
3173 !! end
3174
3175 !!test
3176 3b. Indent-Pre and block tags (multi-line html)
3177 !! wikitext
3178 a <span>foo</span>
3179 b <div> foo </div>
3180 !! html
3181 <pre>a <span>foo</span>
3182 </pre>
3183 b <div> foo </div>
3184
3185 !! html/parsoid
3186 <pre>a <span data-parsoid='{"stx":"html"}'>foo</span></pre>
3187 b <div data-parsoid='{"stx":"html"}'> foo </div>
3188 !! html+tidy
3189 <pre>
3190 a <span>foo</span>
3191 </pre>
3192 <p>b</p>
3193 <div>foo</div>
3194 !!end
3195
3196 !!test
3197 3c. Indent-Pre and block tags (pre-content on separate line)
3198 !! wikitext
3199 <p>
3200 foo
3201 </p>
3202
3203 <div>
3204 foo
3205 </div>
3206
3207 <center>
3208 foo
3209 </center>
3210
3211 <blockquote>
3212 foo
3213 </blockquote>
3214
3215 <blockquote>
3216 <pre>
3217 foo
3218 </pre>
3219 </blockquote>
3220
3221 <table><tr><td>
3222 foo
3223 </td></tr></table>
3224
3225 <ul><li>
3226 foo
3227 </li></ul>
3228
3229 !! html
3230 <p>
3231 foo
3232 </p>
3233 <div>
3234 <pre>foo
3235 </pre>
3236 </div>
3237 <center>
3238 <pre>foo
3239 </pre>
3240 </center>
3241 <blockquote>
3242 <p> foo
3243 </p>
3244 </blockquote>
3245 <blockquote>
3246 <pre>
3247 foo
3248 </pre>
3249 </blockquote>
3250 <table><tr><td>
3251 <pre>foo
3252 </pre>
3253 </td></tr></table>
3254 <ul><li>
3255 foo
3256 </li></ul>
3257
3258 !!end
3259
3260 !! test
3261 4. Indent-Pre and extension tags
3262 !! wikitext
3263 a <tag />
3264 !! html/php
3265 a <pre>
3266 NULL
3267 array (
3268 )
3269 </pre>
3270
3271 !! html/parsoid
3272 a <pre typeof="mw:Extension/tag" about="#mwt2" data-parsoid='{}' data-mw='{"name":"tag","attrs":{},"body":null}'></pre>
3273 !! end
3274
3275 !! test
3276 5. Indent-Pre and html pre
3277 !! wikitext
3278 <pre class="123">hi</pre>
3279 !! html/php
3280 <pre class="123">hi</pre>
3281
3282 !! html/parsoid
3283 <pre typeof="mw:Extension/pre" about="#mwt2" class="123" data-mw='{"name":"pre","attrs":{"class":"123"},"body":{"extsrc":"hi"}}'>hi</pre>
3284 !! end
3285
3286 !!test
3287 Render paragraphs when indent-pre is suppressed in blocklevels
3288 !! wikitext
3289 <blockquote>
3290 foo
3291
3292 bar
3293 </blockquote>
3294 !! html
3295 <blockquote>
3296 <p> foo
3297 </p><p> bar
3298 </p>
3299 </blockquote>
3300
3301 !!end
3302
3303 !!test
3304 4. Multiple spaces at start-of-line
3305 !! wikitext
3306 <p> foo </p>
3307 foo
3308 {|
3309 |foo
3310 |}
3311 !! html
3312 <p> foo </p>
3313 <pre> foo
3314 </pre>
3315 <table>
3316 <tr>
3317 <td>foo
3318 </td></tr></table>
3319
3320 !!end
3321
3322 ## NOTE: the leading white-space chars on empty line are significant
3323 !! test
3324 5a. White-space in indent-pre
3325 !! wikitext
3326 a<br />
3327
3328 b
3329 !! html
3330 <pre>a<br />
3331
3332 b
3333 </pre>
3334 !! end
3335
3336 ## NOTE: the leading white-space chars on empty line are significant
3337 !! test
3338 5b. White-space in indent-pre
3339 !! wikitext
3340 a
3341
3342 b
3343
3344
3345 c
3346 !! html
3347 <pre>a
3348
3349 b
3350
3351
3352 c
3353 </pre>
3354 !! end
3355
3356 !! test
3357 5c. White-space in indent-pre
3358 !! wikitext
3359 ''a''
3360 ''b''
3361 ''c''
3362 !! html
3363 <pre><i>a</i>
3364 <i>b</i>
3365 <i>c</i>
3366 </pre>
3367 !! end
3368
3369 !! test
3370 6. Pre-blocks should extend across lines with leading WS even when there is no wrappable content
3371 !! wikitext
3372 a
3373
3374 <!-- continue -->
3375 b
3376
3377 c
3378
3379 d
3380 !! html
3381 <pre>a
3382
3383 b
3384 </pre>
3385 <pre>c
3386
3387 </pre>
3388 <p>d
3389 </p>
3390 !! end
3391
3392 !! test
3393 7a. Indent-pre and category links
3394 !! options
3395 parsoid=wt2html,wt2wt
3396 !! wikitext
3397 [[Category:foo]] <!-- No pre-wrapping -->
3398 {{echo| [[Category:foo]]}} <!-- No pre-wrapping -->
3399 !! html/php+tidy
3400 !! html/parsoid
3401 <link rel="mw:PageProp/Category" href="./Category:Foo"> <!-- No pre&#x2D;wrapping -->
3402 <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 -->
3403 !! end
3404
3405 ## We used to, but no longer wt2wt this test since the default serializer
3406 ## will normalize all categories to serialize on their own line.
3407 ## This wikitext usage is going to be fairly uncommon in production and
3408 ## selser will take care of preserving formatting in those scenarios.
3409 !! test
3410 7b. Indent-pre and category links
3411 !! options
3412 parsoid=wt2html
3413 !! wikitext
3414 [[Category:foo]] a
3415 [[Category:foo]] {{echo|b}}
3416 !! html/parsoid
3417 <pre><link rel="mw:PageProp/Category" href="./Category:Foo"> a
3418 <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>
3419 !! end
3420
3421 !! test
3422 Indent-Pre: Newlines in comments shouldn't affect sol state
3423 !! wikitext
3424 a <!--
3425 foo
3426 --> b
3427 !! html/php+tidy
3428 <p>a b</p>
3429 !! html/parsoid
3430 <p>a <!--
3431 foo
3432 --> b</p>
3433 !! end
3434
3435 ###
3436 ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
3437 ###
3438
3439 !!test
3440 HTML-pre: 1. embedded newlines
3441 !! wikitext
3442 <pre>foo</pre>
3443
3444 <pre>
3445 foo
3446 </pre>
3447
3448 <pre>
3449
3450 foo
3451 </pre>
3452
3453 <pre>
3454
3455
3456 foo
3457 </pre>
3458 !! html/php+tidy
3459 <pre>
3460 foo
3461 </pre>
3462 <pre>
3463 foo
3464 </pre>
3465 <pre>
3466
3467 foo
3468 </pre>
3469 <pre>
3470
3471
3472 foo
3473 </pre>
3474 !! html/parsoid
3475 <pre typeof="mw:Extension/pre" about="#mwt2" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"foo"}}'>foo</pre>
3476
3477 <pre typeof="mw:Extension/pre" about="#mwt4" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\nfoo\n"}}'>foo
3478 </pre>
3479
3480 <pre typeof="mw:Extension/pre" about="#mwt6" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\n\nfoo\n"}}'>
3481
3482 foo
3483 </pre>
3484
3485 <pre typeof="mw:Extension/pre" about="#mwt8" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\n\n\nfoo\n"}}'>
3486
3487
3488 foo
3489 </pre>
3490 !!end
3491
3492 !! test
3493 HTML-pre: big spaces
3494 !! wikitext
3495 <pre>
3496
3497
3498
3499
3500 haha
3501
3502
3503
3504
3505 haha
3506
3507
3508
3509
3510 </pre>
3511 !! html/php+tidy
3512 <pre>
3513
3514
3515
3516
3517 haha
3518
3519
3520
3521
3522 haha
3523
3524
3525
3526
3527 </pre>
3528 !! html/parsoid
3529 <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"}}'>
3530
3531
3532
3533
3534 haha
3535
3536
3537
3538
3539 haha
3540
3541
3542
3543
3544 </pre>
3545 !! end
3546
3547 !!test
3548 HTML-pre: 2: indented text
3549 !! wikitext
3550 <pre>
3551 foo
3552 </pre>
3553 !! html
3554 <pre>
3555 foo
3556 </pre>
3557
3558 !!end
3559
3560 !!test
3561 HTML-pre: 3: other wikitext
3562 !! wikitext
3563 <pre>
3564 * foo
3565 # bar
3566 = no-h =
3567 '' no-italic ''
3568 [[ NoLink ]]
3569 </pre>
3570 !! html/php
3571 <pre>
3572 * foo
3573 # bar
3574 = no-h =
3575 '' no-italic ''
3576 [[ NoLink ]]
3577 </pre>
3578
3579 !! html/parsoid
3580 <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
3581 # bar
3582 = no-h =
3583 '' no-italic ''
3584 [[ NoLink ]]
3585 </pre>
3586 !!end
3587
3588 ###
3589 ### Definition lists
3590 ###
3591 !! test
3592 Simple definition
3593 !! wikitext
3594 ; name : Definition
3595 !! html
3596 <dl><dt> name&#160;</dt>
3597 <dd> Definition</dd></dl>
3598
3599 !! end
3600
3601 !! test
3602 Definition list for indentation only
3603 !! wikitext
3604 : Indented text
3605 !! html
3606 <dl><dd> Indented text</dd></dl>
3607
3608 !! end
3609
3610 !! test
3611 Definition list with no space
3612 !! wikitext
3613 ;name:Definition
3614 !! html
3615 <dl><dt>name</dt>
3616 <dd>Definition</dd></dl>
3617
3618 !!end
3619
3620 !! test
3621 Definition list with URL link
3622 !! wikitext
3623 ; http://example.com/ : definition
3624 !! html
3625 <dl><dt> <a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&#160;</dt>
3626 <dd> definition</dd></dl>
3627
3628 !! end
3629
3630 !! test
3631 Definition list with bracketed URL link
3632 !! wikitext
3633 ;[http://www.example.com/ Example]:Something about it
3634 !! html
3635 <dl><dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt>
3636 <dd>Something about it</dd></dl>
3637
3638 !! end
3639
3640 !! test
3641 Definition list with wikilink containing colon
3642 !! wikitext
3643 ; [[Help:FAQ]]: The least-read page on Wikipedia
3644 !! html
3645 <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>
3646 <dd> The least-read page on Wikipedia</dd></dl>
3647
3648 !! end
3649
3650 # At Brion's and JeLuF's insistence... :)
3651 !! test
3652 Definition list with news link containing colon
3653 !! wikitext
3654 ; news:alt.wikipedia.rox: This isn't even a real newsgroup!
3655 !! html/php
3656 <dl><dt> <a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a></dt>
3657 <dd> This isn't even a real newsgroup!</dd></dl>
3658
3659 !! html/parsoid
3660 <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>
3661 !! end
3662
3663 !! test
3664 Malformed definition list with colon
3665 !! wikitext
3666 ; news:alt.wikipedia.rox -- don't crash or enter an infinite loop
3667 !! html
3668 <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>
3669
3670 !! end
3671
3672 !! test
3673 Definition lists: colon in external link text
3674 !! wikitext
3675 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
3676 !! html
3677 <dl><dt> <a rel="nofollow" class="external text" href="http://www.wikipedia2.org/">Wikipedia&#160;: The Next Generation</a></dt>
3678 <dd> OK, I made that up</dd></dl>
3679
3680 !! end
3681
3682 !! test
3683 Definition lists: colon in HTML attribute
3684 !! wikitext
3685 ;<b style="display: inline">bold</b>
3686 !! html
3687 <dl><dt><b style="display: inline">bold</b></dt></dl>
3688
3689 !! end
3690
3691 !! test
3692 Definition lists: self-closed tag
3693 !! wikitext
3694 ;one<br/>two : two-line fun
3695 !! html
3696 <dl><dt>one<br />two&#160;</dt>
3697 <dd> two-line fun</dd></dl>
3698
3699 !! end
3700
3701 !! test
3702 Definition lists: ignore colons inside tags
3703 !! wikitext
3704 ;one <b>two : tag <i>fun:</i>:</b>: def
3705 !! html
3706 <dl><dt>one <b>two&#160;: tag <i>fun:</i>:</b></dt>
3707 <dd> def</dd></dl>
3708
3709 !! end
3710
3711 !! test
3712 Definition lists: excess closed tags
3713 !! wikitext
3714 ;one</b>two : bad tag fun
3715 !! html/php+tidy
3716 <dl>
3717 <dt>onetwo&#160;</dt>
3718 <dd>bad tag fun</dd>
3719 </dl>
3720 !! html/parsoid
3721 <dl>
3722 <dt>onetwo</dt>
3723 <dd>bad tag fun</dd>
3724 </dl>
3725 !! end
3726
3727 !! test
3728 T13748: Literal closing tags
3729 !! wikitext
3730 <dl>
3731 <dt>test 1</dt>
3732 <dd>test test test test test</dd>
3733 <dt>test 2</dt>
3734 <dd>test test test test test</dd>
3735 </dl>
3736 !! html
3737 <dl>
3738 <dt>test 1</dt>
3739 <dd>test test test test test</dd>
3740 <dt>test 2</dt>
3741 <dd>test test test test test</dd>
3742 </dl>
3743
3744 !! end
3745
3746 !! test
3747 Definition and unordered list using wiki syntax nested in unordered list using html tags.
3748 !! wikitext
3749 <ul><li>
3750 ; term : description
3751 * unordered
3752 </li></ul>
3753 !! html
3754 <ul><li>
3755 <dl><dt> term&#160;</dt>
3756 <dd> description</dd></dl>
3757 <ul><li> unordered</li></ul>
3758 </li></ul>
3759
3760 !! end
3761
3762 !! test
3763 Definition list with empty definition and following paragraph
3764 !! wikitext
3765 ; term:
3766 Paragraph text
3767 !! html
3768 <dl><dt> term</dt>
3769 <dd></dd></dl>
3770 <p>Paragraph text
3771 </p>
3772 !! end
3773
3774 !! test
3775 Nested definition lists using html syntax
3776 !! wikitext
3777 <dl><dt>x</dt>
3778 <dd>a</dd>
3779 <dd>b</dd></dl>
3780 !! html
3781 <dl><dt>x</dt>
3782 <dd>a</dd>
3783 <dd>b</dd></dl>
3784
3785 !! end
3786
3787 !! test
3788 Definition Lists: No nesting: Multiple dd's
3789 !! wikitext
3790 ;x
3791 :a
3792 :b
3793 !! html
3794 <dl><dt>x</dt>
3795 <dd>a</dd>
3796 <dd>b</dd></dl>
3797
3798 !! end
3799
3800 !! test
3801 Definition Lists: Indentation: Regular
3802 !! wikitext
3803 :i1
3804 ::i2
3805 :::i3
3806 !! html
3807 <dl><dd>i1
3808 <dl><dd>i2
3809 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3810
3811 !! end
3812
3813 !! test
3814 Definition Lists: Indentation: Missing 1st level
3815 !! wikitext
3816 ::i2
3817 :::i3
3818 !! html
3819 <dl><dd><dl><dd>i2
3820 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3821
3822 !! end
3823
3824 !! test
3825 Definition Lists: Indentation: Multi-level indent
3826 !! wikitext
3827 :::i3
3828 !! html
3829 <dl><dd><dl><dd><dl><dd>i3</dd></dl></dd></dl></dd></dl>
3830
3831 !! end
3832
3833 !! test
3834 Definition Lists: Hacky use to indent tables
3835 !! wikitext
3836 ::{|
3837 |foo
3838 |bar
3839 |}
3840 this text
3841 should be left alone
3842 !! html
3843 <dl><dd><dl><dd><table>
3844 <tr>
3845 <td>foo
3846 </td>
3847 <td>bar
3848 </td></tr></table></dd></dl></dd></dl>
3849 <p>this text
3850 should be left alone
3851 </p>
3852 !! end
3853
3854 !! test
3855 Definition Lists: Hacky use to indent tables, with comments (T65979)
3856 !! wikitext
3857 <!-- foo -->
3858 ::{|
3859 |foo
3860 |bar
3861 |}<!-- bar -->
3862 this text
3863 should be left alone
3864 !! html/parsoid
3865 <!-- foo -->
3866 <dl><dd><dl><dd><table><tr>
3867 <td>foo</td>
3868 <td>bar</td>
3869 </tr></table><!-- bar --></dd></dl></dd></dl>
3870 <p>this text
3871 should be left alone</p>
3872 !! end
3873
3874 !! test
3875 Definition Lists: Hacky use to indent tables, with comment before table
3876 !! wikitext
3877 ::<!-- foo -->{|
3878 |foo
3879 |}
3880 !! html/parsoid
3881 <dl><dd><dl><dd><!-- foo --><table><tr>
3882 <td>foo</td>
3883 </tr></table></dd></dl></dd></dl>
3884 !! end
3885
3886 # The trailing whitespace in this test is to catch a regression in
3887 # Parsoid after T54473.
3888 !! test
3889 Definition Lists: Hacky use to indent tables (WS-insensitive)
3890 !! wikitext
3891 : {|
3892 |a
3893 |}
3894 !! html/php
3895 <dl><dd><table>
3896 <tr>
3897 <td>a
3898 </td></tr></table></dd></dl>
3899
3900 !! html/parsoid
3901 <dl><dd> <table>
3902 <tbody><tr><td>a</td></tr>
3903 </tbody></table> </dd></dl>
3904 !! end
3905
3906 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
3907 ## as an empty dt item. It also ignores all but the last ";" when followed
3908 ## by ":" later on. So, ";" are not ignored in ";;;t3" but are ignored in
3909 ## ";;;t3 :d1". So, PHP parser behavior is a little inconsistent wrt multiple
3910 ## ";"s.
3911 ##
3912 ## Ex: ";;t2 ::d2" is transformed into:
3913 ##
3914 ## <dl>
3915 ## <dt>t2 </dt>
3916 ## <dd>
3917 ## <dl>
3918 ## <dt></dt>
3919 ## <dd>d2</dd>
3920 ## </dl>
3921 ## </dd>
3922 ## </dl>
3923 ##
3924 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
3925 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
3926 ##
3927 ## <dl>
3928 ## <dt>
3929 ## <dl>
3930 ## <dt>t2 </dt>
3931 ## <dd>:d2</dd>
3932 ## </dl>
3933 ## </dt>
3934 ## </dl>
3935 ##
3936 ## All Parsoid only definition list tests have this difference.
3937 ##
3938 ## See also: https://phabricator.wikimedia.org/T8569
3939 ## and https://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
3940
3941 !! test
3942 Table / list interaction: indented table with lists in table contents
3943 !! wikitext
3944 :{|
3945 |-
3946 | a
3947 * b
3948 |-
3949 | c
3950 * d
3951 |}
3952 !! html
3953 <dl><dd><table>
3954
3955 <tr>
3956 <td> a
3957 <ul><li> b</li></ul>
3958 </td></tr>
3959 <tr>
3960 <td> c
3961 <ul><li> d</li></ul>
3962 </td></tr></table></dd></dl>
3963
3964 !! end
3965
3966 !!test
3967 Table / list interaction: lists nested in tables nested in indented lists
3968 !! wikitext
3969 :{|
3970 |
3971 :a
3972 :b
3973 |
3974 *c
3975 *d
3976 |}
3977
3978 *e
3979 *f
3980 !! html
3981 <dl><dd><table>
3982 <tr>
3983 <td>
3984 <dl><dd>a</dd>
3985 <dd>b</dd></dl>
3986 </td>
3987 <td>
3988 <ul><li>c</li>
3989 <li>d</li></ul>
3990 </td></tr></table></dd></dl>
3991 <ul><li>e</li>
3992 <li>f</li></ul>
3993
3994 !!end
3995
3996 !! test
3997 Definition Lists: Nesting: Multi-level (Parsoid only)
3998 !! options
3999 parsoid
4000 !! wikitext
4001 ;t1 :d1
4002 ;;t2 ::d2
4003 ;;;t3 :::d3
4004 !! html
4005 <dl>
4006 <dt>t1 </dt>
4007 <dd>d1</dd>
4008 <dt>
4009 <dl>
4010 <dt>t2 </dt>
4011 <dd>:d2</dd>
4012 <dt>
4013 <dl>
4014 <dt>t3 </dt>
4015 <dd>::d3</dd>
4016 </dl>
4017 </dt>
4018 </dl>
4019 </dt>
4020 </dl>
4021
4022
4023 !! end
4024
4025
4026 !! test
4027 Definition Lists: Nesting: Test 2 (Parsoid only)
4028 !! wikitext
4029 ;t1
4030 ::d2
4031 !! html/php+tidy
4032 <dl>
4033 <dt>t1</dt>
4034 <dd>
4035 <dl>
4036 <dd>d2</dd>
4037 </dl>
4038 </dd>
4039 </dl>
4040 !! html/parsoid
4041 <dl>
4042 <dt>t1</dt>
4043 <dd>
4044 <dl>
4045 <dd>d2</dd>
4046 </dl>
4047 </dd>
4048 </dl>
4049
4050 !! end
4051
4052
4053 !! test
4054 Definition Lists: Nesting: Test 3 (Parsoid only)
4055 !! wikitext
4056 :;t1
4057 ::::d2
4058 !! html/php+tidy
4059 <dl>
4060 <dd>
4061 <dl>
4062 <dt>t1</dt>
4063 <dd>
4064 <dl>
4065 <dd>
4066 <dl>
4067 <dd>d2</dd>
4068 </dl>
4069 </dd>
4070 </dl>
4071 </dd>
4072 </dl>
4073 </dd>
4074 </dl>
4075 !! html/parsoid
4076 <dl>
4077 <dd>
4078 <dl>
4079 <dt>t1</dt>
4080 <dd>
4081 <dl>
4082 <dd>
4083 <dl>
4084 <dd>d2</dd>
4085 </dl>
4086 </dd>
4087 </dl>
4088 </dd>
4089 </dl>
4090 </dd>
4091 </dl>
4092
4093 !! end
4094
4095
4096 !! test
4097 Definition Lists: Nesting: Test 4
4098 !! wikitext
4099 ::;t3
4100 :::d3
4101 !! html
4102 <dl><dd><dl><dd><dl><dt>t3</dt>
4103 <dd>d3</dd></dl></dd></dl></dd></dl>
4104
4105 !! end
4106
4107
4108 ## The Parsoid team believes the following three test exposes a
4109 ## bug in the PHP parser. (Parsoid team thinks the PHP parser is
4110 ## wrong to close the <dl> after the <dt> containing the <ul>.)
4111 ## It also exposes a "misfeature" in tidy, which doesn't like
4112 ## <dl> tags with a single <dt> child; it converts the <dt> into
4113 ## a <dd> in that case. (Parsoid leaves the <dt> alone!)
4114 !! test
4115 Definition Lists: Mixed Lists: Test 1
4116 !! wikitext
4117 :;* foo
4118 ::* bar
4119 :; baz
4120 !! html/php
4121 <dl><dd><dl><dt><ul><li> foo</li>
4122 <li> bar</li></ul></dt></dl>
4123 <dl><dt> baz</dt></dl></dd></dl>
4124
4125 !! html/php+tidy
4126 <dl>
4127 <dd>
4128 <dl>
4129 <dd>
4130 <ul>
4131 <li>foo</li>
4132 <li>bar</li>
4133 </ul>
4134 </dd>
4135 </dl>
4136 <dl>
4137 <dt>baz</dt>
4138 </dl>
4139 </dd>
4140 </dl>
4141 !! html/parsoid
4142 <dl>
4143 <dd><dl>
4144 <dt><ul>
4145 <li> foo
4146 </li>
4147 </ul></dt>
4148 <dd><ul>
4149 <li> bar
4150 </li>
4151 </ul></dd>
4152 <dt> baz</dt>
4153 </dl></dd>
4154 </dl>
4155 !! end
4156
4157 !! test
4158 Definition Lists: Mixed Lists: Test 2
4159 !! wikitext
4160 *: d1
4161 *: d2
4162 !! html
4163 <ul><li><dl><dd> d1</dd>
4164 <dd> d2</dd></dl></li></ul>
4165
4166 !! end
4167
4168
4169 !! test
4170 Definition Lists: Mixed Lists: Test 3
4171 !! wikitext
4172 *::: d1
4173 *::: d2
4174 !! html
4175 <ul><li><dl><dd><dl><dd><dl><dd> d1</dd>
4176 <dd> d2</dd></dl></dd></dl></dd></dl></li></ul>
4177
4178 !! end
4179
4180
4181 !! test
4182 Definition Lists: Mixed Lists: Test 4
4183 !! wikitext
4184 *;d1 :d2
4185 *;d3 :d4
4186 !! html
4187 <ul><li><dl><dt>d1&#160;</dt>
4188 <dd>d2</dd>
4189 <dt>d3&#160;</dt>
4190 <dd>d4</dd></dl></li></ul>
4191
4192 !! end
4193
4194
4195 !! test
4196 Definition Lists: Mixed Lists: Test 5
4197 !! wikitext
4198 *:d1
4199 *:: d2
4200 !! html
4201 <ul><li><dl><dd>d1
4202 <dl><dd> d2</dd></dl></dd></dl></li></ul>
4203
4204 !! end
4205
4206
4207 !! test
4208 Definition Lists: Mixed Lists: Test 6
4209 !! wikitext
4210 #*:d1
4211 #*::: d3
4212 !! html
4213 <ol><li><ul><li><dl><dd>d1
4214 <dl><dd><dl><dd> d3</dd></dl></dd></dl></dd></dl></li></ul></li></ol>
4215
4216 !! end
4217
4218
4219 !! test
4220 Definition Lists: Mixed Lists: Test 7
4221 !! wikitext
4222 :* d1
4223 :* d2
4224 !! html
4225 <dl><dd><ul><li> d1</li>
4226 <li> d2</li></ul></dd></dl>
4227
4228 !! end
4229
4230
4231 !! test
4232 Definition Lists: Mixed Lists: Test 8
4233 !! wikitext
4234 :* d1
4235 ::* d2
4236 !! html
4237 <dl><dd><ul><li> d1</li></ul>
4238 <dl><dd><ul><li> d2</li></ul></dd></dl></dd></dl>
4239
4240 !! end
4241
4242
4243 !! test
4244 Definition Lists: Mixed Lists: Test 9
4245 !! wikitext
4246 *;foo :bar
4247 !! html
4248 <ul><li><dl><dt>foo&#160;</dt>
4249 <dd>bar</dd></dl></li></ul>
4250
4251 !! end
4252
4253
4254 !! test
4255 Definition Lists: Mixed Lists: Test 10
4256 !! wikitext
4257 *#;foo :bar
4258 !! html
4259 <ul><li><ol><li><dl><dt>foo&#160;</dt>
4260 <dd>bar</dd></dl></li></ol></li></ul>
4261
4262 !! end
4263
4264 # The Parsoid team disagrees with the PHP parser's seemingly-random
4265 # rules regarding dd/dt on the next two tests. Parsoid is more
4266 # consistent, and recognizes the shared nesting and keeps the
4267 # still-open tags around until the nesting is complete.
4268 # (And tidy again converts <dt> to <dd> before 'bar'.)
4269
4270 !! test
4271 Definition Lists: Mixed Lists: Test 11
4272 !! wikitext
4273 *#*#;*;;foo :bar
4274 *#*#;boo :baz
4275 !! html/php
4276 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt>
4277 <dd><ul><li><dl><dt><dl><dt>bar</dt></dl></dd></dl></li></ul></dd></dl>
4278 <dl><dt>boo&#160;</dt>
4279 <dd>baz</dd></dl></li></ol></li></ul></li></ol></li></ul>
4280
4281 !! html/php+tidy
4282 <ul>
4283 <li>
4284 <ol>
4285 <li>
4286 <ul>
4287 <li>
4288 <ol>
4289 <li>
4290 <dl>
4291 <dt>foo&#160;</dt>
4292 <dd>
4293 <ul>
4294 <li>
4295 <dl>
4296 <dd>
4297 <dl>
4298 <dt>bar</dt>
4299 </dl>
4300 </dd>
4301 </dl>
4302 </li>
4303 </ul>
4304 </dd>
4305 </dl>
4306 <dl>
4307 <dt>boo&#160;</dt>
4308 <dd>baz</dd>
4309 </dl>
4310 </li>
4311 </ol>
4312 </li>
4313 </ul>
4314 </li>
4315 </ol>
4316 </li>
4317 </ul>
4318 !! html/parsoid
4319 <ul>
4320 <li>
4321 <ol>
4322 <li>
4323 <ul>
4324 <li>
4325 <ol>
4326 <li>
4327 <dl>
4328 <dt>
4329 <ul>
4330 <li>
4331 <dl>
4332 <dt>
4333 <dl>
4334 <dt>foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
4335 <dd data-parsoid='{"stx":"row"}'>bar</dd>
4336 </dl></dt>
4337 </dl></li>
4338 </ul></dt>
4339 <dt>boo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
4340 <dd data-parsoid='{"stx":"row"}'>baz</dd>
4341 </dl></li>
4342 </ol></li>
4343 </ul></li>
4344 </ol></li>
4345 </ul>
4346 !! end
4347
4348
4349 # Another case where tidy converts a <dt> to a <dd> (but Parsoid doesn't).
4350 # From whitelist:
4351 # * The test is wrong, there are two colons where there should be :;
4352 # * The PHP parser is wrong to close the <dl> after the <dt> containing the <ul>.
4353 !! test
4354 Definition Lists: Weird Ones: Test 1
4355 !! wikitext
4356 *#;*::;; foo : bar (who uses this?)
4357 !! html/php
4358 <ul><li><ol><li><dl><dt> foo&#160;</dt>
4359 <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>
4360
4361 !! html/php+tidy
4362 <ul>
4363 <li>
4364 <ol>
4365 <li>
4366 <dl>
4367 <dt>foo&#160;</dt>
4368 <dd>
4369 <ul>
4370 <li>
4371 <dl>
4372 <dd>
4373 <dl>
4374 <dd>
4375 <dl>
4376 <dd>
4377 <dl>
4378 <dt>bar (who uses this?)</dt>
4379 </dl>
4380 </dd>
4381 </dl>
4382 </dd>
4383 </dl>
4384 </dd>
4385 </dl>
4386 </li>
4387 </ul>
4388 </dd>
4389 </dl>
4390 </li>
4391 </ol>
4392 </li>
4393 </ul>
4394 !! html/parsoid
4395 <ul>
4396 <li>
4397 <ol>
4398 <li>
4399 <dl>
4400 <dt>
4401 <ul>
4402 <li>
4403 <dl>
4404 <dd>
4405 <dl>
4406 <dd>
4407 <dl>
4408 <dt>
4409 <dl>
4410 <dt> foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span></dt>
4411 <dd data-parsoid='{"stx":"row"}'> bar (who uses this?)</dd>
4412 </dl></dt>
4413 </dl></dd>
4414 </dl></dd>
4415 </dl></li>
4416 </ul></dt>
4417 </dl></li>
4418 </ol></li>
4419 </ul>
4420 !! end
4421
4422 !! test
4423 Definition Lists: colons occurring in tags
4424 !! wikitext
4425 ;a:b
4426 ;'''a:b'''
4427 ;<i>a:b</i>
4428 ;<span>a:b</span>
4429 ;<div>a:b</div>
4430 ;<div>a
4431 :b</div>
4432 ;{{echo|a:b}}
4433 ;{{echo|''a:b''}}
4434 ;;;''a:b''
4435 !! html+tidy
4436 <dl>
4437 <dt>a</dt>
4438 <dd>b</dd>
4439 <dt><b>a:b</b></dt>
4440 <dt><i>a:b</i></dt>
4441 <dt><span>a:b</span></dt>
4442 <dd>
4443 <div>a:b</div>
4444 </dd>
4445 <dd>
4446 <div>a
4447 <dl>
4448 <dd>b</dd>
4449 </dl>
4450 </div>
4451 </dd>
4452 <dt>a</dt>
4453 <dd>b</dd>
4454 <dt><i>a:b</i></dt>
4455 </dl>
4456 <dl>
4457 <dd>
4458 <dl>
4459 <dd>
4460 <dl>
4461 <dt><i>a:b</i></dt>
4462 </dl>
4463 </dd>
4464 </dl>
4465 </dd>
4466 </dl>
4467 !! html/parsoid
4468 <dl><dt>a</dt><dd data-parsoid='{"stx":"row"}'>b</dd>
4469 <dt><b>a:b</b></dt>
4470 <dt><i data-parsoid='{"stx":"html"}'>a:b</i></dt>
4471 <dt><span data-parsoid='{"stx":"html"}'>a:b</span></dt>
4472 <dt><div data-parsoid='{"stx":"html"}'>a:b</div></dt>
4473 <dt><div data-parsoid='{"stx":"html","autoInsertedEnd":true}'>a</div></dt>
4474 <dd>b</dd>
4475 <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>
4476 <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>
4477 <dl><dt><dl><dt><i>a:b</i></dt></dl></dt></dl></dt></dl>
4478 !! end
4479
4480 !! test
4481 Definition Lists: colons and tables 1
4482 !! wikitext
4483 :{|
4484 | x
4485 |}
4486 :{|
4487 | y
4488 |}
4489 !! html
4490 <dl><dd><table>
4491 <tr>
4492 <td> x
4493 </td></tr></table></dd></dl>
4494 <dl><dd><table>
4495 <tr>
4496 <td> y
4497 </td></tr></table></dd></dl>
4498
4499 !! end
4500
4501 # Parsoid's output (as documented below) differs from php's in this case.
4502 # This is probably a bug. If we fixup parsoid to match php's output, the
4503 # above test should pass and the below test case can be removed. It is
4504 # unclear which output is more desirable.
4505
4506 !! test
4507 Definition Lists: colons and tables 2
4508 !! wikitext
4509 :{|
4510 | x
4511 |}
4512 :{|
4513 | y
4514 |}
4515 !! html/parsoid
4516 <dl><dd><table>
4517 <tr>
4518 <td> x
4519 </td></tr></table></dd>
4520 <dd><table>
4521 <tr>
4522 <td> y
4523 </td></tr></table></dd></dl>
4524 !! end
4525
4526 !! test
4527 Definition Lists: template interaction
4528 !! wikitext
4529 ::{{definition_list}}
4530
4531 :one
4532 ::{{definition_list}}
4533 :::two
4534 :::three
4535 ::four
4536 !! html/parsoid
4537 <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">
4538 </span><dd about="#mwt1">two</dd></dl></dd></dl>
4539
4540 <dl><dd data-parsoid='{}'>one
4541 <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">
4542 </span><dd about="#mwt2">two
4543 <dl><dd>two</dd>
4544 <dd>three</dd></dl></dd>
4545 <dd data-parsoid='{}'>four</dd></dl></dd></dl>
4546 !! end
4547
4548
4549 ###
4550 ### External links
4551 ###
4552 !! test
4553 External links: non-bracketed
4554 !! wikitext
4555 Non-bracketed: http://example.com
4556 !! html
4557 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4558 </p>
4559 !! end
4560
4561 # parsoid doesn't explicitly mark autonumbered links, see T55505
4562 !! test
4563 External links: numbered
4564 !! wikitext
4565 Numbered: [http://example.com]
4566 Numbered: [http://example.net]
4567 Numbered: [http://example.com]
4568 !! html/php
4569 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
4570 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
4571 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
4572 </p>
4573 !! html/parsoid
4574 <p>Numbered: <a rel="mw:ExtLink" href="http://example.com"></a>
4575 Numbered: <a rel="mw:ExtLink" href="http://example.net"></a>
4576 Numbered: <a rel="mw:ExtLink" href="http://example.com"></a></p>
4577 !!end
4578
4579 !! test
4580 External links: specified text
4581 !! wikitext
4582 Specified text: [http://example.com link]
4583 !! html
4584 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
4585 </p>
4586 !!end
4587
4588 !! test
4589 External links: trail
4590 !! wikitext
4591 Linktrails should not work for external links: [http://example.com link]s
4592 !! html
4593 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
4594 </p>
4595 !! end
4596
4597 !! test
4598 External links: dollar sign in URL
4599 !! wikitext
4600 http://example.com/1$2345
4601 !! html
4602 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
4603 </p>
4604 !! end
4605
4606 # parsoid doesn't explicitly mark autonumbered links, see T55505
4607 !! test
4608 External links: dollar sign in URL (autonumber)
4609 !! wikitext
4610 [http://example.com/1$2345]
4611 !! html/php
4612 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
4613 </p>
4614 !! html/parsoid
4615 <p><a rel="mw:ExtLink" href="http://example.com/1$2345"></a></p>
4616 !!end
4617
4618 !! test
4619 External links: open square bracket forbidden in URL (T6377)
4620 !! options
4621 parsoid=wt2html,wt2wt,html2html
4622 !! wikitext
4623 http://example.com/1[2345
4624 !! html/php
4625 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
4626 </p>
4627 !! html/parsoid
4628 <p><a rel="mw:ExtLink" href="http://example.com/1">http://example.com/1</a>[2345</p>
4629 !! end
4630
4631 !! test
4632 External links: open square bracket forbidden in URL (named) (T6377)
4633 !! options
4634 parsoid=wt2html,html2html
4635 !! wikitext
4636 [http://example.com/1[2345]
4637 !! html/php
4638 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4639 </p>
4640 !! html/parsoid
4641 <p><a rel="mw:ExtLink" href="http://example.com/1">[2345</a></p>
4642 !!end
4643
4644 # parsoid adds a space before the link name
4645 !! test
4646 External links: open square bracket forbidden in URL (named) (T6377)
4647 Parsoid variant.
4648 !! wikitext
4649 [http://example.com/1 [2345]
4650 !! html
4651 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4652 </p>
4653 !!end
4654
4655 !! test
4656 External links: nowiki in URL link text (T8230)
4657 !! wikitext
4658 [http://example.com/ <nowiki>''example site''</nowiki>]
4659 !! html
4660 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
4661 </p>
4662 !! end
4663
4664 !! test
4665 External links: newline forbidden in text (T8230 regression check)
4666 !! wikitext
4667 [http://example.com/ first
4668 second]
4669 !! html
4670 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
4671 second]
4672 </p>
4673 !!end
4674
4675 !! test
4676 External links: Pipe char between url and text
4677 !! wikitext
4678 [http://example.com | link]
4679 !! html
4680 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
4681 </p>
4682 !!end
4683
4684 !! test
4685 External links: protocol-relative URL in brackets
4686 !! wikitext
4687 [//example.com/ Test]
4688 !! html
4689 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
4690 </p>
4691 !! end
4692
4693 # parsoid doesn't explicitly mark autonumbered links, see T55505
4694 !! test
4695 External links: protocol-relative URL in brackets without text
4696 !! wikitext
4697 [//example.com]
4698 !! html/php
4699 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
4700 </p>
4701 !! html/parsoid
4702 <p><a rel="mw:ExtLink" href="//example.com"></a></p>
4703 !! end
4704
4705 !! test
4706 External links: protocol-relative URL in free text is left alone
4707 !! wikitext
4708 //example.com/Foo
4709 !! html
4710 <p>//example.com/Foo
4711 </p>
4712 !!end
4713
4714 !! test
4715 External links: protocol-relative URL in the middle of a word is left alone (T32269)
4716 !! wikitext
4717 foo//example.com/Foo
4718 !! html
4719 <p>foo//example.com/Foo
4720 </p>
4721 !! end
4722
4723 !! test
4724 External links: with no contents
4725 !! wikitext
4726 [http://en.wikipedia.org/wiki/Foo]
4727
4728 [[wikipedia:Foo|Bar]]
4729
4730 [[wikipedia:Foo|<span>Bar</span>]]
4731 !! html/php
4732 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/wiki/Foo">[1]</a>
4733 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
4734 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo"><span>Bar</span></a>
4735 </p>
4736 !! html/parsoid
4737 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo"></a></p>
4738 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo">Bar</a></p>
4739 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo"><span>Bar</span></a></p>
4740 !! end
4741
4742 !! test
4743 External links: Free with trailing punctuation
4744 !! wikitext
4745 http://example.com,
4746 http://example.com;
4747 http://example.com\
4748 http://example.com.
4749 http://example.com:
4750 http://example.com!
4751 http://example.com?
4752 http://example.com)
4753 http://example.com/url_with_(brackets)
4754 (http://example.com/url_without_brackets)
4755 http://example.com/url_with_entity&amp;
4756 http://example.com/url_with_entity&#x26;
4757 http://example.com/url_with_entity&#038;
4758 http://example.com/url_with_entity&nbsp;
4759 http://example.com/url_with_entity&#xA0;
4760 http://example.com/url_with_entity&#160;
4761 http://example.com/url_with_entity&lt;
4762 http://example.com/url_with_entity&#x3C;
4763 http://example.com/url_with_entity&#60;
4764 !! html/php
4765 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
4766 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>;
4767 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>\
4768 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.
4769 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
4770 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>!
4771 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>?
4772 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
4773 <a rel="nofollow" class="external free" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
4774 (<a rel="nofollow" class="external free" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
4775 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4776 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4777 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4778 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#160;
4779 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#xa0;
4780 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#160;
4781 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&lt;
4782 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#x3c;
4783 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#60;
4784 </p>
4785 !! html/parsoid
4786 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>,
4787 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>;
4788 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>\
4789 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>.
4790 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:
4791 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>!
4792 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>?
4793 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)
4794 <a rel="mw:ExtLink" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
4795 (<a rel="mw:ExtLink" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
4796 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4797 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4798 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4799 <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>
4800 <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>
4801 <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>
4802 <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>
4803 <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>
4804 <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>
4805 !! end
4806
4807 !! test
4808 External links: tricky Parsoid html2html case
4809 !! options
4810 parsoid=wt2html,wt2wt,html2html
4811 !! wikitext
4812 http://example.com/url_with_entity&amp;amp;
4813 !! html/php
4814 <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>;
4815 </p>
4816 !! html/parsoid
4817 <p><a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;amp">http://example.com/url_with_entity&amp;amp</a>;</p>
4818 !! end
4819
4820 !! test
4821 External links: Free with trailing quotes (T113666)
4822 !! wikitext
4823 '''News:''' Stuff here
4824
4825 news:'a'b''c''d e
4826 !! html/php
4827 <p><b>News:</b> Stuff here
4828 </p><p><a rel="nofollow" class="external free" href="news:'a'b">news:'a'b</a><i>c</i>d e
4829 </p>
4830 !! html/parsoid
4831 <p><b>News:</b> Stuff here</p>
4832 <p><a rel="mw:ExtLink" href="news:'a'b">news:'a'b</a><i>c</i>d e</p>
4833 !! end
4834
4835 !! test
4836 External links: with entity
4837 !! wikitext
4838 [http://&#x20;www.librarieswithoutborders.org Libraries without borders]
4839 !! html/php
4840 <p><a rel="nofollow" class="external text" href="http://+www.librarieswithoutborders.org">Libraries without borders</a>
4841 </p>
4842 !! html/parsoid
4843 <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>
4844 !! end
4845
4846 !! test
4847 External links: Lone protocols are never linked (T105697)
4848 !! wikitext
4849 http://
4850 http://;
4851 (http://)
4852 bitcoin:
4853 bitcoin:;
4854 (bitcoin:)
4855 !! html
4856 <p>http://
4857 http://;
4858 (http://)
4859 bitcoin:
4860 bitcoin:;
4861 (bitcoin:)
4862 </p>
4863 !! end
4864
4865 !! test
4866 External links: No preceding word characters allowed (T67278)
4867 !! wikitext
4868 NOPEhttp://example.com
4869 N0http://example.com
4870 ok:http://example.com
4871 ok-http://example.com
4872 !! html
4873 <p>NOPEhttp://example.com
4874 N0http://example.com
4875 ok:<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4876 ok-<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4877 </p>
4878 !! end
4879
4880 !! test
4881 External links: nofollow domain exception
4882 !! wikitext
4883 A [https://no-nofollow.org/foobar link], and another [https://example.org link].
4884 !! html
4885 <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>.
4886 </p>
4887 !!end
4888
4889 !! test
4890 External image
4891 !! wikitext
4892 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4893 !! html
4894 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png"/>
4895 </p>
4896 !! end
4897
4898 !! test
4899 External image from https
4900 !! wikitext
4901 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4902 !! html
4903 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png"/>
4904 </p>
4905 !! end
4906
4907 !! test
4908 External image (when not allowed)
4909 !! options
4910 wgAllowExternalImages=0
4911 !! wikitext
4912 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4913 !! html
4914 <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>
4915 </p>
4916 !! end
4917
4918 !! test
4919 Link to non-http image, no img tag
4920 !! wikitext
4921 Link to non-http image, no img tag: ftp://example.com/test.jpg
4922 !! html
4923 <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>
4924 </p>
4925 !! end
4926
4927 !! test
4928 External links: terminating separator
4929 !! wikitext
4930 Terminating separator: http://example.com/thing,
4931 !! html
4932 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
4933 </p>
4934 !! end
4935
4936 !! test
4937 External links: intervening separator
4938 !! wikitext
4939 Intervening separator: http://example.com/1,2,3
4940 !! html
4941 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
4942 </p>
4943 !! end
4944
4945 !! test
4946 External links: old bug with URL in query
4947 !! wikitext
4948 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
4949 !! html
4950 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
4951 </p>
4952 !! end
4953
4954 !! test
4955 External links: old URL-in-URL bug, mixed protocols
4956 !! wikitext
4957 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
4958 !! html
4959 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
4960 </p>
4961 !!end
4962
4963 # Since Parsoid is starting to emit canonical wikitext for links,
4964 # [http://example.com http://example.com] will not RT back to that
4965 # form anymore.
4966 !! test
4967 External links: URL in text
4968 !! options
4969 parsoid=wt2html
4970 !! wikitext
4971 URL in text: [http://example.com http://example.com]
4972 !! html/php
4973 <p>URL in text: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4974 </p>
4975 !! html/parsoid
4976 <p>URL in text: <a rel="mw:ExtLink" href="http://example.com">http://example.com</a></p>
4977 !! end
4978
4979 !! test
4980 External links: Clickable images
4981 !! wikitext
4982 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
4983 !! html/php
4984 <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>
4985 </p>
4986 !! html/parsoid
4987 <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>
4988 !! end
4989
4990 !! test
4991 External links: raw ampersand
4992 !! wikitext
4993 Old &amp; use: http://x&y
4994 !! html
4995 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4996 </p>
4997 !! end
4998
4999 !! test
5000 External links: encoded ampersand
5001 !! wikitext
5002 Old &amp; use: http://x&amp;y
5003 !! html/php
5004 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
5005 </p>
5006 !! html/parsoid
5007 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y">http://x&amp;y</a></p>
5008 !! end
5009
5010 !! test
5011 External links: encoded equals (T8102)
5012 !! wikitext
5013 http://example.com/?foo&#61;bar
5014 !! html/php
5015 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
5016 </p>
5017 !! html/parsoid
5018 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a></p>
5019 !! end
5020
5021 ##
5022 ## Note that parsoid doesn't explicit mark autonumbered links, nor
5023 ## does it number them. As discussed in T55505, we can identify
5024 ## autonumbered links via CSS.
5025 ##
5026
5027 !! test
5028 External links: [raw ampersand]
5029 !! wikitext
5030 Old &amp; use: [http://x&y]
5031 !! html/php
5032 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
5033 </p>
5034 !! html/parsoid
5035 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
5036 !! end
5037
5038 # note that parsoid html is identical to [raw ampersand] case; so html2wt
5039 # mode will return the [raw ampersand] wikitext
5040 !! test
5041 External links: [encoded ampersand]
5042 !! options
5043 parsoid=wt2html,wt2wt,html2html
5044 !! wikitext
5045 Old &amp; use: [http://x&amp;y]
5046 !! html/php
5047 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
5048 </p>
5049 !! html/parsoid
5050 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
5051 !! end
5052
5053 !! test
5054 External links: [raw equals]
5055 !! wikitext
5056 [http://example.com/?foo=bar]
5057 !! html/php
5058 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
5059 </p>
5060 !! html/parsoid
5061 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
5062 !! end
5063
5064 # note that parsoid html is identical to [raw equals] case; so html2wt
5065 # mode will return the [raw equals] wikitext
5066 !! test
5067 External links: [encoded equals] (T8102)
5068 !! options
5069 parsoid=wt2html,wt2wt,html2html
5070 !! wikitext
5071 [http://example.com/?foo&#61;bar]
5072 !! html/php
5073 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
5074 </p>
5075 !! html/parsoid
5076 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
5077 !! end
5078
5079 # xxx parsoid strips the IDN character, so the round-trip tests will
5080 # obviously fail and are disabled. --cscott
5081 !! test
5082 External links: [IDN ignored character reference in hostname; strip it right off]
5083 !! options
5084 parsoid=wt2html,wt2wt,html2html
5085 !! wikitext
5086 [http://e&zwnj;xample.com/]
5087 !! html/php
5088 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
5089 </p>
5090 !! html/parsoid
5091 <p><a rel="mw:ExtLink" href="http://example.com/"></a></p>
5092 !! end
5093
5094 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
5095 # Where an external link could easily circumvent the sanitization of the text of
5096 # a link like this (where an IDN-ignore character is in the URL somewhere), this
5097 # test demands a higher standard. That's a bit strange.
5098 #
5099 # Example:
5100 #
5101 # http://e‌xample.com -> [http://example.com|http://example.com]
5102 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
5103 #
5104 # The first example is sanitized, but the second is not. Any security benefits
5105 # from this production are trivial to circumvent. Either remove this test and
5106 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
5107 # the test accordingly.
5108 #
5109 # All our love,
5110 # The Parsoid team.
5111 # xxx parsoid strips the IDN character, so the round-trip tests will
5112 # obviously fail and are disabled. --cscott
5113 !! test
5114 External links: IDN ignored character reference in hostname; strip it right off
5115 !! options
5116 parsoid=wt2html,html2html
5117 !! wikitext
5118 http://e&zwnj;xample.com/
5119 !! html/php
5120 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
5121 </p>
5122 !! html/parsoid
5123 <p><a rel="mw:ExtLink" href="http://example.com/">http://example.com/</a></p>
5124 !! end
5125
5126 !! test
5127 External links: www.jpeg.org (T2554)
5128 !! wikitext
5129 http://www.jpeg.org
5130 !! html
5131 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
5132 </p>
5133 !! end
5134
5135 # parsoid doesn't explicitly mark autonumbered links, see T55505
5136 !! test
5137 External links: URL within URL (T2002)
5138 !! wikitext
5139 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
5140 !! html/php
5141 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
5142 </p>
5143 !! html/parsoid
5144 <p><a rel="mw:ExtLink" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp"></a></p>
5145 !! end
5146
5147 !! test
5148 T2361: URL inside bracketed URL
5149 !! wikitext
5150 [http://www.example.com/foo http://www.example.com/bar]
5151 !! html
5152 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
5153 </p>
5154 !! end
5155
5156 !! test
5157 T2361: URL within URL, not bracketed
5158 !! wikitext
5159 http://www.example.com/foo?=http://www.example.com/bar
5160 !! html
5161 <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>
5162 </p>
5163 !! end
5164
5165 !! test
5166 T2289: ">"-token in URL-tail
5167 !! wikitext
5168 http://www.example.com/<hello>
5169 !! html
5170 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
5171 </p>
5172 !!end
5173
5174 !! test
5175 T2289: literal ">"-token in URL-tail
5176 !! wikitext
5177 http://www.example.com/<b>html</b>
5178 !! html/php
5179 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
5180 </p>
5181 !! html/parsoid
5182 <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>
5183 !! end
5184
5185 !! test
5186 T2289: ">"-token in bracketed URL
5187 !! wikitext
5188 [http://www.example.com/<hello> stuff]
5189 !! html
5190 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
5191 </p>
5192 !!end
5193
5194 !! test
5195 T2289: literal ">"-token in bracketed URL
5196 !! wikitext
5197 [http://www.example.com/<b>html</b> stuff]
5198 !! html
5199 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
5200 </p>
5201 !!end
5202
5203 !! test
5204 T2289: literal double quote at end of URL
5205 !! wikitext
5206 http://www.example.com/"hello"
5207 !! html
5208 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
5209 </p>
5210 !!end
5211
5212 !! test
5213 T2289: literal double quote in bracketed URL
5214 !! wikitext
5215 [http://www.example.com/"hello" stuff]
5216 !! html
5217 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
5218 </p>
5219 !!end
5220
5221 !! test
5222 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (T7081)
5223 !! wikitext
5224 [http://www.example.com test]
5225 !! html
5226 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
5227 </p>
5228 !! end
5229
5230 !! test
5231 External links: link text with spaces
5232 !! wikitext
5233 [http://www.example.com a b c]
5234 [http://www.example.com ''a'' ''b'']
5235 !! html
5236 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
5237 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
5238 </p>
5239 !! end
5240
5241 !! test
5242 External links: wiki links within external link (T5695)
5243 !! options
5244 parsoid=wt2html,html2html
5245 !! wikitext
5246 [http://example.com [[wikilink]] embedded in ext link]
5247 !! html/php
5248 <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>
5249 </p>
5250 !! html/parsoid
5251 <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>
5252 !! end
5253
5254 !! test
5255 T2787: Links with one slash after the url protocol are invalid
5256 !! wikitext
5257 http:/example.com
5258
5259 [http:/example.com title]
5260 !! html
5261 <p>http:/example.com
5262 </p><p>[http:/example.com title]
5263 </p>
5264 !! end
5265
5266 !! test
5267 Bracketed external links with template-generated invalid target
5268 !! wikitext
5269 [{{echo|http:/example.com}} title]
5270 !! html
5271 <p>[http:/example.com title]
5272 </p>
5273 !! end
5274
5275 !! test
5276 T4702: Mismatched <i>, <b> and <a> tags are invalid
5277 !! wikitext
5278 ''[http://example.com text'']
5279 [http://example.com '''text]'''
5280 ''Something [http://example.com in italic'']
5281 ''Something [http://example.com mixed''''', even bold]'''
5282 '''''Now [http://example.com both''''']
5283 !! html
5284 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
5285 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
5286 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
5287 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
5288 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
5289 </p>
5290 !! end
5291
5292
5293 !! test
5294 T6781: %26 in URL
5295 !! wikitext
5296 http://www.example.com/?title=AT%26T
5297 !! html/php
5298 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
5299 </p>
5300 !! html/parsoid
5301 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a></p>
5302 !! end
5303
5304 # According to https://www.w3.org/TR/2011/WD-html5-20110525/Overview.html#parsing-urls a plain
5305 # % is actually legal in HTML5. Any change in output would need testing though.
5306 !! test
5307 T6781, T7267: %25 in URL
5308 !! wikitext
5309 http://www.example.com/?title=100%25_Bran
5310 !! html/php
5311 <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>
5312 </p>
5313 !! html/parsoid
5314 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran">http://www.example.com/?title=100%25_Bran</a></p>
5315 !! end
5316
5317 !! test
5318 T6781, T7267: %28, %29 in URL
5319 !! wikitext
5320 http://www.example.com/?title=Ben-Hur_%281959_film%29
5321 !! html/php
5322 <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>
5323 </p>
5324 !! html/parsoid
5325 <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>
5326 !! end
5327
5328
5329 !! test
5330 T6781: %26 in autonumber URL
5331 !! wikitext
5332 [http://www.example.com/?title=AT%26T]
5333 !! html/php
5334 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
5335 </p>
5336 !! html/parsoid
5337 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T"></a></p>
5338 !! end
5339
5340 !! test
5341 T6781, T7267: %26 in autonumber URL
5342 !! wikitext
5343 [http://www.example.com/?title=100%25_Bran]
5344 !! html/php
5345 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
5346 </p>
5347 !! html/parsoid
5348 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran"></a></p>
5349 !! end
5350
5351 !! test
5352 T6781, T7267: %28, %29 in autonumber URL
5353 !! wikitext
5354 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
5355 !! html/php
5356 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
5357 </p>
5358 !! html/parsoid
5359 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29"></a></p>
5360 !! end
5361
5362
5363 !! test
5364 T6781: %26 in bracketed URL
5365 !! wikitext
5366 [http://www.example.com/?title=AT%26T link]
5367 !! html/php
5368 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
5369 </p>
5370 !! html/parsoid
5371 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">link</a></p>
5372 !! end
5373
5374 !! test
5375 T6781, T7267: %25 in bracketed URL
5376 !! wikitext
5377 [http://www.example.com/?title=100%25_Bran link]
5378 !! html
5379 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
5380 </p>
5381 !! end
5382
5383 !! test
5384 T6781, T7267: %28, %29 in bracketed URL
5385 !! wikitext
5386 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
5387 !! html/php
5388 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
5389 </p>
5390 !! html/parsoid
5391 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a></p>
5392 !! end
5393
5394 !! test
5395 External link containing a period in the anchor. (T65947)
5396 !! wikitext
5397 [//foo.org/bar#baz. bang]
5398
5399 [//foo.org/bar. bang]
5400 !! html/php
5401 <p><a rel="nofollow" class="external text" href="//foo.org/bar#baz.">bang</a>
5402 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar.">bang</a>
5403 </p>
5404 !! html/parsoid
5405 <p><a rel="mw:ExtLink" href="//foo.org/bar#baz.">bang</a></p>
5406 <p><a rel="mw:ExtLink" href="//foo.org/bar.">bang</a></p>
5407 !! end
5408
5409 !! test
5410 External link containing a single quote. (T65947)
5411 !! wikitext
5412 [//foo.org/bar'baz]
5413
5414 [//foo.org/bar'baz bang]
5415 !! html/php
5416 <p><a rel="nofollow" class="external autonumber" href="//foo.org/bar'baz">[1]</a>
5417 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar'baz">bang</a>
5418 </p>
5419 !! html/parsoid
5420 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz"></a></p>
5421 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz">bang</a></p>
5422 !! end
5423
5424 !! test
5425 External link containing double-single-quotes in text '' (T6598 sanity check)
5426 !! wikitext
5427 Some [http://example.com/ pretty ''italics'' and stuff]!
5428 !! html
5429 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
5430 </p>
5431 !! end
5432
5433 !! test
5434 External link containing double-single-quotes in text embedded in italics (T6598 sanity check)
5435 !! wikitext
5436 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
5437 !! html
5438 <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>
5439 </p>
5440 !! end
5441
5442 !! test
5443 External link containing double-single-quotes with no space separating the url from text in italics
5444 !! wikitext
5445 [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]].]
5446 !! html/php
5447 <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>
5448 </p>
5449 !! html/php+tidy
5450 <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>
5451 !! html/parsoid
5452 <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>
5453 !! end
5454
5455 !! test
5456 External link with comments in link text
5457 !! wikitext
5458 [http://www.google.com Google <!-- comment -->]
5459 !! html/php
5460 <p><a rel="nofollow" class="external text" href="http://www.google.com">Google </a>
5461 </p>
5462 !! html/parsoid
5463 <p><a rel="mw:ExtLink" href="http://www.google.com">Google <!-- comment --></a></p>
5464 !! end
5465
5466 !! test
5467 External link to bare IPv4 address
5468 !! wikitext
5469 [http://192.168.0.1 Link]
5470 !! html/php
5471 <p><a rel="nofollow" class="external text" href="http://192.168.0.1">Link</a>
5472 </p>
5473 !! html/parsoid
5474 <p><a rel="mw:ExtLink" href="http://192.168.0.1">Link</a></p>
5475 !! end
5476
5477 !! test
5478 URL-encoding in URL functions (single parameter)
5479 !! wikitext
5480 {{localurl:Some page|amp=&}}
5481 !! html
5482 <p>/index.php?title=Some_page&amp;amp=&amp;
5483 </p>
5484 !! end
5485
5486 !! test
5487 URL-encoding in URL functions (multiple parameters)
5488 !! wikitext
5489 {{localurl:Some page|q=?&amp=&}}
5490 !! html
5491 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
5492 </p>
5493 !! end
5494
5495 !! test
5496 Brackets in urls
5497 !! wikitext
5498 http://example.com/index.php?foozoid%5B%5D=bar
5499
5500 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
5501 !! html/php
5502 <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>
5503 </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>
5504 </p>
5505 !! html/parsoid
5506 <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>
5507
5508 <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>
5509 !! end
5510
5511 !! test
5512 IPv6 urls, autolink format (T23261)
5513 !! wikitext
5514 http://[2404:130:0:1000::187:2]/index.php
5515
5516 Examples from RFC 2373, section 2.2:
5517 * http://[1080::8:800:200C:417A]/unicast
5518 * http://[FF01::101]/multicast
5519 * http://[::1]/loopback
5520 * http://[::]/unspecified
5521 * http://[::13.1.68.3]/ipv4compat
5522 * http://[::FFFF:129.144.52.38]/ipv4compat
5523
5524 Examples from RFC 2732, section 2:
5525 * http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html
5526 * http://[1080:0:0:0:8:800:200C:417A]/index.html
5527 * http://[3ffe:2a00:100:7031::1]
5528 * http://[1080::8:800:200C:417A]/foo
5529 * http://[::192.9.5.5]/ipng
5530 * http://[::FFFF:129.144.52.38]:80/index.html
5531 * http://[2010:836B:4179::836B:4179]
5532
5533 !! html/php
5534 <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>
5535 </p><p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2373">RFC 2373</a>, section 2.2:
5536 </p>
5537 <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>
5538 <li> <a rel="nofollow" class="external free" href="http://[FF01::101]/multicast">http://[FF01::101]/multicast</a></li>
5539 <li> <a rel="nofollow" class="external free" href="http://[::1]/loopback">http://[::1]/loopback</a></li>
5540 <li> <a rel="nofollow" class="external free" href="http://[::]/unspecified">http://[::]/unspecified</a></li>
5541 <li> <a rel="nofollow" class="external free" href="http://[::13.1.68.3]/ipv4compat">http://[::13.1.68.3]/ipv4compat</a></li>
5542 <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>
5543 <p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2732">RFC 2732</a>, section 2:
5544 </p>
5545 <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>
5546 <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>
5547 <li> <a rel="nofollow" class="external free" href="http://[3ffe:2a00:100:7031::1]">http://[3ffe:2a00:100:7031::1]</a></li>
5548 <li> <a rel="nofollow" class="external free" href="http://[1080::8:800:200C:417A]/foo">http://[1080::8:800:200C:417A]/foo</a></li>
5549 <li> <a rel="nofollow" class="external free" href="http://[::192.9.5.5]/ipng">http://[::192.9.5.5]/ipng</a></li>
5550 <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>
5551 <li> <a rel="nofollow" class="external free" href="http://[2010:836B:4179::836B:4179]">http://[2010:836B:4179::836B:4179]</a></li></ul>
5552
5553 !! html/parsoid
5554 <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>
5555
5556 <p>Examples from <a href="//tools.ietf.org/html/rfc2373" rel="mw:ExtLink">RFC 2373</a>, section 2.2:</p>
5557 <ul><li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/unicast">http://[1080::8:800:200C:417A]/unicast</a></li>
5558 <li> <a rel="mw:ExtLink" href="http://[FF01::101]/multicast">http://[FF01::101]/multicast</a></li>
5559 <li> <a rel="mw:ExtLink" href="http://[::1]/loopback">http://[::1]/loopback</a></li>
5560 <li> <a rel="mw:ExtLink" href="http://[::]/unspecified">http://[::]/unspecified</a></li>
5561 <li> <a rel="mw:ExtLink" href="http://[::13.1.68.3]/ipv4compat">http://[::13.1.68.3]/ipv4compat</a></li>
5562 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]/ipv4compat">http://[::FFFF:129.144.52.38]/ipv4compat</a></li></ul>
5563
5564 <p>Examples from <a href="//tools.ietf.org/html/rfc2732" rel="mw:ExtLink">RFC 2732</a>, section 2:</p>
5565 <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>
5566 <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>
5567 <li> <a rel="mw:ExtLink" href="http://[3ffe:2a00:100:7031::1]">http://[3ffe:2a00:100:7031::1]</a></li>
5568 <li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/foo">http://[1080::8:800:200C:417A]/foo</a></li>
5569 <li> <a rel="mw:ExtLink" href="http://[::192.9.5.5]/ipng">http://[::192.9.5.5]/ipng</a></li>
5570 <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>
5571 <li> <a rel="mw:ExtLink" href="http://[2010:836B:4179::836B:4179]">http://[2010:836B:4179::836B:4179]</a></li></ul>
5572 !! end
5573
5574 !! test
5575 IPv6 urls, bracketed format (T23261)
5576 !! wikitext
5577 [http://[2404:130:0:1000::187:2]/index.php test]
5578
5579 Examples from RFC 2373, section 2.2:
5580 * [http://[1080::8:800:200C:417A] unicast]
5581 * [http://[FF01::101] multicast]
5582 * [http://[::1]/ loopback]
5583 * [http://[::] unspecified]
5584 * [http://[::13.1.68.3] ipv4compat]
5585 * [http://[::FFFF:129.144.52.38] ipv4compat]
5586
5587 Examples from RFC 2732, section 2:
5588 * [http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html 1]
5589 * [http://[1080:0:0:0:8:800:200C:417A]/index.html 2]
5590 * [http://[3ffe:2a00:100:7031::1] 3]
5591 * [http://[1080::8:800:200C:417A]/foo 4]
5592 * [http://[::192.9.5.5]/ipng 5]
5593 * [http://[::FFFF:129.144.52.38]:80/index.html 6]
5594 * [http://[2010:836B:4179::836B:4179] 7]
5595
5596 !! html/php
5597 <p><a rel="nofollow" class="external text" href="http://[2404:130:0:1000::187:2]/index.php">test</a>
5598 </p><p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2373">RFC 2373</a>, section 2.2:
5599 </p>
5600 <ul><li> <a rel="nofollow" class="external text" href="http://[1080::8:800:200C:417A]">unicast</a></li>
5601 <li> <a rel="nofollow" class="external text" href="http://[FF01::101]">multicast</a></li>
5602 <li> <a rel="nofollow" class="external text" href="http://[::1]/">loopback</a></li>
5603 <li> <a rel="nofollow" class="external text" href="http://[::]">unspecified</a></li>
5604 <li> <a rel="nofollow" class="external text" href="http://[::13.1.68.3]">ipv4compat</a></li>
5605 <li> <a rel="nofollow" class="external text" href="http://[::FFFF:129.144.52.38]">ipv4compat</a></li></ul>
5606 <p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2732">RFC 2732</a>, section 2:
5607 </p>
5608 <ul><li> <a rel="nofollow" class="external text" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">1</a></li>
5609 <li> <a rel="nofollow" class="external text" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">2</a></li>
5610 <li> <a rel="nofollow" class="external text" href="http://[3ffe:2a00:100:7031::1]">3</a></li>
5611 <li> <a rel="nofollow" class="external text" href="http://[1080::8:800:200C:417A]/foo">4</a></li>
5612 <li> <a rel="nofollow" class="external text" href="http://[::192.9.5.5]/ipng">5</a></li>
5613 <li> <a rel="nofollow" class="external text" href="http://[::FFFF:129.144.52.38]:80/index.html">6</a></li>
5614 <li> <a rel="nofollow" class="external text" href="http://[2010:836B:4179::836B:4179]">7</a></li></ul>
5615
5616 !! html/parsoid
5617 <p><a rel="mw:ExtLink" href="http://[2404:130:0:1000::187:2]/index.php">test</a></p>
5618
5619 <p>Examples from <a href="//tools.ietf.org/html/rfc2373" rel="mw:ExtLink">RFC 2373</a>, section 2.2:</p>
5620 <ul><li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]">unicast</a></li>
5621 <li> <a rel="mw:ExtLink" href="http://[FF01::101]">multicast</a></li>
5622 <li> <a rel="mw:ExtLink" href="http://[::1]/">loopback</a></li>
5623 <li> <a rel="mw:ExtLink" href="http://[::]">unspecified</a></li>
5624 <li> <a rel="mw:ExtLink" href="http://[::13.1.68.3]">ipv4compat</a></li>
5625 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]">ipv4compat</a></li></ul>
5626
5627 <p>Examples from <a href="//tools.ietf.org/html/rfc2732" rel="mw:ExtLink">RFC 2732</a>, section 2:</p>
5628 <ul><li> <a rel="mw:ExtLink" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">1</a></li>
5629 <li> <a rel="mw:ExtLink" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">2</a></li>
5630 <li> <a rel="mw:ExtLink" href="http://[3ffe:2a00:100:7031::1]">3</a></li>
5631 <li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/foo">4</a></li>
5632 <li> <a rel="mw:ExtLink" href="http://[::192.9.5.5]/ipng">5</a></li>
5633 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]:80/index.html">6</a></li>
5634 <li> <a rel="mw:ExtLink" href="http://[2010:836B:4179::836B:4179]">7</a></li></ul>
5635 !! end
5636
5637 !! test
5638 Non-extlinks in brackets
5639 !! wikitext
5640 [foo]
5641 [foo bar]
5642 [foo ''bar'']
5643 [fool's] errand
5644 [fool's errand]
5645 [{{echo|foo}}]
5646 [{{echo|foo}} bar]
5647 [{{echo|foo}} ''bar'']
5648 [{{echo|foo}}l's] errand
5649 [{{echo|foo}}l's errand]
5650 [url={{echo|foo}}]
5651 [url=http://example.com]
5652 [http:// bare protocols don't count]
5653 !! html/php
5654 <p>[foo]
5655 [foo bar]
5656 [foo <i>bar</i>]
5657 [fool's] errand
5658 [fool's errand]
5659 [foo]
5660 [foo bar]
5661 [foo <i>bar</i>]
5662 [fool's] errand
5663 [fool's errand]
5664 [url=foo]
5665 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
5666 [http:// bare protocols don't count]
5667 </p>
5668 !! html/parsoid
5669 <p>[foo]
5670 [foo bar]
5671 [foo <i>bar</i>]
5672 [fool's] errand
5673 [fool's errand]
5674 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}"}'>foo</span>]
5675 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}"}'>foo</span> bar]
5676 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}"}'>foo</span> <i>bar</i>]
5677 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}l&#39;s"}'>fool's</span>] errand
5678 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}l&#39;s"}'>fool's</span> errand]
5679 [<span typeof="mw:Placeholder" data-parsoid='{"src":"url={{echo|foo}}"}'>url=foo</span>]
5680 [url=<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>]
5681 [http:// bare protocols don't count]</p>
5682 !! end
5683
5684 !! test
5685 Percent encoding in external links
5686 !! wikitext
5687 [https://github.com/search?l=&q=ResourceLoader+%40wikimedia Search]
5688 !! html/php
5689 <p><a rel="nofollow" class="external text" href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a>
5690 </p>
5691 !! html/parsoid
5692 <p><a rel="mw:ExtLink"
5693 href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a></p>
5694 !! end
5695
5696 !! test
5697 Use url link syntax for links where the content is equal the link target
5698 !! wikitext
5699 http://example.com
5700 !! html/php
5701 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
5702 </p>
5703 !! html/parsoid
5704 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></p>
5705 !! end
5706
5707 !! test
5708 Parenthesis in external links, especially URL links
5709 !! wikitext
5710 http://example.com)
5711
5712 http://example.com/test)
5713
5714 http://example.com/(test)
5715
5716 http://example.com/((test)
5717
5718 (http://example.com/(test))
5719
5720 (http://example.com/(test)))))
5721
5722 http://example.com/a)b
5723
5724 [http://example.com) foo]
5725 !! html/php
5726 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5727 </p><p><a rel="nofollow" class="external free" href="http://example.com/test">http://example.com/test</a>)
5728 </p><p><a rel="nofollow" class="external free" href="http://example.com/(test)">http://example.com/(test)</a>
5729 </p><p><a rel="nofollow" class="external free" href="http://example.com/((test)">http://example.com/((test)</a>
5730 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test))">http://example.com/(test))</a>
5731 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test)))))">http://example.com/(test)))))</a>
5732 </p><p><a rel="nofollow" class="external free" href="http://example.com/a)b">http://example.com/a)b</a>
5733 </p><p><a rel="nofollow" class="external text" href="http://example.com)">foo</a>
5734 </p>
5735 !! html/parsoid
5736 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)</p>
5737 <p><a rel="mw:ExtLink" href="http://example.com/test">http://example.com/test</a>)</p>
5738 <p><a rel="mw:ExtLink" href="http://example.com/(test)">http://example.com/(test)</a></p>
5739 <p><a rel="mw:ExtLink" href="http://example.com/((test)">http://example.com/((test)</a></p>
5740 <p>(<a rel="mw:ExtLink" href="http://example.com/(test))">http://example.com/(test))</a></p>
5741 <p>(<a rel="mw:ExtLink" href="http://example.com/(test)))))">http://example.com/(test)))))</a></p>
5742 <p><a rel="mw:ExtLink" href="http://example.com/a)b">http://example.com/a)b</a></p>
5743 <p><a rel="mw:ExtLink" href="http://example.com)">foo</a></p>
5744 !! end
5745
5746 !! test
5747 Parenthesis in external links, w/ transclusion or comment
5748 !! wikitext
5749 (http://example.com/{{echo|hi}})
5750
5751 (http://example.com<!-- hi -->)
5752 !! html/php
5753 <p>(<a rel="nofollow" class="external free" href="http://example.com/hi">http://example.com/hi</a>)
5754 </p><p>(<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5755 </p>
5756 !! html/parsoid
5757 <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>
5758
5759 <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>
5760 !! end
5761
5762 !! test
5763 Serialize <a> tags with invalid link targets as plain text
5764 !! options
5765 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
5766 !! html/parsoid
5767 <a rel="mw:WikiLink" href="[[foo]]">text</a>
5768 <a rel="mw:WikiLink" href="[[foo]]">*text</a>
5769 <a rel="mw:WikiLink" href="[[foo]]">[[foo]]</a>
5770 <a rel="mw:WikiLink" href="[[foo]]">*a [[foo]]</a>
5771 !! wikitext
5772 text
5773 <nowiki>*</nowiki>text
5774 <nowiki>[[foo]]</nowiki>
5775 <nowiki>*</nowiki>a <nowiki>[[foo]]</nowiki>
5776 !! end
5777
5778 !! test
5779 mw:ExtLink -vs- mw:WikiLink (T94723)
5780 !! options
5781 parsoid=html2wt
5782 !! html/parsoid
5783 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"piped","a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>Bar</a>
5784 <a rel="mw:WikiLink" href="./Foo" title="Foo">Bar</a>
5785 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
5786 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
5787 <p>
5788 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
5789 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
5790 </p>
5791 !! wikitext
5792 [[Foo|Bar]]
5793 [[Foo|Bar]]
5794 [[wikipedia:Foo|Bar]]
5795 [[wikipedia:Foo|Bar]]
5796
5797 [[wikipedia:European_Robin|European Robin]]
5798 [[wikipedia:European_Robin|European Robin]]
5799 !! end
5800
5801 !! test
5802 mw:ExtLink linking to a interwiki URL can be round-tripped losslessly (T94723)
5803 !! options
5804 parsoid=wt2wt
5805 !! wikitext
5806 [http://en.wikipedia.org/wiki/European_Robin European Robin]
5807 !! html/parsoid
5808 THIS SECTION IS NOT USED (but Parsoid won't run the test without it)
5809 !! end
5810
5811
5812 ###
5813 ### Quotes
5814 ###
5815
5816 !! test
5817 Quotes
5818 !! wikitext
5819 Normal text. '''Bold text.''' Normal text. ''Italic text.''
5820
5821 Normal text. '''''Bold italic text.''''' Normal text.
5822 !! html
5823 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
5824 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
5825 </p>
5826 !! end
5827
5828
5829 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
5830 # parser strips. The wikitext contains just the first half of the bold
5831 # quote pair.
5832 !! test
5833 Unclosed and unmatched quotes
5834 !! wikitext
5835 '''''Bold italic text '''with bold deactivated''' in between.'''''
5836
5837 '''''Bold italic text ''with italic deactivated'' in between.'''''
5838
5839 '''Bold text..
5840
5841 ..spanning two paragraphs (should not work).'''
5842
5843 '''Bold tag left open
5844
5845 ''Italic tag left open
5846
5847 Normal text.
5848
5849 <!-- Unmatching number of opening, closing tags: -->
5850 '''This year''''s election ''should'' beat '''last year''''s.
5851
5852 ''Tom'''s car is bigger than ''Susan'''s.
5853
5854 Plain ''italic'''s plain
5855 !! html/php
5856 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
5857 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
5858 </p><p><b>Bold text..</b>
5859 </p><p>..spanning two paragraphs (should not work).
5860 </p><p><b>Bold tag left open</b>
5861 </p><p><i>Italic tag left open</i>
5862 </p><p>Normal text.
5863 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
5864 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
5865 </p><p>Plain <i>italic'</i>s plain
5866 </p>
5867 !! html/parsoid
5868 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
5869 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
5870 </p><p><b>Bold text..</b>
5871 </p><p>..spanning two paragraphs (should not work).<b></b>
5872 </p><p><b>Bold tag left open</b>
5873 </p><p><i>Italic tag left open</i>
5874 </p><p>Normal text.
5875 </p>
5876 <!-- Unmatching number of opening, closing tags: -->
5877 <p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
5878 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
5879 </p><p>Plain <i>italic'</i>s plain
5880 </p>
5881 !! end
5882
5883 ###
5884 ### Tables
5885 ###
5886 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
5887 ###
5888
5889 # This should not produce <table></table> as <table><tr><td></td></tr></table>
5890 # is the bare minimum required by the spec, see:
5891 # https://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
5892 # Parsoid team replies: empty table tags are legal in HTML5
5893 !! test
5894 A table with no data.
5895 !! options
5896 parsoid=wt2html
5897 !! wikitext
5898 {||}
5899 !! html/php
5900
5901 !! html/parsoid
5902 <table></table>
5903
5904 !! end
5905
5906 !! test
5907 A table with stray table end tags on start tag line (wt2html)
5908 !! options
5909 parsoid=wt2html
5910 !! wikitext
5911 {|style="color: red;"|}
5912
5913 {|style="color: red;" |}
5914 |foo
5915 |}
5916
5917 {|style="color: red;"|} id="foo"
5918 |foo
5919 |}
5920
5921 {|style="color: red;" |} id="foo"
5922 |foo
5923 |}
5924 !! html
5925 <table style="color: red;"></table>
5926
5927 <table style="color: red;">
5928 <tbody><tr>
5929 <td>foo</td>
5930 </tr></tbody>
5931 </table>
5932
5933 <table style="color: red;" id="foo">
5934 <tbody><tr>
5935 <td>foo</td>
5936 </tr></tbody>
5937 </table>
5938
5939 <table style="color: red;" id="foo">
5940 <tbody><tr>
5941 <td>foo</td>
5942 </tr></tbody>
5943 </table>
5944
5945 !! end
5946
5947 !! test
5948 A table with no data (take 2)
5949 !! wikitext
5950 {|
5951 |}
5952 !! html/parsoid
5953 <table></table>
5954 !! end
5955
5956 # A table with nothing but a caption is invalid XHTML, we might want to render
5957 # this as <p>caption</p>
5958 # Parsoid team replies: table with only a caption is legal in HTML5
5959 !! test
5960 A table with nothing but a caption
5961 !! wikitext
5962 {|
5963 |+ caption
5964 |}
5965 !! html/php
5966 <table>
5967 <caption> caption
5968 </caption><tr><td></td></tr></table>
5969
5970 !! html/parsoid
5971 <table><caption> caption</caption></table>
5972 !! end
5973
5974 !! test
5975 A table with caption with default-spaced attributes and a table row
5976 !! wikitext
5977 {|
5978 |+ style="color: red;" | caption1
5979 |-
5980 | foo
5981 |}
5982 !! html
5983 <table>
5984 <caption style="color: red;"> caption1
5985 </caption>
5986 <tr>
5987 <td> foo
5988 </td></tr></table>
5989
5990 !! end
5991
5992 !! test
5993 A table with captions with non-default spaced attributes and a table row
5994 !! wikitext
5995 {|
5996 |+style="color: red;"|caption2
5997 |+ style="color: red;"| caption3
5998 |-
5999 | foo
6000 |}
6001 !! html
6002 <table>
6003 <caption style="color: red;">caption2
6004 </caption>
6005 <caption style="color: red;"> caption3
6006 </caption>
6007 <tr>
6008 <td> foo
6009 </td></tr></table>
6010
6011 !! end
6012
6013 !! test
6014 Table td-cell syntax variations
6015 !! wikitext
6016 {|
6017 | foo bar foo | baz
6018 | foo bar foo || baz
6019 | style='color:red;' | baz
6020 | style='color:red;' || baz
6021 |}
6022 !! html
6023 <table>
6024 <tr>
6025 <td> baz
6026 </td>
6027 <td> foo bar foo </td>
6028 <td> baz
6029 </td>
6030 <td style="color:red;"> baz
6031 </td>
6032 <td> style='color:red;' </td>
6033 <td> baz
6034 </td></tr></table>
6035
6036 !! end
6037
6038 !! test
6039 Simple table
6040 !! wikitext
6041 {|
6042 | 1 || 2
6043 |-
6044 | 3 || 4
6045 |}
6046 !! html
6047 <table>
6048 <tr>
6049 <td> 1 </td>
6050 <td> 2
6051 </td></tr>
6052 <tr>
6053 <td> 3 </td>
6054 <td> 4
6055 </td></tr></table>
6056
6057 !! end
6058
6059 !! test
6060 Simple table but with multiple dashes for row wikitext
6061 !! wikitext
6062 {|
6063 | foo
6064 |-----
6065 | bar
6066 |}
6067 !! html
6068 <table>
6069 <tr>
6070 <td> foo
6071 </td></tr>
6072 <tr>
6073 <td> bar
6074 </td></tr></table>
6075
6076 !! end
6077
6078 !! test
6079 Multiplication table
6080 !! wikitext
6081 {| border="1" cellpadding="2"
6082 |+Multiplication table
6083 |-
6084 ! &times; !! 1 !! 2 !! 3
6085 |-
6086 ! 1
6087 | 1 || 2 || 3
6088 |-
6089 ! 2
6090 | 2 || 4 || 6
6091 |-
6092 ! 3
6093 | 3 || 6 || 9
6094 |-
6095 ! 4
6096 | 4 || 8 || 12
6097 |-
6098 ! 5
6099 | 5 || 10 || 15
6100 |}
6101 !! html
6102 <table border="1" cellpadding="2">
6103 <caption>Multiplication table
6104 </caption>
6105 <tr>
6106 <th> &#215; </th>
6107 <th> 1 </th>
6108 <th> 2 </th>
6109 <th> 3
6110 </th></tr>
6111 <tr>
6112 <th> 1
6113 </th>
6114 <td> 1 </td>
6115 <td> 2 </td>
6116 <td> 3
6117 </td></tr>
6118 <tr>
6119 <th> 2
6120 </th>
6121 <td> 2 </td>
6122 <td> 4 </td>
6123 <td> 6
6124 </td></tr>
6125 <tr>
6126 <th> 3
6127 </th>
6128 <td> 3 </td>
6129 <td> 6 </td>
6130 <td> 9
6131 </td></tr>
6132 <tr>
6133 <th> 4
6134 </th>
6135 <td> 4 </td>
6136 <td> 8 </td>
6137 <td> 12
6138 </td></tr>
6139 <tr>
6140 <th> 5
6141 </th>
6142 <td> 5 </td>
6143 <td> 10 </td>
6144 <td> 15
6145 </td></tr></table>
6146
6147 !! end
6148
6149 !! test
6150 Accept "||" in table headings
6151 !! wikitext
6152 {|
6153 !h1 || h2
6154 |}
6155 !! html
6156 <table>
6157 <tr>
6158 <th>h1 </th>
6159 <th> h2
6160 </th></tr></table>
6161
6162 !! end
6163
6164 !! test
6165 Accept "!!" in table data
6166 !! wikitext
6167 {|
6168 | Foo!! ||
6169 |}
6170 !! html
6171 <table>
6172 <tr>
6173 <td> Foo!! </td>
6174 <td>
6175 </td></tr></table>
6176
6177 !! html/parsoid
6178 <table>
6179 <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>
6180 </tbody></table>
6181 !! end
6182
6183 !! test
6184 Accept "||" in indented table headings
6185 !! wikitext
6186 :{|
6187 !h1 || h2
6188 |}
6189 !! html
6190 <dl><dd><table>
6191 <tr>
6192 <th>h1 </th>
6193 <th> h2
6194 </th></tr></table></dd></dl>
6195
6196 !! end
6197
6198 !! test
6199 Accept "!!" in templates
6200 !! wikitext
6201 {|
6202 !a {{echo|b!!c}}
6203 |}
6204 !! html/php
6205 <table>
6206 <tr>
6207 <th>a b</th>
6208 <th>c
6209 </th></tr></table>
6210
6211 !! html/parsoid
6212 <table>
6213 <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>
6214 !! end
6215
6216 !! test
6217 Accept "!!" in table headings after newline
6218 !! wikitext
6219 {|
6220 !a
6221 b!!c
6222 |}
6223 !! html/php
6224 <table>
6225 <tr>
6226 <th>a
6227 <p>b!!c
6228 </p>
6229 </th></tr></table>
6230
6231 !! html/parsoid
6232 <table>
6233 <tbody><tr><th>a
6234 <p>b!!c</p></th></tr>
6235 </tbody></table>
6236 !! end
6237
6238 !! test
6239 Accept "!!" in table data of mixed wikitext / html syntax
6240 !! wikitext
6241 {|
6242 !a
6243 <tr><td>b!!c</td></tr>
6244 |}
6245 !! html+tidy
6246 <table>
6247 <tr>
6248 <th>a</th>
6249 </tr>
6250 <tr>
6251 <td>b!!c</td>
6252 </tr>
6253 </table>
6254 !! html/parsoid
6255 <table>
6256 <tbody><tr><th>a</th></tr>
6257 <tr data-parsoid='{"stx":"html"}'><td data-parsoid='{"stx":"html"}'>b!!c</td></tr>
6258 </tbody></table>
6259 !! end
6260
6261 !! test
6262 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
6263 !! wikitext
6264 {|
6265 !| h1
6266 || a
6267 |}
6268 !! html
6269 <table>
6270 <tr>
6271 <th> h1
6272 </th>
6273 <td> a
6274 </td></tr></table>
6275
6276 !! end
6277
6278 !!test
6279 Accept "| !" at start of line in tables (ignore !-attribute)
6280 !! wikitext
6281 {|
6282 |-
6283 | !style="color:red" | bar
6284 |}
6285 !! html
6286 <table>
6287
6288 <tr>
6289 <td> bar
6290 </td></tr></table>
6291
6292 !!end
6293
6294 !!test
6295 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 +/-
6296 !! wikitext
6297 {|
6298 |-
6299 |style='color:red;'|+1
6300 |style='color:blue;'|-1
6301 |-
6302 | 1 || 2 || 3
6303 | 1 ||+2 ||-3
6304 |-
6305 | +1
6306 | -1
6307 |}
6308 !! html
6309 <table>
6310
6311 <tr>
6312 <td style="color:red;">+1
6313 </td>
6314 <td style="color:blue;">-1
6315 </td></tr>
6316 <tr>
6317 <td> 1 </td>
6318 <td> 2 </td>
6319 <td> 3
6320 </td>
6321 <td> 1 </td>
6322 <td>+2 </td>
6323 <td>-3
6324 </td></tr>
6325 <tr>
6326 <td> +1
6327 </td>
6328 <td> -1
6329 </td></tr></table>
6330
6331 !!end
6332
6333 !! test
6334 Table rowspan
6335 !! wikitext
6336 {| border=1
6337 | Cell 1, row 1
6338 |rowspan=2| Cell 2, row 1 (and 2)
6339 | Cell 3, row 1
6340 |-
6341 | Cell 1, row 2
6342 | Cell 3, row 2
6343 |}
6344 !! html
6345 <table border="1">
6346 <tr>
6347 <td> Cell 1, row 1
6348 </td>
6349 <td rowspan="2"> Cell 2, row 1 (and 2)
6350 </td>
6351 <td> Cell 3, row 1
6352 </td></tr>
6353 <tr>
6354 <td> Cell 1, row 2
6355 </td>
6356 <td> Cell 3, row 2
6357 </td></tr></table>
6358
6359 !! end
6360
6361 !! test
6362 Nested table
6363 !! wikitext
6364 {| border=1
6365 | &alpha;
6366 |
6367 {| bgcolor=#ABCDEF border=2
6368 |nested
6369 |-
6370 |table
6371 |}
6372 |the original table again
6373 |}
6374 !! html
6375 <table border="1">
6376 <tr>
6377 <td> &#945;
6378 </td>
6379 <td>
6380 <table bgcolor="#ABCDEF" border="2">
6381 <tr>
6382 <td>nested
6383 </td></tr>
6384 <tr>
6385 <td>table
6386 </td></tr></table>
6387 </td>
6388 <td>the original table again
6389 </td></tr></table>
6390
6391 !! end
6392
6393 !! test
6394 Invalid attributes in table cell (T3830)
6395 !! wikitext
6396 {|
6397 |Cell:|broken
6398 |}
6399 !! html
6400 <table>
6401 <tr>
6402 <td>broken
6403 </td></tr></table>
6404
6405 !! end
6406
6407 !! test
6408 Table cell attributes: Pipes protected by nowikis should be treated as a plain character
6409 !! wikitext
6410 {|
6411 | title="foo" |bar
6412 | title="foo<nowiki>|</nowiki>" |bar
6413 | title="foo<nowiki>|</nowiki>" bar
6414 |}
6415 !! html/php
6416 <table>
6417 <tr>
6418 <td title="foo">bar
6419 </td>
6420 <td title="foo&#124;">bar
6421 </td>
6422 <td> title="foo|" bar
6423 </td></tr></table>
6424
6425 !! html/parsoid
6426 <table>
6427 <tbody><tr><td title="foo">bar</td>
6428 <td title="foo|" data-parsoid='{"a":{"title":"foo|"},"sa":{"title":"foo&lt;nowiki>|&lt;/nowiki>"},"autoInsertedEnd":true}'>bar</td>
6429 <td> title="foo<span typeof="mw:Nowiki">|</span>" bar</td></tr>
6430 </tbody></table>
6431 !! end
6432
6433 # See: http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html
6434 # N.B. The "|}" to close the table is missing from the input, so parsoid's
6435 # *2wt modes will fail.
6436 !! test
6437 Table security: embedded pipes
6438 !! options
6439 parsoid=wt2html,html2html
6440 !! wikitext
6441 {|
6442 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
6443 !! html/php
6444 <table>
6445 <tr>
6446 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
6447 <td>]" onmouseover="alert(document.cookie)"&gt;test
6448 </td>
6449 </tr>
6450 </table>
6451
6452 !! html/parsoid
6453 <table><tbody>
6454 <tr>
6455 <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>
6456 !! end
6457
6458 !! test
6459 Element attributes with double ! should not be broken up by <th>
6460 !! wikitext
6461 {|
6462 ! hi <div class="!!">ha</div> ho
6463 |}
6464 !! html/php
6465 <table>
6466 <tr>
6467 <th> hi <div class="!!">ha</div> ho
6468 </th></tr></table>
6469
6470 !! html/parsoid
6471 <table>
6472 <tbody><tr><th> hi <div class="!!" data-parsoid='{"stx":"html"}'>ha</div> ho</th></tr>
6473 </tbody></table>
6474 !! end
6475
6476 !! test
6477 ! and || in element attributes should not be parsed as <th>/<td>
6478 !! wikitext
6479 {|
6480 | <div style="color: red !important;" data-contrived="put this here ||">hi</div>
6481 |}
6482 !! html/php
6483 <table>
6484 <tr>
6485 <td> <div style="color: red !important;" data-contrived="put this here &#124;&#124;">hi</div>
6486 </td></tr></table>
6487
6488 !! html/parsoid
6489 <table>
6490 <tbody><tr><td> <div style="color: red !important;" data-contrived="put this here ||" data-parsoid='{"stx":"html"}'>hi</div></td></tr>
6491 </tbody></table>
6492 !! end
6493
6494 # FIXME: The output seems broken. Filed as T110268.
6495 !! test
6496 ! and || in td attributes should not be parsed as <th>/<td>
6497 !! options
6498 parsoid=wt2html
6499 !! wikitext
6500 {|
6501 | style="color: red !important;" data-contrived="put this here ||" | foo
6502 |}
6503 !! html/php
6504 <table>
6505 <tr>
6506 <td> style="color: red !important;" data-contrived="put this here </td>
6507 <td> foo
6508 </td></tr></table>
6509
6510 !! html/parsoid
6511 <table>
6512 <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>
6513 </tbody></table>
6514 !! end
6515
6516 !! test
6517 Break on | in element attribute in template
6518 !! options
6519 parsoid=wt2html,html2html
6520 !! wikitext
6521 {{echo|1=<div class="hi|ho">ha</div>}}
6522 !! html/php
6523 <p>ho"&gt;ha&lt;/div&gt;
6524 </p>
6525 !! html/parsoid
6526 <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>
6527 !! end
6528
6529 !! test
6530 Break on | in element attribute name in template
6531 !! wikitext
6532 {{echo|<div cla|ss="hiho">ha</div>}}
6533 !! html/parsoid
6534 <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>
6535 !! end
6536
6537 !! test
6538 Don't break on | in extension attribute in template
6539 !! wikitext
6540 {{echo|<ref name="hi|ho">ha</ref>}}
6541
6542 <references />
6543 !! html/parsoid
6544 <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>
6545
6546 <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>
6547 !! end
6548
6549 ## We don't support roundtripping of these attributes in Parsoid.
6550 ## Selective serialization takes care of preventing dirty diffs.
6551 ## But, on edits, we dirty-diff the invalid attribute text.
6552 !! test
6553 Invalid text in table attributes should be discarded
6554 !! options
6555 parsoid=wt2html
6556 !! wikitext
6557 {| <span>boo</span> style='border:1px solid black'
6558 | <span>boo</span> style='color:blue' | 1
6559 |<span>boo</span> style='color:blue'| 2
6560 |}
6561 !! html/php
6562 <table style="border:1px solid black">
6563 <tr>
6564 <td style="color:blue"> 1
6565 </td>
6566 <td style="color:blue"> 2
6567 </td></tr></table>
6568
6569 !! html/parsoid
6570 <table style="border:1px solid black">
6571 <tr>
6572 <td style="color:blue"> 1</td>
6573 <td style="color:blue"> 2</td>
6574 </tr>
6575 </table>
6576 !! end
6577
6578 !! test
6579 Invalid text in table attributes should be preserved by selective serializer
6580 !! options
6581 parsoid={
6582 "modes": ["selser"],
6583 "changes": [
6584 ["td:first-child", "text", "abc"],
6585 ["td + td", "text", "xyz"]
6586 ]
6587 }
6588 !! wikitext
6589 {| <span>boo</span> style='border:1px solid black'
6590 | <span>boo</span> style='color:blue' | 1
6591 |<span>boo</span> style='color:blue'| 2
6592 |}
6593 !! wikitext/edited
6594 {| <span>boo</span> style='border:1px solid black'
6595 | <span>boo</span> style='color:blue' |abc
6596 |<span>boo</span> style='color:blue'|xyz
6597 |}
6598 !! end
6599
6600 !! test
6601 1. Template-generated table cell attributes and cell content
6602 !! wikitext
6603 {|
6604 |{{table_attribs}}
6605 | {{table_attribs}}
6606 || {{table_attribs_5}}
6607 | <!--foo--> <!--bar--> <!--baz--> {{table_attribs}}
6608 |align=center {{table_attribs}}
6609 | <!--foo--> align=center <!--bar--> {{table_attribs}}
6610 |}
6611 !! html
6612 <table>
6613 <tr>
6614 <td style="color:red;">Foo
6615 </td>
6616 <td style="color:red;">Foo
6617 </td>
6618 <td> style="color:red;"</td>
6619 <td>Bar
6620 </td>
6621 <td style="color:red;">Foo
6622 </td>
6623 <td align="center" style="color:red;">Foo
6624 </td>
6625 <td align="center" style="color:red;">Foo
6626 </td></tr></table>
6627
6628 !! end
6629
6630 !! test
6631 2. Template-generated table cell attributes and cell content
6632 !! wikitext
6633 {|
6634 |{{table_attribs_2}}
6635 |}
6636 !! html/php
6637 <table>
6638 <tr>
6639 <td style="color:red;">Foo
6640 </td>
6641 <td>Bar</td>
6642 <td>Baz
6643 </td></tr></table>
6644
6645 !! html/parsoid
6646 <table>
6647 <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>
6648 <td about="#mwt1">Bar</td><td about="#mwt1">Baz</td></tr>
6649 </tbody></table>
6650 !! end
6651
6652 !! test
6653 3. Template-generated table cell attributes and cell content
6654 !! wikitext
6655 {|
6656 !align=center {{table_header_cells}}
6657 |-
6658 |align=center {{table_cells}}
6659 |}
6660 !! html/php
6661 <table>
6662 <tr>
6663 <th align="center" style="color:red;">Foo</th>
6664 <th style="color:red;"><i>Bar</i></th>
6665 <th style="color:brown;"><i>Foo</i> and Baz
6666 </th></tr>
6667 <tr>
6668 <td align="center" style="color:red;">Foo</td>
6669 <td style="color:red;"><i>Bar</i></td>
6670 <td style="color:brown;"><i>Foo</i> and Baz
6671 </td></tr></table>
6672
6673 !! html/parsoid
6674 <table>
6675 <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>
6676 <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>
6677 </tbody></table>
6678 !! end
6679
6680 !! test
6681 4. Template-generated table cell attributes and cell content inside a templated table
6682 !! wikitext
6683 {{tbl-start}}
6684 !align=center {{table_header_cells}}
6685 |-
6686 |align=center {{table_cells}}
6687 {{tbl-end}}
6688 !! html/php
6689 <table>
6690 <tr>
6691 <th align="center" style="color:red;">Foo</th>
6692 <th style="color:red;"><i>Bar</i></th>
6693 <th style="color:brown;"><i>Foo</i> and Baz
6694 </th></tr>
6695 <tr>
6696 <td align="center" style="color:red;">Foo</td>
6697 <td style="color:red;"><i>Bar</i></td>
6698 <td style="color:brown;"><i>Foo</i> and Baz
6699 </td></tr></table>
6700
6701 !! html/parsoid
6702 <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}}]}'>
6703 <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>
6704 <tr>
6705 <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>
6706 </tbody></table>
6707 !! end
6708
6709 ## Edge case fix to prevent future regressions
6710 !! test
6711 T107652: <ref>s in templates that also generate table cell attributes should be rendered properly
6712 !! wikitext
6713 {|
6714 |{{table_attribs_7}}
6715 |}
6716 <references />
6717 !! html/parsoid
6718 <table>
6719 <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>
6720 </tbody></table>
6721 <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>
6722 !! end
6723
6724 !! test
6725 Table with row followed by newlines and table heading
6726 !! options
6727 parsoid=wt2html,html2html
6728 !! wikitext
6729 {|
6730 |-
6731
6732 ! foo
6733 |}
6734 !! html/*
6735 <table>
6736
6737
6738 <tr>
6739 <th> foo
6740 </th></tr></table>
6741
6742 !! end
6743
6744 !! test
6745 Table with empty line following the start tag
6746 !! options
6747 parsoid=wt2html,html2html
6748 !! wikitext
6749 {|
6750
6751 |-
6752 | foo
6753 |}
6754 !! html/*
6755 <table>
6756
6757
6758 <tr>
6759 <td> foo
6760 </td></tr></table>
6761
6762 !! end
6763
6764 !! test
6765 Table attributes with empty value
6766 !! options
6767 parsoid=wt2html,html2html
6768 !! wikitext
6769 {|
6770 | style=| hello
6771 |}
6772 !! html/php
6773 <table>
6774 <tr>
6775 <td style=""> hello
6776 </td></tr></table>
6777
6778 !! html/parsoid
6779 <table>
6780 <tbody><tr><td style=""> hello</td></tr>
6781 </tbody></table>
6782 !! end
6783
6784 !! test
6785 Wikitext table with a lot of comments
6786 !! wikitext
6787 {|
6788 <!-- c0 -->
6789 | foo
6790 <!-- c1 -->
6791 |-<!-- c2 -->
6792 <!-- c3 -->
6793 |<!-- c4 -->
6794 <!-- c5 -->
6795 |}
6796 !! html
6797 <table>
6798 <tr>
6799 <td> foo
6800 </td></tr>
6801 <tr>
6802 <td>
6803 </td></tr></table>
6804
6805 !! end
6806
6807 !! test
6808 Wikitext table comments represented in parsoid dom
6809 !! wikitext
6810 {|<!--c1--><!--c2-->
6811 |-<!--c3-->
6812 | x
6813 |}
6814 !! html/php+tidy
6815 <table>
6816 <tr>
6817 <td>x</td>
6818 </tr>
6819 </table>
6820 !! html/parsoid
6821 <table><!--c1--><!--c2-->
6822 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'><!--c3-->
6823 <td data-parsoid='{"autoInsertedEnd":true}'> x</td></tr>
6824 </tbody></table>
6825 !! end
6826
6827 !! test
6828 Wikitext table with double-line table cell
6829 !! wikitext
6830 {|
6831 |a
6832 b
6833 |}
6834 !! html
6835 <table>
6836 <tr>
6837 <td>a
6838 <p>b
6839 </p>
6840 </td></tr></table>
6841
6842 !! end
6843
6844 !! test
6845 Table cell with a single comment
6846 !! wikitext
6847 {|
6848 | <!-- c1 -->
6849 | a
6850 |}
6851 !! html
6852 <table>
6853 <tr>
6854 <td>
6855 </td>
6856 <td> a
6857 </td></tr></table>
6858
6859 !! end
6860
6861 !! test
6862 Table-cell after a comment-only-empty-line
6863 !! wikitext
6864 {|
6865 |a
6866 <!--c1-->
6867 <!--c2-->| b
6868 |}
6869 !! html
6870 <table>
6871 <tr>
6872 <td>a
6873 </td>
6874 <td> b
6875 </td></tr></table>
6876
6877 !! html/parsoid
6878 <table>
6879 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>a</td>
6880 <!--c1-->
6881 <!--c2--><td data-parsoid='{"autoInsertedEnd":true}'> b</td></tr>
6882 </tbody></table>
6883
6884 !! end
6885
6886 !! test
6887 Build table with {{!}}
6888 !! wikitext
6889 {{{!}} class="wikitable"
6890 ! header
6891 ! second header
6892 {{!}}- style="color:red;"
6893 {{!}} data {{!}}{{!}} style="color:red;" {{!}} second data
6894 {{!}}}
6895 !! html
6896 <table class="wikitable">
6897 <tr>
6898 <th> header
6899 </th>
6900 <th> second header
6901 </th></tr>
6902 <tr style="color:red;">
6903 <td> data </td>
6904 <td style="color:red;"> second data
6905 </td></tr></table>
6906
6907 !! end
6908
6909 !! test
6910 Build table with pipe as data
6911 !! wikitext
6912 {| class="wikitable"
6913 ! header
6914 ! second header
6915 |- style="color:red;"
6916 | data || style="color:red;" | second data
6917 |-
6918 | style="color:red;" | data with | || style="color:red;" | second data with |
6919 |-
6920 || data with | ||| second data with |
6921 |}
6922 !! html
6923 <table class="wikitable">
6924 <tr>
6925 <th> header
6926 </th>
6927 <th> second header
6928 </th></tr>
6929 <tr style="color:red;">
6930 <td> data </td>
6931 <td style="color:red;"> second data
6932 </td></tr>
6933 <tr>
6934 <td style="color:red;"> data with | </td>
6935 <td style="color:red;"> second data with |
6936 </td></tr>
6937 <tr>
6938 <td> data with | </td>
6939 <td> second data with |
6940 </td></tr></table>
6941
6942 !! end
6943
6944 !! test
6945 Build table with wikilink
6946 !! wikitext
6947 {| class="wikitable"
6948 ! header || second header
6949 |- style="color:red;"
6950 | data [[Main Page|linktext]] || second data [[Main Page|linktext]]
6951 |-
6952 | data || second data [[Main Page|link|text with pipe]]
6953 |}
6954 !! html
6955 <table class="wikitable">
6956 <tr>
6957 <th> header </th>
6958 <th> second header
6959 </th></tr>
6960 <tr style="color:red;">
6961 <td> data <a href="/wiki/Main_Page" title="Main Page">linktext</a> </td>
6962 <td> second data <a href="/wiki/Main_Page" title="Main Page">linktext</a>
6963 </td></tr>
6964 <tr>
6965 <td> data </td>
6966 <td> second data <a href="/wiki/Main_Page" title="Main Page">link|text with pipe</a>
6967 </td></tr></table>
6968
6969 !! end
6970
6971 # The expected HTML structure in this test is debatable. The PHP parser does
6972 # not parse this kind of table at all. The main focus for Parsoid is on
6973 # round-tripping, so this output is ok for now. TODO: revisit!
6974 !! test
6975 Wikitext table with html-syntax row
6976 !! wikitext
6977 {|
6978 |-
6979 <td>foo</td>
6980 |}
6981 !! html/parsoid
6982 <table>
6983 <tbody>
6984 <tr>
6985 <td>foo</td></tr></tbody></table>
6986 !! end
6987
6988 !! test
6989 Implicit <td> after a |-
6990 !! options
6991 parsoid=wt2html,html2html
6992 !! wikitext
6993 {|
6994 |-
6995 a
6996 |}
6997 !! html/php
6998 <table>
6999
7000 a
7001 </table>
7002
7003 !! html/php+tidy
7004 <p>a</p>
7005 !! html/parsoid
7006 <p data-parsoid='{"fostered":true,"autoInsertedEnd":true}'>a</p><table>
7007 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
7008
7009 </tr></tbody></table>
7010 !! end
7011
7012 !! test
7013 Lists should be recognized in an implicit <td> context
7014 !! options
7015 parsoid=wt2html,html2html
7016 !! wikitext
7017 {|
7018 |-
7019 *a
7020 |}
7021 !! html/php
7022 <table>
7023
7024 <ul><li>a</li></ul>
7025 </table>
7026
7027 !! html/php+tidy
7028 <ul>
7029 <li>a</li>
7030 </ul>
7031 !! html/parsoid
7032 <ul data-parsoid='{"fostered":true,"autoInsertedEnd":true}'><li>a</li></ul><table>
7033 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
7034
7035 </tr></tbody></table>
7036 !! end
7037
7038 !! test
7039 Table cells not properly parsed in an implicit-td context
7040 !! wikitext
7041 {|
7042 |-
7043 {{table_attribs_4}} || a || b
7044 |}
7045 !! html/php+tidy
7046 <table>
7047 <tr>
7048 <td style="background-color:#DC241f;" width="10px"></td>
7049 <td>a</td>
7050 <td>b</td>
7051 </tr>
7052 </table>
7053 !! html/parsoid
7054 <table>
7055 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
7056 <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>
7057 !! end
7058
7059 !! test
7060 Parsoid: Round-trip tables directly followed by content (T53219)
7061 !! options
7062 parsoid=wt2html,wt2wt
7063 !! wikitext
7064 {|
7065 |foo
7066 |} bar
7067
7068 {|
7069 |baz
7070 |}<b>quux</b>
7071 !! html+tidy
7072 <table>
7073 <tr>
7074 <td>foo</td>
7075 </tr>
7076 </table>
7077 <p>bar</p>
7078 <table>
7079 <tr>
7080 <td>baz</td>
7081 </tr>
7082 </table>
7083 <p><b>quux</b></p>
7084 !! end
7085
7086 !! test
7087 Parsoid: Default to a newline after tables in new content (T53219)
7088 !! options
7089 parsoid=html2wt
7090 !! html/parsoid
7091 <table><tbody>
7092 <tr><td>foo</td></tr></tbody></table> bar
7093 <table><tbody>
7094 <tr><td>baz</td></tr></tbody></table><b>quux</b>
7095 !! wikitext
7096 {|
7097 |foo
7098 |}
7099 <nowiki> </nowiki>bar
7100 {|
7101 |baz
7102 |}
7103 '''quux'''
7104 !! end
7105
7106 !! test
7107 Parsoid: newline inducing block nodes don't suppress <nowiki>
7108 !! options
7109 parsoid=html2wt
7110 !! html/parsoid
7111 a<h1>foo</h1>
7112 !! wikitext
7113 <nowiki> </nowiki>a
7114
7115 = foo =
7116 !! end
7117
7118 !! test
7119 Parsoid: Row-syntax table headings followed by comment & table cells
7120 !! options
7121 parsoid=wt2html,wt2wt
7122 !! wikitext
7123 {|
7124 ! foo || bar
7125 <!-- foo --> || baz || quux
7126 |}
7127 !! html/php
7128 <table>
7129 <tr>
7130 <th> foo </th>
7131 <th> bar
7132 </th>
7133 <td> baz </td>
7134 <td> quux
7135 </td></tr></table>
7136
7137 !! html/parsoid
7138 <table>
7139 <tbody><tr><th> foo </th><th> bar
7140 <!-- foo --> </th><td> baz </td><td> quux</td></tr>
7141 </tbody></table>
7142 !! end
7143
7144 !!test
7145 Parsoid: Recover better from broken table attributes
7146 !!options
7147 parsoid=wt2html
7148 !!wikitext
7149 {| class="foo
7150 | class="bar" |
7151 foo
7152 |}
7153 !!html/php+tidy
7154 <table class="foo">
7155 <tr>
7156 <td class="bar">
7157 <p>foo</p>
7158 </td>
7159 </tr>
7160 </table>
7161 !!html/parsoid
7162 <table class="foo">
7163 <tr>
7164 <td class="bar">
7165 <p>foo</p></td></tr>
7166 </tbody></table>
7167 !!end
7168
7169 !! test
7170 Tables: Digest broken attributes on table and tr tag
7171 !! options
7172 parsoid=wt2html
7173 !! wikitext
7174 {| || |} ++
7175 |- || || ++ --
7176 |- > [
7177 |}
7178 !! html
7179 <table>
7180 <tbody>
7181 <tr></tr>
7182 <tr></tr>
7183 </tbody></table>
7184 !! end
7185
7186 # T137406: Whitespace in the HTML
7187 !! test
7188 1. Generate correct wikitext for tables with thead/tbody/tfoot
7189 !! options
7190 parsoid=html2wt
7191 !! html/parsoid
7192 <table>
7193 <caption>Test</caption>
7194 <thead>
7195 <tr>
7196 <th>Month</th>
7197 <th>Savings</th>
7198 </tr>
7199 </thead>
7200 <tbody>
7201 <tr>
7202 <td>January</td>
7203 <td>$100</td>
7204 </tr>
7205 <tr>
7206 <td>February</td>
7207 <td>$80</td>
7208 </tr>
7209 </tbody>
7210 <tfoot>
7211 <tr>
7212 <td>Sum</td>
7213 <td>$180</td>
7214 </tr>
7215 </tfoot>
7216 </table>
7217 !! wikitext
7218 {|
7219 |+Test
7220 !Month
7221 !Savings
7222 |-
7223 |January
7224 |$100
7225 |-
7226 |February
7227 |$80
7228 |-
7229 |Sum
7230 |$180
7231 |}
7232 !! html/php+tidy
7233 <table>
7234 <caption>Test</caption>
7235 <tr>
7236 <th>Month</th>
7237 <th>Savings</th>
7238 </tr>
7239 <tr>
7240 <td>January</td>
7241 <td>$100</td>
7242 </tr>
7243 <tr>
7244 <td>February</td>
7245 <td>$80</td>
7246 </tr>
7247 <tr>
7248 <td>Sum</td>
7249 <td>$180</td>
7250 </tr>
7251 </table>
7252 !! end
7253
7254 # T137406: No whitespace in the HTML
7255 !! test
7256 2. Generate correct wikitext for tables with thead/tbody/tfoot
7257 !! options
7258 parsoid=html2wt
7259 !! html/parsoid
7260 <table><thead><tr><th>heading</th></tr></thead><tbody><tr><td>foo</td></tr></tbody></table>
7261 !! wikitext
7262 {|
7263 !heading
7264 |-
7265 |foo
7266 |}
7267 !! end
7268
7269 !! test
7270 Testing serialization after deletion in references
7271 !! options
7272 parsoid={
7273 "modes": ["wt2wt"],
7274 "changes": [
7275 ["#x", "remove"]
7276 ]
7277 }
7278 !! wikitext
7279 hi <ref><div id="x">ho</div></ref>
7280
7281 <references />
7282 !! wikitext/edited
7283 hi <ref></ref>
7284
7285 <references />
7286 !! end
7287
7288 !!test
7289 Testing serialization after deletion of table cells
7290 !!options
7291 parsoid={
7292 "modes": ["wt2wt", "selser"],
7293 "changes": [
7294 ["#x", "remove"]
7295 ]
7296 }
7297 !!wikitext
7298 {|
7299 !h1 !!h2 !!h3
7300 | id="x" |c1 {{!}}{{!}}{{!}}c2 |||c3
7301 |}
7302 !! wikitext/edited
7303 {|
7304 !h1 !!h2 !!h3
7305 |c2 |||c3
7306 |}
7307 !!end
7308
7309 !! test
7310 Testing selser after addition of new row before first row (T125419)
7311 !! options
7312 parsoid={
7313 "modes": ["wt2wt", "selser"],
7314 "changes": [
7315 [ "tr", "before", "<tr><td>X</td></tr>" ]
7316 ]
7317 }
7318 !! wikitext
7319 {|
7320 |a
7321 |}
7322 !! wikitext/edited
7323 {|
7324 |X
7325 |-
7326 |a
7327 |}
7328 !! end
7329
7330 !! test
7331 Serialize new table rows in a HTML table using HTML tags
7332 !! options
7333 parsoid={
7334 "modes": ["wt2wt", "selser"],
7335 "changes": [
7336 [ "tr", "before", "<tr><td>X</td></tr>" ]
7337 ]
7338 }
7339 !! wikitext
7340 <table><tr><td>a</td></tr></table>
7341 !! wikitext/edited
7342 <table><tr><td>X</td></tr><tr><td>a</td></tr></table>
7343 !! end
7344
7345 !! test
7346 Serialize new table cells in a HTML row using HTML tags
7347 !! options
7348 parsoid={
7349 "modes": ["wt2wt", "selser"],
7350 "changes": [
7351 [ "td", "before", "<td>X</td>" ]
7352 ]
7353 }
7354 !! wikitext
7355 <table><tr><td>a</td></tr></table>
7356 !! wikitext/edited
7357 <table><tr><td>X</td><td>a</td></tr></table>
7358 !! end
7359
7360 !! test
7361 Wikitext tables can be nested inside HTML tables
7362 !! options
7363 parsoid=html2wt
7364 !! html
7365 <table data-parsoid='{"stx":"html"}'>
7366 <tr><td>
7367 <table>
7368 <tr><td>foo</td></tr>
7369 </table>
7370 </td></tr>
7371 </table>
7372 !! wikitext
7373 <table>
7374 <tr><td>
7375 {|
7376 |foo
7377 |}
7378 </td></tr>
7379 </table>
7380 !! end
7381
7382 !! test
7383 Serialize wikitext list items as HTML list items when embedded in a HTML list
7384 !! options
7385 parsoid=html2wt
7386 !! html
7387 <ul data-parsoid='{"stx": "html"}'>
7388 <li data-parsoid='{}'>a</li>
7389 <li>b</li>
7390 </ul>
7391 !! wikitext
7392 <ul>
7393 <li>a</li>
7394 <li>b</li>
7395 </ul>
7396 !! end
7397
7398 # SSS FIXME: Is this actually a good thing given the
7399 # odd nested list output that is generated by MW?
7400 # <ul><li>foo<ul>..</ul></li></ul> instead of
7401 # <ul><li>foo</li><ul>..</ul></ul>
7402 !! test
7403 Wikitext lists can be nested inside HTML lists
7404 !! options
7405 parsoid=html2wt
7406 !! html
7407 <ul data-parsoid='{"stx": "html"}'>
7408 <li data-parsoid='{"stx": "html"}'>a
7409 <ul><li>b</li></ul>
7410 </li>
7411 </ul>
7412
7413 <ul data-parsoid='{"stx": "html"}'>
7414 <li>x
7415 <ul><li>y</li></ul>
7416 </li>
7417 </ul>
7418 !! wikitext
7419 <ul>
7420 <li>a
7421 * b
7422 </li>
7423 </ul>
7424
7425 <ul>
7426 <li>x
7427 * y
7428 </li>
7429 </ul>
7430 !! end
7431
7432 ###
7433 ### Internal links
7434 ###
7435 !! test
7436 Plain link, capitalized
7437 !! wikitext
7438 [[Main Page]]
7439 !! html
7440 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
7441 </p>
7442 !! end
7443
7444 !! test
7445 Plain link, uncapitalized
7446 !! wikitext
7447 [[main Page]]
7448 !! html
7449 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
7450 </p>
7451 !! end
7452
7453 !! test
7454 Piped link
7455 !! wikitext
7456 [[Main Page|The Main Page]]
7457 !! html
7458 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
7459 </p>
7460 !! end
7461
7462 !! test
7463 Piped link with comment in link text
7464 !! wikitext
7465 [[Main Page|The Main<!--front--> Page]]
7466 !! html
7467 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
7468 </p>
7469 !! end
7470
7471 !! test
7472 Piped link with multiple pipe characters in link text
7473 !! wikitext
7474 [[Main Page||The|Main|Page|]]
7475 !! html/php
7476 <p><a href="/wiki/Main_Page" title="Main Page">|The|Main|Page|</a>
7477 </p>
7478 !! html/parsoid
7479 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">|The|Main|Page|</a></p>
7480 !! end
7481
7482 !! test
7483 Piped link with no link text
7484 !! wikitext
7485 [[Thomas Bek (bishop of St David's)|]]
7486 !! html/php
7487 <p>[[Thomas Bek (bishop of St David's)|]]
7488 </p>
7489 !! html/parsoid
7490 <p>[[Thomas Bek (bishop of St David's)|]]</p>
7491 !! end
7492
7493 !! test
7494 Piped link with empty link text
7495 !! wikitext
7496 [[Main Page|<nowiki/>]] - empty nowiki
7497 [[Main Page| ]] - empty space
7498 [[Main Page|&nbsp;]] - empty non breaking space
7499 !! html/php
7500 <p><a href="/wiki/Main_Page" title="Main Page"></a> - empty nowiki
7501 <a href="/wiki/Main_Page" title="Main Page"> </a> - empty space
7502 <a href="/wiki/Main_Page" title="Main Page">&#160;</a> - empty non breaking space
7503 </p>
7504 !! html/parsoid
7505 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page"><span typeof="mw:Nowiki"></span></a> - empty nowiki
7506 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page"> </a> - empty space
7507 <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>
7508 !! end
7509
7510 !! test
7511 Broken link
7512 !! wikitext
7513 [[Zigzagzogzagzig]]
7514 !! html
7515 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
7516 </p>
7517 !! end
7518
7519 !! test
7520 Broken link with fragment
7521 !! wikitext
7522 [[Zigzagzogzagzig#zug]]
7523 !! html
7524 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
7525 </p>
7526 !! end
7527
7528 !! test
7529 Special page link with fragment
7530 !! wikitext
7531 [[Special:Version#anchor]]
7532 !! html
7533 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
7534 </p>
7535 !! end
7536
7537 !! test
7538 Nonexistent special page link with fragment
7539 !! wikitext
7540 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
7541 !! html
7542 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
7543 </p>
7544 !! end
7545
7546 !! test
7547 Link with prefix
7548 !! wikitext
7549 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
7550 !! html
7551 <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>
7552 </p>
7553 !! end
7554
7555 !! test
7556 Link with suffix
7557 !! wikitext
7558 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
7559 !! html
7560 <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>!!!
7561 </p>
7562 !! end
7563
7564 !! article
7565 prefixed article
7566 !! text
7567 Some text
7568 !! endarticle
7569
7570 !! test
7571 T45661: Piped links with identical prefixes
7572 !! wikitext
7573 [[prefixed article|prefixed articles with spaces]]
7574
7575 [[prefixed article|prefixed articlesaoeu]]
7576
7577 [[Main Page|Main Page test]]
7578 !! html
7579 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
7580 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
7581 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
7582 </p>
7583 !! end
7584
7585
7586 !! test
7587 Link with HTML entity in suffix / tail
7588 !! wikitext
7589 [[Main Page]]&quot;, [[Main Page]]&#97;
7590 !! html/php
7591 <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;
7592 </p>
7593 !! html/parsoid
7594 <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>
7595 !! end
7596
7597 !! test
7598 Link with 3 brackets
7599 !! wikitext
7600 [[[Main Page]]]
7601 Foo [[[Main Page]]]
7602 !! html
7603 <p>[[[Main Page]]]
7604 Foo [[[Main Page]]]
7605 </p>
7606 !! end
7607
7608 !! test
7609 Link with 4 brackets
7610 !! wikitext
7611 [[[[Main Page]]]]
7612 !! html
7613 <p>[[<a href="/wiki/Main_Page" title="Main Page">Main Page</a>]]
7614 </p>
7615 !! end
7616
7617 !! test
7618 Piped link with 3 brackets
7619 !! wikitext
7620 [[[main page|the main page]]]
7621 !! html
7622 <p>[[[main page|the main page]]]
7623 </p>
7624 !! end
7625
7626 !! test
7627 Piped link with extlink-like text
7628 !! wikitext
7629 [[Main Page|[bar]]]
7630 [[Main Page|This is a [bar]]]
7631 !! html/php
7632 <p><a href="/wiki/Main_Page" title="Main Page">[bar]</a>
7633 <a href="/wiki/Main_Page" title="Main Page">This is a [bar]</a>
7634 </p>
7635 !! html/parsoid
7636 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>[bar]</a>
7637 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>This is a [bar]</a></p>
7638 !! end
7639
7640 !! test
7641 Link with multiple pipes
7642 !! wikitext
7643 [[Main Page|The|Main|Page]]
7644 !! html
7645 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
7646 </p>
7647 !! end
7648
7649 !! test
7650 Anchor containing a #. (T65430)
7651 !! wikitext
7652 [[Main Page#And#Link]]
7653 !! html/php
7654 <p><a href="/wiki/Main_Page#And.23Link" title="Main Page">Main Page#And#Link</a>
7655 </p>
7656 !! html/parsoid
7657 <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>
7658 !! end
7659
7660 !! test
7661 Link to namespaces
7662 !! wikitext
7663 [[Talk:Parser testing]], [[Meta:Disclaimers]]
7664 !! html
7665 <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>
7666 </p>
7667 !! end
7668
7669 !! test
7670 Link with space in namespace
7671 !! wikitext
7672 [[User talk:Foo bar]]
7673 !! html
7674 <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>
7675 </p>
7676 !! end
7677
7678 !! article
7679 MemoryAlpha:AlphaTest
7680 !! text
7681 This is an article in the MemoryAlpha namespace
7682 (which shadows the memoryalpha interwiki link).
7683 !! endarticle
7684
7685 !! test
7686 Namespace takes precedence over interwiki link (T53680)
7687 !! wikitext
7688 [[MemoryAlpha:AlphaTest]]
7689 !! html
7690 <p><a href="/wiki/MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
7691 </p>
7692 !! end
7693
7694 # The previous test doesn't work correctly in html2*, due to not recognizing the
7695 # link as an internal one. This one checks for the correct behavior.
7696 !! test
7697 Link to namespace preferred over interwiki with correct rel attribute
7698 !! options
7699 parsoid=html2wt,html2html
7700 !! html/parsoid
7701 <p><a rel="mw:WikiLink" href="./MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a></p>
7702 !! wikitext
7703 [[MemoryAlpha:AlphaTest]]
7704 !! end
7705
7706 !! test
7707 Piped link to namespace
7708 !! wikitext
7709 [[Meta:Disclaimers|The disclaimers]]
7710 !! html
7711 <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>
7712 </p>
7713 !! end
7714
7715 !! test
7716 Link containing }
7717 !! wikitext
7718 [[Usually caused by a typo (oops}]]
7719 !! html
7720 <p>[[Usually caused by a typo (oops}]]
7721 </p>
7722 !! end
7723
7724 !! article
7725 7% Solution
7726 !! text
7727 Just a test of an article title containing a percent.
7728 !! endarticle
7729
7730 !! test
7731 Link containing % (not as a hex sequence)
7732 !! wikitext
7733 [[7% Solution]]
7734 [[7% Solution|7%25 Solution]]
7735 !! html/php
7736 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
7737 <a href="/wiki/7%25_Solution" title="7% Solution">7%25 Solution</a>
7738 </p>
7739 !! html/parsoid
7740 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a>
7741 <a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7%25 Solution</a></p>
7742 !! end
7743
7744 # note that the parsoid HTML is identical to the previous test output,
7745 # so the previous test ensures that the html2wt mode will generate the
7746 # "not as a hex sequence" wikitext.
7747 !! test
7748 Link containing % as a single hex sequence interpreted to char
7749 !! options
7750 parsoid=wt2wt,wt2html,html2html
7751 !! wikitext
7752 [[7%25 Solution]]
7753 [[7%25 Solution|7%25 Solution]]
7754 !! html/php
7755 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
7756 <a href="/wiki/7%25_Solution" title="7% Solution">7%25 Solution</a>
7757 </p>
7758 !! html/parsoid
7759 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a>
7760 <a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7%25 Solution</a></p>
7761 !!end
7762
7763 !! test
7764 Link containing % as a double hex sequence interpreted to hex sequence
7765 !! wikitext
7766 [[7%2525 Solution]]
7767 !! html
7768 <p>[[7%2525 Solution]]
7769 </p>
7770 !!end
7771
7772 ## Example for such a section: == < ==
7773 !! test
7774 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
7775 !! wikitext
7776 [[%23%3c]][[%23%3e]]
7777 !! html/php
7778 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
7779 </p>
7780 !! html/parsoid
7781 <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>
7782 !! end
7783
7784 !! test
7785 Link containing "<#" and ">#" as a hex sequences
7786 !! wikitext
7787 [[%3c%23]][[%3e%23]]
7788 !! html
7789 <p>[[%3c%23]][[%3e%23]]
7790 </p>
7791 !! end
7792
7793 !! test
7794 Link containing an equals sign
7795 !! wikitext
7796 [[Special:BookSources/isbn=4-00-026157-6]]
7797 !! html/php
7798 <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>
7799 </p>
7800 !! html/parsoid
7801 <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>
7802 !! end
7803
7804 !! article
7805 Foo~bar
7806 !! text
7807 Just a test of an article title containing a tilde.
7808 !! endarticle
7809
7810 # note that links containing signatures, like [[Foo~~~~]], are
7811 # massaged by the pre-save transform (PST) and so the tildes are never
7812 # seen by the parser.
7813 !! test
7814 Link containing a tilde
7815 !! wikitext
7816 [[Foo~bar]]
7817 !! html/php
7818 <p><a href="/wiki/Foo~bar" title="Foo~bar">Foo~bar</a>
7819 </p>
7820 !! html/parsoid
7821 <p><a rel="mw:WikiLink" href="./Foo~bar" title="Foo~bar">Foo~bar</a></p>
7822 !! end
7823
7824 !! test
7825 Link containing double-single-quotes '' (T6598)
7826 !! wikitext
7827 [[Lista d''e paise d''o munno]]
7828 !! html/php
7829 <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>
7830 </p>
7831 !! html/parsoid
7832 <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>
7833 !! end
7834
7835 !! test
7836 Link containing double quotes and spaces
7837 !! wikitext
7838 [[Cool "Gator"]]
7839 !! html/php
7840 <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>
7841 </p>
7842 !! html/parsoid
7843 <p><a rel="mw:WikiLink" href="./Cool_%22Gator%22" title='Cool "Gator"'>Cool "Gator"</a></p>
7844 !! end
7845
7846 !! test
7847 File containing double quotes and spaces
7848 !! wikitext
7849 [[File:Cool "Gator".png]]
7850 !! html/parsoid
7851 <p><span class="mw-default-size" typeof="mw:Error mw:Image" data-parsoid='{"optList":[]}' data-mw='{"errors":[{"key":"missing-image","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>
7852 !! end
7853
7854 !! test
7855 Redirect containing double quotes and spaces
7856 !! wikitext
7857 #REDIRECT [[Cool "Gator"]]
7858 !! html/parsoid
7859 <link rel="mw:PageProp/redirect" href="./Cool_%22Gator%22" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Cool_%22Gator%22"},"sa":{"href":"Cool \"Gator\""}}'/>
7860 !! end
7861
7862 !! test
7863 Link containing double-single-quotes '' in text (T6598 sanity check)
7864 !! wikitext
7865 Some [[Link|pretty ''italics'' and stuff]]!
7866 !! html/php
7867 <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>!
7868 </p>
7869 !! html/parsoid
7870 <p>Some <a rel="mw:WikiLink" href="./Link" title="Link">pretty <i>italics</i> and stuff</a>!</p>
7871 !! end
7872
7873 !! test
7874 Link containing double-single-quotes '' in text embedded in italics (T6598 sanity check)
7875 !! wikitext
7876 ''Some [[Link|pretty ''italics'' and stuff]]!''
7877 !! html
7878 <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>
7879 </p>
7880 !! end
7881
7882 !! test
7883 Link with double quotes in title part (literal) and alternate part (interpreted)
7884 !! wikitext
7885 [[File:Denys_Savchenko_''Pentecoste''.jpg]]
7886
7887 [[''Pentecoste'']]
7888
7889 [[''Pentecoste''|Pentecoste]]
7890
7891 [[''Pentecoste''|''Pentecoste'']]
7892 !! html/php
7893 <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>
7894 </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>
7895 </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>
7896 </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>
7897 </p>
7898 !! html/parsoid
7899 <p><span class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"missing-image","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>
7900 <p><a rel="mw:WikiLink" href="./''Pentecoste''" title="''Pentecoste''">''Pentecoste''</a></p>
7901 <p><a rel="mw:WikiLink" href="./''Pentecoste''" title="''Pentecoste''">Pentecoste</a></p>
7902 <p><a rel="mw:WikiLink" href="./''Pentecoste''" title="''Pentecoste''"><i>Pentecoste</i></a></p>
7903 !! end
7904
7905 !! test
7906 Broken image links with HTML captions (T41700)
7907 !! wikitext
7908 [[File:Nonexistent|<script></script>]]
7909 [[File:Nonexistent|100x100px|<script></script>]]
7910 [[File:Nonexistent|&lt;]]
7911 [[File:Nonexistent|a<i>b</i>c]]
7912 !! html/php
7913 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
7914 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
7915 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
7916 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
7917 </p>
7918 !! html/parsoid
7919 <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":"missing-image","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>
7920 <span typeof="mw:Error mw:Image" data-parsoid='{"optList":[{"ck":"width","ak":"100x100px"},{"ck":"caption","ak":"&lt;script>&lt;/script>"}]}' data-mw='{"errors":[{"key":"missing-image","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>
7921 <span class="mw-default-size" typeof="mw:Error mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"&amp;lt;"}]}' data-mw='{"errors":[{"key":"missing-image","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>
7922 <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":"missing-image","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>
7923 !! end
7924
7925 !! test
7926 Plain link to URL
7927 !! wikitext
7928 [[http://www.example.com]]
7929 !! html/php
7930 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
7931 </p>
7932 !! html/parsoid
7933 <p>[<a rel="mw:ExtLink" href="http://www.example.com"></a>]</p>
7934 !! end
7935
7936 !! test
7937 Plain link to URL with link text
7938 !! wikitext
7939 [[http://www.example.com Link text]]
7940 !! html
7941 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
7942 </p>
7943 !! end
7944
7945 !! test
7946 Plain link to protocol-relative URL
7947 !! wikitext
7948 [[//www.example.com]]
7949 !! html/php
7950 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
7951 </p>
7952 !! html/parsoid
7953 <p>[<a rel="mw:ExtLink" href="//www.example.com"></a>]</p>
7954 !! end
7955
7956 !! test
7957 Plain link to protocol-relative URL with link text
7958 !! wikitext
7959 [[//www.example.com Link text]]
7960 !! html
7961 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
7962 </p>
7963 !! end
7964
7965 !! test
7966 Plain link to page with question mark in title
7967 !! wikitext
7968 [[A?b]]
7969
7970 [[A?b|Baz]]
7971 !! html
7972 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
7973 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
7974 </p>
7975 !! end
7976
7977
7978 # I'm fairly sure the expected result here is wrong.
7979 # We want these to be URL links, not pseudo-pages with URLs for titles....
7980 # However the current output is also pretty screwy.
7981 #
7982 # ----
7983 # I'm changing it to match the current output--it arguably makes more
7984 # sense in the light of the test above. Old expected result was:
7985 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
7986 #</p>
7987 # But I think this test is bordering on "garbage in, garbage out" anyway.
7988 # -- wtm
7989 !! test
7990 Piped link to URL
7991 !! wikitext
7992 Piped link to URL: [[http://www.example.com|an example URL]]
7993 !! html/php
7994 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
7995 </p>
7996 !! html/parsoid
7997 <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>
7998 !! end
7999
8000 !! test
8001 T2002: [[page|http://url/]] should link to page, not http://url/
8002 !! wikitext
8003 [[Main Page|http://url/]]
8004 !! html/php
8005 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
8006 </p>
8007 !! html/parsoid
8008 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">http://url/</a></p>
8009 !! end
8010
8011 # Parsoid does not mark self-links, by design.
8012 !! test
8013 T2337: Escaped self-links should be bold
8014 !! options
8015 title=[[Bug462]]
8016 !! wikitext
8017 [[Bu&#103;462]] [[Bug462]]
8018 !! html/php
8019 <p><a class="mw-selflink selflink">Bu&#103;462</a> <a class="mw-selflink selflink">Bug462</a>
8020 </p>
8021 !! html/php+tidy
8022 <p><a class="mw-selflink selflink">Bug462</a> <a class="mw-selflink selflink">Bug462</a></p>
8023 !! html/parsoid
8024 <p><a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a> <a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a></p>
8025 !! end
8026
8027 !! test
8028 Self-link to section should not be bold
8029 !! options
8030 title=[[Main Page]]
8031 !! wikitext
8032 [[Main Page#section]]
8033 !! html
8034 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
8035 </p>
8036 !! end
8037
8038 !! article
8039 00
8040 !! text
8041 This is 00.
8042 !! endarticle
8043
8044 !!test
8045 Self-link to numeric title
8046 !!options
8047 title=[[0]]
8048 !! wikitext
8049 [[0]]
8050 !! html
8051 <p><a class="mw-selflink selflink">0</a>
8052 </p>
8053 !!end
8054
8055 !!test
8056 Link to numeric-equivalent title
8057 !!options
8058 title=[[0]]
8059 !! wikitext
8060 [[00]]
8061 !! html
8062 <p><a href="/wiki/00" title="00">00</a>
8063 </p>
8064 !!end
8065
8066 !! test
8067 <nowiki> inside a link
8068 !! wikitext
8069 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
8070 !! html
8071 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
8072 </p>
8073 !! end
8074
8075 !! test
8076 Non-breaking spaces in title
8077 !! wikitext
8078 [[&nbsp; Main &nbsp; Page &nbsp;]]
8079 !! html
8080 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
8081 </p>
8082 !!end
8083
8084 !! test
8085 Internal link with ca linktrail, surrounded by bold apostrophes (T29473 primary issue)
8086 !! options
8087 language=ca
8088 !! wikitext
8089 '''[[Main Page]]'''
8090 !! html
8091 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
8092 </p>
8093 !! end
8094
8095 !! test
8096 Internal link with ca linktrail, surrounded by italic apostrophes (T29473 primary issue)
8097 !! options
8098 language=ca
8099 !! wikitext
8100 ''[[Main Page]]''
8101 !! html
8102 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
8103 </p>
8104 !! end
8105
8106 !! test
8107 Internal link with en linktrail: no apostrophes (T29473)
8108 !! options
8109 language=en
8110 !! wikitext
8111 [[Something]]'nice
8112 !! html
8113 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
8114 </p>
8115 !! end
8116
8117 !! test
8118 Internal link with ca linktrail with apostrophes (T29473)
8119 !! options
8120 language=ca
8121 !! wikitext
8122 [[Something]]'nice
8123 !! html
8124 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
8125 </p>
8126 !! end
8127
8128 !! test
8129 Internal link with kaa linktrail with apostrophes (T29473)
8130 !! options
8131 language=kaa
8132 !! wikitext
8133 [[Something]]'nice
8134 !! html
8135 <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>
8136 </p>
8137 !! end
8138
8139 !! test
8140 Link with multiple ":" in a subpage-supporting namespace (T65636)
8141 !! wikitext
8142 [[User:Foo/Test/63636:Bar|Test]]
8143 !! html/php
8144 <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>
8145 </p>
8146 !! html/parsoid
8147 <p><a rel="mw:WikiLink" href="./User:Foo/Test/63636:Bar" title="User:Foo/Test/63636:Bar">Test</a></p>
8148 !! end
8149
8150 ## Mainly a sanity check for Parsoid
8151 !! test
8152 Handle title parsing for subpages
8153 !! options
8154 title=[[/123123]]
8155 subpage
8156 !! wikitext
8157 123
8158 !! html/php
8159 <p>123
8160 </p>
8161 !! html/parsoid
8162 <p>123</p>
8163 !! end
8164
8165 !! article
8166 User:Test/123
8167 !! text
8168 test 123
8169 !! endarticle
8170
8171 !! test
8172 Link to a subpage from a namespace other than main
8173 !! options
8174 title=[[User:Test]]
8175 subpage
8176 !! wikitext
8177 [[/123]]
8178 !! html/php
8179 <p><a href="/wiki/User:Test/123" title="User:Test/123">/123</a>
8180 </p>
8181 !! html/parsoid
8182 <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>
8183 !! end
8184
8185 !! test
8186 Ensure that transclusion titles are not url-decoded
8187 !! options
8188 subpage title=[[Test]]
8189 parsoid=wt2html
8190 !! wikitext
8191 {{Bar%C3%A9}} {{/Bar%C3%A9}}
8192 !! html/php
8193 <p>{{Bar%C3%A9}} {{/Bar%C3%A9}}
8194 </p>
8195 !! html/parsoid
8196 <p>{{Bar%C3%A9}} {{/Bar%C3%A9}}</p>
8197 !! end
8198
8199 !! test
8200 Purely hash wikilink
8201 !! options
8202 title=[[User:Test/123]]
8203 subpage
8204 !! wikitext
8205 [[#a|b]]
8206 !! html/php
8207 <p><a href="#a">b</a>
8208 </p>
8209 !! html/parsoid
8210 <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>
8211 !! end
8212
8213 !! test
8214 1. Interaction of linktrail and template encapsulation
8215 !! wikitext
8216 {{echo|[[Foo]]}}l
8217 !! html/parsoid
8218 <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>
8219 !! end
8220
8221 !! test
8222 2. Interaction of linktrail and template encapsulation
8223 !! options
8224 parsoid
8225 !! wikitext
8226 {{echo|Some [[Fool]]}}s
8227 !! html
8228 <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>
8229 !! end
8230
8231 !! test
8232 3. Interaction of linktrail and template encapsulation
8233 !! options
8234 parsoid
8235 !! wikitext
8236 {{echo|Some [[Fool]]s are '''bold and foolish'''}}
8237 !! html
8238 <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>
8239 !! end
8240
8241 !! article
8242 Söfnuður
8243 !! text
8244 Test.
8245 !! endarticle
8246
8247 !! test
8248 Internal link with is link prefix
8249 !! options
8250 language=is
8251 !! wikitext
8252 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
8253 !! html
8254 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
8255 </p>
8256 !! end
8257
8258 !! article
8259 Mótmælendatrú
8260 !! text
8261 Test.
8262 !! endarticle
8263
8264 !! test
8265 Internal link with is link trail and link prefix
8266 !! options
8267 language=is
8268 !! wikitext
8269 [[mótmælendatrú|xxx]]ar
8270 [[mótmælendatrú]]ar
8271 mótmælenda[[söfnuður]]
8272 mótmælenda[[söfnuður|söfnuðir]]
8273 mótmælenda[[söfnuður|söfnuðir]]xxx
8274 !! html
8275 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
8276 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
8277 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
8278 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
8279 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
8280 </p>
8281 !! end
8282
8283 !! test
8284 Parsoid link trail escaping
8285 !! options
8286 parsoid=html2wt,html2html
8287 !! html/parsoid
8288 <p><a rel="mw:WikiLink" href="./Apple" title="Apple">apple</a>s</p>
8289 !! wikitext
8290 [[apple]]<nowiki/>s
8291 !! end
8292
8293 !! test
8294 Parsoid link prefix escaping
8295 !! options
8296 language=is
8297 parsoid=html2wt,html2html
8298 !! html/parsoid
8299 <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="./Söfnuður" title="Söfnuður">söfnuður</a></p>
8300 !! wikitext
8301 Aðrir mótmælenda<nowiki/>[[söfnuður]]
8302 !! end
8303
8304 !! test
8305 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
8306 !! wikitext
8307 [[Foo| bar]]
8308
8309 [[Foo| ''bar'']]
8310
8311 [http://wp.org foo]
8312
8313 [http://wp.org ''foo'']
8314 !! html
8315 <p><a href="/wiki/Foo" title="Foo"> bar</a>
8316 </p><p><a href="/wiki/Foo" title="Foo"> <i>bar</i></a>
8317 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
8318 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
8319 </p>
8320 !! end
8321
8322 !! test
8323 Parsoid: Scoped parsing should handle mixed transclusions and plain text
8324 !! wikitext
8325 [[Foo|{{echo|a}} b {{echo|c}}]]
8326 !! html/parsoid
8327 <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>
8328 !! end
8329
8330 !! test
8331 Link with angle bracket after anchor
8332 !! wikitext
8333 [[Foo#<bar>]]
8334 !! html/php
8335 <p><a href="/wiki/Foo#.3Cbar.3E" title="Foo">Foo#&lt;bar&gt;</a>
8336 </p>
8337 !! html/parsoid
8338 <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>
8339 !! end
8340
8341 ###
8342 ### Interwiki links (see maintenance/interwiki.sql)
8343 ###
8344
8345 !! test
8346 Inline interwiki link
8347 !! options
8348 parsoid=wt2html,wt2wt,html2html
8349 !! wikitext
8350 [[MeatBall:SoftSecurity]]
8351 !! html/php
8352 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
8353 </p>
8354 !! html/parsoid
8355 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a></p>
8356 !! end
8357
8358 !! test
8359 Inline interwiki link with empty title (T4372)
8360 !! options
8361 parsoid=wt2html,wt2wt,html2html
8362 !! wikitext
8363 [[MeatBall:]]
8364 !! html/php
8365 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
8366 </p>
8367 !! html/parsoid
8368 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?" title="meatball:">MeatBall:</a></p>
8369 !! end
8370
8371 !! test
8372 Interwiki link encoding conversion (T3636)
8373 !! wikitext
8374 *[[Wikipedia:ro:Olteni&#0355;a]]
8375 *[[Wikipedia:ro:Olteni&#355;a]]
8376 !! html
8377 <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>
8378 <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>
8379
8380 !! html+tidy
8381 <ul>
8382 <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>
8383 <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>
8384 </ul>
8385 !! end
8386
8387 !! test
8388 Interwiki link with fragment (T4130)
8389 !! wikitext
8390 [[MeatBall:SoftSecurity#foo]]
8391 !! html
8392 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
8393 </p>
8394 !! end
8395
8396 !! test
8397 Link scenarios with escaped fragments
8398 !! wikitext
8399 [[#Is this great?]]
8400 [[Foo#Is this great?]]
8401 [[meatball:Foo#Is this great?]]
8402 !! html/php
8403 <p><a href="#Is_this_great.3F">#Is this great?</a>
8404 <a href="/wiki/Foo#Is_this_great.3F" title="Foo">Foo#Is this great?</a>
8405 <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>
8406 </p>
8407 !! html/parsoid
8408 <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>
8409 <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>
8410 <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>
8411 !! end
8412
8413 # Ideally the wikipedia: prefix here should be proto-relative too
8414 # [CSA]: this is kind of a bogus test, as the PHP parser test doesn't
8415 # define the 'en' prefix, and originally the test used 'wikipedia',
8416 # which isn't a localinterwiki prefix hence the links to the 'en:Foo'
8417 # article.
8418 !! test
8419 Different interwiki prefixes mapping to the same URL
8420 !! wikitext
8421 [[:en:Foo]]
8422
8423 [[:en:Foo|Foo]]
8424
8425 [[wikipedia:Foo]]
8426
8427 [[:wikipedia:Foo|Foo]]
8428
8429 [[wikipedia:en:Foo]]
8430
8431 [[:wikipedia:en:Foo]]
8432
8433 [[ wikiPEdia :Foo]]
8434 !! html/parsoid
8435 <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>
8436
8437 <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>
8438
8439 <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>
8440
8441 <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>
8442
8443 <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>
8444
8445 <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>
8446
8447 <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>
8448 !! end
8449
8450 !! test
8451 Interwiki links that cannot be represented in wiki syntax
8452 !! wikitext
8453 [[meatball:ok]]
8454 [[meatball:ok#foo|ok with fragment]]
8455 [[meatball:ok_as_well?|ok ending with ? mark]]
8456 [http://de.wikipedia.org/wiki/Foo?action=history has query]
8457 [http://de.wikipedia.org/wiki/#foo is just fragment]
8458
8459 !! html/php
8460 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?ok" class="extiw" title="meatball:ok">meatball:ok</a>
8461 <a href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" class="extiw" title="meatball:ok">ok with fragment</a>
8462 <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>
8463 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
8464 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a>
8465 </p>
8466 !! html/parsoid
8467 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok" title="meatball:ok">meatball:ok</a>
8468 <a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" title="meatball:ok">ok with fragment</a>
8469 <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>
8470 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
8471 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a></p>
8472 !! end
8473
8474 !! test
8475 Interwiki links: trail
8476 !! wikitext
8477 [[wikipedia:Foo|Ba]]r
8478 !! html/php
8479 <p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
8480 </p>
8481 !! html/parsoid
8482 <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>
8483 !! end
8484
8485 !! test
8486 Local interwiki link
8487 !! options
8488 parsoid=wt2html,wt2wt,html2html
8489 !! wikitext
8490 [[local:Template:Foo]]
8491 !! html/php
8492 <p><a href="/wiki/Template:Foo" title="Template:Foo">local:Template:Foo</a>
8493 </p>
8494 !! html/parsoid
8495 <p><a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">local:Template:Foo</a></p>
8496 !! end
8497
8498 # Parsoid does not mark self-links, by design.
8499 !! test
8500 Local interwiki link: self-link to current page
8501 !! options
8502 title=[[Main Page]]
8503 parsoid=wt2html,wt2wt,html2html
8504 !! wikitext
8505 [[local:Main Page]]
8506 !! html/php
8507 <p><a class="mw-selflink selflink">local:Main Page</a>
8508 </p>
8509 !! html/parsoid
8510 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:Main Page</a></p>
8511 !! end
8512
8513 !! test
8514 Local interwiki link: prefix only (T66167)
8515 !! options
8516 parsoid=wt2html,wt2wt,html2html
8517 !! wikitext
8518 [[local:]]
8519 !! html/php
8520 <p><a href="/wiki/Main_Page" title="Main Page">local:</a>
8521 </p>
8522 !! html/parsoid
8523 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:</a></p>
8524 !! end
8525
8526 !! test
8527 Local interwiki link: with additional interwiki prefix (T63357)
8528 !! options
8529 parsoid=wt2html,wt2wt,html2html
8530 !! wikitext
8531 [[local:meatball:Hello]]
8532 !! html/php
8533 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?Hello" class="extiw" title="meatball:Hello">local:meatball:Hello</a>
8534 </p>
8535 !! html/parsoid
8536 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?Hello" title="meatball:Hello">local:meatball:Hello</a></p>
8537 !! end
8538
8539 !! test
8540 Multiple local interwiki link prefixes
8541 !! wikitext
8542 [[local:local:local:local:mi:local:Foo]]
8543 !! options
8544 parsoid=wt2html,wt2wt,html2html
8545 !! html/php
8546 <p><a href="/wiki/Foo" title="Foo">local:local:local:local:mi:local:Foo</a>
8547 </p>
8548 !! html/parsoid
8549 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">local:local:local:local:mi:local:Foo</a></p>
8550 !! end
8551
8552 ###
8553 ### Interlanguage links
8554 ### Language links (so that searching for '### language' matches..)
8555 ###
8556
8557 !! test
8558 Interlanguage link
8559 !! wikitext
8560 Blah blah blah
8561 [[zh:Chinese]]
8562 !! html/php
8563 <p>Blah blah blah
8564 </p>
8565 !! html/parsoid
8566 <p>Blah blah blah</p>
8567 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8568 !! end
8569
8570 ## parsoid html2wt will lose the space variations
8571 !! test
8572 Interlanguage link with spacing
8573 !! options
8574 parsoid=wt2html,wt2wt,html2html
8575 !! wikitext
8576 Blah blah blah
8577 [[ zh : Chinese ]]
8578 !! html/php
8579 <p>Blah blah blah
8580 </p>
8581 !! html/parsoid
8582 <p>Blah blah blah</p>
8583 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8584 !! end
8585
8586 !! test
8587 Double interlanguage link
8588 !! wikitext
8589 Blah blah blah
8590 [[es:Spanish]]
8591 [[zh:Chinese]]
8592 !! html/php
8593 <p>Blah blah blah
8594 </p>
8595 !! html/parsoid
8596 <p>Blah blah blah</p>
8597 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
8598 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8599 !! end
8600
8601 ## parsoid html2wt will lose the space variations
8602 !! test
8603 Interlanguage link variations
8604 !! options
8605 parsoid=wt2html,wt2wt,html2html
8606 !! wikitext
8607 Blah blah blah
8608 [[ es :Spanish]]
8609 [[ ZH :Chinese]]
8610 [[es:Foo_bar]]
8611 !! html/php
8612 <p>Blah blah blah
8613 </p>
8614 !! html/parsoid
8615 <p>Blah blah blah</p>
8616 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish" />
8617 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese" />
8618 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar" />
8619 !! end
8620
8621 !! test
8622 Escaping of interlanguage links (T129218, T156308)
8623 !! wikitext
8624 Blah blah blah
8625 [[:es:Spanish]]
8626 [[ : zh : Chinese ]]
8627 !! html/php
8628 <p>Blah blah blah
8629 <a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">es:Spanish</a>
8630 <a href="http://zh.wikipedia.org/wiki/Chinese" class="extiw" title="zh:Chinese"> zh : Chinese </a>
8631 </p>
8632 !! html/parsoid
8633 <p>Blah blah blah
8634 <a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">es:Spanish</a>
8635 <a rel="mw:ExtLink" href="http://zh.wikipedia.org/wiki/Chinese" title="zh:Chinese"> zh : Chinese </a></p>
8636 !! end
8637
8638 ## parsoid html2wt will normalize the space to _
8639 !! test
8640 Space and question mark encoding in interlanguage links (T95473)
8641 !! options
8642 parsoid=wt2html,wt2wt,html2html
8643 !! wikitext
8644 Blah blah blah
8645 [[es:Foo bar?]]
8646 !! html/php
8647 <p>Blah blah blah
8648 </p>
8649 !! html/parsoid
8650 <p>Blah blah blah</p>
8651 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar%3F" />
8652 !! end
8653
8654 !! test
8655 Interlanguage link, with prefix links
8656 !! options
8657 language=ln
8658 !! wikitext
8659 Blah blah blah
8660 [[zh:Chinese]]
8661 !! html/php
8662 <p>Blah blah blah
8663 </p>
8664 !! html/parsoid
8665 <p>Blah blah blah</p>
8666 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8667 !! end
8668
8669 !! test
8670 Double interlanguage link, with prefix links (T10897)
8671 !! options
8672 language=ln
8673 !! wikitext
8674 Blah blah blah
8675 [[es:Spanish]]
8676 [[zh:Chinese]]
8677 !! html/php
8678 <p>Blah blah blah
8679 </p>
8680 !! html/parsoid
8681 <p>Blah blah blah</p>
8682 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
8683 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8684 !! end
8685
8686 !! test
8687 "Extra" interlanguage links (T34189 / gerrit 111390)
8688 !! wikitext
8689 Blah blah blah
8690 [[mul:Article]]
8691 !! html/php
8692 <p>Blah blah blah
8693 </p>
8694 !! html/parsoid
8695 <p>Blah blah blah</p>
8696 <link rel="mw:PageProp/Language" title="Multilingual" href="http://wikisource.org/wiki/Article"/>
8697 !! end
8698
8699 ## PHP parser tests script needs an update
8700 ## Parsoid html2wt will normalize output to [[:zh:Chinese]]
8701 !! test
8702 Language links render as inline links if $wgInterwikiMagic=false
8703 !! options
8704 wgInterwikiMagic=false
8705 parsoid=wt2html,wt2wt,html2html
8706 !! wikitext
8707 Blah blah blah
8708 [[zh:Chinese]]
8709 !! html/parsoid
8710 <p>Blah blah blah <a rel="mw:ExtLink" href="http://zh.wikipedia.org/wiki/Chinese" title="zh:Chinese">zh:Chinese</a></p>
8711 !! end
8712
8713 ## PHP parser tests script needs an update
8714 ## Parsoid html2wt will normalize output to [[:zh:Chinese]]
8715 !! test
8716 Language links render as inline links in the Talk namespace
8717 !! options
8718 title=Talk:Foo
8719 parsoid=wt2html,wt2wt,html2html
8720 !! wikitext
8721 Blah blah blah
8722 [[zh:Chinese]]
8723 !! html/parsoid
8724 <p>Blah blah blah <a rel="mw:ExtLink" href="http://zh.wikipedia.org/wiki/Chinese" title="zh:Chinese">zh:Chinese</a></p>
8725 !! end
8726
8727 !! test
8728 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
8729 !! options
8730 language=ln
8731 !! wikitext
8732 [[WW&nbsp;II]]
8733 !! html
8734 <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>
8735 </p>
8736 !! end
8737
8738 !! test
8739 Parsoid T55221: Wikilinks should be properly entity-escaped
8740 !! options
8741 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
8742 !! html/parsoid
8743 <p>He&amp;nbsp;llo <a href="./Foo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
8744 <p>He&amp;nbsp;llo <a href="./He&amp;nbsp;llo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
8745 !! wikitext
8746 He&amp;nbsp;llo [[Foo|He&amp;nbsp;llo]]
8747
8748 He&amp;nbsp;llo He&amp;nbsp;llo
8749 !! html/php
8750 <p>He&amp;nbsp;llo <a href="/wiki/Foo" title="Foo">He&amp;nbsp;llo</a>
8751 </p><p>He&amp;nbsp;llo He&amp;nbsp;llo
8752 </p>
8753 !! end
8754
8755 # html2wt will fail because of title normalization without data-parsoid
8756 !! test
8757 Parsoid: handle constructor well
8758 !! options
8759 parsoid=wt2html,wt2wt
8760 !! wikitext
8761 [[constructor]]
8762
8763 [[constructor:foo]]
8764 !! html/php
8765 <p><a href="/index.php?title=Constructor&amp;action=edit&amp;redlink=1" class="new" title="Constructor (page does not exist)">constructor</a>
8766 </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>
8767 </p>
8768 !! html/parsoid
8769 <p><a rel="mw:WikiLink" href="./Constructor" title="Constructor" data-parsoid='{"stx":"simple","a":{"href":"./Constructor"},"sa":{"href":"constructor"}}'>constructor</a></p>
8770
8771 <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>
8772 !! end
8773
8774 !! article
8775 ko:
8776 !! text
8777 Test.
8778 !! endarticle
8779
8780 # Note that `ko` isn't a known interlanguage prefix
8781 !! test
8782 Parsoid: recognize interlanguage links without a target page
8783 !! options
8784 ill
8785 !! wikitext
8786 [[es:]]
8787
8788 [[ko:]]
8789 !! html/php
8790 es:
8791 !! html/parsoid
8792 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/"/>
8793
8794 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
8795 !! end
8796
8797 # Note that `ko` isn't a known interwiki prefix
8798 !! test
8799 Parsoid: recognize interwiki links without a target page
8800 !! options
8801 parsoid=wt2html,wt2wt,html2html
8802 !! wikitext
8803 [[:es:]]
8804
8805 [[:ko:]]
8806 !! html/php
8807 <p><a href="http://es.wikipedia.org/wiki/" class="extiw" title="es:">es:</a>
8808 </p><p><a href="/wiki/Ko:" title="Ko:">ko:</a>
8809 </p>
8810 !! html/parsoid
8811 <p><a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/" title="es:">es:</a></p>
8812 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
8813 !! end
8814
8815 !! test
8816 Handle interwiki links pointing to the current wiki as plain wiki links (T47209)
8817 !! wikitext
8818 [[mi:Foo]]
8819 !! html/php
8820 <p><a href="/wiki/Foo" title="Foo">mi:Foo</a>
8821 </p>
8822 !! html/parsoid
8823 <p><a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo"},"sa":{"href":"mi:Foo"}}'>mi:Foo</a></p>
8824 !! end
8825
8826 !! test
8827 Interlanguage link with preceding local interwiki link (T70085)
8828 !! options
8829 parsoid=wt2html,wt2wt,html2html
8830 !! wikitext
8831 Blah blah blah
8832 [[local:es:Spanish]]
8833 !! html/php
8834 <p>Blah blah blah
8835 <a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">local:es:Spanish</a>
8836 </p>
8837 !! html/parsoid
8838 <p>Blah blah blah
8839 <a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">local:es:Spanish</a></p>
8840 !! end
8841
8842 !! test
8843 Looks like an interlanguage link, but is actually a local interwiki
8844 !! options
8845 parsoid=wt2html,wt2wt,html2html
8846 !! wikitext
8847 Blah blah blah
8848 [[mi:Template:Foo]]
8849 !! html/php
8850 <p>Blah blah blah
8851 <a href="/wiki/Template:Foo" title="Template:Foo">mi:Template:Foo</a>
8852 </p>
8853 !! html/parsoid
8854 <p>Blah blah blah
8855 <a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">mi:Template:Foo</a></p>
8856 !! end
8857
8858 ###
8859 ### Redirects, Parsoid-only
8860 ###
8861
8862 !! test
8863 1. Simple redirect to page
8864 !! wikitext
8865 #REDIRECT [[Main Page]]
8866 !! html/parsoid
8867 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8868 !! end
8869
8870 !! test
8871 2. Other redirect variants
8872 !! wikitext
8873 #REDIRECT [[Main_Page]]
8874 !! html/parsoid
8875 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Main_Page"},"sa":{"href":"Main_Page"}}'/>
8876 !! end
8877
8878 # Not a valid redirect in PHP (although perhaps it was, once upon a time)
8879 # This tests the Parsoid bail-out code.
8880 !! test
8881 3. Other redirect variants
8882 !! wikitext
8883 #REDIRECT [[<nowiki>[[Bar]]</nowiki>]]
8884 !! html/parsoid
8885 <ol><li data-parsoid>REDIRECT [[[[Bar]]]]</li></ol>
8886 !! end
8887
8888 !! test
8889 4. Redirect to a templated destination
8890 !! wikitext
8891 #REDIRECT [[{{echo|Foo}}bar]]
8892 !! html/parsoid
8893 <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"}]]}'/>
8894 !! end
8895
8896 !! test
8897 Empty redirect
8898 !! options
8899 parsoid=wt2html,wt2wt
8900 !! wikitext
8901 #REDIRECT [[]]
8902 !! html/parsoid
8903 <ol>
8904 <li>REDIRECT [[]]</li></ol>
8905 !! end
8906
8907 !! test
8908 Optional colon in #REDIRECT
8909 !! options
8910 # the colon is archaic syntax. we support it for wt2html, but we
8911 # don't care that it roundtrips back to the modern syntax.
8912 parsoid=wt2html,html2html
8913 !! wikitext
8914 #REDIRECT:[[Main Page]]
8915 !! html/parsoid
8916 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8917 !! end
8918
8919 !! test
8920 Whitespace in #REDIRECT with optional colon
8921 !! options
8922 # the colon and gratuitous whitespace is archaic syntax. we support
8923 # it for wt2html, but we don't care that it roundtrips back to the
8924 # modern syntax (without extra whitespace)
8925 parsoid=wt2html,html2html
8926 !! wikitext
8927
8928 #REDIRECT
8929 :
8930 [[Main Page]]
8931 !! html/parsoid
8932 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8933 !! end
8934
8935 !! test
8936 Piped link in #REDIRECT
8937 !! options
8938 # content after piped link is ignored. we support this syntax,
8939 # but don't care that the piped link is lost when we roundtrip this.
8940 parsoid=wt2html
8941 !! wikitext
8942 #REDIRECT [[Main Page|bar]]
8943 !! html/parsoid
8944 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8945 !! end
8946
8947 !! test
8948 Redirect to category (T104502)
8949 !! options
8950 parsoid=wt2html,wt2wt
8951 !! wikitext
8952 #REDIRECT [[Category:Foo]]
8953 !! html/parsoid
8954 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8955 !! end
8956
8957 !! test
8958 Redirect to category with URL encoding (T104502)
8959 !! options
8960 parsoid=wt2html
8961 !! wikitext
8962 #REDIRECT [[Category%3AFoo]]
8963 !! html/parsoid
8964 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8965 !! end
8966
8967 !! test
8968 Redirect to category page
8969 !! wikitext
8970 #REDIRECT [[:Category:Foo]]
8971 !! html/parsoid
8972 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8973 !! end
8974
8975 !! test
8976 Redirect to image page (1)
8977 !! wikitext
8978 #REDIRECT [[File:Wiki.png]]
8979 !! html/parsoid
8980 <link rel="mw:PageProp/redirect" href="./File:Wiki.png"/>
8981 !! end
8982
8983 !! test
8984 Redirect to image page (2)
8985 !! wikitext
8986 #REDIRECT [[Image:Wiki.png]]
8987 !! html/parsoid
8988 <link rel="mw:PageProp/redirect" href="./File:Wiki.png" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./File:Wiki.png"},"sa":{"href":"Image:Wiki.png"}}'/>
8989 !! end
8990
8991 # html2wt disabled because wts serializes as "#REDIRECT [[:en:File:Wiki.png]]"
8992 # Next test confirms this.
8993 !! test
8994 Redirect to language (1) (T104918)
8995 !! options
8996 parsoid=wt2html,wt2wt,html2html
8997 !! wikitext
8998 #REDIRECT [[en:File:Wiki.png]]
8999 !! html/parsoid
9000 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
9001 !! end
9002
9003 !! test
9004 Redirect to language (2) (T104918)
9005 !! wikitext
9006 #REDIRECT [[:en:File:Wiki.png]]
9007 !! html/parsoid
9008 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
9009 !! end
9010
9011 !! test
9012 Redirect to interwiki (T104918)
9013 !! wikitext
9014 #REDIRECT [[meatball:File:Wiki.png]]
9015 !! html/parsoid
9016 <link rel="mw:PageProp/redirect" href="http://www.usemod.com/cgi-bin/mb.pl?File:Wiki.png"/>
9017 !! end
9018
9019 !! test
9020 Non-English #REDIRECT
9021 !! options
9022 language=is
9023 !! wikitext
9024 #TILVÍSUN [[Main Page]]
9025 !! html/parsoid
9026 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#TILVÍSUN ","a":{"href":"./Main_Page"},"sa":{"href":"Main Page"}}'/>
9027 !! end
9028
9029 !! test
9030 Redirect syntax under text isn't considered a redirect
9031 !! wikitext
9032 some text
9033 #redirect [[Main Page]]
9034 !! html/parsoid
9035 <p>some text</p>
9036 <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>
9037 !! end
9038
9039 # FIXME: Should hoist the redirect to the top of the page and ensure there
9040 # is only one.
9041 !! test
9042 New redirect
9043 !! options
9044 parsoid=html2wt
9045 !! html/parsoid
9046 <p>Foo<link rel="mw:PageProp/redirect" href="./Foo"/></p>
9047 !! wikitext
9048 Foo
9049 #REDIRECT [[Foo]]
9050 !! end
9051
9052 ##
9053 ## XHTML tidiness
9054 ###
9055
9056 !! test
9057 <br> to <br />
9058 !! wikitext
9059 1<br>2<br />3
9060 !! html
9061 <p>1<br />2<br />3
9062 </p>
9063 !! end
9064
9065 !! test
9066 Broken br tag sanitization
9067 !! wikitext
9068 </br>
9069 !! html/php
9070 <p>&lt;/br&gt;
9071 </p>
9072 !! end
9073
9074 # TODO: Fix html2html mode (T53055)!
9075 !! test
9076 Parsoid: Broken br tag recognition
9077 !! options
9078 parsoid=wt2html
9079 !! wikitext
9080 </br>
9081
9082 <br/ >
9083 !! html+tidy
9084 <p><br /></p>
9085 <p><br /></p>
9086 !! end
9087
9088 !! test
9089 Incorrecly removing closing slashes from correctly formed XHTML
9090 !! wikitext
9091 <br style="clear:both;" />
9092 !! html
9093 <p><br style="clear:both;" />
9094 </p>
9095 !! end
9096
9097 !! test
9098 Failing to transform badly formed HTML into correct XHTML
9099 !! wikitext
9100 <br style="clear: left;">
9101 <br style="clear: right;">
9102 <br style="clear: both;">
9103 !! html
9104 <p><br style="clear: left;" />
9105 <br style="clear: right;" />
9106 <br style="clear: both;" />
9107 </p>
9108 !!end
9109
9110 ## FIXME: Is Parsoid's acceptance of self-closing html-tags
9111 ## a feature or a bug? See https://phabricator.wikimedia.org/T76962
9112 !! test
9113 Handling html with a div self-closing tag
9114 !! wikitext
9115 <div title />
9116 <div title/>
9117 <div title/ >
9118 <div title=bar />
9119 <div title=bar/>
9120 <div title=bar/ >
9121 !! html/php
9122 <p>&lt;div title /&gt;
9123 &lt;div title/&gt;
9124 </p>
9125 <div>
9126 <p>&lt;div title=bar /&gt;
9127 &lt;div title=bar/&gt;
9128 </p>
9129 <div title="bar/"></div>
9130 </div>
9131
9132 !! html/parsoid
9133 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
9134 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
9135 <div title="" data-parsoid='{"stx":"html","selfClose":true,"brokenHTMLTag":true}'></div>
9136 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
9137 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
9138 <div title="bar/" data-parsoid='{"stx":"html","autoInsertedEnd":true}'></div>
9139 !! end
9140
9141 !! test
9142 Handling html with a br self-closing tag
9143 !! wikitext
9144 <br title />
9145 <br title/>
9146 <br title/ >
9147 <br title=bar />
9148 <br title=bar/>
9149 <br title=bar/ >
9150 !! html/php
9151 <p><br title="" />
9152 <br title="" />
9153 <br />
9154 <br title="bar" />
9155 <br title="bar" />
9156 <br title="bar/" />
9157 </p>
9158 !! html/parsoid
9159 <p><br title="" />
9160 <br title="" />
9161 <br title="" />
9162 <br title="bar" />
9163 <br title="bar" />
9164 <br title="bar/" />
9165 </p>
9166 !! end
9167
9168 !! test
9169 Horizontal ruler (should it add that extra space?)
9170 !! wikitext
9171 <hr>
9172 <hr >
9173 foo <hr
9174 > bar
9175 !! html+tidy
9176 <hr />
9177 <hr />
9178 <p>foo</p>
9179 <hr />
9180 <p>bar</p>
9181 !! end
9182
9183 !! test
9184 Horizontal ruler -- 4+ dashes render hr
9185 !! wikitext
9186 ----
9187 !! html
9188 <hr />
9189
9190 !! end
9191
9192 !! test
9193 Horizontal ruler -- eats additional dashes on the same line
9194 !! wikitext
9195 ---------
9196 !! html
9197 <hr />
9198
9199 !! end
9200
9201 !! test
9202 Horizontal ruler -- does not collapse dashes on consecutive lines
9203 !! wikitext
9204 ----
9205 ----
9206 !! html
9207 <hr />
9208 <hr />
9209
9210 !! end
9211
9212 !! test
9213 Horizontal ruler -- <4 dashes render as plain text
9214 !! wikitext
9215 ---
9216 !! html
9217 <p>---
9218 </p>
9219 !! end
9220
9221 !! test
9222 Horizontal ruler -- Supports content following dashes on same line
9223 !! wikitext
9224 ---- Foo
9225 !! html
9226 <hr /> Foo
9227
9228 !! html+tidy
9229 <hr />
9230 <p>Foo</p>
9231 !! end
9232
9233 ###
9234 ### Block-level elements
9235 ###
9236 !! test
9237 Common list
9238 !! wikitext
9239 *Common list
9240 * item 2
9241 *item 3
9242 !! html
9243 <ul><li>Common list</li>
9244 <li> item 2</li>
9245 <li>item 3</li></ul>
9246
9247 !! end
9248
9249 !! test
9250 Numbered list
9251 !! wikitext
9252 #Numbered list
9253 #item 2
9254 # item 3
9255 !! html
9256 <ol><li>Numbered list</li>
9257 <li>item 2</li>
9258 <li> item 3</li></ol>
9259
9260 !! end
9261
9262 !! test
9263 Mixed list
9264 !! wikitext
9265 *Mixed list
9266 *# with numbers
9267 ** and bullets
9268 *# and numbers
9269 *bullets again
9270 **bullet level 2
9271 ***bullet level 3
9272 ***#Number on level 4
9273 **bullet level 2
9274 **#Number on level 3
9275 **#Number on level 3
9276 *#number level 2
9277 *Level 1
9278 *** Level 3
9279 #** Level 3, but ordered
9280 !! html
9281 <ul><li>Mixed list
9282 <ol><li> with numbers</li></ol>
9283 <ul><li> and bullets</li></ul>
9284 <ol><li> and numbers</li></ol></li>
9285 <li>bullets again
9286 <ul><li>bullet level 2
9287 <ul><li>bullet level 3
9288 <ol><li>Number on level 4</li></ol></li></ul></li>
9289 <li>bullet level 2
9290 <ol><li>Number on level 3</li>
9291 <li>Number on level 3</li></ol></li></ul>
9292 <ol><li>number level 2</li></ol></li>
9293 <li>Level 1
9294 <ul><li><ul><li> Level 3</li></ul></li></ul></li></ul>
9295 <ol><li><ul><li><ul><li> Level 3, but ordered</li></ul></li></ul></li></ol>
9296
9297 !! end
9298
9299 !! test
9300 1. Nested mixed wikitext and html list
9301 !! wikitext
9302 * hi
9303 * <ul><li>ho</li></ul>
9304 * hi
9305 ** ho
9306 !! html/php
9307 <ul><li> hi</li>
9308 <li> <ul><li>ho</li></ul></li>
9309 <li> hi
9310 <ul><li> ho</li></ul></li></ul>
9311
9312 !! html/parsoid
9313 <ul><li> hi</li>
9314 <li> <ul data-parsoid='{"stx":"html"}'><li data-parsoid='{"stx":"html"}'>ho</li></ul></li>
9315 <li> hi
9316 <ul><li> ho</li></ul></li></ul>
9317 !! end
9318
9319 !! test
9320 2. Nested mixed wikitext and html list (incompatible)
9321 !! wikitext
9322 ; hi
9323 : {{echo|<li>ho</li>}}
9324 !! html/php
9325 <dl><dt> hi</dt>
9326 <dd> <li>ho</li></dd></dl>
9327
9328 !! html/parsoid
9329 <dl><dt> hi</dt>
9330 <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>
9331 !! end
9332
9333 !! test
9334 Nested lists 1
9335 !! wikitext
9336 *foo
9337 **bar
9338 !! html
9339 <ul><li>foo
9340 <ul><li>bar</li></ul></li></ul>
9341
9342 !! end
9343
9344 !! test
9345 Nested lists 2
9346 !! wikitext
9347 **foo
9348 *bar
9349 !! html
9350 <ul><li><ul><li>foo</li></ul></li>
9351 <li>bar</li></ul>
9352
9353 !! end
9354
9355 !! test
9356 Nested lists 3 (first element empty)
9357 !! wikitext
9358 *
9359 **bar
9360 !! html
9361 <ul><li>
9362 <ul><li>bar</li></ul></li></ul>
9363
9364 !! end
9365
9366 !! test
9367 Nested lists 4 (first element empty)
9368 !! wikitext
9369 **
9370 *bar
9371 !! html
9372 <ul><li><ul><li></li></ul></li>
9373 <li>bar</li></ul>
9374
9375 !! end
9376
9377 !! test
9378 Nested lists 5 (both elements empty)
9379 !! wikitext
9380 **
9381 *
9382 !! html
9383 <ul><li><ul><li></li></ul></li>
9384 <li></li></ul>
9385
9386 !! end
9387
9388 !! test
9389 Nested lists 6 (both elements empty)
9390 !! wikitext
9391 *
9392 **
9393 !! html
9394 <ul><li>
9395 <ul><li></li></ul></li></ul>
9396
9397 !! end
9398
9399 !! test
9400 Nested lists 7 (skip initial nesting levels)
9401 !! wikitext
9402 *** foo
9403 !! html
9404 <ul><li><ul><li><ul><li> foo</li></ul></li></ul></li></ul>
9405
9406 !! end
9407
9408 !! test
9409 Nested lists 8 (multiple nesting transitions)
9410 !! wikitext
9411 * foo
9412 *** bar
9413 ** baz
9414 * boo
9415 !! html
9416 <ul><li> foo
9417 <ul><li><ul><li> bar</li></ul></li>
9418 <li> baz</li></ul></li>
9419 <li> boo</li></ul>
9420
9421 !! end
9422
9423 !! test
9424 Nested lists 9 (extension interaction)
9425 !! options
9426 parsoid
9427 !! wikitext
9428 *<references />
9429 !! html/parsoid
9430 <ul><li data-parsoid='{}'><ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-parsoid='{}' data-mw='{"name":"references","attrs":{}}'></ol></li></ul>
9431 !! end
9432
9433 !! test
9434 1. Lists with start-of-line-transparent tokens before bullets: Comments
9435 !! wikitext
9436 *foo
9437 *<!--cmt-->bar
9438 <!--cmt-->*baz
9439 !! html
9440 <ul><li>foo</li>
9441 <li>bar</li>
9442 <li>baz</li></ul>
9443
9444 !! end
9445
9446 !! test
9447 2. Lists with start-of-line-transparent tokens before bullets: Template close
9448 !! wikitext
9449 *foo {{echo|bar
9450 }}*baz
9451 !! html
9452 <ul><li>foo bar</li>
9453 <li>baz</li></ul>
9454
9455 !! end
9456
9457 !! test
9458 List items are not parsed correctly following a <pre> block (T2785)
9459 !! wikitext
9460 * <pre>foo</pre>
9461 * <pre>bar</pre>
9462 * zar
9463 !! html/php
9464 <ul><li> <pre>foo</pre></li>
9465 <li> <pre>bar</pre></li>
9466 <li> zar</li></ul>
9467
9468 !! html/parsoid
9469 <ul><li> <pre typeof="mw:Extension/pre" about="#mwt2" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"foo"}}'>foo</pre></li>
9470 <li> <pre typeof="mw:Extension/pre" about="#mwt4" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"bar"}}'>bar</pre></li>
9471 <li> zar</li></ul>
9472 !! end
9473
9474 !! test
9475 List items from template
9476 !! wikitext
9477
9478 {{inner list}}
9479 * item 2
9480
9481 * item 0
9482 {{inner list}}
9483 * item 2
9484
9485 * item 0
9486 * notSOL{{inner list}}
9487 * item 2
9488 !! html
9489 <ul><li> item 1</li>
9490 <li> item 2</li></ul>
9491 <ul><li> item 0</li>
9492 <li> item 1</li>
9493 <li> item 2</li></ul>
9494 <ul><li> item 0</li>
9495 <li> notSOL</li>
9496 <li> item 1</li>
9497 <li> item 2</li></ul>
9498
9499 !! end
9500
9501 !! test
9502 List interrupted by empty line or heading
9503 !! wikitext
9504 * foo
9505
9506 ** bar
9507 == A heading ==
9508 * Another list item
9509 !! html
9510 <ul><li> foo</li></ul>
9511 <ul><li><ul><li> bar</li></ul></li></ul>
9512 <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>
9513 <ul><li> Another list item</li></ul>
9514
9515 !!end
9516
9517 !!test
9518 Multiple list tags generated by templates
9519 !! wikitext
9520 {{echo|<li>}}a
9521 {{echo|<li>}}b
9522 {{echo|<li>}}c
9523 !! html
9524 <li>a
9525 <li>b
9526 <li>c</li>
9527 </li>
9528 </li>
9529
9530 !! html+tidy
9531 <ul>
9532 <li>a</li>
9533 <li>b</li>
9534 <li>c</li>
9535 </ul>
9536 !!end
9537
9538 !!test
9539 Single-comment whitespace lines dont break lists, and neither do multi-comment whitespace lines
9540 !! wikitext
9541 *a
9542 <!--This line will NOT split the list-->
9543 *b
9544 <!--This line will NOT split the list either-->
9545 *c
9546 <!--foo--> <!----> <!--This line NOT split the list either-->
9547 *d
9548 !! html
9549 <ul><li>a</li>
9550 <li>b</li>
9551 <li>c</li>
9552 <li>d</li></ul>
9553
9554 !!end
9555
9556 !!test
9557 Replacing whitespace with tabs still doesn't break the list (gerrit 78327)
9558 !! wikitext
9559 *a
9560 <!--This line will NOT split the list-->
9561 *b
9562 <!--This line will NOT split the list either-->
9563 *c
9564 <!--foo--> <!----> <!--This line NOT split the list
9565 either-->
9566 *d
9567 !! html
9568 <ul><li>a</li>
9569 <li>b</li>
9570 <li>c</li>
9571 <li>d</li></ul>
9572
9573 !!end
9574
9575 !!test
9576 Test the li-hack
9577 (The PHP parser relies on Tidy for the hack)
9578 !!options
9579 parsoid=wt2html,wt2wt
9580 !! wikitext
9581 * foo
9582 * <li>li-hack
9583 * {{echo|<li>templated li-hack}}
9584 * <!--foo--> <li> unsupported li-hack with preceding comments
9585
9586 <ul>
9587 <li><li>not a li-hack
9588 </li>
9589 </ul>
9590 !! html+tidy
9591 <ul>
9592 <li>foo</li>
9593 <li>li-hack</li>
9594 <li>templated li-hack</li>
9595 <li>unsupported li-hack with preceding comments</li>
9596 </ul>
9597 <ul>
9598 <li>not a li-hack</li>
9599 </ul>
9600 !!end
9601
9602 !! test
9603 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
9604 !! options
9605 parsoid
9606 !! wikitext
9607 # foo
9608 ## bar
9609 * foo
9610 ** bar
9611 : foo
9612 :: bar
9613 !! html
9614 <ol>
9615 <li> foo<ol>
9616 <li> bar</li>
9617 </ol></li>
9618 </ol><ul>
9619 <li> foo<ul>
9620 <li> bar</li>
9621 </ul></li>
9622 </ul><dl>
9623 <dd> foo<dl>
9624 <dd> bar</dd>
9625 </dl></dd>
9626 </dl>
9627 !! end
9628
9629 !! test
9630 Parsoid: Test of whitespace serialization with Templated bullets
9631 !! options
9632 parsoid
9633 !! wikitext
9634 * {{bullet}}
9635 !! html
9636 <ul>
9637 <li> </li><li about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"bullet","href":"./Template:Bullet"},"params":{},"i":0}}]}'> Bar</li>
9638 </ul>
9639 !! end
9640
9641 # ------------------------------------------------------------------------
9642 # The next set of tests are about Parsoid's ability to handle badly nested
9643 # tags (parse, minimize scope of fixup, and roundtrip back)
9644 # ------------------------------------------------------------------------
9645
9646 !! test
9647 Unbalanced closing block tags break a list
9648 (php parser relies on Tidy to fix up)
9649 !! wikitext
9650 <div>
9651 *a</div><div>
9652 *b</div>
9653 !! html+tidy
9654 <div>
9655 <ul>
9656 <li>a</li>
9657 </ul>
9658 </div>
9659 <div>
9660 <ul>
9661 <li>b</li>
9662 </ul>
9663 </div>
9664 !! end
9665
9666 # Parsoid fails this test, but it might be tricky to support properly.
9667 # See T70395.
9668 !! test
9669 Unbalanced closing non-block tags don't break a list
9670 (php parser relies on Tidy to fix up)
9671 !! wikitext
9672 <span>
9673 *a</span><span>
9674 *b</span>
9675 !! html/php+tidy
9676 <ul>
9677 <li><span>a</span></li>
9678 <li><span>b</span></li>
9679 </ul>
9680 !! html/parsoid
9681 <span>
9682 <ul>
9683 <li>a<span></span>
9684 </li>
9685 <li>b
9686 </li>
9687 </ul>
9688 </span>
9689 !! end
9690
9691 !! test
9692 Unclosed formatting tags that straddle lists are closed and reopened
9693 (php parser relies on Tidy to fix up)
9694 !! options
9695 parsoid=wt2html,wt2wt,html2html
9696 !! wikitext
9697 # <s> a
9698 # b </s>
9699 !! html/php+tidy
9700 <ol>
9701 <li><s>a</s></li>
9702 <li><s>b</s></li>
9703 </ol>
9704 !! html/parsoid
9705 <ol><li> <s> a</s></li>
9706 <li><s> b </s></li></ol>
9707 !! end
9708
9709 # See T70395.
9710 !!test
9711 1. List embedded in a formatting tag
9712 !! wikitext
9713 <small>
9714 * foo
9715 </small>
9716 !! html/php+tidy
9717 <ul>
9718 <li><small>foo</small></li>
9719 </ul>
9720 !! html/parsoid
9721 <small>
9722 <ul>
9723 <li> foo</li>
9724 </ul>
9725 </small>
9726 !!end
9727
9728 ## Ugly Parsoid output here
9729 ## Not sure what the right output is.
9730 !!test
9731 2. List embedded in a formatting tag
9732 !! wikitext
9733 <small>
9734 *a
9735 *b</small>
9736 !! html/php+tidy
9737 <ul>
9738 <li><small>a</small></li>
9739 <li><small>b</small></li>
9740 </ul>
9741 !! html/parsoid
9742 <small></small>
9743 <ul><small>
9744 <li>a</li>
9745 </small>
9746 <li><small>b</small></li>
9747 </ul>
9748 !!end
9749
9750 # Ugly Parsoid and PHP parser output here
9751 # Not sure if we want to make this a test!
9752 #
9753 ## !!test
9754 ## 3. Unclosed formatting tags in list elements
9755 ## !! wikitext
9756 ## *<small>a
9757 ## *<small>b
9758 ## !! html/php+tidy
9759 ## <ul>
9760 ## <li><small>a</small></li>
9761 ## <li><small><small>b</small></small></li>
9762 ## </ul>
9763 ## !! html/parsoid
9764 ## <ul>
9765 ## <li><small>a</small></li>
9766 ## <small>
9767 ## <li><small>b</small></li>
9768 ## </small></ul>
9769 ## !!end
9770
9771 # This is a bug in the PHP parser + tidy combination.
9772 # (The </tr> tag gets parsed as text and html-escaped by PHP,
9773 # and then fostered out of the table by tidy.)
9774 # We believe the Parsoid output to be correct.
9775 !! test
9776 Table with missing opening <tr> tag
9777 !! options
9778 parsoid=wt2html,wt2wt
9779 !! wikitext
9780 <table>
9781 <td>foo</td>
9782 </tr>
9783 </table>
9784 !! html+tidy
9785 <table>
9786 <tr>
9787 <td>foo</td>
9788 </tr>
9789 </table>
9790 !! end
9791
9792 ###
9793 ### Magic Words
9794 ###
9795
9796 # Note that the current date is hard-coded as
9797 # 1970-01-01T00:02:03Z (a Thursday)
9798 # when running parser tests. The timezone is also fixed to GMT, so
9799 # local date will be identical to current date.
9800
9801 !! test
9802 Magic Word: {{CURRENTDAY}}
9803 !! wikitext
9804 {{CURRENTDAY}}
9805 !! html
9806 <p>1
9807 </p>
9808 !! end
9809
9810 !! test
9811 Magic Word: {{CURRENTDAY2}}
9812 !! wikitext
9813 {{CURRENTDAY2}}
9814 !! html
9815 <p>01
9816 </p>
9817 !! end
9818
9819 !! test
9820 Magic Word: {{CURRENTDAYNAME}}
9821 !! wikitext
9822 {{CURRENTDAYNAME}}
9823 !! html
9824 <p>Thursday
9825 </p>
9826 !! end
9827
9828 !! test
9829 Magic Word: {{CURRENTDOW}}
9830 !! wikitext
9831 {{CURRENTDOW}}
9832 !! html
9833 <p>4
9834 </p>
9835 !! end
9836
9837 !! test
9838 Magic Word: {{CURRENTMONTH}}
9839 !! wikitext
9840 {{CURRENTMONTH}}
9841 !! html
9842 <p>01
9843 </p>
9844 !! end
9845
9846 !! test
9847 Magic Word: {{CURRENTMONTH1}}
9848 !! wikitext
9849 {{CURRENTMONTH1}}
9850 !! html
9851 <p>1
9852 </p>
9853 !! end
9854
9855 !! test
9856 Magic Word: {{CURRENTMONTHABBREV}}
9857 !! wikitext
9858 {{CURRENTMONTHABBREV}}
9859 !! html
9860 <p>Jan
9861 </p>
9862 !! end
9863
9864 !! test
9865 Magic Word: {{CURRENTMONTHNAME}}
9866 !! wikitext
9867 {{CURRENTMONTHNAME}}
9868 !! html
9869 <p>January
9870 </p>
9871 !! end
9872
9873 !! test
9874 Magic Word: {{CURRENTMONTHNAMEGEN}}
9875 !! wikitext
9876 {{CURRENTMONTHNAMEGEN}}
9877 !! html
9878 <p>January
9879 </p>
9880 !! end
9881
9882 !! test
9883 Magic Word: {{CURRENTTIME}}
9884 !! wikitext
9885 {{CURRENTTIME}}
9886 !! html
9887 <p>00:02
9888 </p>
9889 !! end
9890
9891 !! test
9892 Magic Word: {{CURRENTHOUR}}
9893 !! wikitext
9894 {{CURRENTHOUR}}
9895 !! html
9896 <p>00
9897 </p>
9898 !! end
9899
9900 !! test
9901 Magic Word: {{CURRENTWEEK}} (T6594)
9902 !! wikitext
9903 {{CURRENTWEEK}}
9904 !! html
9905 <p>1
9906 </p>
9907 !! end
9908
9909 !! test
9910 Magic Word: {{CURRENTYEAR}}
9911 !! wikitext
9912 {{CURRENTYEAR}}
9913 !! html
9914 <p>1970
9915 </p>
9916 !! end
9917
9918 !! test
9919 Magic Word: {{CURRENTTIMESTAMP}}
9920 !! wikitext
9921 {{CURRENTTIMESTAMP}}
9922 !! html
9923 <p>19700101000203
9924 </p>
9925 !! end
9926
9927 !! test
9928 Magic Words LOCAL (UTC)
9929 !! wikitext
9930 * {{LOCALMONTH}}
9931 * {{LOCALMONTH1}}
9932 * {{LOCALMONTHNAME}}
9933 * {{LOCALMONTHNAMEGEN}}
9934 * {{LOCALMONTHABBREV}}
9935 * {{LOCALDAY}}
9936 * {{LOCALDAY2}}
9937 * {{LOCALDAYNAME}}
9938 * {{LOCALYEAR}}
9939 * {{LOCALTIME}}
9940 * {{LOCALHOUR}}
9941 * {{LOCALWEEK}}
9942 * {{LOCALDOW}}
9943 * {{LOCALTIMESTAMP}}
9944 !! html
9945 <ul><li> 01</li>
9946 <li> 1</li>
9947 <li> January</li>
9948 <li> January</li>
9949 <li> Jan</li>
9950 <li> 1</li>
9951 <li> 01</li>
9952 <li> Thursday</li>
9953 <li> 1970</li>
9954 <li> 00:02</li>
9955 <li> 00</li>
9956 <li> 1</li>
9957 <li> 4</li>
9958 <li> 19700101000203</li></ul>
9959
9960 !! end
9961
9962 !! test
9963 Magic Word: {{FULLPAGENAME}}
9964 !! options
9965 title=[[User:Ævar Arnfjörð Bjarmason]]
9966 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
9967 !! wikitext
9968 {{FULLPAGENAME}}
9969 !! html/*
9970 <p>User:Ævar Arnfjörð Bjarmason
9971 </p>
9972 !! end
9973
9974 !! test
9975 Magic Word: {{FULLPAGENAMEE}}
9976 !! options
9977 title=[[User:Ævar Arnfjörð Bjarmason]]
9978 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
9979 !! wikitext
9980 {{FULLPAGENAMEE}}
9981 !! html/*
9982 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9983 </p>
9984 !! end
9985
9986 !! test
9987 Magic Word: {{TALKSPACE}}
9988 !! options
9989 title=[[User:Ævar Arnfjörð Bjarmason]]
9990 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
9991 !! wikitext
9992 {{TALKSPACE}}
9993 !! html/*
9994 <p>User talk
9995 </p>
9996 !! end
9997
9998 !! test
9999 Magic Word: {{TALKSPACE}}, same namespace
10000 !! options
10001 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10002 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10003 !! wikitext
10004 {{TALKSPACE}}
10005 !! html/*
10006 <p>User talk
10007 </p>
10008 !! end
10009
10010 !! test
10011 Magic Word: {{TALKSPACE}}, main namespace
10012 !! options
10013 title=[[Parser Test]]
10014 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10015 !! wikitext
10016 {{TALKSPACE}}
10017 !! html/*
10018 <p>Talk
10019 </p>
10020 !! end
10021
10022 !! test
10023 Magic Word: {{TALKSPACEE}}
10024 !! options
10025 title=[[User:Ævar Arnfjörð Bjarmason]]
10026 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10027 !! wikitext
10028 {{TALKSPACEE}}
10029 !! html/*
10030 <p>User_talk
10031 </p>
10032 !! end
10033
10034 !! test
10035 Magic Word: {{SUBJECTSPACE}}
10036 !! options
10037 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10038 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10039 !! wikitext
10040 {{SUBJECTSPACE}}
10041 !! html/*
10042 <p>User
10043 </p>
10044 !! end
10045
10046 !! test
10047 Magic Word: {{SUBJECTSPACE}}, same namespace
10048 !! options
10049 title=[[User:Ævar Arnfjörð Bjarmason]]
10050 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10051 !! wikitext
10052 {{SUBJECTSPACE}}
10053 !! html/*
10054 <p>User
10055 </p>
10056 !! end
10057
10058 !! test
10059 Magic Word: {{SUBJECTSPACE}}, main namespace
10060 !! options
10061 title=[[Parser Test]]
10062 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10063 !! wikitext
10064 {{SUBJECTSPACE}}
10065 !! html/*
10066
10067 !! end
10068
10069 !! test
10070 Magic Word: {{SUBJECTSPACEE}}
10071 !! options
10072 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10073 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10074 !! wikitext
10075 {{SUBJECTSPACEE}}
10076 !! html/*
10077 <p>User
10078 </p>
10079 !! end
10080
10081 !! test
10082 Magic Word: {{NAMESPACE}}
10083 !! options
10084 title=[[User:Ævar Arnfjörð Bjarmason]]
10085 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10086 !! wikitext
10087 {{NAMESPACE}}
10088 !! html/*
10089 <p>User
10090 </p>
10091 !! end
10092
10093 !! test
10094 Magic Word: {{NAMESPACEE}}
10095 !! options
10096 title=[[User:Ævar Arnfjörð Bjarmason]]
10097 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10098 !! wikitext
10099 {{NAMESPACEE}}
10100 !! html/*
10101 <p>User
10102 </p>
10103 !! end
10104
10105 !! test
10106 Magic Word: {{NAMESPACENUMBER}}
10107 !! options
10108 title=[[User:Ævar Arnfjörð Bjarmason]]
10109 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10110 !! wikitext
10111 {{NAMESPACENUMBER}}
10112 !! html/*
10113 <p>2
10114 </p>
10115 !! end
10116
10117 !! test
10118 Magic Word: {{SUBPAGENAME}}
10119 !! options
10120 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
10121 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10122 !! wikitext
10123 {{SUBPAGENAME}}
10124 !! html/*
10125 <p>sub ö
10126 </p>
10127 !! end
10128
10129 !! test
10130 Magic Word: {{SUBPAGENAMEE}}
10131 !! options
10132 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
10133 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10134 !! wikitext
10135 {{SUBPAGENAMEE}}
10136 !! html/*
10137 <p>sub_%C3%B6
10138 </p>
10139 !! end
10140
10141 !! test
10142 Magic Word: {{ROOTPAGENAME}}
10143 !! options
10144 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
10145 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10146 !! wikitext
10147 {{ROOTPAGENAME}}
10148 !! html/*
10149 <p>Ævar Arnfjörð Bjarmason
10150 </p>
10151 !! end
10152
10153 !! test
10154 Magic Word: {{ROOTPAGENAMEE}}
10155 !! options
10156 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
10157 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10158 !! wikitext
10159 {{ROOTPAGENAMEE}}
10160 !! html/*
10161 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10162 </p>
10163 !! end
10164
10165 !! test
10166 Magic Word: {{BASEPAGENAME}}
10167 !! options
10168 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
10169 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10170 !! wikitext
10171 {{BASEPAGENAME}}
10172 !! html/*
10173 <p>Ævar Arnfjörð Bjarmason
10174 </p>
10175 !! end
10176
10177 !! test
10178 Magic Word: {{BASEPAGENAMEE}}
10179 !! options
10180 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
10181 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10182 !! wikitext
10183 {{BASEPAGENAMEE}}
10184 !! html/*
10185 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10186 </p>
10187 !! end
10188
10189 !! test
10190 Magic Word: {{TALKPAGENAME}}
10191 !! options
10192 title=[[User:Ævar Arnfjörð Bjarmason]]
10193 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10194 !! wikitext
10195 {{TALKPAGENAME}}
10196 !! html/*
10197 <p>User talk:Ævar Arnfjörð Bjarmason
10198 </p>
10199 !! end
10200
10201 !! test
10202 Magic Word: {{TALKPAGENAMEE}}
10203 !! options
10204 title=[[User:Ævar Arnfjörð Bjarmason]]
10205 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10206 !! wikitext
10207 {{TALKPAGENAMEE}}
10208 !! html/*
10209 <p>User_talk:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10210 </p>
10211 !! end
10212
10213 !! test
10214 Magic Word: {{SUBJECTPAGENAME}}
10215 !! options
10216 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10217 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10218 !! wikitext
10219 {{SUBJECTPAGENAME}}
10220 !! html/*
10221 <p>User:Ævar Arnfjörð Bjarmason
10222 </p>
10223 !! end
10224
10225 !! test
10226 Magic Word: {{SUBJECTPAGENAMEE}}
10227 !! options
10228 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10229 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10230 !! wikitext
10231 {{SUBJECTPAGENAMEE}}
10232 !! html/*
10233 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10234 </p>
10235 !! end
10236
10237 !! test
10238 Magic Word: {{NUMBEROFFILES}}
10239 !! options
10240 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10241 !! wikitext
10242 {{NUMBEROFFILES}}
10243 !! html/*
10244 <p>7
10245 </p>
10246 !! end
10247
10248 !! test
10249 Magic Word: {{PAGENAME}}
10250 !! options
10251 title=[[User:Ævar Arnfjörð Bjarmason]]
10252 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10253 !! wikitext
10254 {{PAGENAME}}
10255 !! html/*
10256 <p>Ævar Arnfjörð Bjarmason
10257 </p>
10258 !! end
10259
10260 !! test
10261 Magic Word: {{PAGENAME}} with metacharacters
10262 !! options
10263 title=[['foo & bar = baz']]
10264 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10265 !! wikitext
10266 ''{{PAGENAME}}''
10267 !! html/php
10268 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
10269 </p>
10270 !! html+tidy
10271 <p><i>'foo &amp; bar = baz'</i></p>
10272 !! end
10273
10274 !! test
10275 Magic Word: {{PAGENAME}} with metacharacters (T28781)
10276 !! options
10277 title=[[*RFC 1234 http://example.com/]]
10278 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10279 !! wikitext
10280 {{PAGENAME}}
10281 !! html/php
10282 <p>&#42;RFC&#32;1234 http&#58;//example.com/
10283 </p>
10284 !! html+tidy
10285 <p>*RFC 1234 http://example.com/</p>
10286 !! end
10287
10288 !! test
10289 Magic Word: {{PAGENAMEE}}
10290 !! options
10291 title=[[User:Ævar Arnfjörð Bjarmason]]
10292 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10293 !! wikitext
10294 {{PAGENAMEE}}
10295 !! html/*
10296 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10297 </p>
10298 !! end
10299
10300 !! test
10301 Magic Word: {{PAGENAMEE}} with metacharacters (T28781)
10302 !! options
10303 title=[[*RFC 1234 http://example.com/]]
10304 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10305 !! wikitext
10306 {{PAGENAMEE}}
10307 !! html/php
10308 <p>&#42;RFC_1234_http&#58;//example.com/
10309 </p>
10310 !! html+tidy
10311 <p>*RFC_1234_http://example.com/</p>
10312 !! end
10313
10314 !! test
10315 Magic Word: {{REVISIONID}}
10316 !! options
10317 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10318 !! wikitext
10319 {{REVISIONID}}
10320 !! html/*
10321 <p>1337
10322 </p>
10323 !! end
10324
10325 !! test
10326 Magic Word: {{SCRIPTPATH}}
10327 !! options
10328 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10329 !! wikitext
10330 {{SCRIPTPATH}}
10331 !! html/*
10332
10333 !! end
10334
10335 !! test
10336 Magic Word: {{STYLEPATH}}
10337 !! options
10338 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10339 !! wikitext
10340 {{STYLEPATH}}
10341 !! html/*
10342 <p>/skins
10343 </p>
10344 !! end
10345
10346 !! test
10347 Magic Word: {{SERVER}}
10348 !! options
10349 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10350 !! wikitext
10351 {{SERVER}}
10352 !! html/*
10353 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
10354 </p>
10355 !! end
10356
10357 !! test
10358 Magic Word: {{SERVERNAME}}
10359 !! options
10360 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10361 !! wikitext
10362 {{SERVERNAME}}
10363 !! html/*
10364 <p>example.org
10365 </p>
10366 !! end
10367
10368 !! test
10369 Magic Word: {{SITENAME}}
10370 !! options
10371 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10372 !! wikitext
10373 {{SITENAME}}
10374 !! html/*
10375 <p>MediaWiki
10376 </p>
10377 !! end
10378
10379 !! test
10380 Magic Word: {{PAGELANGUAGE}}
10381 !! options
10382 language=fr
10383 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10384 !! wikitext
10385 {{PAGELANGUAGE}}
10386 !! html/*
10387 <p>fr
10388 </p>
10389 !! end
10390
10391 !! test
10392 Magic Word: {{PAGELANGUAGE}} on a page with no explicitly set language
10393 !! options
10394 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10395 !! wikitext
10396 {{PAGELANGUAGE}}
10397 !! html/*
10398 <p>en
10399 </p>
10400 !! end
10401
10402 !! test
10403 Case-sensitive magic words, when cased differently, should just be template transclusions
10404 !! wikitext
10405 {{CurrentMonth}}
10406 {{currentday}}
10407 {{cURreNTweEK}}
10408 {{currentHour}}
10409 !! html
10410 <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>
10411 <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>
10412 <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>
10413 <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>
10414 </p>
10415 !! end
10416
10417 !! test
10418 Case-insensitive magic words should still work with weird casing.
10419 !! wikitext
10420 {{sErVeRNaMe}}
10421 {{LCFirst:AOEU}}
10422 {{ucFIRST:aoeu}}
10423 {{SERver}}
10424 !! html
10425 <p>example.org
10426 aOEU
10427 Aoeu
10428 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
10429 </p>
10430 !! end
10431
10432 # From plwiki:PLOS_ONE
10433 !! test
10434 Parsoid: Page property magic word with magic word contents
10435 !! wikitext
10436 {{DISPLAYTITLE:''{{PAGENAME}}''}}
10437 !! html/parsoid
10438 <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":"&lt;i data-parsoid=&#39;{\"dsr\":[15,31,2,2]}&#39;>&lt;span about=\"#mwt2\" 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>"}]]}'/>
10439 !! end
10440
10441 !! test
10442 Parsoid: Template-generated DISPLAYTITLE
10443 !! wikitext
10444 {{{{echo|DISPLAYTITLE}}:Foo}}
10445 !! html/parsoid
10446 <meta property="mw:PageProp/displaytitle" content="Foo" about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"{{echo|DISPLAYTITLE}}:Foo"},"params":{},"i":0}}]}'/>
10447 !! end
10448
10449 !! test
10450 Namespace 1 {{ns:1}}
10451 !! wikitext
10452 {{ns:1}}
10453 !! html
10454 <p>Talk
10455 </p>
10456 !! end
10457
10458 !! test
10459 Namespace 1 {{ns:01}}
10460 !! wikitext
10461 {{ns:01}}
10462 !! html
10463 <p>Talk
10464 </p>
10465 !! end
10466
10467 !! test
10468 Namespace 0 {{ns:0}} (T6783)
10469 !! wikitext
10470 {{ns:0}}
10471 !! html
10472
10473 !! end
10474
10475 !! test
10476 Namespace 0 {{ns:00}} (T6783)
10477 !! wikitext
10478 {{ns:00}}
10479 !! html
10480
10481 !! end
10482
10483 !! test
10484 Namespace -1 {{ns:-1}}
10485 !! wikitext
10486 {{ns:-1}}
10487 !! html
10488 <p>Special
10489 </p>
10490 !! end
10491
10492 !! test
10493 Namespace User {{ns:User}}
10494 !! wikitext
10495 {{ns:User}}
10496 !! html
10497 <p>User
10498 </p>
10499 !! end
10500
10501 !! test
10502 Namespace User talk {{ns:User_talk}}
10503 !! wikitext
10504 {{ns:User_talk}}
10505 !! html
10506 <p>User talk
10507 </p>
10508 !! end
10509
10510 !! test
10511 Namespace User talk {{ns:uSeR tAlK}}
10512 !! wikitext
10513 {{ns:uSeR tAlK}}
10514 !! html
10515 <p>User talk
10516 </p>
10517 !! end
10518
10519 !! test
10520 Namespace File {{ns:File}}
10521 !! wikitext
10522 {{ns:File}}
10523 !! html
10524 <p>File
10525 </p>
10526 !! end
10527
10528 !! test
10529 Namespace File {{ns:Image}}
10530 !! wikitext
10531 {{ns:Image}}
10532 !! html
10533 <p>File
10534 </p>
10535 !! end
10536
10537 !! test
10538 Namespace (lang=de) Benutzer {{ns:User}}
10539 !! options
10540 language=de
10541 !! wikitext
10542 {{ns:User}}
10543 !! html
10544 <p>Benutzer
10545 </p>
10546 !! end
10547
10548 !! test
10549 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
10550 !! options
10551 language=de
10552 !! wikitext
10553 {{ns:3}}
10554 !! html
10555 <p>Benutzer Diskussion
10556 </p>
10557 !! end
10558
10559 !! test
10560 Urlencode
10561 !! wikitext
10562 {{urlencode:hi world?!}}
10563 {{urlencode:hi world?!|WIKI}}
10564 {{urlencode:hi world?!|PATH}}
10565 {{urlencode:hi world?!|QUERY}}
10566 !! html/php
10567 <p>hi+world%3F%21
10568 hi_world%3F!
10569 hi%20world%3F%21
10570 hi+world%3F%21
10571 </p>
10572 !! end
10573
10574 !! test
10575 Magic Word: prioritize type info over data-parsoid
10576 !! options
10577 parsoid=html2wt
10578 !! html/parsoid
10579 <meta property="mw:PageProp/forcetoc" data-parsoid='{"magicSrc":"__NOTOC__"}'/>
10580 !! wikitext
10581 __FORCETOC__
10582 !! end
10583
10584 !! test
10585 Magic Word: serialize on separate line (parsoid)
10586 !! options
10587 parsoid=wt2wt,html2wt
10588 !! wikitext
10589 foo
10590 __NOTOC__
10591 bar
10592 !! html/parsoid
10593 foo<meta property="mw:PageProp/notoc"/>bar
10594 !! end
10595
10596 !! test
10597 Magic Word: rt non-english wikis
10598 !! options
10599 parsoid=wt2wt
10600 language=de
10601 !! wikitext
10602 __NOEDITSECTION__
10603 !! html/parsoid
10604 <meta property="mw:PageProp/noeditsection" data-parsoid='{"magicSrc":"__NOEDITSECTION__"}'/>
10605 !! end
10606
10607 !!test
10608 __proto__ is treated as normal wikitext (T105997)
10609 !!wikitext
10610 __proto__
10611 !!html
10612 <p>__proto__
10613 </p>
10614 !!end
10615
10616 ###
10617 ### Magic links
10618 ###
10619 !! test
10620 Magic links: internal link to RFC (T2479)
10621 !! wikitext
10622 [[RFC 123]]
10623 !! html/php
10624 <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>
10625 </p>
10626 !! html/parsoid
10627 <p><a rel="mw:WikiLink" href="./RFC_123" title="RFC 123">RFC 123</a></p>
10628 !! end
10629
10630 !! test
10631 Magic links: RFC (T2479)
10632 !! wikitext
10633 RFC 822
10634 !! html/php
10635 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
10636 </p>
10637 !! html/parsoid
10638 <p><a href="//tools.ietf.org/html/rfc822" rel="mw:ExtLink">RFC 822</a></p>
10639 !! end
10640
10641 !! test
10642 Magic links: RFC (T67278)
10643 !! wikitext
10644 This is RFC 822 but thisRFC 822 is not RFC 822linked.
10645 !! html/php
10646 <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.
10647 </p>
10648 !! html/parsoid
10649 <p>This is <a href="//tools.ietf.org/html/rfc822" rel="mw:ExtLink">RFC 822</a> but thisRFC 822 is not RFC 822linked.</p>
10650 !! end
10651
10652 !! test
10653 Magic links: RFC (w/ non-newline whitespace, T30950/T31025)
10654 !! wikitext
10655 RFC &nbsp;&#160;&#0160;&#xA0;&#Xa0; 822
10656 RFC
10657 822
10658 !! html/php
10659 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
10660 RFC
10661 822
10662 </p>
10663 !! html/parsoid
10664 <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>
10665 RFC
10666 822</p>
10667 !! end
10668
10669 !! test
10670 Magic links: ISBN (T3937)
10671 !! wikitext
10672 ISBN 0-306-40615-2
10673 !! html/php
10674 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
10675 </p>
10676 !! html/parsoid
10677 <p><a href="./Special:BookSources/0306406152" rel="mw:WikiLink">ISBN 0-306-40615-2</a></p>
10678 !! end
10679
10680 !! test
10681 Magic links: ISBN (T67278)
10682 !! wikitext
10683 This is ISBN 978-0-316-09811-3 but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.
10684 !! html/php
10685 <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.
10686 </p>
10687 !! html/parsoid
10688 <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>
10689 !! end
10690
10691 !! test
10692 Magic links: ISBN (w/ non-newline whitespace, T30950/T31025)
10693 !! wikitext
10694 ISBN &nbsp;&#160;&#0160;&#xA0;&#Xa0; 978&nbsp;0&#160;316&#0160;09811&#xA0;3
10695 ISBN
10696 9780316098113
10697 ISBN 978
10698 0316098113
10699 !! html/php
10700 <p><a href="/wiki/Special:BookSources/9780316098113" class="internal mw-magiclink-isbn">ISBN 978 0 316 09811 3</a>
10701 ISBN
10702 9780316098113
10703 ISBN 978
10704 0316098113
10705 </p>
10706 !! html/parsoid
10707 <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>
10708 ISBN
10709 9780316098113
10710 ISBN 978
10711 0316098113</p>
10712 !! end
10713
10714 !! test
10715 Magic links: PMID incorrectly converts space to underscore
10716 !! wikitext
10717 PMID 1234
10718 !! html/php
10719 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
10720 </p>
10721 !! html/parsoid
10722 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract" rel="mw:ExtLink">PMID 1234</a></p>
10723 !! end
10724
10725 !! test
10726 Magic links: PMID (T67278)
10727 !! wikitext
10728 This is PMID 1234 but thisPMID 1234 is not PMID 1234linked.
10729 !! html/php
10730 <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.
10731 </p>
10732 !! html/parsoid
10733 <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>
10734 !! end
10735
10736 !! test
10737 Magic links: PMID (w/ non-newline whitespace, T30950/T31025)
10738 !! wikitext
10739 PMID &nbsp;&#160;&#0160;&#xA0;&#Xa0; 1234
10740 PMID
10741 1234
10742 !! html/php
10743 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
10744 PMID
10745 1234
10746 </p>
10747 !! html/parsoid
10748 <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>
10749 PMID
10750 1234</p>
10751 !! end
10752
10753 # <nowiki> nodes shouldn't be inserted during html2wt by Parsoid,
10754 # since these are ExtLinkText, not MagicLinkText
10755 !! test
10756 Magic links: use appropriate serialization for "almost" magic links.
10757 !! wikitext
10758 X[[Special:BookSources/0978739256|foo]]
10759
10760 X[//tools.ietf.org/html/rfc1234 foo]
10761 !! html/php
10762 <p>X<a href="/wiki/Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a>
10763 </p><p>X<a rel="nofollow" class="external text" href="//tools.ietf.org/html/rfc1234">foo</a>
10764 </p>
10765 !! html/parsoid
10766 <p>X<a rel="mw:WikiLink" href="./Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a></p>
10767 <p>X<a rel="mw:ExtLink" href="//tools.ietf.org/html/rfc1234">foo</a></p>
10768 !! end
10769
10770 !! test
10771 Magic links: All disabled (T47942)
10772 !! options
10773 wgEnableMagicLinks={"ISBN":false, "PMID":false, "RFC":false}
10774 !! wikitext
10775 ISBN 0-306-40615-2
10776 PMID 1234
10777 RFC 4321
10778 !! html/php
10779 <p>ISBN 0-306-40615-2
10780 PMID 1234
10781 RFC 4321
10782 </p>
10783 !! end
10784
10785 ###
10786 ### Templates
10787 ####
10788
10789 !! test
10790 Nonexistent template
10791 !! wikitext
10792 {{thistemplatedoesnotexist}}
10793 !! html
10794 <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>
10795 </p>
10796 !! end
10797
10798 !! test
10799 Template with invalid target containing tags
10800 !! wikitext
10801 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
10802 !! html
10803 <p>{{a<b>b</b>|foo|a=b|a = b}}
10804 </p>
10805 !! end
10806
10807 !! test
10808 Template with invalid target containing unclosed tag
10809 !! wikitext
10810 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
10811 !! html
10812 <p>{{a<b>|foo|a=b|a = b}}</b>
10813 </p>
10814 !! end
10815
10816 !! test
10817 Template with invalid target containing wikilink
10818 !! wikitext
10819 {{[[Main Page]]}}
10820 !! html/php
10821 <p>{{<a href="/wiki/Main_Page" title="Main Page">Main Page</a>}}
10822 </p>
10823 !! html/parsoid
10824 <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>
10825 !! end
10826
10827 !! test
10828 Template with just whitespace in it, T70421
10829 !! wikitext
10830 {{echo|{{ }}}}
10831 !! html/parsoid
10832 <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>
10833 !! end
10834
10835 !! article
10836 Template:test
10837 !! text
10838 This is a test template
10839 !! endarticle
10840
10841 !! test
10842 Simple template
10843 !! wikitext
10844 {{test}}
10845 !! html
10846 <p>This is a test template
10847 </p>
10848 !! end
10849
10850 !! test
10851 Template with explicit namespace
10852 !! wikitext
10853 {{Template:test}}
10854 !! html
10855 <p>This is a test template
10856 </p>
10857 !! end
10858
10859
10860 !! article
10861 Template:paramtest
10862 !! text
10863 This is a test template with parameter {{{param}}}
10864 !! endarticle
10865
10866 !! test
10867 Template parameter
10868 !! wikitext
10869 {{paramtest|param=foo}}
10870 !! html
10871 <p>This is a test template with parameter foo
10872 </p>
10873 !! end
10874
10875 !! article
10876 Template:paramtestnum
10877 !! text
10878 [[{{{1}}}|{{{2}}}]]
10879 !! endarticle
10880
10881 !! test
10882 Template unnamed parameter
10883 !! wikitext
10884 {{paramtestnum|Main Page|the main page}}
10885 !! html
10886 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
10887 </p>
10888 !! end
10889
10890 !! article
10891 Template:templatesimple
10892 !! text
10893 (test)
10894 !! endarticle
10895
10896 !! article
10897 Template:templateredirect
10898 !! text
10899 #redirect [[Template:templatesimple]]
10900 !! endarticle
10901
10902 !! article
10903 Template:templateasargtestnum
10904 !! text
10905 {{{{{1}}}}}
10906 !! endarticle
10907
10908 !! article
10909 Template:templateasargtest
10910 !! text
10911 {{template{{{templ}}}}}
10912 !! endarticle
10913
10914 !! article
10915 Template:templateasargtest2
10916 !! text
10917 {{{{{templ}}}}}
10918 !! endarticle
10919
10920 !! test
10921 Template with template name as unnamed argument
10922 !! wikitext
10923 {{templateasargtestnum|templatesimple}}
10924 !! html
10925 <p>(test)
10926 </p>
10927 !! end
10928
10929 !! test
10930 Template with template name as argument
10931 !! wikitext
10932 {{templateasargtest|templ=simple}}
10933 !! html
10934 <p>(test)
10935 </p>
10936 !! end
10937
10938 !! test
10939 Template with template name as argument (2)
10940 !! wikitext
10941 {{templateasargtest2|templ=templatesimple}}
10942 !! html
10943 <p>(test)
10944 </p>
10945 !! end
10946
10947 !! article
10948 Template:templateasargtestdefault
10949 !! text
10950 {{{{{templ|templatesimple}}}}}
10951 !! endarticle
10952
10953 !! article
10954 Template:templa
10955 !! text
10956 '''templ'''
10957 !! endarticle
10958
10959 !! test
10960 Template with default value
10961 !! wikitext
10962 {{templateasargtestdefault}}
10963 !! html
10964 <p>(test)
10965 </p>
10966 !! end
10967
10968 !! test
10969 Template with default value (value set)
10970 !! wikitext
10971 {{templateasargtestdefault|templ=templa}}
10972 !! html
10973 <p><b>templ</b>
10974 </p>
10975 !! end
10976
10977 !! test
10978 Template redirect
10979 !! wikitext
10980 {{templateredirect}}
10981 !! html/php
10982 <p>(test)
10983 </p>
10984 !! html/parsoid
10985 <link rel="mw:PageProp/redirect" href="./Template:Templatesimple" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"templateredirect","href":"./Template:Templateredirect"},"params":{},"i":0}}]}'/>
10986 !! end
10987
10988 !! test
10989 Template with argument in separate line
10990 !! wikitext
10991 {{ templateasargtest |
10992 templ = simple }}
10993 !! html
10994 <p>(test)
10995 </p>
10996 !! end
10997
10998 !! test
10999 Template with complex template as argument
11000 !! wikitext
11001 {{paramtest|
11002 param ={{ templateasargtest |
11003 templ = simple }}}}
11004 !! html
11005 <p>This is a test template with parameter (test)
11006 </p>
11007 !! end
11008
11009 !! test
11010 Template with thumb image (with link in description)
11011 !! wikitext
11012 {{paramtest|param=[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
11013 !! html/php
11014 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>
11015
11016 !! html+tidy
11017 <p>This is a test template with parameter</p>
11018 <div class="thumb tright">
11019 <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>
11020 <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>
11021 </div>
11022 </div>
11023 !! html/parsoid
11024 <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":"missing-image","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>
11025 !! end
11026
11027 !! article
11028 Template:complextemplate
11029 !! text
11030 {{{1}}} {{paramtest|
11031 param ={{{param}}}}}
11032 !! endarticle
11033
11034 !! test
11035 Template with complex arguments
11036 !! wikitext
11037 {{complextemplate|
11038 param ={{ templateasargtest |
11039 templ = simple }}|[[Template:complextemplate|link]]}}
11040 !! html
11041 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
11042 </p>
11043 !! end
11044
11045 !! test
11046 T2553: link with two variables in a piped link
11047 !! wikitext
11048 {|
11049 |[[{{{1}}}|{{{2}}}]]
11050 |}
11051 !! html/php
11052 <table>
11053 <tr>
11054 <td>[[{{{1}}}|{{{2}}}]]
11055 </td></tr></table>
11056
11057 !! html/parsoid
11058 <table>
11059 <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>
11060 </tbody></table>
11061 !! end
11062
11063 # See: T2553
11064 !! test
11065 Abort table cell attribute parsing on wikilink
11066 !! wikitext
11067 {|
11068 | testing [[one|two]] | three || four
11069 | testing one two | three || four
11070 | testing="[[one|two]]" | three || four
11071 |}
11072 !! html/php
11073 <table>
11074 <tr>
11075 <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>
11076 <td> four
11077 </td>
11078 <td> three </td>
11079 <td> four
11080 </td>
11081 <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>
11082 <td> four
11083 </td></tr></table>
11084
11085 !! html/parsoid
11086 <table>
11087 <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>
11088 <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>
11089 <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>
11090 </tbody></table>
11091 !! end
11092
11093 !! test
11094 Don't abort table cell attribute parsing if wikilink is found in template arg
11095 !! wikitext
11096 {|
11097 | Test {{#tag:ref|One two "[[three]]" four}}
11098 |}
11099 !! html/parsoid
11100 <table>
11101 <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>
11102 </tbody></table>
11103 !! end
11104
11105 !! test
11106 Magic variable as template parameter
11107 !! wikitext
11108 {{paramtest|param={{SITENAME}}}}
11109 !! html
11110 <p>This is a test template with parameter MediaWiki
11111 </p>
11112 !! end
11113
11114 !! article
11115 Template:linktest
11116 !! text
11117 [[{{{param}}}|link]]
11118 !! endarticle
11119
11120 !! test
11121 Template parameter as link source
11122 !! wikitext
11123 {{linktest|param=Main Page}}
11124 !! html
11125 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
11126 </p>
11127 !! end
11128
11129 !!article
11130 Template:paramtest2
11131 !! text
11132 including another template, {{paramtest|param={{{arg}}}}}
11133 !! endarticle
11134
11135 !! test
11136 Template passing argument to another template
11137 !! wikitext
11138 {{paramtest2|arg='hmm'}}
11139 !! html
11140 <p>including another template, This is a test template with parameter 'hmm'
11141 </p>
11142 !! end
11143
11144 !! article
11145 Template:Linktest2
11146 !! text
11147 Main Page
11148 !! endarticle
11149
11150 !! test
11151 Template as link source
11152 !! wikitext
11153 [[{{linktest2}}]]
11154
11155 [[{{linktest2}}|Main Page]]
11156
11157 [[{{linktest2}}]]Page
11158 !! html
11159 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
11160 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
11161 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
11162 </p>
11163 !! end
11164
11165
11166 !! article
11167 Template:loop1
11168 !! text
11169 {{loop2}}
11170 !! endarticle
11171
11172 !! article
11173 Template:loop2
11174 !! text
11175 {{loop1}}
11176 !! endarticle
11177
11178 !! test
11179 Template infinite loop
11180 !! wikitext
11181 {{loop1}}
11182 !! html
11183 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
11184 </p>
11185 !! end
11186
11187 !! test
11188 Template from main namespace
11189 !! wikitext
11190 {{:Main Page}}
11191 !! html
11192 <p>blah blah
11193 </p>
11194 !! end
11195
11196 !! article
11197 Template:table
11198 !! text
11199 {|
11200 | 1 || 2
11201 |-
11202 | 3 || 4
11203 |}
11204 !! endarticle
11205
11206 !! test
11207 T2529: Template with table, not included at beginning of line
11208 !! wikitext
11209 foo {{table}}
11210 !! html
11211 <p>foo
11212 </p>
11213 <table>
11214 <tr>
11215 <td> 1 </td>
11216 <td> 2
11217 </td></tr>
11218 <tr>
11219 <td> 3 </td>
11220 <td> 4
11221 </td></tr></table>
11222
11223 !! end
11224
11225 !! test
11226 T2523: Template shouldn't eat newline (or add an extra one before table)
11227 !! wikitext
11228 foo
11229 {{table}}
11230 !! html
11231 <p>foo
11232 </p>
11233 <table>
11234 <tr>
11235 <td> 1 </td>
11236 <td> 2
11237 </td></tr>
11238 <tr>
11239 <td> 3 </td>
11240 <td> 4
11241 </td></tr></table>
11242
11243 !! end
11244
11245 !! test
11246 T2041: Template parameters shown as broken links
11247 !! wikitext
11248 {{{parameter}}}
11249 !! html
11250 <p>{{{parameter}}}
11251 </p>
11252 !! end
11253
11254 !! test
11255 Template with targets containing wikilinks
11256 !! wikitext
11257 {{[[foo]]}}
11258
11259 {{[[{{echo|foo}}]]}}
11260
11261 {{{{echo|[[foo}}]]}}
11262 !! html
11263 <p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
11264 </p><p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
11265 </p><p>{{[[foo}}]]
11266 </p>
11267 !! end
11268
11269 !! article
11270 Template:''
11271 !! text
11272 bar
11273 !! endarticle
11274
11275 !! test
11276 Templates: Double quotes as template target
11277 !! wikitext
11278 foo {{''}} baz
11279 !! html/php
11280 <p>foo bar baz
11281 </p>
11282 !! html/parsoid
11283 <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
11284 </p>
11285 !! end
11286
11287 ## This test is about making sure Parsoid's data-mw is well formed in the
11288 ## face of multiple templates with intersecting and overlapping ranges. The
11289 ## wikitext itself is wretched.
11290 !! test
11291 Templates with intersecting and overlapping ranges
11292 !! wikitext
11293 {|{{echo|
11294 <p>ha</p>}}
11295 {|{{echo|
11296 <p>ho</p>}}
11297 {{echo|{{!}}hi}}
11298 |}
11299 !! html/php+tidy
11300 <p>ha</p>
11301 <p>ho</p>
11302 <table>
11303 <tr>
11304 <td></td>
11305 </tr>
11306 <tr>
11307 <td>hi</td>
11308 </tr>
11309 </table>
11310 <table>
11311 <tr>
11312 <td></td>
11313 </tr>
11314 </table>
11315 !! html/parsoid
11316 <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":""}]]}'>
11317
11318 </table><p about="#mwt1">ho</p><table about="#mwt1" typeof="mw:ExpandedAttrs" data-mw='{"attribs":[[{"txt":"","html":""},{"html":""}]]}'>
11319
11320 <tbody><tr><td>hi</td></tr>
11321 </tbody></table>
11322 !! end
11323
11324 !! article
11325 Template:MSGNW test
11326 !! text
11327 ''None'' of '''this''' should be
11328 * interpreted
11329 but rather passed unmodified
11330 {{test}}
11331 <gallery>
11332 File:Foobar.jpg
11333 </gallery>
11334 <!-- comment -->
11335 !! endarticle
11336
11337 # hmm, fix this or just deprecate msgnw and document its behavior?
11338 !! test
11339 msgnw keyword
11340 !! wikitext
11341 {{msgnw:MSGNW test}}
11342 !! html/php
11343 <p>&#39;&#39;None&#39;&#39; of &#39;&#39;&#39;this&#39;&#39;&#39; should be
11344 &#42; interpreted
11345 &#32;but rather passed unmodified
11346 &#123;&#123;test&#125;&#125;
11347 &#60;gallery&#62;
11348 File:Foobar.jpg
11349 &#60;/gallery&#62;
11350 &#60;!-- comment --&#62;
11351 </p>
11352 !! end
11353
11354 !! test
11355 int keyword
11356 !! wikitext
11357 {{int:youhavenewmessages|lots of money|not!}}
11358 !! html
11359 <p>You have lots of money (not!).
11360 </p>
11361 !! end
11362
11363 !! test
11364 int keyword - non-existing message
11365 !! wikitext
11366 {{int:var}}
11367 !! html
11368 <p>⧼var⧽
11369 </p>
11370 !! end
11371
11372 !! article
11373 Template:Includes
11374 !! text
11375 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
11376 !! endarticle
11377
11378 !! test
11379 <includeonly> and <noinclude> being included
11380 !! wikitext
11381 {{Includes}}
11382 !! html
11383 <p>Foobar
11384 </p>
11385 !! end
11386
11387 !! article
11388 Template:Includes2
11389 !! text
11390 <onlyinclude>Foo</onlyinclude>bar
11391 !! endarticle
11392
11393 !! test
11394 <onlyinclude> being included
11395 !! wikitext
11396 {{Includes2}}
11397 !! html
11398 <p>Foo
11399 </p>
11400 !! end
11401
11402
11403 !! article
11404 Template:Includes3
11405 !! text
11406 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
11407 !! endarticle
11408
11409 !! test
11410 <onlyinclude> and <includeonly> being included
11411 !! wikitext
11412 {{Includes3}}
11413 !! html
11414 <p>Foo
11415 </p>
11416 !! end
11417
11418 !! test
11419 <includeonly> and <noinclude> on a page
11420 !! wikitext
11421 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
11422 !! html
11423 <p>Foozar
11424 </p>
11425 !! end
11426
11427 !! test
11428 Un-closed <noinclude>
11429 !! wikitext
11430 <noinclude>
11431 !! html
11432 !! end
11433
11434 !! test
11435 <onlyinclude> on a page
11436 !! wikitext
11437 <onlyinclude>Foo</onlyinclude>bar
11438 !! html
11439 <p>Foobar
11440 </p>
11441 !! end
11442
11443 !! test
11444 Un-closed <onlyinclude>
11445 !! wikitext
11446 <onlyinclude>
11447 !! html
11448 !! end
11449
11450 !!test
11451 Self-closed noinclude, includeonly, onlyinclude tags
11452 !! wikitext
11453 <noinclude />
11454 <includeonly />
11455 <onlyinclude />
11456 !! html
11457 <p><br />
11458 </p>
11459 !!end
11460
11461 !!test
11462 Unbalanced includeonly and noinclude tags
11463 !! wikitext
11464 {|
11465 |a</noinclude>
11466 |b</noinclude></noinclude>
11467 |c</noinclude></includeonly>
11468 |d</includeonly></includeonly>
11469 |}
11470 !! html
11471 <table>
11472 <tr>
11473 <td>a
11474 </td>
11475 <td>b
11476 </td>
11477 <td>c&lt;/includeonly&gt;
11478 </td>
11479 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
11480 </td></tr></table>
11481
11482 !!end
11483
11484 !! article
11485 Template:Includeonly section
11486 !! text
11487 <includeonly>
11488 ==Includeonly section==
11489 </includeonly>
11490 ==Section T-1==
11491 !!endarticle
11492
11493 !! test
11494 T8563: Edit link generation for section shown by <includeonly>
11495 !! wikitext
11496 {{includeonly section}}
11497 !! html
11498 <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>
11499 <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>
11500
11501 !! end
11502
11503 # Uses same input as the contents of [[Template:Includeonly section]]
11504 !! test
11505 T8563: Section extraction for section shown by <includeonly>
11506 !! options
11507 section=T-2
11508 !! wikitext
11509 <includeonly>
11510 ==Includeonly section==
11511 </includeonly>
11512 ==Section T-2==
11513 !! html
11514 ==Section T-2==
11515 !! end
11516
11517 !! test
11518 T8563: Edit link generation for section suppressed by <includeonly>
11519 !! wikitext
11520 <includeonly>
11521 ==Includeonly section==
11522 </includeonly>
11523 ==Section 1==
11524 !! html
11525 <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>
11526
11527 !! end
11528
11529 !! test
11530 T8563: Section extraction for section suppressed by <includeonly>
11531 !! options
11532 section=1
11533 !! wikitext
11534 <includeonly>
11535 ==Includeonly section==
11536 </includeonly>
11537 ==Section 1==
11538 !! html
11539 ==Section 1==
11540 !! end
11541
11542 !! test
11543 Un-closed <includeonly>
11544 !! wikitext
11545 <includeonly>
11546 !! html/php
11547 !! html/parsoid
11548 <meta typeof="mw:Includes/IncludeOnly" data-parsoid='{"src":"&lt;includeonly>"}'/>
11549 !! end
11550
11551 ## We used to, but no longer wt2wt this test since the default serializer
11552 ## will normalize the include directives to serialize on their own line.
11553 ## Selser will take care of preserving formatting in scenarios where they
11554 ## intermingled with other wikitext.
11555 !! test
11556 Includes and comments at SOL
11557 !! options
11558 parsoid=wt2html,html2html
11559 !! wikitext
11560 <!-- comment --><noinclude><!-- comment --></noinclude><!-- comment -->== hu ==
11561
11562 <noinclude>
11563 some
11564 </noinclude>* stuff
11565 * here
11566
11567 <includeonly>can have stuff</includeonly>=== here ===
11568
11569 !! html/php
11570 <h2><span class="mw-headline" id="hu">hu</span></h2>
11571 <p>some
11572 </p>
11573 <ul><li> stuff</li>
11574 <li> here</li></ul>
11575 <h3><span class="mw-headline" id="here">here</span></h3>
11576
11577 !! html/parsoid
11578 <!-- 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>
11579
11580 <meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/>
11581 <p>some</p>
11582 <meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"&lt;/noinclude>"}'/><ul><li> stuff</li>
11583 <li> here</li></ul>
11584
11585 <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>
11586
11587 !! end
11588
11589 # TODO: test with DOM fragment reuse!
11590 !! test
11591 Parsoid: DOM fragment reuse
11592 !! options
11593 parsoid=wt2wt,wt2html
11594 !! wikitext
11595 a{{echo|b<table></table>c}}d
11596
11597 a{{echo|b
11598 <table></table>
11599 c}}d
11600
11601 {{echo|a
11602
11603 <table></table>
11604
11605 b}}
11606 !! html
11607 <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>
11608
11609 <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">
11610 </span><table about="#mwt2" data-parsoid='{"stx":"html"}'></table><span about="#mwt2">
11611 </span><p about="#mwt2">cd</p>
11612
11613 <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">
11614
11615 </span><table about="#mwt3" data-parsoid='{"stx":"html"}'></table><span about="#mwt3">
11616
11617 </span><p about="#mwt3">b</p>
11618 !! end
11619
11620 !! test
11621 Parsoid: Merge double tds (T52603)
11622 !! options
11623 parsoid
11624 !! wikitext
11625 {|
11626 |{{echo|{{!}} foo}}
11627 |}
11628 !! html
11629 <table><tbody>
11630 <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>
11631 </tbody></table>
11632 !! end
11633
11634 !! test
11635 Parsoid: Merge double tds in nested transclusion content (T52603)
11636 !! options
11637 parsoid
11638 !! wikitext
11639 {{echo|<div>}}
11640 {|
11641 |{{echo|{{!}} foo}}
11642 |}
11643 {{echo|</div>}}
11644 !! html
11645 <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}}]}'>
11646 <table><tbody>
11647 <tr><td data-mw='{"parts":["|"]}'> foo</td></tr>
11648 </tbody></table>
11649 </div>
11650 !! end
11651
11652 ###
11653 ### <includeonly> and <noinclude> in attributes
11654 ###
11655 !!test
11656 0. includeonly around the entire attribute
11657 !! wikitext
11658 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
11659 !! html
11660 <p><span id="v2">bar</span>
11661 </p>
11662 !!end
11663
11664 !!test
11665 1. includeonly in html attr key
11666 !! wikitext
11667 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
11668 !! html
11669 <p><span id="foo">bar</span>
11670 </p>
11671 !!end
11672
11673 !!test
11674 2. includeonly in html attr value
11675 !! wikitext
11676 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
11677 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
11678 !! html
11679 <p><span id="v1">bar</span>
11680 <span id="v1">bar</span>
11681 </p>
11682 !!end
11683
11684 !!test
11685 3. includeonly in part of an attr value
11686 !! wikitext
11687 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
11688 !! html
11689 <p><span style="color:red;">bar</span>
11690 </p>
11691 !!end
11692
11693 !!test
11694 4. includeonly in table attributes
11695 !! wikitext
11696 {|
11697 |- <noinclude>
11698 |-
11699 |a
11700 </noinclude>
11701 |- <includeonly>
11702 |-
11703 |b
11704 </includeonly>
11705 |}
11706 !! html
11707 <table>
11708
11709
11710 <tr>
11711 <td>a
11712 </td></tr>
11713 </table>
11714
11715 !!end
11716
11717 ###
11718 ### Token Stream Patcher tests
11719 ###
11720 ### These tests won't always pass wt2wt and other modes because
11721 ### on serialization, the table will be output on a new line.
11722 ### For now, we are blacklisting them, and using this to test selser.
11723 ###
11724
11725 !!test
11726 1. Table tag in SOL posn. should get reparsed correctly with valid TSR
11727 !!options
11728 parsoid=wt2html,wt2wt
11729 !!wikitext
11730 {{echo|}}{| width = '100%'
11731 |foo
11732 |}
11733 !!html/parsoid
11734 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":""}},"i":0}}]}'></span><table width="100%">
11735 <tbody><tr><td>foo</td></tr>
11736 </tbody></table>
11737 !!end
11738
11739 ## We used to, but no longer wt2wt this test since the default serializer
11740 ## will normalize the include directives to serialize on their own line.
11741 ## Selser will take care of preserving formatting in scenarios where they
11742 ## intermingled with other wikitext.
11743 !!test
11744 2. Table tag in SOL posn. should get reparsed correctly with valid TSR
11745 !!options
11746 parsoid=wt2html
11747 !!wikitext
11748 <includeonly>a</includeonly>{| {{{b}}}
11749 |c
11750 |}
11751 !!html/parsoid
11752 <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":""}]]}'>
11753 <tbody><tr><td>c</td></tr>
11754 </tbody></table>
11755 !!end
11756
11757 !! test
11758 Table wikitext syntax outside wiki-tables
11759 !! wikitext
11760 a
11761 |+ not a caption
11762 ! not a table heading
11763 |- not a table row
11764 | not a table cell
11765 | class="foo bar" | baz
11766 b
11767 |}
11768 |-
11769 c
11770 !! html
11771 <p>a
11772 |+ not a caption
11773 ! not a table heading
11774 |- not a table row
11775 | not a table cell
11776 | class="foo bar" | baz
11777 b
11778 |}
11779 |-
11780 c
11781 </p>
11782 !! end
11783
11784 ###
11785 ### Testing parsing of templates where a template arg
11786 ### has the same name as the template itself.
11787 ###
11788
11789 !! article
11790 Template:quote
11791 !! text
11792 {{{quote|{{{1}}}}}}
11793 !! endarticle
11794
11795 !!test
11796 Templates: Template Name/Arg clash: 1. Use of positional param
11797 !! wikitext
11798 {{quote|foo}}
11799 !! html
11800 <p>foo
11801 </p>
11802 !!end
11803
11804 !!test
11805 Templates: Template Name/Arg clash: 2. Use of named param
11806 !! wikitext
11807 {{quote|quote=foo}}
11808 !! html
11809 <p>foo
11810 </p>
11811 !!end
11812
11813 !!test
11814 Templates: Template Name/Arg clash: 3. Use of named param with empty input
11815 !! wikitext
11816 {{quote|quote}}
11817 !! html
11818 <p>quote
11819 </p>
11820 !!end
11821
11822 ###
11823 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
11824 ###
11825
11826 !!test
11827 Templates: 1. Simple use
11828 !! wikitext
11829 {{echo|Foo}}
11830 !! html
11831 <p>Foo
11832 </p>
11833 !!end
11834
11835 !!test
11836 Templates: 2. Inside a block tag
11837 !! wikitext
11838 <div>{{echo|Foo}}</div>
11839 <blockquote>{{echo|Foo}}</blockquote>
11840 !! html
11841 <div>Foo</div>
11842 <blockquote>Foo</blockquote>
11843
11844 !! html+tidy
11845 <div>Foo</div>
11846 <blockquote>
11847 <p>Foo</p>
11848 </blockquote>
11849 !!end
11850
11851 !!test
11852 Templates: P-wrapping: 1a. Templates on consecutive lines
11853 !! wikitext
11854 {{echo|Foo}}
11855 {{echo|bar}}
11856 !! html
11857 <p>Foo
11858 bar
11859 </p>
11860 !!end
11861
11862 !!test
11863 Templates: P-wrapping: 1b. Templates on consecutive lines
11864 !! wikitext
11865 Foo
11866
11867 {{echo|bar}}
11868 {{echo|baz}}
11869 !! html
11870 <p>Foo
11871 </p><p>bar
11872 baz
11873 </p>
11874 !!end
11875
11876 !!test
11877 Templates: P-wrapping: 1c. Templates on consecutive lines
11878 !! wikitext
11879 {{echo|Foo}}
11880 {{echo|bar}} <div>baz</div>
11881 !! html
11882 <p>Foo
11883 </p>
11884 bar <div>baz</div>
11885
11886 !! html+tidy
11887 <p>Foo</p>
11888 <p>bar</p>
11889 <div>baz</div>
11890 !! end
11891
11892 !!test
11893 Templates: P-wrapping: 1d. Template preceded by comment-only line
11894 !!options
11895 parsoid
11896 !! wikitext
11897 <!-- foo -->
11898 {{echo|Bar}}
11899 !! html
11900 <!-- foo -->
11901
11902 <p about="#mwt223" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Bar"}},"i":0}}]}'>Bar</p>
11903 !!end
11904
11905 !!test
11906 Templates: Inline Text: 1. Multiple template uses
11907 !! wikitext
11908 {{echo|Foo}}bar{{echo|baz}}
11909 !! html
11910 <p>Foobarbaz
11911 </p>
11912 !!end
11913
11914 !!test
11915 Templates: Inline Text: 2. Back-to-back template uses
11916 !! wikitext
11917 {{echo|Foo}}{{echo|bar}}
11918 !! html
11919 <p>Foobar
11920 </p>
11921 !!end
11922
11923 !!test
11924 Templates: Block Tags: 1. Multiple template uses
11925 !! wikitext
11926 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
11927 !! html
11928 <div>Foo</div><div>bar</div><div>baz</div>
11929
11930 !!end
11931
11932 !!test
11933 Templates: Block Tags: 2. Back-to-back template uses
11934 !! wikitext
11935 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
11936 !! html
11937 <div>Foo</div><div>bar</div>
11938
11939 !!end
11940
11941 # This is an edge case relating to paragraph wrapping.
11942 !!test
11943 Templates: Correctly encapsulate templates producing </p> tag without a corresponding <p> tag
11944 !! wikitext
11945 {{echo|a
11946 b</p>}}
11947 !! html/parsoid
11948 <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
11949 b</p>
11950 !!end
11951
11952 !!test
11953 Templates: Links: 1. Simple example
11954 !! wikitext
11955 {{echo|[[Foo|bar]]}}
11956 !! html
11957 <p><a href="/wiki/Foo" title="Foo">bar</a>
11958 </p>
11959 !!end
11960
11961 !!test
11962 Templates: Links: 2. Generation of link href
11963 !! wikitext
11964 [[{{echo|Foo}}|bar]]
11965 !! html
11966 <p><a href="/wiki/Foo" title="Foo">bar</a>
11967 </p>
11968 !!end
11969
11970 !!test
11971 Templates: Links: 3. Generation of part of a link href
11972 !! wikitext
11973 [[Fo{{echo|o}}|bar]]
11974
11975 [[Foo{{echo|bar}}]]
11976
11977 [[Foo{{echo|bar}}baz]]
11978
11979 [[Foo{{echo|bar}}|bar]]
11980
11981 [[:Foo{{echo|bar}}]]
11982
11983 [[:Foo{{echo|bar}}|bar]]
11984 !! html
11985 <p><a href="/wiki/Foo" title="Foo">bar</a>
11986 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11987 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
11988 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
11989 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11990 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
11991 </p>
11992 !!end
11993
11994 !!test
11995 Templates: Links: 4. Multiple templates generating link href
11996 !! wikitext
11997 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
11998 !! html
11999 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
12000 </p>
12001 !!end
12002
12003 !!test
12004 Templates: Links: 5. Generation of link text
12005 !! wikitext
12006 [[Foo|{{echo|bar}}]]
12007 !! html
12008 <p><a href="/wiki/Foo" title="Foo">bar</a>
12009 </p>
12010 !!end
12011
12012 !!test
12013 Templates: Links: 5. Nested templates (only outermost template should be marked)
12014 !! wikitext
12015 {{echo|[[{{echo|Foo}}|bar]]}}
12016 !! html
12017 <p><a href="/wiki/Foo" title="Foo">bar</a>
12018 </p>
12019 !!end
12020
12021 !!test
12022 Templates: HTML Tag: 1. Generation of HTML attr. key
12023 !! wikitext
12024 <div {{echo|style}}="color:red;">foo</div>
12025 !! html
12026 <div style="color:red;">foo</div>
12027
12028 !!end
12029
12030 !!test
12031 Templates: HTML Tag: 2. Generation of HTML attr. value
12032 !! wikitext
12033 <div style={{echo|'color:red;'}}>foo</div>
12034 !! html
12035 <div style="color:red;">foo</div>
12036
12037 !!end
12038
12039 !!test
12040 Templates: HTML Tag: 3. Generation of HTML attr key and value
12041 !! wikitext
12042 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
12043 !! html
12044 <div style="color:red;">foo</div>
12045
12046 !!end
12047
12048 !!test
12049 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
12050 !! wikitext
12051 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
12052 !! html
12053 <div title="This is a long title with just one piece templated">foo</div>
12054
12055 !!end
12056
12057 !!test
12058 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
12059 !! wikitext
12060 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
12061 !! html
12062 <div title="This is a long title with just one piece templated">foo</div>
12063
12064 !!end
12065
12066 !!test
12067 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
12068 !! wikitext
12069 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
12070 !! html
12071 <div title="This is a long title with just one piece templated">foo</div>
12072
12073 !!end
12074
12075 # SSS FIXME: While it is great we added support for all this,
12076 # do we want to make this part of the spec? Maybe we want to
12077 # deprecate this kind of usage in the future?
12078 !!test
12079 Templates: HTML Tag: 7. Generation of partial attribute key string
12080 !! wikitext
12081 <div st{{echo|yle}}="color:red;">foo</div>
12082 !! html
12083 <div style="color:red;">foo</div>
12084
12085 !!end
12086
12087 !! test
12088 Templates: HTML Tag: 8. Template-generated attribute (k=v)
12089 !! wikitext
12090 <div {{echo|1=id="v1"}}>bar</div>
12091 !! html
12092 <div id="v1">bar</div>
12093
12094 !!end
12095
12096 !! test
12097 Templates: HTML Tag: 9. Multiple template-generated attributes
12098 !! wikitext
12099 <div {{echo|1=id="v1" title="foo"}}>bar</div>
12100 !! html
12101 <div id="v1" title="foo">bar</div>
12102
12103 !!end
12104
12105 !! test
12106 Templates: Support for templates generating attributes and content
12107 !! wikitext
12108 {| {{mixed_attr_content_template}}
12109 |-
12110 |bar
12111 |}
12112 !! html/php
12113 <table style="color:red;" title="T48811">
12114
12115 <tr>
12116 <td>foo
12117 </td></tr>
12118 <tr>
12119 <td>bar
12120 </td></tr></table>
12121
12122 !! html/parsoid
12123 <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|}"]}'>
12124 <tbody><tr>
12125 <td>foo</td></tr>
12126 <tr>
12127 <td>bar</td></tr>
12128 </tbody></table>
12129 !!end
12130
12131 !! test
12132 1. Entities and nowikis inside templated attributes should be handled correctly
12133 !! wikitext
12134 <div {{echo|style{{=}}"background:&#35;f9f9f9;"}}>foo</div>
12135 !! html/php
12136 <div style="background:#f9f9f9;">foo</div>
12137
12138 !! html/parsoid
12139 <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>
12140 !! end
12141
12142 !! test
12143 2. Entities and nowikis inside templated attributes should be handled correctly
12144 !! wikitext
12145 {|
12146 |{{table_attribs_3}}
12147 |}
12148 !! html/php
12149 <table>
12150 <tr>
12151 <td style="background:#f9f9f9;">Foo
12152 </td></tr></table>
12153
12154 !! html/parsoid
12155 <table>
12156 <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>
12157 </tbody></table>
12158 !! end
12159
12160 !! test
12161 3. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
12162 !! wikitext
12163 {{tbl-start}}
12164 |{{table_attribs_3}}
12165 {{tbl-end}}
12166 !! html/php
12167 <table>
12168 <tr>
12169 <td style="background:#f9f9f9;">Foo
12170 </td></tr></table>
12171
12172 !! html/parsoid
12173 <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}}]}'>
12174 <tbody><tr><td style="background:#f9f9f9;">Foo</td></tr>
12175 </tbody></table>
12176 !! end
12177
12178 # T107622
12179 !! test
12180 4. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
12181 !! wikitext
12182 {|
12183 | {{table_attribs_6}} hi
12184 |}
12185 !! html/php
12186 <table>
12187 <tr>
12188 <td style="background: red;"> hi
12189 </td></tr></table>
12190
12191 !! html/parsoid
12192 <table>
12193 <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>
12194 </tbody></table>
12195 !! end
12196
12197 !!test
12198 Templates: HTML Tables: 1. Generating start of a HTML table
12199 !! wikitext
12200 {{echo|<table><tr><td>foo</td>}}</tr></table>
12201 !! html
12202 <table><tr><td>foo</td></tr></table>
12203
12204 !!end
12205
12206 !!test
12207 Templates: HTML Tables: 2a. Generating middle of a HTML table
12208 !! wikitext
12209 <table><tr>{{echo|<td>foo</td>}}</tr></table>
12210 !! html
12211 <table><tr><td>foo</td></tr></table>
12212
12213 !!end
12214
12215 !!test
12216 Templates: HTML Tables: 2b. Generating middle of a HTML table
12217 !! wikitext
12218 <table>{{echo|<tr><td>foo</td></tr>}}</table>
12219 !! html
12220 <table><tr><td>foo</td></tr></table>
12221
12222 !!end
12223
12224 !!test
12225 Templates: HTML Tables: 3. Generating end of a HTML table
12226 !! wikitext
12227 <table><tr>{{echo|<td>foo</td></tr></table>}}
12228 !! html
12229 <table><tr><td>foo</td></tr></table>
12230
12231 !!end
12232
12233 !!test
12234 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
12235 !! wikitext
12236 {{echo|<table>}}<tr><td>foo</td></tr></table>
12237 !! html
12238 <table><tr><td>foo</td></tr></table>
12239
12240 !!end
12241
12242 !!test
12243 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
12244 !! wikitext
12245 <table>{{echo|<tr>}}<td>foo</td></tr></table>
12246 !! html
12247 <table><tr><td>foo</td></tr></table>
12248
12249 !!end
12250
12251 !!test
12252 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
12253 !! wikitext
12254 <table><tr>{{echo|<td>}}foo</td></tr></table>
12255 !! html
12256 <table><tr><td>foo</td></tr></table>
12257
12258 !!end
12259
12260 !!test
12261 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
12262 !! wikitext
12263 <table><tr><td>foo{{echo|</td>}}</tr></table>
12264 !! html
12265 <table><tr><td>foo</td></tr></table>
12266
12267 !!end
12268
12269 !!test
12270 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
12271 !! wikitext
12272 <table><tr><td>foo</td>{{echo|</tr>}}</table>
12273 !! html
12274 <table><tr><td>foo</td></tr></table>
12275
12276 !!end
12277
12278 !!test
12279 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
12280 !! wikitext
12281 <table><tr><td>foo</td></tr>{{echo|</table>}}
12282 !! html
12283 <table><tr><td>foo</td></tr></table>
12284
12285 !!end
12286
12287 !!test
12288 Templates: HTML Tables: 5. Proper fostering of categories from inside
12289 !!options
12290 parsoid=wt2html,wt2wt
12291 !! wikitext
12292 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
12293 <!--Two categories (T52330)-->
12294 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
12295 !! html
12296 <link rel="mw:PageProp/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
12297 <!--Two categories (T52330)-->
12298 <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>
12299 !!end
12300
12301 !!test
12302 Templates: Wiki Tables: 1a. Fostering of entire template content
12303 !! wikitext
12304 {|
12305 {{echo|a}}
12306 |}
12307 !! html
12308 <table>
12309 a
12310 <tr><td></td></tr></table>
12311
12312 !! html+tidy
12313 <p>a</p>
12314 <table>
12315 <tr>
12316 <td></td>
12317 </tr>
12318 </table>
12319 !! end
12320
12321 !!test
12322 Templates: Wiki Tables: 1b. Fostering of entire template content
12323 !! wikitext
12324 {|
12325 {{echo|<div>}}
12326 foo
12327 {{echo|</div>}}
12328 |}
12329 !! html
12330 <table>
12331 <div>
12332 <p>foo
12333 </p>
12334 </div>
12335 <tr><td></td></tr></table>
12336
12337 !! html+tidy
12338 <div>
12339 <p>foo</p>
12340 </div>
12341 <table>
12342 <tr>
12343 <td></td>
12344 </tr>
12345 </table>
12346 !! end
12347
12348 !!test
12349 Templates: Wiki Tables: 2. Fostering of partial template content
12350 !! wikitext
12351 {|
12352 {{echo|a
12353 <div>b</div>}}
12354 |}
12355 !! html
12356 <table>
12357 a
12358 <div>b</div>
12359 <tr><td></td></tr></table>
12360
12361 !! html+tidy
12362 <p>a</p>
12363 <div>b</div>
12364 <table>
12365 <tr>
12366 <td></td>
12367 </tr>
12368 </table>
12369 !! end
12370
12371 !!test
12372 Templates: Wiki Tables: 3. td-content via multiple templates
12373 !! wikitext
12374 {|
12375 {{echo|{{pipe}}a}}{{echo|b}}
12376 |}
12377 !! html
12378 <table>
12379 <tr>
12380 <td>ab
12381 </td></tr></table>
12382
12383 !!end
12384
12385 !!test
12386 Templates: Wiki Tables: 4. Templated tags, no content
12387 !! wikitext
12388 {{tbl-start}}
12389 {{tbl-end}}
12390 !! html
12391 <table>
12392 <tr><td></td></tr></table>
12393
12394 !!end
12395
12396 !!test
12397 Templates: Wiki Tables: 5. Templated tags, regular td-tags
12398 !! wikitext
12399 {{tbl-start}}
12400 |foo
12401 {{tbl-end}}
12402 !! html
12403 <table>
12404 <tr>
12405 <td>foo
12406 </td></tr></table>
12407
12408 !!end
12409
12410 !!test
12411 Templates: Wiki Tables: 6. Templated tags, templated td-tags
12412 !! wikitext
12413 {{tbl-start}}
12414 {{!}}foo
12415 {{tbl-end}}
12416 !! html
12417 <table>
12418 <tr>
12419 <td>foo
12420 </td></tr></table>
12421
12422 !!end
12423
12424 ## This test case is very specific to Parsoid's internals
12425 ## and is hence only tested for Parsoid's code. Parsoid uses
12426 ## a <meta> marker tag for <ref> tags and they are expanded
12427 ## much later. We are verifying that this <meta> tag usage
12428 ## doesn't prevent foster parenting.
12429 !!test
12430 Templates: Wiki Tables: 7. Fosterable <ref>s should get fostered
12431 !!wikitext
12432 {{PartialTable}}<ref>foo</ref>
12433 |}
12434
12435 <references />
12436 !!html/parsoid
12437 <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">
12438 <tbody>
12439 </tbody></table>
12440
12441 <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>
12442 !!end
12443
12444 !! test
12445 Templates: Wiki Tables: 8. Fosterable meta-tags should get fostered
12446 !! wikitext
12447 {{echo|
12448 {{{!}}
12449 {{!}}-}}
12450 <onlyinclude>
12451 |foo
12452 </onlyinclude>
12453 {{!}}}
12454 !! html/parsoid
12455 <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{{!}}}"]}'>
12456 </span><meta typeof="mw:Includes/OnlyInclude" about="#mwt1"/><table about="#mwt1">
12457 <tbody><tr>
12458
12459 <td>foo
12460 <meta typeof="mw:Includes/OnlyInclude/End"/></td></tr>
12461 </tbody></table>
12462 !! end
12463
12464 !!test
12465 Templates: Lists: Multi-line list-items via templates
12466 !! wikitext
12467 *{{echo|a {{nonexistent|
12468 unused}}}}
12469 *{{echo|b {{nonexistent|
12470 unused}}}}
12471 !! html
12472 <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>
12473 <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>
12474
12475 !!end
12476
12477 !!test
12478 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
12479 !! wikitext
12480 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
12481 !! html
12482 <p><i>ab</i>c<i>d</i>e
12483 </p>
12484 !!end
12485
12486 !!test
12487 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
12488 (PHP parser generates misnested html)
12489 !! wikitext
12490 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
12491 !! html/parsoid
12492 <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>
12493 !!end
12494
12495 !!test
12496 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
12497 (PHP parser generates misnested html; Parsoid html2wt mode adds newlines between {{echo}}s)
12498 !! options
12499 parsoid=wt2html,wt2wt
12500 !! wikitext
12501 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
12502 !! html
12503 <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>
12504 <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>
12505 <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>
12506 !!end
12507
12508 !!test
12509 Templates: Ugly nesting: 4. Divs opened/closed across templates
12510 !! wikitext
12511 a<div>b{{echo|c</div>d}}e
12512 !! html
12513 a<div>bc</div>de
12514
12515 !! html+tidy
12516 <p>a</p>
12517 <div>bc</div>
12518 <p>de</p>
12519 !! end
12520
12521 !!test
12522 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
12523 (Parsoid-centric)
12524 !! options
12525 parsoid
12526 !! wikitext
12527 {|
12528 |{{echo|foo</table>}}
12529 |bar
12530 |}
12531 !! html
12532 <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|}"]}'>
12533
12534 <tbody>
12535 <tr>
12536 <td>foo</td></tr></tbody></table><span about="#mwt1">
12537 </span><span about="#mwt1">|bar</span><span about="#mwt1">
12538 |}</span>
12539 !!end
12540
12541 !!test
12542 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
12543 (Parsoid-centric)
12544 !! options
12545 parsoid
12546 !! wikitext
12547 <table>
12548 <tr>
12549 <td>
12550 <table>
12551 <tr>
12552 <td>1. {{echo|foo </table>}}</td>
12553 <td> bar </td>
12554 <td>2. {{echo|baz </table>}}</td>
12555 </tr>
12556 <tr>
12557 <td>abc</td>
12558 </tr>
12559 </table>
12560 </td>
12561 </tr>
12562 <tr>
12563 <td>xyz</td>
12564 </tr>
12565 </table>
12566 !! html
12567 <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>"]}'>
12568 <tbody><tr>
12569 <td>
12570 <table>
12571 <tbody><tr>
12572 <td>1. foo </td></tr></tbody></table></td>
12573 <td> bar </td>
12574 <td>2. baz </td></tr></tbody></table><span about="#mwt2">
12575 </span><span about="#mwt2">
12576 </span><span about="#mwt2">
12577 </span><span about="#mwt2">abc</span><span about="#mwt2">
12578 </span><span about="#mwt2">
12579 </span><span about="#mwt2">
12580 </span><span about="#mwt2">
12581 </span><span about="#mwt2">
12582 </span><span about="#mwt2">
12583 </span><span about="#mwt2">xyz</span><span about="#mwt2">
12584 </span><span about="#mwt2">
12585 </span>
12586 !!end
12587
12588 !! test
12589 Templates: Ugly templates: 3. newline-only template parameter
12590 !! wikitext
12591 foo {{echo|
12592 }}
12593 !! html
12594 <p>foo
12595 </p>
12596 !! end
12597
12598 # This looks like a bug: a single newline triggers p/br for some reason.
12599 !! test
12600 Templates: Ugly templates: 4. newline-only template parameter inconsistency
12601 !! wikitext
12602 {{echo|
12603 }}
12604 !! html
12605 <p><br />
12606 </p>
12607 !! end
12608
12609 # T66017 -- ugly wikitext with fostered content generates two template ranges that
12610 # have a true overlap (T1-start - T2-start - T1-end - T2-end).
12611 !! test
12612 Templates: Ugly templates: 5. Template encapsulation test: Non-trivial overlap of template ranges is properly handled
12613 !! wikitext
12614 {{echo|<table>}}
12615 {{echo|<div>foo}}
12616 {{echo|</table>}}
12617 !! html/parsoid
12618 <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
12619 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
12620 </table>
12621 !! end
12622
12623 # T66017 -- ugly wikitext with fostered content generates two template ranges
12624 # that are "identical" and generate nesting cycles in the algorithm
12625 !! test
12626 Templates: Ugly templates: 6. Template encapsulation test: Cyclical nesting of template ranges is properly handled
12627 !! wikitext
12628 {{echo|<table><tr><td><table>}}
12629 {{echo|<div>}}
12630 {{echo|</div>}}
12631 !! html/parsoid
12632 <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"}'>
12633 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
12634 </table></td></tr></tbody></table>
12635 !! end
12636
12637 !! test
12638 Templates: Parameters substituted at the top-level
12639 !! wikitext
12640 {{{foo|''who'' {{echo|me}}? '''never!'''}}}
12641
12642 {{{foo|bar|baz}}}
12643 !! html/php
12644 <p><i>who</i> me? <b>never!</b>
12645 </p><p>bar
12646 </p>
12647 !! html/parsoid
12648 <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>
12649
12650 <p about="#mwt3" typeof="mw:Param" data-mw='{"parts":[{"templatearg":{"target":{"wt":"foo"},"params":{"1":{"wt":"bar"},"2":{"wt":"baz"}},"i":0}}]}'>bar</p>
12651 !! end
12652
12653 !!test
12654 Parser Functions: 1. Simple example
12655 !! wikitext
12656 {{uc:foo}}
12657 !! html
12658 <p>FOO
12659 </p>
12660 !!end
12661
12662 !!test
12663 Parser Functions: 2. Nested use (only outermost should be marked up)
12664 !! wikitext
12665 {{uc:{{lc:FOO}}}}
12666 !! html
12667 <p>FOO
12668 </p>
12669 !!end
12670
12671 ###
12672 ### Pre-save transform tests
12673 ###
12674 !! test
12675 pre-save transform: subst:
12676 !! options
12677 pst
12678 !! wikitext
12679 {{subst:test}}
12680 !! html/php
12681 This is a test template
12682 !! end
12683
12684 !! test
12685 pre-save transform: normal template
12686 !! options
12687 pst
12688 !! wikitext
12689 {{test}}
12690 !! html/php
12691 {{test}}
12692 !! end
12693
12694 !! test
12695 pre-save transform: nonexistent template
12696 !! options
12697 pst
12698 !! wikitext
12699 {{thistemplatedoesnotexist}}
12700 !! html/php
12701 {{thistemplatedoesnotexist}}
12702 !! end
12703
12704 !! test
12705 pre-save transform: subst magic variables
12706 !! options
12707 pst
12708 !! wikitext
12709 {{subst:SITENAME}}
12710 !! html/php
12711 MediaWiki
12712 !! end
12713
12714 # This is T2089, which I fixed. -- wtm
12715 !! test
12716 pre-save transform: subst: templates with parameters
12717 !! options
12718 pst
12719 !! wikitext
12720 {{subst:paramtest|param="something else"}}
12721 !! html/php
12722 This is a test template with parameter "something else"
12723 !! end
12724
12725 !! article
12726 Template:nowikitest
12727 !! text
12728 <nowiki>'''not wiki'''</nowiki>
12729 !! endarticle
12730
12731 !! test
12732 pre-save transform: nowiki in subst (T3188)
12733 !! options
12734 pst
12735 !! wikitext
12736 {{subst:nowikitest}}
12737 !! html/php
12738 <nowiki>'''not wiki'''</nowiki>
12739 !! end
12740
12741 !! article
12742 Template:commenttest
12743 !! text
12744 This template has <!-- a comment --> in it.
12745 !! endarticle
12746
12747 !! test
12748 pre-save transform: comment in subst (T3936)
12749 !! options
12750 pst
12751 !! wikitext
12752 {{subst:commenttest}}
12753 !! html/php
12754 This template has <!-- a comment --> in it.
12755 !! end
12756
12757 !! test
12758 pre-save transform: unclosed tag
12759 !! options
12760 pst
12761 !! wikitext
12762 <nowiki>'''not wiki'''
12763 !! html/php
12764 <nowiki>'''not wiki'''
12765 !! end
12766
12767 !! test
12768 pre-save transform: mixed tag case
12769 !! options
12770 pst
12771 !! wikitext
12772 <NOwiki>'''not wiki'''</noWIKI>
12773 !! html/php
12774 <NOwiki>'''not wiki'''</noWIKI>
12775 !! end
12776
12777 !! test
12778 pre-save transform: unclosed comment in <nowiki>
12779 !! options
12780 pst
12781 !! wikitext
12782 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
12783 !! html/php
12784 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
12785 !!end
12786
12787 # Leading @ in this template definition works around a limitation
12788 # in parsoid's parserTests which otherwise strips the <span> from the
12789 # result (confusing it for a template wrapper)
12790 !! article
12791 Template:dangerous
12792 !!text
12793 @<span onmouseover="alert('crap')">Oh no</span>
12794 !!endarticle
12795
12796 !!test
12797 (confirming safety of fix for subst T3936)
12798 !! wikitext
12799 {{Template:dangerous}}
12800 !! html
12801 <p>@<span>Oh no</span>
12802 </p>
12803 !! end
12804
12805 !! test
12806 pre-save transform: comment containing gallery (T7024)
12807 !! options
12808 pst
12809 !! wikitext
12810 <!-- <gallery>data</gallery> -->
12811 !! html/php
12812 <!-- <gallery>data</gallery> -->
12813 !!end
12814
12815 !! test
12816 pre-save transform: comment containing extension
12817 !! options
12818 pst
12819 !! wikitext
12820 <!-- <tag>data</tag> -->
12821 !! html/php
12822 <!-- <tag>data</tag> -->
12823 !!end
12824
12825 !! test
12826 pre-save transform: comment containing nowiki
12827 !! options
12828 pst
12829 !! wikitext
12830 <!-- <nowiki>data</nowiki> -->
12831 !! html/php
12832 <!-- <nowiki>data</nowiki> -->
12833 !!end
12834
12835 !! test
12836 pre-save transform: <noinclude> in subst (T5298)
12837 !! options
12838 pst
12839 !! wikitext
12840 {{subst:Includes}}
12841 !! html/php
12842 Foobar
12843 !! end
12844
12845 !! test
12846 pre-save transform: <onlyinclude> in subst (T5298)
12847 !! options
12848 pst
12849 !! wikitext
12850 {{subst:Includes2}}
12851 !! html/php
12852 Foo
12853 !! end
12854
12855 !! article
12856 Template:SubstTest
12857 !!text
12858 {{<includeonly>subst:</includeonly>Includes}}
12859 !! endarticle
12860
12861 !! article
12862 Template:SafeSubstTest
12863 !! text
12864 {{<includeonly>safesubst:</includeonly>Includes}}
12865 !! endarticle
12866
12867 !! test
12868 T24297: safesubst: works during PST
12869 !! options
12870 pst
12871 !! wikitext
12872 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
12873 !! html/php
12874 FoobarFoobar
12875 !! end
12876
12877 !! test
12878 T24297: safesubst: works during normal parse
12879 !! wikitext
12880 {{SafeSubstTest}}
12881 !! html
12882 <p>Foobar
12883 </p>
12884 !! end
12885
12886 !! test
12887 subst: does not work during normal parse
12888 !! wikitext
12889 {{SubstTest}}
12890 !! html
12891 <p>{{subst:Includes}}
12892 </p>
12893 !! end
12894
12895 !! test
12896 pre-save transform: context links ("pipe trick")
12897 !! options
12898 pst
12899 !! wikitext
12900 [[Article (context)|]]
12901 [[Bar:Article|]]
12902 [[:Bar:Article|]]
12903 [[Bar:Article (context)|]]
12904 [[:Bar:Article (context)|]]
12905 [[|Article]]
12906 [[|Article (context)]]
12907 [[Bar:X (Y) Z|]]
12908 [[:Bar:X (Y) Z|]]
12909 !! html/php
12910 [[Article (context)|Article]]
12911 [[Bar:Article|Article]]
12912 [[:Bar:Article|Article]]
12913 [[Bar:Article (context)|Article]]
12914 [[:Bar:Article (context)|Article]]
12915 [[Article]]
12916 [[Article (context)]]
12917 [[Bar:X (Y) Z|X (Y) Z]]
12918 [[:Bar:X (Y) Z|X (Y) Z]]
12919 !! end
12920
12921 !! test
12922 pre-save transform: context links ("pipe trick") with interwiki prefix
12923 !! options
12924 pst
12925 !! wikitext
12926 [[interwiki:Article|]]
12927 [[:interwiki:Article|]]
12928 [[interwiki:Bar:Article|]]
12929 [[:interwiki:Bar:Article|]]
12930 !! html/php
12931 [[interwiki:Article|Article]]
12932 [[:interwiki:Article|Article]]
12933 [[interwiki:Bar:Article|Bar:Article]]
12934 [[:interwiki:Bar:Article|Bar:Article]]
12935 !! end
12936
12937 !! test
12938 pre-save transform: context links ("pipe trick") with parens in title
12939 !! options
12940 pst title=[[Somearticle (context)]]
12941 !! wikitext
12942 [[|Article]]
12943 !! html/php
12944 [[Article (context)|Article]]
12945 !! end
12946
12947 !! test
12948 pre-save transform: context links ("pipe trick") with comma in title
12949 !! options
12950 pst title=[[Someplace, Somewhere]]
12951 !! wikitext
12952 [[|Otherplace]]
12953 [[Otherplace, Elsewhere|]]
12954 [[Otherplace, Elsewhere, Anywhere|]]
12955 !! html/php
12956 [[Otherplace, Somewhere|Otherplace]]
12957 [[Otherplace, Elsewhere|Otherplace]]
12958 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
12959 !! end
12960
12961 !! test
12962 pre-save transform: context links ("pipe trick") with parens and comma
12963 !! options
12964 pst title=[[Someplace (IGNORED), Somewhere]]
12965 !! wikitext
12966 [[|Otherplace]]
12967 [[Otherplace (place), Elsewhere|]]
12968 !! html/php
12969 [[Otherplace, Somewhere|Otherplace]]
12970 [[Otherplace (place), Elsewhere|Otherplace]]
12971 !! end
12972
12973 !! test
12974 pre-save transform: context links ("pipe trick") with comma and parens
12975 !! options
12976 pst title=[[Who, me? (context)]]
12977 !! wikitext
12978 [[|Yes, you.]]
12979 [[Me, Myself, and I (1937 song)|]]
12980 !! html/php
12981 [[Yes, you. (context)|Yes, you.]]
12982 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
12983 !! end
12984
12985 !! test
12986 pre-save transform: context links ("pipe trick") with namespace
12987 !! options
12988 pst title=[[Ns:Somearticle]]
12989 !! wikitext
12990 [[|Article]]
12991 !! html/php
12992 [[Ns:Article|Article]]
12993 !! end
12994
12995 !! test
12996 pre-save transform: context links ("pipe trick") with namespace and parens
12997 !! options
12998 pst title=[[Ns:Somearticle (context)]]
12999 !! wikitext
13000 [[|Article]]
13001 !! html/php
13002 [[Ns:Article (context)|Article]]
13003 !! end
13004
13005 !! test
13006 pre-save transform: context links ("pipe trick") with namespace and comma
13007 !! options
13008 pst title=[[Ns:Somearticle, Context, Whatever]]
13009 !! wikitext
13010 [[|Article]]
13011 !! html/php
13012 [[Ns:Article, Context, Whatever|Article]]
13013 !! end
13014
13015 !! test
13016 pre-save transform: context links ("pipe trick") with namespace, comma and parens
13017 !! options
13018 pst title=[[Ns:Somearticle, Context (context)]]
13019 !! wikitext
13020 [[|Article]]
13021 !! html/php
13022 [[Ns:Article (context)|Article]]
13023 !! end
13024
13025 !! test
13026 pre-save transform: context links ("pipe trick") with namespace, parens and comma
13027 !! options
13028 pst title=[[Ns:Somearticle (IGNORED), Context]]
13029 !! wikitext
13030 [[|Article]]
13031 !! html/php
13032 [[Ns:Article, Context|Article]]
13033 !! end
13034
13035 !! test
13036 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, T32149)
13037 !! options
13038 pst
13039 !! wikitext
13040 [[Article(context)|]]
13041 [[Bar:Article(context)|]]
13042 [[:Bar:Article(context)|]]
13043 [[|Article(context)]]
13044 [[Bar:X(Y)Z|]]
13045 [[:Bar:X(Y)Z|]]
13046 !! html/php
13047 [[Article(context)|Article]]
13048 [[Bar:Article(context)|Article]]
13049 [[:Bar:Article(context)|Article]]
13050 [[Article(context)]]
13051 [[Bar:X(Y)Z|X(Y)Z]]
13052 [[:Bar:X(Y)Z|X(Y)Z]]
13053 !! end
13054
13055 !! test
13056 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, T32149)
13057 !! options
13058 pst
13059 !! wikitext
13060 [[Article (context)|]]
13061 [[Bar:Article (context)|]]
13062 [[:Bar:Article (context)|]]
13063 [[|Article (context)]]
13064 [[Bar:X (Y) Z|]]
13065 [[:Bar:X (Y) Z|]]
13066 !! html/php
13067 [[Article (context)|Article]]
13068 [[Bar:Article (context)|Article]]
13069 [[:Bar:Article (context)|Article]]
13070 [[Article (context)]]
13071 [[Bar:X (Y) Z|X (Y) Z]]
13072 [[:Bar:X (Y) Z|X (Y) Z]]
13073 !! end
13074
13075 !! test
13076 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, T32149)
13077 !! options
13078 pst
13079 !! wikitext
13080 [[Article(context)|]]
13081 [[Bar:Article(context)|]]
13082 [[:Bar:Article(context)|]]
13083 [[|Article(context)]]
13084 [[Bar:X(Y)Z|]]
13085 [[:Bar:X(Y)Z|]]
13086 !! html/php
13087 [[Article(context)|Article]]
13088 [[Bar:Article(context)|Article]]
13089 [[:Bar:Article(context)|Article]]
13090 [[Article(context)]]
13091 [[Bar:X(Y)Z|X(Y)Z]]
13092 [[:Bar:X(Y)Z|X(Y)Z]]
13093 !! end
13094
13095 !! test
13096 pre-save transform: context links ("pipe trick") with commas (T23660)
13097 !! options
13098 pst
13099 !! wikitext
13100 [[Article (context), context|]]
13101 [[Article (context),context|]]
13102 [[Bar:Article (context), context|]]
13103 [[Bar:Article (context),context|]]
13104 [[:Bar:Article (context), context|]]
13105 [[:Bar:Article (context),context|]]
13106 !! html/php
13107 [[Article (context), context|Article]]
13108 [[Article (context),context|Article]]
13109 [[Bar:Article (context), context|Article]]
13110 [[Bar:Article (context),context|Article]]
13111 [[:Bar:Article (context), context|Article]]
13112 [[:Bar:Article (context),context|Article]]
13113 !! end
13114
13115 !! test
13116 pre-save transform: trim trailing empty lines
13117 !! options
13118 pst
13119 !! wikitext
13120 Empty lines are trimmed
13121
13122
13123
13124
13125 !! html/php
13126 Empty lines are trimmed
13127 !! end
13128
13129 !! test
13130 pre-save transform: Signature expansion
13131 !! options
13132 pst
13133 !! wikitext
13134 * ~~~
13135 * <noinclude>~~~</noinclude>
13136 * <includeonly>~~~</includeonly>
13137 * <onlyinclude>~~~</onlyinclude>
13138 !! html/php
13139 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
13140 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
13141 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
13142 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
13143 !! end
13144
13145
13146 !! test
13147 pre-save transform: Signature expansion in nowiki tags (T2093)
13148 !! options
13149 pst disabled
13150 !! wikitext
13151 Shall not expand:
13152
13153 <nowiki>~~~~</nowiki>
13154
13155 <includeonly><nowiki>~~~~</nowiki></includeonly>
13156
13157 <noinclude><nowiki>~~~~</nowiki></noinclude>
13158
13159 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
13160
13161 {{subst:Foo}} shall be converted to FOO
13162
13163 As well as inside noinclude/onlyinclude
13164 <noinclude>{{subst:Foo}}</noinclude>
13165 <onlyinclude>{{subst:Foo}}</onlyinclude>
13166
13167 But not inside includeonly
13168 <includeonly>{{subst:Foo}}</includeonly>
13169 !! html/php
13170 Shall not expand:
13171
13172 <nowiki>~~~~</nowiki>
13173
13174 <includeonly><nowiki>~~~~</nowiki></includeonly>
13175
13176 <noinclude><nowiki>~~~~</nowiki></noinclude>
13177
13178 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
13179
13180 FOO shall be converted to FOO
13181
13182 As well as inside noinclude/onlyinclude
13183 <noinclude>FOO</noinclude>
13184 <onlyinclude>FOO</onlyinclude>
13185
13186 But not inside includeonly
13187 <includeonly>{{subst:Foo}}</includeonly>
13188 !! end
13189
13190 !! test
13191 Parsoid: Recognize nowiki with trailing space in tags
13192 !! options
13193 parsoid=wt2html
13194 !! wikitext
13195 <nowiki ><div>[[foo]]</nowiki >
13196
13197 a<nowiki / >b
13198
13199 c<nowiki />d
13200
13201 e<nowiki/ >f
13202 !! html
13203 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
13204 <p>ab</p>
13205 <p>cd</p>
13206 <p>ef</p>
13207 !! end
13208
13209 !! test
13210 Parsoid: Recognize nowiki with odd capitalization
13211 !! options
13212 parsoid=wt2html
13213 !! wikitext
13214 <noWikI ><div>[[foo]]</Nowiki >
13215 !! html
13216 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
13217 !! end
13218
13219
13220 !! test
13221 Parsoid: Escape nowiki with trailing space in tags
13222 !! options
13223 parsoid=html2wt
13224 !! html/parsoid
13225 <p>&lt;nowiki &gt; foo &lt/nowiki ></p>
13226 <p>a&lt;nowiki /&gt;b</p>
13227 <p>c&lt;nowiki/ &gt;d</p>
13228 !! wikitext
13229 &lt;nowiki &gt; foo &lt;/nowiki &gt;
13230
13231 a&lt;nowiki /&gt;b
13232
13233 c&lt;nowiki/ &gt;d
13234 !! end
13235
13236 !! test
13237 Parsoid: Escape weird noWikI capitalizations
13238 !! options
13239 parsoid=html2wt
13240 !! html/parsoid
13241 <p>&lt;noWikI &gt; foo &lt/NoWikI ></p>
13242 !! wikitext
13243 &lt;noWikI &gt; foo &lt;/NoWikI &gt;
13244 !! end
13245
13246 ###
13247 ### Message transform tests
13248 ###
13249 !! test
13250 message transform: magic variables
13251 !! options
13252 msg
13253 !! wikitext
13254 {{SITENAME}}
13255 !! html
13256 MediaWiki
13257 !! end
13258
13259 !! test
13260 message transform: should not transform wiki markup
13261 !! options
13262 msg
13263 !! wikitext
13264 ''test''
13265 !! html
13266 ''test''
13267 !! end
13268
13269 !! test
13270 message transform: <noinclude> in transcluded template (T6926)
13271 !! options
13272 msg
13273 !! wikitext
13274 {{Includes}}
13275 !! html
13276 Foobar
13277 !! end
13278
13279 !! test
13280 message transform: <onlyinclude> in transcluded template (T6926)
13281 !! options
13282 msg
13283 !! wikitext
13284 {{Includes2}}
13285 !! html
13286 Foo
13287 !! end
13288
13289 !! test
13290 {{#special:}} page name, known
13291 !! options
13292 msg
13293 !! wikitext
13294 {{#special:Recentchanges}}
13295 !! html
13296 Special:RecentChanges
13297 !! end
13298
13299 !! test
13300 {{#special:}} page name with subpage, known
13301 !! options
13302 msg
13303 !! wikitext
13304 {{#special:Recentchanges/param}}
13305 !! html
13306 Special:RecentChanges/param
13307 !! end
13308
13309 !! test
13310 {{#special:}} page name, unknown
13311 !! options
13312 msg
13313 !! wikitext
13314 {{#special:foobar nonexistent}}
13315 !! html
13316 Special:Foobar nonexistent
13317 !! end
13318
13319 !! test
13320 {{#speciale:}} page name, known
13321 !! options
13322 msg
13323 !! wikitext
13324 {{#speciale:Recentchanges}}
13325 !! html
13326 Special:RecentChanges
13327 !! end
13328
13329 !! test
13330 {{#speciale:}} page name with subpage, known
13331 !! options
13332 msg
13333 !! wikitext
13334 {{#speciale:Recentchanges/param}}
13335 !! html
13336 Special:RecentChanges/param
13337 !! end
13338
13339 !! test
13340 {{#speciale:}} page name, unknown
13341 !! options
13342 msg
13343 !! wikitext
13344 {{#speciale:foobar nonexistent}}
13345 !! html
13346 Special:Foobar_nonexistent
13347 !! end
13348
13349 ###
13350 ### Images
13351 ###
13352 ### For Parsoid-specific tests, see
13353 #### https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
13354
13355 !! test
13356 Simple image
13357 !! options
13358 parsoid=wt2html,wt2wt,html2html
13359 !! wikitext
13360 [[Image:foobar.jpg]]
13361 !! html/php
13362 <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>
13363 </p>
13364 !! html/parsoid
13365 <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>
13366 !! end
13367
13368 !! test
13369 Simple image (using File: namespace, now canonical)
13370 !! wikitext
13371 [[File:Foobar.jpg]]
13372 !! html/php
13373 <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>
13374 </p>
13375 !! html/parsoid
13376 <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>
13377 !! end
13378
13379 !! test
13380 Right-aligned image
13381 !! wikitext
13382 [[File:Foobar.jpg|right]]
13383 !! html/php
13384 <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>
13385
13386 !! html/parsoid
13387 <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>
13388 !! end
13389
13390 !! test
13391 Image with caption
13392 !! wikitext
13393 [[File:Foobar.jpg|right|Caption text]]
13394 !! html/php
13395 <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>
13396
13397 !! html/parsoid
13398 <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>
13399 !! end
13400
13401 !! test
13402 Image with caption, T55312 #1
13403 !! wikitext
13404 [[File:Foobar.jpg|right|Caption page stuff]]
13405 !! html/php
13406 <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>
13407
13408 !! html/parsoid
13409 <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>
13410 !! end
13411
13412 !! test
13413 Image with caption, T55312 #2
13414 !! wikitext
13415 [[File:Foobar.jpg|right|Caption page=]]
13416 !! html/php
13417 <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>
13418
13419 !! html/parsoid
13420 <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>
13421 !! end
13422
13423 !! test
13424 Image with caption, T55312 #3
13425 !! wikitext
13426 [[File:Foobar.jpg|right|Caption page=stuff]]
13427 !! html/php
13428 <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>
13429
13430 !! html/parsoid
13431 <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>
13432 !! end
13433
13434 !! test
13435 Allow empty links in image captions (T62753)
13436 !! options
13437 thumbsize=220
13438 !! wikitext
13439 [[File:Foobar.jpg|thumb|Caption [[Link1]]
13440 [[]]
13441 [[Link2]]
13442 ]]
13443 !! html/php
13444 <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>
13445
13446 !! html/parsoid
13447 <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>
13448 [[]]
13449 <a rel="mw:WikiLink" href="./Link2" title="Link2" data-parsoid='{"stx":"simple","a":{"href":"./Link2"},"sa":{"href":"Link2"}}'>Link2</a>
13450 </figcaption></figure>
13451 !! end
13452
13453 !! test
13454 Titles in unlinked images (T23454)
13455 !! wikitext
13456 [[File:Foobar.jpg|link=|stuff]]
13457 !! html/php
13458 <p><img alt="stuff" src="http://example.com/images/3/3a/Foobar.jpg" title="stuff" width="1941" height="220" />
13459 </p>
13460 !! end
13461
13462 !! test
13463 Link with empty target
13464 !! wikitext
13465 [[]]
13466 !! html
13467 <p>[[]]
13468 </p>
13469 !! end
13470
13471 !! test
13472 Image with link trail
13473 !! wikitext
13474 Linktrails should not work for images: [[File:Foobar.jpg]]s
13475 !! html/php
13476 <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
13477 </p>
13478 !! html/parsoid
13479 <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>
13480 !! end
13481
13482 !! test
13483 Image with empty attribute
13484 !! options
13485 parsoid=wt2html,wt2wt,html2html
13486 !! wikitext
13487 [[File:Foobar.jpg|right||Caption text]]
13488 !! html/php
13489 <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>
13490
13491 !! html/parsoid
13492 <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>
13493 !! end
13494
13495 !! test
13496 1. Block image with individual attributes from templates
13497 !! wikitext
13498 [[File:Foobar.jpg|thumb|{{echo|137px}}|This is a caption]]
13499 !! html/php
13500 <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>
13501
13502 !! html/parsoid
13503 <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>
13504 !! end
13505
13506 !! test
13507 2. Block Image with individual attributes from templates
13508 !! wikitext
13509 [[File:Foobar.jpg|{{echo|thumb}}|{{echo|137px}}|This is a caption]]
13510 !! html/php
13511 <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>
13512
13513 !! html/parsoid
13514 <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>
13515 !! end
13516
13517 !! test
13518 3. Inline image with individual attributes from templates
13519 !! wikitext
13520 [[File:Foobar.jpg|{{echo|50px}}]]
13521 !! html/php
13522 <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>
13523 </p>
13524 !! html/parsoid
13525 <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>
13526 !! end
13527
13528 ## Parsoid does not provide editing support for images where templates produce multiple image attributes.
13529 ## To signal this, we add a 'mw:Placeholder' type to such images. This could change in the future.
13530 !! test
13531 Image with multiple attributes from the same template
13532 !! wikitext
13533 [[File:Foobar.jpg|{{image_attribs}}]]
13534 !! html/php
13535 <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>
13536
13537 !! html/parsoid
13538 <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>
13539 !! end
13540
13541 !! test
13542 Image with link tails
13543 !! options
13544 thumbsize=220
13545 !! wikitext
13546 123[[File:Foobar.jpg]]456
13547 123[[File:Foobar.jpg|right]]456
13548 123[[File:Foobar.jpg|thumb]]456
13549 !! html/php
13550 <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
13551 </p>
13552 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
13553 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
13554
13555 !! html/php+tidy
13556 <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>
13557 <p>123</p>
13558 <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>
13559 <p>456 123</p>
13560 <div class="thumb tright">
13561 <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>
13562 <div class="thumbcaption">
13563 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
13564 </div>
13565 </div>
13566 </div>
13567 <p>456</p>
13568 !! html/parsoid
13569 <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>
13570 <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>
13571 <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>
13572 !! end
13573
13574 !! test
13575 Image with multiple captions -- only last one is accepted
13576 !! wikitext
13577 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
13578 !! html/php
13579 <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>
13580
13581 !! html/parsoid
13582 <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>
13583 !! end
13584
13585 !! test
13586 Image with multiple widths -- use last
13587 !! wikitext
13588 [[File:Foobar.jpg|200px|300px|caption]]
13589 !! html/php
13590 <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>
13591 </p>
13592 !! html/parsoid
13593 <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>
13594 !! end
13595
13596 !! test
13597 Image with multiple alignments -- use first (T50664)
13598 !! options
13599 thumbsize=220
13600 !! wikitext
13601 [[File:Foobar.jpg|thumb|left|right|center|caption]]
13602
13603 [[File:Foobar.jpg|middle|text-top|caption]]
13604 !! html/php
13605 <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>
13606 <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>
13607 </p>
13608 !! html/parsoid
13609 <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>
13610 <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>
13611 !! end
13612
13613 !! test
13614 Image with width attribute at different positions
13615 !! wikitext
13616 [[File:Foobar.jpg|200px|right|Caption]]
13617 [[File:Foobar.jpg|right|200px|Caption]]
13618 [[File:Foobar.jpg|right|Caption|200px]]
13619 !! html/php
13620 <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>
13621 <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>
13622 <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>
13623
13624 !! html/parsoid
13625 <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>
13626 <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>
13627 <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>
13628 !! end
13629
13630 # a sad bit of backward-compatibility
13631 !! test
13632 Image with size specified with pxpx (T15500, T53628)
13633 !! options
13634 parsoid=wt2html,wt2wt,html2html
13635 !! wikitext
13636 [[File:Foobar.jpg|20pxpx]]
13637 [[File:Foobar.jpg|200x20pxpx]]
13638 !! html/php
13639 <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>
13640 <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>
13641 </p>
13642 !! html/parsoid
13643 <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>
13644 !! end
13645
13646 !! test
13647 Image with link parameter, wiki target
13648 !! wikitext
13649 [[File:Foobar.jpg|link=Main Page]]
13650 !! html/php
13651 <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>
13652 </p>
13653 !! html/parsoid
13654 <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>
13655 !! end
13656
13657 # parsoid T51293 (part 1)
13658 !! test
13659 Image with link parameter, URL target
13660 !! wikitext
13661 [[File:Foobar.jpg|link=http://example.com/]]
13662 !! html/php
13663 <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>
13664 </p>
13665 !! html/parsoid
13666 <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>
13667 !! end
13668
13669 # parsoid T51293 (part 2)
13670 !! test
13671 Image with link parameter, protocol-less URL target
13672 !! wikitext
13673 [[File:Foobar.jpg|link=//example.com/]]
13674 !! html/php
13675 <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>
13676 </p>
13677 !! html/parsoid
13678 <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>
13679 !! end
13680
13681 !! test
13682 Escaping non-block captions (T107435)
13683 !! options
13684 parsoid={
13685 "modes": ["wt2wt"],
13686 "changes": [
13687 ["[typeof~='mw:Image']", "attr", "data-mw", "{\"caption\": \"|\"}"]
13688 ]
13689 }
13690 !! wikitext
13691 [[Image:Foobar.jpg|caption]]
13692 !! wikitext/edited
13693 [[Image:Foobar.jpg|<nowiki>|</nowiki>]]
13694 !! end
13695
13696 # wgExternalLinkTarget not supported by Parsoid
13697 !! test
13698 Image with link parameter, wgExternalLinkTarget
13699 !! wikitext
13700 [[Image:foobar.jpg|link=http://example.com/]]
13701 !! config
13702 wgExternalLinkTarget='foobar'
13703 !! html/php
13704 <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>
13705 </p>
13706 !! end
13707
13708 !! test
13709 Image with link parameter, wgNoFollowLinks set to false
13710 !! wikitext
13711 [[Image:foobar.jpg|link=http://example.com/]]
13712 !! config
13713 wgNoFollowLinks=false
13714 !! html
13715 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
13716 </p>
13717 !! end
13718
13719 !! test
13720 Image with link parameter, wgNoFollowDomainExceptions
13721 !! wikitext
13722 [[Image:foobar.jpg|link=http://example.com/]]
13723 !! config
13724 wgNoFollowDomainExceptions='example.com'
13725 !! html
13726 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
13727 </p>
13728 !! end
13729
13730 # wgExternalLinkTarget not supported by Parsoid
13731 !! test
13732 Image with link parameter, wgExternalLinkTarget, unnamed parameter
13733 !! wikitext
13734 [[Image:foobar.jpg|link=http://example.com/|Title]]
13735 !! config
13736 wgExternalLinkTarget='foobar'
13737 !! html/php
13738 <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>
13739 </p>
13740 !! end
13741
13742 !! test
13743 Image with empty link parameter
13744 !! wikitext
13745 [[File:Foobar.jpg|link=]]
13746 !! html/php
13747 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
13748 </p>
13749 !! html/parsoid
13750 <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>
13751 !! end
13752
13753 !! test
13754 Image with link parameter (wiki target) and unnamed parameter
13755 !! wikitext
13756 [[File:Foobar.jpg|link=Main_Page|Title]]
13757 !! html/php
13758 <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>
13759 </p>
13760 !! html/parsoid
13761 <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>
13762 !! end
13763
13764 !! test
13765 Image with link parameter (URL target) and unnamed parameter
13766 !! wikitext
13767 [[File:Foobar.jpg|link=http://example.com/|Title]]
13768 !! html/php
13769 <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>
13770 </p>
13771 !! html/parsoid
13772 <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>
13773 !! end
13774
13775 !! test
13776 Thumbnail image with link parameter
13777 !! options
13778 thumbsize=220
13779 parsoid=wt2html,wt2wt,html2html
13780 !! wikitext
13781 [[File:Foobar.jpg|thumb|link=http://example.com/|Title]]
13782 !! html/php
13783 <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>
13784
13785 !! html/parsoid
13786 <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>
13787 !! end
13788
13789 !! test
13790 Manually-specified thumbnail image
13791 !! options
13792 thumbsize=220
13793 !! wikitext
13794 [[File:Foobar.jpg|thumbnail=Thumb.png|Title]]
13795 !! html/php
13796 <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>
13797
13798 !! html/parsoid
13799 <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>
13800 !! end
13801
13802 !! test
13803 Manually-specified thumbnail image with explicit link to wiki page
13804 !! options
13805 thumbsize=220
13806 parsoid=wt2html,wt2wt,html2html
13807 !! wikitext
13808 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|Title]]
13809 !! html/php
13810 <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>
13811
13812 !! html/parsoid
13813 <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>
13814 !! end
13815
13816 !! test
13817 Manually-specified thumbnail image with explicit link to url
13818 !! options
13819 thumbsize=220
13820 parsoid=wt2html,wt2wt,html2html
13821 !! wikitext
13822 [[File:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
13823 !! html/php
13824 <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>
13825
13826 !! html/parsoid
13827 <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>
13828 !! end
13829
13830 !! test
13831 Manually-specified thumbnail image with explicit no link
13832 !! options
13833 thumbsize=220
13834 parsoid=wt2html,wt2wt,html2html
13835 !! wikitext
13836 [[File:Foobar.jpg|thumb=Thumb.png|link=|Title]]
13837 !! html/php
13838 <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>
13839
13840 !! html/parsoid
13841 <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>
13842 !! end
13843
13844 !! test
13845 Manually-specified thumbnail image with explicit link and alt text
13846 !! options
13847 thumbsize=220
13848 parsoid=wt2html,wt2wt,html2html
13849 !! wikitext
13850 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|alt=alttext|Title]]
13851 !! html/php
13852 <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>
13853
13854 !! html/parsoid
13855 <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>
13856 !! end
13857
13858 !! test
13859 Image with frame and link
13860 !! options
13861 parsoid=wt2html,wt2wt,html2html
13862 !! wikitext
13863 [[File:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
13864 !! html/php
13865 <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>
13866
13867 !! html/parsoid
13868 <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>
13869 !! end
13870
13871 !! test
13872 Image with frame and link and explicit alt
13873 !! options
13874 parsoid=wt2html,wt2wt,html2html
13875 !! wikitext
13876 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
13877 !! html/php
13878 <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>
13879
13880 !! html/parsoid
13881 <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>
13882 !! end
13883
13884 !! test
13885 Image with wiki markup in implicit alt
13886 !! wikitext
13887 [[Image:Foobar.jpg|testing '''bold''' in alt]]
13888
13889 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
13890 !! html/php
13891 <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>
13892 </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>
13893 </p>
13894 !! html/parsoid
13895 <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>
13896
13897 <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>
13898 !! end
13899
13900 !! test
13901 Alt image option should handle most kinds of wikitext without barfing
13902 !! wikitext
13903 [[Image:Foobar.jpg|thumb|This is the image caption|alt=This is a [[link]] and a {{echo|''bold template''}}.]]
13904 !! html/php
13905 <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>
13906
13907 !! html/parsoid
13908 <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>
13909 !! end
13910
13911 ###################
13912 # Conflicting image format options.
13913 # First option specified should 'win'.
13914 # All three cases in each test should be identical.
13915
13916 !! test
13917 Image with 'frameless' first.
13918 !! options
13919 parsoid=wt2html,wt2wt,html2html
13920 !! wikitext
13921 [[File:Foobar.jpg|frameless|caption]]
13922
13923 [[File:Foobar.jpg|frameless|frame|caption]]
13924
13925 [[File:Foobar.jpg|frameless|thumb|caption]]
13926 !! html/php
13927 <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>
13928 </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>
13929 </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>
13930 </p>
13931 !! html/parsoid
13932 <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>
13933 <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>
13934 <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>
13935 !! end
13936
13937 !! test
13938 Image with 'frame' first.
13939 !! options
13940 parsoid=wt2html,wt2wt,html2html
13941 !! wikitext
13942 [[File:Foobar.jpg|frame|caption]]
13943 [[File:Foobar.jpg|frame|frameless|caption]]
13944 [[File:Foobar.jpg|frame|thumb|caption]]
13945 !! html/php
13946 <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>
13947 <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>
13948 <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>
13949
13950 !! html/parsoid
13951 <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>
13952 <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>
13953 <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>
13954 !! end
13955
13956 !! test
13957 Image with 'thumb' first.
13958 !! options
13959 parsoid=wt2html,wt2wt,html2html
13960 !! wikitext
13961 [[File:Foobar.jpg|thumb|caption]]
13962 [[File:Foobar.jpg|thumb|frameless|caption]]
13963 [[File:Foobar.jpg|thumb|frame|caption]]
13964 !! html/php
13965 <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>
13966 <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>
13967 <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>
13968
13969 !! html/parsoid
13970 <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>
13971 <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>
13972 <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>
13973 !! end
13974
13975 ###################
13976 # Image sizing.
13977 # See https://www.mediawiki.org/wiki/Help:Images#Size_and_frame
13978 # and https://phabricator.wikimedia.org/T64258
13979 # Foobar has actual size of 1941x220
13980 # 1. Thumbs & frameless always reduce, can't be enlarged unless it's
13981 # a scalable format.
13982 # 2. Framed images always ignore size options; always render at default size.
13983 # 3. "Unspecified format" and border are the only types which can be
13984 # enlarged.
13985
13986 !! test
13987 Image: "unspecified format" and border enlarge
13988 !! options
13989 parsoid=wt2html,wt2wt,html2html
13990 !! wikitext
13991 [[File:Foobar.jpg|2000px]]
13992
13993 [[File:Foobar.jpg|border|2000px]]
13994 !! html/php
13995 <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>
13996 </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>
13997 </p>
13998 !! html/parsoid
13999 <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>
14000 <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>
14001 !! end
14002
14003 !! test
14004 Image: "unspecified format" and border reduce
14005 !! options
14006 parsoid=wt2html,wt2wt,html2html
14007 !! wikitext
14008 [[File:Foobar.jpg|1000px]]
14009
14010 [[File:Foobar.jpg|border|1000px]]
14011 !! html/php
14012 <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>
14013 </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>
14014 </p>
14015 !! html/parsoid
14016 <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>
14017 <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>
14018 !! end
14019
14020 !! test
14021 Image: thumbs reduce
14022 !! options
14023 parsoid=wt2html,wt2wt,html2html
14024 !! wikitext
14025 [[File:Foobar.jpg|thumb|50px]]
14026 !! html/php
14027 <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>
14028
14029 !! html/parsoid
14030 <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>
14031 !! end
14032
14033 !! test
14034 Image: bitmap thumbs can't be enlarged past original size, but vector can.
14035 !! options
14036 parsoid=wt2html,wt2wt,html2html
14037 !! wikitext
14038 [[File:Foobar.jpg|thumb|2000px]]
14039
14040 [[File:Foobar.svg|thumb|2000px]]
14041 !! html/php
14042 <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>
14043 <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>
14044
14045 !! html/parsoid
14046 <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>
14047 <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>
14048 !! end
14049
14050 !! test
14051 Image: frameless can reduce in size
14052 !! options
14053 parsoid=wt2html,wt2wt,html2html
14054 !! wikitext
14055 [[File:Foobar.jpg|frameless|50px]]
14056 !! html/php
14057 <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>
14058 </p>
14059 !! html/parsoid
14060 <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>
14061 !! end
14062
14063 !! test
14064 Image: bitmap frameless can't be enlarged past original size, but vector can
14065 !! options
14066 parsoid=wt2html,wt2wt,html2html
14067 !! wikitext
14068 [[File:Foobar.jpg|frameless|2000px]]
14069
14070 [[File:Foobar.svg|frameless|2000px]]
14071 !! html/php
14072 <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>
14073 </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>
14074 </p>
14075 !! html/parsoid
14076 <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>
14077 <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>
14078 !! end
14079
14080 !! test
14081 Image: framed images are always unscaled.
14082 !! options
14083 parsoid=wt2html,wt2wt,html2html
14084 !! wikitext
14085 [[File:Foobar.jpg|frame]]
14086
14087 [[File:Foobar.jpg|frame|50px]]
14088
14089 [[File:Foobar.jpg|frame|50x50px]]
14090
14091 [[File:Foobar.jpg|frame|2000px]]
14092 !! html/php
14093 <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>
14094 <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>
14095 <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>
14096 <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>
14097
14098 !! html/parsoid
14099 <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>
14100 <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>
14101 <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>
14102 <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>
14103 !! end
14104
14105 ###################
14106
14107 !! test
14108 Link to image page- image page normally doesn't exists, hence edit link
14109 Add test with existing image page
14110 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
14111 !! wikitext
14112 [[:Image:test]]
14113 !! html
14114 <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>
14115 </p>
14116 !! end
14117
14118 !! test
14119 T20784 Link to non-existent image page with caption should use caption as link text
14120 !! wikitext
14121 [[:Image:test|caption]]
14122 !! html
14123 <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>
14124 </p>
14125 !! end
14126
14127 !! test
14128 Frameless image caption with a free URL
14129 !! wikitext
14130 [[File:Foobar.jpg|http://example.com]]
14131 !! html/php
14132 <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>
14133 </p>
14134 !! html/parsoid
14135 <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>
14136 !! end
14137
14138 !! test
14139 Thumbnail image caption with a free URL
14140 !! options
14141 thumbsize=220
14142 !! wikitext
14143 [[File:Foobar.jpg|thumb|http://example.com]]
14144 !! html/php
14145 <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>
14146
14147 !! html/parsoid
14148 <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>
14149 !! end
14150
14151 !! test
14152 Thumbnail image caption with a free URL and explicit alt
14153 !! options
14154 thumbsize=220
14155 parsoid=wt2html,wt2wt,html2html
14156 !! wikitext
14157 [[File:Foobar.jpg|thumb|http://example.com|alt=Alteration]]
14158 !! html/php
14159 <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>
14160
14161 !! html/parsoid
14162 <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>
14163 !! end
14164
14165 !! test
14166 SVG thumbnails with no language set
14167 !! options
14168 !! wikitext
14169 [[File:Foobar.svg|thumb|caption]]
14170 !! html/php
14171 <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>
14172
14173 !! html/parsoid
14174 <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>
14175 !! end
14176
14177 !! test
14178 SVG thumbnails with language de
14179 !! options
14180 parsoid=wt2html,wt2wt,html2html
14181 !! wikitext
14182 [[File:Foobar.svg|thumb|caption|lang=de]]
14183 !! html/php
14184 <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>
14185
14186 !! html/parsoid
14187 <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>
14188 !! end
14189
14190 !! test
14191 SVG thumbnails with invalid language code
14192 !! options
14193 parsoid=wt2html,wt2wt,html2html
14194 !! wikitext
14195 [[File:Foobar.svg|thumb|caption|lang=invalid.language.code]]
14196 !! html/php
14197 <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>
14198
14199 !! html/parsoid
14200 <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>
14201 !! end
14202
14203 !! test
14204 T3887: A ISBN with a thumbnail
14205 !! wikitext
14206 [[File:Foobar.jpg|thumb|ISBN 1235467890]]
14207 !! html/php
14208 <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>
14209
14210 !! html/parsoid
14211 <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>
14212 !! end
14213
14214 !! test
14215 T3887: A RFC with a thumbnail
14216 !! wikitext
14217 [[File:Foobar.jpg|thumb|This is RFC 12354]]
14218 !! html/php
14219 <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>
14220
14221 !! html/parsoid
14222 <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>
14223 !! end
14224
14225 !! test
14226 T3887: A mailto link with a thumbnail
14227 !! wikitext
14228 [[File:Foobar.jpg|thumb|Please mailto:nobody@example.com]]
14229 !! html/php
14230 <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>
14231
14232 !! html/parsoid
14233 <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>
14234 !! end
14235
14236 # Pending resolution to T2368
14237 !! test
14238 T2648: Frameless image caption with a link
14239 !! wikitext
14240 [[File:Foobar.jpg|text with a [[link]] in it]]
14241 !! html/php
14242 <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>
14243 </p>
14244 !! html/parsoid
14245 <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>
14246 !! end
14247
14248 !! test
14249 T2648: Frameless image caption with a link (suffix)
14250 !! wikitext
14251 [[File:Foobar.jpg|text with a [[link]]foo in it]]
14252 !! html/php
14253 <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>
14254 </p>
14255 !! html/parsoid
14256 <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>
14257 !! end
14258
14259 !! test
14260 T2648: Frameless image caption with an interwiki link
14261 !! wikitext
14262 [[File:Foobar.jpg|text with a [[MeatBall:Link]] in it]]
14263 !! html/php
14264 <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>
14265 </p>
14266 !! html/parsoid
14267 <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>
14268 !! end
14269
14270 !! test
14271 T2648: Frameless image caption with a piped interwiki link
14272 !! wikitext
14273 [[File:Foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
14274 !! html/php
14275 <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>
14276 </p>
14277 !! html/parsoid
14278 <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>
14279 !! end
14280
14281 !! test
14282 T107474: Frameless image caption with <nowiki>
14283 !! wikitext
14284 [[File:Foobar.jpg|<nowiki>text with a [[MeatBall:Link|link]] in it</nowiki>]]
14285 !! html/parsoid
14286 <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>
14287 !! end
14288
14289 !! test
14290 Escape HTML special chars in image alt text
14291 !! wikitext
14292 [[File:Foobar.jpg|& < > "]]
14293 !! html/php
14294 <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>
14295 </p>
14296 !! html/parsoid
14297 <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>
14298 !! end
14299
14300 !! test
14301 Escape HTML special chars in image alt text with LanguageConverter
14302 !! options
14303 language=zh
14304 !! wikitext
14305 [[File:Foobar.jpg|& < > "]]
14306 !! html/php
14307 <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>
14308 </p>
14309 !! html/parsoid
14310 <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>
14311 !! end
14312
14313 !! test
14314 Entities in file name and attributes
14315 !! wikitext
14316 [[File:7%25 solution.gif|manualthumb=7%25 solution.gif|link=7%25 solution|[[7%25 solution]]]]
14317 !! html/php
14318 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=7%25_solution.gif" class="new" title="File:7% solution.gif">7% solution</a>
14319 </p>
14320 !! html/parsoid
14321 <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":"missing-image","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>
14322 !! end
14323
14324 !! test
14325 T2499: Alt text should have &#1234;, not &amp;1234;
14326 !! wikitext
14327 [[File:Foobar.jpg|&#9792;]]
14328 !! html/php
14329 <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>
14330 </p>
14331 !! html/parsoid
14332 <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>
14333 !! end
14334
14335 !! test
14336 Broken image caption with link
14337 !! options
14338 parsoid=wt2html,wt2wt,html2html
14339 !! wikitext
14340 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
14341 !! html/php
14342 <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.
14343 </p>
14344 !! html/parsoid
14345 <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>
14346 !! end
14347
14348 !! test
14349 Image caption containing another image
14350 !! wikitext
14351 [[File:Foobar.jpg|thumb|This is a caption with another [[File:Thumb.png|image]] inside it!]]
14352 !! html/php
14353 <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>
14354
14355 !! html/parsoid
14356 <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>
14357 !! end
14358
14359 !! test
14360 Image: caption containing a newline
14361 !! wikitext
14362 [[File:Foobar.jpg|This
14363 *is some text]]
14364 !! html/php
14365 <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>
14366 </p>
14367 !! html/parsoid
14368 <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>
14369 !!end
14370
14371 !!test
14372 Image: caption containing leading space
14373 (The leading space should not trigger nowiki escaping in wt2wt mode)
14374 !! wikitext
14375 [[File:Foobar.jpg|thumb| bar]]
14376 !! html/php
14377 <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>
14378
14379 !! html/parsoid
14380 <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>
14381 !!end
14382
14383 !! test
14384 Image: caption containing a table
14385 !! options
14386 parsoid=wt2html,wt2wt,html2html
14387 !! wikitext
14388 [[Image:Foobar.jpg|thumb|200px|This is an example image thumbnail caption with a table
14389 {|
14390 ! Foo !! Bar
14391 |-
14392 | Foo1 || Bar1
14393 |}
14394 and some more text.]]
14395 !! html/php
14396 <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>
14397
14398 !! html/parsoid
14399 <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
14400 <table>
14401 <tbody>
14402 <tr><th>Foo </th><th>Bar</th></tr>
14403 <tr>
14404 <td>Foo1 </td>
14405 <td>Bar1</td></tr></tbody></table>and some more text.</figcaption></figure>
14406 !! end
14407
14408 !! test
14409 T5090: External links other than http: in image captions
14410 !! wikitext
14411 [[File:Foobar.jpg|thumb|200x200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
14412 !! html/php
14413 <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>
14414
14415 !! html/parsoid
14416 <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>
14417 !! end
14418
14419 !! test
14420 Custom class
14421 !! options
14422 parsoid=wt2html,wt2wt,html2html
14423 !! wikitext
14424 [[Image:foobar.jpg|a|class=b]]
14425 !! html/php
14426 <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>
14427 </p>
14428 !! html/parsoid
14429 <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>
14430 !! end
14431
14432 !! test
14433 Localized image handling (1).
14434 !! options
14435 parsoid=wt2html,wt2wt,html2html
14436 language=es
14437 !! wikitext
14438 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
14439 !! html/php
14440 <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>
14441
14442 !! html/parsoid
14443 <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>
14444 !! end
14445
14446 !! test
14447 Localized image handling (2).
14448 !! options
14449 thumbsize=220
14450 parsoid=wt2html,wt2wt,html2html
14451 language=es
14452 !! wikitext
14453 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
14454 !! html/php
14455 <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>
14456
14457 !! html/parsoid
14458 <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>
14459 !! end
14460
14461 !! test
14462 Localized image handling (3).
14463 !! options
14464 language=fa
14465 parsoid=html2wt
14466 !! html/parsoid
14467 <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>
14468 !! wikitext
14469 [[File:Foobar.jpg|بندانگشتی]]
14470 !! end
14471
14472 !! test
14473 "border", "frameless" and "class" attributes on an image.
14474 !! options
14475 thumbsize=220
14476 parsoid=wt2html,wt2wt,html2html
14477 !! wikitext
14478 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
14479 !! html/php
14480 <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>
14481 </p>
14482 !! html/parsoid
14483 <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>
14484 !! end
14485
14486 # Note that 'right' is the default alignment, despite the misspelled 'righ' below
14487 !! test
14488 Invalid image attributes (T64500)
14489 !! options
14490 thumbsize=220
14491 parsoid=wt2html,wt2wt,html2html
14492 !! wikitext
14493 [[File:Foobar.jpg|thumb|float|left|caption]]
14494
14495 [[File:Foobar.jpg|thumb|righ|caption]]
14496
14497 [[File:Foobar.jpg|bogus1|thumb|bogus2|left|bogus3|caption]]
14498 !! html/php
14499 <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>
14500 <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>
14501 <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>
14502
14503 !! html/parsoid
14504 <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>
14505 <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>
14506 <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>
14507 !! end
14508
14509 !! article
14510 File:Barfoo.jpg
14511 !! text
14512 #REDIRECT [[File:Barfoo.jpg]]
14513 !! endarticle
14514
14515 # FIXME: Parsoid should run this test -- but we'd need to teach the
14516 # mockAPI about the redirected Barfoo.jpg image.
14517 !! test
14518 Redirected image
14519 !! wikitext
14520 [[Image:Barfoo.jpg]]
14521 !! html/php
14522 <p><a href="/wiki/File:Barfoo.jpg" class="mw-redirect" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
14523 </p>
14524 !! end
14525
14526 !! test
14527 Missing image with uploads disabled
14528 !! options
14529 wgEnableUploads=0
14530 !! wikitext
14531 [[File:Foobaz.jpg]]
14532 !! html/php
14533 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
14534 </p>
14535 !! html/parsoid
14536 <p><span class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"missing-image","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>
14537 !! end
14538
14539 # Parsoid-specific testing for images
14540 # https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
14541 # Currently imperfect due to a flaw in the Parsoid testrunner
14542 # Work in progress
14543 # THESE TESTS SHOULD BE MOVED UP and merged with the php-specific
14544 # image tests.
14545
14546 !! test
14547 Parsoid-specific image handling - simple image with size and middle alignment
14548 !! wikitext
14549 [[File:Foobar.jpg|middle|50px]]
14550 !! html/parsoid
14551 <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>
14552 !! end
14553
14554 !! test
14555 Parsoid-specific image handling - simple image with size, middle alignment,
14556 non-standard namespace alias
14557 !! options
14558 parsoid=wt2wt,wt2html,html2html
14559 !! wikitext
14560 [[Image:Foobar.jpg|middle|50px]]
14561 !! html/parsoid
14562 <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>
14563 !! end
14564
14565 !! test
14566 Parsoid-specific image handling - simple image with size and middle alignment
14567 (existing content)
14568 !! wikitext
14569 [[File:Foobar.jpg|50px|middle]]
14570 !! html/parsoid
14571 <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>
14572 !! end
14573
14574 !! test
14575 Parsoid-specific image handling - simple image with size and middle alignment
14576 and non-standard namespace name
14577 !! options
14578 parsoid=wt2html,wt2wt,html2html
14579 !! wikitext
14580 [[Image:Foobar.jpg|50px|middle]]
14581 !! html/parsoid
14582 <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>
14583 !! end
14584
14585 !! test
14586 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
14587 !! wikitext
14588 [[File:Foobar.jpg|500x10px|baseline|caption]]
14589 !! html/parsoid
14590 <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>
14591 !! end
14592
14593 !! test
14594 Parsoid-specific image handling - simple image with border and size spec
14595 !! wikitext
14596 [[File:Foobar.jpg|50px|border|caption]]
14597 !! html/parsoid
14598 <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>
14599 !! end
14600
14601 !! test
14602 Parsoid-specific image handling - thumbnail with halign, valign, and caption
14603 !! wikitext
14604 [[File:Foobar.jpg|left|baseline|thumb|caption content]]
14605 !! html/parsoid
14606 <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>
14607 !! end
14608
14609 !! test
14610 Parsoid-specific image handling - thumbnail with halign, valign, and caption
14611 (existing content)
14612 !! wikitext
14613 [[File:Foobar.jpg|thumb|left|baseline|caption content]]
14614 !! html/parsoid
14615 <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>
14616 !! end
14617
14618 !! test
14619 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
14620 !! wikitext
14621 [[Image:Foobar.jpg|right|middle|thumb|50x50px|caption]]
14622 !! html/parsoid
14623 <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>
14624 !! end
14625
14626 !! test
14627 Parsoid-specific image handling - thumbnail with specific size, halign,
14628 valign, and caption (existing content)
14629 !! wikitext
14630 [[File:Foobar.jpg|thumb|50x50px|right|middle|caption]]
14631 !! html/parsoid
14632 <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>
14633 !! end
14634
14635 !! test
14636 Parsoid-specific image handling - framed image with specific size and caption
14637 (size is ignored)
14638 !! options
14639 parsoid=wt2html,wt2wt,html2html
14640 !! wikitext
14641 [[File:Foobar.jpg|frame|500x50px|caption]]
14642 !! html/parsoid
14643 <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>
14644 !! end
14645
14646 !! test
14647 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption
14648 (size is ignored)
14649 !! options
14650 parsoid=wt2html,wt2wt,html2html
14651 !! wikitext
14652 [[File:Foobar.jpg|left|baseline|frame|500x50px|caption]]
14653 !! html/parsoid
14654 <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>
14655 !! end
14656
14657 !! test
14658 Parsoid-specific image handling - frameless image with specific size, border, and caption
14659 !! wikitext
14660 [[File:Foobar.jpg|frameless|442x50px|border|caption]]
14661 !! html/parsoid
14662 <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>
14663 !! end
14664
14665 !! test
14666 Parsoid-specific image handling - simple image with a formatted caption
14667 !! wikitext
14668 [[File:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
14669 !! html/parsoid
14670 <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>
14671 !! end
14672
14673 !! test
14674 Parsoid-specific image handling - caption with a template in it
14675 !! wikitext
14676 [[File:Foobar.jpg|thumb|200x23px|This caption has a {{echo|transclusion}} in it.]]
14677 !! html/parsoid
14678 <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>
14679 !! end
14680
14681 !! test
14682 Parsoid-specific image handling - caption with unbalanced tags in it
14683 !! options
14684 parsoid=wt2html,wt2wt,html2html
14685 !! wikitext
14686 foo
14687 [[File:Foobar.jpg|thumb|200x200px|This caption has a <center>unbalanced tag in it.]]
14688 bar
14689 !! html/parsoid
14690 <p>foo</p>
14691 <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>
14692 <p>bar</p>
14693 !! end
14694
14695 !! test
14696 Parsoid-specific image handling - empty caption (1)
14697 !! options
14698 parsoid=wt2html,wt2wt
14699 !! wikitext
14700 [[File:Foobar.jpg|thumb|]]
14701 !! html/parsoid
14702 <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>
14703 !! end
14704
14705 # empty captions don't get serialized unless we're in the "round trip" case
14706 !! test
14707 Parsoid-specific image handling - empty caption (2)
14708 !! options
14709 parsoid=html2wt
14710 !! html/parsoid
14711 <figure class="mw-default-size" typeof="mw:Image/Thumb">
14712 <a href="./File:Foobar.jpg">
14713 <img resource="./File:Foobar.jpg"
14714 src="//example.com/images/3/3a/Foobar.jpg"
14715 data-file-width="1941" data-file-height="220" data-file-type="bitmap"
14716 height="25" width="220"/>
14717 </a>
14718 <figcaption></figcaption>
14719 </figure>
14720 !! wikitext
14721 [[File:Foobar.jpg|thumb]]
14722 !! end
14723
14724 !! test
14725 Parsoid-specific image handling - whitespace caption
14726 !! wikitext
14727 [[File:Foobar.jpg|thumb| ]]
14728 !! html/parsoid
14729 <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>
14730 !! end
14731
14732 !! test
14733 Parsoid-specific image handling - lang option
14734 !! wikitext
14735 foo
14736 [[File:Foobar.svg|lang=de|caption]]
14737 bar
14738 !! html/parsoid
14739 <p>foo
14740 <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>
14741 bar</p>
14742 !! end
14743
14744 ## Edge case bugs in Parsoid from T93580
14745 !! test
14746 T93580: 1. Templated <ref> inside block images
14747 !! wikitext
14748 [[File:Foobar.jpg|thumb|Caption with templated ref: {{echo|<ref>foo</ref>}}]]
14749
14750 <references />
14751 !! html/parsoid
14752 <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>
14753
14754 <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>
14755 !! end
14756
14757 !! test
14758 T93580: 2. <ref> inside inline images
14759 !! wikitext
14760 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: <ref>foo</ref>]]
14761
14762 <references />
14763 !! html/parsoid
14764 <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>
14765
14766 <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>
14767 !! end
14768
14769 !! test
14770 T93580: 3. Templated <ref> inside inline images
14771 !! wikitext
14772 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: {{echo|<ref>{{echo|foo}}</ref>}}]]
14773
14774 <references />
14775 !! html/parsoid
14776 <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>
14777
14778 <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>
14779 !! end
14780
14781 ###
14782 ### Subpages
14783 ###
14784 !! article
14785 Subpage test/subpage
14786 !! text
14787 foo
14788 !! endarticle
14789
14790 !! test
14791 Subpage link
14792 !! options
14793 subpage title=[[Subpage test]]
14794 !! wikitext
14795 [[/subpage]]
14796 !! html
14797 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
14798 </p>
14799 !! end
14800
14801 !! test
14802 Subpage noslash link
14803 !! options
14804 subpage title=[[Subpage test]]
14805 !! wikitext
14806 [[/subpage/]]
14807 !! html
14808 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
14809 </p>
14810 !! end
14811
14812 !! article
14813 Subpage test/1/2/subpage
14814 !! text
14815 blah
14816 !! endarticle
14817
14818 !! test
14819 Relative subpage noslash link
14820 !! options
14821 parsoid=wt2wt,wt2html,html2html
14822 subpage title=[[Subpage test/1/2/3/4]]
14823 !! wikitext
14824 [[../../subpage/]]
14825
14826 [[../../subpage]]
14827 !! html/php
14828 <p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a>
14829 </p><p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage test/1/2/subpage</a>
14830 </p>
14831 !! html/parsoid
14832 <p><a rel="mw:WikiLink" href="./Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a></p>
14833 <p><a rel="mw:WikiLink" href="./Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
14834 !! end
14835
14836 !! test
14837 Parsoid: dot-slash prefixed wikilinks
14838 !! wikitext
14839 [[./foo]]
14840
14841 [[././bar]]
14842
14843 [[././baz/]]
14844 !! html/php
14845 <p>[[./foo]]
14846 </p><p>[[././bar]]
14847 </p><p>[[././baz/]]
14848 </p>
14849 !! html/parsoid
14850 <p>[[./foo]]
14851 </p><p>[[././bar]]
14852 </p><p>[[././baz/]]
14853 </p>
14854 !! end
14855
14856 !! test
14857 Render invalid page names as plain text (T53090)
14858 !! wikitext
14859 [[./../foo|bar]]
14860 [[foo�|bar]]
14861 [[foo/.|bar]]
14862 [[foo/..|bar]]
14863 [[foo~~~bar]]
14864 [[foo>bar]]
14865 [[foo[bar]]
14866 [[.]]
14867 [[..]]
14868 [[foo././bar]]
14869
14870 [[{{echo|./../foo}}|bar]]
14871 [[{{echo|foo/.}}|bar]]
14872 [[{{echo|foo/..}}|bar]]
14873 [[{{echo|foo~~~~bar}}]]
14874 [[{{echo|foo>bar}}]]
14875 [[{{echo|foo././bar}}]]
14876 [[{{echo|foo{bar}}]]
14877 [[{{echo|foo}bar}}]]
14878 [[{{echo|foo[bar}}]]
14879 [[{{echo|foo]bar}}]]
14880 [[{{echo|foo<bar}}]]
14881 !!html/php
14882 <p>[[./../foo|bar]]
14883 [[foo�|bar]]
14884 [[foo/.|bar]]
14885 [[foo/..|bar]]
14886 [[foo~~~bar]]
14887 [[foo&gt;bar]]
14888 [[foo[bar]]
14889 [[.]]
14890 [[..]]
14891 [[foo././bar]]
14892 </p><p>[[./../foo|bar]]
14893 [[foo/.|bar]]
14894 [[foo/..|bar]]
14895 [[foo~~~~bar]]
14896 [[foo&gt;bar]]
14897 [[foo././bar]]
14898 [[foo{bar]]
14899 [[foo}bar]]
14900 [[foo[bar]]
14901 [[foo]bar]]
14902 [[foo&lt;bar]]
14903 </p>
14904 !!html/parsoid
14905 <p>[[./../foo|bar]]
14906 [[foo�|bar]]
14907 [[foo/.|bar]]
14908 [[foo/..|bar]]
14909 [[foo~~~bar]]
14910 [[foo>bar]]
14911 [[foo[bar]]
14912 [[.]]
14913 [[..]]
14914 [[foo././bar]]</p>
14915
14916 <p>[[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"./../foo"}},"i":0}}]}'>./../foo</span>|bar]]
14917 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/."}},"i":0}}]}'>foo/.</span>|bar]]
14918 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/.."}},"i":0}}]}'>foo/..</span>|bar]]
14919 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo~~~~bar"}},"i":0}}]}'>foo~~~~bar</span>]]
14920 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo>bar"}},"i":0}}]}'>foo>bar</span>]]
14921 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo././bar"}},"i":0}}]}'>foo././bar</span>]]
14922 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo{bar"}},"i":0}}]}'>foo{bar</span>]]
14923 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo}bar"}},"i":0}}]}'>foo}bar</span>]]
14924 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo[bar"}},"i":0}}]}'>foo[bar</span>]]
14925 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo]bar"}},"i":0}}]}'>foo]bar</span>]]
14926 [[<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>
14927 !!end
14928
14929 !! test
14930 Disabled subpages
14931 !! wikitext
14932 [[/subpage]]
14933 !! html
14934 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
14935 </p>
14936 !! end
14937
14938 !! test
14939 T2561: {{/Subpage}}
14940 !! options
14941 subpage title=[[Page]]
14942 !! wikitext
14943 {{/Subpage}}
14944 !! html
14945 <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>
14946 </p>
14947 !! end
14948
14949 ###
14950 ### Categories
14951 ###
14952 !! article
14953 Category:MediaWiki User's Guide
14954 !! text
14955 blah
14956 !! endarticle
14957
14958 !! test
14959 Link to category
14960 !! wikitext
14961 [[:Category:MediaWiki User's Guide]]
14962 !! html
14963 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
14964 </p>
14965 !! end
14966
14967 !! test
14968 Simple category
14969 !! options
14970 cat
14971 !! wikitext
14972 [[Category:MediaWiki User's Guide]]
14973 !! html/php
14974 cat=MediaWiki_User's_Guide sort=
14975 !! html/parsoid
14976 <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"}}'/>
14977 !! end
14978
14979 !! test
14980 PAGESINCATEGORY invalid title fatal (r33546 fix)
14981 !! wikitext
14982 {{PAGESINCATEGORY:<bogus>}}
14983 !! html
14984 <p>0
14985 </p>
14986 !! end
14987
14988 !! test
14989 Category with different sort key
14990 !! options
14991 cat
14992 !! wikitext
14993 [[Category:MediaWiki User's Guide|Foo]]
14994 !! html/php
14995 cat=MediaWiki_User's_Guide sort=Foo
14996 !! html/parsoid
14997 <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"}}'/>
14998 !! end
14999
15000 !! test
15001 Category with identical sort key
15002 !! options
15003 cat
15004 !! wikitext
15005 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
15006 !! html/php
15007 cat=MediaWiki_User's_Guide sort=MediaWiki User's Guide
15008 !! html/parsoid
15009 <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"}}'/>
15010 !! end
15011
15012 !! test
15013 Category with empty sort key
15014 !! options
15015 cat
15016 pst
15017 !! wikitext
15018 [[Category:MediaWiki User's Guide|]]
15019 !! html/php
15020 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
15021 !! end
15022
15023 !! test
15024 Category with empty sort key and parentheses
15025 !! options
15026 cat
15027 pst
15028 !! wikitext
15029 [[Category:Foo (bar)|]]
15030 !! html/php
15031 [[Category:Foo (bar)|Foo]]
15032 !! end
15033
15034 !! test
15035 Category with link tail
15036 !! options
15037 cat
15038 pst
15039 !! wikitext
15040 123[[Category:Foo]]456
15041 !! html/php
15042 123[[Category:Foo]]456
15043 !! end
15044
15045 !! test
15046 Category with template
15047 !! options
15048 cat
15049 pst
15050 !! wikitext
15051 [[Category:{{echo|Foo}}]]
15052 !! html/php
15053 [[Category:{{echo|Foo}}]]
15054 !! end
15055
15056 !! test
15057 Category with template in sort key
15058 !! options
15059 cat
15060 pst
15061 !! wikitext
15062 [[Category:Foo|{{echo|Bar}}]]
15063 !! html/php
15064 [[Category:Foo|{{echo|Bar}}]]
15065 !! end
15066
15067 !! test
15068 Category with template in sort key and title
15069 !! options
15070 cat
15071 pst
15072 !! wikitext
15073 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
15074 !! html/php
15075 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
15076 !! end
15077
15078 ## We used to, but no longer wt2wt this test since the default serializer
15079 ## will normalize all categories to serialize on their own line.
15080 ## This wikitext usage is going to be fairly uncommon in production and
15081 ## selser will take care of preserving formatting in those scenarios.
15082 !! test
15083 Category / paragraph interactions
15084 !! options
15085 parsoid=wt2html
15086 !! wikitext
15087 Foo [[Category:Baz]] Bar
15088
15089 Foo [[Category:Baz]]
15090 Bar
15091
15092 Foo
15093 [[Category:Baz]]
15094 Bar
15095
15096 Foo
15097 [[Category:Baz]] Bar
15098
15099 Foo
15100 [[Category:Baz]]
15101 [[Category:Baz]]
15102 [[Category:Baz]]
15103 Bar
15104
15105 [[Category:Baz]]
15106 [[Category:Baz]]
15107 [[Category:Baz]]
15108
15109 [[Category:Baz]]
15110 {{echo|[[Category:Baz]]}}
15111 [[Category:Baz]]
15112 !! html/php
15113 <p>Foo Bar
15114 </p><p>Foo
15115 Bar
15116 </p><p>Foo
15117 Bar
15118 </p><p>Foo Bar
15119 </p><p>Foo
15120 Bar
15121 </p>
15122 !! html/parsoid
15123 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
15124 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
15125 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
15126 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
15127 <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>
15128 <link rel="mw:PageProp/Category" href="./Category:Baz"/>
15129 !! end
15130
15131 ## We used to, but no longer wt2wt this test since the default serializer
15132 ## will normalize all categories to serialize on their own line.
15133 ## This wikitext usage is going to be fairly uncommon in production and
15134 ## selser will take care of preserving formatting in those scenarios.
15135 ##
15136 ## The whitespace on the empty line is part of the test. Please do not delete
15137 !! test
15138 1. Categories and newlines: All preceding newlines should be suppressed (courtesy T2087)
15139 !! options
15140 parsoid=wt2html
15141 !! wikitext
15142 This
15143
15144 [[Category:Foo]] and this should be part of same paragraph (not an indent-pre)
15145
15146 {{echo|[[Category:Foo]] and so should this!}}
15147 !! html/php
15148 <p>This and this should be part of same paragraph (not an indent-pre) and so should this!
15149 </p>
15150 !! html/parsoid
15151 <p>This
15152
15153 <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of same paragraph (not an indent-pre)
15154
15155 <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>
15156 !! end
15157
15158 ## Parsoid will not try to wt2wt this while preserving newlines because
15159 ## it suppresses excess newlines within list items -- and we don't want to
15160 ## introduce a special case just for categories, which is, in reality somewhat
15161 ## odd behavior -- categories are unlikely to be used in list items like this
15162 ## in top-level pages and are only likely to show up in template-generated
15163 ## list items where this RT-ing is a non-issue.
15164 ##
15165 ## The whitespace on the empty line is part of the test. Please do not delete
15166 !! test
15167 2. Categories and newlines: All preceding newlines should be suppressed (courtesy T2087)
15168 !! options
15169 parsoid=wt2html
15170 !! wikitext
15171 * This
15172
15173 [[Category:Foo]] and this should be part of the same list item
15174 * So should this
15175
15176 {{echo|[[Category:Foo]] and this should be part of the same list item}}
15177 !! html
15178 <ul><li>This and this should be part of the same list item</li>
15179 <li>So should this and this should be part of the same list item</li></ul>
15180 !! html/parsoid
15181 <ul>
15182 <li>This <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of the same list item</li>
15183 <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>
15184 </ul>
15185 !! end
15186
15187 ## Newlines and categories that follow the last item of a list
15188 ## are treated differently because this (list followed by categories)
15189 ## is an extremely common pattern on wikis.
15190 !! test
15191 3. Categories and newlines: newline suppression for last list item should RT properly
15192 !! wikitext
15193 * a
15194 * b
15195
15196 [[Category:Foo]]
15197
15198 [[Category:Bar]]
15199 [[Category:Baz]]
15200 !! html/parsoid
15201 <ul><li> a</li>
15202 <li> b</li></ul>
15203
15204 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
15205
15206 <link rel="mw:PageProp/Category" href="./Category:Bar" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
15207 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
15208 !! end
15209
15210 !! test
15211 4. Categories and newlines: newline suppression for last list item should RT properly
15212 !! wikitext
15213 * a
15214 **** b
15215
15216 [[Category:Foo]]
15217 !! html/parsoid
15218 <ul><li> a
15219 <ul><li><ul><li><ul><li> b</li></ul></li></ul></li></ul></li></ul>
15220
15221 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
15222 !! end
15223
15224 ## only wt2html for this to make sure the algo only applies to the rightmost path
15225 !! test
15226 5. Categories and newlines: migrateTrailingCategories dom pass should only run on the rightmost path of nested lists
15227 !! options
15228 parsoid=wt2html
15229 !! wikitext
15230 * a
15231 ** b
15232 [[Category:Foo]]
15233 * c
15234 ** d
15235 [[Category:Foo]]
15236 !! html/parsoid
15237 <ul><li> a
15238 <ul><li> b
15239 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/></li></ul></li>
15240 <li> c
15241 <ul><li> d</li></ul></li></ul>
15242 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
15243 !! end
15244
15245 ## We used to, but no longer wt2wt this test since the default serializer
15246 ## will normalize all categories to serialize on their own line.
15247 ## This wikitext usage is going to be fairly uncommon in production and
15248 ## selser will take care of preserving formatting in those scenarios.
15249 !! test
15250 6. Categories and newlines: migrateTrailingCategories dom pass should not migrate categories not preceded by newlines
15251 !! options
15252 parsoid=wt2html
15253 !! wikitext
15254 * a [[Category:Foo]]
15255 !! html/parsoid
15256 <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>
15257 !! end
15258
15259 # This test also demonstrates because of newline+category tunneling
15260 # through the list hander, template wrapping doesn't expand to the
15261 # containing list when the list item swallows the category.
15262 !! test
15263 7. Categories and newlines: migrateTrailingCategories dom pass should leave template content alone
15264 !! wikitext
15265 * {{echo|a
15266 [[Category:Foo]]}}
15267 !! html/parsoid
15268 <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
15269 </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>
15270 !! end
15271
15272 !! test
15273 8. Categories and newlines: migrateTrailingCategories dom pass should not get tripped by intervening templates
15274 !! wikitext
15275 * a
15276
15277 {{echo|[[Category:Foo]]
15278 [[Category:Bar]]}}
15279 [[Category:Baz]]
15280 !! html/parsoid
15281 <ul><li> a</li></ul>
15282
15283 <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">
15284 </span><link rel="mw:PageProp/Category" href="./Category:Bar" about="#mwt1" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
15285 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
15286 !! end
15287
15288 !! test
15289 Category links with multiple namespaces
15290 !! wikitext
15291 [[Category:Project:Foo]]
15292 !! html/parsoid
15293 <link rel="mw:PageProp/Category" href="./Category:Project:Foo" />
15294 !! end
15295
15296 !! test
15297 Parsoid: Serialize link to category page with colon escape
15298 !! options
15299 parsoid
15300 !! wikitext
15301
15302 [[:Category:Foo]]
15303 [[:Category:Foo|Bar]]
15304 !! html
15305 <p>
15306 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Category:Foo</a>
15307 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Bar</a>
15308 </p>
15309 !! end
15310
15311 # We used to, but no longer wt2wt this test since the default serializer
15312 # will normalize all categories to serialize on their own line.
15313 # This wikitext usage is going to be fairly uncommon in production and
15314 # selser will take care of preventing whitespace insertion if this
15315 # occurs in an article.
15316 #
15317 # html2html disabled for the same reason (whitespace insertion between
15318 # x and y).
15319 #
15320 # html2wt disabled because it localizes the "Category" namespace.
15321 !! test
15322 Link prefix/suffixes aren't applied to category links
15323 !! options
15324 parsoid=wt2html
15325 language=is
15326 !! wikitext
15327 x[[Category:Foo]]y
15328 !! html/php
15329 <p>xy
15330 </p>
15331 !! html/parsoid
15332 <p>x<link rel="mw:PageProp/Category" href="./Flokkur:Foo" data-parsoid=""/>y</p>
15333 !! end
15334
15335 !! test
15336 Parsoid: Serialize link to file page with colon escape
15337 !! options
15338 parsoid
15339 !! wikitext
15340
15341 [[:File:Foo.png]]
15342 [[:File:Foo.png|Bar]]
15343 !! html
15344 <p>
15345 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">File:Foo.png</a>
15346 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">Bar</a>
15347 </p>
15348 !! end
15349
15350 !! test
15351 Parsoid: Serialize a genuine category link without colon escape
15352 !! options
15353 parsoid
15354 !! wikitext
15355 [[Category:Foo]]
15356 [[Category:Foo|Bar]]
15357 !! html
15358 <link rel="mw:PageProp/Category" href="./Category:Foo">
15359 <link rel="mw:PageProp/Category" href="./Category:Foo#Bar">
15360 !! end
15361
15362 !! test
15363 Normalize hrefs properly before testing for invalid link targets (T72894)
15364 !! options
15365 parsoid=html2wt
15366 !! html/parsoid
15367 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne"/>
15368 !! wikitext
15369 [[Category:Toxine bactérienne]]
15370 !! end
15371
15372 !! test
15373 Parsoid: Defaultsort
15374 !! wikitext
15375 {{DEFAULTSORT:Foo}}
15376 !! html/parsoid
15377 <meta property="mw:PageProp/categorydefaultsort" content="Foo"/>
15378 !! end
15379
15380 !! test
15381 Parsoid: Defaultsort (template-generated)
15382 !! wikitext
15383 {{{{echo|DEFAULTSORT}}:Foo}}
15384 !! html/parsoid
15385 <meta property="mw:PageProp/categorydefaultsort" content="Foo" about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"{{echo|DEFAULTSORT}}:Foo"},"params":{},"i":0}}]}'/>
15386 !! end
15387
15388 ###
15389 ### Inter-language links
15390 ###
15391 !! test
15392 Interlanguage links
15393 !! options
15394 ill
15395 !! wikitext
15396 [[es:Alimento]]
15397 [[fr:Nourriture]]
15398 [[zh:食品]]
15399 !! html/php
15400 es:Alimento fr:Nourriture zh:食品
15401 !! html/parsoid
15402 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Alimento"/>
15403 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/Nourriture"/>
15404 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/食品"/>
15405 !! end
15406
15407 !! test
15408 Duplicate interlanguage links (T26502)
15409 !! options
15410 ill
15411 !! wikitext
15412 [[es:1]]
15413 [[es:2]]
15414 [[fr:1]]
15415 [[fr:2]]
15416 !! html/php
15417 es:1 fr:1
15418 !! html/parsoid
15419 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/1"/>
15420 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/2"/>
15421 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/1"/>
15422 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/2"/>
15423 !! end
15424
15425 ###
15426 ### Sections
15427 ###
15428 !! test
15429 Basic section headings
15430 !! wikitext
15431 == Headline 1 ==
15432 Some text
15433
15434 ==Headline 2==
15435 More
15436 ===Smaller headline===
15437 Blah blah
15438 !! html
15439 <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>
15440 <p>Some text
15441 </p>
15442 <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>
15443 <p>More
15444 </p>
15445 <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>
15446 <p>Blah blah
15447 </p>
15448 !! end
15449
15450 !! test
15451 Section headings with TOC
15452 !! wikitext
15453 == Headline 1 ==
15454 === Subheadline 1 ===
15455 ===== Skipping a level =====
15456 ====== Skipping a level ======
15457
15458 == Headline 2 ==
15459 Some text
15460 ===Another headline===
15461 !! html
15462 <div id="toc" class="toc"><div id="toctitle" class="toctitle"><h2>Contents</h2></div>
15463 <ul>
15464 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
15465 <ul>
15466 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
15467 <ul>
15468 <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>
15469 <ul>
15470 <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>
15471 </ul>
15472 </li>
15473 </ul>
15474 </li>
15475 </ul>
15476 </li>
15477 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
15478 <ul>
15479 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
15480 </ul>
15481 </li>
15482 </ul>
15483 </div>
15484
15485 <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>
15486 <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>
15487 <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>
15488 <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>
15489 <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>
15490 <p>Some text
15491 </p>
15492 <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>
15493
15494 !! end
15495
15496 !! test
15497 TOC anchors don't collide
15498 !! wikitext
15499 __FORCETOC__
15500 == Headline 2 ==
15501 == Headline ==
15502 == Headline 2 ==
15503 == Headline ==
15504 !! html/php
15505 <div id="toc" class="toc"><div id="toctitle" class="toctitle"><h2>Contents</h2></div>
15506 <ul>
15507 <li class="toclevel-1 tocsection-1"><a href="#Headline_2"><span class="tocnumber">1</span> <span class="toctext">Headline 2</span></a></li>
15508 <li class="toclevel-1 tocsection-2"><a href="#Headline"><span class="tocnumber">2</span> <span class="toctext">Headline</span></a></li>
15509 <li class="toclevel-1 tocsection-3"><a href="#Headline_2_2"><span class="tocnumber">3</span> <span class="toctext">Headline 2</span></a></li>
15510 <li class="toclevel-1 tocsection-4"><a href="#Headline_3"><span class="tocnumber">4</span> <span class="toctext">Headline</span></a></li>
15511 </ul>
15512 </div>
15513
15514 <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>
15515 <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>
15516 <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>
15517 <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>
15518
15519 !! end
15520
15521 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
15522 !! test
15523 Handling of sections up to level 6 and beyond
15524 !! wikitext
15525 = Level 1 Heading=
15526 == Level 2 Heading==
15527 === Level 3 Heading===
15528 ==== Level 4 Heading====
15529 ===== Level 5 Heading=====
15530 ====== Level 6 Heading======
15531 ======= Level 7 Heading=======
15532 ======== Level 8 Heading========
15533 ========= Level 9 Heading=========
15534 ========== Level 10 Heading==========
15535 !! html
15536 <div id="toc" class="toc"><div id="toctitle" class="toctitle"><h2>Contents</h2></div>
15537 <ul>
15538 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
15539 <ul>
15540 <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>
15541 <ul>
15542 <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>
15543 <ul>
15544 <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>
15545 <ul>
15546 <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>
15547 <ul>
15548 <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>
15549 <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>
15550 <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>
15551 <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>
15552 <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>
15553 </ul>
15554 </li>
15555 </ul>
15556 </li>
15557 </ul>
15558 </li>
15559 </ul>
15560 </li>
15561 </ul>
15562 </li>
15563 </ul>
15564 </div>
15565
15566 <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>
15567 <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>
15568 <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>
15569 <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>
15570 <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>
15571 <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>
15572 <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>
15573 <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>
15574 <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>
15575 <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>
15576
15577 !! end
15578
15579 !! test
15580 TOC regression (T11764)
15581 !! wikitext
15582 == title 1 ==
15583 === title 1.1 ===
15584 ==== title 1.1.1 ====
15585 === title 1.2 ===
15586 == title 2 ==
15587 === title 2.1 ===
15588 !! html
15589 <div id="toc" class="toc"><div id="toctitle" class="toctitle"><h2>Contents</h2></div>
15590 <ul>
15591 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
15592 <ul>
15593 <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>
15594 <ul>
15595 <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>
15596 </ul>
15597 </li>
15598 <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>
15599 </ul>
15600 </li>
15601 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
15602 <ul>
15603 <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>
15604 </ul>
15605 </li>
15606 </ul>
15607 </div>
15608
15609 <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>
15610 <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>
15611 <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>
15612 <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>
15613 <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>
15614 <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>
15615
15616 !! end
15617
15618 !! test
15619 TOC for heading containing <span id="..."></span> (T96153)
15620 !! wikitext
15621 __FORCETOC__
15622 ==<span id="old-anchor"></span>New title==
15623 !! html/php
15624 <div id="toc" class="toc"><div id="toctitle" class="toctitle"><h2>Contents</h2></div>
15625 <ul>
15626 <li class="toclevel-1 tocsection-1"><a href="#New_title"><span class="tocnumber">1</span> <span class="toctext">New title</span></a></li>
15627 </ul>
15628 </div>
15629
15630 <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>
15631
15632 !! end
15633
15634 !! test
15635 TOC with wgMaxTocLevel=3 (T8204)
15636 !! options
15637 wgMaxTocLevel=3
15638 !! wikitext
15639 == title 1 ==
15640 === title 1.1 ===
15641 ==== title 1.1.1 ====
15642 === title 1.2 ===
15643 == title 2 ==
15644 === title 2.1 ===
15645 !! html
15646 <div id="toc" class="toc"><div id="toctitle" class="toctitle"><h2>Contents</h2></div>
15647 <ul>
15648 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
15649 <ul>
15650 <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>
15651 <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>
15652 </ul>
15653 </li>
15654 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
15655 <ul>
15656 <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>
15657 </ul>
15658 </li>
15659 </ul>
15660 </div>
15661
15662 <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>
15663 <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>
15664 <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>
15665 <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>
15666 <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>
15667 <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>
15668
15669 !! end
15670
15671 !! test
15672 TOC with wgMaxTocLevel=3 and two level four headings (T8204)
15673 !! options
15674 wgMaxTocLevel=3
15675 !! wikitext
15676 ==Section 1==
15677 ===Section 1.1===
15678 ====Section 1.1.1====
15679 ====Section 1.1.1.1====
15680 ==Section 2==
15681 !! html
15682 <div id="toc" class="toc"><div id="toctitle" class="toctitle"><h2>Contents</h2></div>
15683 <ul>
15684 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
15685 <ul>
15686 <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>
15687 </ul>
15688 </li>
15689 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
15690 </ul>
15691 </div>
15692
15693 <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>
15694 <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>
15695 <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>
15696 <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>
15697 <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>
15698
15699 !! end
15700
15701
15702 !! test
15703 Resolving duplicate section names
15704 !! wikitext
15705 == Foo bar ==
15706 == Foo bar ==
15707 !! html
15708 <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>
15709 <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>
15710
15711 !! end
15712
15713 !! test
15714 Resolving duplicate section names with differing case (T12721)
15715 !! wikitext
15716 == Foo bar ==
15717 == Foo Bar ==
15718 !! html
15719 <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>
15720 <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>
15721
15722 !! end
15723
15724 !! article
15725 Template:sections
15726 !! text
15727 ===Section 1===
15728 ==Section 2==
15729 !! endarticle
15730
15731 !! test
15732 Template with sections, __NOTOC__
15733 !! wikitext
15734 __NOTOC__
15735 ==Section 0==
15736 {{sections}}
15737 ==Section 4==
15738 !! html
15739 <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>
15740 <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>
15741 <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>
15742 <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>
15743
15744 !! end
15745
15746 !! test
15747 __NOEDITSECTION__ keyword
15748 !! wikitext
15749 __NOEDITSECTION__
15750 ==Section 1==
15751 ==Section 2==
15752 !! html
15753 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
15754 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
15755
15756 !! end
15757
15758 !! test
15759 Link inside a section heading
15760 !! wikitext
15761 ==Section with a [[Main Page|link]] in it==
15762 !! html
15763 <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>
15764
15765 !! end
15766
15767 !! test
15768 TOC regression (T14077)
15769 !! wikitext
15770 __TOC__
15771 == title 1 ==
15772 === title 1.1 ===
15773 == title 2 ==
15774 !! html
15775 <div id="toc" class="toc"><div id="toctitle" class="toctitle"><h2>Contents</h2></div>
15776 <ul>
15777 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
15778 <ul>
15779 <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>
15780 </ul>
15781 </li>
15782 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
15783 </ul>
15784 </div>
15785
15786 <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>
15787 <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>
15788 <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>
15789
15790 !! end
15791
15792 !! test
15793 T3219 URL next to image (good)
15794 !! wikitext
15795 http://example.com [[File:Foobar.jpg]]
15796 !! html/php
15797 <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>
15798 </p>
15799 !! html/parsoid
15800 <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>
15801 !!end
15802
15803 !! test
15804 Short headings with trailing space should match behavior of Parser::doHeadings (T21910)
15805 !! wikitext
15806 ===
15807 The line above must have a trailing space!
15808 === <!--
15809 --> <!-- -->
15810 But just in case it doesn't...
15811 !! html
15812 <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>
15813 <p>The line above must have a trailing space!
15814 </p>
15815 <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>
15816 <p>But just in case it doesn't...
15817 </p>
15818 !! end
15819
15820 !! test
15821 Header with special characters (T27462)
15822 !! wikitext
15823 The tooltips shall not show entities to the user (ie. be double escaped)
15824
15825 == text > text ==
15826 section 1
15827
15828 == text < text ==
15829 section 2
15830
15831 == text & text ==
15832 section 3
15833
15834 == text ' text ==
15835 section 4
15836
15837 == text " text ==
15838 section 5
15839 !! html
15840 <p>The tooltips shall not show entities to the user (ie. be double escaped)
15841 </p>
15842 <div id="toc" class="toc"><div id="toctitle" class="toctitle"><h2>Contents</h2></div>
15843 <ul>
15844 <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>
15845 <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>
15846 <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>
15847 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
15848 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
15849 </ul>
15850 </div>
15851
15852 <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>
15853 <p>section 1
15854 </p>
15855 <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>
15856 <p>section 2
15857 </p>
15858 <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>
15859 <p>section 3
15860 </p>
15861 <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>
15862 <p>section 4
15863 </p>
15864 <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>
15865 <p>section 5
15866 </p>
15867 !! end
15868
15869 !! test
15870 Header with space, plus and underscore as entity
15871 !! wikitext
15872 Id should not contain + for spaces
15873
15874 == Space between Text ==
15875 section 1
15876
15877 == Space-Entity&#32;between&#32;Text ==
15878 section 2
15879
15880 == Plus+between+Text ==
15881 section 3
15882
15883 == Plus-Entity&#43;between&#43;Text ==
15884 section 4
15885
15886 == Underscore_between_Text ==
15887 section 5
15888
15889 == Underscore-Entity&#95;between&#95;Text ==
15890 section 6
15891
15892 [[#Space between Text]]
15893 [[#Space-Entity&#32;between&#32;Text]]
15894 [[#Plus+between+Text]]
15895 [[#Plus-Entity&#43;between&#43;Text]]
15896 [[#Underscore_between_Text]]
15897 [[#Underscore-Entity&#95;between&#95;Text]]
15898 !! html
15899 <p>Id should not contain + for spaces
15900 </p>
15901 <div id="toc" class="toc"><div id="toctitle" class="toctitle"><h2>Contents</h2></div>
15902 <ul>
15903 <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>
15904 <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>
15905 <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>
15906 <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>
15907 <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>
15908 <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>
15909 </ul>
15910 </div>
15911
15912 <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>
15913 <p>section 1
15914 </p>
15915 <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>
15916 <p>section 2
15917 </p>
15918 <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>
15919 <p>section 3
15920 </p>
15921 <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>
15922 <p>section 4
15923 </p>
15924 <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>
15925 <p>section 5
15926 </p>
15927 <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>
15928 <p>section 6
15929 </p><p><a href="#Space_between_Text">#Space between Text</a>
15930 <a href="#Space-Entity_between_Text">#Space-Entity&#32;between&#32;Text</a>
15931 <a href="#Plus.2Bbetween.2BText">#Plus+between+Text</a>
15932 <a href="#Plus-Entity.2Bbetween.2BText">#Plus-Entity&#43;between&#43;Text</a>
15933 <a href="#Underscore_between_Text">#Underscore_between_Text</a>
15934 <a href="#Underscore-Entity_between_Text">#Underscore-Entity&#95;between&#95;Text</a>
15935 </p>
15936 !! end
15937
15938 !! test
15939 Headers with excess '=' characters
15940 (Are similar tests necessary beyond the 1st level?)
15941 !! wikitext
15942 =foo==
15943 ==foo=
15944 =''italic'' heading==
15945 ==''italic'' heading=
15946 !! html
15947 <div id="toc" class="toc"><div id="toctitle" class="toctitle"><h2>Contents</h2></div>
15948 <ul>
15949 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
15950 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
15951 <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>
15952 <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>
15953 </ul>
15954 </div>
15955
15956 <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>
15957 <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>
15958 <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>
15959 <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>
15960
15961 !! end
15962
15963 !! test
15964 HTML headers vs TOC (T25393)
15965 (__NOEDITSECTION__ for clearer output, doesn't matter here)
15966 !! wikitext
15967 <h1>Header 1</h1>
15968 == Header 1.1 ==
15969 == Header 1.2 ==
15970
15971 <h1>Header 2
15972 </h1>
15973 == Header 2.1 ==
15974 == Header 2.2 ==
15975 __NOEDITSECTION__
15976 !! html
15977 <div id="toc" class="toc"><div id="toctitle" class="toctitle"><h2>Contents</h2></div>
15978 <ul>
15979 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
15980 <ul>
15981 <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>
15982 <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>
15983 </ul>
15984 </li>
15985 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
15986 <ul>
15987 <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>
15988 <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>
15989 </ul>
15990 </li>
15991 </ul>
15992 </div>
15993
15994 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
15995 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
15996 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
15997 <h1><span class="mw-headline" id="Header_2">Header 2</span></h1>
15998 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
15999 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
16000
16001 !! end
16002
16003 !! test
16004 Single-line or multiline-comments can follow headings
16005 !! options
16006 parsoid=wt2html,wt2wt
16007 !! wikitext
16008 ==foo==<!---->
16009 ==bar==<!--c1-->
16010 ==baz==<!--
16011 c2
16012 c3-->
16013 !! html
16014 <h2><span class="mw-headline" id="foo">foo</span></h2>
16015 <h2><span class="mw-headline" id="bar">bar</span></h2>
16016 <h2><span class="mw-headline" id="baz">baz</span></h2>
16017
16018 !! end
16019
16020 !! test
16021 T3219 URL next to image (broken)
16022 !! wikitext
16023 http://example.com[[File:Foobar.jpg]]
16024 !! html/php
16025 <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>
16026 </p>
16027 !! html/parsoid
16028 <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>
16029 !!end
16030
16031 !! test
16032 T3186 news: in the middle of text
16033 !! wikitext
16034 http://en.wikinews.org/wiki/Wikinews:Workplace
16035 !! html
16036 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
16037 </p>
16038 !!end
16039
16040
16041 !! test
16042 Namespaced link must have a title
16043 !! wikitext
16044 [[Project:]]
16045 !! html
16046 <p>[[Project:]]
16047 </p>
16048 !!end
16049
16050 !! test
16051 Namespaced link must have a title (bad fragment version)
16052 !! wikitext
16053 [[Project:#fragment]]
16054 !! html
16055 <p>[[Project:#fragment]]
16056 </p>
16057 !!end
16058
16059
16060 ###
16061 ### HTML tags and HTML attributes
16062 ###
16063
16064 !! test
16065 div with no attributes
16066 !! wikitext
16067 <div>HTML rocks</div>
16068 !! html
16069 <div>HTML rocks</div>
16070
16071 !! end
16072
16073 !! test
16074 div with double-quoted attribute
16075 !! wikitext
16076 <div id="rock">HTML rocks</div>
16077 !! html
16078 <div id="rock">HTML rocks</div>
16079
16080 !! end
16081
16082 !! test
16083 div with single-quoted attribute
16084 !! wikitext
16085 <div id='rock'>HTML rocks</div>
16086 !! html
16087 <div id="rock">HTML rocks</div>
16088
16089 !! end
16090
16091 !! test
16092 div with unquoted attribute
16093 !! wikitext
16094 <div id=rock>HTML rocks</div>
16095 !! html
16096 <div id="rock">HTML rocks</div>
16097
16098 !! end
16099
16100 !! test
16101 div with illegal double attributes
16102 !! wikitext
16103 <div id="a" id="b">HTML rocks</div>
16104 !! html
16105 <div id="b">HTML rocks</div>
16106
16107 !!end
16108
16109 !! test
16110 div with empty attribute value, space before equals
16111 !! options
16112 parsoid=wt2html,html2html
16113 !! wikitext
16114 <div class =>HTML rocks</div>
16115 !! html/php
16116 <div class="">HTML rocks</div>
16117
16118 !! html/parsoid
16119 <div class="" data-parsoid='{"stx":"html"}'>HTML rocks</div>
16120 !! end
16121
16122 !! test
16123 div with multiple empty attribute values
16124 !! options
16125 parsoid=wt2html,html2html
16126 !! wikitext
16127 <div id= title=>HTML rocks</div>
16128 !! html/php
16129 <div id="title.3D">HTML rocks</div>
16130
16131 !! html/parsoid
16132 <div id="title.3D" data-parsoid='{"stx":"html"}'>HTML rocks</div>
16133 !! end
16134
16135 !! test
16136 table with multiple empty attribute values
16137 !! options
16138 parsoid=wt2html,html2html
16139 !! wikitext
16140 {| title= id=
16141 | hi
16142 |}
16143 !! html/php
16144 <table title="id=">
16145 <tr>
16146 <td> hi
16147 </td></tr></table>
16148
16149 !! html/parsoid
16150 <table title="id=">
16151 <tbody><tr><td> hi</td></tr>
16152 </tbody></table>
16153 !! end
16154
16155 !! test
16156 div with braces in attribute value
16157 !! wikitext
16158 <div title="{}">Foo</div>
16159 !! html/php
16160 <div title="&#123;&#125;">Foo</div>
16161
16162 !! html/parsoid
16163 <div title="{}">Foo</div>
16164 !! end
16165
16166 !! test
16167 div with empty attribute value, no space before equals
16168 !! options
16169 parsoid=wt2html,html2html
16170 !! wikitext
16171 <div class=>HTML rocks</div>
16172 !! html/php
16173 <div class="">HTML rocks</div>
16174
16175 !! html/parsoid
16176 <div class="">HTML rocks</div>
16177 !! end
16178
16179 !! test
16180 HTML multiple attributes correction
16181 !! wikitext
16182 <p class="error" class="awesome">Awesome!</p>
16183 !! html
16184 <p class="awesome">Awesome!</p>
16185
16186 !!end
16187
16188 !! test
16189 Table multiple attributes correction
16190 !! wikitext
16191 {|
16192 !+ class="error" class="awesome"| status
16193 |}
16194 !! html
16195 <table>
16196 <tr>
16197 <th class="awesome"> status
16198 </th></tr></table>
16199
16200 !!end
16201
16202 !! test
16203 DIV IN UPPERCASE
16204 !! wikitext
16205 <DIV ID="x">HTML ROCKS</DIV>
16206 !! html
16207 <div id="x">HTML ROCKS</div>
16208
16209 !!end
16210
16211 !! test
16212 Non-ASCII pseudo-tags are rendered as text
16213 !! wikitext
16214 <khyô>
16215 !! html
16216 <p>&lt;khyô&gt;
16217 </p>
16218 !! end
16219
16220 !! test
16221 Pseudo-tag with URL 'name' renders as url link
16222 !! wikitext
16223 <http://example.com/>
16224 !! html
16225 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
16226 </p>
16227 !! end
16228
16229 !! test
16230 text with amp in the middle of nowhere
16231 !! wikitext
16232 Remember AT&T?
16233 !! html
16234 <p>Remember AT&amp;T?
16235 </p>
16236 !! end
16237
16238 !! test
16239 text with character entity: eacute
16240 !! wikitext
16241 I always thought &eacute; was a cute letter.
16242 !! html
16243 <p>I always thought &#233; was a cute letter.
16244 </p>
16245 !! html+tidy
16246 <p>I always thought é was a cute letter.</p>
16247 !! end
16248
16249 !! test
16250 text with entity-escaped character entity-like string: eacute
16251 !! wikitext
16252 I always thought &amp;eacute; was a cute letter.
16253 !! html
16254 <p>I always thought &amp;eacute; was a cute letter.
16255 </p>
16256 !! end
16257
16258 !! test
16259 text with undefined character entity: xacute
16260 !! wikitext
16261 I always thought &xacute; was a cute letter.
16262 !! html
16263 <p>I always thought &amp;xacute; was a cute letter.
16264 </p>
16265 !! end
16266
16267 !! test
16268 HTML5 tags
16269 !! wikitext
16270 <data value="5">five</data>
16271 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
16272 <mark>This highlighted text</mark>
16273 !! html
16274 <p><data value="5">five</data>
16275 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
16276 <mark>This highlighted text</mark>
16277 </p>
16278 !! end
16279
16280 !! test
16281 HTML tag with leading space is parsed as text
16282 !! wikitext
16283 < div>foo< /div>
16284 !! html
16285 <p>&lt; div&gt;foo&lt; /div&gt;
16286 </p>
16287 !! end
16288
16289 ###
16290 ### Nesting tests (see T43545, T52604, T53081)
16291 ###
16292
16293 # This test case is fixed in Parsoid by domino 1.0.12. (T52604)
16294 # Note that html2wt is considerably more difficult if we use <b> in
16295 # the test case, instead of <small>
16296 !! test
16297 Ensure that HTML adoption agency algorithm is properly implemented.
16298 !! wikitext
16299 <small>X<small>Y</small>Z</small>
16300 !! html
16301 <p><small>X<small>Y</small>Z</small>
16302 </p>
16303 !! end
16304
16305 # This was T43545 in the PHP parser.
16306 # Note that tidy doesn't handle this correctly.
16307 !! test
16308 Nesting of <kbd>
16309 !! wikitext
16310 <kbd>X<kbd>Y</kbd>Z</kbd>
16311 !! html
16312 <p><kbd>X<kbd>Y</kbd>Z</kbd>
16313 </p>
16314 !! end
16315
16316 # The following cases were T53081 in the PHP parser.
16317 # Note that there are some other nestable tags (b, i, etc) which are
16318 # not covered; see T53081 for discussion.
16319
16320 # Note that tidy doesn't handle this correctly.
16321 !! test
16322 Nesting of <em>
16323 !! wikitext
16324 <em>X<em>Y</em>Z</em>
16325 !! html
16326 <p><em>X<em>Y</em>Z</em>
16327 </p>
16328 !! end
16329
16330 # Note that tidy doesn't handle this correctly.
16331 !! test
16332 Nesting of <strong>
16333 !! wikitext
16334 <strong>X<strong>Y</strong>Z</strong>
16335 !! html
16336 <p><strong>X<strong>Y</strong>Z</strong>
16337 </p>
16338 !! end
16339
16340 !! test
16341 Nesting of <q>
16342 !! wikitext
16343 <q>X<q>Y</q>Z</q>
16344 !! html+tidy
16345 <p><q>X<q>Y</q>Z</q></p>
16346 !! end
16347
16348 # Note that tidy doesn't handle this correctly.
16349 !! test
16350 Nesting of <ruby>
16351 !! wikitext
16352 <ruby>X<ruby>Y</ruby>Z</ruby>
16353 !! html
16354 <p><ruby>X<ruby>Y</ruby>Z</ruby>
16355 </p>
16356 !! end
16357
16358 # Note that tidy doesn't handle this correctly.
16359 !! test
16360 Nesting of <bdo>
16361 !! wikitext
16362 <bdo>X<bdo>Y</bdo>Z</bdo>
16363 !! html
16364 <p><bdo>X<bdo>Y</bdo>Z</bdo>
16365 </p>
16366 !! end
16367
16368
16369 ###
16370 ### Media links
16371 ###
16372
16373 !! test
16374 Media link
16375 !! wikitext
16376 [[Media:Foobar.jpg]]
16377 !! html
16378 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
16379 </p>
16380 !! end
16381
16382 !! test
16383 Media link with text
16384 !! wikitext
16385 [[Media:Foobar.jpg|A neat file to look at]]
16386 !! html
16387 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
16388 </p>
16389 !! end
16390
16391 # FIXME: this is still bad HTML tag nesting
16392 # FIXME: doBlockLevels won't wrap this in a paragraph because it contains a div
16393 !! test
16394 Media link with nasty text
16395 !! wikitext
16396 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
16397 !! html
16398 <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>
16399
16400 !! html+tidy
16401 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Safe Link</a></p>
16402 <div style="display:none">" onmouseover="alert(document.cookie)" onfoo="</div>
16403 !! end
16404
16405 !! test
16406 Media link to nonexistent file (T3702)
16407 !! wikitext
16408 [[Media:No such.jpg]]
16409 !! html
16410 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
16411 </p>
16412 !! end
16413
16414 !! test
16415 Image link to nonexistent file (T3850 - good)
16416 !! wikitext
16417 [[File:No_such.jpg]]
16418 !! html/php
16419 <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>
16420 </p>
16421 !! html/parsoid
16422 <p><span class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"missing-image","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>
16423 !! end
16424
16425 !! test
16426 :Image link to nonexistent file (T3850 - bad)
16427 !! wikitext
16428 [[:Image:No such.jpg]]
16429 !! html/php
16430 <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>
16431 </p>
16432 !! html/parsoid
16433 <p><a rel="mw:WikiLink" href="./File:No_such.jpg" title="File:No such.jpg">Image:No such.jpg</a></p>
16434 !! end
16435
16436
16437
16438 !! test
16439 Character reference normalization in link text (T3938)
16440 !! wikitext
16441 [[Main Page|this&that]]
16442 !! html
16443 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
16444 </p>
16445 !!end
16446
16447 !! article
16448 אַ
16449 !! text
16450 Test for unicode normalization
16451
16452 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
16453 !! endarticle
16454
16455 !! test
16456 (T21451) Links should refer to the normalized form.
16457 !! wikitext
16458 [[&#xFB2E;]]
16459 [[&#x5d0;&#x5b7;]]
16460 [[&#x5d0;ַ]]
16461 [[א&#x5b7;]]
16462 [[אַ]]
16463 !! html
16464 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
16465 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
16466 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
16467 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
16468 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
16469 </p>
16470 !! end
16471
16472 !! test
16473 Empty attribute crash test (T4067)
16474 !! wikitext
16475 <font color="">foo</font>
16476 !! html
16477 <p><font color="">foo</font>
16478 </p>
16479 !! end
16480
16481 !! test
16482 Empty attribute crash test single-quotes (T4067)
16483 !! wikitext
16484 <font color=''>foo</font>
16485 !! html
16486 <p><font color="">foo</font>
16487 </p>
16488 !! end
16489
16490 !! test
16491 Attribute test: equals, then nothing
16492 !! options
16493 parsoid=wt2html,html2html
16494 !! wikitext
16495 <font color=>foo</font>
16496 !! html/php
16497 <p><font color="">foo</font>
16498 </p>
16499 !! html/parsoid
16500 <p><font color="" data-parsoid='{"stx":"html"}'>foo</font></p>
16501 !! end
16502
16503 !! test
16504 Attribute test: unquoted value
16505 !! options
16506 parsoid=wt2html,html2html
16507 !! wikitext
16508 <font color=x>foo</font>
16509 !! html/php
16510 <p><font color="x">foo</font>
16511 </p>
16512 !! html/parsoid
16513 <p><font color="x" data-parsoid='{"stx":"html"}'>foo</font></p>
16514 !! end
16515
16516 !! test
16517 Attribute test: unquoted but illegal value (hash)
16518 !! wikitext
16519 <font color=#x>foo</font>
16520 !! html
16521 <p><font color="#x">foo</font>
16522 </p>
16523 !! end
16524
16525 # Parsoid does not serialize to empty attribute syntax,
16526 # so wt2wt and html2wt cases are skipped
16527 !! test
16528 Attribute test: no value (T54330)
16529 !! options
16530 parsoid=wt2html,html2html
16531 !! wikitext
16532 <font color>foo</font>
16533 !! html/php
16534 <p><font color="">foo</font>
16535 </p>
16536 !! html/parsoid
16537 <p><font color="">foo</font></p>
16538 !! end
16539
16540 !! test
16541 T4095: link with three closing brackets
16542 !! wikitext
16543 [[Main Page]]]
16544 !! html/php
16545 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
16546 </p>
16547 !! html/parsoid
16548 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a>]</p>
16549 !! end
16550
16551 !! test
16552 T4095: link with pipe and three closing brackets
16553 !! wikitext
16554 [[Main Page|link]]]
16555 !! html/php
16556 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
16557 </p>
16558 !! html/parsoid
16559 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">link</a>]</p>
16560 !! end
16561
16562 !! test
16563 T4095: link with pipe and three closing brackets, version 2
16564 !! wikitext
16565 [[Main Page|[http://example.com/]]]
16566 !! html/php
16567 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
16568 </p>
16569 !! html/parsoid
16570 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">[http://example.com/]</a></p>
16571 !! end
16572
16573
16574 ###
16575 ### Safety
16576 ###
16577
16578 !! article
16579 Template:Dangerous attribute
16580 !! text
16581 " onmouseover="alert(document.cookie)
16582 !! endarticle
16583
16584 !! article
16585 Template:Dangerous style attribute
16586 !! text
16587 border-size: expression(alert(document.cookie))
16588 !! endarticle
16589
16590 !! article
16591 Template:Div style
16592 !! text
16593 <div style="float: right; {{{1}}}">Magic div</div>
16594 !! endarticle
16595
16596 !! test
16597 T4304: HTML attribute safety (safe template; regression T4309)
16598 !! wikitext
16599 <div title="{{test}}"></div>
16600 !! html/php
16601 <div title="This is a test template"></div>
16602
16603 !! html/parsoid
16604 <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>
16605 !! end
16606
16607 # Parsoid has enough context to handle this case
16608 !! test
16609 T4304: HTML attribute safety (dangerous template; 2309)
16610 !! wikitext
16611 <div title="{{dangerous attribute}}"></div>
16612 !! html/php
16613 <div title=""></div>
16614
16615 !! html/parsoid
16616 <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>
16617 !! end
16618
16619 !! test
16620 T4304: HTML attribute safety (dangerous style template; 2309)
16621 !! wikitext
16622 <div style="{{dangerous style attribute}}"></div>
16623 !! html/php
16624 <div style="/* insecure input */"></div>
16625
16626 !! html/parsoid
16627 <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>
16628 !! end
16629
16630 !! test
16631 T4304: HTML attribute safety (safe parameter; 2309)
16632 !! wikitext
16633 {{div style|width: 200px}}
16634 !! html/php
16635 <div style="float: right; width: 200px">Magic div</div>
16636
16637 !! html/parsoid
16638 <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>
16639 !! end
16640
16641 !! test
16642 T4304: HTML attribute safety (unsafe parameter; 2309)
16643 !! wikitext
16644 {{div style|width: expression(alert(document.cookie))}}
16645 !! html/php
16646 <div style="/* insecure input */">Magic div</div>
16647
16648 !! html/parsoid
16649 <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>
16650 !! end
16651
16652 ## Parsoid output here differs; needs investigation.
16653 !! test
16654 T4304: HTML attribute safety (unsafe breakout parameter; 2309)
16655 !! wikitext
16656 {{div style|"><script>alert(document.cookie)</script>}}
16657 !! html
16658 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
16659
16660 !! end
16661
16662 ## Parsoid output here differs; needs investigation.
16663 !! test
16664 T4304: HTML attribute safety (unsafe breakout parameter 2; 2309)
16665 !! wikitext
16666 {{div style|" ><script>alert(document.cookie)</script>}}
16667 !! html
16668 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
16669
16670 !! end
16671
16672 !! test
16673 T4304: HTML attribute safety (link)
16674 !! wikitext
16675 <div title="[[Main Page]]"></div>
16676 !! html
16677 <div title="&#91;&#91;Main Page]]"></div>
16678
16679 !! end
16680
16681 !! test
16682 T4304: HTML attribute safety (italics)
16683 !! wikitext
16684 <div title="''foobar''"></div>
16685 !! html
16686 <div title="&#39;&#39;foobar&#39;&#39;"></div>
16687
16688 !! end
16689
16690 !! test
16691 T4304: HTML attribute safety (bold)
16692 !! wikitext
16693 <div title="'''foobar'''"></div>
16694 !! html
16695 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
16696
16697 !! end
16698
16699 !! test
16700 T4304: HTML attribute safety (ISBN)
16701 !! wikitext
16702 <div title="ISBN 1234567890"></div>
16703 !! html
16704 <div title="&#73;SBN 1234567890"></div>
16705
16706 !! end
16707
16708 !! test
16709 T4304: HTML attribute safety (RFC)
16710 !! wikitext
16711 <div title="RFC 1234"></div>
16712 !! html
16713 <div title="&#82;FC 1234"></div>
16714
16715 !! end
16716
16717 !! test
16718 T4304: HTML attribute safety (PMID)
16719 !! wikitext
16720 <div title="PMID 1234567890"></div>
16721 !! html
16722 <div title="&#80;MID 1234567890"></div>
16723
16724 !! end
16725
16726 !! test
16727 T4304: HTML attribute safety (web link)
16728 !! wikitext
16729 <div title="http://example.com/"></div>
16730 !! html
16731 <div title="http&#58;//example.com/"></div>
16732
16733 !! end
16734
16735 !! test
16736 T4304: HTML attribute safety (named web link)
16737 !! wikitext
16738 <div title="[http://example.com/ link]"></div>
16739 !! html
16740 <div title="&#91;http&#58;//example.com/ link]"></div>
16741
16742 !! end
16743
16744 !! test
16745 T5244: HTML attribute safety (extension; safe)
16746 !! wikitext
16747 <div style="<nowiki>background:blue</nowiki>"></div>
16748 !! html/php
16749 <div style="background:blue"></div>
16750
16751 !! html/parsoid
16752 <div style="background:blue" data-parsoid='{"stx":"html","a":{"style":"background:blue"},"sa":{"style":"&lt;nowiki>background:blue&lt;/nowiki>"}}'></div>
16753 !! end
16754
16755 !! test
16756 T5244: HTML attribute safety (extension; unsafe)
16757 !! wikitext
16758 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
16759 !! html/php
16760 <div style="/* insecure input */"></div>
16761
16762 !! html/parsoid
16763 <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>
16764 !! end
16765
16766 # More MSIE fun discovered by Tom Gilder
16767
16768 !! test
16769 MSIE CSS safety test: spurious slash
16770 !! wikitext
16771 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
16772 !! html/php
16773 <div style="/* insecure input */">evil</div>
16774
16775 !! html/parsoid
16776 <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>
16777 !! end
16778
16779 !! test
16780 MSIE CSS safety test: hex code
16781 !! wikitext
16782 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
16783 !! html/php
16784 <div style="/* insecure input */">evil</div>
16785
16786 !! html/parsoid
16787 <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>
16788 !! end
16789
16790 !! test
16791 MSIE CSS safety test: comment in url
16792 !! wikitext
16793 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
16794 !! html/php
16795 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
16796
16797 !! html/parsoid
16798 <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>
16799 !! end
16800
16801 !! test
16802 MSIE CSS safety test: comment in expression
16803 !! wikitext
16804 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
16805 !! html/php
16806 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
16807
16808 !! html/parsoid
16809 <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>
16810 !! end
16811
16812 !! test
16813 CSS safety test (all browsers): vertical tab (T57332 / CVE-2013-4567)
16814 !! wikitext
16815 <p style="font-size: 100px; background-image:url\b(https://www.google.com/images/srpr/logo6w.png)">A</p>
16816 !! html/php
16817 <p style="/* invalid control char */">A</p>
16818
16819 !! html/parsoid
16820 <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>
16821 !! end
16822
16823 !! test
16824 MSIE 6 CSS safety test: Fullwidth (T57332)
16825 !! wikitext
16826 <p style="font-size: 100px; color: expression((title='XSSed'),'red')">A</p>
16827 <div style="top:EXPRESSION(alert())">B</div>
16828 !! html/php
16829 <p style="/* insecure input */">A</p>
16830 <div style="/* insecure input */">B</div>
16831
16832 !! html/parsoid
16833 <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>
16834 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"top:EXPRESSION(alert())"}}'>B</div>
16835 !! end
16836
16837 !! test
16838 MSIE 6 CSS safety test: IPA extensions (T57332)
16839 !! wikitext
16840 <div style="background-image:uʀʟ(javascript:alert())">A</div>
16841 <p style="font-size: 100px; color: expʀessɪoɴ((title='XSSed'),'red')">B</p>
16842 !! html/php
16843 <div style="/* insecure input */">A</div>
16844 <p style="/* insecure input */">B</p>
16845
16846 !! html/parsoid
16847 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"background-image:uʀʟ(javascript:alert())"}}'>A</div>
16848 <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>
16849 !! end
16850
16851 !! test
16852 MSIE 6 CSS safety test: sup/sub script (T57332)
16853 !! wikitext
16854 <div style="background-image:url⁽javascript:alert())">A</div>
16855 <div style="background-image:url₍javascript:alert())">B</div>
16856 <p style="font-size: 100px; color: expressioⁿ((title='XSSed'),'red')">C</p>
16857 !! html/php
16858 <div style="/* insecure input */">A</div>
16859 <div style="/* insecure input */">B</div>
16860 <p style="/* insecure input */">C</p>
16861
16862 !! html/parsoid
16863 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"background-image:url⁽javascript:alert())"}}'>A</div>
16864 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"background-image:url₍javascript:alert())"}}'>B</div>
16865 <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>
16866 !! end
16867
16868 !! test
16869 Opera -o-link CSS
16870 !! options
16871 parsoid=wt2html,html2html
16872 !! wikitext
16873 <div
16874 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;"
16875 style="-o-link:attr(title);-o-link-source:current">X</div>
16876 !! html/php
16877 <div title="data:text/html,&lt;img src=1 onerror=alert(1)&gt;" style="/* insecure input */">X</div>
16878
16879 !! html/parsoid
16880 <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>
16881 !! end
16882
16883 !! test
16884 MSIE 6 CSS safety test: Repetition markers (T57332)
16885 !! wikitext
16886 <p style="font-size: 100px; color: expres〱ion((title='XSSed'),'red')">A</p>
16887 <p style="font-size: 100px; color: expresゝion((title='XSSed'),'red')">B</p>
16888 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">C</p>
16889 <p style="font-size: 100px; color: expresヽion((title='XSSed'),'red')">D</p>
16890 <p style="font-size: 100px; color: expresﹽion((title='XSSed'),'red')">E</p>
16891 <p style="font-size: 100px; color: expresﹼion((title='XSSed'),'red')">F</p>
16892 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">G</p>
16893 !! html/php
16894 <p style="/* insecure input */">A</p>
16895 <p style="/* insecure input */">B</p>
16896 <p style="/* insecure input */">C</p>
16897 <p style="/* insecure input */">D</p>
16898 <p style="/* insecure input */">E</p>
16899 <p style="/* insecure input */">F</p>
16900 <p style="/* insecure input */">G</p>
16901
16902 !! html/parsoid
16903 <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>
16904 <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>
16905 <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>
16906 <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>
16907 <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>
16908 <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>
16909 <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>
16910 !! end
16911
16912 !! test
16913 Table attribute legitimate extension
16914 !! wikitext
16915 {|
16916 !+ style="<nowiki>color:blue</nowiki>"| status
16917 |}
16918 !! html
16919 <table>
16920 <tr>
16921 <th style="color:blue"> status
16922 </th></tr></table>
16923
16924 !!end
16925
16926 !! test
16927 Table attribute safety
16928 !! wikitext
16929 {|
16930 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
16931 |}
16932 !! html
16933 <table>
16934 <tr>
16935 <th style="/* insecure input */"> status
16936 </th></tr></table>
16937
16938 !! end
16939
16940 !! test
16941 CSS line continuation 1
16942 !! wikitext
16943 <div style="background-image: u\&#10;rl(test.jpg);"></div>
16944 !! html
16945 <div style="/* insecure input */"></div>
16946
16947 !! end
16948
16949 !! test
16950 CSS line continuation 2
16951 !! wikitext
16952 <div style="background-image: u\&#13;rl(test.jpg); "></div>
16953 !! html
16954 <div style="/* invalid control char */"></div>
16955
16956 !! end
16957
16958 !! article
16959 Template:Identity
16960 !! text
16961 {{{1}}}
16962 !! endarticle
16963
16964 !! test
16965 Expansion of multi-line templates in attribute values (T8255)
16966 !! wikitext
16967 <div style="background: {{identity|#00FF00}}">-</div>
16968 !! html
16969 <div style="background: #00FF00">-</div>
16970
16971 !! end
16972
16973 !! test
16974 Expansion of multi-line templates in attribute values (T8255 sanity check)
16975 !! wikitext
16976 <div style="background:
16977 #00FF00">-</div>
16978 !! html/php
16979 <div style="background: #00FF00">-</div>
16980
16981 !! html/parsoid
16982 <div style="background:
16983 #00FF00">-</div>
16984 !! end
16985
16986 !! test
16987 Expansion of multi-line templates in attribute values (T8255 sanity check 2)
16988 !! wikitext
16989 <div style="background: &#10;#00FF00">-</div>
16990 !! html
16991 <div style="background: &#10;#00FF00">-</div>
16992
16993 !! end
16994
16995 !! test
16996 Tags which are hidden from Tidy cannot pass through the Sanitizer
16997 !! wikitext
16998 <mw:toc><script>alert();</script></mw:toc>
16999 !! html+tidy
17000 <p>&lt;mw:toc&gt;&lt;script&gt;alert();&lt;/script&gt;&lt;/mw:toc&gt;</p>
17001 !! end
17002
17003 ###
17004 ### Parser hooks (see tests/parser/parserTestsParserHook.php for the <tag> extension)
17005 ###
17006
17007 !! test
17008 Parser hook: empty input
17009 !! wikitext
17010 <tag></tag>
17011 !! html/php
17012 <pre>
17013 ''
17014 array (
17015 )
17016 </pre>
17017
17018 !! html/parsoid
17019 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
17020 !! end
17021
17022 ## Don't expect parsoid to rt this form.
17023 !! test
17024 Parser hook: empty input using terminated empty elements
17025 !! options
17026 parsoid=wt2html,html2html
17027 !! wikitext
17028 <tag/>
17029 !! html/php
17030 <pre>
17031 NULL
17032 array (
17033 )
17034 </pre>
17035
17036 !! html/parsoid
17037 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":null}' data-parsoid='{}' about="#mwt2"></pre>
17038 !! end
17039
17040 !! test
17041 Parser hook: empty input using terminated empty elements (space before)
17042 !! wikitext
17043 <tag />
17044 !! html/php
17045 <pre>
17046 NULL
17047 array (
17048 )
17049 </pre>
17050
17051 !! html/parsoid
17052 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":null}' data-parsoid='{}' about="#mwt2"></pre>
17053 !! end
17054
17055 !! test
17056 Parser hook: basic input
17057 !! wikitext
17058 <tag>input</tag>
17059 !! html/php
17060 <pre>
17061 'input'
17062 array (
17063 )
17064 </pre>
17065
17066 !! html/parsoid
17067 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
17068 !! end
17069
17070 ## Don't expect parsoid to rt this form.
17071 !! test
17072 Parser hook: case insensitive
17073 !! options
17074 parsoid=wt2html,html2html
17075 !! wikitext
17076 <TAG>input</TAG>
17077 !! html/php
17078 <pre>
17079 'input'
17080 array (
17081 )
17082 </pre>
17083
17084 !! html/parsoid
17085 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
17086 !! end
17087
17088 ## Don't expect parsoid to rt this form.
17089 !! test
17090 Parser hook: case insensitive, redux
17091 !! options
17092 parsoid=wt2html,html2html
17093 !! wikitext
17094 <TaG>input</TAg>
17095 !! html/php
17096 <pre>
17097 'input'
17098 array (
17099 )
17100 </pre>
17101
17102 !! html/parsoid
17103 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
17104 !! end
17105
17106 !! test
17107 Parser hook: nested tags
17108 !! wikitext
17109 <tag><tag></tag></tag>
17110 !! html/php
17111 <pre>
17112 '<tag>'
17113 array (
17114 )
17115 </pre>&lt;/tag&gt;
17116
17117 !! html/parsoid
17118 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"&lt;tag>"}}' data-parsoid='{}' about="#mwt2"></pre>&lt;/tag>
17119 !! end
17120
17121 !! test
17122 Parser hook: basic arguments
17123 !! wikitext
17124 <tag width="200" height="100" depth="50" square=""></tag>
17125 !! html/php
17126 <pre>
17127 ''
17128 array (
17129 'width' => '200',
17130 'height' => '100',
17131 'depth' => '50',
17132 'square' => '',
17133 )
17134 </pre>
17135
17136 !! html/parsoid
17137 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
17138 !! end
17139
17140 ## Don't expect parsoid to rt this form.
17141 !! test
17142 Parser hook: basic arguments, variations
17143 !! options
17144 parsoid=wt2html,html2html
17145 !! wikitext
17146 <tag width=200 height = "100" depth = '50' square></tag>
17147 !! html/php
17148 <pre>
17149 ''
17150 array (
17151 'width' => '200',
17152 'height' => '100',
17153 'depth' => '50',
17154 'square' => '',
17155 )
17156 </pre>
17157
17158 !! html/parsoid
17159 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
17160 !! end
17161
17162 !! test
17163 Parser hook: argument containing a forward slash (T7344)
17164 !! wikitext
17165 <tag filename="/tmp/bla"></tag>
17166 !! html/php
17167 <pre>
17168 ''
17169 array (
17170 'filename' => '/tmp/bla',
17171 )
17172 </pre>
17173
17174 !! html/parsoid
17175 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"filename":"/tmp/bla"},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
17176 !! end
17177
17178 ## Don't expect parsoid to rt this form.
17179 !! test
17180 Parser hook: empty input using terminated empty elements (T4374)
17181 !! options
17182 parsoid=wt2html,html2html
17183 !! wikitext
17184 <tag foo=bar/>text
17185 !! html/php
17186 <pre>
17187 NULL
17188 array (
17189 'foo' => 'bar',
17190 )
17191 </pre>text
17192
17193 !! html/parsoid
17194 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"foo":"bar"},"body":null}' data-parsoid='{}' about="#mwt2"></pre>text
17195 !! end
17196
17197 ## </tag> should be output literally since there is no matching tag that begins it
17198 ## Don't expect parsoid to rt this form.
17199 !! test
17200 Parser hook: basic arguments using terminated empty elements (T4374)
17201 !! options
17202 parsoid=wt2html
17203 !! wikitext
17204 <tag width=200 height = "100" depth = '50' square/>
17205 other stuff
17206 </tag>
17207 !! html/php
17208 <pre>
17209 NULL
17210 array (
17211 'width' => '200',
17212 'height' => '100',
17213 'depth' => '50',
17214 'square' => '',
17215 )
17216 </pre>
17217 <p>other stuff
17218 &lt;/tag&gt;
17219 </p>
17220 !! html/parsoid
17221 <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
17222 &lt;/tag></p>
17223 !! end
17224
17225 ## Don't expect parsoid to rt this form.
17226 !! test
17227 Parser hook: Don't allow unclosed extension tags
17228 !! options
17229 parsoid=wt2html
17230 !! wikitext
17231 test <tag>123
17232
17233 this is a '''test'''
17234 !! html/php
17235 <p>test &lt;tag&gt;123
17236 </p><p>this is a <b>test</b>
17237 </p>
17238 !! html/parsoid
17239 <p>test &lt;tag>123</p>
17240
17241 <p>this is a <b>test</b></p>
17242 !! end
17243
17244 ###
17245 ### (see tests/parser/parserTestsParserHook.php for the <statictag> extension)
17246 ###
17247
17248 !! test
17249 Parser hook: static parser hook not inside a comment
17250 !! wikitext
17251 <statictag>hello, world</statictag>
17252
17253 <statictag action="flush" />
17254 !! html/php
17255 <p><br />
17256 hello, world
17257 </p>
17258 !! html/parsoid
17259 <p><span typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{},"body":{"extsrc":"hello, world"}}' data-parsoid='{}' about="#mwt2"></span></p>
17260 <p typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{"action":"flush"},"body":null}' data-parsoid='{}' about="#mwt4">hello, world</p>
17261 !! end
17262
17263 !! test
17264 Parser hook: static parser hook inside a comment
17265 !! wikitext
17266 <!-- <statictag>hello, world</statictag> -->
17267 <statictag action="flush" />
17268 !! html/php
17269 <p><br />
17270 </p>
17271 !! html/parsoid
17272 <!-- <statictag&#x3E;hello, world</statictag&#x3E; -->
17273 <p typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{"action":"flush"},"body":null}' data-parsoid='{}' about="#mwt2"></p>
17274 !! end
17275
17276 # Nested template calls; this case was broken by Parser.php rev 1.506,
17277 # since reverted.
17278
17279 !! article
17280 Template:One-parameter
17281 !! text
17282 (My parameter is: {{{1}}})
17283 !! endarticle
17284
17285 !! article
17286 Template:Map-one-parameter
17287 !! text
17288 {{{{{1}}}|{{{2}}}}}
17289 !! endarticle
17290
17291 !! test
17292 Nested template calls
17293 !! wikitext
17294 {{Map-one-parameter|One-parameter|param}}
17295 !! html
17296 <p>(My parameter is: param)
17297 </p>
17298 !! end
17299
17300
17301 ###
17302 ### Sanitizer
17303 ###
17304
17305 # HTML+Tidy effectively strips out the empty tags completely
17306 # But since Parsoid doesn't it wraps the <s></s> tags in p-tags
17307 # which Tidy would have done for the PHP parser had there been content inside it.
17308 !! test
17309 Sanitizer: Closing of open tags
17310 !! wikitext
17311 <s></s><table></table>
17312 !! html
17313 <s></s><table></table>
17314
17315 !! html/parsoid
17316 <p><s></s></p><table></table>
17317 !! end
17318
17319 !! test
17320 Sanitizer: Closing of open but not closed tags
17321 !! wikitext
17322 <s>foo
17323 !! html
17324 <p><s>foo</s>
17325 </p>
17326 !! end
17327
17328 !! test
17329 Sanitizer: Closing of closed but not open tags
17330 !! options
17331 parsoid=wt2html
17332 !! wikitext
17333 </s>
17334 !! html/php+tidy
17335 !! html/parsoid
17336 !! end
17337
17338 !! test
17339 Sanitizer: Closing of closed but not open table tags
17340 !! options
17341 parsoid=wt2html
17342 !! wikitext
17343 Table not started</td></tr></table>
17344 !! html/php+tidy
17345 <p>Table not started</p>
17346 !! html/parsoid
17347 <p>Table not started</p>
17348 !! end
17349
17350 !! test
17351 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
17352 !! wikitext
17353 <span id="æ: v">byte</span>[[#æ: v|backlink]]
17354 !! html/php
17355 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
17356 </p>
17357 !! html/parsoid
17358 <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>
17359 !! end
17360
17361 # In HTML5, the restrictions are that id must contain at least one character,
17362 # and must not contain any space characters.
17363 !! test
17364 Sanitizer: Validating the contents of the id attribute (T6515)
17365 !! options
17366 disabled
17367 !! wikitext
17368 <br id="" /><br id="a space" />
17369 !! html
17370 Something ...
17371 !! end
17372
17373 # In HTML5, id must be unique amongst all the ids in the element's home subtree.
17374 !! test
17375 Sanitizer: Validating id attribute uniqueness (T6515, T8301)
17376 !! options
17377 disabled
17378 !! wikitext
17379 <br id="foo" /><br id="foo" />
17380 !! html
17381 Something need to be done. foo-2 ?
17382 !! end
17383
17384 !! test
17385 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
17386 !! wikitext
17387 <div itemscope>
17388 <meta itemprop="hello" content="world">
17389 <meta http-equiv="refresh" content="5">
17390 <meta itemprop="hello" http-equiv="refresh" content="5">
17391 <link itemprop="hello" href="{{SERVER}}">
17392 <link rel="stylesheet" href="{{SERVER}}">
17393 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
17394 </div>
17395 !! html
17396 <div itemscope="">
17397 <p> <meta itemprop="hello" content="world" />
17398 &lt;meta http-equiv="refresh" content="5"&gt;
17399 <meta itemprop="hello" content="5" />
17400 </p>
17401 <link itemprop="hello" href="http&#58;//example.org" />
17402 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
17403 <link itemprop="hello" href="http&#58;//example.org" />
17404 </div>
17405
17406 !! end
17407
17408 !! test
17409 Language converter: output gets cut off unexpectedly (T7757)
17410 !! options
17411 language=zh
17412 !! wikitext
17413 this bit is safe: }-
17414
17415 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
17416
17417 then we get cut off here: }-
17418
17419 all additional text is vanished
17420 !! html
17421 <p>this bit is safe: }-
17422 </p><p>but if we add a conversion instance: xxx
17423 </p><p>then we get cut off here: }-
17424 </p><p>all additional text is vanished
17425 </p>
17426 !! end
17427
17428 !! test
17429 Self closed html pairs (T7487)
17430 !! options
17431 !! wikitext
17432 <center><font id="bug" />Centered text</center>
17433 <div><font id="bug2" />In div text</div>
17434 !! html
17435 <center>&lt;font id="bug" /&gt;Centered text</center>
17436 <div>&lt;font id="bug2" /&gt;In div text</div>
17437
17438 !! end
17439
17440 #
17441 #
17442 #
17443
17444 !! test
17445 Punctuation: nbsp before exclamation
17446 !! wikitext
17447 C'est grave !
17448 !! html
17449 <p>C'est grave&#160;!
17450 </p>
17451 !! end
17452
17453 !! test
17454 Punctuation: CSS !important (T13874)
17455 !! wikitext
17456 <div style="width:50% !important">important</div>
17457 !! html
17458 <div style="width:50% !important">important</div>
17459
17460 !!end
17461
17462 !! test
17463 Punctuation: CSS ! important (T13874; with space after)
17464 !! wikitext
17465 <div style="width:50% ! important">important</div>
17466 !! html
17467 <div style="width:50% ! important">important</div>
17468
17469 !!end
17470
17471 !! test
17472 HTML bullet list, closed tags (T7497)
17473 !! wikitext
17474 <ul>
17475 <li>One</li>
17476 <li>Two</li>
17477 </ul>
17478 !! html/php
17479 <ul>
17480 <li>One</li>
17481 <li>Two</li>
17482 </ul>
17483
17484 !! html/parsoid
17485 <ul data-parsoid='{"stx":"html"}'>
17486 <li data-parsoid='{"stx":"html"}'>One</li>
17487 <li data-parsoid='{"stx":"html"}'>Two</li>
17488 </ul>
17489
17490 !! end
17491
17492 !! test
17493 HTML bullet list, unclosed tags (T7497)
17494 !! wikitext
17495 <ul>
17496 <li>One
17497 <li>Two
17498 </ul>
17499 !! html/php+tidy
17500 <ul>
17501 <li>One</li>
17502 <li>Two</li>
17503 </ul>
17504 !! html/parsoid
17505 <ul data-parsoid='{"stx":"html"}'>
17506 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
17507 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
17508 </ul>
17509
17510 !! end
17511
17512 !! test
17513 HTML ordered list, closed tags (T7497)
17514 !! wikitext
17515 <ol>
17516 <li>One</li>
17517 <li>Two</li>
17518 </ol>
17519 !! html/php
17520 <ol>
17521 <li>One</li>
17522 <li>Two</li>
17523 </ol>
17524
17525 !! html/parsoid
17526 <ol data-parsoid='{"stx":"html"}'>
17527 <li data-parsoid='{"stx":"html"}'>One</li>
17528 <li data-parsoid='{"stx":"html"}'>Two</li>
17529 </ol>
17530
17531 !! end
17532
17533 !! test
17534 HTML ordered list, unclosed tags (T7497)
17535 !! options
17536 !! wikitext
17537 <ol>
17538 <li>One
17539 <li>Two
17540 </ol>
17541 !! html/php+tidy
17542 <ol>
17543 <li>One</li>
17544 <li>Two</li>
17545 </ol>
17546 !! html/parsoid
17547 <ol data-parsoid='{"stx":"html"}'>
17548 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
17549 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
17550 </ol>
17551
17552 !! end
17553
17554 !! test
17555 HTML nested bullet list, closed tags (T7497)
17556 !! wikitext
17557 <ul>
17558 <li>One</li>
17559 <li>Two:
17560 <ul>
17561 <li>Sub-one</li>
17562 <li>Sub-two</li>
17563 </ul>
17564 </li>
17565 </ul>
17566 !! html/php
17567 <ul>
17568 <li>One</li>
17569 <li>Two:
17570 <ul>
17571 <li>Sub-one</li>
17572 <li>Sub-two</li>
17573 </ul>
17574 </li>
17575 </ul>
17576
17577 !! html/parsoid
17578 <ul data-parsoid='{"stx":"html"}'>
17579 <li data-parsoid='{"stx":"html"}'>One</li>
17580 <li data-parsoid='{"stx":"html"}'>Two:
17581 <ul data-parsoid='{"stx":"html"}'>
17582 <li data-parsoid='{"stx":"html"}'>Sub-one</li>
17583 <li data-parsoid='{"stx":"html"}'>Sub-two</li>
17584 </ul>
17585 </li>
17586 </ul>
17587 !! end
17588
17589 !! test
17590 HTML nested bullet list, open tags (T7497)
17591 !! wikitext
17592 <ul>
17593 <li>One
17594 <li>Two:
17595 <ul>
17596 <li>Sub-one
17597 <li>Sub-two
17598 </ul>
17599 </ul>
17600 !! html/php+tidy
17601 <ul>
17602 <li>One</li>
17603 <li>Two:
17604 <ul>
17605 <li>Sub-one</li>
17606 <li>Sub-two</li>
17607 </ul>
17608 </li>
17609 </ul>
17610 !! html/parsoid
17611 <ul>
17612 <li>One
17613 </li>
17614 <li>Two:
17615 <ul>
17616 <li>Sub-one
17617 </li>
17618 <li>Sub-two
17619 </li>
17620 </ul>
17621 </li>
17622 </ul>
17623
17624 !! end
17625
17626 !! test
17627 HTML nested ordered list, closed tags (T7497)
17628 !! wikitext
17629 <ol>
17630 <li>One</li>
17631 <li>Two:
17632 <ol>
17633 <li>Sub-one</li>
17634 <li>Sub-two</li>
17635 </ol>
17636 </li>
17637 </ol>
17638 !! html
17639 <ol>
17640 <li>One</li>
17641 <li>Two:
17642 <ol>
17643 <li>Sub-one</li>
17644 <li>Sub-two</li>
17645 </ol>
17646 </li>
17647 </ol>
17648
17649 !! end
17650
17651 !! test
17652 HTML nested ordered list, open tags (T7497)
17653 !! wikitext
17654 <ol>
17655 <li>One
17656 <li>Two:
17657 <ol>
17658 <li>Sub-one
17659 <li>Sub-two
17660 </ol>
17661 </ol>
17662 !! html/php
17663 <ol>
17664 <li>One
17665 <li>Two:
17666 <ol>
17667 <li>Sub-one
17668 <li>Sub-two
17669 </ol>
17670 </ol>
17671
17672 !! html/parsoid
17673 <ol>
17674 <li>One
17675 </li>
17676 <li>Two:
17677 <ol>
17678 <li>Sub-one
17679 </li>
17680 <li>Sub-two
17681 </li>
17682 </ol>
17683 </li>
17684 </ol>
17685
17686 !! end
17687
17688 !! test
17689 HTML ordered list item with parameters oddity
17690 !! wikitext
17691 <ol><li id="fragment">One</li>
17692 </ol>
17693 !! html
17694 <ol><li id="fragment">One</li>
17695 </ol>
17696
17697 !! end
17698
17699 # parsoid doesn't explicitly mark autonumbered links, see T55505
17700 !!test
17701 T7918: autonumbering
17702 !! wikitext
17703 [http://first/] [http://second] [ftp://ftp]
17704
17705 ftp://inlineftp
17706
17707 [mailto:enclosed@mail.tld With target]
17708
17709 [mailto:enclosed@mail.tld]
17710
17711 mailto:inline@mail.tld
17712 !! html/php
17713 <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>
17714 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
17715 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
17716 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
17717 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
17718 </p>
17719 !! html/parsoid
17720 <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>
17721 <p><a rel="mw:ExtLink" href="ftp://inlineftp">ftp://inlineftp</a></p>
17722 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld">With target</a></p>
17723 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld"></a></p>
17724 <p><a rel="mw:ExtLink" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a></p>
17725 !! end
17726
17727
17728 #
17729 # Security and HTML correctness
17730 # From Nick Jenkins' fuzz testing
17731 #
17732
17733 !! test
17734 Fuzz testing: Parser13
17735 !! wikitext
17736 {|
17737 | http://a|
17738 !! html
17739 <table>
17740 <tr>
17741 <td>
17742 </td>
17743 </tr>
17744 </table>
17745
17746 !! end
17747
17748 !! test
17749 Fuzz testing: Parser14
17750 !! wikitext
17751 == onmouseover= ==
17752 http://__TOC__
17753 !! html
17754 <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>
17755 http://<div id="toc" class="toc"><div id="toctitle" class="toctitle"><h2>Contents</h2></div>
17756 <ul>
17757 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
17758 </ul>
17759 </div>
17760
17761
17762 !! html+tidy
17763 <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>
17764 <p>http://</p>
17765 <div id="toc" class="toc">
17766 <div id="toctitle" class="toctitle">
17767 <h2>Contents</h2>
17768 </div>
17769 <ul>
17770 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
17771 </ul>
17772 </div>
17773 <p></p>
17774 !! end
17775
17776 !! test
17777 Fuzz testing: Parser14-table
17778 !! options
17779 parsoid=wt2html,html2html
17780 !! wikitext
17781 ==a==
17782 {| STYLE=__TOC__
17783 !! html
17784 <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>
17785 <table style="&#95;_TOC&#95;_">
17786 <tr><td></td></tr>
17787 </table>
17788
17789 !! html+tidy
17790 <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>
17791 <table style="__TOC__">
17792 <tr>
17793 <td></td>
17794 </tr>
17795 </table>
17796 !! html/parsoid
17797 <h2>a</h2>
17798 <table style="__TOC__"></table>
17799 !! end
17800
17801 # Known to produce bogus xml (extra </td>)
17802 !! test
17803 Fuzz testing: Parser16
17804 !! wikitext
17805 {|
17806 !https://||||||
17807 !! html
17808 <table>
17809 <tr>
17810 <th>https://</th>
17811 <th></th>
17812 <th></th>
17813 <th>
17814 </td>
17815 </tr>
17816 </table>
17817
17818 !! html+tidy
17819 <table>
17820 <tr>
17821 <th>https://</th>
17822 <th></th>
17823 <th></th>
17824 <th></th>
17825 </tr>
17826 </table>
17827 !! end
17828
17829 !! test
17830 Fuzz testing: Parser21
17831 !! wikitext
17832 {|
17833 ! irc://{{ftp://a" onmouseover="alert('hello world');"
17834 |
17835 !! html
17836 <table>
17837 <tr>
17838 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
17839 </th>
17840 <td>
17841 </td>
17842 </tr>
17843 </table>
17844
17845 !! end
17846
17847 !! test
17848 Fuzz testing: Parser22
17849 !! wikitext
17850 http://===r:::https://b
17851
17852 {|
17853 !! html
17854 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
17855 </p>
17856 <table>
17857 <tr><td></td></tr>
17858 </table>
17859
17860 !! end
17861
17862 # Known to produce bad XML for now
17863 !! test
17864 Fuzz testing: Parser24
17865 !! options
17866 parsoid=wt2html
17867 !! wikitext
17868 {|
17869 {{{|
17870 <u CLASS=
17871 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
17872 <br style="onmouseover='alert(document.cookie);' " />
17873
17874 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
17875 |
17876 !! html/php
17877 <table>
17878 {{{|
17879 <u class="&#124;">}}}} &gt;
17880 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
17881
17882 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
17883 <tr>
17884 <td></u>
17885 </td>
17886 </tr>
17887 </table>
17888
17889 !! html/parsoid
17890 <p data-parsoid='{"fostered":true,"autoInsertedEnd":true}'>{{{|
17891 <u class="|" about="#mwt2" typeof="mw:ExpandedAttrs" data-parsoid='{"stx":"html","a":{"{{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx-->&lt;noinclude>}}}}":null},"sa":{"{{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx-->&lt;noinclude>}}}}":""},"autoInsertedEnd":true}' data-mw='{"attribs":[[{"txt":"{{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx-->}}}}","html":"{&lt;span about=\"#mwt1\" typeof=\"mw:Param\" data-parsoid=&#39;{\"pi\":[[]],\"dsr\":[21,79,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"templatearg\":{\"target\":{\"wt\":\"SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx-->&amp;lt;noinclude>\"},\"params\":{},\"i\":0}}]}&#39;>{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx-->}}}&lt;/span>}"},{"html":""}]]}'>
17892 <br style="onmouseover='alert(document.cookie);' " data-parsoid='{"stx":"html","selfClose":true}'/></u></p><p data-parsoid='{"fostered":true,"autoInsertedEnd":true}'><u class="|" about="#mwt2" typeof="mw:ExpandedAttrs" data-parsoid='{"stx":"html","a":{"{{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx-->&lt;noinclude>}}}}":null},"sa":{"{{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx-->&lt;noinclude>}}}}":""},"autoInsertedEnd":true,"autoInsertedStart":true}' data-mw='{"attribs":[[{"txt":"{{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx-->}}}}","html":"{&lt;span about=\"#mwt1\" typeof=\"mw:Param\" data-parsoid=&#39;{\"pi\":[[]],\"dsr\":[21,79,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"templatearg\":{\"target\":{\"wt\":\"SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx-->&amp;lt;noinclude>\"},\"params\":{},\"i\":0}}]}&#39;>{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx-->}}}&lt;/span>}"},{"html":""}]]}'>MOVE YOUR MOUSE CURSOR OVER THIS TEXT</u></p><table data-parsoid='{"autoInsertedEnd":true}'>
17893
17894
17895
17896 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'></td></tr></tbody></table>
17897 !! end
17898
17899 # Note: the current result listed for this is not what the original one was,
17900 # but the original bug was JavaScript injection, which is fixed in any case.
17901 # It's not clear that the original result listed was any more correct than the
17902 # current one. Original result:
17903 # <p>{{{|
17904 # </p>
17905 # <li class="&#124;&#124;">
17906 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
17907 !!test
17908 Fuzz testing: Parser25 (T8055)
17909 !! wikitext
17910 {{{
17911 |
17912 <LI CLASS=||
17913 >
17914 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
17915 !! html/php
17916 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
17917 </p>
17918 !! html/parsoid
17919 <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"]}'>
17920 </span><p about="#mwt1">&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b></p>
17921 !! end
17922
17923 !!test
17924 Fuzz testing: URL adjacent extension (with space, clean)
17925 !! wikitext
17926 http://example.com <nowiki>junk</nowiki>
17927 !! html/php
17928 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
17929 </p>
17930 !! html/parsoid
17931 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a> <span typeof="mw:Nowiki">junk</span></p>
17932 !! end
17933
17934 !!test
17935 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
17936 !! wikitext
17937 http://example.com<nowiki>junk</nowiki>
17938 !! html/php
17939 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
17940 </p>
17941 !! html/parsoid
17942 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a><span typeof="mw:Nowiki">junk</span></p>
17943 !! end
17944
17945 !! test
17946 Fuzz testing: URL adjacent extension (no space, dirty; pre)
17947 !! wikitext
17948 http://example.com<pre>junk</pre>
17949 !! html/php
17950 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
17951
17952 !! html/php+tidy
17953 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></p>
17954 <pre>
17955 junk
17956 </pre>
17957 !! html/parsoid
17958 <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>
17959 !! end
17960
17961 !! test
17962 Fuzz testing: image with bogus manual thumbnail
17963 !! wikitext
17964 [[Image:foobar.jpg|thumbnail= ]]
17965 !! html/php
17966 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
17967
17968 !! html/parsoid
17969 <figure class="mw-default-size" typeof="mw:Error mw:Image/Thumb" data-parsoid='{"optList":[{"ck":"manualthumb","ak":"thumbnail= "}]}' data-mw='{"errors":[{"key":"missing-thumbnail","message":"This thumbnail does not exist.","params":{"name":""}}],"thumb":""}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="./Special:FilePath/" height="220" width="220" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"220"},"sa":{"resource":"Image:foobar.jpg"}}'/></a></figure>
17970 !! end
17971
17972 !! test
17973 Fuzz testing: encoded newline in generated HTML replacements (T8577)
17974 !! wikitext
17975 <pre dir="&#10;"></pre>
17976 !! html/php
17977 <pre dir="&#10;"></pre>
17978
17979 !! html/parsoid
17980 <pre typeof="mw:Extension/pre" about="#mwt2" dir="&amp;#10;" data-mw='{"name":"pre","attrs":{"dir":"&amp;#10;"},"body":{"extsrc":""}}'></pre>
17981 !! end
17982
17983 !! test
17984 Parsing optional HTML elements (T8171)
17985 !! options
17986 !! wikitext
17987 <table>
17988 <tr>
17989 <td> Some tabular data</td>
17990 <td> More tabular data ...
17991 <td> And yet som tabular data</td>
17992 </tr>
17993 </table>
17994 !! html
17995 <table>
17996 <tr>
17997 <td> Some tabular data</td>
17998 <td> More tabular data ...
17999 </td><td> And yet som tabular data</td>
18000 </tr>
18001 </table>
18002
18003 !! end
18004
18005 !! test
18006 Correct handling of <td>, <tr> (T8171)
18007 !! options
18008 !! wikitext
18009 <table>
18010 <tr>
18011 <td> Some tabular data</td>
18012 <td> More tabular data ...</td>
18013 <td> And yet som tabular data</td>
18014 </tr>
18015 </table>
18016 !! html
18017 <table>
18018 <tr>
18019 <td> Some tabular data</td>
18020 <td> More tabular data ...</td>
18021 <td> And yet som tabular data</td>
18022 </tr>
18023 </table>
18024
18025 !! end
18026
18027
18028 !! test
18029 Parsing crashing regression (fr:JavaScript)
18030 !! wikitext
18031 </body></x>
18032 !! html
18033 <p>&lt;/body&gt;&lt;/x&gt;
18034 </p>
18035 !! end
18036
18037 !! test
18038 Inline wiki vs wiki block nesting
18039 !! wikitext
18040 '''Bold paragraph
18041
18042 New wiki paragraph
18043 !! html
18044 <p><b>Bold paragraph</b>
18045 </p><p>New wiki paragraph
18046 </p>
18047 !! end
18048
18049 # FIXME: The current php output is documented
18050 # and desired output is the parsoid target.
18051 !! test
18052 Inline HTML vs wiki block nesting
18053 !! wikitext
18054 <b>Bold paragraph
18055
18056 New wiki paragraph
18057 !! html/php
18058 <p><b>Bold paragraph
18059 </p><p>New wiki paragraph</b>
18060 </p>
18061 !! html/parsoid
18062 <p><b>Bold paragraph</b>
18063 </p><p>New wiki paragraph
18064 </p>
18065 !! end
18066
18067 # Original result was this:
18068 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
18069 # </p>
18070 # While that might be marginally more intuitive, maybe, the six-apostrophe
18071 # construct is clearly pathological and the result stated here (which is what
18072 # the parser actually does) is about as reasonable as anything.
18073 !!test
18074 Mixing markup for italics and bold
18075 !! options
18076 !! wikitext
18077 '''bold''''''bold''bolditalics'''''
18078 !! html
18079 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
18080 </p>
18081 !! end
18082
18083
18084 !! article
18085 Xyzzyx
18086 !! text
18087 Article for special page transclusion test
18088 !! endarticle
18089
18090 !! test
18091 Special page transclusion
18092 !! options
18093 !! wikitext
18094 {{Special:Prefixindex/Xyzzyx}}
18095 !! html
18096 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
18097 </ul>
18098
18099 !! end
18100
18101 !! test
18102 Special page transclusion twice (T7021)
18103 !! options
18104 !! wikitext
18105 {{Special:Prefixindex/Xyzzyx}}
18106 {{Special:Prefixindex/Xyzzyx}}
18107 !! html
18108 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
18109 </ul>
18110 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
18111 </ul>
18112
18113 !! end
18114
18115 !! test
18116 Transclusion of default MediaWiki message
18117 !! wikitext
18118 {{MediaWiki:Mainpage}}
18119 !! html
18120 <p>Main Page
18121 </p>
18122 !! end
18123
18124 !! test
18125 Transclusion of nonexistent MediaWiki message
18126 !! wikitext
18127 {{MediaWiki:Mainpagexxx}}
18128 !! html
18129 <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>
18130 </p>
18131 !! end
18132
18133 !! test
18134 Transclusion of MediaWiki message with underscore
18135 !! wikitext
18136 {{MediaWiki:history_short}}
18137 !! html
18138 <p>History
18139 </p>
18140 !! end
18141
18142 !! test
18143 Transclusion of MediaWiki message with space
18144 !! wikitext
18145 {{MediaWiki:history short}}
18146 !! html
18147 <p>History
18148 </p>
18149 !! end
18150
18151 !! test
18152 Invalid header with following text
18153 !! wikitext
18154 = x = y
18155 !! html
18156 <p>= x = y
18157 </p>
18158 !! end
18159
18160
18161 !! test
18162 Section extraction test (section 0)
18163 !! options
18164 section=0
18165 !! wikitext
18166 start
18167 ==a==
18168 ===aa===
18169 ====aaa====
18170 ==b==
18171 ===ba===
18172 ===bb===
18173 ====bba====
18174 ===bc===
18175 ==c==
18176 ===ca===
18177 !! html/php
18178 start
18179 !! end
18180
18181 !! test
18182 Section extraction test (section 1)
18183 !! options
18184 section=1
18185 !! wikitext
18186 start
18187 ==a==
18188 ===aa===
18189 ====aaa====
18190 ==b==
18191 ===ba===
18192 ===bb===
18193 ====bba====
18194 ===bc===
18195 ==c==
18196 ===ca===
18197 !! html/php
18198 ==a==
18199 ===aa===
18200 ====aaa====
18201 !! end
18202
18203 !! test
18204 Section extraction test (section 2)
18205 !! options
18206 section=2
18207 !! wikitext
18208 start
18209 ==a==
18210 ===aa===
18211 ====aaa====
18212 ==b==
18213 ===ba===
18214 ===bb===
18215 ====bba====
18216 ===bc===
18217 ==c==
18218 ===ca===
18219 !! html/php
18220 ===aa===
18221 ====aaa====
18222 !! end
18223
18224 !! test
18225 Section extraction test (section 3)
18226 !! options
18227 section=3
18228 !! wikitext
18229 start
18230 ==a==
18231 ===aa===
18232 ====aaa====
18233 ==b==
18234 ===ba===
18235 ===bb===
18236 ====bba====
18237 ===bc===
18238 ==c==
18239 ===ca===
18240 !! html/php
18241 ====aaa====
18242 !! end
18243
18244 !! test
18245 Section extraction test (section 4)
18246 !! options
18247 section=4
18248 !! wikitext
18249 start
18250 ==a==
18251 ===aa===
18252 ====aaa====
18253 ==b==
18254 ===ba===
18255 ===bb===
18256 ====bba====
18257 ===bc===
18258 ==c==
18259 ===ca===
18260 !! html/php
18261 ==b==
18262 ===ba===
18263 ===bb===
18264 ====bba====
18265 ===bc===
18266 !! end
18267
18268 !! test
18269 Section extraction test (section 5)
18270 !! options
18271 section=5
18272 !! wikitext
18273 start
18274 ==a==
18275 ===aa===
18276 ====aaa====
18277 ==b==
18278 ===ba===
18279 ===bb===
18280 ====bba====
18281 ===bc===
18282 ==c==
18283 ===ca===
18284 !! html/php
18285 ===ba===
18286 !! end
18287
18288 !! test
18289 Section extraction test (section 6)
18290 !! options
18291 section=6
18292 !! wikitext
18293 start
18294 ==a==
18295 ===aa===
18296 ====aaa====
18297 ==b==
18298 ===ba===
18299 ===bb===
18300 ====bba====
18301 ===bc===
18302 ==c==
18303 ===ca===
18304 !! html/php
18305 ===bb===
18306 ====bba====
18307 !! end
18308
18309 !! test
18310 Section extraction test (section 7)
18311 !! options
18312 section=7
18313 !! wikitext
18314 start
18315 ==a==
18316 ===aa===
18317 ====aaa====
18318 ==b==
18319 ===ba===
18320 ===bb===
18321 ====bba====
18322 ===bc===
18323 ==c==
18324 ===ca===
18325 !! html/php
18326 ====bba====
18327 !! end
18328
18329 !! test
18330 Section extraction test (section 8)
18331 !! options
18332 section=8
18333 !! wikitext
18334 start
18335 ==a==
18336 ===aa===
18337 ====aaa====
18338 ==b==
18339 ===ba===
18340 ===bb===
18341 ====bba====
18342 ===bc===
18343 ==c==
18344 ===ca===
18345 !! html/php
18346 ===bc===
18347 !! end
18348
18349 !! test
18350 Section extraction test (section 9)
18351 !! options
18352 section=9
18353 !! wikitext
18354 start
18355 ==a==
18356 ===aa===
18357 ====aaa====
18358 ==b==
18359 ===ba===
18360 ===bb===
18361 ====bba====
18362 ===bc===
18363 ==c==
18364 ===ca===
18365 !! html/php
18366 ==c==
18367 ===ca===
18368 !! end
18369
18370 !! test
18371 Section extraction test (section 10)
18372 !! options
18373 section=10
18374 !! wikitext
18375 start
18376 ==a==
18377 ===aa===
18378 ====aaa====
18379 ==b==
18380 ===ba===
18381 ===bb===
18382 ====bba====
18383 ===bc===
18384 ==c==
18385 ===ca===
18386 !! html/php
18387 ===ca===
18388 !! end
18389
18390 !! test
18391 Section extraction test (nonexistent section 11)
18392 !! options
18393 section=11
18394 !! wikitext
18395 start
18396 ==a==
18397 ===aa===
18398 ====aaa====
18399 ==b==
18400 ===ba===
18401 ===bb===
18402 ====bba====
18403 ===bc===
18404 ==c==
18405 ===ca===
18406 !! html/php
18407 !! end
18408
18409 !! test
18410 Section extraction test with bogus heading (section 1)
18411 !! options
18412 section=1
18413 !! wikitext
18414 ==a==
18415 ==bogus== not a legal section
18416 ==b==
18417 !! html/php
18418 ==a==
18419 ==bogus== not a legal section
18420 !! end
18421
18422 !! test
18423 Section extraction test with bogus heading (section 2)
18424 !! options
18425 section=2
18426 !! wikitext
18427 ==a==
18428 ==bogus== not a legal section
18429 ==b==
18430 !! html/php
18431 ==b==
18432 !! end
18433
18434 !! test
18435 Section extraction test with comment after heading (section 1)
18436 !! options
18437 section=1
18438 !! wikitext
18439 ==a==
18440 ==b== <!-- -->
18441 ==c==
18442 !! html/php
18443 ==a==
18444 !! end
18445
18446 !! test
18447 Section extraction test with comment after heading (section 2)
18448 !! options
18449 section=2
18450 !! wikitext
18451 ==a==
18452 ==b== <!-- -->
18453 ==c==
18454 !! html/php
18455 ==b== <!-- -->
18456 !! end
18457
18458 !! test
18459 Section extraction test with bogus <nowiki> heading (section 1)
18460 !! options
18461 section=1
18462 !! wikitext
18463 ==a==
18464 ==bogus== <nowiki>not a legal section</nowiki>
18465 ==b==
18466 !! html/php
18467 ==a==
18468 ==bogus== <nowiki>not a legal section</nowiki>
18469 !! end
18470
18471 !! test
18472 Section extraction test with bogus <nowiki> heading (section 2)
18473 !! options
18474 section=2
18475 !! wikitext
18476 ==a==
18477 ==bogus== <nowiki>not a legal section</nowiki>
18478 ==b==
18479 !! html/php
18480 ==b==
18481 !! end
18482
18483 # Formerly testing for T4587, now resolved by the use of unmarked sections
18484 # instead of respecting commented sections
18485 !! test
18486 Section extraction prefixed by comment (section 1)
18487 !! options
18488 section=1
18489 !! wikitext
18490 <!-- -->==sec1==
18491 ==sec2==
18492 !! html/php
18493 ==sec2==
18494 !!end
18495
18496 !! test
18497 Section extraction prefixed by comment (section 2)
18498 !! options
18499 section=2
18500 !! wikitext
18501 <!-- -->==sec1==
18502 ==sec2==
18503 !! html/php
18504
18505 !!end
18506
18507 # Formerly testing for T4607, now resolved by the use of unmarked sections
18508 # instead of respecting HTML-style headings
18509 !! test
18510 Section extraction, mixed wiki and html (section 1)
18511 !! options
18512 section=1
18513 !! wikitext
18514 <h2>unmarked</h2>
18515 unmarked
18516 ==1==
18517 one
18518 ==2==
18519 two
18520 !! html/php
18521 ==1==
18522 one
18523 !! end
18524
18525 !! test
18526 Section extraction, mixed wiki and html (section 2)
18527 !! options
18528 section=2
18529 !! wikitext
18530 <h2>unmarked</h2>
18531 unmarked
18532 ==1==
18533 one
18534 ==2==
18535 two
18536 !! html/php
18537 ==2==
18538 two
18539 !! end
18540
18541
18542 # Formerly testing for T5342
18543 !! test
18544 Section extraction, heading surrounded by <noinclude>
18545 !! options
18546 section=1
18547 !! wikitext
18548 <noinclude>==unmarked==</noinclude>
18549 ==marked==
18550 !! html/php
18551 ==marked==
18552 !!end
18553
18554 # Test behavior of T21910
18555 !! test
18556 Sectiion with all-equals
18557 !! options
18558 section=2
18559 !! wikitext
18560 ===
18561 The line above must have a trailing space
18562 === <!--
18563 --> <!-- -->
18564 But just in case it doesn't...
18565 !! html/php
18566 === <!--
18567 --> <!-- -->
18568 But just in case it doesn't...
18569 !! end
18570
18571 !! test
18572 Section replacement test (section 0)
18573 !! options
18574 replace=0,"xxx"
18575 !! wikitext
18576 start
18577 ==a==
18578 ===aa===
18579 ====aaa====
18580 ==b==
18581 ===ba===
18582 ===bb===
18583 ====bba====
18584 ===bc===
18585 ==c==
18586 ===ca===
18587 !! html/php
18588 xxx
18589
18590 ==a==
18591 ===aa===
18592 ====aaa====
18593 ==b==
18594 ===ba===
18595 ===bb===
18596 ====bba====
18597 ===bc===
18598 ==c==
18599 ===ca===
18600 !! end
18601
18602 !! test
18603 Section replacement test (section 1)
18604 !! options
18605 replace=1,"xxx"
18606 !! wikitext
18607 start
18608 ==a==
18609 ===aa===
18610 ====aaa====
18611 ==b==
18612 ===ba===
18613 ===bb===
18614 ====bba====
18615 ===bc===
18616 ==c==
18617 ===ca===
18618 !! html/php
18619 start
18620 xxx
18621
18622 ==b==
18623 ===ba===
18624 ===bb===
18625 ====bba====
18626 ===bc===
18627 ==c==
18628 ===ca===
18629 !! end
18630
18631 !! test
18632 Section replacement test (section 2)
18633 !! options
18634 replace=2,"xxx"
18635 !! wikitext
18636 start
18637 ==a==
18638 ===aa===
18639 ====aaa====
18640 ==b==
18641 ===ba===
18642 ===bb===
18643 ====bba====
18644 ===bc===
18645 ==c==
18646 ===ca===
18647 !! html/php
18648 start
18649 ==a==
18650 xxx
18651
18652 ==b==
18653 ===ba===
18654 ===bb===
18655 ====bba====
18656 ===bc===
18657 ==c==
18658 ===ca===
18659 !! end
18660
18661 !! test
18662 Section replacement test (section 3)
18663 !! options
18664 replace=3,"xxx"
18665 !! wikitext
18666 start
18667 ==a==
18668 ===aa===
18669 ====aaa====
18670 ==b==
18671 ===ba===
18672 ===bb===
18673 ====bba====
18674 ===bc===
18675 ==c==
18676 ===ca===
18677 !! html/php
18678 start
18679 ==a==
18680 ===aa===
18681 xxx
18682
18683 ==b==
18684 ===ba===
18685 ===bb===
18686 ====bba====
18687 ===bc===
18688 ==c==
18689 ===ca===
18690 !! end
18691
18692 !! test
18693 Section replacement test (section 4)
18694 !! options
18695 replace=4,"xxx"
18696 !! wikitext
18697 start
18698 ==a==
18699 ===aa===
18700 ====aaa====
18701 ==b==
18702 ===ba===
18703 ===bb===
18704 ====bba====
18705 ===bc===
18706 ==c==
18707 ===ca===
18708 !! html/php
18709 start
18710 ==a==
18711 ===aa===
18712 ====aaa====
18713 xxx
18714
18715 ==c==
18716 ===ca===
18717 !! end
18718
18719 !! test
18720 Section replacement test (section 5)
18721 !! options
18722 replace=5,"xxx"
18723 !! wikitext
18724 start
18725 ==a==
18726 ===aa===
18727 ====aaa====
18728 ==b==
18729 ===ba===
18730 ===bb===
18731 ====bba====
18732 ===bc===
18733 ==c==
18734 ===ca===
18735 !! html/php
18736 start
18737 ==a==
18738 ===aa===
18739 ====aaa====
18740 ==b==
18741 xxx
18742
18743 ===bb===
18744 ====bba====
18745 ===bc===
18746 ==c==
18747 ===ca===
18748 !! end
18749
18750 !! test
18751 Section replacement test (section 6)
18752 !! options
18753 replace=6,"xxx"
18754 !! wikitext
18755 start
18756 ==a==
18757 ===aa===
18758 ====aaa====
18759 ==b==
18760 ===ba===
18761 ===bb===
18762 ====bba====
18763 ===bc===
18764 ==c==
18765 ===ca===
18766 !! html/php
18767 start
18768 ==a==
18769 ===aa===
18770 ====aaa====
18771 ==b==
18772 ===ba===
18773 xxx
18774
18775 ===bc===
18776 ==c==
18777 ===ca===
18778 !! end
18779
18780 !! test
18781 Section replacement test (section 7)
18782 !! options
18783 replace=7,"xxx"
18784 !! wikitext
18785 start
18786 ==a==
18787 ===aa===
18788 ====aaa====
18789 ==b==
18790 ===ba===
18791 ===bb===
18792 ====bba====
18793 ===bc===
18794 ==c==
18795 ===ca===
18796 !! html/php
18797 start
18798 ==a==
18799 ===aa===
18800 ====aaa====
18801 ==b==
18802 ===ba===
18803 ===bb===
18804 xxx
18805
18806 ===bc===
18807 ==c==
18808 ===ca===
18809 !! end
18810
18811 !! test
18812 Section replacement test (section 8)
18813 !! options
18814 replace=8,"xxx"
18815 !! wikitext
18816 start
18817 ==a==
18818 ===aa===
18819 ====aaa====
18820 ==b==
18821 ===ba===
18822 ===bb===
18823 ====bba====
18824 ===bc===
18825 ==c==
18826 ===ca===
18827 !! html/php
18828 start
18829 ==a==
18830 ===aa===
18831 ====aaa====
18832 ==b==
18833 ===ba===
18834 ===bb===
18835 ====bba====
18836 xxx
18837
18838 ==c==
18839 ===ca===
18840 !!end
18841
18842 !! test
18843 Section replacement test (section 9)
18844 !! options
18845 replace=9,"xxx"
18846 !! wikitext
18847 start
18848 ==a==
18849 ===aa===
18850 ====aaa====
18851 ==b==
18852 ===ba===
18853 ===bb===
18854 ====bba====
18855 ===bc===
18856 ==c==
18857 ===ca===
18858 !! html/php
18859 start
18860 ==a==
18861 ===aa===
18862 ====aaa====
18863 ==b==
18864 ===ba===
18865 ===bb===
18866 ====bba====
18867 ===bc===
18868 xxx
18869 !! end
18870
18871 !! test
18872 Section replacement test (section 10)
18873 !! options
18874 replace=10,"xxx"
18875 !! wikitext
18876 start
18877 ==a==
18878 ===aa===
18879 ====aaa====
18880 ==b==
18881 ===ba===
18882 ===bb===
18883 ====bba====
18884 ===bc===
18885 ==c==
18886 ===ca===
18887 !! html/php
18888 start
18889 ==a==
18890 ===aa===
18891 ====aaa====
18892 ==b==
18893 ===ba===
18894 ===bb===
18895 ====bba====
18896 ===bc===
18897 ==c==
18898 xxx
18899 !! end
18900
18901 !! test
18902 Section replacement test with initial whitespace (T15728)
18903 !! options
18904 replace=2,"xxx"
18905 !! wikitext
18906 Preformatted initial line
18907 ==a==
18908 ===a===
18909 !! html/php
18910 Preformatted initial line
18911 ==a==
18912 xxx
18913 !! end
18914
18915
18916 !! test
18917 Section extraction, heading followed by pre with 20 spaces (T8398)
18918 !! options
18919 section=1
18920 !! wikitext
18921 ==a==
18922 a
18923 !! html/php
18924 ==a==
18925 a
18926 !! end
18927
18928 !! test
18929 Section extraction, heading followed by pre with 19 spaces (T8398 sanity check)
18930 !! options
18931 section=1
18932 !! wikitext
18933 ==a==
18934 a
18935 !! html/php
18936 ==a==
18937 a
18938 !! end
18939
18940
18941 !! test
18942 Section extraction, <pre> around bogus header (T12309)
18943 !! options
18944 section=2
18945 !! wikitext
18946 == Section One ==
18947 <pre>
18948 =======
18949 </pre>
18950
18951 == Section Two ==
18952 stuff
18953 !! html/php
18954 == Section Two ==
18955 stuff
18956 !! end
18957
18958 !! test
18959 Section replacement, <pre> around bogus header (T12309)
18960 !! options
18961 replace=2,"xxx"
18962 !! wikitext
18963 == Section One ==
18964 <pre>
18965 =======
18966 </pre>
18967
18968 == Section Two ==
18969 stuff
18970 !! html/php
18971 == Section One ==
18972 <pre>
18973 =======
18974 </pre>
18975
18976 xxx
18977 !! end
18978
18979 !! test
18980 Handling of &#x0A; in URLs
18981 !! wikitext
18982 ** irc://&#x0A;a
18983 !! html/php
18984 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
18985
18986 !! html/parsoid
18987 <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>
18988 !! end
18989
18990 !! test
18991 Handling of %0A in URLs
18992 !! wikitext
18993 ** irc://%0Aa
18994 !! html/php
18995 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
18996
18997 !! html/parsoid
18998 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
18999 !! end
19000
19001 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
19002 !! test
19003 5 quotes, code coverage +1 line
19004 !! options
19005 parsoid=wt2html
19006 !! wikitext
19007 '''''
19008 !! html/php
19009 !! html/parsoid
19010 <p><b><i></i></b></p>
19011 !! end
19012
19013 # same html as previous, but wikitext adjusted to match parsoid html2wt
19014 # note that wt2html and html2html will put the <i> before the <b>
19015 !! test
19016 5 quotes, code coverage +1 line w/ nowiki (1)
19017 !! options
19018 parsoid=wt2wt,html2wt
19019 !! wikitext
19020 '''''<nowiki/>'''''
19021 !! html/php
19022 <p><i></i>
19023 </p>
19024 !! html/parsoid
19025 <p><b><i></i></b></p>
19026 !! end
19027
19028 # same as previous, just swapping the <i> and <b>
19029 !! test
19030 5 quotes, code coverage +1 line w/ nowiki (2)
19031 !! wikitext
19032 '''''<nowiki/>'''''
19033 !! html/php
19034 <p><i></i>
19035 </p>
19036 !! html/parsoid
19037 <p><i><b></b></i></p>
19038 !! end
19039
19040 !! test
19041 Special:Search page linking.
19042 !! wikitext
19043 {{Special:search}}
19044 !! html
19045 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
19046 </p>
19047 !! end
19048
19049 !! test
19050 {{!}} is a magic word
19051 !! wikitext
19052 {{!}} is a magic word there and {{!}} is still a magic word here
19053 | is not a magic word here but {{!}} is still a magic word here
19054 !! html/php
19055 <p>| is a magic word there and | is still a magic word here
19056 | is not a magic word here but | is still a magic word here
19057 </p>
19058 !! html/parsoid
19059 <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
19060 | 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>
19061
19062 !! end
19063
19064 !! test
19065 Say the magic word
19066 !! options
19067 title=[[Parser test]]
19068 !! wikitext
19069 * {{PAGENAME}}
19070 * {{PAGENAMEE}}
19071 * {{FULLPAGENAME}}
19072 * {{FULLPAGENAMEE}}
19073 * {{BASEPAGENAME}}
19074 * {{BASEPAGENAMEE}}
19075 * {{SUBPAGENAME}}
19076 * {{SUBPAGENAMEE}}
19077 * {{ROOTPAGENAME}}
19078 * {{ROOTPAGENAMEE}}
19079 * {{TALKPAGENAME}}
19080 * {{TALKPAGENAMEE}}
19081 * {{SUBJECTPAGENAME}}
19082 * {{SUBJECTPAGENAMEE}}
19083 * {{NAMESPACEE}}
19084 * {{NAMESPACE}}
19085 * {{NAMESPACENUMBER}}
19086 * {{TALKSPACE}}
19087 * {{TALKSPACEE}}
19088 * {{SUBJECTSPACE}}
19089 * {{SUBJECTSPACEE}}
19090 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
19091 !! html
19092 <ul><li> Parser test</li>
19093 <li> Parser_test</li>
19094 <li> Parser test</li>
19095 <li> Parser_test</li>
19096 <li> Parser test</li>
19097 <li> Parser_test</li>
19098 <li> Parser test</li>
19099 <li> Parser_test</li>
19100 <li> Parser test</li>
19101 <li> Parser_test</li>
19102 <li> Talk:Parser test</li>
19103 <li> Talk:Parser_test</li>
19104 <li> Parser test</li>
19105 <li> Parser_test</li>
19106 <li> </li>
19107 <li> </li>
19108 <li> 0</li>
19109 <li> Talk</li>
19110 <li> Talk</li>
19111 <li> </li>
19112 <li> </li>
19113 <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>
19114
19115 !! end
19116 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
19117
19118 !! test
19119 Gallery with valid attributes
19120 !! wikitext
19121 <gallery type="123" summary="345">
19122 File:File:Foobar.jpg
19123 </gallery>
19124 !! html/php
19125 <ul class="gallery mw-gallery-traditional" type="123">
19126 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19127 <div class="thumb" style="height: 150px;">File:Foobar.jpg</div>
19128 <div class="gallerytext">
19129 </div>
19130 </div></li>
19131 </ul>
19132
19133 !! html/parsoid
19134 <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"}}'>
19135 <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>
19136 </ul>
19137 !! end
19138
19139 ## Parsoid thinks the "centre" here is a property, not a caption.
19140 !! test
19141 Gallery
19142 !! options
19143 parsoid={
19144 "modes": ["wt2html"],
19145 "nativeGallery": true
19146 }
19147 !! wikitext
19148 <gallery>
19149 image1.png |
19150 image2.gif|||||
19151
19152 image3|
19153 image4 |300px| centre
19154 image5.svg| http://///////
19155 [[x|xx]]]]
19156 * image6
19157 </gallery>
19158 !! html/php
19159 <ul class="gallery mw-gallery-traditional">
19160 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19161 <div class="thumb" style="height: 150px;">Image1.png</div>
19162 <div class="gallerytext">
19163 </div>
19164 </div></li>
19165 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19166 <div class="thumb" style="height: 150px;">Image2.gif</div>
19167 <div class="gallerytext">
19168 </div>
19169 </div></li>
19170 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19171 <div class="thumb" style="height: 150px;">Image3</div>
19172 <div class="gallerytext">
19173 </div>
19174 </div></li>
19175 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19176 <div class="thumb" style="height: 150px;">Image4</div>
19177 <div class="gallerytext">
19178 <pre>centre
19179 </pre>
19180 </div>
19181 </div></li>
19182 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19183 <div class="thumb" style="height: 150px;">Image5.svg</div>
19184 <div class="gallerytext">
19185 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
19186 </p>
19187 </div>
19188 </div></li>
19189 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19190 <div class="thumb" style="height: 150px;">* image6</div>
19191 <div class="gallerytext">
19192 </div>
19193 </div></li>
19194 </ul>
19195
19196 !! html/parsoid
19197 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt3" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
19198 <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>
19199 <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>
19200 <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>
19201 <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>
19202 <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>
19203 <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>
19204 </ul>
19205 !! end
19206
19207 !! test
19208 Gallery (with options, html)
19209 !! options
19210 parsoid={
19211 "modes": ["wt2html", "html2html"],
19212 "nativeGallery": true
19213 }
19214 !! wikitext
19215 <gallery widths="70px" heights="40px" perrow="2" caption="Foo [[Main Page]]">
19216 File:Nonexistent.jpg|caption
19217 File:Nonexistent.jpg
19218 image:foobar.jpg|some '''caption''' [[Main Page]]
19219 image:foobar.jpg
19220 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
19221 </gallery>
19222 !! html/php
19223 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
19224 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
19225 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19226 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
19227 <div class="gallerytext">
19228 <p>caption
19229 </p>
19230 </div>
19231 </div></li>
19232 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19233 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
19234 <div class="gallerytext">
19235 </div>
19236 </div></li>
19237 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19238 <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>
19239 <div class="gallerytext">
19240 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
19241 </p>
19242 </div>
19243 </div></li>
19244 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19245 <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>
19246 <div class="gallerytext">
19247 </div>
19248 </div></li>
19249 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19250 <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>
19251 <div class="gallerytext">
19252 <p>blabla.
19253 </p>
19254 </div>
19255 </div></li>
19256 </ul>
19257
19258 !! html/parsoid
19259 <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":{}}'>
19260 <li class="gallerycaption">Foo <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a></li>
19261 <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>
19262 <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>
19263 <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>
19264 <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>
19265 <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>
19266 </ul>
19267 !! end
19268
19269 !! test
19270 Gallery (with options, extsrc)
19271 !! options
19272 parsoid={
19273 "nativeGallery": false
19274 }
19275 !! wikitext
19276 <gallery widths="70px" heights="40px" perrow="2" caption="Foo [[Main Page]]">
19277 File:Nonexistent.jpg|caption
19278 File:Nonexistent.jpg
19279 image:foobar.jpg|some '''caption''' [[Main Page]]
19280 image:foobar.jpg
19281 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
19282 </gallery>
19283 !! html/php
19284 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
19285 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
19286 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19287 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
19288 <div class="gallerytext">
19289 <p>caption
19290 </p>
19291 </div>
19292 </div></li>
19293 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19294 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
19295 <div class="gallerytext">
19296 </div>
19297 </div></li>
19298 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19299 <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>
19300 <div class="gallerytext">
19301 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
19302 </p>
19303 </div>
19304 </div></li>
19305 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19306 <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>
19307 <div class="gallerytext">
19308 </div>
19309 </div></li>
19310 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19311 <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>
19312 <div class="gallerytext">
19313 <p>blabla.
19314 </p>
19315 </div>
19316 </div></li>
19317 </ul>
19318
19319 !! html/parsoid
19320 <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"}}'>
19321 <li class="gallerycaption">Foo <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a></li>
19322 <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>
19323 <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>
19324 <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>
19325 <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>
19326 <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>
19327 </ul>
19328 !! end
19329
19330 !! test
19331 Gallery with link that has fragment
19332 !! options
19333 parsoid={
19334 "modes": ["wt2html", "html2html"],
19335 "nativeGallery": true
19336 }
19337 !! wikitext
19338 <gallery>
19339 image:foobar.jpg|link=Main_Page
19340 image:foobar.jpg|link=Main_Page#section
19341 image:foobar.jpg|link=Main Page#section|caption
19342 </gallery>
19343 !! html/php
19344 <ul class="gallery mw-gallery-traditional">
19345 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19346 <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>
19347 <div class="gallerytext">
19348 </div>
19349 </div></li>
19350 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19351 <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>
19352 <div class="gallerytext">
19353 </div>
19354 </div></li>
19355 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19356 <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>
19357 <div class="gallerytext">
19358 <p>caption
19359 </p>
19360 </div>
19361 </div></li>
19362 </ul>
19363
19364 !! html/parsoid
19365 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
19366 <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>
19367 <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>
19368 <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>
19369 </ul>
19370 !! end
19371
19372 ## Whoops, Parsoid shouldn't be parsing templates in the attribute caption!
19373 !! test
19374 Gallery with template inside caption
19375 !! options
19376 parsoid={
19377 "nativeGallery": true
19378 }
19379 !! wikitext
19380 <gallery caption="{{echo|hi}}">
19381 File:Foobar.jpg|{{echo|ho}}
19382 </gallery>
19383 !! html/php
19384 <ul class="gallery mw-gallery-traditional">
19385 <li class='gallerycaption'>{{echo|hi}}</li>
19386 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19387 <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>
19388 <div class="gallerytext">
19389 <p>ho
19390 </p>
19391 </div>
19392 </div></li>
19393 </ul>
19394
19395 !! html/parsoid
19396 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt6" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
19397 <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>
19398 <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>
19399 </ul>
19400 !! end
19401
19402 !! test
19403 Gallery with wikitext inside caption
19404 !! options
19405 parsoid={
19406 "nativeGallery": true
19407 }
19408 !! wikitext
19409 <gallery>
19410 File:Foobar.jpg|alt=galleryalt|[[File:Foobar.jpg|alt=inneralt|20x20px|desc]]
19411 File:Foobar.jpg|alt=galleryalt|{{Test|unamedParam|alt=param}}
19412 </gallery>
19413 !! html/php
19414 <ul class="gallery mw-gallery-traditional">
19415 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19416 <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>
19417 <div class="gallerytext">
19418 <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>
19419 </p>
19420 </div>
19421 </div></li>
19422 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19423 <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>
19424 <div class="gallerytext">
19425 <p>This is a test template
19426 </p>
19427 </div>
19428 </div></li>
19429 </ul>
19430
19431 !! html/parsoid
19432 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt6" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
19433 <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>
19434 <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>
19435 </ul>
19436 !! end
19437
19438 !! test
19439 Gallery (with showfilename option)
19440 !! options
19441 parsoid={
19442 "nativeGallery": true
19443 }
19444 !! wikitext
19445 <gallery showfilename="">
19446 File:Nonexistent.jpg|caption
19447 File:Nonexistent.jpg
19448 File:Foobar.jpg|some '''caption''' [[Main Page]]
19449 File:Foobar.jpg
19450 </gallery>
19451 !! html/php
19452 <ul class="gallery mw-gallery-traditional">
19453 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19454 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
19455 <div class="gallerytext">
19456 <p><a href="/wiki/File:Nonexistent.jpg" class="galleryfilename galleryfilename-truncate" title="File:Nonexistent.jpg">Nonexistent.jpg</a>
19457 caption
19458 </p>
19459 </div>
19460 </div></li>
19461 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19462 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
19463 <div class="gallerytext">
19464 <p><a href="/wiki/File:Nonexistent.jpg" class="galleryfilename galleryfilename-truncate" title="File:Nonexistent.jpg">Nonexistent.jpg</a>
19465 </p>
19466 </div>
19467 </div></li>
19468 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19469 <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>
19470 <div class="gallerytext">
19471 <p><a href="/wiki/File:Foobar.jpg" class="galleryfilename galleryfilename-truncate" title="File:Foobar.jpg">Foobar.jpg</a>
19472 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
19473 </p>
19474 </div>
19475 </div></li>
19476 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19477 <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>
19478 <div class="gallerytext">
19479 <p><a href="/wiki/File:Foobar.jpg" class="galleryfilename galleryfilename-truncate" title="File:Foobar.jpg">Foobar.jpg</a>
19480 </p>
19481 </div>
19482 </div></li>
19483 </ul>
19484
19485 !! html/parsoid
19486 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt3" data-mw='{"name":"gallery","attrs":{"showfilename":""},"body":{}}'>
19487 <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>
19488 <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>
19489 <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>
19490 <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>
19491 </ul>
19492 !! end
19493
19494 ## Should Parsoid be preserving these variations?
19495 !! test
19496 Gallery (with namespace-less filenames)
19497 !! options
19498 parsoid={
19499 "modes": ["wt2html", "html2html"],
19500 "nativeGallery": true
19501 }
19502 !! wikitext
19503 <gallery>
19504 File:Nonexistent.jpg
19505 Nonexistent.jpg
19506 image:foobar.jpg
19507 foobar.jpg
19508 </gallery>
19509 !! html/php
19510 <ul class="gallery mw-gallery-traditional">
19511 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19512 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
19513 <div class="gallerytext">
19514 </div>
19515 </div></li>
19516 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19517 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
19518 <div class="gallerytext">
19519 </div>
19520 </div></li>
19521 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19522 <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>
19523 <div class="gallerytext">
19524 </div>
19525 </div></li>
19526 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19527 <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>
19528 <div class="gallerytext">
19529 </div>
19530 </div></li>
19531 </ul>
19532
19533 !! html/parsoid
19534 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
19535 <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>
19536 <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>
19537 <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>
19538 <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>
19539 </ul>
19540 !! end
19541
19542 !! test
19543 Gallery override link with WikiLink (T36852)
19544 !! options
19545 parsoid={
19546 "nativeGallery": true
19547 }
19548 !! wikitext
19549 <gallery>
19550 File:Foobar.jpg|alt=galleryalt|link=InterWikiLink
19551 </gallery>
19552 !! html/php
19553 <ul class="gallery mw-gallery-traditional">
19554 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19555 <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>
19556 <div class="gallerytext">
19557 </div>
19558 </div></li>
19559 </ul>
19560
19561 !! html/parsoid
19562 <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":{}}'>
19563 <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>
19564 </ul>
19565 !! end
19566
19567 !! test
19568 Gallery override link with absolute external link (T36852)
19569 !! options
19570 parsoid={
19571 "nativeGallery": true
19572 }
19573 !! wikitext
19574 <gallery>
19575 File:Foobar.jpg|alt=galleryalt|link=http://www.example.org
19576 </gallery>
19577 !! html/php
19578 <ul class="gallery mw-gallery-traditional">
19579 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19580 <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>
19581 <div class="gallerytext">
19582 </div>
19583 </div></li>
19584 </ul>
19585
19586 !! html/parsoid
19587 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
19588 <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>
19589 </ul>
19590 !! end
19591
19592 !! test
19593 Gallery override link with absolute external link with LanguageConverter
19594 !! options
19595 language=zh
19596 !! input
19597 <gallery>
19598 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
19599 </gallery>
19600 !! result
19601 <ul class="gallery mw-gallery-traditional">
19602 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19603 <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>
19604 <div class="gallerytext">
19605 <p>caption
19606 </p>
19607 </div>
19608 </div></li>
19609 </ul>
19610
19611 !! end
19612
19613 !! test
19614 Gallery override link with malicious javascript (T36852)
19615 !! options
19616 parsoid={
19617 "modes": ["wt2html", "html2html"],
19618 "nativeGallery": true
19619 }
19620 !! wikitext
19621 <gallery>
19622 File:Foobar.jpg|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
19623 </gallery>
19624 !! html/php
19625 <ul class="gallery mw-gallery-traditional">
19626 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19627 <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>
19628 <div class="gallerytext">
19629 </div>
19630 </div></li>
19631 </ul>
19632
19633 !! html/parsoid
19634 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
19635 <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>
19636 </ul>
19637 !! end
19638
19639 !! test
19640 Gallery with invalid title as link (T45964)
19641 !! options
19642 parsoid={
19643 "modes": ["wt2html", "html2html"],
19644 "nativeGallery": true
19645 }
19646 !! wikitext
19647 <gallery>
19648 File:Foobar.jpg|link=<
19649 </gallery>
19650 !! html/php
19651 <ul class="gallery mw-gallery-traditional">
19652 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19653 <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>
19654 <div class="gallerytext">
19655 </div>
19656 </div></li>
19657 </ul>
19658
19659 !! html/parsoid
19660 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
19661 <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>
19662 </ul>
19663 !! end
19664
19665 !! test
19666 Serialize gallery without attrs in data-mw
19667 !! options
19668 parsoid={
19669 "modes": ["html2wt"],
19670 "nativeGallery": true
19671 }
19672 !! html/parsoid
19673 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","body":{}}'>
19674 <li class="gallerycaption">123</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;">File:Test.png</span></div><div class="gallerytext"></div></li>
19676 </ul>
19677 !! wikitext
19678 <gallery caption="123">
19679 File:Test.png
19680 </gallery>
19681 !! end
19682
19683 !! test
19684 Gallery with class and style attributes
19685 !! options
19686 parsoid={
19687 "nativeGallery": true
19688 }
19689 !! wikitext
19690 <gallery class="center" style="text-align: center;">
19691 File:Foobar.jpg
19692 </gallery>
19693 !! html/php
19694 <ul class="gallery mw-gallery-traditional center" style="text-align: center;">
19695 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19696 <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>
19697 <div class="gallerytext">
19698 </div>
19699 </div></li>
19700 </ul>
19701
19702 !! html/parsoid
19703 <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":{}}'>
19704 <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>
19705 </ul>
19706 !! end
19707
19708 !! test
19709 Gallery in slideshow mode
19710 !! options
19711 parsoid={
19712 "nativeGallery": true
19713 }
19714 !! wikitext
19715 <gallery mode="slideshow" showthumbnails="">
19716 File:Foobar.jpg
19717 </gallery>
19718 !! html/php
19719 <ul class="gallery mw-gallery-slideshow" data-showthumbnails="1">
19720 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19721 <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>
19722 <div class="gallerytext">
19723 </div>
19724 </div></li>
19725 </ul>
19726
19727 !! html/parsoid
19728 <ul class="gallery mw-gallery-slideshow" data-showthumbnails="1" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{"mode":"slideshow","showthumbnails":""},"body":{}}'>
19729 <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>
19730 </ul>
19731 !! end
19732
19733 !! test
19734 HTML Hex character encoding (spells the word "JavaScript")
19735 !! options
19736 parsoid=wt2html,wt2wt,html2html
19737 !! wikitext
19738 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
19739 !! html/php
19740 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
19741 </p>
19742 !! html/php+tidy
19743 <p>JavaScript</p>
19744 !! html/parsoid
19745 <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>
19746 !! end
19747
19748 !! test
19749 HTML Hex character encoding bogus encoding (T28437 regression check)
19750 !! wikitext
19751 &#xsee;&#XSEE;
19752 !! html/php
19753 <p>&amp;#xsee;&amp;#XSEE;
19754 </p>
19755 !! html/parsoid
19756 <p>&amp;#xsee;&amp;#XSEE;</p>
19757 !! end
19758
19759 !! test
19760 HTML Hex character encoding mixed case
19761 !! options
19762 parsoid=wt2html,wt2wt,html2html
19763 !! wikitext
19764 &#xEE;&#Xee;
19765 !! html/php
19766 <p>&#xee;&#xee;
19767 </p>
19768 !! html/php+tidy
19769 <p>îî</p>
19770 !! html/parsoid
19771 <p><span typeof="mw:Entity">î</span><span typeof="mw:Entity">î</span></p>
19772 !! end
19773
19774 # See: https://www.w3.org/TR/html5/syntax.html#character-references
19775 # Note that U+000C (form feed) is not a valid XML character, so
19776 # it is banned even though allowed in HTML5.
19777 !! test
19778 Illegal character references (T106578)
19779 !! wikitext
19780 ; Null: &#00;
19781 ; FF: &#xC;
19782 ; CR: &#xD;
19783 ; Control (low): &#8;
19784 ; Control (high): &#x7F; &#x9F;
19785 ; Surrogate: &#xD83D;&#xDCA9;
19786 ; This is an okay astral character: &#x1F4A9;
19787 !! html+tidy
19788 <dl>
19789 <dt>Null</dt>
19790 <dd>&amp;#00;</dd>
19791 <dt>FF</dt>
19792 <dd>&amp;#xC;</dd>
19793 <dt>CR</dt>
19794 <dd>&amp;#xD;</dd>
19795 <dt>Control (low)</dt>
19796 <dd>&amp;#8;</dd>
19797 <dt>Control (high)</dt>
19798 <dd>&amp;#x7F; &amp;#x9F;</dd>
19799 <dt>Surrogate</dt>
19800 <dd>&amp;#xD83D;&amp;#xDCA9;</dd>
19801 <dt>This is an okay astral character</dt>
19802 <dd>💩</dd>
19803 </dl>
19804 !! end
19805
19806 !! test
19807 __FORCETOC__ override
19808 !! wikitext
19809 __NEWSECTIONLINK__
19810 __FORCETOC__
19811 !! html/php
19812 <p><br />
19813 </p>
19814 !! end
19815
19816 !! test
19817 ISBN code coverage
19818 !! wikitext
19819 ISBN 978-0-1234-56&#x20;789
19820 !! html
19821 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
19822 </p>
19823 !! html+tidy
19824 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a> 789</p>
19825 !! html/parsoid
19826 <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>
19827 !! end
19828
19829 !! test
19830 ISBN followed by 5 spaces
19831 !! wikitext
19832 ISBN
19833 !! html
19834 <p>ISBN
19835 </p>
19836 !! end
19837
19838 !! test
19839 Double ISBN
19840 !! wikitext
19841 ISBN ISBN 1234567890
19842 !! html/php
19843 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
19844 </p>
19845 !! html/parsoid
19846 <p>ISBN <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a></p>
19847 !! end
19848
19849 # Uppercase X and lowercase x as well
19850 !! test
19851 ISBN with an X
19852 !! wikitext
19853 ISBN 3-462-04561-X
19854 ISBN 3-462-04561-x
19855 ISBN 080442957X
19856 ISBN 080442957x
19857 ISBN 978080442957X
19858 ISBN 978080442957x
19859 !! html/php
19860 <p><a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-X</a>
19861 <a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-x</a>
19862 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957X</a>
19863 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957x</a>
19864 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957X</a>
19865 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957x</a>
19866 </p>
19867 !! html/parsoid
19868 <p><a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-X</a>
19869 <a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-x</a>
19870 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957X</a>
19871 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957x</a>
19872 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957X</a>
19873 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957x</a></p>
19874 !! end
19875
19876 !! test
19877 ISBN with empty prefix (parsoid test)
19878 !! wikitext
19879 ISBN 1234567890
19880 !! html/php
19881 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
19882 </p>
19883 !! html/parsoid
19884 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink">ISBN 1234567890</a></p>
19885 !! end
19886
19887 !! test
19888 T24905: <abbr> followed by ISBN followed by </a>
19889 !! wikitext
19890 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
19891 !! html/php
19892 <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>
19893 </p>
19894 !! html/parsoid
19895 <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>
19896 !! end
19897
19898 !! test
19899 Double RFC
19900 !! wikitext
19901 RFC RFC 1234
19902 !! html
19903 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
19904 </p>
19905 !! end
19906
19907 !! test
19908 Double RFC with a wiki link
19909 !! wikitext
19910 RFC [[RFC 1234]]
19911 !! html
19912 <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>
19913 </p>
19914 !! end
19915
19916 !! test
19917 RFC code coverage
19918 !! wikitext
19919 RFC 983&#x20;987
19920 !! html
19921 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
19922 </p>
19923 !! html+tidy
19924 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a> 987</p>
19925 !! end
19926
19927 !! test
19928 Centre-aligned image
19929 !! wikitext
19930 [[Image:foobar.jpg|centre]]
19931 !! html
19932 <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>
19933
19934 !!end
19935
19936 !! test
19937 None-aligned image
19938 !! wikitext
19939 [[Image:foobar.jpg|none]]
19940 !! html
19941 <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>
19942
19943 !!end
19944
19945 !! test
19946 Width + Height sized image (using px) (height is ignored)
19947 !! wikitext
19948 [[Image:foobar.jpg|640x480px]]
19949 !! html
19950 <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>
19951 </p>
19952 !!end
19953
19954 !! test
19955 Width-sized image (using px, no following whitespace)
19956 !! wikitext
19957 [[Image:foobar.jpg|640px]]
19958 !! html
19959 <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>
19960 </p>
19961 !!end
19962
19963 !! test
19964 Width-sized image (using px, with following whitespace - test regression from r39467)
19965 !! wikitext
19966 [[Image:foobar.jpg|640px ]]
19967 !! html
19968 <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>
19969 </p>
19970 !!end
19971
19972 !! test
19973 Width-sized image (using px, with preceding whitespace - test regression from r39467)
19974 !! wikitext
19975 [[Image:foobar.jpg| 640px]]
19976 !! html
19977 <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>
19978 </p>
19979 !!end
19980
19981 !! test
19982 Image with page parameter
19983 !! options
19984 djvu
19985 !! wikitext
19986 [[File:LoremIpsum.djvu|page=2]]
19987 !! html/php
19988 <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>
19989 </p>
19990 !! html/parsoid
19991 <p><span class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"page","ak":"page=2"}]}'><a href="./File:LoremIpsum.djvu" data-parsoid='{"a":{"href":"./File:LoremIpsum.djvu"},"sa":{}}'><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>
19992 !! end
19993
19994 !! test
19995 Another italics / bold test
19996 !! wikitext
19997 ''' ''x'
19998 !! html
19999 <pre>'<i> </i>x'
20000 </pre>
20001 !!end
20002
20003 # FIXME: The php output seems broken. It's interleaving some open/close tags.
20004 !! test
20005 dt/dd/dl test
20006 !! wikitext
20007 :;;;::
20008 !! html/php
20009 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dt></dl></dd></dl></dd></dl></dd></dl></dd></dl></dd></dl>
20010
20011 !! html/parsoid
20012 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dd></dl></dd></dl></dt></dl></dt></dl></dt></dl></dd></dl>
20013
20014 !!end
20015
20016 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
20017 !! test
20018 Images with the "|" character in the comment
20019 !! wikitext
20020 [[File:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
20021 !! html/php
20022 <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>
20023
20024 !! html/parsoid
20025 <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>
20026 !! end
20027
20028 !! test
20029 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
20030 !! wikitext
20031 <html><script>alert(1);</script></html>
20032 !! html
20033 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
20034 </p>
20035 !! end
20036
20037 !! test
20038 HTML with raw HTML ($wgRawHtml==true)
20039 !! options
20040 wgRawHtml=1
20041 !! wikitext
20042 <html><script>alert(1);</script></html>
20043 !! html
20044 <p><script>alert(1);</script>
20045 </p>
20046 !! end
20047
20048 !! test
20049 Parents of subpages, one level up
20050 !! options
20051 subpage title=[[Subpage test/L1/L2/L3]]
20052 !! wikitext
20053 [[../|L2]]
20054 !! html
20055 <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>
20056 </p>
20057 !! end
20058
20059
20060 !! test
20061 Parents of subpages, one level up, not named
20062 !! options
20063 subpage title=[[Subpage test/L1/L2/L3]]
20064 !! wikitext
20065 [[../]]
20066 !! html
20067 <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>
20068 </p>
20069 !! end
20070
20071
20072
20073 !! test
20074 Parents of subpages, two levels up
20075 !! options
20076 subpage title=[[Subpage test/L1/L2/L3]]
20077 !! wikitext
20078 [[../../|L1]]2
20079
20080 [[../../|L1]]l
20081 !! html
20082 <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
20083 </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>
20084 </p>
20085 !! end
20086
20087 !! test
20088 Parents of subpages, two levels up, without trailing slash or name.
20089 !! options
20090 subpage title=[[Subpage test/L1/L2/L3]]
20091 !! wikitext
20092 [[../..]]
20093 !! html
20094 <p>[[../..]]
20095 </p>
20096 !! end
20097
20098 !! test
20099 Parents of subpages, two levels up, with lots of extra trailing slashes.
20100 !! options
20101 subpage title=[[Subpage test/L1/L2/L3]]
20102 !! wikitext
20103 [[../../////]]
20104 !! html
20105 <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>
20106 </p>
20107 !! end
20108
20109 !! article
20110 Subpage test/L1/L2/L3Sibling
20111 !! text
20112 Sibling article
20113 !! endarticle
20114
20115 !! test
20116 Transclusion of a sibling page (one level up)
20117 !! options
20118 subpage title=[[Subpage test/L1/L2/L3]]
20119 !! wikitext
20120 {{../L3Sibling}}
20121 !! html
20122 <p>Sibling article
20123 </p>
20124 !! end
20125
20126 !! test
20127 Transclusion of a child page
20128 !! options
20129 subpage title=[[Subpage test/L1/L2]]
20130 !! wikitext
20131 {{/L3Sibling}}
20132 !! html
20133 <p>Sibling article
20134 </p>
20135 !! end
20136
20137 # This is wt2html only in Parsoid because we add <nowiki>
20138 # because of {{..}} and we don't expect to fix that to
20139 # eliminate the nowikis selective for {{..}} markup.
20140 !! test
20141 Non-transclusion because of too many up levels
20142 !! options
20143 subpage title=[[Subpage test/L1/L2/L3]]
20144 parsoid=wt2html
20145 !! wikitext
20146 {{../../../../More than parent}}
20147 !! html/php
20148 <p>{{../../../../More than parent}}
20149 </p>
20150 !! html/parsoid
20151 <p>{{../../../../More than parent}}</p>
20152 !! end
20153
20154 !! test
20155 Definition list code coverage
20156 !! wikitext
20157 ; title : def
20158 ; title : def
20159 ;title: def
20160 !! html/php
20161 <dl><dt> title &#160;</dt>
20162 <dd> def</dd>
20163 <dt> title&#160;</dt>
20164 <dd> def</dd>
20165 <dt>title</dt>
20166 <dd> def</dd></dl>
20167
20168 !! html/parsoid
20169 <dl><dt> title <span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
20170 <dt> title<span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
20171 <dt>title</dt><dd> def</dd></dl>
20172 !! end
20173
20174 !! test
20175 Don't fall for the self-closing div
20176 !! wikitext
20177 <div>hello world</div/>
20178 !! html
20179 <div>hello world</div>
20180
20181 !! end
20182
20183 !! test
20184 MSGNW magic word
20185 !! wikitext
20186 {{MSGNW:msg}}
20187 !! html/php
20188 <p>&#91;&#91;:Template:Msg&#93;&#93;
20189 </p>
20190 !! end
20191
20192 !! test
20193 RAW magic word
20194 !! wikitext
20195 {{RAW:QUERTY}}
20196 !! html
20197 <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>
20198 </p>
20199 !! end
20200
20201 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
20202 !! test
20203 Always escape literal '>' in output, not just after '<'
20204 !! wikitext
20205 ><>
20206 !! html
20207 <p>&gt;&lt;&gt;
20208 </p>
20209 !! end
20210
20211 !! test
20212 Template caching
20213 !! wikitext
20214 {{Test}}
20215 {{Test}}
20216 !! html
20217 <p>This is a test template
20218 This is a test template
20219 </p>
20220 !! end
20221
20222
20223 !! article
20224 MediaWiki:Fake
20225 !! text
20226 ==header==
20227 !! endarticle
20228
20229 !! test
20230 Inclusion of !userCanEdit() content
20231 !! wikitext
20232 {{MediaWiki:Fake}}
20233 !! html
20234 <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>
20235
20236 !! end
20237
20238
20239 !! test
20240 Out-of-order TOC heading levels
20241 !! wikitext
20242 ==2==
20243 ======6======
20244 ===3===
20245 =1=
20246 =====5=====
20247 ==2==
20248 !! html
20249 <div id="toc" class="toc"><div id="toctitle" class="toctitle"><h2>Contents</h2></div>
20250 <ul>
20251 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
20252 <ul>
20253 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
20254 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
20255 </ul>
20256 </li>
20257 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
20258 <ul>
20259 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
20260 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
20261 </ul>
20262 </li>
20263 </ul>
20264 </div>
20265
20266 <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>
20267 <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>
20268 <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>
20269 <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>
20270 <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>
20271 <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>
20272
20273 !! end
20274
20275
20276 !! test
20277 ISBN with a dummy number
20278 !! wikitext
20279 ISBN ---
20280 !! html
20281 <p>ISBN ---
20282 </p>
20283 !! end
20284
20285
20286 !! test
20287 ISBN with space-delimited number
20288 !! wikitext
20289 ISBN 92 9017 032 8
20290 !! html
20291 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
20292 </p>
20293 !! end
20294
20295
20296 !! test
20297 ISBN with multiple spaces, no number
20298 !! wikitext
20299 ISBN foo
20300 !! html
20301 <p>ISBN foo
20302 </p>
20303 !! end
20304
20305
20306 !! test
20307 ISBN length
20308 !! wikitext
20309 ISBN 123456789
20310
20311 ISBN 1234567890
20312
20313 ISBN 12345678901
20314 !! html
20315 <p>ISBN 123456789
20316 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
20317 </p><p>ISBN 12345678901
20318 </p>
20319 !! end
20320
20321
20322 !! test
20323 ISBN with trailing year (T9110)
20324 !! wikitext
20325 ISBN 1-234-56789-0 - 2006
20326
20327 ISBN 1 234 56789 0 - 2006
20328 !! html
20329 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
20330 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
20331 </p>
20332 !! end
20333
20334
20335 !! test
20336 anchorencode
20337 !! wikitext
20338 {{anchorencode:foo bar©#%n}}
20339 !! html
20340 <p>foo_bar.C2.A9.23.25n
20341 </p>
20342 !! end
20343
20344 !! test
20345 anchorencode trims spaces
20346 !! wikitext
20347 {{anchorencode: __pretty__please__}}
20348 !! html
20349 <p>pretty_please
20350 </p>
20351 !! end
20352
20353 !! test
20354 anchorencode deals with links
20355 !! wikitext
20356 {{anchorencode: [[hello|world]] [[hi]]}}
20357 !! html
20358 <p>world_hi
20359 </p>
20360 !! end
20361
20362 !! test
20363 anchorencode deals with templates
20364 !! wikitext
20365 {{anchorencode: {{Foo}} }}
20366 !! html
20367 <p>FOO
20368 </p>
20369 !! end
20370
20371 !! test
20372 anchorencode encodes like the TOC generator: (T20431)
20373 !! wikitext
20374 === _ +:.3A%3A&&amp;]] ===
20375 {{anchorencode: _ +:.3A%3A&&amp;]] }}
20376 __NOEDITSECTION__
20377 !! html
20378 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
20379 <p>.2B:.3A.253A.26.26.5D.5D
20380 </p>
20381 !! end
20382
20383 !! test
20384 T8200: blockquotes and paragraph formatting
20385 !! wikitext
20386 <blockquote>
20387 foo
20388 </blockquote>
20389
20390 bar
20391
20392 baz
20393 !! html
20394 <blockquote>
20395 <p>foo
20396 </p>
20397 </blockquote>
20398 <p>bar
20399 </p>
20400 <pre>baz
20401 </pre>
20402 !! end
20403
20404 !! test
20405 T10293: Use of center tag ruins paragraph formatting
20406 !! wikitext
20407 <center>
20408 foo
20409 </center>
20410
20411 bar
20412
20413 baz
20414 !! html
20415 <center>
20416 <p>foo
20417 </p>
20418 </center>
20419 <p>bar
20420 </p>
20421 <pre>baz
20422 </pre>
20423 !! end
20424
20425 !!test
20426 Parsing of overlapping (improperly nested) inline html tags
20427 !! wikitext
20428 <span><s>x</span></s>
20429 !! html/php
20430 <p><span><s>x&lt;/span&gt;</s></span>
20431 </p>
20432 !! html/parsoid
20433 <p><span><s>x</s></span>
20434 </p>
20435 !!end
20436
20437 ###
20438 ### Language variants related tests
20439 ###
20440 !! test
20441 Self-link in language variants
20442 !! options
20443 title=[[Dunav]] language=sr
20444 !! wikitext
20445 Both [[Dunav]] and [[Дунав]] are names for this river.
20446 !! html
20447 <p>Both <a class="mw-selflink selflink">Dunav</a> and <a class="mw-selflink selflink">Дунав</a> are names for this river.
20448 </p>
20449 !!end
20450
20451 !! article
20452 Дуна
20453 !! text
20454 content
20455 !! endarticle
20456
20457 !! test
20458 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
20459 !! options
20460 title=[[Duna]] language=sr
20461 !! wikitext
20462 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
20463 !! html
20464 <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.
20465 </p>
20466 !! end
20467
20468 !! test
20469 Link to a section of a variant of this title shouldn't be parsed as self-link
20470 !! options
20471 title=[[Duna]] language=sr
20472 !! wikitext
20473 [[Dуна]] is a self-link while [[Dunа#Foo]] and [[Dуна#Foo]] are not self-links.
20474 !! html
20475 <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.
20476 </p>
20477 !! end
20478
20479 !! test
20480 Link to pages in language variants
20481 !! options
20482 language=sr
20483 !! wikitext
20484 Main Page can be written as [[Маин Паге]]
20485 !! html
20486 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
20487 </p>
20488 !!end
20489
20490
20491 !! test
20492 Multiple links to pages in language variants
20493 !! options
20494 language=sr
20495 !! wikitext
20496 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
20497 !! html
20498 <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>.
20499 </p>
20500 !!end
20501
20502
20503 !! test
20504 Simple template in language variants
20505 !! options
20506 language=sr
20507 !! wikitext
20508 {{тест}}
20509 !! html
20510 <p>This is a test template
20511 </p>
20512 !! end
20513
20514
20515 !! test
20516 Template with explicit namespace in language variants
20517 !! options
20518 language=sr
20519 !! wikitext
20520 {{Template:тест}}
20521 !! html
20522 <p>This is a test template
20523 </p>
20524 !! end
20525
20526
20527 !! test
20528 Basic test for template parameter in language variants
20529 !! options
20530 language=sr
20531 !! wikitext
20532 {{парамтест|param=foo}}
20533 !! html
20534 <p>This is a test template with parameter foo
20535 </p>
20536 !! end
20537
20538 !! test
20539 Simple category in language variants
20540 !! options
20541 language=sr cat
20542 !! wikitext
20543 [[Category:МедиаWики Усер'с Гуиде]]
20544 !! html/php
20545 cat=МедиаWики_Усер'с_Гуиде sort=
20546 !! html/parsoid
20547 <link rel="mw:PageProp/Category" href="./Категорија:МедиаWики_Усер'с_Гуиде" data-parsoid='{"stx":"simple","a":{"href":"./Категорија:МедиаWики_Усер&#39;с_Гуиде"},"sa":{"href":"Category:МедиаWики Усер&#39;с Гуиде"}}'/>
20548 !! end
20549
20550 !! article
20551 Category:分类
20552 !! text
20553 blah
20554 !! endarticle
20555
20556 !! article
20557 Category:分類
20558 !! text
20559 blah
20560 !! endarticle
20561
20562 ## We used to, but no longer wt2wt this test since the default serializer
20563 ## will normalize all categories to serialize on their own line.
20564 ## This wikitext usage is going to be fairly uncommon in production and
20565 ## selser will take care of preserving formatting in those scenarios.
20566 !! test
20567 Don't convert blue categorylinks to another variant (T35210)
20568 !! options
20569 cat
20570 language=zh
20571 parsoid=wt2html
20572 !! wikitext
20573 [[A]][[Category:分类]]
20574 !! html/php
20575 cat=分类 sort=
20576 !! html/parsoid
20577 <p><a rel="mw:WikiLink" href="./A" title="A">A</a></p>
20578 <link rel="mw:PageProp/Category" href="./Category:分类"/>
20579 !! end
20580
20581 !! test
20582 Stripping -{}- tags (language variants)
20583 !! options
20584 language=sr
20585 !! wikitext
20586 Latin proverb: -{Ne nuntium necare}-
20587 !! html
20588 <p>Latin proverb: Ne nuntium necare
20589 </p>
20590 !! end
20591
20592
20593 !! test
20594 Prevent conversion with -{}- tags (language variants)
20595 !! options
20596 language=sr variant=sr-ec
20597 !! wikitext
20598 Latinski: -{Ne nuntium necare}-
20599 !! html
20600 <p>Латински: Ne nuntium necare
20601 </p>
20602 !! end
20603
20604
20605 !! test
20606 Prevent conversion of text with -{}- tags (language variants)
20607 !! options
20608 language=sr variant=sr-ec
20609 !! wikitext
20610 Latinski: -{Ne nuntium necare}-
20611 !! html
20612 <p>Латински: Ne nuntium necare
20613 </p>
20614 !! end
20615
20616
20617 !! test
20618 Prevent conversion of links with -{}- tags (language variants)
20619 !! options
20620 language=sr variant=sr-ec
20621 !! wikitext
20622 -{[[Main Page]]}-
20623 !! html
20624 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
20625 </p>
20626 !! end
20627
20628
20629 !! test
20630 -{}- tags within headlines (within html for parserConvert())
20631 !! options
20632 language=sr variant=sr-ec
20633 !! wikitext
20634 == -{Naslov}- ==
20635 !! html
20636 <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>
20637
20638 !! end
20639
20640
20641 !! test
20642 Explicit definition of language variant alternatives
20643 !! options
20644 language=zh variant=zh-tw
20645 !! wikitext
20646 -{zh:China;zh-tw:Taiwan}-, not China
20647 !! html
20648 <p>Taiwan, not China
20649 </p>
20650 !! end
20651
20652
20653 !! test
20654 Conversion around HTML tags
20655 !! options
20656 language=sr variant=sr-ec
20657 !! wikitext
20658 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
20659 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
20660 !! html
20661 <p>
20662 <span title="ЛаCтин">ски</span>
20663 </p>
20664 !! end
20665
20666
20667 !! test
20668 Explicit session-wise language variant mapping (A flag and - flag)
20669 !! options
20670 language=zh variant=zh-tw
20671 !! wikitext
20672 Taiwan is not China.
20673 But -{A|zh:China;zh-tw:Taiwan}- is China,
20674 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
20675 and -{China}- is China.
20676 !! html
20677 <p>Taiwan is not China.
20678 But Taiwan is Taiwan,
20679 (This should be stripped!)
20680 and China is China.
20681 </p>
20682 !! end
20683
20684 !! test
20685 Explicit session-wise language variant mapping (H flag for hide)
20686 !! options
20687 language=zh variant=zh-tw
20688 !! wikitext
20689 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
20690 Taiwan is China.
20691 !! html
20692 <p>(This should be stripped!)
20693 Taiwan is Taiwan.
20694 </p>
20695 !! end
20696
20697 !! test
20698 Adding explicit conversion rule for title (T flag)
20699 !! options
20700 language=zh variant=zh-tw showtitle
20701 !! wikitext
20702 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
20703 !! html
20704 Taiwan
20705 <p>Should be stripped!
20706 </p>
20707 !! end
20708
20709 !! test
20710 Testing that changing the language variant here in the tests actually works
20711 !! options
20712 language=zh variant=zh showtitle
20713 !! wikitext
20714 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
20715 !! html
20716 China
20717 <p>Should be stripped!
20718 </p>
20719 !! end
20720
20721 !! test
20722 Recursive conversion of alt and title attrs shouldn't clear converter state
20723 !! options
20724 language=zh variant=zh-cn showtitle
20725 !! wikitext
20726 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
20727 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
20728 !! html
20729 China
20730 <p>
20731 Should be stripped<span title="Exclamation">!</span>
20732 </p>
20733 !! end
20734
20735 !! test
20736 T26072: more test on conversion rule for title
20737 !! options
20738 language=zh variant=zh-tw showtitle
20739 !! wikitext
20740 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
20741 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
20742 !! html
20743 Taiwan
20744 <p>This should be stripped!
20745 This won't take interferes with the title rule.
20746 </p>
20747 !! end
20748
20749 !! test
20750 Partly disable title conversion if variant == main language code
20751 !! options
20752 language=zh variant=zh title=[[ZH]] showtitle
20753 !! wikitext
20754 -{T|zh-cn:CN;zh-tw:TW}-
20755 !! html
20756 ZH
20757 <p>
20758 </p>
20759 !! end
20760
20761 !! test
20762 Partly disable title conversion if variant == main language code, more
20763 !! options
20764 language=zh variant=zh title=[[ZH]] showtitle
20765 !! wikitext
20766 -{T|TW}-
20767 !! html
20768 ZH
20769 <p>
20770 </p>
20771 !! end
20772
20773 !! test
20774 Raw output of variant escape tags (R flag)
20775 !! options
20776 language=zh variant=zh-tw
20777 !! wikitext
20778 Raw: -{R|zh:China;zh-tw:Taiwan}-
20779 !! html
20780 <p>Raw: zh:China;zh-tw:Taiwan
20781 </p>
20782 !! end
20783
20784 !! test
20785 Strings evaluating false shouldn't be ignored by Language converter (T51072)
20786 !! options
20787 language=zh variant=zh-cn
20788 !! input
20789 -{zh-cn:0;zh-sg:1;zh-tw:2;zh-hk:3}-
20790 !! result
20791 <p>0
20792 </p>
20793 !! end
20794
20795 !! test
20796 Conversion rules from [numeric-only string] to [something else] (T48634)
20797 !! options
20798 language=zh variant=zh-cn
20799 !! input
20800 -{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
20801 !! result
20802 <p>D12345EE12345
20803 </p>
20804 !! end
20805
20806 !! test
20807 Bidirectional converter rule entries with an empty value should be ignored (T53551)
20808 !! options
20809 language=zh variant=zh-cn
20810 !! input
20811 -{H|zh-cn:foo;zh-tw:;}-foobar
20812 !! result
20813 <p>foobar
20814 </p>
20815 !! end
20816
20817 !! test
20818 Unidirectional converter rule entries with an empty "from" string should be ignored (T53551)
20819 !! options
20820 language=zh variant=zh-cn
20821 !! input
20822 -{H|=>zh-cn:foo;}-foobar
20823 !! result
20824 <p>foobar
20825 </p>
20826 !! end
20827
20828 !! test
20829 Empty converter rule entries shouldn't be inserted into the conversion table (T53551)
20830 !! options
20831 language=zh variant=zh-cn
20832 !! input
20833 -{H|}-foobar
20834 !! result
20835 <p>foobar
20836 </p>
20837 !! end
20838
20839 !! test
20840 Nested using of manual convert syntax
20841 !! options
20842 language=zh variant=zh-hk
20843 !! wikitext
20844 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
20845 !! html
20846 <p>Nested: Hello Hong Kong!
20847 </p>
20848 !! end
20849
20850 !! test
20851 HTML markups with conversion syntax in attribs, nested in other conversion blocks
20852 !! options
20853 language=zh variant=zh-cn
20854 !! wikitext
20855 -{zh;zh-hans;zh-hant|<span title="-{X}-">A</span>}-
20856 !! html
20857 <p><span title="X">A</span>
20858 </p>
20859 !! end
20860
20861 !! test
20862 HTML markups with conversion syntax in attribs, nested in other conversion blocks (not working yet)
20863 !! options
20864 language=zh variant=zh-cn disabled
20865 !! wikitext
20866 -{<span title="-{X}-">A</span>}-
20867 !! html
20868 <p><span title="X">A</span>
20869 </p>
20870 !! end
20871
20872 # Since Parsoid is starting to emit canonical wikitext for links,
20873 # [http://example.com http://example.com] will not RT back to that
20874 # form anymore.
20875 !! test
20876 Proper conversion of text in external links
20877 !! options
20878 language=sr variant=sr-ec
20879 parsoid=wt2html
20880 !! wikitext
20881 http://www.google.com
20882 gopher://www.google.com
20883 [http://www.google.com http://www.google.com]
20884 [gopher://www.google.com gopher://www.google.com]
20885 [https://www.google.com irc://www.google.com]
20886 [ftp://www.google.com www.google.com/ftp://dir]
20887 [//www.google.com www.google.com]
20888 !! html/php
20889 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
20890 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
20891 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
20892 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
20893 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
20894 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
20895 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
20896 </p>
20897 !! html/parsoid
20898 <p><a rel="mw:ExtLink" href="http://www.google.com">http://www.google.com</a>
20899 <a rel="mw:ExtLink" href="gopher://www.google.com">gopher://www.google.com</a>
20900 <a rel="mw:ExtLink" href="http://www.google.com">http://www.google.com</a>
20901 <a rel="mw:ExtLink" href="gopher://www.google.com">gopher://www.google.com</a>
20902 <a rel="mw:ExtLink" href="https://www.google.com">irc://www.google.com</a>
20903 <a rel="mw:ExtLink" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
20904 <a rel="mw:ExtLink" href="//www.google.com">www.гоогле.цом</a></p>
20905 !! end
20906
20907 !! test
20908 Do not convert roman numbers to language variants
20909 !! options
20910 language=sr variant=sr-ec
20911 !! wikitext
20912 Fridrih IV je car.
20913 !! html
20914 <p>Фридрих IV је цар.
20915 </p>
20916 !! end
20917
20918 !! test
20919 Unclosed language converter markup "-{"
20920 !! options
20921 language=sr
20922 !! wikitext
20923 -{T|hello
20924 !! html
20925 <p>-{T|hello
20926 </p>
20927 !! end
20928
20929 !! test
20930 Don't convert raw rule "-{R|=&gt;}-" to "=>"
20931 !! options
20932 language=sr
20933 !! wikitext
20934 -{R|=&gt;}-
20935 !! html
20936 <p>=&gt;
20937 </p>
20938 !!end
20939
20940 !! test
20941 Don't break link parsing if language converter markup is in the caption.
20942 !! options
20943 language=sr variant=sr-ec
20944 !! wikitext
20945 [[Main Page|-{R|main page}-]]
20946 !! html
20947 <p><a href="/wiki/Main_Page" title="Маин Паге">main page</a>
20948 </p>
20949 !! end
20950
20951 # FIXME: This test is currently broken in the PHP parser T153761
20952 !! test
20953 T146304: Don't break template parsing if language converter markup is in the parameter.
20954 !! options
20955 language=sr variant=sr-ec
20956 disabled
20957 !! wikitext
20958 {{echo|-{R|foo}-}}
20959 !! html/php
20960 <p>foo
20961 </p>
20962 !! end
20963
20964 !! test
20965 T146305: Don't break image parsing if language converter markup is in the caption.
20966 !! options
20967 language=sr
20968 !! wikitext
20969 [[File:Foobar.jpg|thumb|-{R|caption:}-]]
20970 !! html/php
20971 <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>
20972
20973 !! html/parsoid
20974 <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>
20975 !! end
20976
20977 !! test
20978 T146305: Don't break image parsing if nested language converter markup is in the caption.
20979 !! options
20980 language=zh variant=zh-cn
20981 !! wikitext
20982 [[File:Foobar.jpg|thumb|-{zh-cn:blog (hk: -{zh-hans|WEBJOURNAL}-, tw: -{zh-hans|WEBLOG}-)}-]]
20983 !! html/php
20984 <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>
20985
20986 !! html/parsoid
20987 <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>
20988 !! end
20989
20990 !! test
20991 Don't break gallery if language converter markup is inside.
20992 !! options
20993 language=zh
20994 !! wikitext
20995 <gallery>
20996 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=-{R|foo}-|-{R|bar}-]]|alt=-{R|bat}-
20997 File:foobar.jpg|{{Test|unamedParam|alt=-{R|param}-}}|alt=galleryalt
20998 </gallery>
20999 !! html
21000 <ul class="gallery mw-gallery-traditional">
21001 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21002 <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>
21003 <div class="gallerytext">
21004 <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>
21005 </p>
21006 </div>
21007 </div></li>
21008 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21009 <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>
21010 <div class="gallerytext">
21011 <p>This is a test template
21012 </p>
21013 </div>
21014 </div></li>
21015 </ul>
21016
21017 !! end
21018
21019 !! test
21020 T153135: Don't break list handling if language converter markup is in the item.
21021 !! options
21022 language=zh variant=zh-cn
21023 !! wikitext
21024 ;-{zh-cn:AAA;zh-tw:BBB}-
21025 ;-{R|foo:bar}-
21026 !! html/php
21027 <dl><dt>AAA</dt>
21028 <dt>foo:bar</dt></dl>
21029
21030 !! html/parsoid
21031 <dl>
21032 <dt><span typeof="mw:LanguageVariant" data-mw='{"bidir":[{"l":"zh-cn","t":"AAA"},{"l":"zh-tw","t":"BBB"}],"show":true}'></span></dt>
21033 <dt><span typeof="mw:LanguageVariant" data-mw='{"disabled":true,"show":true,"text":"foo:bar"}'></span></dt>
21034 </dl>
21035 !! end
21036
21037 // Note that parsoid does not protect colons unless language converter
21038 // markup is properly nested, because it is a backtracking parser.
21039 !! test
21040 T153135: Unclosed markup in definition list (code coverage)
21041 !! options
21042 language=zh variant=zh-cn
21043 !! wikitext
21044 ;<b>foo:bar
21045 ;-{zh-cn:AAA
21046 !! html/php
21047 <dl><dt><b>foo:bar</dt>
21048 <dt>-{zh-cn:AAA</b></dt></dl>
21049
21050 !! html/parsoid
21051 <dl>
21052 <dt><b>foo:bar</b></dt>
21053 <b>
21054 <dt>-{zh-cn</dt>
21055 <dd>AAA</dd>
21056 </b></dl>
21057 !! end
21058
21059 !! test
21060 T153135: Nested language converter markup in definition list (code coverage)
21061 !! options
21062 language=zh variant=zh-cn
21063 !! wikitext
21064 ;-{zh-cn:AAA -{zh-hans|foo:bar}- -{R|bat:baz}-}-:def
21065 !! html/php
21066 <dl><dt>AAA foo:bar bat:baz</dt>
21067 <dd>def</dd></dl>
21068
21069 !! html/parsoid
21070 <dl>
21071 <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>
21072 <dd>def</dd>
21073 </dl>
21074 !! end
21075
21076 !! test
21077 T153140: Don't break table handling if language converter markup is in the cell.
21078 !! options
21079 language=sr variant=sr-ec
21080 !! wikitext
21081 {|
21082 |-
21083 | -{R|B}-
21084 |}
21085 !! html/php
21086 <table>
21087
21088 <tr>
21089 <td> B
21090 </td></tr></table>
21091
21092 !! html/parsoid
21093 <table>
21094
21095 <tr>
21096 <td> B
21097 </td></tr></table>
21098
21099 !! end
21100
21101 !! test
21102 T2529: Uncovered bullet
21103 !! wikitext
21104 * Foo {{bullet}}
21105 !! html
21106 <ul><li> Foo </li>
21107 <li> Bar</li></ul>
21108
21109 !! end
21110
21111 # Plain MediaWiki does not remove empty lists, but tidy actually does.
21112 # Templates in Wikipedia rely on this behavior, as tidy has always been
21113 # enabled there. These tests are normally run *without* tidy, so specify the
21114 # full output here.
21115 # To test realistic parsing behavior, apply a tidy-like transformation to both
21116 # the expected output and your parser's output.
21117 !! test
21118 T2529: Uncovered bullet leaving empty list, normally removed by tidy
21119 !! wikitext
21120 ******* Foo {{bullet}}
21121 !! html
21122 <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>
21123 <li> Bar</li></ul>
21124
21125 !! end
21126
21127 !! test
21128 T2529: Uncovered table already at line-start
21129 !! wikitext
21130 x
21131
21132 {{table}}
21133 y
21134 !! html
21135 <p>x
21136 </p>
21137 <table>
21138 <tr>
21139 <td> 1 </td>
21140 <td> 2
21141 </td></tr>
21142 <tr>
21143 <td> 3 </td>
21144 <td> 4
21145 </td></tr></table>
21146 <p>y
21147 </p>
21148 !! end
21149
21150 !! test
21151 T2529: Uncovered bullet in parser function result
21152 !! wikitext
21153 * Foo {{lc:{{bullet}} }}
21154 !! html
21155 <ul><li> Foo </li>
21156 <li> bar</li></ul>
21157
21158 !! end
21159
21160 !! test
21161 T7678: Double-parsed template argument
21162 !! wikitext
21163 {{lc:{{{1}}}|hello}}
21164 !! html
21165 <p>{{{1}}}
21166 </p>
21167 !! end
21168
21169 !! test
21170 T7678: Double-parsed template invocation
21171 !! wikitext
21172 {{lc:{{paramtest {{!}} param = hello }} }}
21173 !! html
21174 <p>{{paramtest | param = hello }}
21175 </p>
21176 !! end
21177
21178 !! test
21179 Case insensitivity of parser functions for non-ASCII characters (T10143)
21180 !! options
21181 language=cs
21182 title=[[Main Page]]
21183 !! wikitext
21184 {{PRVNÍVELKÉ:ěščř}}
21185 {{prvnívelké:ěščř}}
21186 {{PRVNÍMALÉ:ěščř}}
21187 {{prvnímalé:ěščř}}
21188 {{MALÁ:ěščř}}
21189 {{malá:ěščř}}
21190 {{VELKÁ:ěščř}}
21191 {{velká:ěščř}}
21192 !! html
21193 <p>Ěščř
21194 Ěščř
21195 ěščř
21196 ěščř
21197 ěščř
21198 ěščř
21199 ĚŠČŘ
21200 ĚŠČŘ
21201 </p>
21202 !! end
21203
21204 !! test
21205 Morwen/13: Unclosed link followed by heading
21206 !! wikitext
21207 [[link
21208 ==heading==
21209 !! html
21210 <p>[[link
21211 </p>
21212 <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>
21213
21214 !! end
21215
21216 !! test
21217 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
21218 !! wikitext
21219 {{foo|
21220 =heading=
21221 !! html
21222 <p>{{foo|
21223 </p>
21224 <h1><span class="mw-headline" id="heading">heading</span></h1>
21225
21226 !! end
21227
21228 !! test
21229 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
21230 !! wikitext
21231 {{foo|
21232 ==heading==
21233 !! html
21234 <p>{{foo|
21235 </p>
21236 <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>
21237
21238 !! end
21239
21240 !! test
21241 Tildes in comments
21242 !! options
21243 pst
21244 !! wikitext
21245 <!-- ~~~~ -->
21246 !! html/php
21247 <!-- ~~~~ -->
21248 !! end
21249
21250 !! test
21251 Paragraphs inside divs (no extra line breaks)
21252 !! wikitext
21253 <div>Line one
21254
21255 Line two</div>
21256 !! html
21257 <div>Line one
21258 Line two</div>
21259
21260 !! end
21261
21262 !! test
21263 Paragraphs inside divs (extra line break on open)
21264 !! wikitext
21265 <div>
21266 Line one
21267
21268 Line two</div>
21269 !! html
21270 <div>
21271 <p>Line one
21272 </p>
21273 Line two</div>
21274
21275 !! end
21276
21277 !! test
21278 Paragraphs inside divs (extra line break on close)
21279 !! wikitext
21280 <div>Line one
21281
21282 Line two
21283 </div>
21284 !! html
21285 <div>Line one
21286 <p>Line two
21287 </p>
21288 </div>
21289
21290 !! end
21291
21292 !! test
21293 Paragraphs inside divs (extra line break on open and close)
21294 !! wikitext
21295 <div>
21296 Line one
21297
21298 Line two
21299 </div>
21300 !! html
21301 <div>
21302 <p>Line one
21303 </p><p>Line two
21304 </p>
21305 </div>
21306
21307 !! end
21308
21309 !! test
21310 Nesting tags, paragraphs on lines which begin with <div>
21311 !! wikitext
21312 <div></div><strong>A
21313 B</strong>
21314 !! html/php+tidy
21315 <p><strong>A</strong></p>
21316 <p><strong>B</strong></p>
21317 !! html/parsoid
21318 <div></div>
21319 <p><strong>A
21320 B</strong>
21321 </p>
21322 !! end
21323
21324 # T8200: <blockquote> should behave like <div> with respect to line breaks
21325 !! test
21326 T8200: paragraphs inside blockquotes (no extra line breaks)
21327 !! wikitext
21328 <blockquote>Line one
21329
21330 Line two</blockquote>
21331 !! html
21332 <blockquote>Line one
21333 Line two</blockquote>
21334
21335 !! html+tidy
21336 <blockquote>
21337 <p>Line one Line two</p>
21338 </blockquote>
21339 !! end
21340
21341 !! test
21342 T8200: paragraphs inside blockquotes (extra line break on open)
21343 !! wikitext
21344 <blockquote>
21345 Line one
21346
21347 Line two</blockquote>
21348 !! html
21349 <blockquote>
21350 <p>Line one
21351 </p>
21352 Line two</blockquote>
21353
21354 !! html+tidy
21355 <blockquote>
21356 <p>Line one</p>
21357 Line two</blockquote>
21358 !! end
21359
21360 !! test
21361 T8200: paragraphs inside blockquotes (extra line break on close)
21362 !! wikitext
21363 <blockquote>Line one
21364
21365 Line two
21366 </blockquote>
21367 !! html
21368 <blockquote>Line one
21369 <p>Line two
21370 </p>
21371 </blockquote>
21372
21373 !! html+tidy
21374 <blockquote>
21375 <p>Line one</p>
21376 <p>Line two</p>
21377 </blockquote>
21378 !! end
21379
21380 !! test
21381 T8200: paragraphs inside blockquotes (extra line break on open and close)
21382 !! wikitext
21383 <blockquote>
21384 Line one
21385
21386 Line two
21387 </blockquote>
21388 !! html
21389 <blockquote>
21390 <p>Line one
21391 </p><p>Line two
21392 </p>
21393 </blockquote>
21394
21395 !! html+tidy
21396 <blockquote>
21397 <p>Line one</p>
21398 <p>Line two</p>
21399 </blockquote>
21400 !! end
21401
21402 !! test
21403 Paragraphs inside blockquotes/divs (no extra line breaks)
21404 !! wikitext
21405 <blockquote><div>Line one
21406
21407 Line two</div></blockquote>
21408 !! html
21409 <blockquote><div>Line one
21410 Line two</div></blockquote>
21411
21412 !! end
21413
21414 !! test
21415 Paragraphs inside blockquotes/divs (extra line break on open)
21416 !! wikitext
21417 <blockquote><div>
21418 Line one
21419
21420 Line two</div></blockquote>
21421 !! html
21422 <blockquote><div>
21423 <p>Line one
21424 </p>
21425 Line two</div></blockquote>
21426
21427 !! end
21428
21429 !! test
21430 Paragraphs inside blockquotes/divs (extra line break on close)
21431 !! wikitext
21432 <blockquote><div>Line one
21433
21434 Line two
21435 </div></blockquote>
21436 !! html
21437 <blockquote><div>Line one
21438 <p>Line two
21439 </p>
21440 </div></blockquote>
21441
21442 !! end
21443
21444 !! test
21445 Paragraphs inside blockquotes/divs (extra line break on open and close)
21446 !! wikitext
21447 <blockquote><div>
21448 Line one
21449
21450 Line two
21451 </div></blockquote>
21452 !! html
21453 <blockquote><div>
21454 <p>Line one
21455 </p><p>Line two
21456 </p>
21457 </div></blockquote>
21458
21459 !! end
21460
21461 !! test
21462 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
21463 !! options
21464 wgLinkHolderBatchSize=0
21465 !! wikitext
21466 [[meatball:1]]
21467 [[meatball:2]]
21468 [[meatball:3]]
21469 !! html
21470 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
21471 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
21472 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
21473 </p>
21474 !! end
21475
21476 !! test
21477 Free external link invading image caption
21478 !! wikitext
21479 [[Image:Foobar.jpg|thumb|http://x|hello]]
21480 !! html
21481 <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>
21482
21483 !! end
21484
21485 !! test
21486 T17196: localised external link numbers
21487 !! options
21488 language=fa
21489 !! wikitext
21490 [http://en.wikipedia.org/]
21491 !! html/php
21492 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
21493 </p>
21494 !! html/parsoid
21495 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/"></a></p>
21496 !! end
21497
21498 !! test
21499 Multibyte character in padleft
21500 !! wikitext
21501 {{padleft:-Hello|7|Æ}}
21502 !! html
21503 <p>Æ-Hello
21504 </p>
21505 !! end
21506
21507 !! test
21508 Multibyte character in padright
21509 !! wikitext
21510 {{padright:Hello-|7|Æ}}
21511 !! html
21512 <p>Hello-Æ
21513 </p>
21514 !! end
21515
21516 !!test
21517 formatdate parser function
21518 !! wikitext
21519 {{#formatdate:2009-03-24}}
21520 !! html
21521 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
21522 </p>
21523 !! end
21524
21525 !!test
21526 formatdate parser function, with default format
21527 !! wikitext
21528 {{#formatdate:2009-03-24|mdy}}
21529 !! html
21530 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
21531 </p>
21532 !! end
21533
21534 !! test
21535 Spacing of numbers in formatted dates
21536 !! wikitext
21537 {{#formatdate:January 15}}
21538 !! html
21539 <p><span class="mw-formatted-date" title="01-15">January 15</span>
21540 </p>
21541 !! end
21542
21543 !! test
21544 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
21545 !! options
21546 language=nl title=[[MediaWiki:Common.css]]
21547 !! wikitext
21548 {{#formatdate:2009-03-24|dmy}}
21549 !! html
21550 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
21551 </p>
21552 !! end
21553
21554 #
21555 #
21556 #
21557
21558 #
21559 # Edit comments
21560 #
21561
21562 !! test
21563 Edit comment with link
21564 !! options
21565 comment
21566 !! wikitext
21567 I like the [[Main Page]] a lot
21568 !! html/php
21569 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
21570 !!end
21571
21572 !! test
21573 Edit comment with link and link text
21574 !! options
21575 comment
21576 !! wikitext
21577 I like the [[Main Page|best pages]] a lot
21578 !! html/php
21579 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
21580 !!end
21581
21582 !! test
21583 Edit comment with link and link text with suffix
21584 !! options
21585 comment
21586 !! wikitext
21587 I like the [[Main Page|best page]]s a lot
21588 !! html/php
21589 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
21590 !!end
21591
21592 !! test
21593 Edit comment with section link (non-local, eg in history list)
21594 !! options
21595 comment title=[[Main Page]]
21596 !! wikitext
21597 /* External links */ removed bogus entries
21598 !! html/php
21599 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
21600 !!end
21601
21602 !! test
21603 Edit comment with section link and text before it (non-local, eg in history list)
21604 !! options
21605 comment title=[[Main Page]]
21606 !! wikitext
21607 pre-comment text /* External links */ removed bogus entries
21608 !! html/php
21609 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>
21610 !!end
21611
21612 !! test
21613 Edit comment with section link (local, eg in diff view)
21614 !! options
21615 comment local title=[[Main Page]]
21616 !! wikitext
21617 /* External links */ removed bogus entries
21618 !! html/php
21619 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
21620 !!end
21621
21622 !! test
21623 Edit comment with subpage link (T16080)
21624 !! options
21625 comment
21626 subpage
21627 title=[[Subpage test]]
21628 !! wikitext
21629 Poked at a [[/subpage]] here...
21630 !! html/php
21631 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
21632 !!end
21633
21634 !! test
21635 Edit comment with subpage link and link text (T16080)
21636 !! options
21637 comment
21638 subpage
21639 title=[[Subpage test]]
21640 !! wikitext
21641 Poked at a [[/subpage|neat little page]] here...
21642 !! html/php
21643 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
21644 !!end
21645
21646 !! test
21647 Edit comment with bogus subpage link in non-subpage NS (T16080)
21648 !! options
21649 comment
21650 title=[[Subpage test]]
21651 !! wikitext
21652 Poked at a [[/subpage]] here...
21653 !! html/php
21654 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...
21655 !!end
21656
21657 !! test
21658 Edit comment with bare anchor link (local, as on diff)
21659 !! options
21660 comment
21661 local
21662 title=[[Main Page]]
21663 !! wikitext
21664 [[#section]]
21665 !! html/php
21666 <a href="#section">#section</a>
21667 !! end
21668
21669 !! test
21670 Edit comment with bare anchor link (non-local, as on history)
21671 !! options
21672 comment
21673 title=[[Main Page]]
21674 !! wikitext
21675 [[#section]]
21676 !! html/php
21677 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
21678 !! end
21679
21680 !! test
21681 Anchor starting with underscore
21682 !! options
21683 title=[[Foo]]
21684 !! wikitext
21685 [[#_ref|One]]
21686 !! html/php
21687 <p><a href="#_ref">One</a>
21688 </p>
21689 !! html/parsoid
21690 <p><a rel="mw:WikiLink" href="./Foo#_ref" data-parsoid='{"stx":"piped","a":{"href":"./Foo#_ref"},"sa":{"href":"#_ref"}}'>One</a></p>
21691 !! end
21692
21693 !! test
21694 Id starting with underscore
21695 !! wikitext
21696 <div id="_ref"></div>
21697 !! html/*
21698 <div id="_ref"></div>
21699
21700 !! end
21701
21702 !! test
21703 Edit comment with link with more than one pipe (T99346)
21704 !! options
21705 comment
21706 !! wikitext
21707 [[Main Page|Many|pipes]]
21708 !! html/php
21709 <a href="/wiki/Main_Page" title="Main Page">Many|pipes</a>
21710 !! end
21711
21712 !! test
21713 Complex edit comment with link with more than one pipe (T99346)
21714 !! options
21715 comment
21716 !! wikitext
21717 Created page with "<noinclude>[[Category:Requests for permissions/Bot|{{subst:#titleparts:{{subst:PAGENAME}}|1|3}}]]</noinclude> === [[User:MineoBot|]] 8=== {{Request for permissions/links|Mineo..."
21718 !! html/php
21719 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;
21720 !! end
21721
21722 !! test
21723 Space normalisation on autocomment (T24784)
21724 !! options
21725 comment
21726 title=[[Main Page]]
21727 !! wikitext
21728 /* __hello__world__ */
21729 !! html/php
21730 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
21731 !! end
21732
21733 !! test
21734 percent-encoding and + signs in comments (T28410)
21735 !! options
21736 comment
21737 !! wikitext
21738 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
21739 !! html/php
21740 <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>
21741 !! end
21742
21743 # Parsoid doesn't support this yet: see T75581
21744 # but it *should* omit the 'src' attribute if the image is bad.
21745 # PHP side of tests was disabled in
21746 # mediawiki/core:6bd31e7d95161a6e88fa86df60871051da997c3c
21747 # because of issues in the PHP parserTests infrastructure
21748 # (but the output below is indeed what the PHP side emits)
21749 !! test
21750 Bad images - basic functionality
21751 !! wikitext
21752 [[File:Bad.jpg]]
21753 !! DISABLED/html/php
21754 !! html/parsoid
21755 <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>
21756 !! end
21757
21758 !! test
21759 Bad images - T18039: text after bad image disappears
21760 !! wikitext
21761 Foo bar
21762 [[File:Bad.jpg]]
21763 Bar foo
21764 !! DISABLED/html/php
21765 <p>Foo bar
21766 </p><p>Bar foo
21767 </p>
21768 !! html/parsoid
21769 <p>Foo bar
21770 <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>
21771 Bar foo</p>
21772 !! end
21773
21774 !! test
21775 Verify that displaytitle works (T24501) no displaytitle
21776 !! options
21777 showtitle
21778 !! config
21779 wgAllowDisplayTitle=true
21780 wgRestrictDisplayTitle=false
21781 !! wikitext
21782 this is not the the title
21783 !! html/php
21784 Parser test
21785 <p>this is not the the title
21786 </p>
21787 !! end
21788
21789 !! test
21790 Verify that displaytitle works (T24501) RestrictDisplayTitle=false
21791 !! options
21792 showtitle
21793 title=[[Screen]]
21794 !! config
21795 wgAllowDisplayTitle=true
21796 wgRestrictDisplayTitle=false
21797 !! wikitext
21798 this is not the the title
21799 {{DISPLAYTITLE:whatever}}
21800 !! html/php
21801 whatever
21802 <p>this is not the the title
21803 </p>
21804 !! end
21805
21806 !! test
21807 Verify that displaytitle works (T24501) RestrictDisplayTitle=true mismatch
21808 !! options
21809 showtitle
21810 title=[[Screen]]
21811 !! config
21812 wgAllowDisplayTitle=true
21813 wgRestrictDisplayTitle=true
21814 !! wikitext
21815 this is not the the title
21816 {{DISPLAYTITLE:whatever}}
21817 !! html/php
21818 Screen
21819 <p>this is not the the title
21820 </p>
21821 !! end
21822
21823 !! test
21824 Verify that displaytitle works (T24501) RestrictDisplayTitle=true matching
21825 !! options
21826 showtitle
21827 title=[[Screen]]
21828 !! config
21829 wgAllowDisplayTitle=true
21830 wgRestrictDisplayTitle=true
21831 !! wikitext
21832 this is not the the title
21833 {{DISPLAYTITLE:screen}}
21834 !! html/php
21835 screen
21836 <p>this is not the the title
21837 </p>
21838 !! end
21839
21840 !! test
21841 Verify that displaytitle works (T24501) AllowDisplayTitle=false
21842 !! options
21843 showtitle
21844 title=[[Screen]]
21845 !! config
21846 wgAllowDisplayTitle=false
21847 !! wikitext
21848 this is not the the title
21849 {{DISPLAYTITLE:screen}}
21850 !! html/php
21851 Screen
21852 <p>this is not the the title
21853 <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>
21854 </p>
21855 !! end
21856
21857 !! test
21858 Verify that displaytitle works (T24501) AllowDisplayTitle=false no DISPLAYTITLE
21859 !! options
21860 showtitle
21861 title=[[Screen]]
21862 !! config
21863 wgAllowDisplayTitle=false
21864 !! wikitext
21865 this is not the the title
21866 !! html/php
21867 Screen
21868 <p>this is not the the title
21869 </p>
21870 !! end
21871
21872 !! test
21873 Verify that displaytitle handles inline CSS styles (T28547) - rejected value
21874 !! options
21875 showtitle
21876 title=[[Screen]]
21877 !! config
21878 wgAllowDisplayTitle=true
21879 wgRestrictDisplayTitle=true
21880 !! wikitext
21881 this is not the the title
21882 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
21883 !! html/php
21884 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
21885 <p>this is not the the title
21886 </p>
21887 !! end
21888
21889 !! test
21890 Verify that displaytitle handles inline CSS styles (T28547) - accepted value
21891 !! options
21892 showtitle
21893 title=[[Screen]]
21894 !! config
21895 wgAllowDisplayTitle=true
21896 wgRestrictDisplayTitle=true
21897 !! wikitext
21898 this is not the the title
21899 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
21900 !! html/php
21901 <span style="color: red;">s</span>creen
21902 <p>this is not the the title
21903 </p>
21904 !! end
21905
21906 !! test
21907 Page status indicators: Empty name is invalid
21908 !! options
21909 showindicators
21910 !! wikitext
21911 <indicator name=" "></indicator>
21912 <indicator></indicator>
21913 !! html/php
21914 <p><span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
21915 <span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
21916 </p>
21917 !! end
21918
21919 !! test
21920 Page status indicators: Weird syntaxes that are okay
21921 !! options
21922 showindicators
21923 !! wikitext
21924 <indicator name="empty" />
21925 <indicator name="name"></indicator>
21926 !! html/php
21927 empty=
21928 name=
21929 <p><br />
21930 </p>
21931 !! end
21932
21933 !! test
21934 Page status indicators: Torture test
21935 !! options
21936 showindicators
21937 !! wikitext
21938 <indicator name="01">hello world</indicator>
21939 <indicator name="02">[[Main Page]]</indicator>
21940 <indicator name="03">[[File:Foobar.jpg|25px|link=]]</indicator>
21941 <indicator name="04">[[File:Foobar.jpg|25px]]</indicator>
21942 <indicator name="05">* foo
21943 * bar</indicator>
21944 <indicator name="06"><nowiki>foo</nowiki></indicator>
21945 <indicator name="07"> Preformatted</indicator>
21946 <indicator name="08"><div>Broken tag</indicator>
21947 <indicator name="09">{| class=wikitable
21948 | cell
21949 |}</indicator>
21950 <indicator name="10">Two
21951
21952 paragraphs</indicator>
21953 !! html/php
21954 01=hello world
21955 02=<a href="/wiki/Main_Page" title="Main Page">Main Page</a>
21956 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" />
21957 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>
21958 05=<ul><li> foo</li>
21959 <li> bar</li></ul>
21960
21961 06=foo
21962 07=<pre>Preformatted
21963 </pre>
21964 08=<div>Broken tag</div>
21965
21966 09=<table class="wikitable">
21967 <tr>
21968 <td> cell
21969 </td></tr></table>
21970
21971 10=<p>Two
21972 </p><p>paragraphs
21973 </p>
21974 <p><br />
21975 </p><p><br />
21976 </p><p><br />
21977 </p><p><br />
21978 </p><p><br />
21979 </p>
21980 !! end
21981
21982 !! test
21983 preload: check <noinclude> and <includeonly>
21984 !! options
21985 preload
21986 !! wikitext
21987 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
21988 !! html/php
21989 Hello kind world.
21990 !! end
21991
21992 !! test
21993 preload: check <onlyinclude>
21994 !! options
21995 preload
21996 !! wikitext
21997 Goodbye <onlyinclude>Hello world</onlyinclude>
21998 !! html/php
21999 Hello world
22000 !! end
22001
22002 !! test
22003 preload: can pass tags through if we want to
22004 !! options
22005 preload
22006 !! wikitext
22007 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
22008 !! html/php
22009 <includeonly>Hello world</includeonly>
22010 !! end
22011
22012 !! test
22013 preload: check that it doesn't try to do tricks
22014 !! options
22015 preload
22016 !! wikitext
22017 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
22018 !! html/php
22019 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
22020 !! end
22021
22022 !! test
22023 Play a bit with r67090 and T5158
22024 !! wikitext
22025 <div style="width:50% !important">&nbsp;</div>
22026 <div style="width:50%&nbsp;!important">&nbsp;</div>
22027 <div style="width:50%&#160;!important">&nbsp;</div>
22028 <div style="border : solid;">&nbsp;</div>
22029 !! html/php
22030 <div style="width:50% !important">&#160;</div>
22031 <div style="width:50% !important">&#160;</div>
22032 <div style="width:50% !important">&#160;</div>
22033 <div style="border&#160;: solid;">&#160;</div>
22034
22035 !! html/parsoid
22036 <div style="width:50% !important" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
22037 <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>
22038 <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>
22039 <div style="border : solid;" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
22040
22041 !! end
22042
22043 !! test
22044 HTML5 data attributes
22045 !! wikitext
22046 <span data-foo="bar">Baz</span>
22047 <p data-abc-def_hij="">Quuz</p>
22048 !! html/php
22049 <p><span data-foo="bar">Baz</span>
22050 </p>
22051 <p data-abc-def_hij="">Quuz</p>
22052
22053 !! html/parsoid
22054 <p><span data-foo="bar" data-parsoid='{"stx":"html"}'>Baz</span></p>
22055 <p data-abc-def_hij="" data-parsoid='{"stx":"html"}'>Quuz</p>
22056 !! end
22057
22058 !! test
22059 Strip reserved data attributes
22060 !! wikitext
22061 <div data-mw="foo" data-parsoid="bar" data-mw-someext="baz" data-ok="fred" data-ooui="xyzzy" data-bad:ns="ns">d</div>
22062 !! html/php
22063 <div data-ok="fred">d</div>
22064
22065 !! html/parsoid
22066 <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>
22067 !! end
22068
22069 !! test
22070 percent-encoding and + signs in internal links (T28410)
22071 !! wikitext
22072 [[User:+%]] [[Page+title%]]
22073 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
22074 [[%]] [[+]] [[File:%+abc%39|foo|[[bar]]]]
22075 [[%33%45]] [[%33%45+]]
22076 !! html/php
22077 <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>
22078 <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>
22079 <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>
22080 <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>
22081 </p>
22082 !! html/parsoid
22083 <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>
22084 <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>
22085 <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":"missing-image","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>
22086 <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>
22087 !! end
22088
22089 !! test
22090 Special characters in embedded file links (T29679)
22091 !! wikitext
22092 [[File:Contains & ampersand.jpg]]
22093 [[File:Does not exist.jpg|Title with & ampersand]]
22094 !! html/php
22095 <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>
22096 <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>
22097 </p>
22098 !! html/parsoid
22099 <p><span class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"missing-image","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>
22100 <span class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"missing-image","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>
22101 !! end
22102
22103 !! test
22104 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
22105 !! wikitext
22106 Text&apos;s been normalized?
22107 !! html
22108 <p>Text&#39;s been normalized?
22109 </p>
22110 !! end
22111
22112 !! test
22113 T21052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
22114 !! wikitext
22115 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
22116 !! html
22117 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
22118 </p>
22119 !! end
22120
22121 !! test
22122 T21052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
22123 !! wikitext
22124 [http://www.example.org/ ideograms]
22125 !! html
22126 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
22127 </p>
22128 !! end
22129
22130 !! test
22131 T21052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
22132 !! wikitext
22133 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
22134 !! html
22135 <p><img src="http://www.example.org/pic.png" alt="pic.png"/> &lt;-- U+3000 (vim: ^Vu3000)
22136 </p>
22137 !! end
22138
22139 !! article
22140 Mediawiki:loop1
22141 !! text
22142 {{Identical|A}}
22143 !! endarticle
22144
22145 !! article
22146 Mediawiki:loop2
22147 !! text
22148 {{Identical|B}}
22149 !! endarticle
22150
22151 !! article
22152 Template:Identical
22153 !! text
22154 {{int:loop1}}
22155 {{int:loop2}}
22156 !! endarticle
22157
22158 !! test
22159 T33098 Template which includes system messages which includes the template
22160 !! wikitext
22161 {{Identical}}
22162 !! html
22163 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
22164 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
22165 </p>
22166 !! end
22167
22168 !! test
22169 T33490 Turkish: ucfirst 'blah'
22170 !! options
22171 language=tr
22172 !! wikitext
22173 {{ucfirst:blah}}
22174 !! html
22175 <p>Blah
22176 </p>
22177 !! end
22178
22179 !! test
22180 T33490 Turkish: ucfirst 'ix'
22181 !! options
22182 language=tr
22183 !! wikitext
22184 {{ucfirst:ix}}
22185 !! html
22186 <p>İx
22187 </p>
22188 !! end
22189
22190 !! test
22191 T33490 Turkish: lcfirst 'BLAH'
22192 !! options
22193 language=tr
22194 !! wikitext
22195 {{lcfirst:BLAH}}
22196 !! html
22197 <p>bLAH
22198 </p>
22199 !! end
22200
22201 !! test
22202 T33490 Turkish: ucfırst (with a dotless i)
22203 !! options
22204 language=tr
22205 !! wikitext
22206 {{ucfırst:blah}}
22207 !! html
22208 <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>
22209 </p>
22210 !! end
22211
22212 !! test
22213 T33490 ucfırst (with a dotless i) with English language
22214 !! options
22215 language=en
22216 !! wikitext
22217 {{ucfırst:blah}}
22218 !! html
22219 <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>
22220 </p>
22221 !! end
22222
22223 !! test
22224 T28375: TOC with italics
22225 !! options
22226 title=[[Main Page]]
22227 !! wikitext
22228 __TOC__
22229 == ''Lost'' episodes ==
22230 !! html
22231 <div id="toc" class="toc"><div id="toctitle" class="toctitle"><h2>Contents</h2></div>
22232 <ul>
22233 <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>
22234 </ul>
22235 </div>
22236
22237 <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>
22238
22239 !! end
22240
22241 !! test
22242 T28375: TOC with bold
22243 !! options
22244 title=[[Main Page]]
22245 !! wikitext
22246 __TOC__
22247 == '''should be bold''' then normal text ==
22248 !! html
22249 <div id="toc" class="toc"><div id="toctitle" class="toctitle"><h2>Contents</h2></div>
22250 <ul>
22251 <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>
22252 </ul>
22253 </div>
22254
22255 <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>
22256
22257 !! end
22258
22259 !! test
22260 T35845: Headings become cursive in TOC when they contain an image
22261 !! options
22262 title=[[Main Page]]
22263 !! wikitext
22264 __TOC__
22265 == Image [[Image:foobar.jpg]] ==
22266 !! html
22267 <div id="toc" class="toc"><div id="toctitle" class="toctitle"><h2>Contents</h2></div>
22268 <ul>
22269 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
22270 </ul>
22271 </div>
22272
22273 <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>
22274
22275 !! end
22276
22277 !! test
22278 T35845 (2): Headings become bold in TOC when they contain a blockquote
22279 !! options
22280 title=[[Main Page]]
22281 !! wikitext
22282 __TOC__
22283 == <blockquote>Quote</blockquote> ==
22284 !! html
22285 <div id="toc" class="toc"><div id="toctitle" class="toctitle"><h2>Contents</h2></div>
22286 <ul>
22287 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
22288 </ul>
22289 </div>
22290
22291 <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>
22292
22293 !! html+tidy
22294 <p></p>
22295 <div id="toc" class="toc">
22296 <div id="toctitle" class="toctitle">
22297 <h2>Contents</h2>
22298 </div>
22299 <ul>
22300 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
22301 </ul>
22302 </div>
22303 <p></p>
22304 <h2><span class="mw-headline" id="Quote"></span></h2>
22305 <blockquote>
22306 <p><span class="mw-headline" id="Quote">Quote</span></p>
22307 </blockquote>
22308 <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>
22309 !! end
22310
22311 !! test
22312 Unclosed tags in TOC
22313 !! options
22314 title=[[Main Page]]
22315 !! wikitext
22316 __TOC__
22317 == Proof: 2 < 3 ==
22318 <small>Hanc marginis exiguitas non caperet.</small>
22319 QED
22320 !! html
22321 <div id="toc" class="toc"><div id="toctitle" class="toctitle"><h2>Contents</h2></div>
22322 <ul>
22323 <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>
22324 </ul>
22325 </div>
22326
22327 <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>
22328 <p><small>Hanc marginis exiguitas non caperet.</small>
22329 QED
22330 </p>
22331 !! end
22332
22333 !! test
22334 Multiple tags in TOC
22335 !! wikitext
22336 __TOC__
22337 == <i>Foo</i> <b>Bar</b> ==
22338
22339 == <i>Foo</i> <blockquote>Bar</blockquote> ==
22340 !! html
22341 <div id="toc" class="toc"><div id="toctitle" class="toctitle"><h2>Contents</h2></div>
22342 <ul>
22343 <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>
22344 <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>
22345 </ul>
22346 </div>
22347
22348 <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>
22349 <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>
22350
22351 !! html+tidy
22352 <p></p>
22353 <div id="toc" class="toc">
22354 <div id="toctitle" class="toctitle">
22355 <h2>Contents</h2>
22356 </div>
22357 <ul>
22358 <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>
22359 <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>
22360 </ul>
22361 </div>
22362 <p></p>
22363 <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>
22364 <h2><span class="mw-headline" id="Foo_Bar_2"><i>Foo</i></span></h2>
22365 <blockquote>
22366 <p><span class="mw-headline" id="Foo_Bar_2">Bar</span></p>
22367 </blockquote>
22368 <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>
22369 !! end
22370
22371 # Don't expect Parsoid to roundtrip this until the php parser comes closer to
22372 # html5 tag parsing.
22373 !! test
22374 Tags with parameters in TOC
22375 !! options
22376 parsoid=wt2html
22377 !! wikitext
22378 __TOC__
22379 == <sup class="in-h2">Hello</sup> ==
22380
22381 == <sup class="a > b">Evilbye</sup> ==
22382 !! html/php
22383 <div id="toc" class="toc"><div id="toctitle" class="toctitle"><h2>Contents</h2></div>
22384 <ul>
22385 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
22386 <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>
22387 </ul>
22388 </div>
22389
22390 <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>
22391 <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>
22392
22393 !! html/parsoid
22394 <meta property="mw:PageProp/toc" />
22395 <h2> <sup class="in-h2" data-parsoid='{"stx":"html"}'>Hello</sup> </h2>
22396
22397 <h2> <sup class="a " data-parsoid='{"stx":"html"}'> b">Evilbye</sup> </h2>
22398 !! end
22399
22400 !! test
22401 span tags with directionality in TOC
22402 !! wikitext
22403 __TOC__
22404 == <span dir="ltr">C++</span> ==
22405
22406 == <span dir="rtl">זבנג!</span> ==
22407
22408 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
22409
22410 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
22411
22412 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
22413 !! html
22414 <div id="toc" class="toc"><div id="toctitle" class="toctitle"><h2>Contents</h2></div>
22415 <ul>
22416 <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>
22417 <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>
22418 <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>
22419 <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>
22420 <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>
22421 </ul>
22422 </div>
22423
22424 <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>
22425 <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>
22426 <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>
22427 <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>
22428 <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>
22429
22430 !! end
22431
22432 !! test
22433 T74884: bdi element in ToC
22434 !! wikitext
22435 __TOC__
22436 == <bdi>test</bdi> ==
22437 !! html
22438 <div id="toc" class="toc"><div id="toctitle" class="toctitle"><h2>Contents</h2></div>
22439 <ul>
22440 <li class="toclevel-1 tocsection-1"><a href="#test"><span class="tocnumber">1</span> <span class="toctext"><bdi>test</bdi></span></a></li>
22441 </ul>
22442 </div>
22443
22444 <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>
22445
22446 !! end
22447
22448 !! test
22449 T35715: s/strike element in ToC
22450 !! wikitext
22451 __TOC__
22452 == <s>test</s> test <strike>test</strike> ==
22453 !! html
22454 <div id="toc" class="toc"><div id="toctitle" class="toctitle"><h2>Contents</h2></div>
22455 <ul>
22456 <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>
22457 </ul>
22458 </div>
22459
22460 <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>
22461
22462 !! end
22463
22464 # Note that the html output does not have the <p></p>, but the
22465 # html+tidy output *does*. This is because the empty <p></p> is
22466 # removed by the sanitizer, but only when tidy is *not* enabled (!).
22467 !! test
22468 Empty <p> tag in TOC, removed by Sanitizer (T92892)
22469 !! wikitext
22470 __TOC__
22471 == x ==
22472 !! html
22473 <div id="toc" class="toc"><div id="toctitle" class="toctitle"><h2>Contents</h2></div>
22474 <ul>
22475 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
22476 </ul>
22477 </div>
22478
22479 <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>
22480
22481 !! html+tidy
22482 <p></p>
22483 <div id="toc" class="toc">
22484 <div id="toctitle" class="toctitle">
22485 <h2>Contents</h2>
22486 </div>
22487 <ul>
22488 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
22489 </ul>
22490 </div>
22491 <p></p>
22492 <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>
22493 !! end
22494
22495 !! article
22496 MediaWiki:T34057
22497 !! text
22498 == {{int:headline_sample}} ==
22499 !! endarticle
22500
22501 !! test
22502 T34057: Title needed when expanding <h> nodes.
22503 !! options
22504 title=[[Main Page]]
22505 !! wikitext
22506 {{int:T34057}}
22507 !! html
22508 <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>
22509
22510 !! end
22511
22512 !! test
22513 Strip marker in urlencode
22514 !! wikitext
22515 {{urlencode:x<nowiki/>y}}
22516 {{urlencode:x<nowiki/>y|wiki}}
22517 {{urlencode:x<nowiki/>y|path}}
22518 {{urlencode:x<pre id="one">two</pre>y}}
22519 !! html/php
22520 <p>xy
22521 xy
22522 xy
22523 xy
22524 </p>
22525 !! end
22526
22527 !! test
22528 Strip marker in lc
22529 !! wikitext
22530 {{lc:x<nowiki/>y}}
22531 !! html
22532 <p>xy
22533 </p>
22534 !! end
22535
22536 !! test
22537 Strip marker in uc
22538 !! wikitext
22539 {{uc:x<nowiki/>y}}
22540 !! html
22541 <p>XY
22542 </p>
22543 !! end
22544
22545 !! test
22546 Strip marker in formatNum
22547 !! wikitext
22548 {{formatnum:1<nowiki/>2}}
22549 {{formatnum:1<nowiki/>2|R}}
22550 !! html
22551 <p>12
22552 12
22553 </p>
22554 !! end
22555
22556 !! test
22557 Check noCommafy in formatNum
22558 !! options
22559 language=be-tarask
22560 !! wikitext
22561 {{formatnum:123456.78}}
22562 {{formatnum:123456.78|NOSEP}}
22563 !! html
22564 <p>123 456,78
22565 123456.78
22566 </p>
22567 !! end
22568
22569 !! test
22570 Wrong option for formatNum (T58199)
22571 !! wikitext
22572 {{formatnum:1,234.56|Random}}
22573 {{formatnum:1,234.56|EVERYTHING}}
22574 {{formatnum:1234.56|any argument that has the string 'NOSEP'}}
22575 !! html
22576 <p>1,234.56
22577 1,234.56
22578 1,234.56
22579 </p>
22580 !! end
22581
22582 !! test
22583 Strip marker in grammar
22584 !! options
22585 language=fi
22586 !! wikitext
22587 {{grammar:elative|foo<nowiki/>bar}}
22588 !! html
22589 <p>foobarista
22590 </p>
22591 !! end
22592
22593 !! test
22594 Strip marker in padleft
22595 !! wikitext
22596 {{padleft:|2|x<nowiki/>y}}
22597 !! html
22598 <p>xy
22599 </p>
22600 !! end
22601
22602 !! test
22603 Strip marker in padright
22604 !! wikitext
22605 {{padright:|2|x<nowiki/>y}}
22606 !! html
22607 <p>xy
22608 </p>
22609 !! end
22610
22611 !! test
22612 Strip marker in anchorencode
22613 !! wikitext
22614 {{anchorencode:x<nowiki/>y}}
22615 !! html
22616 <p>xy
22617 </p>
22618 !! end
22619
22620 !! test
22621 nowiki inside link inside heading (T20295)
22622 !! wikitext
22623 ==[[foo|x<nowiki>y</nowiki>z]]==
22624 !! html
22625 <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>
22626
22627 !! end
22628
22629 !! test
22630 new support for bdi element (T33817)
22631 !! wikitext
22632 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
22633 !! html
22634 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
22635
22636 !!end
22637
22638 !! test
22639 Ignore pipe between table row attributes
22640 !! wikitext
22641 {|
22642 | quux
22643 |- id=foo | style='color: red'
22644 | bar
22645 |}
22646 !! html
22647 <table>
22648 <tr>
22649 <td> quux
22650 </td></tr>
22651 <tr id="foo" style="color: red">
22652 <td> bar
22653 </td></tr></table>
22654
22655 !! end
22656
22657 !!test
22658 Language parser function
22659 !! wikitext
22660 {{#language:ar}}
22661 !! html
22662 <p>العربية
22663 </p>
22664 !! end
22665
22666 !!test
22667 Padleft and padright as substr
22668 !! wikitext
22669 {{padleft:|3|abcde}}
22670 {{padright:|3|abcde}}
22671 !! html
22672 <p>abc
22673 abc
22674 </p>
22675 !! end
22676
22677 !!test
22678 Special parser function
22679 !! wikitext
22680 {{#special:RandomPage}}
22681 {{#special:BaDtItLe}}
22682 {{#special:Foobar}}
22683 !! html
22684 <p>Special:Random
22685 Special:Badtitle
22686 Special:Foobar
22687 </p>
22688 !! end
22689
22690 !!test
22691 T36939 - Case insensitive link parsing ([HttP://])
22692 !! wikitext
22693 [HttP://MediaWiki.Org/]
22694 !! html/php
22695 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
22696 </p>
22697 !! html/parsoid
22698 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/"></a></p>
22699 !! end
22700
22701 !!test
22702 T36939 - Case insensitive link parsing ([HttP:// title])
22703 !! wikitext
22704 [HttP://MediaWiki.Org/ MediaWiki]
22705 !! html
22706 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
22707 </p>
22708 !! end
22709
22710 !!test
22711 T36939 - Case insensitive link parsing (HttP://)
22712 !! wikitext
22713 HttP://MediaWiki.Org/
22714 !! html/php
22715 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
22716 </p>
22717 !! html/parsoid
22718 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a></p>
22719 !! end
22720
22721 !!test
22722 Disable TOC
22723 !! options
22724 notoc
22725 !! wikitext
22726 Lead
22727 == Section 1 ==
22728 == Section 2 ==
22729 == Section 3 ==
22730 == Section 4 ==
22731 == Section 5 ==
22732 !! html
22733 <p>Lead
22734 </p>
22735
22736 <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>
22737 <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>
22738 <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>
22739 <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>
22740 <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>
22741
22742 !! end
22743
22744
22745 ###
22746 ### Parsoid-specific tests
22747 ### Parsoid-PHP parser incompatibilities
22748 ###
22749 !!test
22750 1. SOL-sensitive wikitext tokens as template-args
22751 !!options
22752 parsoid=wt2html,wt2wt
22753 !! wikitext
22754 {{echo|*a}}
22755 {{echo|#a}}
22756 {{echo|:a}}
22757 !! html
22758 <span about="#mwt1" typeof="mw:Transclusion">
22759 </span><ul about="#mwt1"><li>a</li>
22760 </ul>
22761 <span about="#mwt2" typeof="mw:Transclusion">
22762 </span><ol about="#mwt2"><li>a</li>
22763 </ol>
22764 <span about="#mwt3" typeof="mw:Transclusion">
22765 </span><dl about="#mwt3"><dd>a</dd>
22766 </dl>
22767 !!end
22768
22769 #### -----------------------------------------------------------------
22770 #### Parsoid-specific functionality tests
22771 #### -----------------------------------------------------------------
22772
22773 # T65642/T68749: Formatting elt fixup around images is cleaned up.
22774 # We know wt2wt will fail, but we expect selser to pass.
22775 # Due to the nature of our testing, wt2wt and selser tests will enter the
22776 # blacklist and we'll catch selser regressions based on changes to the
22777 # blacklist entries for selser tests.
22778 !! test
22779 1. Bad treebuilder fixup of formatting elt is cleaned up
22780 !! options
22781 parsoid=wt2html,wt2wt
22782 !! wikitext
22783 {|
22784 |
22785 <small>
22786 [[Image:Foobar.jpg|right|Test]]
22787 </small>
22788 |}
22789 !! html/parsoid
22790 <table>
22791 <tbody><tr><td>
22792 <small>
22793 <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>
22794 </small>
22795 </td></tr>
22796 </tbody></table>
22797 !! end
22798
22799 !! test
22800 2. Bad treebuilder fixup of formatting elt is cleaned up
22801 !! options
22802 parsoid=wt2html,wt2wt
22803 !! wikitext
22804 '''foo[[File:Foobar.jpg|thumb|caption]]bar'''
22805
22806 <small>[[Image:Foobar.jpg|right|300px]]</small>
22807 !! html/parsoid
22808
22809 <p><b>foo</b></p>
22810 <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>
22811 <p><b>bar</b></p>
22812 <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>
22813 !! end
22814
22815 !! test
22816 3. Bad treebuilder fixup of formatting elt is cleaned up
22817 !! options
22818 parsoid=wt2html,wt2wt
22819 !! wikitext
22820 <small>'''foo[[File:Foobar.jpg|thumb|caption]]bar'''</small>
22821 !! html/parsoid
22822 <p><small><b>foo</b></small></p>
22823 <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>
22824 <p><small><b>bar</b></small></p>
22825 !! end
22826
22827 !! test
22828 4. Bad treebuilder fixup of formatting elt is cleaned up: formatting tags around captionless images are ignored
22829 !! options
22830 parsoid=wt2html,wt2wt
22831 !! wikitext
22832 '''<small>[[Image:Foobar.jpg|right|300px]]</small>'''
22833 !! html/parsoid
22834 <p><b><small></small></b></p>
22835 <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>
22836 <p></p>
22837 !! end
22838
22839 #### ----------------------------------------------------------------
22840 #### Parsoid-only testing of Parsoid's impl of LST
22841 #### Not implemented yet, see
22842 #### https://www.mediawiki.org/wiki/Parsoid/HTML_based_LST
22843 #### ----------------------------------------------------------------
22844
22845 ## We still need to support serializing the older format while content is stored.
22846 !! test
22847 LST Sections: Backwards compatibility
22848 !! options
22849 parsoid={
22850 "suppressErrors": true,
22851 "modes": ["html2wt"]
22852 }
22853 !! wikitext
22854 <section begin="2011-05-16" />
22855 <section end="2014-04-10 (MW 1.23wmf22)" />
22856 !! html/parsoid
22857 <p><meta typeof="mw:Extension/LabeledSectionTransclusion/begin" content="2011-05-16"/>
22858 <meta typeof="mw:Extension/LabeledSectionTransclusion/end" content="2014-04-10 (MW 1.23wmf22)"/></p>
22859 !! end
22860
22861 ## The unconventional output is the result of `usePHPPreProcessor` being
22862 ## disabled in parserTests.js. This test is mainly just to show <section> is
22863 ## recognized as an extension tag w/o a native handler.
22864 !! test
22865 LST Sections: Newfangled approach
22866 !! wikitext
22867 <section begin="2011-05-16" />
22868 <section end="2014-04-10 (MW 1.23wmf22)" />
22869 !! html/parsoid
22870 <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>
22871 <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>
22872 !! end
22873
22874 #--------- Test stripping of empty nodes in template content ----------
22875 !!test
22876 Empty LI and TR nodes should be stripped from template content
22877 !!wikitext
22878 {{EmptyLITest}}
22879 {{EmptyTRTest}}
22880 !!html/parsoid
22881 <ul about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyLITest","href":"./Template:EmptyLITest"},"params":{},"i":0}}]}'>
22882 <li>a</li>
22883 <li>b</li>
22884 </ul>
22885 <table about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRTest","href":"./Template:EmptyTRTest"},"params":{},"i":0}}]}'>
22886 <tbody>
22887 <tr>
22888 <td>foo</td>
22889 </tr>
22890 <tr>
22891 <td>bar</td>
22892 </tr>
22893 </tbody>
22894 </table>
22895 !!end
22896
22897 !!test
22898 Empty LI and TR nodes should not be stripped from top-level content
22899 !!wikitext
22900 * a
22901 *
22902 * b
22903 {|
22904 |-
22905 |-
22906 |foo
22907 |}
22908 !!html/parsoid
22909 <ul>
22910 <li> a</li>
22911 <li></li>
22912 <li> b</li>
22913 </ul>
22914 <table>
22915 <tbody>
22916 <tr></tr>
22917 <tr>
22918 <td>foo</td>
22919 </tr>
22920 </tbody>
22921 </table>
22922 !!end
22923
22924 !!test
22925 Empty TR nodes should not be stripped if they have any attributes set
22926 !!wikitext
22927 {{EmptyTRWithHTMLAttrTest}}
22928 !!html/parsoid
22929 <table about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRWithHTMLAttrTest","href":"./Template:EmptyTRWithHTMLAttrTest"},"params":{},"i":0}}]}'>
22930 <tr align="center"></tr>
22931 <tr><td>foo</td></tr>
22932 <tr align="center"></tr>
22933 <tr><td>bar</td></tr>
22934 </table>
22935 !!end
22936
22937 #### ----------------------------------------------------------------
22938 #### The following section of tests are primarily to test
22939 #### wikitext escaping capabilities of Parsoid. Given that
22940 #### escaping can be done any number of ways, the wikitext (input)
22941 #### is always adjusted to reflect how Parsoid adds nowiki
22942 #### escape tags.
22943 ####
22944 #### We are marking several tests as parsoid-only since the
22945 #### HTML in the result section is different from what the
22946 #### PHP parser generates for it.
22947 #### ----------------------------------------------------------------
22948
22949
22950 #### --------------- Headings ---------------
22951 #### 0. Unnested
22952 #### 1. Nested inside html <h1>=foo=</h1>
22953 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
22954 #### 3. Nested inside html with wikitext split by html tags
22955 #### 4. No escape needed
22956 #### 5. Empty headings <h1></h1>
22957 #### 6. Heading chars in SOL context
22958 #### ----------------------------------------
22959 !! test
22960 Headings: 0. Unnested
22961 !! options
22962 parsoid=html2wt
22963 !! html/parsoid
22964 <p>=foo=</p>
22965
22966 <p> =foo=
22967 <!--cmt-->
22968 =foo=</p>
22969
22970 <p>=foo<i>a</i>=</p>
22971 !! wikitext
22972 <nowiki>=foo=</nowiki>
22973
22974 <nowiki> </nowiki>=foo=
22975 <!--cmt-->
22976 <nowiki>=foo=</nowiki>
22977
22978 =foo''a''<nowiki>=</nowiki>
22979 !!end
22980
22981 # New headings and existing headings are handled differently
22982 !! test
22983 Headings: 1. Nested inside html
22984 !! options
22985 parsoid=html2wt
22986 !! html/parsoid
22987 <h1>=foo=</h1>
22988 <h2>=foo=</h2>
22989 <h3>=foo=</h3>
22990
22991 <h1 data-parsoid=''>=foo=</h1>
22992 <h2 data-parsoid=''>=foo=</h2>
22993 <h3 data-parsoid=''>=foo=</h3>
22994 <h4 data-parsoid=''>=foo=</h4>
22995 <h5 data-parsoid=''>=foo=</h5>
22996 <h6 data-parsoid=''>=foo=</h6>
22997 !! wikitext
22998 = =foo= =
22999
23000 == =foo= ==
23001
23002 === =foo= ===
23003
23004 =<nowiki>=foo=</nowiki>=
23005 ==<nowiki>=foo=</nowiki>==
23006 ===<nowiki>=foo=</nowiki>===
23007 ====<nowiki>=foo=</nowiki>====
23008 =====<nowiki>=foo=</nowiki>=====
23009 ======<nowiki>=foo=</nowiki>======
23010
23011 !!end
23012
23013 !! test
23014 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
23015 !! options
23016 parsoid=html2wt
23017 !! html/parsoid
23018 <h1>foo</h1>*bar
23019 <h1>foo</h1>=bar
23020 <h1>foo</h1>=bar=
23021 !! wikitext
23022 = foo =
23023 <nowiki>*</nowiki>bar
23024
23025 = foo =
23026 =bar
23027
23028 = foo =
23029 <nowiki>=bar=</nowiki>
23030 !!end
23031
23032 !! test
23033 Headings: 3. Nested inside html with wikitext split by html tags
23034 !! options
23035 parsoid=html2wt
23036 !! html/parsoid
23037 <h1>=<b>bold</b>foo=</h1>
23038 !! wikitext
23039 = ='''bold'''foo= =
23040 !!end
23041
23042 !! test
23043 Headings: 4a. No escaping needed (testing just h1 and h2)
23044 !! options
23045 parsoid=html2wt
23046 !! html/parsoid
23047 <h1>=foo</h1>
23048 <h1>foo=</h1>
23049 <h1> =foo= </h1>
23050 <h1>=foo= bar</h1>
23051 <h2>=foo</h2>
23052 <h2>foo=</h2>
23053 <h1>=</h1>
23054 <h1><i>=</i>foo=</h1>
23055 !! wikitext
23056 = =foo =
23057
23058 = foo= =
23059
23060 = =foo= =
23061
23062 = =foo= bar =
23063
23064 == =foo ==
23065
23066 == foo= ==
23067
23068 = = =
23069
23070 = ''=''foo= =
23071 !!end
23072
23073 !! test
23074 Headings: 4b. No escaping needed (inside p-tags)
23075 !! options
23076 parsoid=html2wt
23077 !! html/parsoid
23078 <p>===
23079 =foo= x
23080 =foo= <s></s>
23081 </p>
23082 !! wikitext
23083 ===
23084 =foo= x
23085 =foo= <s></s>
23086 !!end
23087
23088 !! test
23089 Headings: 5. Empty headings
23090 !! options
23091 parsoid=html2wt
23092 !! html/parsoid
23093 <h1 data-parsoid='{}'></h1>
23094
23095 <h2 data-parsoid='{}'></h2>
23096
23097 <h3 data-parsoid='{}'></h3>
23098
23099 <h4 data-parsoid='{}'></h4>
23100
23101 <h5 data-parsoid='{}'></h5>
23102
23103 <h6 data-parsoid='{}'></h6>
23104 !! wikitext
23105 =<nowiki/>=
23106
23107 ==<nowiki/>==
23108
23109 ===<nowiki/>===
23110
23111 ====<nowiki/>====
23112
23113 =====<nowiki/>=====
23114
23115 ======<nowiki/>======
23116 !!end
23117
23118 !! test
23119 Headings: 6a. Heading chars in SOL context (with trailing spaces)
23120 !! options
23121 parsoid=html2wt
23122 !! html/parsoid
23123 <p>=a=</p>
23124
23125 <p>=a=</p>
23126
23127 <p>=a=</p>
23128 !! wikitext
23129 <nowiki>=a=</nowiki>
23130
23131 <nowiki>=a=</nowiki>
23132
23133 <nowiki>=a=</nowiki>
23134 !!end
23135
23136 !! test
23137 Headings: 6b. Heading chars in SOL context (with trailing newlines)
23138 !! options
23139 parsoid=html2wt
23140 !! html/parsoid
23141 <p>=a=
23142 b</p>
23143
23144 <p>=a=
23145 b</p>
23146
23147 <p>=a=
23148 b</p>
23149 !! wikitext
23150 <nowiki>=a=</nowiki>
23151 b
23152
23153 <nowiki>=a=</nowiki>
23154 b
23155
23156 <nowiki>=a=</nowiki>
23157 b
23158 !!end
23159
23160 !! test
23161 Headings: 6c. Heading chars in SOL context (leading newline break)
23162 !! options
23163 parsoid=html2wt
23164 !! html/parsoid
23165 <p>a
23166 =b=</p>
23167 !! wikitext
23168 a
23169 <nowiki>=b=</nowiki>
23170 !!end
23171
23172 !! test
23173 Headings: 6d. Heading chars in SOL context (with interspersed comments)
23174 !! options
23175 parsoid=html2wt
23176 !! html/parsoid
23177 <!--c0--><p>=a=</p>
23178
23179 <!--c1--><p>=a=</p> <!--c2--> <!--c3-->
23180 !! wikitext
23181 <!--c0--><nowiki>=a=</nowiki>
23182
23183 <!--c1--><nowiki>=a=</nowiki> <!--c2--> <!--c3-->
23184 !!end
23185
23186 !! test
23187 Headings: 6d. Heading chars in SOL context (No escaping needed)
23188 !! options
23189 parsoid=html2wt
23190 !! html/parsoid
23191 =a=<div>b</div>
23192 !! wikitext
23193 =a=<div>b</div>
23194 !!end
23195
23196 !! test
23197 Headings: 7. Insert a newline between new content and headings
23198 !! options
23199 parsoid=html2wt
23200 !! html/parsoid
23201 <h2>NEW</h2>
23202 <p>new</p>
23203 <h2 data-parsoid='{}'>A</h2>
23204 <p data-parsoid='{}'>a</p>
23205 !! wikitext
23206 == NEW ==
23207 new
23208
23209 ==A==
23210 a
23211
23212 !! end
23213
23214 #### --------------- Lists ---------------
23215 #### 0. Outside nests (*foo, etc.)
23216 #### 1. Nested inside html <ul><li>*foo</li></ul>
23217 #### 2. Inside definition lists
23218 #### 3. Only bullets at start should be escaped
23219 #### 4. No escapes needed
23220 #### 5. No unnecessary escapes
23221 #### 6. Escape bullets in SOL position
23222 #### 7. Escape bullets in a multi-line context
23223 #### ----------------------------------------
23224
23225 !! test
23226 Lists: 0. Outside nests
23227 !! options
23228 parsoid=html2wt
23229 !! html/parsoid
23230 <p>*foo</p>
23231
23232 <p>#foo</p>
23233
23234 <p>;Foo:bar</p>
23235 !! wikitext
23236 <nowiki>*</nowiki>foo
23237
23238 <nowiki>#</nowiki>foo
23239
23240 <nowiki>;</nowiki>Foo<nowiki>:</nowiki>bar
23241 !!end
23242
23243 ## Making these next 3 tests Parsoid-only since they are html2wt tests
23244 ## to test wikitext escaping, and insignificant whitespace diffs
23245 ## cause PHP parser tests to barf
23246 !! test
23247 Lists: 1. Nested inside html (No unnecessary escapes)
23248 !! options
23249 parsoid=html2wt
23250 !! html/parsoid
23251 <ul>
23252 <li>*foo</li>
23253 <li>#foo</li>
23254 <li>:foo</li>
23255 <li>;foo</li>
23256 <li data-parsoid='{}'>*foo</li>
23257 <li data-parsoid='{}'>#foo</li>
23258 <li data-parsoid='{}'>:foo</li>
23259 <li data-parsoid='{}'>;foo</li>
23260 </ul>
23261
23262 <ol>
23263 <li>*foo</li>
23264 <li>#foo</li>
23265 <li>:foo</li>
23266 <li>;foo</li>
23267 <li data-parsoid='{}'>*foo</li>
23268 <li data-parsoid='{}'>#foo</li>
23269 <li data-parsoid='{}'>:foo</li>
23270 <li data-parsoid='{}'>;foo</li>
23271 </ol>
23272 !! wikitext
23273 * *foo
23274 * #foo
23275 * :foo
23276 * ;foo
23277 *<nowiki>*foo</nowiki>
23278 *<nowiki>#foo</nowiki>
23279 *<nowiki>:foo</nowiki>
23280 *<nowiki>;foo</nowiki>
23281
23282 # *foo
23283 # #foo
23284 # :foo
23285 # ;foo
23286 #<nowiki>*foo</nowiki>
23287 #<nowiki>#foo</nowiki>
23288 #<nowiki>:foo</nowiki>
23289 #<nowiki>;foo</nowiki>
23290 !!end
23291
23292 !! test
23293 Lists: 2. Inside definition lists
23294 !! options
23295 parsoid=html2wt
23296 !! html/parsoid
23297 <dl><dt>;foo</dt></dl>
23298 <dl><dt>:foo</dt></dl>
23299 <dl><dt>:foo</dt>
23300 <dd>bar</dd></dl>
23301 <dl><dd>:foo</dd></dl>
23302 !! wikitext
23303 ; ;foo
23304
23305 ; <nowiki>:foo</nowiki>
23306
23307 ; <nowiki>:foo</nowiki>
23308 : bar
23309
23310 : :foo
23311 !!end
23312
23313 !! test
23314 Lists: 3. Only bullets at start of text in wikitext-generated HTML should be escaped
23315 !! options
23316 parsoid=html2wt
23317 !! html/parsoid
23318 <ul>
23319 <li>*foo*bar</li>
23320 <li data-parsoid='{}'>*foo<i>it</i>*bar</li>
23321 </ul>
23322 !! wikitext
23323 * *foo*bar
23324 *<nowiki>*foo</nowiki>''it''*bar
23325 !!end
23326
23327 !! test
23328 Lists: 4. No escapes needed
23329 !! options
23330 parsoid=html2wt
23331 !! html/parsoid
23332 <ul>
23333 <li>foo*bar
23334 </li>
23335 </ul>
23336 <ul>
23337 <li><i>foo</i>*bar
23338 </li>
23339 </ul>
23340 <ul>
23341 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>: bar
23342 </li>
23343 </ul>
23344 <ul>
23345 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>*bar
23346 </li>
23347 </ul>
23348 !! wikitext
23349 *foo*bar
23350
23351 *''foo''*bar
23352
23353 *[[Foo]]: bar
23354
23355 *[[Foo]]*bar
23356 !!end
23357
23358 !! test
23359 Lists: 5. No unnecessary escapes
23360 !! options
23361 parsoid=html2wt
23362 !! html/parsoid
23363 <ul><li> bar <span>[[foo]]</span></li></ul>
23364 <ul><li> =bar <span>[[foo]]</span></li></ul>
23365 <ul><li> [[bar <span>[[foo]]</span></li></ul>
23366 <ul><li> ]]bar <span>[[foo]]</span></li></ul>
23367 <ul><li> =bar <span>foo]]</span>=</li></ul>
23368 <ul><li> <s></s>: a</li></ul>
23369 <ul><li> <i>* foo</i></li></ul>
23370
23371 !! wikitext
23372 * bar <span><nowiki>[[foo]]</nowiki></span>
23373
23374 * =bar <span><nowiki>[[foo]]</nowiki></span>
23375
23376 * [[bar <span><nowiki>[[foo]]</nowiki></span>
23377
23378 * ]]bar <span><nowiki>[[foo]]</nowiki></span>
23379
23380 * =bar <span>foo]]</span>=
23381
23382 * <s></s>: a
23383
23384 * ''* foo''
23385 !!end
23386
23387 !! test
23388 Lists: 6. Escape bullets in SOL position
23389 !! options
23390 parsoid=html2wt
23391 !! html/parsoid
23392 <p><!--cmt-->*foo</p>
23393 !! wikitext
23394 <!--cmt--><nowiki>*</nowiki>foo
23395 !!end
23396
23397 !! test
23398 Lists: 7. Escape bullets in a multi-line context
23399 !! options
23400 parsoid=html2wt
23401 !! html/parsoid
23402 <p>a
23403 *b
23404 </p>
23405 !! wikitext
23406 a
23407 <nowiki>*</nowiki>b
23408 !!end
23409
23410 !! test
23411 Lists: 8. Escape colons only if not present in tags
23412 !! options
23413 parsoid=html2wt
23414 !! html/parsoid
23415 <dl><dt>a:b<i>c:d</i></dt></dl>
23416 !! wikitext
23417 ; <nowiki>a:b</nowiki>''c:d''
23418 !! end
23419
23420 #### --------------- HRs ---------------
23421 #### 1. Single line
23422 #### -----------------------------------
23423
23424 !! test
23425 HRs: 1. Single line
23426 !! options
23427 parsoid=html2wt
23428 !! html/parsoid
23429 <hr />----
23430 <hr />=foo=
23431 <hr />*foo
23432 !! wikitext
23433 ----<nowiki>----</nowiki>
23434 ----=foo=
23435 ----*foo
23436 !! end
23437
23438 #### --------------- Tables ---------------
23439 #### 1a. Simple example
23440 #### 1b. No escaping needed (!foo)
23441 #### 1c. No escaping needed (|foo)
23442 #### 1d. No escaping needed (|}foo)
23443 ####
23444 #### 2a. Nested in td (<td>foo|bar</td>)
23445 #### 2b. Nested in td (<td>foo||bar</td>)
23446 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
23447 ####
23448 #### 3a. Nested in th (<th>foo!bar</th>)
23449 #### 3b. Nested in th (<th>foo!!bar</th>)
23450 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
23451 ####
23452 #### 4a. Escape -
23453 #### 4b. Escape +
23454 #### 4c. No escaping needed
23455 #### --------------------------------------
23456
23457 !! test
23458 Tables: 1a. Simple example
23459 !! options
23460 parsoid=html2wt
23461 !! html/parsoid
23462 <p>{|
23463 |}
23464 </p>
23465 !! wikitext
23466 <nowiki>{|</nowiki>
23467 |}
23468 !! end
23469
23470 !! test
23471 Tables: 1b. No escaping needed
23472 !! options
23473 parsoid=html2wt
23474 !! html/parsoid
23475 <p>!foo
23476 </p>
23477 !! wikitext
23478 !foo
23479 !! end
23480
23481 !! test
23482 Tables: 1c. No escaping needed
23483 !! options
23484 parsoid=html2wt
23485 !! html/parsoid
23486 <p>|foo
23487 </p>
23488 !! wikitext
23489 |foo
23490 !! end
23491
23492 !! test
23493 Tables: 1d. No escaping needed
23494 !! options
23495 parsoid=html2wt
23496 !! html/parsoid
23497 <p>|}foo
23498 </p>
23499 !! wikitext
23500 |}foo
23501 !! end
23502
23503 !! test
23504 Tables: 2a. Nested in td
23505 !! options
23506 parsoid=html2wt
23507 !! html/parsoid
23508 <table><tbody><tr>
23509 <td>foo|bar</td></tr>
23510 <tr><td>x<div>a|b</div></td>
23511 </tbody></table>
23512 !! wikitext
23513 {|
23514 |<nowiki>foo|bar</nowiki>
23515 |-
23516 |x<div><nowiki>a|b</nowiki></div>
23517 |}
23518 !! html/php+tidy
23519 <table>
23520 <tr>
23521 <td>foo|bar</td>
23522 </tr>
23523 <tr>
23524 <td>x
23525 <div>a|b</div>
23526 </td>
23527 </tr>
23528 </table>
23529 !! end
23530
23531 !! test
23532 Tables: 2b. Nested in td
23533 !! options
23534 parsoid=html2wt
23535 !! html/parsoid
23536 <table><tbody><tr>
23537 <td>foo||bar</td>
23538 <td>a<i>b||c</i></td>
23539 <td>a<i><div>b||c</div></i></td>
23540 </tr></tbody></table>
23541 !! wikitext
23542 {|
23543 |<nowiki>foo||bar</nowiki>
23544 |a''<nowiki>b||c</nowiki>''
23545 |a''<div><nowiki>b||c</nowiki></div>''
23546 |}
23547 !! html/php
23548 <table>
23549 <tr>
23550 <td>foo||bar
23551 </td>
23552 <td>a<i>b||c</i>
23553 </td>
23554 <td>a<i><div>b||c</div></i>
23555 </td></tr></table>
23556
23557 !! end
23558
23559 !! test
23560 Tables: 2c. Nested in td -- no escaping needed
23561 !! options
23562 parsoid=html2wt
23563 !! html/*
23564 <table>
23565 <tr>
23566 <td>foo!!bar
23567 </td></tr></table>
23568
23569 !! wikitext
23570 {|
23571 |foo!!bar
23572 |}
23573 !! end
23574
23575 !! test
23576 Tables: 3a. Nested in th
23577 !! options
23578 parsoid=html2wt
23579 !! html/*
23580 <table>
23581 <tr>
23582 <th>foo!bar
23583 </th></tr></table>
23584
23585 !! wikitext
23586 {|
23587 !foo!bar
23588 |}
23589 !! end
23590
23591 !! test
23592 Tables: 3b. Nested in th
23593 !! options
23594 parsoid=html2wt
23595 !! html/parsoid
23596 <table><tbody>
23597 <tr><th>foo!!bar</th>
23598 <th><i>foo|bar</i></th>
23599 <th><i>foo!!bar</i></th>
23600 <th><i><span>foo!!bar</span></i></th>
23601 </tr></tbody></table>
23602 !! wikitext
23603 {|
23604 !<nowiki>foo!!bar</nowiki>
23605 !''<nowiki>foo|bar</nowiki>''
23606 !''<nowiki>foo!!bar</nowiki>''
23607 !''<span><nowiki>foo!!bar</nowiki></span>''
23608 |}
23609 !! html/php
23610 <table>
23611 <tr>
23612 <th>foo!!bar
23613 </th>
23614 <th><i>foo|bar</i>
23615 </th>
23616 <th><i>foo!!bar</i>
23617 </th>
23618 <th><i><span>foo!!bar</span></i>
23619 </th></tr></table>
23620
23621 !! end
23622
23623 !! test
23624 Tables: 3c. Nested in th
23625 !! options
23626 parsoid=html2wt
23627 !! html/parsoid
23628 <table><tbody>
23629 <tr><th>foo||bar</th>
23630 <th><span typeof="mw:Nowiki">foo||bar</span></th>
23631 </tr></tbody></table>
23632 !! wikitext
23633 {|
23634 !<nowiki>foo||bar</nowiki>
23635 !<nowiki>foo||bar</nowiki>
23636 |}
23637 !! html/php
23638 <table>
23639 <tr>
23640 <th>foo||bar
23641 </th>
23642 <th>foo||bar
23643 </th></tr></table>
23644
23645 !! end
23646
23647 !! test
23648 Tables: 4a. Escape -
23649 !! options
23650 parsoid=html2wt
23651 !! html/*
23652 <table>
23653 <tr>
23654 <th>-bar
23655 </th></tr>
23656 <tr>
23657 <td>-bar
23658 </td></tr></table>
23659
23660 !! wikitext
23661 {|
23662 !-bar
23663 |-
23664 |<nowiki>-bar</nowiki>
23665 |}
23666 !! end
23667
23668 !! test
23669 Tables: 4b. Escape +
23670 !! options
23671 parsoid=html2wt
23672 !! html/*
23673 <table>
23674 <tr>
23675 <th>+bar
23676 </th></tr>
23677 <tr>
23678 <td>+bar
23679 </td></tr></table>
23680
23681 !! wikitext
23682 {|
23683 !+bar
23684 |-
23685 |<nowiki>+bar</nowiki>
23686 |}
23687 !! end
23688
23689 !! test
23690 Tables: 4c. No escaping needed
23691 !! options
23692 parsoid=html2wt
23693 !! html/parsoid
23694 <table><tbody>
23695 <tr><td>foo-bar</td><td>foo+bar</td></tr>
23696 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
23697 <tr><td>foo
23698 <p>bar|baz
23699 +bar
23700 -bar</p></td></tr>
23701 <tr><td>x
23702 <div>a|b</div></td>
23703 </tbody></table>
23704 !! wikitext
23705 {|
23706 |foo-bar
23707 |foo+bar
23708 |-
23709 |''foo''-bar
23710 |''foo''+bar
23711 |-
23712 |foo
23713 bar|baz
23714 +bar
23715 -bar
23716 |-
23717 |x
23718 <div>a|b</div>
23719 |}
23720 !! html/php
23721 <table>
23722 <tr>
23723 <td>foo-bar
23724 </td>
23725 <td>foo+bar
23726 </td></tr>
23727 <tr>
23728 <td><i>foo</i>-bar
23729 </td>
23730 <td><i>foo</i>+bar
23731 </td></tr>
23732 <tr>
23733 <td>foo
23734 <p>bar|baz
23735 +bar
23736 -bar
23737 </p>
23738 </td></tr>
23739 <tr>
23740 <td>x
23741 <div>a|b</div>
23742 </td></tr></table>
23743
23744 !! end
23745
23746 !! test
23747 Tables: 4d. No escaping needed
23748 !! options
23749 parsoid=html2wt
23750 !! html/parsoid
23751 <table>
23752 <tbody><tr><td><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>-bar</td>
23753 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>+1</td>
23754 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>-2</td></tr>
23755 </tbody></table>
23756 !! wikitext
23757 {|
23758 |[[Foo]]-bar
23759 ||+1
23760 ||-2
23761 |}
23762 !! html/php
23763 <table>
23764 <tr>
23765 <td><a href="/wiki/Foo" title="Foo">Foo</a>-bar
23766 </td>
23767 <td>+1
23768 </td>
23769 <td>-2
23770 </td></tr></table>
23771
23772 !! end
23773
23774 !! test
23775 T97430: Don't emit empty nowiki pairs around marker meta tags
23776 !! options
23777 parsoid=html2wt
23778 !! html/parsoid
23779 <p>*This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
23780 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.</p>
23781 !! wikitext
23782 <nowiki>*</nowiki>This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
23783 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.
23784 !! end
23785
23786 !! test
23787 Unclosed xmlish element in table line shouldn't eat end delimiters
23788 !! options
23789 parsoid=html2wt
23790 !! html/parsoid
23791 <table>
23792 <tbody><tr><td> &lt;foo</td>
23793 <td> bar></td></tr>
23794 </tbody></table>
23795 !! wikitext
23796 {|
23797 | <foo
23798 | bar>
23799 |}
23800 !! html/php
23801 <table>
23802 <tr>
23803 <td> &lt;foo
23804 </td>
23805 <td> bar&gt;
23806 </td></tr></table>
23807
23808 !! end
23809
23810 #### --------------- Links ----------------
23811 #### 1. Quote marks in link text
23812 #### 2. Wikilinks: Escapes needed
23813 #### 3. Wikilinks: No escapes needed
23814 #### 4. Extlinks: Escapes needed
23815 #### 5. Extlinks: No escapes needed
23816 #### --------------------------------------
23817 !! test
23818 Links 1. WikiLinks: No escapes needed
23819 !! options
23820 parsoid=html2wt
23821 !! html/parsoid
23822 <p><a rel="mw:WikiLink" href="Foo" title="Foo">Foo<i>boo</i></a>
23823 <a rel="mw:WikiLink" href="Foo" title="Foo">[Foobar]</a>
23824 <a rel="mw:WikiLink" href="Foo" title="Foo">x [Foobar] x</a></p>
23825 !! wikitext
23826 [[Foo|Foo''boo'']]
23827 [[Foo|[Foobar]]]
23828 [[Foo|x [Foobar] x]]
23829 !! html/php
23830 <p><a href="/wiki/Foo" title="Foo">Foo<i>boo</i></a>
23831 <a href="/wiki/Foo" title="Foo">[Foobar]</a>
23832 <a href="/wiki/Foo" title="Foo">x [Foobar] x</a>
23833 </p>
23834 !! end
23835
23836 !! test
23837 Links 2. WikiLinks: Escapes needed
23838 !! options
23839 parsoid=html2wt
23840 !! html/parsoid
23841 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
23842 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
23843 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
23844 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
23845 <a href="Foo" rel="mw:WikiLink">|Bar</a>
23846 <a href="Foo" rel="mw:WikiLink">]]bar</a>
23847 <a href="Foo" rel="mw:WikiLink">[[bar</a>
23848 <a href="Foo" rel="mw:WikiLink">x [[ y</a>
23849 <a href="Foo" rel="mw:WikiLink">x ]] y</a>
23850 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
23851 !! wikitext
23852 [[Foo|<nowiki>Foobar]</nowiki>]]
23853 [[Foo|x <nowiki>[http://google.com g]</nowiki> x]]
23854 [[Foo|<nowiki>[[Bar]]</nowiki>]]
23855 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
23856 [[Foo|<nowiki>|Bar</nowiki>]]
23857 [[Foo|<nowiki>]]bar</nowiki>]]
23858 [[Foo|<nowiki>[[bar</nowiki>]]
23859 [[Foo|<nowiki>x [[ y</nowiki>]]
23860 [[Foo|<nowiki>x ]] y</nowiki>]]
23861 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
23862 !! html/php
23863 <p><a href="/wiki/Foo" title="Foo">Foobar]</a>
23864 <a href="/wiki/Foo" title="Foo">x [http://google.com g] x</a>
23865 <a href="/wiki/Foo" title="Foo">[[Bar]]</a>
23866 <a href="/wiki/Foo" title="Foo">x [[Bar]] x</a>
23867 <a href="/wiki/Foo" title="Foo">|Bar</a>
23868 <a href="/wiki/Foo" title="Foo">]]bar</a>
23869 <a href="/wiki/Foo" title="Foo">[[bar</a>
23870 <a href="/wiki/Foo" title="Foo">x [[ y</a>
23871 <a href="/wiki/Foo" title="Foo">x ]] y</a>
23872 <a href="/wiki/Foo" title="Foo">x ]] y [[ z</a>
23873 </p>
23874 !! end
23875
23876 !! test
23877 Links 3. WikiLinks: No escapes needed
23878 !! options
23879 parsoid=html2wt
23880 !! html/parsoid
23881 <p><a rel="mw:WikiLink" href="Foo">[Foobar</a>
23882 <a rel="mw:WikiLink" href="Foo" title="Foo">foo|bar</a></p>
23883 !! wikitext
23884 [[Foo|[Foobar]]
23885 [[Foo|foo|bar]]
23886 !! html/php
23887 <p><a href="/wiki/Foo" title="Foo">[Foobar</a>
23888 <a href="/wiki/Foo" title="Foo">foo|bar</a>
23889 </p>
23890 !! end
23891
23892 !! test
23893 Links 4. ExtLinks: Escapes needed
23894 !! options
23895 parsoid=html2wt
23896 !! html/parsoid
23897 <p><a rel="mw:ExtLink" href="http://google.com">[google]</a>
23898 <a rel="mw:ExtLink" href="http://google.com">google]</a>
23899 <a rel="mw:ExtLink" href="http://google.com">goog] le</a></p>
23900 <p>[http://google.com]</p>
23901 <p>[http://google.com google]</p>
23902 <p>[<a rel="mw:ExtLink" href="http://google.com">http://google.com</a>]</p>
23903 <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>
23904 !! wikitext
23905 [http://google.com <nowiki>[google]</nowiki>]
23906 [http://google.com <nowiki>google]</nowiki>]
23907 [http://google.com <nowiki>goog] le</nowiki>]
23908
23909 <nowiki>[http://google.com]</nowiki>
23910
23911 <nowiki>[http://google.com google]</nowiki>
23912
23913 [http://google.com<nowiki>]</nowiki>
23914
23915 [{{echo|http://google.com}}<nowiki>]</nowiki>
23916 !! html/php
23917 <p><a rel="nofollow" class="external text" href="http://google.com">[google]</a>
23918 <a rel="nofollow" class="external text" href="http://google.com">google]</a>
23919 <a rel="nofollow" class="external text" href="http://google.com">goog] le</a>
23920 </p><p>[http://google.com]
23921 </p><p>[http://google.com google]
23922 </p><p>[<a rel="nofollow" class="external free" href="http://google.com">http://google.com</a>]
23923 </p><p>[<a rel="nofollow" class="external free" href="http://google.com">http://google.com</a>]
23924 </p>
23925 !! end
23926
23927 !! test
23928 Links 5. ExtLinks: No escapes needed
23929 !! options
23930 parsoid=html2wt
23931 !! html/parsoid
23932 <p><a rel="mw:ExtLink" href="http://google.com">[google</a></p>
23933 <p>[<a ref="mw:ExtLink" href="http://google.com"></a>]</p>
23934 !! wikitext
23935 [http://google.com [google]
23936
23937 [[http://google.com]]
23938 !! html/php
23939 <p><a rel="nofollow" class="external text" href="http://google.com">[google</a>
23940 </p><p>[<a rel="nofollow" class="external autonumber" href="http://google.com">[1]</a>]
23941 </p>
23942 !! end
23943
23944 !! test
23945 Links 6. Add <nowiki/>s between text-nodes and url-links when required (T66300)
23946 !! options
23947 parsoid=html2wt
23948 !! html/parsoid
23949 <p>x<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>y
23950 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>?x
23951 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>&amp;x
23952 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>'x
23953 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,x
23954 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.x
23955 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
23956 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>:x
23957 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
23958 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>!x
23959 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>=x
23960 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>(x)
23961 <a rel="mw:ExtLink" href="http://example.com(x" data-parsoid='{"stx":"url"}'>http://example.com(x</a>)
23962 </p>
23963 !! wikitext
23964 x<nowiki/>http://example.com<nowiki/>y
23965 http://example.com<nowiki/>?x
23966 http://example.com<nowiki/>&x
23967 http://example.com<nowiki/>'x
23968 http://example.com<nowiki/>,x
23969 http://example.com<nowiki/>.x
23970 http://example.com<nowiki/>;x
23971 http://example.com<nowiki/>:x
23972 http://example.com<nowiki/>;x
23973 http://example.com<nowiki/>!x
23974 http://example.com<nowiki/>=x
23975 http://example.com<nowiki/>(x)
23976 http://example.com(x<nowiki/>)
23977 !! end
23978
23979 !! test
23980 Links 7a. Don't add spurious <nowiki/>s between text-nodes and url-links (T66300)
23981 !! options
23982 parsoid=html2wt
23983 !! html/parsoid
23984 <p>x
23985 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>
23986 y
23987 "<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>"
23988 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>)
23989 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>) foo
23990 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,
23991 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>, foo
23992 </p>
23993 !! wikitext
23994 x
23995 http://example.com
23996 y
23997 "http://example.com"
23998 (http://example.com)
23999 (http://example.com) foo
24000 http://example.com,
24001 http://example.com, foo
24002 !! html/php
24003 <p>x
24004 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
24005 y
24006 "<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>"
24007 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
24008 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>) foo
24009 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
24010 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>, foo
24011 </p>
24012 !! end
24013
24014 !! test
24015 Links 7b. Don't add spurious <nowiki/>s between text-nodes and url-links (T66300)
24016 !! options
24017 parsoid=html2wt
24018 !! html/parsoid
24019 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.,;:!?\
24020 -<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:</p>
24021 !! wikitext
24022 http://example.com.,;:!?\
24023 -http://example.com:
24024 !! html/php
24025 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.,;:!?\
24026 -<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
24027 </p>
24028 !! end
24029
24030 !! test
24031 Links 8. Add <nowiki/>s between text-nodes and RFC-links when required (T66300)
24032 !! options
24033 parsoid=html2wt
24034 !! html/parsoid
24035 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>4
24036 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
24037 X<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y</p>
24038 !! wikitext
24039 RFC 123<nowiki/>4
24040 RFC 123<nowiki/>y
24041 X<nowiki/>RFC 123<nowiki/>y
24042 !! end
24043
24044 !! test
24045 Links 9. Don't add spurious <nowiki/>s between text-nodes and RFC-links (T66300)
24046 !! options
24047 parsoid=html2wt
24048 !! html/parsoid
24049 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>?foo
24050 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>&amp;foo
24051 -<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>-
24052 </p>
24053 !! wikitext
24054 RFC 123?foo
24055 RFC 123&foo
24056 -RFC 123-
24057 !! html/php
24058 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>?foo
24059 <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>&amp;foo
24060 -<a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>-
24061 </p>
24062 !! end
24063
24064 !! test
24065 Links 10. Add <nowiki/>s between text-nodes and PMID-links when required (T66300)
24066 !! options
24067 parsoid=html2wt
24068 !! html/parsoid
24069 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>4
24070 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
24071 X<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
24072 !! wikitext
24073 PMID 123<nowiki/>4
24074 PMID 123<nowiki/>y
24075 X<nowiki/>PMID 123<nowiki/>y
24076 !! end
24077
24078 !! test
24079 Links 11. Don't add spurious <nowiki/>s between text-nodes and PMID-links (T66300)
24080 !! options
24081 parsoid=html2wt
24082 !! html/parsoid
24083 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>?foo
24084 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>&foo
24085 -<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>-
24086 </p>
24087 !! wikitext
24088 PMID 123?foo
24089 PMID 123&foo
24090 -PMID 123-
24091 !! html/php
24092 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>?foo
24093 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>&amp;foo
24094 -<a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>-
24095 </p>
24096 !! end
24097
24098 !! test
24099 Links 12. Add <nowiki/>s between text-nodes and ISBN-links when required (T66300)
24100 !! options
24101 parsoid=html2wt
24102 !! html/parsoid
24103 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>1
24104 <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>x
24105 a<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>b
24106 </p>
24107 !! wikitext
24108 ISBN 1234567890<nowiki/>1
24109 ISBN 1234567890<nowiki/>x
24110 a<nowiki/>ISBN 1234567890<nowiki/>b
24111 !! end
24112
24113 !! test
24114 Links 13. Don't add spurious <nowiki/>s between text-nodes and ISBN-links (T66300)
24115 !! options
24116 parsoid=html2wt
24117 !! html/parsoid
24118 <p>-<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>'s
24119 !! wikitext
24120 -ISBN 1234567890's
24121 !! html/php
24122 <p>-<a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>'s
24123 </p>
24124 !! end
24125
24126 !! test
24127 Links 14. Protect link-like plain text. (Parsoid bug T78425)
24128 !! options
24129 parsoid=html2wt
24130 !! html/*
24131 <p>this is not a link: http://example.com
24132 </p>
24133 !! wikitext
24134 this is not a link: <nowiki>http://example.com</nowiki>
24135 !! end
24136
24137 !! test
24138 Links 15. Link trails can't become link prefixes.
24139 !! options
24140 language=is
24141 parsoid=html2wt
24142 !! html/parsoid
24143 <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>
24144 !! wikitext
24145 [[Söfnuður]]-[[00]]
24146 !! html/php
24147 <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>
24148 </p>
24149 !! end
24150
24151 #### --------------- Quotes ---------------
24152 #### 1. Quotes inside <b> and <i>
24153 #### 2. Link fragments separated by <i> and <b> tags
24154 #### 3. Link fragments inside <i> and <b>
24155 #### 4. No escaping needed
24156 #### --------------------------------------
24157 !! test
24158 1a. Quotes inside <b> and <i>
24159 !! options
24160 parsoid=html2wt
24161 !! html/*
24162 <p><i>'foo'</i>
24163 <i>''foo''</i>
24164 <i>'''foo'''</i>
24165 <i>foo</i>'s
24166 <b>'foo'</b>
24167 <b>''foo''</b>
24168 <b>'''foo'''</b>
24169 <b>foo'<i>bar'</i>baz</b>
24170 <b>foo</b>'s
24171 '<i>foo</i>
24172 <i>foo</i>'
24173 <i>foo'</i>'
24174 '<i>foo</i>'
24175 '<b>foo</b>
24176 <b>foo</b>'
24177 '<b>foo</b>'
24178 <i>fools'<span> errand</span></i>
24179 <i><span>fool</span>'s errand</i>
24180 '<i>foo</i> bar '<i>baz</i>
24181 a|!*#-:;+-~[]{}b'<i>x</i>
24182 </p>
24183 !! wikitext
24184 ''<nowiki/>'foo'''
24185 ''<nowiki>''foo''</nowiki>''
24186 ''<nowiki>'''foo'''</nowiki>''
24187 ''foo''<nowiki/>'s
24188 '''<nowiki/>'foo''''
24189 '''<nowiki>''foo''</nowiki>'''
24190 '''<nowiki>'''foo'''</nowiki>'''
24191 '''foo'<nowiki/>''bar'<nowiki/>''baz'''
24192 '''foo'''<nowiki/>'s
24193 '''foo''
24194 ''foo''<nowiki/>'
24195 ''foo'''<nowiki/>'
24196 '''foo''<nowiki/>'
24197 ''''foo'''
24198 '''foo'''<nowiki/>'
24199 ''''foo'''<nowiki/>'
24200 ''fools'<span> errand</span>''
24201 ''<span>fool</span>'s errand''
24202 '<nowiki/>''foo'' bar '''baz''
24203 a|!*#-:;+-~[]{}b'''x''
24204 !! end
24205
24206 !! test
24207 1b. Quotes inside <b> and <i> with other tags on same line
24208 !! options
24209 parsoid=html2wt
24210 !! html/parsoid
24211 '<i>a</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
24212 <i>a'</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
24213 <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>
24214 <a rel="mw:WikiLink" href="Foo" title="Foo">foo</a> x'<i><a href="Bar" rel="mw:WikiLink" title="Bar">bar</a></i>
24215 '<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>
24216 '<i>foo</i> <div title="name">test</div>
24217 '<i>foo</i> and <br data-parsoid='{"stx":"html","noClose":true}'/> bar
24218 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
24219 <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>
24220 </ol>
24221 !! wikitext
24222 '''a'' foo ''[[bar]]''
24223 ''a''' foo ''[[bar]]''
24224 ''a''' foo '''{{echo|[[bar]]}}'''
24225 [[foo]] x'''[[bar]]''
24226 '''foo'' <ref>test</ref>
24227 '''foo'' <div title="name">test</div>
24228 '''foo'' and <br> bar
24229 <references />
24230 !! end
24231
24232 !! test
24233 2. Link fragments separated by <i> and <b> tags
24234 !! options
24235 parsoid=html2wt
24236 !! html/parsoid
24237 <p>[[<i>foo</i>hello]]</p>
24238 <p>[[<b>foo</b>hello]]</p>
24239 !! wikitext
24240 [[''foo''<nowiki>hello]]</nowiki>
24241
24242 [['''foo'''<nowiki>hello]]</nowiki>
24243 !! end
24244
24245 # FIXME: Escaping one or both of [[ and ]] is also acceptable --
24246 # this is one of the shortcomings of this format
24247 !! test
24248 3. Link fragments inside <i> and <b>
24249 !! options
24250 parsoid=html2wt
24251 !! html/parsoid
24252 <p><i>[[foo</i>]]</p>
24253 <p><b>[[foo</b>]]</p>
24254 !! wikitext
24255 ''[[foo''<nowiki>]]</nowiki>
24256
24257 '''[[foo'''<nowiki>]]</nowiki>
24258 !! end
24259
24260 !! test
24261 4. No escaping needed
24262 !! options
24263 parsoid=html2wt
24264 !! html/parsoid
24265 <p>'<span><i>bar</i></span>'
24266 '<span><b>bar</b></span>'
24267 'a:b'foo
24268 </p>
24269 !! wikitext
24270 '<span>''bar''</span>'
24271 '<span>'''bar'''</span>'
24272 'a:b'foo
24273 !! end
24274
24275 #### ----------- Paragraphs ---------------
24276 #### 1. No unnecessary escapes
24277 #### --------------------------------------
24278
24279 !! test
24280 1. No unnecessary escapes
24281 !! options
24282 parsoid=html2wt
24283 !! html/parsoid
24284 <p>bar <span>[[foo]]</span>
24285 </p><p>=bar <span>[[foo]]</span>
24286 </p><p>[[bar <span>[[foo]]</span>
24287 </p><p>]]bar <span>[[foo]]</span>
24288 </p><p>=bar <span>foo]]</span>=
24289 </p>
24290 !! wikitext
24291 bar <span><nowiki>[[foo]]</nowiki></span>
24292
24293 =bar <span><nowiki>[[foo]]</nowiki></span>
24294
24295 [[bar <span><nowiki>[[foo]]</nowiki></span>
24296
24297 ]]bar <span><nowiki>[[foo]]</nowiki></span>
24298
24299 =bar <span>foo]]</span><nowiki>=</nowiki>
24300 !!end
24301
24302 #### ----------------------- PRE --------------------------
24303 #### 1. Leading whitespace in SOL context should be escaped
24304 #### ------------------------------------------------------
24305 !! test
24306 1. Leading whitespace in SOL context should be escaped
24307 !! options
24308 parsoid=html2wt
24309 !! html/parsoid
24310 <p> a</p>
24311
24312 <p> a</p>
24313
24314 <p> a(tab)</p>
24315
24316 <p> a
24317 <!--cmt-->
24318 a</p>
24319
24320 <p>a
24321 b</p>
24322
24323 <p>a
24324 b</p>
24325
24326 <p>a
24327 b</p>
24328 !! wikitext
24329 <nowiki> </nowiki>a
24330
24331 <nowiki> </nowiki> a
24332
24333 a(tab)
24334
24335 <nowiki> </nowiki> a
24336 <!--cmt-->
24337 <nowiki> </nowiki>a
24338
24339 a
24340 <nowiki> </nowiki>b
24341
24342 a
24343 b
24344
24345 a
24346 b
24347 !! html/php
24348 <p> a
24349 </p><p> a
24350 </p><p> a(tab)
24351 </p><p> a
24352 a
24353 </p><p>a
24354 b
24355 </p><p>a
24356 b
24357 </p><p>a
24358 b
24359 </p>
24360 !! end
24361
24362 !! test
24363 2. Leading whitespace in non-indent-pre contexts should not be escaped
24364 !! options
24365 parsoid=html2wt
24366 !! html/parsoid
24367 <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>
24368 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
24369 <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>
24370 b</span></li>
24371 </ol>
24372 !! wikitext
24373 foo <ref>''a''
24374 b</ref>
24375 <references />
24376 !! end
24377
24378 !! test
24379 3. Leading whitespace in indent-pre suppressing contexts should not be escaped
24380 !! options
24381 parsoid=html2wt
24382 !! html/parsoid
24383 <blockquote>
24384 <p>
24385 a
24386 <span>b</span>
24387 c</p>
24388 </blockquote>
24389 !! wikitext
24390 <blockquote>
24391 a
24392 <span>b</span>
24393 c
24394 </blockquote>
24395 !! end
24396
24397 !! test
24398 4. Leading whitespace in indent-pre suppressing contexts should not be escaped
24399 !! options
24400 parsoid=html2wt
24401 !! html/parsoid
24402 <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>
24403 !! wikitext
24404 [[File:Foobar.jpg|thumb|caption]]
24405 !! end
24406
24407 !! test
24408 5. Nowiki escaping should account for indent-pres
24409 !! options
24410 parsoid=html2wt
24411 !! html/parsoid
24412 <pre>==foo==</pre>
24413 !! wikitext
24414 ==foo==
24415 !! end
24416
24417 !!test
24418 T95794: nowiki escaping should account for leading space at start-of-line in an indent-pre block
24419 !! options
24420 parsoid=html2wt
24421 !! html/parsoid
24422 <pre>
24423 * foo
24424 * bar
24425 </pre>
24426 !! wikitext
24427 * foo
24428 * bar
24429 !! end
24430
24431 #### --------------- Behavior Switches --------------------
24432
24433 !! test
24434 1. Valid behavior switches should be escaped
24435 !! options
24436 parsoid=html2wt
24437 !! html/parsoid
24438 __TOC__
24439 <i>__TOC__</i>
24440 !! wikitext
24441 <nowiki>__TOC__</nowiki>
24442 ''<nowiki>__TOC__</nowiki>''
24443 !! end
24444
24445 !! test
24446 2. Invalid behavior switches should not be escaped
24447 !! options
24448 parsoid=html2wt
24449 !! html/parsoid
24450 __TOO__
24451 __|__
24452 !! wikitext
24453 __TOO__
24454 __|__
24455 !! end
24456
24457 # We use indent-pre as an indirect way to test for sol-transparent behavior.
24458 !! test
24459 Behavior switches should be SOL-transparent
24460 !! options
24461 parsoid=html2wt
24462 !! html/parsoid
24463 <meta property="mw:PageProp/toc" />
24464
24465 <!-- this one's bogus -->
24466 <pre>__TOO__</pre>
24467
24468 <pre data-parsoid='{}'><meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/> foo</pre>
24469
24470 <meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/><pre data-parsoid='{}'>bar</pre>
24471 !! wikitext
24472 __TOC__
24473
24474 <!-- this one's bogus -->
24475 __TOO__
24476
24477 __TOC__ foo
24478
24479 __TOC__
24480 bar
24481 !! end
24482
24483 #### --------------- HTML tags ---------------
24484 #### 1. a tags
24485 #### 2. other tags
24486 #### 3. multi-line html tag
24487 #### 4. extension tags
24488 #### -----------------------------------------
24489 !! test
24490 1. a tags
24491 !! options
24492 parsoid=html2wt
24493 !! html/parsoid
24494 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
24495 !! wikitext
24496 <a href="http://google.com">google</a>
24497 !! end
24498
24499 !! test
24500 2. other tags
24501 !! options
24502 parsoid=html2wt
24503 !! html/parsoid
24504 <ul><li> &lt;div&gt;foo&lt;/div&gt;</li>
24505 <li> &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;</li>
24506 <li> &lt;td&gt;</li></ul>
24507
24508 !! wikitext
24509 * <nowiki><div>foo</div></nowiki>
24510 * <nowiki><div style="color:red">foo</div></nowiki>
24511 * <nowiki><td></nowiki>
24512 !! end
24513
24514 !! test
24515 3. multi-line html tag
24516 !! options
24517 parsoid=html2wt
24518 !! html/parsoid
24519 <p>&lt;div
24520 &gt;foo&lt;/div
24521 &gt;
24522 </p>
24523 !! wikitext
24524 <nowiki><div
24525 >foo</div
24526 ></nowiki>
24527 !! end
24528
24529 !! test
24530 4. extension tags
24531 !! options
24532 parsoid=html2wt
24533 !! html/parsoid
24534 <p>&lt;ref&gt;foo&lt;/ref&gt;
24535 </p><p>&lt;ref&gt;bar
24536 </p><p>baz&lt;/ref&gt;
24537 </p>
24538 !! wikitext
24539 <nowiki><ref>foo</ref></nowiki>
24540
24541 <nowiki><ref>bar</nowiki>
24542
24543 baz<nowiki></ref></nowiki>
24544 !! end
24545
24546 #### --------------- Others ---------------
24547 !! test
24548 Escaping nowikis
24549 !! options
24550 parsoid=html2wt
24551 !! html/parsoid
24552 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
24553 </p>
24554 !! wikitext
24555 &lt;nowiki&gt;foo&lt;/nowiki&gt;
24556 !! end
24557
24558 ## The quote-char in the input is necessary for triggering the bug
24559 !! test
24560 (T54035) Nowiki-escaping should not get tripped by " :" in text
24561 !! options
24562 parsoid=html2wt
24563 !! html/parsoid
24564 <p>foo's bar :</p>
24565 !! wikitext
24566 foo's bar :
24567 !! end
24568
24569 #----------- End of wikitext escaping tests --------------
24570
24571 !! test
24572
24573 Tag-like HTML structures are passed through as text
24574 !! wikitext
24575 <x y>
24576
24577 <x.y>
24578
24579 <x-y>
24580
24581 1>2
24582
24583 x<y
24584
24585 a>b
24586
24587 1<d e>f
24588 !! html
24589 <p>&lt;x y&gt;
24590 </p><p>&lt;x.y&gt;
24591 </p><p>&lt;x-y&gt;
24592 </p><p>1&gt;2
24593 </p><p>x&lt;y
24594 </p><p>a&gt;b
24595 </p><p>1&lt;d e&gt;f
24596 </p>
24597 !! end
24598
24599 !! test
24600 HTML tag with necessary entities in attributes
24601 !! wikitext
24602 <span title="&amp;amp;">foo</span>
24603 !! html
24604 <p><span title="&amp;amp;">foo</span>
24605 </p>
24606 !! end
24607
24608 !! test
24609 HTML tag with 'unnecessary' entity encoding in attributes
24610 !! wikitext
24611 <span title="&amp;">foo</span>
24612 !! html
24613 <p><span title="&amp;">foo</span>
24614 </p>
24615 !! end
24616
24617 !! test
24618 HTML tag with broken attribute value quoting
24619 !! options
24620 parsoid=wt2html,html2html
24621 !! wikitext
24622 <span title="Hello world>Foo</span>
24623 !! html/php
24624 <p><span title="Hello world">Foo</span>
24625 </p>
24626 !! html/parsoid
24627 <p><span title="Hello world">Foo</span></p>
24628 !! end
24629
24630 !! test
24631 Self-closed tag with broken attribute value quoting
24632 !! options
24633 parsoid=wt2html,html2html
24634 !! wikitext
24635 <div title="Hello world />Foo
24636 !! html/php+tidy
24637 <div title="Hello world"></div>
24638 <p>Foo</p>
24639 !! html/parsoid
24640 <div title="Hello world " data-parsoid='{"stx":"html","selfClose":true}'></div><p>Foo</p>
24641 !! end
24642
24643 !! test
24644 Table with broken attribute value quoting
24645 !! options
24646 parsoid=wt2html,html2html
24647 !! wikitext
24648 {|
24649 | title="Hello world|Foo
24650 |}
24651 !! html/php
24652 <table>
24653 <tr>
24654 <td title="Hello world">Foo
24655 </td></tr></table>
24656
24657 !! html/parsoid
24658 <table>
24659 <tr>
24660 <td title="Hello world">Foo
24661 </td></tr></table>
24662
24663 !! end
24664
24665 !! test
24666 Table with broken attribute value quoting on consecutive lines
24667 !! options
24668 parsoid=wt2html,html2html
24669 !! wikitext
24670 {|
24671 | title="Hello world|Foo
24672 | style="color:red|Bar
24673 |}
24674 !! html/php
24675 <table>
24676 <tr>
24677 <td title="Hello world">Foo
24678 </td>
24679 <td style="color:red">Bar
24680 </td></tr></table>
24681
24682 !! html/parsoid
24683 <table><tbody>
24684 <tr>
24685 <td title="Hello world">Foo
24686 </td><td style="color: red">Bar
24687 </td></tr></tbody></table>
24688
24689 !! end
24690
24691 !!test
24692 Accept empty td cell attribute
24693 !! wikitext
24694 {|
24695 | align="center" | foo || |
24696 |}
24697 !! html
24698 <table>
24699 <tr>
24700 <td align="center"> foo </td>
24701 <td>
24702 </td></tr></table>
24703
24704 !!end
24705
24706 !!test
24707 Non-empty attributes in th-cells
24708 !! wikitext
24709 {|
24710 ! Foo !! style="color: red" | Bar
24711 |}
24712 !! html
24713 <table>
24714 <tr>
24715 <th> Foo </th>
24716 <th style="color: red"> Bar
24717 </th></tr></table>
24718
24719 !!end
24720
24721 !!test
24722 Accept empty attributes in th-cells
24723 !! wikitext
24724 {|
24725 !| foo !!| bar
24726 |}
24727 !! html
24728 <table>
24729 <tr>
24730 <th> foo </th>
24731 <th> bar
24732 </th></tr></table>
24733
24734 !!end
24735
24736 !!test
24737 Empty table rows go away
24738 !! wikitext
24739 {|
24740 | Hello
24741 | there
24742 |- class="foo"
24743 |-
24744 |}
24745 !! html
24746 <table>
24747 <tr>
24748 <td> Hello
24749 </td>
24750 <td> there
24751 </td></tr>
24752
24753 </table>
24754
24755 !! end
24756
24757 ###
24758 ### Parsoid-centric tests for testing RTing of inter-element separators
24759 ### Edge cases not tested by existing parser tests and specific to
24760 ### Parsoid-specific serialization strategies.
24761 ###
24762
24763 !!test
24764 RT-ed inter-element separators should be valid separators
24765 !! wikitext
24766 {|
24767 |- [[foo]]
24768 |}
24769 !! html/php
24770 <table>
24771
24772 </table>
24773
24774 !! html/parsoid
24775 <table>
24776 <tbody><tr data-parsoid='{"startTagSrc":"|-","a":{"[[foo]]":null},"sa":{"[[foo]]":""},"autoInsertedEnd":true}'></tr>
24777 </tbody></table>
24778 !!end
24779
24780 # Parsoid-only since PHP parser relies on Tidy for correct output
24781 !!test
24782 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
24783 !!options
24784 parsoid
24785 !! wikitext
24786 {|
24787 |<small>foo
24788 bar
24789 |}
24790
24791 {|
24792 |<small>foo<small>
24793 |}
24794 !! html
24795 <table>
24796 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'>foo
24797 <p>bar</p></small></td></tr>
24798 </tbody></table>
24799
24800 <table>
24801 <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>
24802 </tbody></table>
24803 !!end
24804
24805 # Note that the "style" attribute is really a template parameter here.
24806 # The = would have to be {{=}} if you wanted the literal.
24807 !!test
24808 Empty TD followed by TD with tpl-generated attribute
24809 !! wikitext
24810 {|
24811 |-
24812 |
24813 |{{echo|style='color:red'}}|foo
24814 |}
24815 !! html
24816 <table>
24817
24818 <tr>
24819 <td>
24820 </td>
24821 <td>foo
24822 </td></tr></table>
24823
24824 !!end
24825
24826 !!test
24827 Indented table with an empty td
24828 !! wikitext
24829 {|
24830 |-
24831 |
24832 |foo
24833 |}
24834 !! html
24835 <table>
24836
24837 <tr>
24838 <td>
24839 </td>
24840 <td>foo
24841 </td></tr></table>
24842
24843 !!end
24844
24845 ## We have some newline diffs RT-ing this edge case
24846 ## and it is not important enough -- we seem to be emitting
24847 ## at most 2 newlines after a </tr> and this is unrelated to
24848 ## the issue from T85627 that this is testing.
24849 !!test
24850 Indented table with blank lines in between (T85627)
24851 !! options
24852 parsoid=wt2html
24853 !! wikitext
24854 {|
24855 |foo
24856
24857
24858 |}
24859 !! html
24860 <table>
24861
24862 <tr>
24863 <td>foo
24864 </td></tr></table>
24865
24866 !!end
24867
24868 !!test
24869 Indented block & table
24870 !! wikitext
24871 <div>foo</div>
24872 {|
24873 |foo
24874 |}
24875 !! html/php
24876 <div>foo</div>
24877 <table>
24878 <tr>
24879 <td>foo
24880 </td></tr></table>
24881
24882 !! html/parsoid
24883 <div data-parsoid='{"stx":"html"}'>foo</div>
24884 <table><tbody>
24885 <tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>foo</td></tr>
24886 </tbody></table>
24887 !!end
24888
24889 !! test
24890 Indent and comment before table row
24891 !! wikitext
24892 {|
24893 <!--hi-->|-
24894 | there
24895 |}
24896 !! html/php
24897 <table>
24898
24899 <tr>
24900 <td> there
24901 </td></tr></table>
24902
24903 !! html/parsoid
24904 <table>
24905 <!--hi--><tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
24906 <td data-parsoid='{"autoInsertedEnd":true}'> there</td></tr>
24907 </tbody></table>
24908 !! end
24909
24910 # Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext
24911 !!test
24912 Empty TR followed by a template-generated TR
24913 !!options
24914 parsoid
24915 !! wikitext
24916 {|
24917 |-
24918 {{echo|<tr><td>foo</td></tr>}}
24919 |}
24920 !! html
24921 <table>
24922 <tbody>
24923 <tr></tr>
24924 <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}}]}'>
24925 <td>foo</td></tr>
24926 </tbody></table>
24927 !!end
24928
24929 ## PHP and parsoid output differ for this, and since this is primarily
24930 ## for testing Parsoid's serializer, marking this Parsoid only
24931 !!test
24932 Empty TR followed by mixed-ws-comment line should RT correctly
24933 !!options
24934 parsoid
24935 !! wikitext
24936 {|
24937 |-
24938 <!--c-->
24939 |-
24940 <!--c--> <!--d-->
24941 |}
24942 !! html
24943 <table>
24944 <tbody>
24945 <tr></tr>
24946 <!--c-->
24947 <tr>
24948 <!--c--> </tr><!--d-->
24949 </tbody></table>
24950
24951 !!end
24952
24953 !!test
24954 Multi-line image caption generated by templates with/without trailing newlines
24955 !! wikitext
24956 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
24957 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
24958 !! html/parsoid
24959 <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>
24960 <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>
24961 !!end
24962
24963 !! test
24964 New element inserted (without intervening newlines) after an old sol-transparent node should serialize correctly
24965 !! options
24966 parsoid=html2wt
24967 !! html/parsoid
24968 <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>
24969
24970 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{}'/><h1>new heading</h1>
24971 !! wikitext
24972 <includeonly>foo</includeonly>
24973 new para
24974
24975 [[Category:Foo]]
24976
24977 = new heading =
24978 !! end
24979
24980 ## PHP emits broken html for this, and since this is primarily
24981 ## a Parsoid serializer test, marking this Parsoid only
24982 !!test
24983 Improperly nested inline or quotes tags with whitespace in between
24984 !! wikitext
24985 <span> <s>x</span> </s>
24986 ''' ''x''' ''
24987 !! html/parsoid
24988 <p><span> <s>x</s></span><s> </s>
24989 <b> <i>x</i></b><i> </i>
24990 </p>
24991 !!end
24992
24993 !!test
24994 Encapsulate protected attributes from wt
24995 !! wikitext
24996 <div typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
24997
24998 {| typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true"
24999 | ok
25000 |}
25001 !! html/parsoid
25002 <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>
25003
25004 <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">
25005 <tbody><tr><td data-parsoid='{"autoInsertedEnd":true}'> ok</td></tr>
25006 </tbody></table>
25007 !!end
25008
25009 ## Currently the p-wrapper is fragile in how it adds / removes transformations.
25010 ## Having nested or stray pre tags results in the attempt to add duplicates,
25011 ## causing an assertion fail. This test tries to prevent that situation.
25012 !!test
25013 Ensure ParagraphWrapper can deal with stray closing pre tags
25014 !!options
25015 parsoid=wt2html
25016 !! wikitext
25017 plain text</pre>
25018 !! html/parsoid
25019 plain text
25020 !!end
25021
25022 !!test
25023 1. Ensure fostered text content is wrapped in element nodes
25024 !!options
25025 parsoid=wt2html
25026 !! wikitext
25027 <table>hi</table><table>ho</table>
25028 !! html/parsoid
25029 <p>hi</p>
25030 <table></table>
25031 <p>ho</p>
25032 <table></table>
25033 !!end
25034
25035 !!test
25036 2. Ensure fostered text content is wrapped in element nodes (traps regressions around fostered marker on the element getting lost)
25037 !!options
25038 parsoid=wt2html,wt2wt
25039 !! wikitext
25040 <table>
25041 <tr> || ||
25042 <td> a
25043 </table>
25044 !! html/parsoid
25045 <p> || ||
25046 </p><table>
25047 <tbody><tr><td> a</td></tr>
25048 </tbody></table>
25049 !!end
25050
25051 !!test
25052 Encapsulation properly handles null DSR information from foster box
25053 !!options
25054 parsoid=wt2html,wt2wt
25055 !! wikitext
25056 {{echo|<table>foo<tr><td>bar</td></tr></table>}}
25057 !! html/parsoid
25058 <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>
25059 !!end
25060
25061 !!test
25062 1. Encapsulate foster-parented transclusion content
25063 !!options
25064 parsoid=wt2wt,wt2html
25065 !! wikitext
25066 <table>{{echo|foo<tr><td>bar</td></tr>}}</table>
25067 !! html/parsoid
25068 <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>
25069 <tbody>
25070 <tr>
25071 <td>bar</td>
25072 </tr>
25073 </tbody>
25074 </table>
25075 !!end
25076
25077 !!test
25078 2. Encapsulate foster-parented transclusion content
25079 !!options
25080 parsoid=wt2wt,wt2html
25081 !! wikitext
25082 <table><div>{{echo|foo}}</div><tr><td>bar</td></tr></table>
25083 !! html/parsoid
25084 <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>
25085 <table>
25086 <tbody>
25087 <tr>
25088 <td>bar</td>
25089 </tr>
25090 </tbody>
25091 </table>
25092 !!end
25093
25094 !!test
25095 3. Encapsulate foster-parented transclusion content
25096 !!options
25097 parsoid=wt2wt,wt2html
25098 !! wikitext
25099 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
25100 !! html/parsoid
25101 <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;]}">
25102 <p>foo</p>
25103 </div>
25104 <table>
25105 <tbody>
25106 <tr>
25107 <td>bar</td>
25108 </tr>
25109 </tbody>
25110 </table>
25111 !!end
25112
25113 !!test
25114 4. Encapsulate foster-parented transclusion content
25115 !!options
25116 parsoid=wt2wt,wt2html
25117 !! wikitext
25118 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
25119 !! html/parsoid
25120 <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;]}">
25121 <p>foo</p>
25122 </div>
25123 <table>
25124 <tbody>
25125 <tr>
25126 <td>bar</td>
25127 </tr>
25128 </tbody>
25129 </table>
25130 !!end
25131
25132 !!test
25133 5. Encapsulate foster-parented transclusion content
25134 !!options
25135 parsoid=wt2wt,wt2html
25136 !! wikitext
25137 <table><tr><td><div><p>{{echo|foo</p></div></td>foo}}</tr></table>
25138 !! html/parsoid
25139 <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>
25140 <table>
25141 <tbody>
25142 <tr>
25143 <td>
25144 <div>
25145 <p>foo</p>
25146 </div>
25147 </td>
25148 </tr>
25149 </tbody>
25150 </table>
25151 !!end
25152
25153 !!test
25154 6. Encapsulate foster-parented transclusion content
25155 !!options
25156 parsoid=wt2wt,wt2html
25157 !! wikitext
25158 <table><tr><td><div><p>{{echo|foo</p></div></td>foo</tr></table>}}<p>ok</p>
25159 !! html/parsoid
25160 <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>
25161 <table>
25162 <tbody>
25163 <tr>
25164 <td>
25165 <div>
25166 <p>foo</p>
25167 </div>
25168 </td>
25169 </tr>
25170 </tbody>
25171 </table>
25172 <p>ok</p>
25173 !!end
25174
25175 !!test
25176 7. Encapsulate foster-parented transclusion content
25177 !!options
25178 parsoid=wt2wt,wt2html
25179 !! wikitext
25180 <table>{{echo|<p>foo</p>}}<td>bar</td></table>
25181 !! html/parsoid
25182 <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>
25183 <table>
25184 <tbody>
25185 <tr>
25186 <td>bar</td>
25187 </tr>
25188 </tbody>
25189 </table>
25190 !!end
25191
25192 # Note that the wt is broken on purpose: the = should be {{=}} if you
25193 # don't want it to be a template parameter key.
25194 !!test
25195 8. Encapsulate foster-parented transclusion content
25196 !!options
25197 parsoid=wt2wt,wt2html
25198 !! wikitext
25199 {{echo|a
25200 }}{|{{echo|style='color:red'}}
25201 |-
25202 |b
25203 |}
25204 !! html/parsoid
25205 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\n"}},"i":0}}]}'>a</p>
25206 <span> </span>
25207 <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>
25208 <table>
25209 <tbody>
25210 <tr>
25211 <td>b</td>
25212 </tr>
25213 </tbody>
25214 </table>
25215 !!end
25216
25217 !!test
25218 9. Encapsulate foster-parented transclusion content
25219 !!options
25220 parsoid=wt2wt,wt2html
25221 !! wikitext
25222 <table>{{echo|hi</table>hello}}
25223 !! html/parsoid
25224 <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>
25225 !!end
25226
25227 !!test
25228 Table in fosterable position
25229 !!options
25230 parsoid=wt2html
25231 !! wikitext
25232 {{OpenTable}}
25233 <div>
25234 {|
25235 |}
25236 </div>
25237 |}
25238 !! html/parsoid
25239 <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">
25240 </span>
25241 <table about="#mwt1" data-parsoid='{"autoInsertedEnd":true}'></table>
25242
25243 <table>
25244 </table>
25245 !!end
25246
25247 # Parsoid only for T66747
25248 !! test
25249 Properly encapsulate empty-content transclusions in fosterable positions
25250 !! wikitext
25251 <table>
25252 {{#if:|
25253 <td>foo</td>
25254 }}
25255 </table>
25256 !! html/parsoid
25257 <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"}]]}'>
25258
25259 </table>
25260 !! end
25261
25262 !! test
25263 Always encapsulate foster box when template range is expanded to table
25264 !! options
25265 parsoid=wt2wt
25266 !! wikitext
25267 {|
25268 hello
25269 {{OpenTable}}
25270 |}
25271 !! html/parsoid
25272
25273 !! end
25274
25275 !! test
25276 T115289: Unclosed table
25277 !! wikitext
25278 {{echo|<table>}}<!--c-->[[Category:Two]]
25279 !! html/parsoid
25280 <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>
25281 !! end
25282
25283 !! test
25284 T115289: Don't migrate newlines out of tables with fostered content
25285 !! wikitext
25286 <table><td></td>{{echo|<tr>[[Category:One]]}}<!--c-->[[Category:Two]]
25287 !! html/parsoid
25288 <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>
25289 !! end
25290
25291 !! test
25292 T73074: More fostering fun
25293 !! wikitext
25294 <table><td></td>{{echo|<tr>}}<!--c-->[[Category:Two]]
25295 !! html/parsoid
25296 <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>
25297 !! end
25298
25299 !!test
25300 Support <object> element with .data attribute
25301 !!options
25302 parsoid=html2wt
25303 !! html/parsoid
25304 <object data="test.swf"></object>
25305 !! wikitext
25306 <object data="test.swf"></object>
25307 !!end
25308
25309 !! test
25310 Don't block XML namespace declaration
25311 !! wikitext
25312 <span xmlns:dct="http://purl.org/dc/terms/" property="dct:title">MediaWiki</span>
25313 !! html/php
25314 <p><span xmlns:dct="http&#58;//purl.org/dc/terms/" property="dct:title">MediaWiki</span>
25315 </p>
25316 !! html/parsoid
25317 <p><span xmlns:dct="http://purl.org/dc/terms/" data-x-property="dct:title" data-parsoid='{"stx":"html"}'>MediaWiki</span></p>
25318 !! end
25319
25320 # -----------------------------------------------------------------
25321 # The following section of tests are primarily to spec requirements
25322 # around Parsoid's serialization (old, new, edited content)
25323 #
25324 # All these tests are marked Parsoid html2wt and html2html only
25325 # ----------------------------------------------------------------
25326
25327 !! test
25328 Ignore rel attribute in a-tags during serialization to url-links
25329 !! options
25330 parsoid=html2wt
25331 !! html/parsoid
25332 <a href='http://en.wikipedia.org/wiki/Foobar'>http://en.wikipedia.org/wiki/Foobar</a>
25333 <a href='http://en.wikipedia.org/wiki/Foobar' rel='mw:ExtLink'>http://en.wikipedia.org/wiki/Foobar</a>
25334 <a href='http://en.wikipedia.org/wiki/Foobar' rel='mw:WikiLink'>http://en.wikipedia.org/wiki/Foobar</a>
25335 !! wikitext
25336 http://en.wikipedia.org/wiki/Foobar
25337 http://en.wikipedia.org/wiki/Foobar
25338 http://en.wikipedia.org/wiki/Foobar
25339 !! end
25340
25341 # 'mi' is a localinterwiki prefix as well as a language
25342 !! test
25343 Serialize interwiki links pointing to the current wiki as plain wiki links (T67869)
25344 !! options
25345 parsoid=html2wt
25346 !! html/parsoid
25347 <p><a rel="mw:ExtLink" href="http://mi.wikipedia.org/wiki/Foo">Foo</a></p>
25348 !! wikitext
25349 [[Foo]]
25350 !! end
25351
25352 # See T93839
25353 !! test
25354 New wikilinks should be serialized properly
25355 !! options
25356 parsoid=html2wt
25357 !! html/parsoid
25358 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{}'>Foo</a>
25359 <a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>
25360 <a href="//en.wikipedia.org/wiki/Foo">//en.wikipedia.org/wiki/Foo</a>
25361 <a href="http://en.wikipedia.org/wiki/Foo">http://en.wikipedia.org/wiki/Foo</a>
25362 <a href="//en.wikipedia.org/wiki/Foo_bar">//en.wikipedia.org/wiki/Foo bar</a>
25363 !! wikitext
25364 [[Foo]]
25365 [[Foo]]
25366 [[:en:Foo|//en.wikipedia.org/wiki/Foo]]
25367 http://en.wikipedia.org/wiki/Foo
25368 [[:en:Foo_bar|//en.wikipedia.org/wiki/Foo bar]]
25369 !! end
25370
25371 !! test
25372 New wiki links (href variations)
25373 !! options
25374 parsoid=html2wt
25375 !! html/parsoid
25376 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
25377 <a rel="mw:WikiLink" href="Foo_bar">Foo_bar</a>
25378 <a rel="mw:WikiLink" href="Foo bar">Foo_bar</a>
25379 <a rel="mw:WikiLink" href="./Toxine_bact%C3%A9rienne">Toxine bactérienne</a>
25380 !! wikitext
25381 [[Foo_bar]]
25382 [[Foo_bar]]
25383 [[Foo_bar]]
25384 [[Toxine bactérienne]]
25385 !! end
25386
25387 !! test
25388 New wiki links (content string variations)
25389 !! options
25390 parsoid=html2wt
25391 !! html/parsoid
25392 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
25393 <a rel="mw:WikiLink" href="./Foo_bar">Foo bar</a>
25394 <a rel="mw:WikiLink" href="./Foo_bar">./Foo_bar</a>
25395 !! wikitext
25396 [[Foo_bar]]
25397 [[Foo bar]]
25398 [[Foo_bar|./Foo_bar]]
25399 !! end
25400
25401 !! test
25402 New category links (href variations)
25403 !! options
25404 parsoid=html2wt
25405 !! html/parsoid
25406 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne" />
25407 <link rel="mw:PageProp/Category" href="./Category:Toxine_bact%C3%A9rienne" />
25408 <link rel="mw:PageProp/Category" href="Category:Toxine_bact%C3%A9rienne" />
25409 !! wikitext
25410 [[Category:Toxine bactérienne]]
25411 [[Category:Toxine bactérienne]]
25412 [[Category:Toxine bactérienne]]
25413 !! end
25414
25415 !! test
25416 New sol transparent links don't need indent-pre nowiki protection
25417 !! options
25418 parsoid=html2wt
25419 language=de
25420 !! html/parsoid
25421 <link rel="mw:PageProp/redirect" href="./Main_Page">
25422 <!-- this is good --> <link rel="mw:PageProp/Category" href="./Category:Good" />
25423 <!-- this is great --> <link rel="mw:PageProp/Category" href="./Kategorie:Great" />
25424 !! wikitext
25425 #WEITERLEITUNG [[Main Page]]
25426 <!-- this is good --> [[Category:Good]]
25427 <!-- this is great --> [[Kategorie:Great]]
25428 !! end
25429
25430 !! test
25431 New interlanguage links (href variations)
25432 !! options
25433 parsoid=html2wt
25434 !! html/parsoid
25435 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine bactérienne" />
25436 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bactérienne" />
25437 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bact%C3%A9rienne" />
25438 !! wikitext
25439 [[es:Toxine bactérienne]]
25440 [[es:Toxine_bactérienne]]
25441 [[es:Toxine_bactérienne]]
25442 !! end
25443
25444 !! test
25445 Image: Modifying size of an image (1)
25446 !! options
25447 parsoid={
25448 "modes": ["wt2wt"],
25449 "changes": [
25450 ["img[height]", "attr", "height", "22"],
25451 ["img[width]", "attr", "width", "200"]
25452 ]
25453 }
25454 !! wikitext
25455 [[Image:Foobar.jpg|230x230px]]
25456 !! wikitext/edited
25457 [[Image:Foobar.jpg|200x200px]]
25458 !!end
25459
25460 !! test
25461 Image: Modifying size of an image (2)
25462 !! options
25463 parsoid={
25464 "modes": ["wt2wt"],
25465 "changes": [
25466 ["img[height]", "attr", "height", "100"],
25467 ["img[width]", "attr", "width", "500"]
25468 ]
25469 }
25470 !! wikitext
25471 [[Image:Foobar.jpg|230x230px]]
25472 !! wikitext/edited
25473 [[Image:Foobar.jpg|500x500px]]
25474 !!end
25475
25476 # Change in size is ignored so long as class='mw-default-size'
25477 !! test
25478 Image: Modifying size of an image (3)
25479 !! options
25480 parsoid={
25481 "modes": ["wt2wt"],
25482 "changes": [
25483 ["figure[class]", "removeClass", "mw-default-size"],
25484 ["figure img", "attr", "height", "19"],
25485 ["figure img", "attr", "width", "170"]
25486 ]
25487 }
25488 !! wikitext
25489 [[Image:Foobar.jpg|thumb]]
25490 !! wikitext/edited
25491 [[Image:Foobar.jpg|thumb|170x170px]]
25492 !!end
25493
25494 !! test
25495 Image: Modifying alignment of an image (T50665)
25496 !! options
25497 parsoid={
25498 "modes": ["wt2wt"],
25499 "changes": [
25500 ["figure[class]", "removeClass", "mw-halign-right"],
25501 ["figure[class]", "addClass", "mw-halign-left"]
25502 ]
25503 }
25504 !! wikitext
25505 [[Image:Foobar.jpg|thumb|caption|right]]
25506 !! wikitext/edited
25507 [[Image:Foobar.jpg|thumb|caption|left]]
25508 !! end
25509
25510 !! test
25511 Image: Modifying mw-default-size of an frameless image (T64805)
25512 !! options
25513 parsoid={
25514 "modes": ["wt2wt"],
25515 "changes": [
25516 ["figure.mw-default-size", "removeClass", "mw-default-size"]
25517 ]
25518 }
25519 !! wikitext
25520 [[Image:Foobar.jpg|frameless|right]]
25521 !! wikitext/edited
25522 [[Image:Foobar.jpg|frameless|right|220x220px]]
25523 !! end
25524
25525 !! test
25526 Image: Modifying valign of an image (T51221)
25527 !! options
25528 parsoid={
25529 "modes": ["wt2wt"],
25530 "changes": [
25531 ["*[typeof=\"mw:Image\"]", "removeClass", "mw-valign-middle"],
25532 ["*[typeof=\"mw:Image\"]", "addClass", "mw-valign-text-top"]
25533 ]
25534 }
25535 !! wikitext
25536 [[File:Foobar.jpg|20px|middle]]
25537 !! wikitext/edited
25538 [[File:Foobar.jpg|20px|text-top]]
25539 !! end
25540
25541 !! test
25542 Image: Modifying alt attribute of an image (T58400)
25543 !! options
25544 parsoid={
25545 "modes": ["wt2wt"],
25546 "changes": [
25547 ["img[alt]", "attr", "alt", "some alternate edited text"]
25548 ]
25549 }
25550 !! wikitext
25551 [[File:Foobar.jpg|thumb|some caption|alt=some alternate text]]
25552 !! wikitext/edited
25553 [[File:Foobar.jpg|thumb|some caption|alt=some alternate edited text]]
25554 !!end
25555
25556 !! test
25557 Image: Modifying caption of an image
25558 !! options
25559 parsoid={
25560 "modes": ["wt2wt"],
25561 "changes": [
25562 ["figcaption", "text", "new caption"]
25563 ]
25564 }
25565 !! wikitext
25566 [[Image:Foobar.jpg|thumb|original caption]]
25567 !! wikitext/edited
25568 [[Image:Foobar.jpg|thumb|new caption]]
25569 !!end
25570
25571 !! test
25572 Image: empty alt attribute (T50924)
25573 !! options
25574 parsoid
25575 !! wikitext
25576 [[File:Foobar.jpg|thumb|alt=|bar]]
25577 !! html
25578 <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>
25579 !! end
25580
25581 !! test
25582 Image: new attributes should be serialized in wiki's language for RTL languages (T53852)
25583 !! options
25584 parsoid=html2wt
25585 language=ar
25586 disabled
25587 !! html/parsoid
25588 <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>
25589 !! wikitext
25590 [[Imagen:Foobar.jpg|derecha|miniaturadeimagen]]
25591 !! end
25592
25593 !! test
25594 Image: Block level image should have \n before and after
25595 !! wikitext
25596 123
25597 [[File:Foobar.jpg|right|thumb|150x150px]]
25598 456
25599 !! html/parsoid
25600 <p>123</p>
25601 <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>
25602 <p>456</p>
25603 !!end
25604
25605 !! test
25606 Image: New block level image should have \n before and after (existing content)
25607 !! wikitext
25608 123
25609 [[File:Foobar.jpg|right|thumb|150x150px]]
25610 456
25611 !! html/parsoid
25612 <p>123</p>
25613 <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>
25614 <p>456</p>
25615 !!end
25616
25617 !! test
25618 Image: upright option (parsoid)
25619 !! wikitext
25620 [[File:Foobar.jpg|thumb|upright|caption]]
25621 [[File:Foobar.jpg|thumb|upright=0.5|caption]]
25622 [[File:Foobar.jpg|thumb|500x500px|upright=0.5|caption]]
25623 !! html/parsoid
25624 <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>
25625 <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>
25626 <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>
25627 !!end
25628
25629 !! test
25630 Image: upright option is ignored on inline and frame images (parsoid)
25631 !! wikitext
25632 [[File:Foobar.jpg|500x500px|upright=0.5|caption]]
25633 !! html/parsoid
25634 <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>
25635 !!end
25636
25637 !! test
25638 Image: from basic HTML (1)
25639 !! options
25640 parsoid=html2wt
25641 !! html/parsoid
25642 <span typeof="mw:Image">
25643 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
25644 </span>
25645 !! wikitext
25646 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
25647 !! end
25648
25649 !! test
25650 Image: from basic HTML (2)
25651 !! options
25652 parsoid=html2wt
25653 !! html/parsoid
25654 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
25655 !! wikitext
25656 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
25657 !! end
25658
25659 !! test
25660 Image: from basic HTML (3)
25661 !! options
25662 parsoid=html2wt
25663 !! html/parsoid
25664 <a href="Main"><img src="./File:Foobar.jpg" width=100 height=100 alt="Alt"></a>
25665 !! wikitext
25666 [[File:Foobar.jpg|link=Main|alt=Alt|100x100px]]
25667 !! end
25668
25669 !! test
25670 Image: from basic HTML (4)
25671 !! options
25672 parsoid=html2wt
25673 !! html/parsoid
25674 <img src="./File:Foobar.jpg">
25675 !! wikitext
25676 [[File:Foobar.jpg|link=]]
25677 !! end
25678
25679 !! test
25680 Image: Invalid title as link
25681 !! wikitext
25682 [[File:Foobar.jpg|link=<]]
25683 !! html/php
25684 <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>
25685 </p>
25686 !! html/parsoid
25687 <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>
25688 !! end
25689
25690 !! test
25691 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
25692 !! options
25693 parsoid=html2wt
25694 !! html/parsoid
25695 <ul>
25696 <li><p>foo</p></li>
25697 </ul>
25698 !! wikitext
25699 * foo
25700 !! end
25701
25702 !! test
25703 Lists: Serialize correctly even when list tags has unneeded whitespace between tags
25704 !! options
25705 parsoid=html2wt
25706 !! html/parsoid
25707 <ul> <li>foo</li></ul>
25708 !! wikitext
25709 * foo
25710 !! end
25711
25712 !! test
25713 Don't strip leading whitespace when handling indent-pre suppressing tags
25714 !! options
25715 parsoid=html2wt
25716 !! html/parsoid
25717 <table>
25718 <tr><td> indented row</td></tr>
25719 </table>
25720 <blockquote><p>
25721 <b>This is very bold of you!</b>
25722 </p>
25723 <table><tr><td>
25724 indented cell (no pre-wrapping!)
25725 </td></tr></table>
25726 </blockquote>
25727 <p>foo</p>
25728 <div>bar</div>
25729 !! wikitext
25730 {|
25731 | indented row
25732 |}
25733 <blockquote>
25734 '''This is very bold of you!'''
25735
25736 {|
25737 |
25738 indented cell (no pre-wrapping!)
25739 |}
25740 </blockquote>
25741 foo
25742 <div>bar</div>
25743 !! end
25744
25745 !! test
25746 Nowiki-wrap leading whitespace when handling indent-pre inducing tags
25747 !! options
25748 parsoid=html2wt
25749 !! html/parsoid
25750 <p>foo</p>
25751 <span>bar</span>
25752
25753 <span>foo2
25754 </span>bar2
25755
25756 <div>foo</div>
25757 <span>bar</span>
25758
25759 <div>
25760 <span>foo</span>
25761 </div>
25762 !! wikitext
25763 foo
25764
25765 <span>bar</span>
25766
25767 <span>foo2
25768 <nowiki> </nowiki></span>bar2
25769
25770 <div>foo</div>
25771 <nowiki> </nowiki><span>bar</span>
25772
25773 <div>
25774 <nowiki> </nowiki><span>foo</span>
25775 </div>
25776 !! end
25777
25778 !! test
25779 Lists: Dont insert newlines in a serialized list item.
25780 !! options
25781 parsoid=html2wt
25782 !! html/parsoid
25783 <ul><li>a<br>b</li><li>c</li></ul>
25784 !! wikitext
25785 * a<br>b
25786 * c
25787 !! end
25788
25789 !! test
25790 1. Headings: Force sol-transparent links and behavior switches to serialize before/after
25791 !! options
25792 parsoid={
25793 "modes": ["html2wt"],
25794 "scrubWikitext": false
25795 }
25796 !! html/parsoid
25797 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
25798 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
25799
25800 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
25801 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
25802
25803 <h2 data-parsoid='{}'>howdy<link href="./Category:A5" rel="mw:PageProp/Category" /></h2>
25804
25805 <h2><meta property="mw:PageProp/toc" /> ok</h2>
25806 !! wikitext
25807 == hello there [[Category:A1]] ==
25808
25809 == [[Category:A2]] hi pal ==
25810
25811 == <!--foo--> [[Category:A3]] how goes it ==
25812
25813 == it goes well [[Category:A4]] <!--bar--> ==
25814
25815 ==howdy [[Category:A5]]==
25816
25817 == __TOC__ ok ==
25818 !! end
25819
25820 !! test
25821 2. Headings: Force sol-transparent links and behavior switches to serialize before/after
25822 !! options
25823 parsoid={
25824 "modes": ["html2wt"],
25825 "scrubWikitext": true
25826 }
25827 !! html/parsoid
25828 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
25829 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
25830
25831 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
25832 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
25833
25834 <h2><meta property="mw:PageProp/toc" /> ok</h2>
25835 !! wikitext
25836 == hello there ==
25837 [[Category:A1]]
25838 [[Category:A2]]
25839
25840 == hi pal ==
25841
25842 <!--foo--> [[Category:A3]]
25843
25844 == how goes it ==
25845
25846 == it goes well ==
25847 [[Category:A4]] <!--bar-->
25848
25849 __TOC__
25850
25851 == ok ==
25852 !! end
25853
25854 !! test
25855 Headings: Don't hoist metas that come from templates
25856 !! options
25857 parsoid={
25858 "modes": ["html2wt"],
25859 "scrubWikitext": true
25860 }
25861 !! html/parsoid
25862 <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>
25863 !! wikitext
25864 == {{echo|foo [[Category:Foo]]}} ==
25865 !! end
25866
25867 !! test
25868 Headings: Category in ref isn't hoisted
25869 !! options
25870 parsoid={
25871 "modes": ["html2wt"],
25872 "scrubWikitext": true
25873 }
25874 !! html/parsoid
25875 <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>
25876
25877 <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>
25878 !! wikitext
25879 == foo <ref>bar
25880 [[Category:Baz]] </ref> ==
25881
25882 <references />
25883 !! end
25884
25885 !! test
25886 Parsoid: Serialize positional parameters with = in them as named parameter
25887 !! options
25888 parsoid=html2wt
25889 !! html/parsoid
25890 <p about="#mwt1" typeof="mw:Transclusion"
25891 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
25892
25893 <p about="#mwt1" typeof="mw:Transclusion"
25894 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}, "2":{"wt":"bar"}},"i":0}}]}'>foo</p>
25895
25896 <!--Orig params with data-parsoid has heuristics for handling = chars-->
25897 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
25898 <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>
25899 !! wikitext
25900 {{echo|1=f=oo}}
25901
25902 {{echo|1=f=oo|2=bar}}
25903
25904 <!--Orig params with data-parsoid has heuristics for handling = chars-->
25905 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
25906 {{echo|<nowiki>f=oo</nowiki>|bar}}
25907 !! end
25908
25909 !! test
25910 Parsoid: Serialize positional parameters with = in extlink as named parameter
25911 !! options
25912 parsoid=html2wt
25913 !! html/parsoid
25914 <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>
25915 !! wikitext
25916 {{echo|1=http://stuff?is=ok}}
25917 !! end
25918
25919 !! test
25920 Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
25921 !! options
25922 parsoid=html2wt
25923 !! html/parsoid
25924 <div>a<p>b</p></div>
25925 <div>a
25926 <p>b</p></div>
25927 <div>
25928 a
25929 <p>b</p></div>
25930 !! wikitext
25931 <div>a
25932 b
25933 </div>
25934 <div>a
25935 b
25936 </div>
25937 <div>
25938 a
25939
25940 b
25941 </div>
25942 !! end
25943
25944 !! test
25945 Substrings resembling wikitext in hrefs should not get nowiki escapes
25946 !! options
25947 parsoid=html2wt
25948 !! html/parsoid
25949 <a rel="mw:WikiLink" href="./Foo''bar''baz">Foo''bar''baz</a>
25950 !! wikitext
25951 [[Foo''bar''baz]]
25952 !! end
25953
25954 !! test
25955 Enforce single-line context in the serializer
25956 !! options
25957 parsoid=html2wt
25958 !! html/parsoid
25959 <h2>testing
25960 123</h2>
25961
25962 <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">
25963 </span><span about="#mwt1">you</span> </h2>
25964
25965 <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>
25966
25967 <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
25968 there</span></li></ol>
25969
25970 <ul><li>asd
25971 sdf</li></ul>
25972
25973 <ul><li>foo
25974 bar
25975 baz</li>
25976 <li>foo <b>bar</b>
25977 baz</li></ul>
25978
25979 <dl><dt>hi
25980 ho </dt><dd data-parsoid='{"stx":"row"}'> hi
25981 ho</dd></dl>
25982
25983 <dl><dd> <table>
25984 <tbody><tr><td> ha
25985 ha
25986 ha</td></tr>
25987 </tbody></table></dd></dl>
25988 !! wikitext
25989 == testing 123 ==
25990
25991 == hi {{bogus|there
25992 you}} ==
25993
25994 == foo <ref>hello
25995 there</ref> ==
25996
25997 <references />
25998
25999 * asd sdf
26000
26001 * foo bar baz
26002 * foo '''bar''' baz
26003
26004 ; hi ho : hi ho
26005
26006 : {|
26007 | ha
26008 ha
26009 ha
26010 |}
26011 !! end
26012
26013 !! test
26014 Serialize new placeholder space without spans
26015 !! options
26016 parsoid=html2wt
26017 !! html/parsoid
26018 <p>foo<span typeof="mw:Placeholder"> </span>: bar</p>
26019
26020 <p>foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span>: bar</p>
26021
26022 <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>
26023 !! wikitext
26024 foo : bar
26025
26026 foo : bar
26027
26028 <ref>foo : bar</ref>ok
26029 !! end
26030
26031
26032 #-----------------------
26033 # Tag minimization tests
26034 #-----------------------
26035
26036 !! test
26037 1. I/B quote minimization: wikitext-only tags should be combined
26038 !! options
26039 parsoid=html2wt
26040 !! html/parsoid
26041 <p><i>A</i><i>B</i></p>
26042 <p><b>A</b><b>B</b></p>
26043 <p><i>A</i><b><i>B</i></b></p>
26044 <p><b>A</b><i><b>B</b></i></p>
26045 <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
26046 <p><i><b>A</b></i><i><b>B</b></i></p>
26047 <p><i><b>A</b></i><b><i>B</i></b></p>
26048 <p><b><i>A</i></b><i><b>B</b></i></p>
26049 !! wikitext
26050 ''AB''
26051
26052 '''AB'''
26053
26054 ''A'''B'''''
26055
26056 '''A''B'''''
26057
26058 '''A''BC''D'''
26059
26060 '''''AB'''''
26061
26062 '''''AB'''''
26063
26064 '''''AB'''''
26065 !! end
26066
26067 !! test
26068 2. I/B quote minimization: wikitext and html tags should not be combined
26069 !! options
26070 parsoid=html2wt
26071 !! html/parsoid
26072 <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
26073 <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
26074 !! wikitext
26075 ''A''<i>B</i>
26076
26077 ''A''<nowiki/>'''<i>B</i>'''
26078 !! end
26079
26080 !! test
26081 3. I/B quote minimization: templated content stops minimization
26082 !! options
26083 parsoid=html2wt
26084 !! html/parsoid
26085 <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>
26086 <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>
26087 !! wikitext
26088 ''A''{{echo|''B''}}
26089
26090 ''A''{{echo|'''''B'''''}}
26091 !! end
26092
26093 !! test
26094 4. I/B quote minimization: new content should be mimimized with adjacent old content
26095 !! options
26096 parsoid=html2wt
26097 !! html/parsoid
26098 <p><i>A</i><i>B</i></p>
26099 <p><b>A</b><b>B</b></p>
26100 <p><i>A</i><b><i>B</i></b></p>
26101 !! wikitext
26102 ''AB''
26103
26104 '''AB'''
26105
26106 ''A'''B'''''
26107 !! end
26108
26109 !! test
26110 5a. Merge adjacent quote nodes if they've been edited
26111 !! options
26112 parsoid={
26113 "modes": ["wt2wt", "selser"],
26114 "changes": [
26115 ["p", "contents", "remove", ":contains('b')"]
26116 ]
26117 }
26118 !! wikitext
26119 ''a''b''c''
26120 !! wikitext/edited
26121 ''ac''
26122 !! end
26123
26124 !! test
26125 5b. Merge adjacent quote nodes if they've been edited
26126 !! options
26127 parsoid={
26128 "modes": ["wt2wt", "selser"],
26129 "changes": [
26130 ["#x", "remove"]
26131 ]
26132 }
26133 !! wikitext
26134 ''a''<span id="x">b</span>''c''
26135 !! wikitext/edited
26136 ''ac''
26137 !! end
26138
26139 !! test
26140 1. Merge adjacent link nodes as long as at least one element is new
26141 !! options
26142 parsoid={
26143 "modes": ["html2wt"],
26144 "scrubWikitext": true
26145 }
26146 !! html/parsoid
26147 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
26148 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
26149 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a data-parsoid="{}" rel="mw:WikiLink" href="./Football">ball</a>
26150 !! wikitext
26151 [[Football]]
26152 [[Football]]
26153 [[Football|Foot]][[Football|ball]]
26154 !! end
26155
26156 !! test
26157 2. Merge adjacent link nodes and enable additional normalizations
26158 !! options
26159 parsoid={
26160 "modes": ["html2wt"],
26161 "scrubWikitext": true
26162 }
26163 !! html/parsoid
26164 <a rel="mw:WikiLink" href="./Football"><i>Foot</i></a><a rel="mw:WikiLink" href="./Football"><i>ball</i></a>
26165 !! wikitext
26166 [[Football|''Football'']]
26167 !! end
26168
26169 !! test
26170 3. Don't merge adjacent link nodes if scrubWikitext is false
26171 !! options
26172 parsoid={
26173 "modes": ["html2wt"],
26174 "scrubWikitext": false
26175 }
26176 !! html/parsoid
26177 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
26178 !! wikitext
26179 [[Football|Foot]][[Football|ball]]
26180 !! end
26181
26182 #------------------------------
26183 # End of tag minimization tests
26184 #------------------------------
26185
26186 !!test
26187 T56262: New entities
26188 !! options
26189 parsoid=html2wt
26190 !! html/parsoid
26191 <span typeof="mw:Entity">&nbsp;</span>
26192 !! wikitext
26193 &nbsp;
26194 !! end
26195
26196 ## Note that there is no wikitext output for 'unknownproperty' ##
26197 ## Unknown magic words are silently dropped ##
26198
26199 !! test
26200 Magic words
26201 !! options
26202 parsoid=html2wt
26203 !! html/parsoid
26204 <meta property='mw:PageProp/toc' />
26205 <meta property='mw:PageProp/notoc' />
26206 <meta property='mw:PageProp/forcetoc' />
26207 <meta property='mw:PageProp/index' />
26208 <meta property='mw:PageProp/noindex' />
26209 <meta property='mw:PageProp/nogallery' />
26210 <meta property='mw:PageProp/noeditsection' />
26211 <meta property='mw:PageProp/notitleconvert' />
26212 <meta property='mw:PageProp/nocontentconvert' />
26213 <meta property='mw:PageProp/unknownproperty' />
26214 !! wikitext
26215 __TOC__
26216 __NOTOC__
26217 __FORCETOC__
26218 __INDEX__
26219 __NOINDEX__
26220 __NOGALLERY__
26221 __NOEDITSECTION__
26222 __NOTITLECONVERT__
26223 __NOCONTENTCONVERT__
26224 !! end
26225
26226 !! test
26227 Consecutive <pre>s should not get merged
26228 !! options
26229 parsoid=html2wt,html2html
26230 !! html/parsoid
26231 <pre>a</pre><pre>b</pre>
26232
26233 <pre>c
26234 </pre><pre>
26235 d</pre>
26236
26237 <pre>e
26238
26239 </pre><pre>
26240
26241 f</pre>
26242 !! wikitext
26243 a
26244
26245 b
26246
26247 c
26248
26249 d
26250
26251 e
26252
26253
26254
26255 f
26256 !! end
26257
26258 !! test
26259 Edited ISBN links not serializable as ISBN links should serialize as wikilinks
26260 !! options
26261 parsoid=html2wt
26262 !! html/parsoid
26263 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink">ISBN 1234567895</a>
26264 !! wikitext
26265 [[Special:BookSources/1234567890|ISBN 1234567895]]
26266 !! end
26267
26268 !! test
26269 Edited RFC links not serializable as RFC links should serialize as extlinks
26270 !! options
26271 parsoid=html2wt
26272 !! html/parsoid
26273 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink">New RFC</a>
26274 !! wikitext
26275 [//tools.ietf.org/html/rfc123 New RFC]
26276 !! end
26277
26278 !! test
26279 Edited PMID links not serializable as PMID links should serialize as extlinks
26280 !! options
26281 parsoid=html2wt
26282 !! html/parsoid
26283 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink">New PMID</a>
26284 !! wikitext
26285 [//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract New PMID]
26286 !! end
26287
26288 !! test
26289 WTS of autolinks with trailing/surrounding context
26290 !! options
26291 parsoid=html2wt
26292 !! html/parsoid
26293 <p><a href="http://cscott.net">http://cscott.net</a><b>foo</b></p>
26294 <p><a href="http://cscott.net">http://cscott.net</a><b data-parsoid='{"stx":"html"}'>foo</b></p>
26295 <p><b><a href="http://cscott.net">http://cscott.net</a></b></p>
26296 <p><b><a href="http://cscott.net">http://cscott.net</a> </b></p>
26297 <p><b><a href="http://cscott.net">http://cscott.net</a>x</b></p>
26298 <p><a href="http://cscott.net">http://cscott.net</a>x</p>
26299 !! wikitext
26300 http://cscott.net'''foo'''
26301
26302 http://cscott.net<b>foo</b>
26303
26304 '''http://cscott.net'''
26305
26306 '''http://cscott.net '''
26307
26308 '''http://cscott.net<nowiki/>x'''
26309
26310 http://cscott.net<nowiki/>x
26311 !! end
26312
26313 !! test
26314 WTS of autolinks with nowikis (round-trip)
26315 !! wikitext
26316 x<nowiki/>http://cscott.net<nowiki/>x
26317 !! html/parsoid
26318 <p>x<a rel="mw:ExtLink" href="http://cscott.net">http://cscott.net</a>x</p>
26319 !! end
26320
26321 # this is the "easy" test because it leaves in place all the
26322 # data-parsoid information indicating this is an autolink
26323 !! test
26324 WTS of autolinks with escapes (editing)
26325 !! options
26326 parsoid={
26327 "modes": ["wt2wt"],
26328 "changes": [
26329 [ "span", "remove" ]
26330 ]
26331 }
26332 !! wikitext
26333 x<nowiki/>http://cscott.net<nowiki/>x
26334 !! wikitext/edited
26335 x<nowiki/>http://cscott.net<nowiki/>x
26336 !! end
26337
26338 !! test
26339 WTS of edited autolink-like text (T103364)
26340 !! options
26341 parsoid={
26342 "modes": ["wt2wt"],
26343 "changes": [
26344 [ "span[typeof]", "removeAttr", "typeof" ]
26345 ]
26346 }
26347 !! wikitext
26348 Not a link: <nowiki>http://example.com</nowiki>.
26349 !! wikitext/edited
26350 Not a link: <span><nowiki>http://example.com</nowiki></span>.
26351 !! end
26352
26353 !! test
26354 WTS of newly-authored autolink-like text (T103364)
26355 !! options
26356 parsoid=html2wt
26357 !! html/parsoid
26358 <p>http://example.com is not a link.</p>
26359 !! wikitext
26360 <nowiki>http://example.com</nowiki> is not a link.
26361 !! end
26362
26363 !! test
26364 WTS of autolink-like text after an autolink (T108563)
26365 !! options
26366 parsoid=html2wt
26367 !! html/parsoid
26368 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a> http://example.com is not a link.</p>
26369 !! wikitext
26370 http://example.com <nowiki>http://example.com</nowiki> is not a link.
26371 !! end
26372
26373 !! test
26374 Magic links inside links (not autolinked)
26375 !! wikitext
26376 [[Foo|http://example.com]]
26377 [[Foo|RFC 1234]]
26378 [[Foo|PMID 1234]]
26379 [[Foo|ISBN 123456789x]]
26380
26381 [http://foo.com http://example.com]
26382 [http://foo.com RFC 1234]
26383 [http://foo.com PMID 1234]
26384 [http://foo.com ISBN 123456789x]
26385 !! html+tidy
26386 <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>
26387 <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>
26388 !! html/parsoid
26389 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">http://example.com</a>
26390 <a rel="mw:WikiLink" href="./Foo" title="Foo">RFC 1234</a>
26391 <a rel="mw:WikiLink" href="./Foo" title="Foo">PMID 1234</a>
26392 <a rel="mw:WikiLink" href="./Foo" title="Foo">ISBN 123456789x</a></p>
26393
26394 <p><a rel="mw:ExtLink" href="http://foo.com">http://example.com</a>
26395 <a rel="mw:ExtLink" href="http://foo.com">RFC 1234</a>
26396 <a rel="mw:ExtLink" href="http://foo.com">PMID 1234</a>
26397 <a rel="mw:ExtLink" href="http://foo.com">ISBN 123456789x</a></p>
26398 !! end
26399
26400 !! test
26401 Magic links inside image captions (autolinked)
26402 !! wikitext
26403 [[File:Foobar.jpg|thumb|http://example.com]]
26404 [[File:Foobar.jpg|thumb|RFC 1234]]
26405 [[File:Foobar.jpg|thumb|PMID 1234]]
26406 [[File:Foobar.jpg|thumb|ISBN 123456789x]]
26407 !! html+tidy
26408 <div class="thumb tright">
26409 <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>
26410 <div class="thumbcaption">
26411 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
26412 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></div>
26413 </div>
26414 </div>
26415 <div class="thumb tright">
26416 <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>
26417 <div class="thumbcaption">
26418 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
26419 <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a></div>
26420 </div>
26421 </div>
26422 <div class="thumb tright">
26423 <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>
26424 <div class="thumbcaption">
26425 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
26426 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a></div>
26427 </div>
26428 </div>
26429 <div class="thumb tright">
26430 <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>
26431 <div class="thumbcaption">
26432 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
26433 <a href="/wiki/Special:BookSources/123456789X" class="internal mw-magiclink-isbn">ISBN 123456789x</a></div>
26434 </div>
26435 </div>
26436 !! html/parsoid
26437 <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>
26438 <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>
26439 <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>
26440 <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>
26441 !! end
26442
26443 !! test
26444 WTS of magic word text (T109371)
26445 !! options
26446 parsoid=html2wt
26447 !! html/parsoid
26448 <p>RFC 1234</p>
26449 <p><a href="http://foo.com" rel="mw:ExtLink">RFC 1234</a></p>
26450 <p><a href="./Foo" rel="mw:WikiLink">RFC 1234</a></p>
26451 !! wikitext
26452 <nowiki>RFC 1234</nowiki>
26453
26454 [http://foo.com RFC 1234]
26455
26456 [[Foo|RFC 1234]]
26457 !! end
26458
26459 !! test
26460 Edited Redirect link should emit a non-piped wikitext link
26461 !! options
26462 parsoid=html2wt
26463 !! html/parsoid
26464 <link rel="mw:PageProp/redirect" href="Bar" data-parsoid='{"a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>
26465 !! wikitext
26466 #REDIRECT [[Bar]]
26467 !! end
26468
26469 !! test
26470 T75121: Infer extension name from typeOf if data-mw is not present
26471 !! options
26472 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
26473 !! html/parsoid
26474 <div typeOf="mw:Extension/foo"></div>
26475 !! wikitext
26476 <foo />
26477 !! end
26478
26479 # Note that the <p> wrapping isn't present in PHP parser output
26480 # The important thing for this test is that P-wrapping doesn't
26481 # interfere with the <nowiki> protection for leading - in <td>
26482 # (which isn't necessary for <th>).
26483 !! test
26484 T88318: p-wrapped dash in table.
26485 !! options
26486 parsoid=html2wt,wt2wt
26487 !! html/parsoid
26488 <table><tbody>
26489 <tr><th><p>-</p></th><th><p>- </p></th></tr>
26490 <tr><td><p>-</p></td><td><p>- </p></td></tr>
26491 <tr><td><small>-</small></td><td><br/><p>-</p></td><td><br/>-</td></tr>
26492 </tbody></table>
26493 !! wikitext
26494 {|
26495 !-
26496 !-
26497 |-
26498 |<nowiki>-</nowiki>
26499 |<nowiki>- </nowiki>
26500 |-
26501 |<small>-</small>
26502 |<br>
26503 -
26504 |<br>
26505 -
26506 |}
26507 !! html/php+tidy
26508 <table>
26509 <tr>
26510 <th>-</th>
26511 <th>-</th>
26512 </tr>
26513 <tr>
26514 <td>-</td>
26515 <td>-</td>
26516 </tr>
26517 <tr>
26518 <td><small>-</small></td>
26519 <td><br />
26520 <p>-</p>
26521 </td>
26522 <td><br />
26523 <p>-</p>
26524 </td>
26525 </tr>
26526 </table>
26527 !! end
26528
26529 !! test
26530 T149209: WTS: Handle newlines in table cells properly
26531 !! options
26532 parsoid=html2wt
26533 !! html/parsoid
26534 <table>
26535 <tbody>
26536 <tr><td>a
26537 b
26538 </td><td data-parsoid='{"stx_v":"row"}'>c</td></tr>
26539 <tr><td><p>x</p>
26540 </td><td data-parsoid='{"stx_v":"row", "startTagSrc": "{{!}}{{!}}"}'>y</td></tr>
26541 </tbody></table>
26542 <table>
26543 <tbody>
26544 <tr><th>a
26545 b
26546 </th><th data-parsoid='{"stx_v":"row"}'>c</th></tr>
26547 <tr><th><p>x</h>
26548 </th><th data-parsoid='{"stx_v":"row"}'>y</th></tr>
26549 </tbody></table>
26550 !! wikitext
26551 {|
26552 |a
26553 b
26554 |c
26555 |-
26556 |x
26557 {{!}}y
26558 |}
26559 {|
26560 !a
26561 b
26562 !c
26563 |-
26564 !x
26565 !y
26566 |}
26567 !! end
26568
26569 !! test
26570 T149209: Selser: Handle newlines in table cells properly
26571 !! options
26572 parsoid={
26573 "modes": ["selser"],
26574 "changes": [
26575 [ "#h1", "html", "a\nb\n" ],
26576 [ "#h2", "html", "a\nb\n" ],
26577 [ "#c1", "html", "a\nb\n" ],
26578 [ "#c2", "html", "<p>a</p>" ],
26579 [ "#c3", "html", "<p>a</p>" ],
26580 [ "#c4", "html", "edit-me<p>a</p>" ]
26581 ]
26582 }
26583 !! wikitext
26584 {|
26585 ! id="h1" |edit-me!!1
26586 |-
26587 ! id="h2" |edit-me||2
26588 |-
26589 | id="c1" |edit-me||3
26590 |-
26591 | id="c2" |edit-me||4
26592 |-
26593 | id="c3" |edit-me||p||q||r
26594 |-
26595 | id="c4" |edit-me||p||q||r
26596 |}
26597 !! wikitext/edited
26598 {|
26599 ! id="h1" |a
26600 b
26601 !1
26602 |-
26603 ! id="h2" |a
26604 b
26605 !2
26606 |-
26607 | id="c1" |a
26608 b
26609 |3
26610 |-
26611 | id="c2" |a
26612 |4
26613 |-
26614 | id="c3" |a
26615 |p||q||r
26616 |-
26617 | id="c4" |edit-me
26618 a
26619 |p||q||r
26620 |}
26621 !! end
26622
26623 !! test
26624 HTML id attribute with Parsoid-like element ids should not be serialized to wikitext
26625 !! options
26626 parsoid=html2wt
26627 !! html/parsoid
26628 <table id='mwAb'>
26629 <td id='mwAc'>foo</td>
26630 <td id='serialize-this'>bar</td>
26631 </table>
26632 !! wikitext
26633 {|
26634 |foo
26635 | id="serialize-this" |bar
26636 |}
26637 !! end
26638
26639 !! test
26640 Parsoid-like element ids should not be serialized to wikitext unless shadowed
26641 !! options
26642 parsoid=html2wt
26643 !! html/parsoid
26644 <div id="mwAQ" data-parsoid='{"stx":"html","a":{"id":"mwAQ"},"sa":{"id":"hello"}}'>ok</div>
26645 !! wikitext
26646 <div id="hello">ok</div>
26647 !! end
26648
26649 !! test
26650 WTS change modes
26651 !! options
26652 parsoid={
26653 "modes": ["wt2wt"],
26654 "changes": [
26655 [ "#xyz", "before", "<b>before</b> stuff " ],
26656 [ "#xyz", "after", " stuff <i>after</i>" ],
26657 [ "#xyz", "html", "x <b>y</b> z" ]
26658 ]
26659 }
26660 !! wikitext
26661 <span id="xyz">hello</span>
26662 !! wikitext/edited
26663 '''before''' stuff <span id="xyz">x '''y''' z</span> stuff ''after''
26664 !! end
26665
26666 !! test
26667 Never serialize a-tag as html, regardless of what data-parsoid has to say
26668 !! options
26669 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
26670 !! html/parsoid
26671 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"html"}'>Foo</a>
26672 !! wikitext
26673 [[Foo]]
26674 !! end
26675
26676 ## SSS FIXME: This is broken output nevertheless.
26677 ## What might be a reasonable non-broken output for this?
26678 ## This is an edge case unlikely to be seen in production
26679 ## that I am not wasting more time on this right now.
26680 !! test
26681 Never serialize a-tag as html, no matter what attributes it has
26682 !! options
26683 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
26684 !! html/parsoid
26685 <a bad='true' href='http://boo.org'><img src='http://boohoo.org' /></a>
26686 !! wikitext
26687 [http://boo.org http://boohoo.org]
26688 !! end
26689
26690 # Misnested is an indication that selser can reuse the source but these have
26691 # shown to sneak through on occasion. See T101768.
26692 # The original wikitext here is: [http://test.com [[one]] two three]
26693 !! test
26694 Strip span tags added to mark misnested links
26695 !! options
26696 parsoid=html2wt
26697 !! html/parsoid
26698 <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>
26699 !! wikitext
26700 [http://test.com][[one]] two three
26701 !! end
26702
26703 !! test
26704 Use data-parsoid.firstWikitextNode to compute newline constraints for template content
26705 !! options
26706 parsoid=html2wt
26707 !! html/parsoid
26708 <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|}"]}'>
26709 <tbody><tr><td>d
26710 </td></tr>
26711 </tbody></table>
26712 !! wikitext
26713 {{echo|a}}
26714 {|{{echo|c
26715 {{!}}d
26716 }}
26717 |}
26718 !! end
26719
26720 ## This test verifies the presence and computation of this attribute indirectly
26721 ## by making an edit and ensuring that the serialization is correct (which it would be
26722 ## only if firstWikitextNode is properly set).
26723 !! test
26724 data-parsoid.firstWikitextNode should be computed properly in the presence of fostered content
26725 !! options
26726 parsoid= {
26727 "modes": ["wt2wt"],
26728 "changes": [
26729 [ "div#x", "remove" ],
26730 [ "div", "before", "<div>new</div>" ]
26731 ]
26732 }
26733 !! wikitext
26734 <div id="x">foo</div>
26735 {|
26736 {{echo|<div>boo</div>
26737 {{!}}b}}
26738 |c
26739 |}
26740 !! wikitext/edited
26741
26742 <div>new</div>
26743 {|
26744 {{echo|<div>boo</div>
26745 {{!}}b}}
26746 |c
26747 |}
26748 !! end
26749
26750 # --------------------------------------------
26751 # Tests spec'ing wikitext serialization norms |
26752 # --------------------------------------------
26753
26754 !! test
26755 Serialize multi-line indent-pre starting with wikitext syntax
26756 !! options
26757 parsoid=html2wt
26758 !! html/parsoid
26759 <pre>* 1
26760 ** 2
26761 * 3</pre>
26762 !! wikitext
26763 * 1
26764 ** 2
26765 * 3
26766 !! end
26767
26768 !! test
26769 1. Categories should always be serialized on their own line
26770 !! options
26771 parsoid=html2wt
26772 !! html/parsoid
26773 foo<link rel="mw:PageProp/Category" href="./Category:Foo">bar
26774 !! wikitext
26775 foo
26776 [[Category:Foo]]
26777 bar
26778 !! end
26779
26780 !! test
26781 2. Categories that are part of templates should not introduce a line break
26782 !! wikitext
26783 foo {{echo|<span>bar</span> [[Category:baz]]}} bar
26784 !! html/parsoid
26785 <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>
26786 !! end
26787
26788 # Careful while editing these next 2 tests. There are \u200f characters
26789 # before and after the <link> tags in the HTML and following some
26790 # of the categories in wikitext
26791 # Do not remove these characters in edits.
26792 #
26793 # As part of the serialization, these bidi characters will get stripped.
26794 !! test
26795 RTL (\u200f) and LTR (\u200e) markers around category tags should be stripped
26796 !! options
26797 parsoid={
26798 "modes": ["html2wt"],
26799 "scrubWikitext": true
26800 }
26801 !! html/parsoid
26802 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏
26803 ‏<link rel="mw:PageProp/Category" href="./קטגוריה:_שיטות_משפט" />‏</p>
26804 !! wikitext
26805 [[קטגוריה:טקסים]]
26806 [[קטגוריה: שיטות משפט]]
26807 !! end
26808
26809 !! test
26810 RTL (\u200f) and LTR (\u200e) markers should not be stripped if followed by a text node
26811 !! options
26812 parsoid={
26813 "modes": ["html2wt"],
26814 "scrubWikitext": true
26815 }
26816 !! html/parsoid
26817 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏y</p>
26818 !! wikitext
26819 [[קטגוריה:טקסים]]
26820 ‏y
26821 !! end
26822
26823 !! test
26824 Lists: Add space after bullets
26825 !! options
26826 parsoid=html2wt
26827 !! html/parsoid
26828 <ul>
26829 <li>foo</li>
26830 <li> bar</li>
26831 <li><span> baz</span></li>
26832 </ul>
26833 !! wikitext
26834 * foo
26835 * bar
26836 * <span> baz</span>
26837 !! end
26838
26839 !! test
26840 1. Headings: Add space before/after == (T53744)
26841 !! options
26842 parsoid=html2wt
26843 !! html/parsoid
26844 <h2>foo</h2>
26845 <h2> bar</h2>
26846 <h2>baz </h2>
26847 <h2><span> baz</span></h2>
26848 !! wikitext
26849 == foo ==
26850
26851 == bar ==
26852
26853 == baz ==
26854
26855 == <span> baz</span> ==
26856 !! end
26857
26858 !! test
26859 2. Headings: Add space before/after == even after hoisted content
26860 !! options
26861 parsoid={
26862 "modes": ["html2wt"],
26863 "scrubWikitext": true
26864 }
26865 !! html/parsoid
26866 <h2> <link href="./Category:A2" rel="mw:PageProp/Category" />ok</h2>
26867 !! wikitext
26868 [[Category:A2]]
26869
26870 == ok ==
26871 !! end
26872
26873 !! test
26874 1. Headings: suppress newly created empty headings
26875 !! options
26876 parsoid={
26877 "modes": ["html2wt"],
26878 "scrubWikitext": true
26879 }
26880 !! html/parsoid
26881 <h2></h2>
26882 !! wikitext
26883 !! end
26884
26885 !! test
26886 2. Headings: don't suppress empty headings if scrubWikitext is false
26887 !! options
26888 parsoid=html2wt
26889 !! html/parsoid
26890 <h2></h2>
26891 !! wikitext
26892 ==<nowiki/>==
26893 !! end
26894
26895 !! test
26896 3. Headings: suppress empty headings on edits
26897 !! options
26898 parsoid={
26899 "modes": ["selser"],
26900 "scrubWikitext": true,
26901 "changes": [
26902 [ "#x", "remove"]
26903 ]
26904 }
26905 !! wikitext
26906 ==<span id="x">foo</span>==
26907 !! wikitext/edited
26908 !! end
26909
26910 !! test
26911 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = true)
26912 !! options
26913 parsoid={
26914 "modes": ["html2wt"],
26915 "scrubWikitext": true
26916 }
26917 !! html/parsoid
26918 <h2>foo<br/>bar</h2>
26919 <h2>foo <span><br/>bar</span> baz</h2>
26920 !! wikitext
26921 == foo bar ==
26922
26923 == foo <span> bar</span> baz ==
26924 !! end
26925
26926 !! test
26927 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = false)
26928 !! options
26929 parsoid={
26930 "modes": ["html2wt"],
26931 "scrubWikitext": false
26932 }
26933 !! html/parsoid
26934 <h2>foo<br/>bar</h2>
26935 !! wikitext
26936 == foo<br> bar ==
26937 !! end
26938
26939 !! test
26940 1. WT Quote Tags: suppress newly created empty style tags
26941 !! options
26942 parsoid={
26943 "modes": ["html2wt"],
26944 "scrubWikitext": true
26945 }
26946 !! html/parsoid
26947 <i></i><b></b>
26948 !! wikitext
26949 !! end
26950
26951 !! test
26952 2. WT Quote Tags: don't suppress empty style tags if scrubWikitext is false
26953 !! options
26954 parsoid=html2wt
26955 !! html/parsoid
26956 <i></i><b></b>
26957 !! wikitext
26958 ''<nowiki/>'''''<nowiki/>'''
26959 !! end
26960
26961 !! test
26962 3. WT Quote Tags: suppress empty style tags on edits
26963 !! options
26964 parsoid={
26965 "modes": ["selser"],
26966 "scrubWikitext": true,
26967 "changes": [
26968 [ "#x", "remove"]
26969 ]
26970 }
26971 !! wikitext
26972 '''<span id="x">foo</span>'''
26973 !! wikitext/edited
26974 !! end
26975
26976 !! test
26977 1. Anchors: suppress newly created empty anchors
26978 !! options
26979 parsoid={
26980 "modes": ["html2wt"],
26981 "scrubWikitext": true
26982 }
26983 !! html/parsoid
26984 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
26985 !! wikitext
26986 !! end
26987
26988 !! test
26989 2. Anchors: don't suppress empty anchors if scrubWikitext is false
26990 !! options
26991 parsoid={
26992 "modes": ["html2wt"],
26993 "scrubWikitext": false
26994 }
26995 !! html/parsoid
26996 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
26997 !! wikitext
26998 [[Test|<nowiki/>]]
26999 !! end
27000
27001 !! test
27002 3. Anchors: suppress empty anchors on edits
27003 !! options
27004 parsoid={
27005 "modes": ["selser"],
27006 "scrubWikitext": true,
27007 "changes": [
27008 [ "#x", "remove"]
27009 ]
27010 }
27011 !! wikitext
27012 [[Test|<span id="x">foo</span>]]
27013 !! wikitext/edited
27014 !! end
27015
27016 !! test
27017 3a. Anchors: do not suppress numbered extlinks
27018 !! options
27019 parsoid={
27020 "modes": ["wt2wt"],
27021 "scrubWikitext": true
27022 }
27023 !! wikitext
27024 [http://foo.com]
27025 !! html/parsoid
27026 <a rel="mw:ExtLink" href="http://foo.com"></a>
27027 !! end
27028
27029 !! test
27030 3b. Anchors: do not suppress numbered extlinks
27031 !! options
27032 parsoid={
27033 "modes": ["wt2wt"],
27034 "scrubWikitext": true,
27035 "changes": [
27036 [ "#x", "remove"]
27037 ]
27038 }
27039 !! wikitext
27040 [http://foo.com <span id="x">foo</span>]
27041 !! wikitext/edited
27042 [http://foo.com]
27043 !! end
27044
27045 !!test
27046 Normalizations should be restricted to edited content
27047 !!options
27048 parsoid={
27049 "modes": ["selser"],
27050 "scrubWikitext": true,
27051 "changes": [
27052 [ "h1", "before", "<i></i>"]
27053 ]
27054 }
27055 !!wikitext
27056 a
27057 = =
27058 b
27059 !!wikitext/edited
27060 a
27061 = =
27062 b
27063 !!end
27064
27065 !! test
27066 1. Multiple normalizations (html2wt)
27067 !! options
27068 parsoid={
27069 "modes": ["html2wt"],
27070 "scrubWikitext": true
27071 }
27072 !! html
27073 <h2><i></i></h2>
27074 <p><a href='Foo' rel='mw:WikiLink'>foo<i></i>
27075 </a><b><i></i></b>x</p>
27076 !! wikitext
27077
27078 [[foo]]
27079 x
27080
27081 !! end
27082
27083 !! test
27084 2. Multiple normalizations (selser)
27085 !! options
27086 parsoid={
27087 "modes": ["selser"],
27088 "scrubWikitext": true,
27089 "changes": [
27090 [ "#x", "after", "<h1><i></i></h1>\n<p> x<b></b></p>"]
27091 ]
27092 }
27093 !! wikitext
27094 <span id="x">foo</span>
27095 !! wikitext/edited
27096 <span id="x">foo</span>
27097
27098 x
27099 !! end
27100
27101 !! test
27102 1. Indent Pre Nowiki: suppress whitespace at the start of new paragraph
27103 !! options
27104 parsoid={
27105 "modes": ["html2wt"],
27106 "scrubWikitext": true
27107 }
27108 !! html/parsoid
27109 <p> hi</p>
27110 <p> hello</p>
27111 !! wikitext
27112 hi
27113
27114 hello
27115 !! end
27116
27117 !! test
27118 2. Indent Pre Nowiki: don't suppress whitespace at the start of new paragraph if scrubWikitext is false
27119 !! options
27120 parsoid=html2wt
27121 !! html/parsoid
27122 <p> hi</p>
27123 <p> hello</p>
27124 !! wikitext
27125 <nowiki> </nowiki>hi
27126
27127 <nowiki> </nowiki> hello
27128 !! end
27129
27130 !! test
27131 3. Indent Pre Nowiki: suppress whitespace after newlines in new paragraph or table cell
27132 !! options
27133 parsoid={
27134 "modes": ["html2wt"],
27135 "scrubWikitext": true
27136 }
27137 !! html/parsoid
27138 <p>Foo
27139 bar
27140 baz</p>
27141
27142 <table><tr><td>Foo
27143 bar
27144 baz bang</td></tr></table>
27145
27146 <p><!--boo--> foo
27147 bar</p>
27148
27149 <p> foo
27150 bar<span>boo</span></p>
27151 !! wikitext
27152 Foo
27153 bar
27154 baz
27155
27156 {|
27157 |Foo
27158 bar
27159 baz bang
27160 |}
27161
27162 <!--boo-->foo
27163 bar
27164
27165 foo
27166 bar<span>boo</span>
27167 !! end
27168
27169 !! test
27170 4. Indent Pre Nowiki: suppress leading whitespace in edited paragraphs
27171 !! options
27172 parsoid={
27173 "modes": ["selser"],
27174 "scrubWikitext": true,
27175 "changes": [
27176 [ "p", "html", " a\n b" ]
27177 ]
27178 }
27179 !! wikitext
27180 xyz
27181 !! wikitext/edited
27182 a
27183 b
27184 !! end
27185
27186 !! test
27187 1. New links that end in spaces
27188 !! options
27189 parsoid={
27190 "modes": ["html2wt"],
27191 "scrubWikitext": false
27192 }
27193 !! html/parsoid
27194 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
27195 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
27196 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
27197 !! wikitext
27198 [[Berlin ]]<nowiki/>is the capital of Germany.
27199
27200 [[Foo ]]'''bar'''
27201
27202 [[Boston ]] is a city.
27203 !! end
27204
27205 !! test
27206 2. New links that end in spaces
27207 !! options
27208 parsoid={
27209 "modes": ["html2wt"],
27210 "scrubWikitext": true
27211 }
27212 !! html/parsoid
27213 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
27214 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
27215 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
27216 !! wikitext
27217 [[Berlin]] is the capital of Germany.
27218
27219 [[Foo]] '''bar'''
27220
27221 [[Boston]] is a city.
27222 !! end
27223
27224 !! test
27225 1. Table cells with escapable prefixes
27226 !! options
27227 parsoid={
27228 "modes": ["html2wt"],
27229 "scrubWikitext": false
27230 }
27231 !! html
27232 <table>
27233 <tr><td>a</td></tr>
27234 <tr><td>-</td></tr>
27235 <tr><td>+</td></tr>
27236 </table>
27237 !! wikitext
27238 {|
27239 |a
27240 |-
27241 |<nowiki>-</nowiki>
27242 |-
27243 |<nowiki>+</nowiki>
27244 |}
27245 !! end
27246
27247 !! test
27248 2. Table cells with escapable prefixes
27249 !! options
27250 parsoid={
27251 "modes": ["html2wt"],
27252 "scrubWikitext": true
27253 }
27254 !! html
27255 <table>
27256 <tr><td>a</td></tr>
27257 <tr><td>-</td></tr>
27258 <tr><td>+</td></tr>
27259 </table>
27260 !! wikitext
27261 {|
27262 |a
27263 |-
27264 | -
27265 |-
27266 | +
27267 |}
27268 !! end
27269
27270 !! test
27271 3a. Table cells with escapable prefixes after edits
27272 !! options
27273 parsoid={
27274 "modes": ["selser"],
27275 "scrubWikitext": true,
27276 "changes": [
27277 [ "table tbody tr:first-child td:first-child", "remove"]
27278 ]
27279 }
27280 !! wikitext
27281 {|
27282 |a||-
27283 |}
27284 !! wikitext/edited
27285 {|
27286 | -
27287 |}
27288 !! end
27289
27290 !! test
27291 3b. Table cells with escapable prefixes after edits
27292 !! options
27293 parsoid={
27294 "modes": ["selser"],
27295 "scrubWikitext": true,
27296 "changes": [
27297 [ "table tbody tr:first-child td:first-child", "html", "-" ],
27298 [ "#x", "remove" ]
27299 ]
27300 }
27301 !! wikitext
27302 {|
27303 |pqr
27304 |<span id="x">foo</span>+
27305 |}
27306 !! wikitext/edited
27307 {|
27308 | -
27309 | +
27310 |}
27311 !! end
27312
27313 # FIXME: This test will fail because
27314 # normalization doesn't realize that the id attribute
27315 # will eliminate the escapable scenario
27316 !! test
27317 4a. Table cells without escapable prefixes after edits
27318 !! options
27319 parsoid={
27320 "modes": ["selser"],
27321 "scrubWikitext": true,
27322 "changes": [
27323 [ "#x", "html", "-" ]
27324 ]
27325 }
27326 !! wikitext
27327 {|
27328 | id="x" |abcd
27329 |}
27330 !! wikitext/edited
27331 {|
27332 | id="x" |-
27333 |}
27334 !! end
27335
27336 ## This tests normalizer's ability to discriminate between
27337 ## cells having identical content.
27338 !! test
27339 4b. Table cells without escapable prefixes after edits
27340 !! options
27341 parsoid={
27342 "modes": ["selser"],
27343 "scrubWikitext": true,
27344 "changes": [
27345 [ "td", "html", "-" ]
27346 ]
27347 }
27348 !! wikitext
27349 {|
27350 |a||b
27351 |}
27352 !! wikitext/edited
27353 {|
27354 | -||-
27355 |}
27356 !! end
27357
27358 ## This tests normalizer's ability to not be tripped by
27359 ## comments (and whitespace)
27360 !! test
27361 4c. Table cells without escapable prefixes after edits
27362 !! options
27363 parsoid={
27364 "modes": ["selser"],
27365 "scrubWikitext": true,
27366 "changes": [
27367 [ "table tbody tr td:first-child", "remove" ]
27368 ]
27369 }
27370 !! wikitext
27371 {|
27372 |-
27373 <!--foo--> |a||-
27374 |}
27375 !! wikitext/edited
27376 {|
27377 |-
27378 <!--foo--> | -
27379 |}
27380 !! end
27381
27382 ## This tests normalizer's ability to handle HTML cells
27383 !! test
27384 4d. Table cells without escapable prefixes after edits
27385 !! options
27386 parsoid={
27387 "modes": ["selser"],
27388 "scrubWikitext": true,
27389 "changes": [
27390 [ "td", "html", "-" ]
27391 ]
27392 }
27393 !! wikitext
27394 <table>
27395 <tr><td>a</td></tr>
27396 </table>
27397 !! wikitext/edited
27398 <table>
27399 <tr><td>-</td></tr>
27400 </table>
27401 !! end
27402
27403 ## T111151 Remove font elements without attributes
27404 !! test
27405 5a. font tags without attributes should be dropped in scrubWikitext mode
27406 !! options
27407 parsoid={
27408 "modes": ["html2wt"],
27409 "scrubWikitext": true
27410 }
27411 !! html
27412 <font>foo</font>
27413 <font><font>bar</font></font>
27414 <font class="x">boo</font>
27415 !! wikitext
27416 foo
27417 bar
27418 <font class="x">boo</font>
27419 !! end
27420
27421 !! test
27422 5b. font tags should not be dropped without scrubWikitext being enabled
27423 !! options
27424 parsoid={
27425 "modes": ["html2wt"],
27426 "scrubWikitext": false
27427 }
27428 !! html
27429 <font>foo</font>
27430 !! wikitext
27431 <font>foo</font>
27432 !! end
27433
27434 !! test
27435 Escape nowiki DOM elements
27436 !! options
27437 parsoid=html2wt
27438 !! html/parsoid
27439 <nowiki><i>foo</i></nowiki>
27440 !! wikitext
27441 &lt;nowiki&gt;''foo''&lt;/nowiki&gt;
27442 !! end
27443
27444 # This is meant to be an interim fix while we go about figuring out
27445 # how to not introduce these trailing <nowiki/>s in the first place.
27446 !! test
27447 T115717: Strip trailing <nowiki/>s (without affecting valid uses)
27448 !! options
27449 parsoid=html2wt
27450 !! html/parsoid
27451 <p>x<meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/>
27452 y</p>
27453 <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>
27454 <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>
27455 !! wikitext
27456 x
27457 y
27458
27459 {{echo|
27460 1 = <nowiki/>}}
27461
27462 {{echo|
27463 1 = <nowiki/>
27464 }}
27465 !! end
27466
27467 # ---------------------------------------------------
27468 # End of tests spec'ing wikitext serialization norms |
27469 # ---------------------------------------------------
27470
27471 # T104032
27472 !! test
27473 Bare inline nodes not wrapped inside p-tags should be treated as p-wrapped
27474 !! options
27475 parsoid=html2wt
27476 !! html/parsoid
27477 a<p>b</p>
27478 <b>c</b><p>d</p>
27479 <table><tr>
27480 <td>a<p>b</p></td>
27481 <td><b>c</b><p>d</p></td>
27482 </tr></table>
27483 !! wikitext
27484 a
27485
27486 b
27487
27488 '''c'''
27489
27490 d
27491 {|
27492 |a
27493 b
27494 |'''c'''
27495 d
27496 |}
27497 !! end
27498
27499 !! test
27500 Anchor without href scenarios
27501 !! options
27502 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
27503 !! html/parsoid
27504 <a class="bc"></a>
27505 <a class="no">dice</a>
27506 <a name="foo"></a>
27507 !! wikitext
27508
27509 dice
27510 <span name="foo"></span>
27511 !! end
27512
27513 # -----------------------------------------------------------------
27514 # End of section for Parsoid-only html2wt tests for serialization
27515 # of new content
27516 # -----------------------------------------------------------------
27517
27518 # -----------------------------------------------------------------
27519 # The following section of tests are primarily to spec behavior of
27520 # the selective serializer. All these tests have manual selser
27521 # changes. The automated selser changes for all tests handle the
27522 # wide variation of changes, but these tests here capture specs
27523 # deterministically.
27524 # ----------------------------------------------------------------
27525
27526 ## T90517
27527 !! test
27528 Selser: New comments should not be lost
27529 !! options
27530 parsoid={
27531 "modes": ["selser"],
27532 "changes": [
27533 [ "#a", "after", "<!--c1-->" ],
27534 [ "#b", "before", "<!--c2-->" ]
27535 ]
27536 }
27537 !! wikitext
27538 <span id="a">a</span>
27539
27540 <span id="b">b</span>
27541 !! wikitext/edited
27542 <span id="a">a</span><!--c1-->
27543
27544 <!--c2--><span id="b">b</span>
27545 !! end
27546
27547 ## T89383
27548 !! test
27549 Selser: Check for validity of DSR before using it
27550 !! options
27551 parsoid={
27552 "modes": ["selser"],
27553 "changes": [
27554 [ "#a", "before", "<meta property='mw:PageProp/displaytitle' content='foo'>" ]
27555 ]
27556 }
27557 !! wikitext
27558 <span id="a">a</span>
27559 !! wikitext/edited
27560 {{DISPLAYTITLE:foo}}
27561 <span id="a">a</span>
27562 !! end
27563
27564 !! test
27565 1. DOMDiff: Changes to <ref> content should be looked up using id
27566 !! options
27567 parsoid={
27568 "modes": ["selser"],
27569 "changes": [
27570 ["#X", "after", "bar"],
27571 ["#Y", "after", "baz"]
27572 ]
27573 }
27574 !! wikitext
27575 X <ref><span id="X">foo</span></ref>
27576 Y <ref name="a" />
27577 <references>
27578 <ref name="a"><span id="Y">foo</span></ref>
27579 </references>
27580 !! wikitext/edited
27581 X <ref><span id="X">foo</span>bar</ref>
27582 Y <ref name="a" />
27583 <references>
27584 <ref name="a"><span id="Y">foo</span>baz</ref>
27585 </references>
27586 !! end
27587
27588 !! test
27589 2. DOMDiff: Changes to <ref> content should be looked up using id
27590 !! options
27591 parsoid={
27592 "modes": ["selser"],
27593 "changes": [
27594 ["#Z", "after", "bar"]
27595 ]
27596 }
27597 !! wikitext
27598 A <ref>foo bar for a</ref>
27599 B <ref group="X" name="b" />
27600
27601 <references />
27602
27603 <references group="X">
27604 <ref name="b"><span id="Z">foo</span></ref>
27605 </references>
27606 !! wikitext/edited
27607 A <ref>foo bar for a</ref>
27608 B <ref group="X" name="b" />
27609
27610 <references />
27611
27612 <references group="X">
27613 <ref name="b"><span id="Z">foo</span>bar</ref>
27614 </references>
27615 !! end
27616
27617 !! test
27618 DOMDiff: Edits to content nested in elements with templated attributes should not be lost (T139388)
27619 !! options
27620 parsoid={
27621 "modes": ["selser"],
27622 "changes": [
27623 [ "div:first-child", "text", "bar" ]
27624 ]
27625 }
27626 !! wikitext
27627 <div style="{{1x|color:red;}}%">foo</div>
27628 !! wikitext/edited
27629 <div style="{{1x|color:red;}}%">bar</div>
27630 !! end
27631
27632 !! test
27633 Empty LI (T49673)
27634 !! wikitext
27635 * a
27636 *
27637 *
27638 * b
27639 !! html/php+tidy
27640 <ul>
27641 <li>a</li>
27642 <li class="mw-empty-elt"></li>
27643 <li class="mw-empty-elt"></li>
27644 <li>b</li>
27645 </ul>
27646 !! end
27647
27648 !! test
27649 Thumbnail output
27650 !! wikitext
27651 [[File:Thumb.png|thumb]]
27652 !! html/php+tidy
27653 <div class="thumb tright">
27654 <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>
27655 <div class="thumbcaption">
27656 <div class="magnify"><a href="/wiki/File:Thumb.png" class="internal" title="Enlarge"></a></div>
27657 </div>
27658 </div>
27659 </div>
27660 !! end
27661
27662 !! test
27663 unclosed internal link XSS (T137264)
27664 !! wikitext
27665 [[#%3Cscript%3Ealert(1)%3C/script%3E|
27666 !! html/php
27667 <p>[[#&lt;script&gt;alert(1)&lt;/script&gt;|
27668 </p>
27669 !! html/parsoid
27670 <p>[[#%3Cscript%3Ealert(1)%3C/script%3E|</p>
27671 !! end