368dc0d2134de56e67fcd441d10f4a7cc1796063
[lhc/web/wiklou.git] / tests / parser / parserTests.txt
1 # MediaWiki Parser test cases
2 # Some taken from https://meta.wikimedia.org/wiki/Parser_testing
3 # All (C) their respective authors and released under the GPL
4 #
5 # The syntax should be fairly self-explanatory.
6 #
7 # Currently supported test options:
8 # One of the following three:
9 #
10 # (default) generate HTML output
11 # pst apply pre-save transform
12 # msg apply message transform
13 #
14 # Plus any combination of these:
15 #
16 # cat add category links
17 # (ignored by Parsoid, since it emits <link>s)
18 # ill add inter-language links
19 # (ignored by Parsoid, since it emits <link>s)
20 # subpage enable subpages (disabled by default)
21 # title=[[XXX]] run test using article title XXX
22 # language=XXX set content language to XXX for this test
23 # variant=XXX set the variant of language for this test (eg zh-tw)
24 # disabled do not run test
25 # parsoid parsoid-specific options (not run by PHP parser unless
26 # the test includes an html/php section)
27 # php php-only test (not run by the parsoid parser unless
28 # the test includes an html/parsoid section)
29 # showtitle make the first line the title
30 # showindicators make the first lines the page status indicators
31 # comment run through Linker::formatComment() instead of main parser
32 # local format section links in edit comment text as local links
33 # notoc disable table of contents
34 # thumbsize=NNN set the default thumb size to NNNpx for this test
35 # wrap include the normal wrapper <div class="mw-parser-output"> (since 1.30)
36 #
37 # You can also set the following parser properties via test options:
38 # wgEnableUploads, wgAllowExternalImages, wgMaxTocLevel,
39 # wgLinkHolderBatchSize, wgRawHtml, wgInterwikiMagic,
40 # wgEnableMagicLinks
41 #
42 # For testing purposes, temporary articles can created:
43 # !!article / NAMESPACE:TITLE / !!text / ARTICLE TEXT / !!endarticle
44 # where '/' denotes a newline.
45
46 # This is the standard article assumed to exist.
47 !! article
48 Main Page
49 !! text
50 blah blah
51 !! endarticle
52
53 !!article
54 Foo
55 !!text
56 FOO
57 !!endarticle
58
59 !!article
60 Template:Foo
61 !!text
62 FOO
63 !!endarticle
64
65 !! article
66 Template:Blank
67 !! text
68 !! endarticle
69
70 !! article
71 Template:pipe
72 !! text
73 |
74 !! endarticle
75
76 !! article
77 Template:=
78 !! text
79 <nowiki>=</nowiki>
80 !! endarticle
81
82 !!article
83 MediaWiki:bad image list
84 !!text
85 * [[File:Bad.jpg]] except [[Nasty page]]
86 !!endarticle
87
88 !! article
89 Template:inner list
90 !! text
91 * item 1
92 !! endarticle
93
94 !! article
95 Template:tbl-start
96 !! text
97 {|
98 !! endarticle
99
100 !! article
101 Template:tbl-end
102 !! text
103 |}
104 !! endarticle
105
106 !! article
107 Template:echo
108 !! text
109 {{{1}}}
110 !! endarticle
111
112 !! article
113 Template:echo_with_span
114 !! text
115 <span>{{{1}}}</span>
116 !! endarticle
117
118 !! article
119 Template:echo_with_div
120 !! text
121 <div>{{{1}}}</div>
122 !! endarticle
123
124 !! article
125 Template:blank_param
126 !! text
127 {{{1}}}
128 {{{}}}
129 !! endarticle
130
131 !! article
132 Template:table_attribs
133 !! text
134 <noinclude>
135 |</noinclude>style="color:red;"|Foo
136 !! endarticle
137
138 !! article
139 Template:table_attribs_2
140 !! text
141 <noinclude>
142 |</noinclude>style="color:red;"|Foo
143 |Bar||Baz
144 !! endarticle
145
146 !! article
147 Template:table_attribs_3
148 !! text
149 <noinclude>
150 |</noinclude>style{{=}}"background:&#35;f9f9f9;"|Foo
151 !! endarticle
152
153 !! article
154 Template:table_attribs_4
155 !! text
156 | style="background-color:#DC241f;" width="10px" |
157 !! endarticle
158
159 !! article
160 Template:table_attribs_5
161 !! text
162 <noinclude>
163 |</noinclude>style="color:red;"||Bar
164 !! endarticle
165
166 !! article
167 Template:table_attribs_6
168 !! text
169 style="background: <nowiki>
170
171
172 red;</nowiki>" |
173 !! endarticle
174
175 !! article
176 Template:table_attribs_7
177 !! text
178 <noinclude>
179 |</noinclude>style{{=}}"background:&#35;f9f9f9;"|Foo<ref>foo</ref>
180 !! endarticle
181
182 !! article
183 Template:table_header_cells
184 !! text
185 {{table_attribs}}!!style='color:red;'|''Bar''||style='color:brown;'|''Foo'' and Baz
186 !! endarticle
187
188 !! article
189 Template:table_cells
190 !! text
191 {{table_attribs}}||style='color:red;'|''Bar''||style='color:brown;'|''Foo'' and Baz
192 !! endarticle
193
194 !! article
195 Template:PartialTable
196 !! text
197 {|
198 |-
199 !! endarticle
200
201 !! article
202 Template:image_attribs
203 !! text
204 <noinclude>
205 [[File:foobar.jpg|</noinclude>right|Caption text<noinclude>]]</noinclude>
206 !! endarticle
207
208 ## See T48811 for details
209 !! article
210 Template:mixed_attr_content_template
211 !! text
212 style="color:red;" title="T48811"
213 |-
214 |foo
215 !! endarticle
216
217 !! article
218 Template:definition_list
219 !! text
220 one
221 ::two
222 !! endarticle
223
224 !! article
225 A?b
226 !! text
227 Weirdo titles!
228 !! endarticle
229
230 !!article
231 Template:Bullet
232 !!text
233 * Bar
234 !!endarticle
235
236 !!article
237 Template:OpenTable
238 !!text
239 {|
240 !!endarticle
241
242 !!article
243 Template:EmptyLITest
244 !!text
245 *a
246 *
247 *
248 *b
249 !!endarticle
250
251 !!article
252 Template:EmptyTRTest
253 !!text
254 {|
255 |-
256 |-
257 |foo
258 |-
259 |-
260 |bar
261 |}
262 !!endarticle
263
264 !!article
265 Template:EmptyTRWithHTMLAttrTest
266 !!text
267 <table>
268 <tr align="center"></tr>
269 <tr><td>foo</td></tr>
270 <tr align="center"></tr>
271 <tr><td>bar</td></tr>
272 </table>
273 !!endarticle
274
275 !! article
276 Template:CircularRef
277 !! text
278 <ref>{{CircularRef}}</ref>
279 !! endarticle
280
281 ###
282 ### Basic tests
283 ###
284 !! test
285 Blank input
286 !! wikitext
287 !! html
288 !! end
289
290 !! test
291 CircularRef
292 !! wikitext
293 {{CircularRef}}
294 <references />
295 !! html/parsoid
296 <p><span about="#mwt1" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Transclusion mw:Extension/ref" data-parsoid='{"pi":[[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"CircularRef","href":"./Template:CircularRef"},"params":{},"i":0}}]}'><a href="./Main_Page#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></span></p>
297 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><a href="./Main_Page#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text" data-parsoid="{}">Error: Expansion loop detected at <a data-parsoid='{"a":{"href":null},"sa":{"href":"Template:CircularRef"}}'>Template:CircularRef</a></span></li></ol>
298 !! end
299
300 !! test
301 Simple paragraph
302 !! wikitext
303 This is a simple paragraph.
304 !! html
305 <p>This is a simple paragraph.
306 </p>
307 !! end
308
309 !! test
310 Paragraphs with extra newline spacing
311 !! wikitext
312 foo
313
314 bar
315
316
317 baz
318
319
320
321 booz
322 !! html
323 <p>foo
324 </p><p>bar
325 </p><p><br />
326 baz
327 </p><p><br />
328 </p><p>booz
329 </p>
330 !! end
331
332 !! test
333 Paragraphs with newline spacing with comment lines in between
334 !! wikitext
335 ----
336 a
337 <!--foo-->
338 b
339 ----
340 a
341 <!--foo--><!--More than 1 comment, still stripped-->
342 b
343 ----
344 a
345 <!--foo--> <!----> <!-- bar -->
346 b
347 ----
348 a
349 <!--foo-->
350
351 b
352 ----
353 a
354
355 <!--foo-->
356 b
357 ----
358 a
359 <!--foo-->
360
361
362 b
363 ----
364 a
365
366
367 <!--foo-->
368 b
369 ----
370 !! html
371 <hr />
372 <p>a
373 b
374 </p>
375 <hr />
376 <p>a
377 b
378 </p>
379 <hr />
380 <p>a
381 b
382 </p>
383 <hr />
384 <p>a
385 </p><p>b
386 </p>
387 <hr />
388 <p>a
389 </p><p>b
390 </p>
391 <hr />
392 <p>a
393 </p><p><br />
394 b
395 </p>
396 <hr />
397 <p>a
398 </p><p><br />
399 b
400 </p>
401 <hr />
402
403 !! end
404
405 !! test
406 Paragraphs with newline spacing with non-empty white-space lines in between
407 !! wikitext
408 ----
409 a
410
411 b
412 ----
413 a
414
415
416 b
417 ----
418 !! html
419 <hr />
420 <p>a
421 </p><p>b
422 </p>
423 <hr />
424 <p>a
425 </p><p><br />
426 b
427 </p>
428 <hr />
429
430 !! end
431
432 !! test
433 Paragraphs with newline spacing with non-empty mixed comment and white-space lines in between
434 !! wikitext
435 ----
436 a
437 <!--foo-->
438 b
439 ----
440 a
441 <!--foo--><!--More than 1 comment doesn't disable stripping of this line!-->
442 b
443 ----
444 a
445
446 <!--foo-->
447 <!--bar-->
448 b
449 ----
450 a
451
452 <!--foo-->
453 <!--bar-->
454
455 b
456 ----
457 !! html
458 <hr />
459 <p>a
460 b
461 </p>
462 <hr />
463 <p>a
464 b
465 </p>
466 <hr />
467 <p>a
468 </p><p>b
469 </p>
470 <hr />
471 <p>a
472 </p><p><br />
473 b
474 </p>
475 <hr />
476
477 !! end
478
479 !! test
480 Extra newlines: More paragraphs with indented comment
481 !! wikitext
482 a
483
484 <!--boo-->
485
486 b
487 !! html
488 <p>a
489 </p><p><br />
490 b
491 </p>
492 !!end
493
494 !! test
495 Extra newlines followed by heading
496 !! wikitext
497 a
498
499
500
501 =b=
502 [[a]]
503
504
505 =b=
506 !! html
507 <p>a
508 </p><p><br />
509 </p>
510 <h1><span class="mw-headline" id="b">b</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: b">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
511 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
512 </p><p><br />
513 </p>
514 <h1><span class="mw-headline" id="b_2">b</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: b">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
515
516 !! end
517
518 !! test
519 Extra newlines between heading and content are swallowed
520 !! wikitext
521 =b=
522
523
524
525 [[a]]
526 !! html
527 <h1><span class="mw-headline" id="b">b</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: b">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
528 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
529 </p>
530 !! end
531
532 !! test
533 Heading with line break in nowiki
534 !! options
535 parsoid=wt2html
536 !! wikitext
537 == A <nowiki>B
538 C</nowiki> ==
539 !! html
540 <h2><span class="mw-headline" id="A_B.0AC">A B
541 C</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: A B&#10;C">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
542
543 !! html/parsoid
544 <h2 id="A_B.0AC">A <span typeof="mw:Nowiki">B
545 C</span> </h2>
546 !! end
547
548 !! test
549 Parsing an URL
550 !! wikitext
551 http://fr.wikipedia.org/wiki/🍺
552 <!-- EasterEgg we love beer, better be able be able to link to it -->
553 !! html
554 <p><a rel="nofollow" class="external free" href="http://fr.wikipedia.org/wiki/🍺">http://fr.wikipedia.org/wiki/🍺</a>
555 </p>
556 !! end
557
558 # Note that the html+tidy output removes the spaces after the <li>,
559 # which is a bug (https://sourceforge.net/p/tidy/bugs/945/, etc).
560 # This is an issue for all tests with lists. We intentionally do
561 # *not* add html+tidy clauses for these, as we don't want to
562 # document/test the broken behavior. (Parsoid matches the non-tidy
563 # output in these cases.)
564
565 !! test
566 Simple list
567 !! wikitext
568 * Item 1
569 * Item 2
570 !! html
571 <ul><li> Item 1</li>
572 <li> Item 2</li></ul>
573
574 !! end
575
576 !! test
577 Italics and bold
578 !! wikitext
579 * plain
580 * plain''italic''plain
581 * plain''italic''plain''italic''plain
582 * plain'''bold'''plain
583 * plain'''bold'''plain'''bold'''plain
584 * plain''italic''plain'''bold'''plain
585 * plain'''bold'''plain''italic''plain
586 * plain''italic'''bold-italic'''italic''plain
587 * plain'''bold''bold-italic''bold'''plain
588 * plain'''''bold-italic'''italic''plain
589 * plain'''''bold-italic''bold'''plain
590 * plain''italic'''bold-italic'''''plain
591 * plain'''bold''bold-italic'''''plain
592 * plain l'''italic''plain
593 * plain l''''bold''' plain
594 !! html
595 <ul><li> plain</li>
596 <li> plain<i>italic</i>plain</li>
597 <li> plain<i>italic</i>plain<i>italic</i>plain</li>
598 <li> plain<b>bold</b>plain</li>
599 <li> plain<b>bold</b>plain<b>bold</b>plain</li>
600 <li> plain<i>italic</i>plain<b>bold</b>plain</li>
601 <li> plain<b>bold</b>plain<i>italic</i>plain</li>
602 <li> plain<i>italic<b>bold-italic</b>italic</i>plain</li>
603 <li> plain<b>bold<i>bold-italic</i>bold</b>plain</li>
604 <li> plain<i><b>bold-italic</b>italic</i>plain</li>
605 <li> plain<b><i>bold-italic</i>bold</b>plain</li>
606 <li> plain<i>italic<b>bold-italic</b></i>plain</li>
607 <li> plain<b>bold<i>bold-italic</i></b>plain</li>
608 <li> plain l'<i>italic</i>plain</li>
609 <li> plain l'<b>bold</b> plain</li></ul>
610
611 !! end
612
613 # this example taken from the [[simple:Moon]] article (T49326)
614 !! test
615 Italics and possessives (1)
616 !! wikitext
617 obtained by ''[[Lunar Prospector]]'''s gamma-ray spectrometer
618 !! html
619 <p>obtained by <i><a href="/index.php?title=Lunar_Prospector&amp;action=edit&amp;redlink=1" class="new" title="Lunar Prospector (page does not exist)">Lunar Prospector</a>'</i>s gamma-ray spectrometer
620 </p>
621 !! end
622
623 # this example taken from [[en:Flaming Pie]] (T51926)
624 !! test
625 Italics and possessives (2)
626 !! wikitext
627 '''''Flaming Pie''''' is ... released in 1997. In ''Flaming Pie'''s liner notes
628 !! html
629 <p><i><b>Flaming Pie</b></i> is ... released in 1997. In <i>Flaming Pie'</i>s liner notes
630 </p>
631 !! end
632
633 # this example taken from [[en:Dictionary]] (T51926)
634 !! test
635 Italics and possessives (3)
636 !! wikitext
637 The first monolingual dictionary written in a Romance language was ''Sebastián Covarrubias''' ''Tesoro de la lengua castellana o española'', published in 1611 in Madrid. In 1612 the first edition of the ''Vocabolario dell'[[Accademia della Crusca]]'', for Italian, was published. In 1690 in Rotterdam was published, posthumously, the ''Dictionnaire Universel''.
638 !! html
639 <p>The first monolingual dictionary written in a Romance language was <i>Sebastián Covarrubias'</i> <i>Tesoro de la lengua castellana o española</i>, published in 1611 in Madrid. In 1612 the first edition of the <i>Vocabolario dell'<a href="/index.php?title=Accademia_della_Crusca&amp;action=edit&amp;redlink=1" class="new" title="Accademia della Crusca (page does not exist)">Accademia della Crusca</a></i>, for Italian, was published. In 1690 in Rotterdam was published, posthumously, the <i>Dictionnaire Universel</i>.
640 </p>
641 !! end
642
643
644 ###
645 ### 2-quote opening sequence tests
646 ###
647 !! test
648 Italics and bold: 2-quote opening sequence: (2,2)
649 !! wikitext
650 ''foo''
651 !! html
652 <p><i>foo</i>
653 </p>
654 !!end
655
656 !! test
657 Italics and bold: 2-quote opening sequence: (2,3)
658 !! wikitext
659 ''foo'''
660 !! html/*
661 <p><i>foo'</i>
662 </p>
663 !!end
664
665 !! test
666 Italics and bold: 2-quote opening sequence: (2,4)
667 !! options
668 parsoid=wt2html
669 !! wikitext
670 ''foo''''
671 !! html/*
672 <p><i>foo''</i>
673 </p>
674 !!end
675
676 # same html as previous, but wikitext adjusted to match parsoid html2wt
677 !! test
678 Italics and bold: 2-quote opening sequence: (2,4) w/ nowiki
679 !! wikitext
680 ''foo<nowiki>''</nowiki>''
681 !! html
682 <p><i>foo''</i>
683 </p>
684 !! end
685
686 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
687 !! test
688 Italics and bold: 2-quote opening sequence: (2,5)
689 !! options
690 parsoid=wt2html
691 !! wikitext
692 ''foo'''''
693 !! html/php
694 <p><i>foo</i>
695 </p>
696 !! html/parsoid
697 <p><i>foo</i><b></b>
698 </p>
699 !!end
700
701 # same html as previous, but wikitext adjusted to match parsoid html2wt
702 !! test
703 Italics and bold: 2-quote opening sequence: (2,5+3) w/ nowiki
704 !! wikitext
705 ''foo'''''<nowiki/>'''
706 !! html/php
707 <p><i>foo</i>
708 </p>
709 !! html/parsoid
710 <p><i>foo</i><b></b>
711 </p>
712 !! end
713
714
715 ###
716 ### 3-quote opening sequence tests
717 ###
718
719 !! test
720 Italics and bold: 3-quote opening sequence: (3,2)
721 !! wikitext
722 '''foo''
723 !! html/*
724 <p>'<i>foo</i>
725 </p>
726 !!end
727
728 !! test
729 Italics and bold: 3-quote opening sequence: (3,3)
730 !! wikitext
731 '''foo'''
732 !! html
733 <p><b>foo</b>
734 </p>
735 !!end
736
737 !! test
738 Italics and bold: 3-quote opening sequence: (3,4)
739 !! wikitext
740 '''foo''''
741 !! html/*
742 <p><b>foo'</b>
743 </p>
744 !!end
745
746 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
747 !! test
748 Italics and bold: 3-quote opening sequence: (3,5)
749 !! options
750 parsoid=wt2html
751 !! wikitext
752 '''foo'''''
753 !! html/php
754 <p><b>foo</b>
755 </p>
756 !! html/parsoid
757 <p><b>foo</b><i></i>
758 </p>
759 !!end
760
761 # same html as previous, but wikitext adjusted to match parsoid html2wt
762 !! test
763 Italics and bold: 3-quote opening sequence: (3,5+2) w/ nowiki
764 !! wikitext
765 '''foo'''''<nowiki/>''
766 !! html/php
767 <p><b>foo</b>
768 </p>
769 !! html/parsoid
770 <p><b>foo</b><i></i>
771 </p>
772 !! end
773
774
775 ###
776 ### 4-quote opening sequence tests
777 ###
778
779 !! test
780 Italics and bold: 4-quote opening sequence: (4,2)
781 !! options
782 parsoid=wt2html
783 !! wikitext
784 ''''foo''
785 !! html/*
786 <p>''<i>foo</i>
787 </p>
788 !!end
789
790 # same html as previous, but wikitext adjusted to match parsoid html2wt
791 !! test
792 Italics and bold: 4-quote opening sequence: (4,2) w/ nowiki
793 !! wikitext
794 <nowiki>''</nowiki>''foo''
795 !! html
796 <p>''<i>foo</i>
797 </p>
798 !! end
799
800 !! test
801 Italics and bold: 4-quote opening sequence: (4,3)
802 !! wikitext
803 ''''foo'''
804 !! html/*
805 <p>'<b>foo</b>
806 </p>
807 !!end
808
809 !! test
810 Italics and bold: 4-quote opening sequence: (4,4)
811 !! options
812 parsoid=wt2html
813 !! wikitext
814 ''''foo''''
815 !! html/*
816 <p>'<b>foo'</b>
817 </p>
818 !!end
819
820 # same html as previous, but wikitext adjusted to match parsoid html2wt
821 !! test
822 Italics and bold: 4-quote opening sequence: (4,4) w/ nowiki
823 !! wikitext
824 '<nowiki/>'''foo''''
825 !! html
826 <p>'<b>foo'</b>
827 </p>
828 !! end
829
830 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
831 !! test
832 Italics and bold: 4-quote opening sequence: (4,5)
833 !! options
834 parsoid=wt2html
835 !! wikitext
836 ''''foo'''''
837 !! html/php
838 <p>'<b>foo</b>
839 </p>
840 !! html/parsoid
841 <p>'<b>foo</b><i></i>
842 </p>
843 !!end
844
845 # same html as previous, but wikitext adjusted to match parsoid html2wt
846 !! test
847 Italics and bold: 4-quote opening sequence: (4,5+2) w/ nowiki
848 !! wikitext
849 '<nowiki/>'''foo'''''<nowiki/>''
850 !! html/php
851 <p>'<b>foo</b>
852 </p>
853 !! html/parsoid
854 <p>'<b>foo</b><i></i>
855 </p>
856 !! end
857
858
859 ###
860 ### 5-quote opening sequence tests
861 ###
862
863 !! test
864 Italics and bold: 5-quote opening sequence: (5,2)
865 !! options
866 parsoid=wt2html
867 !! wikitext
868 '''''foo''
869 !! html/*
870 <p><b><i>foo</i></b>
871 </p>
872 !!end
873
874 # same html as previous, but wikitext adjusted to match parsoid html2wt
875 !! test
876 Italics and bold: 5-quote opening sequence: (5,2+3)
877 !! wikitext
878 '''''foo'''''
879 !! html/*
880 <p><i><b>foo</b></i>
881 </p>
882 !! end
883
884 !! test
885 Italics and bold: 5-quote opening sequence: (5,3)
886 !! options
887 parsoid=wt2html
888 !! wikitext
889 '''''foo'''
890 !! html/*
891 <p><i><b>foo</b></i>
892 </p>
893 !!end
894
895 # same html as previous, but wikitext adjusted to match parsoid html2wt
896 !! test
897 Italics and bold: 5-quote opening sequence: (5,3+2)
898 !! wikitext
899 '''''foo'''''
900 !! html
901 <p><i><b>foo</b></i>
902 </p>
903 !! end
904
905 !! test
906 Italics and bold: 5-quote opening sequence: (5,4)
907 !! options
908 parsoid=wt2html
909 !! wikitext
910 '''''foo''''
911 !! html/*
912 <p><i><b>foo'</b></i>
913 </p>
914 !!end
915
916 !! test
917 Italics and bold: 5-quote opening sequence: (5,5)
918 !! wikitext
919 '''''foo'''''
920 !! html
921 <p><i><b>foo</b></i>
922 </p>
923 !!end
924
925 !! test
926 Italics and bold: 5-quote opening sequence: (5,6)
927 !! wikitext
928 '''''foo''''''
929 !! html/*
930 <p><i><b>foo'</b></i>
931 </p>
932 !! end
933
934 ###
935 ### multiple quote sequences in a line
936 ###
937
938 !! test
939 Italics and bold: multiple quote sequences: (2,4,2)
940 !! options
941 parsoid=wt2html
942 !! wikitext
943 ''foo''''bar''
944 !! html/*
945 <p><i>foo'<b>bar</b></i>
946 </p>
947 !! end
948
949 # same html as previous, but wikitext adjusted to match parsoid html2wt
950 !! test
951 Italics and bold: multiple quote sequences: (2,4,2+3) w/ nowiki
952 !! wikitext
953 ''foo'<nowiki/>'''bar'''''
954 !! html
955 <p><i>foo'<b>bar</b></i>
956 </p>
957 !! end
958
959 !! test
960 Italics and bold: multiple quote sequences: (2,4,3)
961 !! options
962 parsoid=wt2html
963 !! wikitext
964 ''foo''''bar'''
965 !! html/*
966 <p><i>foo'<b>bar</b></i>
967 </p>
968 !! end
969
970 # same html as previous, but wikitext adjusted to match parsoid html2wt
971 !! test
972 Italics and bold: multiple quote sequences: (2,4,3+2) w/ nowiki
973 !! wikitext
974 ''foo'<nowiki/>'''bar'''''
975 !! html
976 <p><i>foo'<b>bar</b></i>
977 </p>
978 !! end
979
980 !! test
981 Italics and bold: multiple quote sequences: (2,4,4)
982 !! options
983 parsoid=wt2html
984 !! wikitext
985 ''foo''''bar''''
986 !! html/*
987 <p><i>foo'<b>bar'</b></i>
988 </p>
989 !! end
990
991 # same html as previous, but wikitext adjusted to match parsoid html2wt
992 !! test
993 Italics and bold: multiple quote sequences: (2,4,4+2) w/ nowiki
994 !! wikitext
995 ''foo'<nowiki/>'''bar'<nowiki/>'''''
996 !! html
997 <p><i>foo'<b>bar'</b></i>
998 </p>
999 !! end
1000
1001 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
1002 !! test
1003 Italics and bold: multiple quote sequences: (3,4,2)
1004 !! options
1005 parsoid=wt2html
1006 !! wikitext
1007 '''foo''''bar''
1008 !! html/php
1009 <p><b>foo'</b>bar
1010 </p>
1011 !! html/parsoid
1012 <p><b>foo'</b>bar<i></i>
1013 </p>
1014 !! end
1015
1016 # same html as previous, but wikitext adjusted to match parsoid html2wt
1017 !! test
1018 Italics and bold: multiple quote sequences: (3,4,2+2) w/ nowiki
1019 !! wikitext
1020 '''foo''''bar''<nowiki/>''
1021 !! html/php
1022 <p><b>foo'</b>bar
1023 </p>
1024 !! html/parsoid
1025 <p><b>foo'</b>bar<i></i>
1026 </p>
1027 !! end
1028
1029 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
1030 !! test
1031 Italics and bold: multiple quote sequences: (3,4,3)
1032 !! options
1033 parsoid=wt2html
1034 !! wikitext
1035 '''foo''''bar'''
1036 !! html/php
1037 <p><b>foo'</b>bar
1038 </p>
1039 !! html/parsoid
1040 <p><b>foo'</b>bar<b></b>
1041 </p>
1042 !! end
1043
1044 # same html as previous, but wikitext adjusted to match parsoid html2wt
1045 !! test
1046 Italics and bold: multiple quote sequences: (3,4,3+3) w/ nowiki
1047 !! wikitext
1048 '''foo''''bar'''<nowiki/>'''
1049 !! html/php
1050 <p><b>foo'</b>bar
1051 </p>
1052 !! html/parsoid
1053 <p><b>foo'</b>bar<b></b>
1054 </p>
1055 !! end
1056
1057 ###
1058 ### other quote tests
1059 ###
1060 !! test
1061 Italics and bold: other quote tests: (2,3,5)
1062 !! wikitext
1063 ''this is about '''foo's family'''''
1064 !! html
1065 <p><i>this is about <b>foo's family</b></i>
1066 </p>
1067 !!end
1068
1069
1070 !! test
1071 Italics and bold: other quote tests: (2,(3,3),2)
1072 !! wikitext
1073 ''this is about '''foo's''' family''
1074 !! html
1075 <p><i>this is about <b>foo's</b> family</i>
1076 </p>
1077 !!end
1078
1079
1080 !! test
1081 Italics and bold: other quote tests: (3,2,3,2)
1082 !! options
1083 parsoid=wt2html
1084 !! wikitext
1085 '''this is about ''foo'''s family''
1086 !! html/*
1087 <p><b>this is about <i>foo</i></b><i>s family</i>
1088 </p>
1089 !!end
1090
1091
1092 # same html as previous, but wikitext adjusted to match parsoid html2wt
1093 !! test
1094 Italics and bold: other quote tests: (3,2,3+2+2,2)
1095 !! wikitext
1096 '''this is about ''foo'''''<nowiki/>''s family''
1097 !! html
1098 <p><b>this is about <i>foo</i></b><i>s family</i>
1099 </p>
1100 !! end
1101
1102
1103 !! test
1104 Italics and bold: other quote tests: (3,2,3,3)
1105 !! wikitext
1106 '''this is about ''foo'''s family'''
1107 !! html/*
1108 <p>'<i>this is about </i>foo<b>s family</b>
1109 </p>
1110 !!end
1111
1112
1113 !! test
1114 Italics and bold: other quote tests: (3,(2,2),3)
1115 !! wikitext
1116 '''this is about ''foo's'' family'''
1117 !! html
1118 <p><b>this is about <i>foo's</i> family</b>
1119 </p>
1120 !!end
1121
1122
1123 !! test
1124 Italicized possessive
1125 !! wikitext
1126 The ''[[Main Page]]'''s talk page.
1127 !! html/php
1128 <p>The <i><a href="/wiki/Main_Page" title="Main Page">Main Page</a>'</i>s talk page.
1129 </p>
1130 !! html/parsoid
1131 <p>The <i><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a>'</i>s talk page.</p>
1132 !! end
1133
1134 !! test
1135 Parsoid only: Quote balancing context should be restricted to td/th cells on the same wikitext line
1136 (Requires tidy for PHP parser output to be fixed up)
1137 !! options
1138 parsoid=wt2html,wt2wt
1139 !! wikitext
1140 {|
1141 !''a!!''b
1142 |''a||''b
1143 |}
1144 !! html/php+tidy
1145 <table>
1146 <tr>
1147 <th><i>a</i></th>
1148 <th><i>b</i></th>
1149 <td><i>a</i></td>
1150 <td><i>b</i></td>
1151 </tr>
1152 </table>
1153 !! html/parsoid
1154 <table>
1155 <tbody><tr><th><i>a</i></th><th><i>b</i></th>
1156 <td><i>a</i></td><td><i>b</i></td></tr>
1157 </tbody></table>
1158 !! end
1159
1160 ###
1161 ### Non-html5 tags
1162 ###
1163
1164 !! test
1165 Non-html5 tags should be accepted
1166 !! wikitext
1167 <center>''foo''</center>
1168 <big>''foo''</big>
1169 <font>''foo''</font>
1170 <strike>''foo''</strike>
1171 <tt>''foo''</tt>
1172 !! html
1173 <center><i>foo</i></center>
1174 <p><big><i>foo</i></big>
1175 <font><i>foo</i></font>
1176 <strike><i>foo</i></strike>
1177 <tt><i>foo</i></tt>
1178 </p>
1179 !! end
1180
1181 !! test
1182 <wbr> is valid wikitext (T54468)
1183 !! wikitext
1184 <wbr>
1185 !! html
1186 <p><wbr />
1187 </p>
1188 !! end
1189
1190 # <strike> is HTML4, <s> is HTML4/5.
1191 !! test
1192 <s> or <strike> for strikethrough
1193 !! wikitext
1194 <strike>strike</strike>
1195
1196 <s>s</s>
1197 !! html
1198 <p><strike>strike</strike>
1199 </p><p><s>s</s>
1200 </p>
1201 !! end
1202
1203 ## a not permitted
1204 ## i,b,br omitted
1205 !! test
1206 Text-level semantic html elements in wikitext
1207 !! wikitext
1208 <em>text</em>
1209 <strong>text</strong>
1210 <small>text</small>
1211 <s>text</s>
1212 <cite>text</cite>
1213 <q>text</q>
1214 <dfn>text</dfn>
1215 <abbr>text</abbr>
1216 <data>text</data>
1217 <time>text</time>
1218 <code>text</code>
1219 <var>text</var>
1220 <samp>text</samp>
1221 <kbd>text</kbd>
1222 <sub>text</sub>
1223 <u>text</u>
1224 <mark>text</mark>
1225 <ruby><rb>明日</rb><rp>(</rp><rt>Ashita</rt><rp> </rp><rtc>あした</rtc><rp>)</rp></ruby>
1226 <bdi>text</bdi>
1227 <bdo>text</bdo>
1228 <span>text</span>
1229 <wbr />
1230 !! html
1231 <p><em>text</em>
1232 <strong>text</strong>
1233 <small>text</small>
1234 <s>text</s>
1235 <cite>text</cite>
1236 <q>text</q>
1237 <dfn>text</dfn>
1238 <abbr>text</abbr>
1239 <data>text</data>
1240 <time>text</time>
1241 <code>text</code>
1242 <var>text</var>
1243 <samp>text</samp>
1244 <kbd>text</kbd>
1245 <sub>text</sub>
1246 <u>text</u>
1247 <mark>text</mark>
1248 <ruby><rb>明日</rb><rp>(</rp><rt>Ashita</rt><rp> </rp><rtc>あした</rtc><rp>)</rp></ruby>
1249 <bdi>text</bdi>
1250 <bdo>text</bdo>
1251 <span>text</span>
1252 <wbr />
1253 </p>
1254 !! end
1255
1256 # test cases taken from
1257 # https://www.w3.org/TR/html5/text-level-semantics.html#the-ruby-element
1258 !! test
1259 Ruby markup (W3C-style)
1260 !! wikitext
1261 ; Mono-ruby for individual base characters
1262 : <ruby>日<rt>に</rt>本<rt>ほん</rt>語<rt>ご</rt></ruby>
1263 ; Group ruby
1264 : <ruby>今日<rt>きょう</rt></ruby>
1265 ; Jukugo ruby
1266 : <ruby>法<rb>華</rb><rb>経</rb><rt>ほ</rt><rt>け</rt><rt>きょう</rt></ruby>
1267 ; Inline ruby
1268 : <ruby>東<rb>京</rb><rp>(</rp><rt>とう</rt><rt>きょう</rt><rp>)</rp></ruby>
1269 ; Double-sided ruby
1270 : <ruby><rb>旧</rb><rb>金</rb><rb>山</rb><rt>jiù</rt><rt>jīn</rt><rt>shān</rt><rtc>San Francisco</rtc></ruby>
1271 <ruby>
1272 <rb>♥</rb><rtc><rt>Heart</rt></rtc><rtc lang="fr"><rt>Cœur</rt></rtc>
1273 <rb>☘</rb><rtc><rt>Shamrock</rt></rtc><rtc lang="fr"><rt>Trèfle</rt></rtc>
1274 <rb>✶</rb><rtc><rt>Star</rt></rtc><rtc lang="fr"><rt>Étoile</rt></rtc>
1275 </ruby>
1276 !! html
1277 <dl><dt> Mono-ruby for individual base characters</dt>
1278 <dd> <ruby>日<rt>に</rt>本<rt>ほん</rt>語<rt>ご</rt></ruby></dd>
1279 <dt> Group ruby</dt>
1280 <dd> <ruby>今日<rt>きょう</rt></ruby></dd>
1281 <dt> Jukugo ruby</dt>
1282 <dd> <ruby>法<rb>華</rb><rb>経</rb><rt>ほ</rt><rt>け</rt><rt>きょう</rt></ruby></dd>
1283 <dt> Inline ruby</dt>
1284 <dd> <ruby>東<rb>京</rb><rp>(</rp><rt>とう</rt><rt>きょう</rt><rp>)</rp></ruby></dd>
1285 <dt> Double-sided ruby</dt>
1286 <dd> <ruby><rb>旧</rb><rb>金</rb><rb>山</rb><rt>jiù</rt><rt>jīn</rt><rt>shān</rt><rtc>San Francisco</rtc></ruby></dd></dl>
1287 <p><ruby>
1288 <rb>♥</rb><rtc><rt>Heart</rt></rtc><rtc lang="fr"><rt>Cœur</rt></rtc>
1289 <rb>☘</rb><rtc><rt>Shamrock</rt></rtc><rtc lang="fr"><rt>Trèfle</rt></rtc>
1290 <rb>✶</rb><rtc><rt>Star</rt></rtc><rtc lang="fr"><rt>Étoile</rt></rtc>
1291 </ruby>
1292 </p>
1293 !! end
1294
1295 # The next two test different paths in the sanitizer.
1296 !! test
1297 Non-word characters don't terminate tag names (T19663, T42670, T54022)
1298 !! wikitext
1299 <blockquote|>a</blockquote>
1300
1301 <b→> doesn't terminate </b→>
1302
1303 <bä> doesn't terminate </bä>
1304
1305 <boo> doesn't terminate </boo>
1306
1307 <s.foo> doesn't terminate </s.foo>
1308
1309 <sub-ID#1>
1310 !! html
1311 <p>&lt;blockquote|&gt;a&lt;/blockquote&gt;
1312 </p><p>&lt;b→&gt; doesn't terminate &lt;/b→&gt;
1313 </p><p>&lt;bä&gt; doesn't terminate &lt;/bä&gt;
1314 </p><p>&lt;boo&gt; doesn't terminate &lt;/boo&gt;
1315 </p><p>&lt;s.foo&gt; doesn't terminate &lt;/s.foo&gt;
1316 </p><p>&lt;sub-ID#1&gt;
1317 </p>
1318 !! end
1319
1320 # There is a tidy bug here: https://sourceforge.net/p/tidy/bugs/946/
1321 # If the non-word-character tag made it through the sanitizer, tidy
1322 # would munge it up.
1323 !! test
1324 Non-word characters don't terminate tag names + tidy
1325 !! wikitext
1326 <blockquote|>a</blockquote>
1327
1328 <b→> doesn't terminate </b→>
1329
1330 <bä> doesn't terminate </bä>
1331
1332 <boo> doesn't terminate </boo>
1333
1334 <s.foo> doesn't terminate </s.foo>
1335
1336 <sub-ID#1>
1337 !! html+tidy
1338 <p>&lt;blockquote|&gt;a</p>
1339 <p>&lt;b→&gt; doesn't terminate &lt;/b→&gt;</p>
1340 <p>&lt;bä&gt; doesn't terminate &lt;/bä&gt;</p>
1341 <p>&lt;boo&gt; doesn't terminate &lt;/boo&gt;</p>
1342 <p>&lt;s.foo&gt; doesn't terminate &lt;/s.foo&gt;</p>
1343 <p>&lt;sub-ID#1&gt;</p>
1344 !! end
1345
1346 ###
1347 ### See tests/parser/parserTestsParserHook.php for the <tåg> extension)
1348 ### This checks that HTML5 tags (with non-word characters in the tag
1349 ### name) make it safely through the parser -- the Sanitizer will
1350 ### munge them later, as it should.
1351 ###
1352 !! test
1353 Non-word characters are valid in extension tags (T19663)
1354 !! wikitext
1355 <tåg>tåg</tåg>
1356 !! html/php
1357 <pre>
1358 'tåg'
1359 array (
1360 )
1361 </pre>
1362
1363 !! html/parsoid
1364 <pre typeof="mw:Extension/tåg" data-mw='{"name":"tåg","attrs":{},"body":{"extsrc":"tåg"}}' data-parsoid='{}' about="#mwt2"></pre>
1365 !! end
1366
1367 !! test
1368 Isolated close tags should be treated as literal text (T54760)
1369 !! options
1370 parsoid=wt2html
1371 !! wikitext
1372 </b>
1373
1374 <s.foo>s</s>
1375 !! html/php+tidy
1376 <p>&lt;s.foo&gt;s</p>
1377 !! html/parsoid
1378 <p>&lt;s.foo&gt;s</p>
1379 !! end
1380
1381 ###
1382 ### Special characters
1383 ###
1384
1385 !! test
1386 Bare pipe character (T54363)
1387 !! wikitext
1388 |
1389 !! html
1390 <p>|
1391 </p>
1392 !! end
1393
1394 !! test
1395 Bare pipe character from a template (T54363)
1396 !! wikitext
1397 {{pipe}}
1398 !! html
1399 <p>|
1400 </p>
1401 !! end
1402
1403 ###
1404 ### <nowiki> test cases
1405 ###
1406
1407 !! test
1408 <nowiki> unordered list
1409 !! wikitext
1410 <nowiki>* This is not an unordered list item.</nowiki>
1411 !! html/php
1412 <p>* This is not an unordered list item.
1413 </p>
1414 !! html/parsoid
1415 <p><span typeof="mw:Nowiki">* This is not an unordered list item.</span></p>
1416 !! end
1417
1418 !! test
1419 <nowiki> spacing
1420 !! wikitext
1421 <nowiki>Lorem ipsum dolor
1422
1423 sed abit.
1424 sed nullum.
1425
1426 :and a colon
1427 </nowiki>
1428 !! html/php
1429 <p>Lorem ipsum dolor
1430
1431 sed abit.
1432 sed nullum.
1433
1434 :and a colon
1435
1436 </p>
1437 !! html/parsoid
1438 <p><span typeof="mw:Nowiki">Lorem ipsum dolor
1439
1440 sed abit.
1441 sed nullum.
1442
1443 :and a colon
1444 </span></p>
1445 !! end
1446
1447 !! test
1448 Don't parse <nowiki><span class="error"></nowiki> (T149622)
1449 !! wikitext
1450 <nowiki><span class="error"></nowiki>
1451 !! html/php
1452 <p>&lt;span class="error"&gt;
1453 </p>
1454 !! html/parsoid
1455 <p><span typeof="mw:Nowiki">&lt;span class="error"></span></p>
1456 !! end
1457
1458 !! test
1459 nowiki 3
1460 !! wikitext
1461 :There is not nowiki.
1462 :There is <nowiki>nowiki</nowiki>.
1463
1464 #There is not nowiki.
1465 #There is <nowiki>nowiki</nowiki>.
1466
1467 *There is not nowiki.
1468 *There is <nowiki>nowiki</nowiki>.
1469 !! html/php
1470 <dl><dd>There is not nowiki.</dd>
1471 <dd>There is nowiki.</dd></dl>
1472 <ol><li>There is not nowiki.</li>
1473 <li>There is nowiki.</li></ol>
1474 <ul><li>There is not nowiki.</li>
1475 <li>There is nowiki.</li></ul>
1476
1477 !! html/parsoid
1478 <dl><dd data-parsoid='{}'>There is not nowiki.</dd>
1479 <dd data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</dd></dl>
1480
1481 <ol><li data-parsoid='{}'>There is not nowiki.</li>
1482 <li data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</li></ol>
1483
1484 <ul><li data-parsoid='{}'>There is not nowiki.</li>
1485 <li data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</li></ul>
1486 !! end
1487
1488 !! test
1489 Entities inside <nowiki>
1490 !! wikitext
1491 <nowiki>&lt;</nowiki>
1492 !! html/php
1493 <p>&lt;
1494 </p>
1495 !! html/parsoid
1496 <p><span typeof="mw:Nowiki"><span typeof="mw:Entity" data-parsoid='{"src":"&amp;lt;","srcContent":"&lt;"}'>&lt;</span></span></p>
1497 !! end
1498
1499 !! test
1500 Entities inside template parameters
1501 !! wikitext
1502 {{echo|&ndash;}}
1503 !! html/php+tidy
1504 <p>–</p>
1505 !! html/parsoid
1506 <p><span typeof="mw:Transclusion mw:Entity" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&amp;ndash;"}},"i":0}}]}'>&ndash;</span></p>
1507 !! end
1508
1509 !! test
1510 Properly escape nowiki when combined with other wiki markup
1511 !! options
1512 parsoid=html2wt
1513 !! html/parsoid
1514 <p>* &lt;/nowiki&gt; tag</p>
1515 !! wikitext
1516 <nowiki>*</nowiki> <nowiki>&lt;/nowiki&gt;</nowiki> tag
1517 !! end
1518
1519 !! test
1520 T93824: Put escaped HTML tags inside nowiki
1521 !! options
1522 parsoid=html2wt
1523 !! html/parsoid
1524 <p>&lt;h2&gt;foo&lt;/h2&gt;</p>
1525 !! wikitext
1526 <nowiki><h2>foo</h2></nowiki>
1527 !! end
1528
1529 !! test
1530 T71950: 1. Put nowiki as close to cause as possible, even with non-quote escapable chars
1531 !! options
1532 parsoid=html2wt
1533 !! html/parsoid
1534 <p>This text: L'<a rel="mw:WikiLink" href="./Foo">Foo</a>
1535 This text: L''<a rel="mw:WikiLink" href="./Foo">Foo</a>
1536 This text: L'''<a rel="mw:WikiLink" href="./Foo">Foo</a>''</p>
1537 !! wikitext
1538 This text: L'[[Foo]]
1539 This text: L<nowiki>''</nowiki>[[Foo]]
1540 This text: L<nowiki>'''</nowiki>[[Foo]]<nowiki>''</nowiki>
1541 !! end
1542
1543 # This test fails because wikitext whitespace is not normalized before comparing.
1544 !! test
1545 T71950: 2. Put nowiki as close to cause as possible, after ' :'
1546 !! options
1547 parsoid=html2wt
1548 !! html/parsoid
1549 <p>This text : L''<a rel="mw:WikiLink" href="./Foo">Foo</a>
1550 </p>
1551 !! wikitext
1552 This text : L<nowiki>''</nowiki>[[Foo]]
1553 !! end
1554
1555 # This test and the next one are html2wt only as they test that incorrect wikitext
1556 # passed in template arguments gets escaped or wrapped in nowikis where required.
1557 !! test
1558 T71482: Use {{!}} instead of nowiki for single pipe in template argument
1559 !! options
1560 parsoid=html2wt
1561 !! html/parsoid
1562 <p><span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;foo|bar&quot;}},&quot;i&quot;:0}}]}" about="#mwt1"></span>
1563 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;foo|bar |[[&quot;}},&quot;i&quot;:0}}]}" about="#mwt2"></p>
1564 !! wikitext
1565 {{echo|foo{{!}}bar}}
1566 {{echo|<nowiki>foo|bar |[[</nowiki>}}
1567 !! end
1568
1569 !! test
1570 T53961: Output correct nowikis in template arguments
1571 !! options
1572 parsoid=html2wt
1573 !! html/parsoid
1574 <p><span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;a [ b&quot;}},&quot;i&quot;:0}}]}" about="#mwt1"></span>
1575 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;a }} b&quot;}},&quot;i&quot;:0}}]}" about="#mwt2"></span>
1576 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;a [[ b&quot;}},&quot;i&quot;:0}}]}" about="#mwt3"></span>
1577 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;a | {{ ]]&quot;}},&quot;i&quot;:0}}]}" about="#mwt4"></span>
1578 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;a }&quot;}},&quot;i&quot;:0}}]}" about="#mwt5"></span></p>
1579 !! wikitext
1580 {{echo|a [ b}}
1581 {{echo|<nowiki>a }} b</nowiki>}}
1582 {{echo|<nowiki>a [[ b</nowiki>}}
1583 {{echo|<nowiki>a | {{ ]]</nowiki>}}
1584 {{echo|a <nowiki>}</nowiki>}}
1585 !! end
1586
1587 !! test
1588 Cases where "!!" needs nowiki protection
1589 !! options
1590 parsoid=html2wt
1591 !! html/parsoid
1592 <table>
1593 <tr><th>this needs protection !! here</th></tr>
1594 </table>
1595
1596 <table>
1597 <tr><th>this does not need
1598 protection !! here</th></tr>
1599 </table>
1600 !! wikitext
1601 {|
1602 !<nowiki>this needs protection !! here</nowiki>
1603 |}
1604
1605 {|
1606 !this does not need
1607 protection !! here
1608 |}
1609 !! end
1610
1611 ###
1612 ### Comments
1613 ###
1614 !! test
1615 Comments and Indent-Pre
1616 !! wikitext
1617 <!-- comment 1 --> asdf
1618
1619 <!-- comment 1 --> asdf
1620 <!-- comment 2 -->
1621
1622 <!-- comment 1 --> asdf
1623 <!-- comment 2 -->xyz
1624
1625 <!-- comment 1 --> asdf
1626 <!-- comment 2 --> xyz
1627 !! html
1628 <pre>asdf
1629 </pre>
1630 <pre>asdf
1631 </pre>
1632 <pre>asdf
1633 </pre>
1634 <p>xyz
1635 </p>
1636 <pre>asdf
1637 xyz
1638 </pre>
1639 !! end
1640
1641 !! test
1642 Comment test 2a
1643 !! wikitext
1644 asdf
1645 <!-- comment 1 -->
1646 jkl
1647 !! html
1648 <p>asdf
1649 jkl
1650 </p>
1651 !! end
1652
1653 !! test
1654 Comment test 2b
1655 !! wikitext
1656 asdf
1657 <!-- comment 1 -->
1658
1659 jkl
1660 !! html
1661 <p>asdf
1662 </p><p>jkl
1663 </p>
1664 !! end
1665
1666 !! test
1667 Comment test 3
1668 !! wikitext
1669 asdf
1670 <!-- comment 1 -->
1671 <!-- comment 2 -->
1672 jkl
1673 !! html
1674 <p>asdf
1675 jkl
1676 </p>
1677 !! end
1678
1679 !! test
1680 Comment test 4
1681 !! wikitext
1682 asdf<!-- comment 1 -->jkl
1683 !! html
1684 <p>asdfjkl
1685 </p>
1686 !! end
1687
1688 !! test
1689 Comment spacing
1690 !! wikitext
1691 a
1692 <!-- foo --> b <!-- bar -->
1693 c
1694 !! html
1695 <p>a
1696 </p>
1697 <pre> b
1698 </pre>
1699 <p>c
1700 </p>
1701 !! end
1702
1703 !! test
1704 Comment whitespace
1705 !! wikitext
1706 <!-- returns a single newline, not nothing, since the newline after > is not stripped -->
1707 !! html
1708
1709 !! end
1710
1711 !! test
1712 Comment semantics and delimiters
1713 !! wikitext
1714 <!-- --><!----><!-----><!------>
1715 !! html/php
1716
1717 !! html/parsoid
1718 <!-- --><!----><!--&#x2D;--><!--&#x2D;&#x2D;-->
1719 !! end
1720
1721 !! test
1722 Comment semantics and delimiters, redux
1723 !! wikitext
1724 <!-- In SGML every "foo" here would actually show up in the text -- foo -- bar
1725 -- foo -- funky huh? ... -->
1726 !! html/php
1727
1728 !! html/parsoid
1729 <!-- In SGML every "foo" here would actually show up in the text &#x2D;&#x2D; foo &#x2D;&#x2D; bar
1730 &#x2D;&#x2D; foo &#x2D;&#x2D; funky huh? ... -->
1731 !! end
1732
1733 !! test
1734 Comment semantics and delimiters: directors cut
1735 !! wikitext
1736 <!-- ... However we like to keep things simple and somewhat XML-ish so we eat
1737 everything starting with < followed by !-- until the first -- and > we see,
1738 that wouldn't be valid XML however, since in XML -- has to terminate a comment
1739 -->-->
1740 !! html/php
1741 <p>--&gt;
1742 </p>
1743 !! html/parsoid
1744 <!-- ... However we like to keep things simple and somewhat XML&#x2D;ish so we eat
1745 everything starting with < followed by !&#x2D;&#x2D; until the first &#x2D;&#x2D; and &#x3E; we see,
1746 that wouldn't be valid XML however, since in XML &#x2D;&#x2D; has to terminate a comment
1747 --><p>--></p>
1748 !! end
1749
1750 !! test
1751 Comment semantics: nesting
1752 !! wikitext
1753 <!--<!-- no, we're not going to do anything fancy here -->-->
1754 !! html/php
1755 <p>--&gt;
1756 </p>
1757 !! html/parsoid
1758 <!--<!&#x2D;&#x2D; no, we're not going to do anything fancy here --><p>--></p>
1759 !! end
1760
1761 # Parsoid closes the unclosed comment, even if it means a slight
1762 # round-trip diff.
1763 !! test
1764 Comment semantics: unclosed comment at end
1765 !! options
1766 parsoid=wt2html,html2html
1767 !! wikitext
1768 <!--This comment will run out to the end of the document
1769 !! html/php
1770
1771 !! html/parsoid
1772 <!--This comment will run out to the end of the document-->
1773 !! end
1774
1775 !! test
1776 Comment semantics: normalize comments to play nice with XML and browsers
1777 !! wikitext
1778 <!-- Browsers --!> think this is closed -->
1779 <!--> This would normally be text -->
1780 <!---> As would this -->
1781 <!-- XML doesn't like trailing dashes -------->
1782 <!-- Nor doubled hyphens -- anywhere in the data -->
1783 But this is not a comment.
1784 !! html/php
1785 <p>But this is not a comment.
1786 </p>
1787 !! html/parsoid
1788 <!-- Browsers &#x2D;&#x2D;!&#x3E; think this is closed -->
1789 <!--&#x3E; This would normally be text -->
1790 <!--&#x2D;&#x3E; As would this -->
1791 <!-- XML doesn't like trailing dashes &#x2D;&#x2D;&#x2D;&#x2D;&#x2D;&#x2D;-->
1792 <!-- Nor doubled hyphens &#x2D;&#x2D; anywhere in the data -->
1793 <p>But this is not a comment.</p>
1794 !! end
1795
1796 !! test
1797 Comment semantics: round-trip even text which contains encoded -->
1798 !! wikitext
1799 <!-- hello & goodbye - > --&gt; --&amp;gt; --&xx -->
1800 !! html/parsoid
1801 <!-- hello &#x26; goodbye &#x2D; &#x3E; &#x2D;&#x2D;&#x3E; &#x2D;&#x2D;&#x26;gt; &#x2D;&#x2D;&#x26;xx -->
1802 !! end
1803
1804 !! test
1805 Comment in template title
1806 !! wikitext
1807 {{f<!---->oo}}
1808 !! html
1809 <p>FOO
1810 </p>
1811 !! end
1812
1813 !! test
1814 Comment on its own line post-expand
1815 !! wikitext
1816 a
1817 {{blank}}<!---->
1818 b
1819 !! html
1820 <p>a
1821 </p><p>b
1822 </p>
1823 !! end
1824
1825 !! test
1826 Comment on its own line post-expand with non-significant whitespace
1827 !! wikitext
1828 a
1829 {{blank}} <!---->
1830 b
1831 !! html
1832 <p>a
1833 </p><p>b
1834 </p>
1835 !! end
1836
1837 !! test
1838 Multiple comments should still parse as SOL-transparent
1839 !! options
1840 parsoid=wt2html,wt2wt
1841 !! wikitext
1842 <!--c1-->*a
1843 <!--c2--><!--c3--><!--c4-->*b
1844 !! html/php
1845 <ul><li>a</li>
1846 <li>b</li></ul>
1847
1848 !! html/parsoid
1849 <!--c1--><ul>
1850 <li>a
1851 </li>
1852 <!--c2--><!--c3--><!--c4-->
1853 <li>b
1854 </li>
1855 </ul>
1856 !! end
1857
1858 ###
1859 ### paragraph wrapping tests
1860 ###
1861 !! test
1862 No block tags
1863 !! wikitext
1864 a
1865
1866 b
1867 !! html
1868 <p>a
1869 </p><p>b
1870 </p>
1871 !! end
1872
1873 !! test
1874 Block tag on one line (<div>)
1875 !! wikitext
1876 a <div>foo</div>
1877
1878 b
1879 !! html
1880 a <div>foo</div>
1881 <p>b
1882 </p>
1883 !! html+tidy
1884 <p>a</p>
1885 <div>foo</div>
1886 <p>b</p>
1887 !! end
1888
1889 !! test
1890 Block tag on one line (<blockquote>)
1891 !! wikitext
1892 a <blockquote>foo</blockquote>
1893
1894 b
1895 !! html
1896 a <blockquote>foo</blockquote>
1897 <p>b
1898 </p>
1899 !! html+tidy
1900 <p>a</p>
1901 <blockquote>
1902 <p>foo</p>
1903 </blockquote>
1904 <p>b</p>
1905 !! end
1906
1907 !! test
1908 Block tag on both lines (<div>)
1909 !! wikitext
1910 a <div>foo</div>
1911
1912 b <div>foo</div>
1913 !! html
1914 a <div>foo</div>
1915 b <div>foo</div>
1916
1917 !! html+tidy
1918 <p>a</p>
1919 <div>foo</div>
1920 <p>b</p>
1921 <div>foo</div>
1922 !! end
1923
1924 !! test
1925 Block tag on both lines (<blockquote>)
1926 !! wikitext
1927 a <blockquote>foo</blockquote>
1928
1929 b <blockquote>foo</blockquote>
1930 !! html
1931 a <blockquote>foo</blockquote>
1932 b <blockquote>foo</blockquote>
1933
1934 !! html+tidy
1935 <p>a</p>
1936 <blockquote>
1937 <p>foo</p>
1938 </blockquote>
1939 <p>b</p>
1940 <blockquote>
1941 <p>foo</p>
1942 </blockquote>
1943 !! end
1944
1945 !! test
1946 Multiple lines without block tags
1947 !! wikitext
1948 <div>foo</div> a
1949 b
1950 c
1951 d<!--foo--> e
1952 x <div>foo</div> z
1953 !! html
1954 <div>foo</div> a
1955 <p>b
1956 c
1957 d e
1958 </p>
1959 x <div>foo</div> z
1960
1961 !! html+tidy
1962 <div>foo</div>
1963 <p>a</p>
1964 <p>b c d e</p>
1965 <p>x</p>
1966 <div>foo</div>
1967 <p>z</p>
1968 !! end
1969
1970 # Tidy strips out the empty <div> tags. Parsoid doesn't.
1971 # So, we have a separate section for Parsoid. We don't want
1972 # to mimic this stripping behavior in Parsoid. It affects
1973 # editing experience and also requires us to maintain additional
1974 # info for RT-ing.
1975 !! test
1976 Empty lines between lines with block tags
1977 !! wikitext
1978 <div></div>
1979
1980
1981 <div></div>a
1982
1983 b
1984 <div>a</div>b
1985
1986 <div>b</div>d
1987
1988
1989 <div>e</div>
1990 !! html
1991 <div></div>
1992 <p><br />
1993 </p>
1994 <div></div>a
1995 <p>b
1996 </p>
1997 <div>a</div>b
1998 <div>b</div>d
1999 <p><br />
2000 </p>
2001 <div>e</div>
2002
2003 !! html+tidy
2004 <p><br /></p>
2005 <p>a</p>
2006 <p>b</p>
2007 <div>a</div>
2008 <p>b</p>
2009 <div>b</div>
2010 <p>d</p>
2011 <p><br /></p>
2012 <div>e</div>
2013 !! html/parsoid
2014 <div data-parsoid='{"stx":"html"}'></div>
2015
2016 <p><br /></p>
2017 <div data-parsoid='{"stx":"html"}'></div><p>a</p>
2018
2019 <p>b</p>
2020 <div data-parsoid='{"stx":"html"}'>a</div><p>b</p>
2021
2022 <div data-parsoid='{"stx":"html"}'>b</div><p>d</p>
2023
2024 <p><br /></p>
2025 <div data-parsoid='{"stx":"html"}'>e</div>
2026 !! end
2027
2028 ## PHP parser emits output which is broken
2029 !! test
2030 Unclosed HTML p-tags should be handled properly
2031 !! wikitext
2032 <div><p>foo</div>
2033 a
2034
2035 b
2036 !! html/php+tidy
2037 <div>
2038 <p>foo</p>
2039 </div>
2040 <p>a</p>
2041 <p>b</p>
2042 !! html/parsoid
2043 <div data-parsoid='{"stx":"html"}'><p data-parsoid='{"stx":"html", "autoInsertedEnd":true}'>foo</p></div>
2044 <p>a</p>
2045 <p>b</p>
2046 !! end
2047
2048 ## SSS FIXME: I can come up with other scenarios where this doesn't work because
2049 ## of eager output of buffered tokens in the p-wrapper. But, I'm going to ignore
2050 ## them for now.
2051 !! test
2052 1. P-wrapping should leave sol-transparent tags outside p-tags where possible
2053 !! options
2054 parsoid=wt2html
2055 !! wikitext
2056 a [[Category:A1]] [[Category:A2]]
2057 [[Category:A3]]
2058 [[Category:A4]]
2059 !! html/parsoid
2060 <p>a</p>
2061 <link rel="mw:PageProp/Category" href="./Category:A1"/> <link rel="mw:PageProp/Category" href="./Category:A2"/> <link rel="mw:PageProp/Category" href="./Category:A3"/> <link rel="mw:PageProp/Category" href="./Category:A4"/>
2062 !! end
2063
2064 !! test
2065 2. P-wrapping should leave sol-transparent tags outside p-tags where possible
2066 !! options
2067 parsoid=wt2html
2068 !! wikitext
2069 [[Category:A1]]a
2070 !! html/parsoid
2071 <link rel="mw:PageProp/Category" href="./Category:A1"/><p>a</p>
2072 !! end
2073
2074 ###
2075 ### Preformatted text
2076 ###
2077 !! test
2078 Preformatted text
2079 !! wikitext
2080 This is some
2081 Preformatted text
2082 With ''italic''
2083 And '''bold'''
2084 And a [[Main Page|link]]
2085 !! html
2086 <pre>This is some
2087 Preformatted text
2088 With <i>italic</i>
2089 And <b>bold</b>
2090 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
2091 </pre>
2092 !! end
2093
2094 !! test
2095 Tabs don't trigger preformatted text
2096 !! wikitext
2097 This is not
2098 preformatted text.
2099 This is preformatted text.
2100 So is this.
2101 !! html/php
2102 <p> This is not
2103 preformatted text.
2104 </p>
2105 <pre>This is preformatted text.
2106 So is this.
2107 </pre>
2108 !! html/parsoid
2109 <p> This is not
2110 preformatted text.</p>
2111 <pre>This is preformatted text.
2112 So is this.</pre>
2113 !! end
2114
2115 !! test
2116 Space before tab needs nowiki pre protection
2117 !! options
2118 parsoid=html2wt
2119 !! html/parsoid
2120 <p> a</p>
2121 !! wikitext
2122 <nowiki> </nowiki> a
2123 !! end
2124
2125 !! test
2126 Ident preformatting with inline content
2127 !! wikitext
2128 a
2129 ''b''
2130 !! html
2131 <pre>a
2132 <i>b</i>
2133 </pre>
2134 !! end
2135
2136 !! test
2137 <pre> with <nowiki> inside (compatibility with 1.6 and earlier)
2138 !! wikitext
2139 <pre><nowiki>
2140 <b>
2141 <cite>
2142 <em>
2143 </nowiki></pre>
2144 !! html
2145 <pre>
2146 &lt;b&gt;
2147 &lt;cite&gt;
2148 &lt;em&gt;
2149 </pre>
2150
2151 !! end
2152
2153 !! test
2154 Regression with preformatted in <center>
2155 !! wikitext
2156 <center>
2157 Blah
2158 </center>
2159 !! html
2160 <center>
2161 <pre>Blah
2162 </pre>
2163 </center>
2164
2165 !! end
2166
2167 !! test
2168 T54763: Preformatted in <blockquote>
2169 !! wikitext
2170 <blockquote>
2171 Blah
2172 {|
2173 |
2174 indented cell (no pre-wrapping!)
2175 |}
2176 </blockquote>
2177 !! html
2178 <blockquote>
2179 <p> Blah
2180 </p>
2181 <table>
2182 <tr>
2183 <td>
2184 <p> indented cell (no pre-wrapping!)
2185 </p>
2186 </td></tr></table>
2187 </blockquote>
2188
2189 !! end
2190
2191 !! test
2192 T53086: Double newlines in blockquotes should be turned into paragraphs
2193 !! wikitext
2194 <blockquote>
2195 Foo
2196
2197 Bar
2198 </blockquote>
2199 !! html
2200 <blockquote>
2201 <p>Foo
2202 </p><p>Bar
2203 </p>
2204 </blockquote>
2205
2206 !! end
2207
2208 !! test
2209 T17491: <ins>/<del> in blockquote
2210 !! wikitext
2211 <blockquote>
2212 Foo <del>bar</del> <ins>baz</ins> quux
2213 </blockquote>
2214 !! html
2215 <blockquote>
2216 <p>Foo <del>bar</del> <ins>baz</ins> quux
2217 </p>
2218 </blockquote>
2219
2220 !! end
2221
2222 # Note that the p-wrapping is newline sensitive, which could be
2223 # considered a bug: tidy will wrap only the 'Foo' in the example
2224 # below in a <p> tag. (see comment 23-25 of T8200)
2225 !! test
2226 T17491: <ins>/<del> in blockquote (2)
2227 !! wikitext
2228 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
2229 </blockquote>
2230 !! html
2231 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
2232 </blockquote>
2233
2234 !! html+tidy
2235 <blockquote>
2236 <p>Foo</p>
2237 <del>bar</del> <ins>baz</ins> quux</blockquote>
2238 !! end
2239
2240 !! test
2241 <pre> with attributes (T5202)
2242 !! wikitext
2243 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
2244 !! html
2245 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
2246
2247 !! end
2248
2249 !! test
2250 <pre> with width attribute (T5202)
2251 !! wikitext
2252 <pre width="8">Narrow screen goodies</pre>
2253 !! html
2254 <pre width="8">Narrow screen goodies</pre>
2255
2256 !! end
2257
2258 !! test
2259 <pre> with forbidden attribute (T5202)
2260 !! wikitext
2261 <pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
2262 !! html
2263 <pre width="8">Narrow screen goodies</pre>
2264
2265 !! end
2266
2267 !! test
2268 Entities inside <pre>
2269 !! wikitext
2270 <pre>&lt;</pre>
2271 !! html
2272 <pre>&lt;</pre>
2273
2274 !! end
2275
2276 !! test
2277 <pre> with forbidden attribute values (T5202)
2278 !! wikitext
2279 <pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
2280 !! html
2281 <pre width="8" style="/* insecure input */">Narrow screen goodies</pre>
2282
2283 !! end
2284
2285 !! test
2286 <nowiki> inside <pre> (T15238)
2287 !! wikitext
2288 <pre>
2289 <nowiki>
2290 </pre>
2291 <pre>
2292 <nowiki></nowiki>
2293 </pre>
2294 <pre><nowiki><nowiki></nowiki>Foo<nowiki></nowiki></nowiki></pre>
2295 !! html
2296 <pre>
2297 &lt;nowiki&gt;
2298 </pre>
2299 <pre>
2300
2301 </pre>
2302 <pre>&lt;nowiki&gt;Foo&lt;/nowiki&gt;</pre>
2303
2304 !! end
2305
2306 !! test
2307 <nowiki> inside of #tag:pre
2308 !! wikitext
2309 {{#tag:pre|Foo <nowiki>&rarr;bar</nowiki>}}
2310 !! html/php
2311 <pre>Foo &#8594;bar</pre>
2312
2313 !! html/parsoid
2314 <pre about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"#tag:pre","function":"#tag"},"params":{"1":{"wt":"Foo &lt;nowiki>&amp;rarr;bar&lt;/nowiki>"}},"i":0}}]}'>Foo <span typeof="mw:Entity">→</span>bar</pre>
2315 !! end
2316
2317 ## Don't expect this to rt, Parsoid drops the unmatched closing pre tags that
2318 ## aren't enclosed in nowikis.
2319 !! test
2320 <nowiki> and <pre> preference (first one wins)
2321 !! options
2322 parsoid=wt2html
2323 !! wikitext
2324 <pre>
2325 <nowiki>
2326 </pre>
2327 </nowiki>
2328 </pre>
2329
2330 <nowiki>
2331 <pre>
2332 <nowiki>
2333 </pre>
2334 </nowiki>
2335 </pre>
2336
2337 !! html/php
2338 <pre>
2339 &lt;nowiki&gt;
2340 </pre>
2341 <p>&lt;/nowiki&gt;
2342 &lt;/pre&gt;
2343 </p><p>
2344 &lt;pre&gt;
2345 &lt;nowiki&gt;
2346 &lt;/pre&gt;
2347
2348 &lt;/pre&gt;
2349 </p>
2350 !! html/parsoid
2351 <pre typeof="mw:Extension/pre" about="#mwt2" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\n&lt;nowiki>\n"}}'>&lt;nowiki>
2352 </pre>
2353 <p>&lt;/nowiki></p>
2354
2355
2356 <p><span typeof="mw:Nowiki">
2357 &lt;pre>
2358 &lt;nowiki>
2359 &lt;/pre>
2360 </span></p>
2361 !! end
2362
2363 !! test
2364 </pre> inside nowiki
2365 !! wikitext
2366 <nowiki></pre></nowiki>
2367 !! html
2368 <p>&lt;/pre&gt;
2369 </p>
2370 !! end
2371
2372 # Parsoid doesn't strip empty tags, like Tidy does.
2373 !! test
2374 Empty pre; pre inside other HTML tags (T56946)
2375 !! wikitext
2376 a
2377
2378 <div><pre>
2379 foo
2380 </pre></div>
2381 <pre></pre>
2382 !! html/php
2383 <p>a
2384 </p>
2385 <div><pre>
2386 foo
2387 </pre></div>
2388 <pre></pre>
2389
2390 !! html/php+tidy
2391 <p>a</p>
2392 <div>
2393 <pre>
2394 foo
2395 </pre></div>
2396 !! html/parsoid
2397 <p>a</p>
2398
2399 <div data-parsoid='{"stx":"html"}'><pre typeof="mw:Extension/pre" about="#mwt2" data-parsoid='{"stx":"html"}' data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\nfoo\n"}}'>foo
2400 </pre></div>
2401 <pre typeof="mw:Extension/pre" about="#mwt4" data-parsoid='{"stx":"html"}' data-mw='{"name":"pre","attrs":{},"body":{"extsrc":""}}'></pre>
2402 !! end
2403
2404 !! test
2405 HTML pre followed by indent-pre
2406 !! wikitext
2407 <pre>foo</pre>
2408 bar
2409 !! html
2410 <pre>foo</pre>
2411 <pre>bar
2412 </pre>
2413 !! end
2414
2415 # Note that tidy removes the empty <p> tags from the start and end.
2416 # Parsoid does not, by design.
2417 !! test
2418 Block tag pre
2419 !! wikitext
2420 <p><pre>foo</pre></p>
2421 !! html/php+tidy
2422 <pre>
2423 foo
2424 </pre>
2425 !! html/parsoid
2426 <p data-parsoid='{"stx":"html","autoInsertedEnd":true}'></p><pre typeof="mw:Extension/pre" about="#mwt2" data-parsoid='{"stx":"html"}' data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"foo"}}'>foo</pre><p data-parsoid='{"autoInsertedStart":true,"stx":"html"}'></p>
2427 !! end
2428
2429 !!test
2430 Templates: Indent-Pre: 1a. Templates that break a line should suppress <pre>
2431 !! wikitext
2432 {{echo|}}
2433 !! html
2434
2435 !!end
2436
2437 !!test
2438 Templates: Indent-Pre: 1b. Templates that break a line should suppress <pre>
2439 !! wikitext
2440 {{echo|
2441 foo}}
2442 !! html
2443 <p>foo
2444 </p>
2445 !!end
2446
2447 !! test
2448 Templates: Indent-Pre: 1c: Wrapping should be based on expanded content
2449 !! wikitext
2450 {{echo|a
2451 b}}
2452 !! html
2453 <pre>a
2454 </pre>
2455 <p>b
2456 </p>
2457 !!end
2458
2459 !! test
2460 Templates: Indent-Pre: 1d: Wrapping should be based on expanded content
2461 !! wikitext
2462 {{echo|a
2463 b
2464 c
2465 d
2466 e
2467 }}
2468 !! html
2469 <pre>a
2470 </pre>
2471 <p>b
2472 c
2473 </p>
2474 <pre>d
2475 </pre>
2476 <p>e
2477 </p>
2478 !!end
2479
2480 !!test
2481 Templates: Indent-Pre: 1e. Wrapping should be based on expanded content
2482 !! wikitext
2483 {{echo| foo}}
2484
2485 {{echo| foo}}{{echo| bar}}
2486
2487 {{echo| foo}}
2488 {{echo| bar}}
2489
2490 {{echo|<!--cmt--> foo}}
2491
2492 <!--cmt-->{{echo| foo}}
2493
2494 {{echo|{{echo| }}bar}}
2495 !! html
2496 <pre>foo
2497 </pre>
2498 <pre>foo bar
2499 </pre>
2500 <pre>foo
2501 bar
2502 </pre>
2503 <pre>foo
2504 </pre>
2505 <pre>foo
2506 </pre>
2507 <pre>bar
2508 </pre>
2509 !!end
2510
2511 !! test
2512 Templates: Indent-Pre: 1f: Wrapping should be based on expanded content
2513 !! wikitext
2514 {{echo| }}a
2515
2516 {{echo|
2517 }}a
2518
2519 {{echo|
2520 b}}
2521
2522 {{echo|a
2523 }}b
2524
2525 {{echo|a
2526 }} b
2527 !! html
2528 <pre>a
2529 </pre>
2530 <p><br />
2531 </p>
2532 <pre>a
2533 </pre>
2534 <p><br />
2535 </p>
2536 <pre>b
2537 </pre>
2538 <p>a
2539 </p>
2540 <pre>b
2541 </pre>
2542 <p>a
2543 </p>
2544 <pre>b
2545 </pre>
2546 !!end
2547
2548 ## Hmm, should Parsoid rt this?
2549 !! test
2550 Pres with newline attributes
2551 !! options
2552 parsoid=wt2html,html2html
2553 !! wikitext
2554 <pre class="one
2555 two">hi</pre>
2556 !! html/php
2557 <pre class="one two">hi</pre>
2558
2559 !! html/parsoid
2560 <pre typeof="mw:Extension/pre" about="#mwt2" class="one two" data-mw='{"name":"pre","attrs":{"class":"one two"},"body":{"extsrc":"hi"}}'>hi</pre>
2561 !! end
2562
2563 !! test
2564 Things that look like <pre> tags aren't treated as such
2565 !! wikitext
2566 Barack Obama <President> of the United States
2567 <President></President>
2568 !! html
2569 <p>Barack Obama &lt;President&gt; of the United States
2570 &lt;President&gt;&lt;/President&gt;
2571 </p>
2572 !! end
2573
2574 !! test
2575 Handle broken pre-like tags (T66025)
2576 !! options
2577 parsoid=wt2html
2578 !! wikitext
2579 {{echo|<pre <pre>x</pre>}}
2580
2581 <table><pre </table>
2582 !! html/php
2583 <pre>x</pre>
2584 <table>&lt;pre </table>
2585
2586 !! html/php+tidy
2587 <pre>
2588 x
2589 </pre>
2590 <p>&lt;pre</p>
2591 !! html/parsoid
2592 <pre about="#mwt1" typeof="mw:Transclusion mw:Extension/pre" data-parsoid='{"a":{"&lt;pre":null},"sa":{"&lt;pre":""},"stx":"html","pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;pre &lt;pre>x&lt;/pre>"}},"i":0}}]}'>x</pre>
2593
2594
2595 <p>&lt;pre </p>
2596
2597 <table></table>
2598 !! end
2599
2600 !! test
2601 Parsoid: handle pre with space after attribute
2602 !! options
2603 parsoid=wt2html
2604 !! wikitext
2605 <pre style="width:50%;" >{{echo|foo}}</pre>
2606 !! html/php
2607 <pre style="width:50%;">{{echo|foo}}</pre>
2608
2609 !! html/parsoid
2610 <pre typeof="mw:Extension/pre" about="#mwt2" style="width:50%;" data-mw='{"name":"pre","attrs":{"style":"width:50%;"},"body":{"extsrc":"{{echo|foo}}"}}'>{{echo|foo}}</pre>
2611 !! end
2612
2613 # TODO / maybe: fix wt2wt for this
2614 !! test
2615 Parsoid: Don't paragraph-wrap fosterable content
2616 !! options
2617 parsoid=wt2html
2618 !! wikitext
2619 {|
2620 <td></td>
2621 <td></td>
2622
2623
2624
2625 |}
2626 !! html
2627 <table>
2628
2629 <tbody>
2630 <tr>
2631 <td></td>
2632
2633 <td></td></tr>
2634
2635
2636
2637 </tbody></table>
2638 !! end
2639
2640 !! test
2641 Parsoid: Don't paragraph-wrap fosterable content even if table syntax is unbalanced
2642 !! options
2643 parsoid=wt2html
2644 !! wikitext
2645 {|
2646 <td>
2647 <td>
2648 </td>
2649
2650
2651
2652 |}
2653 !! html
2654 <table>
2655
2656 <tbody>
2657 <tr>
2658 <td></td>
2659
2660 <td>
2661 </td></tr>
2662
2663
2664
2665 </tbody></table>
2666 !! end
2667
2668
2669 #--------------------------------------------------------------------
2670 # Transclusion parameter whitespace stripping tests
2671 # Behavior is different for positional and named parameters
2672 #--------------------------------------------------------------------
2673 !! test
2674 Templates: Strip leading and trailing whitespace from named-param values
2675 !! wikitext
2676 {{echo|1= a }}
2677
2678 {{echo|1= {{echo|b}} }}
2679
2680 {{echo| 1 =
2681 c }}
2682
2683 {{echo| 1 =
2684 * d
2685 }}
2686 !! html
2687 <p>a
2688 </p><p>b
2689 </p><p>c
2690 </p>
2691 <ul><li> d</li></ul>
2692
2693 !! end
2694
2695 !! test
2696 Templates: Don't strip whitespace from positional-param values
2697 !! wikitext
2698 {{echo|a }}
2699
2700 {{echo|{{echo|b}} }}
2701
2702 {{echo| c
2703 }}
2704
2705 {{echo| {{echo|d}}
2706 }}
2707
2708 {{echo|
2709 e}}
2710
2711 {{echo|
2712 * f}}
2713
2714 {{echo|
2715 }}g
2716 !! html
2717 <p>a
2718 </p><p>b
2719 </p>
2720 <pre>c
2721 </pre>
2722 <p><br />
2723 </p>
2724 <pre>d
2725 </pre>
2726 <p><br />
2727 </p>
2728 <pre>e
2729 </pre>
2730 <p><br />
2731 </p>
2732 <ul><li> f</li></ul>
2733 <p><br />
2734 </p>
2735 <pre>g
2736 </pre>
2737 !! end
2738
2739 !! test
2740 Templates: Don't recognize targets split by newlines
2741 !! options
2742 parsoid=wt2html
2743 !! wikitext
2744 {{ech
2745 o|foo}}
2746 !! html/php
2747 <p>{{ech
2748 o|foo}}
2749 </p>
2750 !! html/parsoid
2751 <p>{{ech
2752 o|foo}}</p>
2753 !! end
2754
2755 !! test
2756 Templates: Recognize targets when newlines and comments don't split the target
2757 !! options
2758 parsoid=wt2html
2759 !! wikitext
2760 {{
2761 <!--X--> ech<!--X-->o<!--X-->
2762 <!--X--> <!--X-->
2763
2764 |foo}}
2765 !! html/php
2766 <p>foo
2767 </p>
2768 !! html/parsoid
2769 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"ech&lt;!--X-->o&lt;!--X--> \n &lt;!--X--> &lt;!--X-->\n\n ","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2770 !! end
2771
2772 !! test
2773 Templates: Handle empty comment-and-ws-only lines correctly
2774 !! wikitext
2775 {{echo|foo
2776 <!--should be ignored-->
2777 <!--should be ignored as well-->
2778 bar}}
2779 !! html/php
2780 <p>foo
2781 bar
2782 </p>
2783 !! html/parsoid
2784 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo\n&lt;!--should be ignored-->\n &lt;!--should be ignored as well-->\nbar"}},"i":0}}]}'>foo <!--should be ignored--> <!--should be ignored as well--> bar</p>
2785 !! end
2786
2787 !! test
2788 Templates: Handle comments in the target
2789 !! wikitext
2790 {{echo
2791 <!-- should be ignored -->
2792 |foo}}
2793
2794 {{echo
2795 <!-- should be ignored and spaces on next line should not trip us up (T147742) -->
2796 |foo}}
2797
2798 {{echo<!-- should be ignored -->
2799 |foo}}
2800
2801 {{echo<!-- should be ignored -->|foo}}
2802
2803 {{<!-- should be ignored -->echo|foo}}
2804 !! html/php
2805 <p>foo
2806 </p><p>foo
2807 </p><p>foo
2808 </p><p>foo
2809 </p><p>foo
2810 </p>
2811 !! html/parsoid
2812 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo\n&lt;!-- should be ignored -->\n","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2813
2814 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo\n&lt;!-- should be ignored and spaces on next line should not trip us up (T147742) -->\n ","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2815
2816 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo&lt;!-- should be ignored -->\n","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2817
2818 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo&lt;!-- should be ignored -->","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2819
2820 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2821 !!end
2822
2823 !! test
2824 Templates: Handle comments in parameter names (T69657)
2825 !! wikitext
2826 {{echo|1
2827 <!-- should be ignored -->
2828 =foo}}
2829
2830 {{echo|
2831 <!-- should be ignored -->
2832 1 = foo}}
2833
2834 {{echo|1<!-- should be ignored -->=foo}}
2835
2836 {{echo|<!-- should be ignored -->1=foo}}
2837 !! html/php
2838 <p>foo
2839 </p><p>foo
2840 </p><p>foo
2841 </p><p>foo
2842 </p>
2843 !! html/parsoid
2844 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo","key":{"wt":"1\n&lt;!-- should be ignored -->"}}},"i":0}}]}'>foo</p>
2845
2846 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo","key":{"wt":"&lt;!-- should be ignored -->\n1"}}},"i":0}}]}'>foo</p>
2847
2848 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo","key":{"wt":"1&lt;!-- should be ignored -->"}}},"i":0}}]}'>foo</p>
2849
2850 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo","key":{"wt":"&lt;!-- should be ignored -->1"}}},"i":0}}]}'>foo</p>
2851 !!end
2852
2853 !! test
2854 Templates: Other wikitext in parameter names (T69657)
2855 !! wikitext
2856 {{echo|''1''=foo}}
2857 !! html/php
2858 <p>{{{1}}}
2859 </p>
2860 !! html/parsoid
2861 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"&#39;&#39;1&#39;&#39;":{"wt":"foo"}},"i":0}}]}'>{{{1}}}</p>
2862 !!end
2863
2864 #--------------------------------------------------------------------
2865 # Transclusion parameter escaping tests
2866 #--------------------------------------------------------------------
2867 !! test
2868 Templates: Parsoid parameter escaping test 1
2869 !! wikitext
2870 {{echo|[foo]|{{echo|[bar]}}}}
2871 !! html/php+tidy
2872 <p>[foo]</p>
2873 !! html/parsoid
2874 <p about="#mwt1" typeof="mw:Transclusion"
2875 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[foo]"},"2":{"wt":"{{echo|[bar]}}"}},"i":0}}]}'>[foo]</p>
2876 !! end
2877
2878 !! test
2879 Parsoid: Pipes in external links in template parameter
2880 !! wikitext
2881 {{echo|[{{echo|http://example.com}} link]}}
2882 !! html/php+tidy
2883 <p><a rel="nofollow" class="external text" href="http://example.com">link</a></p>
2884 !! html/parsoid
2885 <p><a rel="mw:ExtLink" href="http://example.com" about="#mwt31" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[{{echo|http://example.com}} link]"}},"i":0}}]}'>link</a></p>
2886 !! end
2887
2888 !! test
2889 Parsoid: pipe in transclusion parameter
2890 !! wikitext
2891 {{echo|http://foo.com/a&#124;b}}
2892 !! html/php+tidy
2893 <p><a rel="nofollow" class="external free" href="http://foo.com/a%7Cb">http://foo.com/a%7Cb</a></p>
2894 !! html/parsoid
2895 <p><a rel="mw:ExtLink" href="http://foo.com/a%7Cb" about="#mwt1"
2896 typeof="mw:Transclusion"
2897 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"http://foo.com/a&amp;#124;b"}},"i":0}}]}'>http://foo.com/a%7Cb</a></p>
2898 !! end
2899
2900 !! test
2901 Parsoid: Pipe in external link target and content in template parameter
2902 !! options
2903 parsoid=html2wt,wt2wt
2904 !! wikitext
2905 {{echo|[http://foo.com/a&#124;b a&#124;b]}}
2906 !! html/php+tidy
2907 <p><a rel="nofollow" class="external text" href="http://foo.com/a%7Cb">a|b</a></p>
2908 !! html/parsoid
2909 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2910 typeof="mw:Transclusion"
2911 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},
2912 "params":{"1":{"wt":"[http://foo.com/a|b a|b]"}},"i":0}}]}'>a|b</a></p>
2913 !! end
2914
2915 !! test
2916 Parsoid: Pipe in template with nested template in external link target in template parameter (seriously)
2917 !! options
2918 parsoid
2919 !! wikitext
2920 {{echo|[{{fullurl:{{FULLPAGENAME}}|action=edit}} bar]}}
2921 !! html
2922 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[{{fullurl:{{FULLPAGENAME}}|action=edit}} bar]"}},"i":0}}]}'>[Main Page bar]</p>
2923 !! end
2924
2925 !! test
2926 Templates: Don't escape already nowiki-escaped text in template parameters
2927 !! options
2928 parsoid=html2wt,wt2wt
2929 !! wikitext
2930 {{echo|foo<nowiki>|</nowiki>bar}}
2931 {{echo|<nowiki>&lt;div&gt;</nowiki>}}
2932 {{echo|<nowiki></nowiki>}}
2933 !! html/php+tidy
2934 <p>foo|bar &lt;div&gt;</p>
2935 !! html/parsoid
2936 <p><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo<nowiki>|</nowiki>bar"}},"i":0}}]}'}'>foo</span><span typeof="mw:Nowiki" about="#mwt1">|</span><span about="#mwt1">bar</span>
2937 <span typeof="mw:Transclusion mw:Nowiki" about="#mwt2" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<nowiki>&amp;lt;div&amp;gt;</nowiki>"}},"i":0}}]}'><span typeof="mw:Entity">&lt;</span>div<span typeof="mw:Entity">&gt;</span></span>
2938 <span typeof="mw:Transclusion mw:Nowiki" about="#mwt3" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<nowiki></nowiki>"}},"i":0}}]}'></span>
2939 </p>
2940 !! end
2941
2942 ## T54824
2943 !! test
2944 Templates: '=' char in nested transclusions should not trigger nowiki escapes or conversion to named param
2945 !! options
2946 parsoid=html2wt,wt2wt
2947 !! wikitext
2948 {{echo|{{echo|1=bar}}}}
2949 !! html/php+tidy
2950 <p>bar</p>
2951 !! html/parsoid
2952 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"{{echo|1=bar}}"}},"i":0}}]}'>bar</p>
2953 !! end
2954
2955 ## T58733
2956 !! test
2957 Templates parameters with special tokenizing behavior dont get modified because of arg escaping
2958 !! wikitext
2959 {{echo|a : b}}
2960 !! html/php+tidy
2961 <p>a&#160;: b</p>
2962 !! html/parsoid
2963 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a : b"}},"i":0}}]}'>a<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"isDisplayHack":true}'> </span>: b</p>
2964 !! end
2965
2966 ## T73412
2967 !! test
2968 Templates: Preserve blank parameter names
2969 !! wikitext
2970 {{echo|=foo}}
2971 !! html/php+tidy
2972 <p>{{{1}}}</p>
2973 !! html/parsoid
2974 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"":{"wt":"foo"}},"i":0}}]}'>{{{1}}}</p>
2975 !! end
2976
2977 !! test
2978 Templates: Preserve blank parameter names in other positions
2979 !! wikitext
2980 {{blank_param|bar|=foo}}
2981 !! html/php+tidy
2982 <p>bar foo</p>
2983 !! html/parsoid
2984 <p about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"},{"k":"","named":true}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"blank_param","href":"./Template:Blank_param"},"params":{"1":{"wt":"bar"},"":{"wt":"foo"}},"i":0}}]}'>bar
2985 foo</p>
2986 !! end
2987
2988 ###
2989 ### Parsoid-centric tests for testing RT edge cases for pre
2990 ###
2991
2992 !!test
2993 1a. Indent-Pre and Comments
2994 !! wikitext
2995 a
2996 <!--a-->
2997 c
2998 !! html
2999 <pre>a
3000 </pre>
3001 <p>c
3002 </p>
3003 !!end
3004
3005 !!test
3006 1b. Indent-Pre and Comments
3007 !! wikitext
3008 a
3009 <!--a-->
3010 c
3011 !! html
3012 <pre>a
3013 </pre>
3014 <p>c
3015 </p>
3016 !!end
3017
3018 !!test
3019 1c. Indent-Pre and Comments
3020 !! wikitext
3021 <!--a--> a
3022
3023 <!--a--> a
3024 !! html
3025 <pre> a
3026 </pre>
3027 <pre> a
3028 </pre>
3029 !!end
3030
3031 !!test
3032 1d. Indent-Pre and Comments
3033 (Pre-handler currently cannot distinguish between comment/ws order and normalizes them to [comment,ws] order)
3034 !! wikitext
3035 <!--a--> a
3036
3037 <!--b-->b
3038 !! html
3039 <pre>a
3040 </pre>
3041 <pre>b
3042 </pre>
3043 !!end
3044
3045 !!test
3046 2a. Indent-Pre and tables
3047 !! wikitext
3048 {|
3049 |-
3050 !h1!!h2
3051 |foo||bar
3052 |}
3053 !! html
3054 <table>
3055
3056 <tr>
3057 <th>h1</th>
3058 <th>h2
3059 </th>
3060 <td>foo</td>
3061 <td>bar
3062 </td></tr></table>
3063
3064 !!end
3065
3066 !!test
3067 2b. Indent-Pre and tables
3068 !! wikitext
3069 {|
3070 |-
3071 |foo
3072 |}
3073 !! html
3074 <table>
3075
3076 <tr>
3077 <td>foo
3078 </td></tr></table>
3079
3080 !!end
3081
3082 !!test
3083 2c. Indent-Pre and tables (T44252)
3084 !! wikitext
3085 {|
3086 |+ foo
3087 ! | bar
3088 |}
3089 !! html
3090 <table>
3091 <caption> foo
3092 </caption>
3093 <tr>
3094 <th> bar
3095 </th></tr></table>
3096
3097 !!end
3098
3099 !!test
3100 2d. Indent-Pre and tables
3101 !! wikitext
3102 a
3103 {|
3104 | b
3105 |}
3106 !! html/php
3107 <pre>a
3108 </pre>
3109 <table>
3110 <tr>
3111 <td> b
3112 </td></tr></table>
3113
3114 !! html/parsoid
3115 <pre>a</pre>
3116 <table>
3117 <tbody><tr><td> b</td></tr>
3118 </tbody></table>
3119 !!end
3120
3121 !!test
3122 2e. Indent-Pre and table-line syntax
3123 !! wikitext
3124 a
3125 | b
3126 | c
3127 !! html/php
3128 <pre>a
3129 | b
3130 | c
3131 </pre>
3132 !!end
3133
3134 !!test
3135 2f. Indent-pre started by table-line syntax
3136 !! wikitext
3137 a
3138 | b
3139 | c
3140 !! html/php
3141 <p>a
3142 </p>
3143 <pre>| b
3144 | c
3145 </pre>
3146 !! html/parsoid
3147 <p>a</p>
3148 <pre>
3149 | b
3150 | c</pre>
3151 !!end
3152
3153 !! test
3154 2g. Indented table markup mixed with indented pre content (proposed in T8200)
3155 !! wikitext
3156 <table>
3157 <tr>
3158 <td>
3159 Text that should be rendered preformatted
3160 </td>
3161 </tr>
3162 </table>
3163 !! html
3164 <table>
3165 <tr>
3166 <td>
3167 <pre>Text that should be rendered preformatted
3168 </pre>
3169 </td>
3170 </tr>
3171 </table>
3172
3173 !! end
3174
3175 !!test
3176 3a. Indent-Pre and block tags (single-line html)
3177 !! wikitext
3178 a <p> foo </p>
3179 b <div> foo </div>
3180 c <blockquote> foo </blockquote>
3181 <span> foo </span>
3182 !! html
3183 a <p> foo </p>
3184 b <div> foo </div>
3185 c <blockquote> foo </blockquote>
3186 <pre><span> foo </span>
3187 </pre>
3188 !! html/parsoid
3189 <p>a </p><p data-parsoid='{"stx":"html"}'> foo </p>
3190 <p>b </p><div data-parsoid='{"stx":"html"}'> foo </div>
3191 <p>c </p><blockquote data-parsoid='{"stx":"html"}'> foo </blockquote>
3192 <pre><span> foo </span>
3193 </pre>
3194 !! html+tidy
3195 <p>a</p>
3196 <p>foo</p>
3197 <p>b</p>
3198 <div>foo</div>
3199 <p>c</p>
3200 <blockquote>
3201 <p>foo</p>
3202 </blockquote>
3203 <pre>
3204 <span> foo </span>
3205 </pre>
3206 !! end
3207
3208 !!test
3209 3b. Indent-Pre and block tags (multi-line html)
3210 !! wikitext
3211 a <span>foo</span>
3212 b <div> foo </div>
3213 !! html
3214 <pre>a <span>foo</span>
3215 </pre>
3216 b <div> foo </div>
3217
3218 !! html/parsoid
3219 <pre>a <span data-parsoid='{"stx":"html"}'>foo</span></pre>
3220 b <div data-parsoid='{"stx":"html"}'> foo </div>
3221 !! html+tidy
3222 <pre>
3223 a <span>foo</span>
3224 </pre>
3225 <p>b</p>
3226 <div>foo</div>
3227 !!end
3228
3229 !!test
3230 3c. Indent-Pre and block tags (pre-content on separate line)
3231 !! wikitext
3232 <p>
3233 foo
3234 </p>
3235
3236 <div>
3237 foo
3238 </div>
3239
3240 <center>
3241 foo
3242 </center>
3243
3244 <blockquote>
3245 foo
3246 </blockquote>
3247
3248 <blockquote>
3249 <pre>
3250 foo
3251 </pre>
3252 </blockquote>
3253
3254 <table><tr><td>
3255 foo
3256 </td></tr></table>
3257
3258 <ul><li>
3259 foo
3260 </li></ul>
3261
3262 !! html
3263 <p>
3264 foo
3265 </p>
3266 <div>
3267 <pre>foo
3268 </pre>
3269 </div>
3270 <center>
3271 <pre>foo
3272 </pre>
3273 </center>
3274 <blockquote>
3275 <p> foo
3276 </p>
3277 </blockquote>
3278 <blockquote>
3279 <pre>
3280 foo
3281 </pre>
3282 </blockquote>
3283 <table><tr><td>
3284 <pre>foo
3285 </pre>
3286 </td></tr></table>
3287 <ul><li>
3288 foo
3289 </li></ul>
3290
3291 !!end
3292
3293 !! test
3294 4. Indent-Pre and extension tags
3295 !! wikitext
3296 a <tag />
3297 !! html/php
3298 a <pre>
3299 NULL
3300 array (
3301 )
3302 </pre>
3303
3304 !! html/parsoid
3305 a <pre typeof="mw:Extension/tag" about="#mwt2" data-parsoid='{}' data-mw='{"name":"tag","attrs":{},"body":null}'></pre>
3306 !! end
3307
3308 !! test
3309 5. Indent-Pre and html pre
3310 !! wikitext
3311 <pre class="123">hi</pre>
3312 !! html/php
3313 <pre class="123">hi</pre>
3314
3315 !! html/parsoid
3316 <pre typeof="mw:Extension/pre" about="#mwt2" class="123" data-mw='{"name":"pre","attrs":{"class":"123"},"body":{"extsrc":"hi"}}'>hi</pre>
3317 !! end
3318
3319 !!test
3320 Render paragraphs when indent-pre is suppressed in blocklevels
3321 !! wikitext
3322 <blockquote>
3323 foo
3324
3325 bar
3326 </blockquote>
3327 !! html
3328 <blockquote>
3329 <p> foo
3330 </p><p> bar
3331 </p>
3332 </blockquote>
3333
3334 !!end
3335
3336 !!test
3337 4. Multiple spaces at start-of-line
3338 !! wikitext
3339 <p> foo </p>
3340 foo
3341 {|
3342 |foo
3343 |}
3344 !! html
3345 <p> foo </p>
3346 <pre> foo
3347 </pre>
3348 <table>
3349 <tr>
3350 <td>foo
3351 </td></tr></table>
3352
3353 !!end
3354
3355 ## NOTE: the leading white-space chars on empty line are significant
3356 !! test
3357 5a. White-space in indent-pre
3358 !! wikitext
3359 a<br />
3360
3361 b
3362 !! html
3363 <pre>a<br />
3364
3365 b
3366 </pre>
3367 !! end
3368
3369 ## NOTE: the leading white-space chars on empty line are significant
3370 !! test
3371 5b. White-space in indent-pre
3372 !! wikitext
3373 a
3374
3375 b
3376
3377
3378 c
3379 !! html
3380 <pre>a
3381
3382 b
3383
3384
3385 c
3386 </pre>
3387 !! end
3388
3389 !! test
3390 5c. White-space in indent-pre
3391 !! wikitext
3392 ''a''
3393 ''b''
3394 ''c''
3395 !! html
3396 <pre><i>a</i>
3397 <i>b</i>
3398 <i>c</i>
3399 </pre>
3400 !! end
3401
3402 !! test
3403 6. Pre-blocks should extend across lines with leading WS even when there is no wrappable content
3404 !! wikitext
3405 a
3406
3407 <!-- continue -->
3408 b
3409
3410 c
3411
3412 d
3413 !! html
3414 <pre>a
3415
3416 b
3417 </pre>
3418 <pre>c
3419
3420 </pre>
3421 <p>d
3422 </p>
3423 !! end
3424
3425 !! test
3426 7a. Indent-pre and category links
3427 !! options
3428 parsoid=wt2html,wt2wt
3429 !! wikitext
3430 [[Category:foo]] <!-- No pre-wrapping -->
3431 {{echo| [[Category:foo]]}} <!-- No pre-wrapping -->
3432 !! html/php+tidy
3433 !! html/parsoid
3434 <link rel="mw:PageProp/Category" href="./Category:Foo"> <!-- No pre&#x2D;wrapping -->
3435 <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":" [[Category:foo]]"}},"i":0}}]}'> </span><link rel="mw:PageProp/Category" href="./Category:Foo" about="#mwt1"> <!-- No pre&#x2D;wrapping -->
3436 !! end
3437
3438 ## We used to, but no longer wt2wt this test since the default serializer
3439 ## will normalize all categories to serialize on their own line.
3440 ## This wikitext usage is going to be fairly uncommon in production and
3441 ## selser will take care of preserving formatting in those scenarios.
3442 !! test
3443 7b. Indent-pre and category links
3444 !! options
3445 parsoid=wt2html
3446 !! wikitext
3447 [[Category:foo]] a
3448 [[Category:foo]] {{echo|b}}
3449 !! html/parsoid
3450 <pre><link rel="mw:PageProp/Category" href="./Category:Foo"> a
3451 <link rel="mw:PageProp/Category" href="./Category:Foo"> <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"b"}},"i":0}}]}'>b</span></pre>
3452 !! end
3453
3454 !! test
3455 Indent-Pre: Newlines in comments shouldn't affect sol state
3456 !! wikitext
3457 a <!--
3458 foo
3459 --> b
3460 !! html/php+tidy
3461 <p>a b</p>
3462 !! html/parsoid
3463 <p>a <!--
3464 foo
3465 --> b</p>
3466 !! end
3467
3468 ###
3469 ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
3470 ###
3471
3472 !!test
3473 HTML-pre: 1. embedded newlines
3474 !! wikitext
3475 <pre>foo</pre>
3476
3477 <pre>
3478 foo
3479 </pre>
3480
3481 <pre>
3482
3483 foo
3484 </pre>
3485
3486 <pre>
3487
3488
3489 foo
3490 </pre>
3491 !! html/php+tidy
3492 <pre>
3493 foo
3494 </pre>
3495 <pre>
3496 foo
3497 </pre>
3498 <pre>
3499
3500 foo
3501 </pre>
3502 <pre>
3503
3504
3505 foo
3506 </pre>
3507 !! html/parsoid
3508 <pre typeof="mw:Extension/pre" about="#mwt2" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"foo"}}'>foo</pre>
3509
3510 <pre typeof="mw:Extension/pre" about="#mwt4" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\nfoo\n"}}'>foo
3511 </pre>
3512
3513 <pre typeof="mw:Extension/pre" about="#mwt6" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\n\nfoo\n"}}'>
3514
3515 foo
3516 </pre>
3517
3518 <pre typeof="mw:Extension/pre" about="#mwt8" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\n\n\nfoo\n"}}'>
3519
3520
3521 foo
3522 </pre>
3523 !!end
3524
3525 !! test
3526 HTML-pre: big spaces
3527 !! wikitext
3528 <pre>
3529
3530
3531
3532
3533 haha
3534
3535
3536
3537
3538 haha
3539
3540
3541
3542
3543 </pre>
3544 !! html/php+tidy
3545 <pre>
3546
3547
3548
3549
3550 haha
3551
3552
3553
3554
3555 haha
3556
3557
3558
3559
3560 </pre>
3561 !! html/parsoid
3562 <pre typeof="mw:Extension/pre" about="#mwt2" data-parsoid='{"stx":"html"}' data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\n\n\n\n\nhaha\n\n\n\n\nhaha\n\n\n\n\n"}}'>
3563
3564
3565
3566
3567 haha
3568
3569
3570
3571
3572 haha
3573
3574
3575
3576
3577 </pre>
3578 !! end
3579
3580 !!test
3581 HTML-pre: 2: indented text
3582 !! wikitext
3583 <pre>
3584 foo
3585 </pre>
3586 !! html
3587 <pre>
3588 foo
3589 </pre>
3590
3591 !!end
3592
3593 !!test
3594 HTML-pre: 3: other wikitext
3595 !! wikitext
3596 <pre>
3597 * foo
3598 # bar
3599 = no-h =
3600 '' no-italic ''
3601 [[ NoLink ]]
3602 </pre>
3603 !! html/php
3604 <pre>
3605 * foo
3606 # bar
3607 = no-h =
3608 '' no-italic ''
3609 [[ NoLink ]]
3610 </pre>
3611
3612 !! html/parsoid
3613 <pre typeof="mw:Extension/pre" about="#mwt2" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\n* foo\n# bar\n= no-h =\n&#39;&#39; no-italic &#39;&#39;\n[[ NoLink ]]\n"}}'>* foo
3614 # bar
3615 = no-h =
3616 '' no-italic ''
3617 [[ NoLink ]]
3618 </pre>
3619 !!end
3620
3621 ###
3622 ### Definition lists
3623 ###
3624 !! test
3625 Simple definition
3626 !! wikitext
3627 ; name : Definition
3628 !! html
3629 <dl><dt> name&#160;</dt>
3630 <dd> Definition</dd></dl>
3631
3632 !! end
3633
3634 !! test
3635 Definition list for indentation only
3636 !! wikitext
3637 : Indented text
3638 !! html
3639 <dl><dd> Indented text</dd></dl>
3640
3641 !! end
3642
3643 !! test
3644 Definition list with no space
3645 !! wikitext
3646 ;name:Definition
3647 !! html
3648 <dl><dt>name</dt>
3649 <dd>Definition</dd></dl>
3650
3651 !!end
3652
3653 !! test
3654 Definition list with URL link
3655 !! wikitext
3656 ; http://example.com/ : definition
3657 !! html
3658 <dl><dt> <a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&#160;</dt>
3659 <dd> definition</dd></dl>
3660
3661 !! end
3662
3663 !! test
3664 Definition list with bracketed URL link
3665 !! wikitext
3666 ;[http://www.example.com/ Example]:Something about it
3667 !! html
3668 <dl><dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt>
3669 <dd>Something about it</dd></dl>
3670
3671 !! end
3672
3673 !! test
3674 Definition list with wikilink containing colon
3675 !! wikitext
3676 ; [[Help:FAQ]]: The least-read page on Wikipedia
3677 !! html
3678 <dl><dt> <a href="/index.php?title=Help:FAQ&amp;action=edit&amp;redlink=1" class="new" title="Help:FAQ (page does not exist)">Help:FAQ</a></dt>
3679 <dd> The least-read page on Wikipedia</dd></dl>
3680
3681 !! end
3682
3683 # At Brion's and JeLuF's insistence... :)
3684 !! test
3685 Definition list with news link containing colon
3686 !! wikitext
3687 ; news:alt.wikipedia.rox: This isn't even a real newsgroup!
3688 !! html/php
3689 <dl><dt> <a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a></dt>
3690 <dd> This isn't even a real newsgroup!</dd></dl>
3691
3692 !! html/parsoid
3693 <dl><dt> <a rel="mw:ExtLink" href="news:alt.wikipedia.rox" data-parsoid='{"stx":"url"}'>news:alt.wikipedia.rox</a></dt><dd data-parsoid='{"stx":"row"}'> This isn't even a real newsgroup!</dd></dl>
3694 !! end
3695
3696 !! test
3697 Malformed definition list with colon
3698 !! wikitext
3699 ; news:alt.wikipedia.rox -- don't crash or enter an infinite loop
3700 !! html
3701 <dl><dt> <a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a> -- don't crash or enter an infinite loop</dt></dl>
3702
3703 !! end
3704
3705 !! test
3706 Definition lists: colon in external link text
3707 !! wikitext
3708 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
3709 !! html
3710 <dl><dt> <a rel="nofollow" class="external text" href="http://www.wikipedia2.org/">Wikipedia&#160;: The Next Generation</a></dt>
3711 <dd> OK, I made that up</dd></dl>
3712
3713 !! end
3714
3715 !! test
3716 Definition lists: colon in HTML attribute
3717 !! wikitext
3718 ;<b style="display: inline">bold</b>
3719 !! html
3720 <dl><dt><b style="display: inline">bold</b></dt></dl>
3721
3722 !! end
3723
3724 !! test
3725 Definition lists: self-closed tag
3726 !! wikitext
3727 ;one<br/>two : two-line fun
3728 !! html
3729 <dl><dt>one<br />two&#160;</dt>
3730 <dd> two-line fun</dd></dl>
3731
3732 !! end
3733
3734 !! test
3735 Definition lists: ignore colons inside tags
3736 !! wikitext
3737 ;one <b>two : tag <i>fun:</i>:</b>: def
3738 !! html
3739 <dl><dt>one <b>two&#160;: tag <i>fun:</i>:</b></dt>
3740 <dd> def</dd></dl>
3741
3742 !! end
3743
3744 !! test
3745 Definition lists: excess closed tags
3746 !! wikitext
3747 ;one</b>two : bad tag fun
3748 !! html/php+tidy
3749 <dl>
3750 <dt>onetwo&#160;</dt>
3751 <dd>bad tag fun</dd>
3752 </dl>
3753 !! html/parsoid
3754 <dl>
3755 <dt>onetwo</dt>
3756 <dd>bad tag fun</dd>
3757 </dl>
3758 !! end
3759
3760 !! test
3761 T13748: Literal closing tags
3762 !! wikitext
3763 <dl>
3764 <dt>test 1</dt>
3765 <dd>test test test test test</dd>
3766 <dt>test 2</dt>
3767 <dd>test test test test test</dd>
3768 </dl>
3769 !! html
3770 <dl>
3771 <dt>test 1</dt>
3772 <dd>test test test test test</dd>
3773 <dt>test 2</dt>
3774 <dd>test test test test test</dd>
3775 </dl>
3776
3777 !! end
3778
3779 !! test
3780 Definition and unordered list using wiki syntax nested in unordered list using html tags.
3781 !! wikitext
3782 <ul><li>
3783 ; term : description
3784 * unordered
3785 </li></ul>
3786 !! html
3787 <ul><li>
3788 <dl><dt> term&#160;</dt>
3789 <dd> description</dd></dl>
3790 <ul><li> unordered</li></ul>
3791 </li></ul>
3792
3793 !! end
3794
3795 !! test
3796 Definition list with empty definition and following paragraph
3797 !! wikitext
3798 ; term:
3799 Paragraph text
3800 !! html
3801 <dl><dt> term</dt>
3802 <dd></dd></dl>
3803 <p>Paragraph text
3804 </p>
3805 !! end
3806
3807 !! test
3808 Nested definition lists using html syntax
3809 !! wikitext
3810 <dl><dt>x</dt>
3811 <dd>a</dd>
3812 <dd>b</dd></dl>
3813 !! html
3814 <dl><dt>x</dt>
3815 <dd>a</dd>
3816 <dd>b</dd></dl>
3817
3818 !! end
3819
3820 !! test
3821 Definition Lists: No nesting: Multiple dd's
3822 !! wikitext
3823 ;x
3824 :a
3825 :b
3826 !! html
3827 <dl><dt>x</dt>
3828 <dd>a</dd>
3829 <dd>b</dd></dl>
3830
3831 !! end
3832
3833 !! test
3834 Definition Lists: Indentation: Regular
3835 !! wikitext
3836 :i1
3837 ::i2
3838 :::i3
3839 !! html
3840 <dl><dd>i1
3841 <dl><dd>i2
3842 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3843
3844 !! end
3845
3846 !! test
3847 Definition Lists: Indentation: Missing 1st level
3848 !! wikitext
3849 ::i2
3850 :::i3
3851 !! html
3852 <dl><dd><dl><dd>i2
3853 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3854
3855 !! end
3856
3857 !! test
3858 Definition Lists: Indentation: Multi-level indent
3859 !! wikitext
3860 :::i3
3861 !! html
3862 <dl><dd><dl><dd><dl><dd>i3</dd></dl></dd></dl></dd></dl>
3863
3864 !! end
3865
3866 !! test
3867 Definition Lists: Hacky use to indent tables
3868 !! wikitext
3869 ::{|
3870 |foo
3871 |bar
3872 |}
3873 this text
3874 should be left alone
3875 !! html
3876 <dl><dd><dl><dd><table>
3877 <tr>
3878 <td>foo
3879 </td>
3880 <td>bar
3881 </td></tr></table></dd></dl></dd></dl>
3882 <p>this text
3883 should be left alone
3884 </p>
3885 !! end
3886
3887 !! test
3888 Definition Lists: Hacky use to indent tables, with comments (T65979)
3889 !! wikitext
3890 <!-- foo -->
3891 ::{|
3892 |foo
3893 |bar
3894 |}<!-- bar -->
3895 this text
3896 should be left alone
3897 !! html/parsoid
3898 <!-- foo -->
3899 <dl><dd><dl><dd><table><tr>
3900 <td>foo</td>
3901 <td>bar</td>
3902 </tr></table><!-- bar --></dd></dl></dd></dl>
3903 <p>this text
3904 should be left alone</p>
3905 !! end
3906
3907 !! test
3908 Definition Lists: Hacky use to indent tables, with comment before table
3909 !! wikitext
3910 ::<!-- foo -->{|
3911 |foo
3912 |}
3913 !! html/parsoid
3914 <dl><dd><dl><dd><!-- foo --><table><tr>
3915 <td>foo</td>
3916 </tr></table></dd></dl></dd></dl>
3917 !! end
3918
3919 # The trailing whitespace in this test is to catch a regression in
3920 # Parsoid after T54473.
3921 !! test
3922 Definition Lists: Hacky use to indent tables (WS-insensitive)
3923 !! wikitext
3924 : {|
3925 |a
3926 |}
3927 !! html/php
3928 <dl><dd><table>
3929 <tr>
3930 <td>a
3931 </td></tr></table></dd></dl>
3932
3933 !! html/parsoid
3934 <dl><dd> <table>
3935 <tbody><tr><td>a</td></tr>
3936 </tbody></table> </dd></dl>
3937 !! end
3938
3939 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
3940 ## as an empty dt item. It also ignores all but the last ";" when followed
3941 ## by ":" later on. So, ";" are not ignored in ";;;t3" but are ignored in
3942 ## ";;;t3 :d1". So, PHP parser behavior is a little inconsistent wrt multiple
3943 ## ";"s.
3944 ##
3945 ## Ex: ";;t2 ::d2" is transformed into:
3946 ##
3947 ## <dl>
3948 ## <dt>t2 </dt>
3949 ## <dd>
3950 ## <dl>
3951 ## <dt></dt>
3952 ## <dd>d2</dd>
3953 ## </dl>
3954 ## </dd>
3955 ## </dl>
3956 ##
3957 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
3958 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
3959 ##
3960 ## <dl>
3961 ## <dt>
3962 ## <dl>
3963 ## <dt>t2 </dt>
3964 ## <dd>:d2</dd>
3965 ## </dl>
3966 ## </dt>
3967 ## </dl>
3968 ##
3969 ## All Parsoid only definition list tests have this difference.
3970 ##
3971 ## See also: https://phabricator.wikimedia.org/T8569
3972 ## and https://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
3973
3974 !! test
3975 Table / list interaction: indented table with lists in table contents
3976 !! wikitext
3977 :{|
3978 |-
3979 | a
3980 * b
3981 |-
3982 | c
3983 * d
3984 |}
3985 !! html
3986 <dl><dd><table>
3987
3988 <tr>
3989 <td> a
3990 <ul><li> b</li></ul>
3991 </td></tr>
3992 <tr>
3993 <td> c
3994 <ul><li> d</li></ul>
3995 </td></tr></table></dd></dl>
3996
3997 !! end
3998
3999 !!test
4000 Table / list interaction: lists nested in tables nested in indented lists
4001 !! wikitext
4002 :{|
4003 |
4004 :a
4005 :b
4006 |
4007 *c
4008 *d
4009 |}
4010
4011 *e
4012 *f
4013 !! html
4014 <dl><dd><table>
4015 <tr>
4016 <td>
4017 <dl><dd>a</dd>
4018 <dd>b</dd></dl>
4019 </td>
4020 <td>
4021 <ul><li>c</li>
4022 <li>d</li></ul>
4023 </td></tr></table></dd></dl>
4024 <ul><li>e</li>
4025 <li>f</li></ul>
4026
4027 !!end
4028
4029 !! test
4030 Definition Lists: Nesting: Multi-level (Parsoid only)
4031 !! options
4032 parsoid
4033 !! wikitext
4034 ;t1 :d1
4035 ;;t2 ::d2
4036 ;;;t3 :::d3
4037 !! html
4038 <dl>
4039 <dt>t1 </dt>
4040 <dd>d1</dd>
4041 <dt>
4042 <dl>
4043 <dt>t2 </dt>
4044 <dd>:d2</dd>
4045 <dt>
4046 <dl>
4047 <dt>t3 </dt>
4048 <dd>::d3</dd>
4049 </dl>
4050 </dt>
4051 </dl>
4052 </dt>
4053 </dl>
4054
4055
4056 !! end
4057
4058
4059 !! test
4060 Definition Lists: Nesting: Test 2 (Parsoid only)
4061 !! wikitext
4062 ;t1
4063 ::d2
4064 !! html/php+tidy
4065 <dl>
4066 <dt>t1</dt>
4067 <dd>
4068 <dl>
4069 <dd>d2</dd>
4070 </dl>
4071 </dd>
4072 </dl>
4073 !! html/parsoid
4074 <dl>
4075 <dt>t1</dt>
4076 <dd>
4077 <dl>
4078 <dd>d2</dd>
4079 </dl>
4080 </dd>
4081 </dl>
4082
4083 !! end
4084
4085
4086 !! test
4087 Definition Lists: Nesting: Test 3 (Parsoid only)
4088 !! wikitext
4089 :;t1
4090 ::::d2
4091 !! html/php+tidy
4092 <dl>
4093 <dd>
4094 <dl>
4095 <dt>t1</dt>
4096 <dd>
4097 <dl>
4098 <dd>
4099 <dl>
4100 <dd>d2</dd>
4101 </dl>
4102 </dd>
4103 </dl>
4104 </dd>
4105 </dl>
4106 </dd>
4107 </dl>
4108 !! html/parsoid
4109 <dl>
4110 <dd>
4111 <dl>
4112 <dt>t1</dt>
4113 <dd>
4114 <dl>
4115 <dd>
4116 <dl>
4117 <dd>d2</dd>
4118 </dl>
4119 </dd>
4120 </dl>
4121 </dd>
4122 </dl>
4123 </dd>
4124 </dl>
4125
4126 !! end
4127
4128
4129 !! test
4130 Definition Lists: Nesting: Test 4
4131 !! wikitext
4132 ::;t3
4133 :::d3
4134 !! html
4135 <dl><dd><dl><dd><dl><dt>t3</dt>
4136 <dd>d3</dd></dl></dd></dl></dd></dl>
4137
4138 !! end
4139
4140
4141 ## The Parsoid team believes the following three test exposes a
4142 ## bug in the PHP parser. (Parsoid team thinks the PHP parser is
4143 ## wrong to close the <dl> after the <dt> containing the <ul>.)
4144 ## It also exposes a "misfeature" in tidy, which doesn't like
4145 ## <dl> tags with a single <dt> child; it converts the <dt> into
4146 ## a <dd> in that case. (Parsoid leaves the <dt> alone!)
4147 !! test
4148 Definition Lists: Mixed Lists: Test 1
4149 !! wikitext
4150 :;* foo
4151 ::* bar
4152 :; baz
4153 !! html/php
4154 <dl><dd><dl><dt><ul><li> foo</li>
4155 <li> bar</li></ul></dt></dl>
4156 <dl><dt> baz</dt></dl></dd></dl>
4157
4158 !! html/php+tidy
4159 <dl>
4160 <dd>
4161 <dl>
4162 <dd>
4163 <ul>
4164 <li>foo</li>
4165 <li>bar</li>
4166 </ul>
4167 </dd>
4168 </dl>
4169 <dl>
4170 <dt>baz</dt>
4171 </dl>
4172 </dd>
4173 </dl>
4174 !! html/parsoid
4175 <dl>
4176 <dd><dl>
4177 <dt><ul>
4178 <li> foo
4179 </li>
4180 </ul></dt>
4181 <dd><ul>
4182 <li> bar
4183 </li>
4184 </ul></dd>
4185 <dt> baz</dt>
4186 </dl></dd>
4187 </dl>
4188 !! end
4189
4190 !! test
4191 Definition Lists: Mixed Lists: Test 2
4192 !! wikitext
4193 *: d1
4194 *: d2
4195 !! html
4196 <ul><li><dl><dd> d1</dd>
4197 <dd> d2</dd></dl></li></ul>
4198
4199 !! end
4200
4201
4202 !! test
4203 Definition Lists: Mixed Lists: Test 3
4204 !! wikitext
4205 *::: d1
4206 *::: d2
4207 !! html
4208 <ul><li><dl><dd><dl><dd><dl><dd> d1</dd>
4209 <dd> d2</dd></dl></dd></dl></dd></dl></li></ul>
4210
4211 !! end
4212
4213
4214 !! test
4215 Definition Lists: Mixed Lists: Test 4
4216 !! wikitext
4217 *;d1 :d2
4218 *;d3 :d4
4219 !! html
4220 <ul><li><dl><dt>d1&#160;</dt>
4221 <dd>d2</dd>
4222 <dt>d3&#160;</dt>
4223 <dd>d4</dd></dl></li></ul>
4224
4225 !! end
4226
4227
4228 !! test
4229 Definition Lists: Mixed Lists: Test 5
4230 !! wikitext
4231 *:d1
4232 *:: d2
4233 !! html
4234 <ul><li><dl><dd>d1
4235 <dl><dd> d2</dd></dl></dd></dl></li></ul>
4236
4237 !! end
4238
4239
4240 !! test
4241 Definition Lists: Mixed Lists: Test 6
4242 !! wikitext
4243 #*:d1
4244 #*::: d3
4245 !! html
4246 <ol><li><ul><li><dl><dd>d1
4247 <dl><dd><dl><dd> d3</dd></dl></dd></dl></dd></dl></li></ul></li></ol>
4248
4249 !! end
4250
4251
4252 !! test
4253 Definition Lists: Mixed Lists: Test 7
4254 !! wikitext
4255 :* d1
4256 :* d2
4257 !! html
4258 <dl><dd><ul><li> d1</li>
4259 <li> d2</li></ul></dd></dl>
4260
4261 !! end
4262
4263
4264 !! test
4265 Definition Lists: Mixed Lists: Test 8
4266 !! wikitext
4267 :* d1
4268 ::* d2
4269 !! html
4270 <dl><dd><ul><li> d1</li></ul>
4271 <dl><dd><ul><li> d2</li></ul></dd></dl></dd></dl>
4272
4273 !! end
4274
4275
4276 !! test
4277 Definition Lists: Mixed Lists: Test 9
4278 !! wikitext
4279 *;foo :bar
4280 !! html
4281 <ul><li><dl><dt>foo&#160;</dt>
4282 <dd>bar</dd></dl></li></ul>
4283
4284 !! end
4285
4286
4287 !! test
4288 Definition Lists: Mixed Lists: Test 10
4289 !! wikitext
4290 *#;foo :bar
4291 !! html
4292 <ul><li><ol><li><dl><dt>foo&#160;</dt>
4293 <dd>bar</dd></dl></li></ol></li></ul>
4294
4295 !! end
4296
4297 # The Parsoid team disagrees with the PHP parser's seemingly-random
4298 # rules regarding dd/dt on the next two tests. Parsoid is more
4299 # consistent, and recognizes the shared nesting and keeps the
4300 # still-open tags around until the nesting is complete.
4301 # (And tidy again converts <dt> to <dd> before 'bar'.)
4302
4303 !! test
4304 Definition Lists: Mixed Lists: Test 11
4305 !! wikitext
4306 *#*#;*;;foo :bar
4307 *#*#;boo :baz
4308 !! html/php
4309 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt>
4310 <dd><ul><li><dl><dt><dl><dt>bar</dt></dl></dd></dl></li></ul></dd></dl>
4311 <dl><dt>boo&#160;</dt>
4312 <dd>baz</dd></dl></li></ol></li></ul></li></ol></li></ul>
4313
4314 !! html/php+tidy
4315 <ul>
4316 <li>
4317 <ol>
4318 <li>
4319 <ul>
4320 <li>
4321 <ol>
4322 <li>
4323 <dl>
4324 <dt>foo&#160;</dt>
4325 <dd>
4326 <ul>
4327 <li>
4328 <dl>
4329 <dd>
4330 <dl>
4331 <dt>bar</dt>
4332 </dl>
4333 </dd>
4334 </dl>
4335 </li>
4336 </ul>
4337 </dd>
4338 </dl>
4339 <dl>
4340 <dt>boo&#160;</dt>
4341 <dd>baz</dd>
4342 </dl>
4343 </li>
4344 </ol>
4345 </li>
4346 </ul>
4347 </li>
4348 </ol>
4349 </li>
4350 </ul>
4351 !! html/parsoid
4352 <ul>
4353 <li>
4354 <ol>
4355 <li>
4356 <ul>
4357 <li>
4358 <ol>
4359 <li>
4360 <dl>
4361 <dt>
4362 <ul>
4363 <li>
4364 <dl>
4365 <dt>
4366 <dl>
4367 <dt>foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
4368 <dd data-parsoid='{"stx":"row"}'>bar</dd>
4369 </dl></dt>
4370 </dl></li>
4371 </ul></dt>
4372 <dt>boo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
4373 <dd data-parsoid='{"stx":"row"}'>baz</dd>
4374 </dl></li>
4375 </ol></li>
4376 </ul></li>
4377 </ol></li>
4378 </ul>
4379 !! end
4380
4381
4382 # Another case where tidy converts a <dt> to a <dd> (but Parsoid doesn't).
4383 # From whitelist:
4384 # * The test is wrong, there are two colons where there should be :;
4385 # * The PHP parser is wrong to close the <dl> after the <dt> containing the <ul>.
4386 !! test
4387 Definition Lists: Weird Ones: Test 1
4388 !! wikitext
4389 *#;*::;; foo : bar (who uses this?)
4390 !! html/php
4391 <ul><li><ol><li><dl><dt> foo&#160;</dt>
4392 <dd><ul><li><dl><dd><dl><dd><dl><dt><dl><dt> bar (who uses this?)</dt></dl></dd></dl></dd></dl></dd></dl></li></ul></dd></dl></li></ol></li></ul>
4393
4394 !! html/php+tidy
4395 <ul>
4396 <li>
4397 <ol>
4398 <li>
4399 <dl>
4400 <dt>foo&#160;</dt>
4401 <dd>
4402 <ul>
4403 <li>
4404 <dl>
4405 <dd>
4406 <dl>
4407 <dd>
4408 <dl>
4409 <dd>
4410 <dl>
4411 <dt>bar (who uses this?)</dt>
4412 </dl>
4413 </dd>
4414 </dl>
4415 </dd>
4416 </dl>
4417 </dd>
4418 </dl>
4419 </li>
4420 </ul>
4421 </dd>
4422 </dl>
4423 </li>
4424 </ol>
4425 </li>
4426 </ul>
4427 !! html/parsoid
4428 <ul>
4429 <li>
4430 <ol>
4431 <li>
4432 <dl>
4433 <dt>
4434 <ul>
4435 <li>
4436 <dl>
4437 <dd>
4438 <dl>
4439 <dd>
4440 <dl>
4441 <dt>
4442 <dl>
4443 <dt> foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span></dt>
4444 <dd data-parsoid='{"stx":"row"}'> bar (who uses this?)</dd>
4445 </dl></dt>
4446 </dl></dd>
4447 </dl></dd>
4448 </dl></li>
4449 </ul></dt>
4450 </dl></li>
4451 </ol></li>
4452 </ul>
4453 !! end
4454
4455 !! test
4456 Definition Lists: colons occurring in tags
4457 !! wikitext
4458 ;a:b
4459 ;'''a:b'''
4460 ;<i>a:b</i>
4461 ;<span>a:b</span>
4462 ;<div>a:b</div>
4463 ;<div>a
4464 :b</div>
4465 ;{{echo|a:b}}
4466 ;{{echo|''a:b''}}
4467 ;;;''a:b''
4468 !! html+tidy
4469 <dl>
4470 <dt>a</dt>
4471 <dd>b</dd>
4472 <dt><b>a:b</b></dt>
4473 <dt><i>a:b</i></dt>
4474 <dt><span>a:b</span></dt>
4475 <dd>
4476 <div>a:b</div>
4477 </dd>
4478 <dd>
4479 <div>a
4480 <dl>
4481 <dd>b</dd>
4482 </dl>
4483 </div>
4484 </dd>
4485 <dt>a</dt>
4486 <dd>b</dd>
4487 <dt><i>a:b</i></dt>
4488 </dl>
4489 <dl>
4490 <dd>
4491 <dl>
4492 <dd>
4493 <dl>
4494 <dt><i>a:b</i></dt>
4495 </dl>
4496 </dd>
4497 </dl>
4498 </dd>
4499 </dl>
4500 !! html/parsoid
4501 <dl><dt>a</dt><dd data-parsoid='{"stx":"row"}'>b</dd>
4502 <dt><b>a:b</b></dt>
4503 <dt><i data-parsoid='{"stx":"html"}'>a:b</i></dt>
4504 <dt><span data-parsoid='{"stx":"html"}'>a:b</span></dt>
4505 <dt><div data-parsoid='{"stx":"html"}'>a:b</div></dt>
4506 <dt><div data-parsoid='{"stx":"html","autoInsertedEnd":true}'>a</div></dt>
4507 <dd>b</dd>
4508 <dt><span about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a:b"}},"i":0}}]}'>a:b</span></dt>
4509 <dt><i about="#mwt2" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&#39;&#39;a:b&#39;&#39;"}},"i":0}}]}'>a:b</i>
4510 <dl><dt><dl><dt><i>a:b</i></dt></dl></dt></dl></dt></dl>
4511 !! end
4512
4513 !! test
4514 Definition Lists: colons and tables 1
4515 !! wikitext
4516 :{|
4517 | x
4518 |}
4519 :{|
4520 | y
4521 |}
4522 !! html
4523 <dl><dd><table>
4524 <tr>
4525 <td> x
4526 </td></tr></table></dd></dl>
4527 <dl><dd><table>
4528 <tr>
4529 <td> y
4530 </td></tr></table></dd></dl>
4531
4532 !! end
4533
4534 # Parsoid's output (as documented below) differs from php's in this case.
4535 # This is probably a bug. If we fixup parsoid to match php's output, the
4536 # above test should pass and the below test case can be removed. It is
4537 # unclear which output is more desirable.
4538
4539 !! test
4540 Definition Lists: colons and tables 2
4541 !! wikitext
4542 :{|
4543 | x
4544 |}
4545 :{|
4546 | y
4547 |}
4548 !! html/parsoid
4549 <dl><dd><table>
4550 <tr>
4551 <td> x
4552 </td></tr></table></dd>
4553 <dd><table>
4554 <tr>
4555 <td> y
4556 </td></tr></table></dd></dl>
4557 !! end
4558
4559 !! test
4560 Definition Lists: template interaction
4561 !! wikitext
4562 ::{{definition_list}}
4563
4564 :one
4565 ::{{definition_list}}
4566 :::two
4567 :::three
4568 ::four
4569 !! html/parsoid
4570 <dl><dd><dl data-parsoid='{}'><dd about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[]]}' data-mw='{"parts":[":",{"template":{"target":{"wt":"definition_list","href":"./Template:Definition_list"},"params":{},"i":0}}]}'>one</dd><span about="#mwt1">
4571 </span><dd about="#mwt1">two</dd></dl></dd></dl>
4572
4573 <dl><dd data-parsoid='{}'>one
4574 <dl><dd about="#mwt2" typeof="mw:Transclusion" data-parsoid='{"pi":[[]]}' data-mw='{"parts":["::",{"template":{"target":{"wt":"definition_list","href":"./Template:Definition_list"},"params":{},"i":0}},"\n:::two\n:::three"]}'>one</dd><span about="#mwt2">
4575 </span><dd about="#mwt2">two
4576 <dl><dd>two</dd>
4577 <dd>three</dd></dl></dd>
4578 <dd data-parsoid='{}'>four</dd></dl></dd></dl>
4579 !! end
4580
4581
4582 ###
4583 ### External links
4584 ###
4585 !! test
4586 External links: non-bracketed
4587 !! wikitext
4588 Non-bracketed: http://example.com
4589 !! html
4590 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4591 </p>
4592 !! end
4593
4594 # parsoid doesn't explicitly mark autonumbered links, see T55505
4595 !! test
4596 External links: numbered
4597 !! wikitext
4598 Numbered: [http://example.com]
4599 Numbered: [http://example.net]
4600 Numbered: [http://example.com]
4601 !! html/php
4602 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
4603 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
4604 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
4605 </p>
4606 !! html/parsoid
4607 <p>Numbered: <a rel="mw:ExtLink" href="http://example.com"></a>
4608 Numbered: <a rel="mw:ExtLink" href="http://example.net"></a>
4609 Numbered: <a rel="mw:ExtLink" href="http://example.com"></a></p>
4610 !!end
4611
4612 !! test
4613 External links: specified text
4614 !! wikitext
4615 Specified text: [http://example.com link]
4616 !! html
4617 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
4618 </p>
4619 !!end
4620
4621 !! test
4622 External links: trail
4623 !! wikitext
4624 Linktrails should not work for external links: [http://example.com link]s
4625 !! html
4626 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
4627 </p>
4628 !! end
4629
4630 !! test
4631 External links: dollar sign in URL
4632 !! wikitext
4633 http://example.com/1$2345
4634 !! html
4635 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
4636 </p>
4637 !! end
4638
4639 # parsoid doesn't explicitly mark autonumbered links, see T55505
4640 !! test
4641 External links: dollar sign in URL (autonumber)
4642 !! wikitext
4643 [http://example.com/1$2345]
4644 !! html/php
4645 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
4646 </p>
4647 !! html/parsoid
4648 <p><a rel="mw:ExtLink" href="http://example.com/1$2345"></a></p>
4649 !!end
4650
4651 !! test
4652 External links: open square bracket forbidden in URL (T6377)
4653 !! options
4654 parsoid=wt2html,wt2wt,html2html
4655 !! wikitext
4656 http://example.com/1[2345
4657 !! html/php
4658 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
4659 </p>
4660 !! html/parsoid
4661 <p><a rel="mw:ExtLink" href="http://example.com/1">http://example.com/1</a>[2345</p>
4662 !! end
4663
4664 !! test
4665 External links: open square bracket forbidden in URL (named) (T6377)
4666 !! options
4667 parsoid=wt2html,html2html
4668 !! wikitext
4669 [http://example.com/1[2345]
4670 !! html/php
4671 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4672 </p>
4673 !! html/parsoid
4674 <p><a rel="mw:ExtLink" href="http://example.com/1">[2345</a></p>
4675 !!end
4676
4677 # parsoid adds a space before the link name
4678 !! test
4679 External links: open square bracket forbidden in URL (named) (T6377)
4680 Parsoid variant.
4681 !! wikitext
4682 [http://example.com/1 [2345]
4683 !! html
4684 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4685 </p>
4686 !!end
4687
4688 !! test
4689 External links: nowiki in URL link text (T8230)
4690 !! wikitext
4691 [http://example.com/ <nowiki>''example site''</nowiki>]
4692 !! html
4693 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
4694 </p>
4695 !! end
4696
4697 !! test
4698 External links: newline forbidden in text (T8230 regression check)
4699 !! wikitext
4700 [http://example.com/ first
4701 second]
4702 !! html
4703 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
4704 second]
4705 </p>
4706 !!end
4707
4708 !! test
4709 External links: Pipe char between url and text
4710 !! wikitext
4711 [http://example.com | link]
4712 !! html
4713 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
4714 </p>
4715 !!end
4716
4717 !! test
4718 External links: protocol-relative URL in brackets
4719 !! wikitext
4720 [//example.com/ Test]
4721 !! html
4722 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
4723 </p>
4724 !! end
4725
4726 # parsoid doesn't explicitly mark autonumbered links, see T55505
4727 !! test
4728 External links: protocol-relative URL in brackets without text
4729 !! wikitext
4730 [//example.com]
4731 !! html/php
4732 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
4733 </p>
4734 !! html/parsoid
4735 <p><a rel="mw:ExtLink" href="//example.com"></a></p>
4736 !! end
4737
4738 !! test
4739 External links: protocol-relative URL in free text is left alone
4740 !! wikitext
4741 //example.com/Foo
4742 !! html
4743 <p>//example.com/Foo
4744 </p>
4745 !!end
4746
4747 !! test
4748 External links: protocol-relative URL in the middle of a word is left alone (T32269)
4749 !! wikitext
4750 foo//example.com/Foo
4751 !! html
4752 <p>foo//example.com/Foo
4753 </p>
4754 !! end
4755
4756 !! test
4757 External links: with no contents
4758 !! wikitext
4759 [http://en.wikipedia.org/wiki/Foo]
4760
4761 [[wikipedia:Foo|Bar]]
4762
4763 [[wikipedia:Foo|<span>Bar</span>]]
4764 !! html/php
4765 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/wiki/Foo">[1]</a>
4766 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
4767 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo"><span>Bar</span></a>
4768 </p>
4769 !! html/parsoid
4770 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo"></a></p>
4771 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo">Bar</a></p>
4772 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo"><span>Bar</span></a></p>
4773 !! end
4774
4775 !! test
4776 External links: Free with trailing punctuation
4777 !! wikitext
4778 http://example.com,
4779 http://example.com;
4780 http://example.com\
4781 http://example.com.
4782 http://example.com:
4783 http://example.com!
4784 http://example.com?
4785 http://example.com)
4786 http://example.com/url_with_(brackets)
4787 (http://example.com/url_without_brackets)
4788 http://example.com/url_with_entity&amp;
4789 http://example.com/url_with_entity&#x26;
4790 http://example.com/url_with_entity&#038;
4791 http://example.com/url_with_entity&nbsp;
4792 http://example.com/url_with_entity&#xA0;
4793 http://example.com/url_with_entity&#160;
4794 http://example.com/url_with_entity&lt;
4795 http://example.com/url_with_entity&#x3C;
4796 http://example.com/url_with_entity&#60;
4797 !! html/php
4798 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
4799 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>;
4800 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>\
4801 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.
4802 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
4803 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>!
4804 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>?
4805 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
4806 <a rel="nofollow" class="external free" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
4807 (<a rel="nofollow" class="external free" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
4808 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4809 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4810 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4811 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#160;
4812 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#xa0;
4813 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#160;
4814 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&lt;
4815 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#x3c;
4816 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#60;
4817 </p>
4818 !! html/parsoid
4819 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>,
4820 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>;
4821 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>\
4822 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>.
4823 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:
4824 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>!
4825 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>?
4826 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)
4827 <a rel="mw:ExtLink" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
4828 (<a rel="mw:ExtLink" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
4829 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4830 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4831 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4832 <a rel="mw:ExtLink" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span>
4833 <a rel="mw:ExtLink" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#xA0;","srcContent":" "}'> </span>
4834 <a rel="mw:ExtLink" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#160;","srcContent":" "}'> </span>
4835 <a rel="mw:ExtLink" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;lt;","srcContent":"&lt;"}'>&lt;</span>
4836 <a rel="mw:ExtLink" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#x3C;","srcContent":"&lt;"}'>&lt;</span>
4837 <a rel="mw:ExtLink" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#60;","srcContent":"&lt;"}'>&lt;</span></p>
4838 !! end
4839
4840 !! test
4841 External links: tricky Parsoid html2html case
4842 !! options
4843 parsoid=wt2html,wt2wt,html2html
4844 !! wikitext
4845 http://example.com/url_with_entity&amp;amp;
4846 !! html/php
4847 <p><a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;amp">http://example.com/url_with_entity&amp;amp</a>;
4848 </p>
4849 !! html/parsoid
4850 <p><a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;amp">http://example.com/url_with_entity&amp;amp</a>;</p>
4851 !! end
4852
4853 !! test
4854 External links: Free with trailing quotes (T113666)
4855 !! wikitext
4856 '''News:''' Stuff here
4857
4858 news:'a'b''c''d e
4859 !! html/php
4860 <p><b>News:</b> Stuff here
4861 </p><p><a rel="nofollow" class="external free" href="news:'a'b">news:'a'b</a><i>c</i>d e
4862 </p>
4863 !! html/parsoid
4864 <p><b>News:</b> Stuff here</p>
4865 <p><a rel="mw:ExtLink" href="news:'a'b">news:'a'b</a><i>c</i>d e</p>
4866 !! end
4867
4868 !! test
4869 External links: with entity
4870 !! wikitext
4871 [http://&#x20;www.librarieswithoutborders.org Libraries without borders]
4872 !! html/php
4873 <p><a rel="nofollow" class="external text" href="http://+www.librarieswithoutborders.org">Libraries without borders</a>
4874 </p>
4875 !! html/parsoid
4876 <p><a rel="mw:ExtLink" href="http://+www.librarieswithoutborders.org" data-parsoid='{"a":{"href":"http://+www.librarieswithoutborders.org"},"sa":{"href":"http://&amp;#x20;www.librarieswithoutborders.org"}}'>Libraries without borders</a></p>
4877 !! end
4878
4879 !! test
4880 External links: Lone protocols are never linked (T105697)
4881 !! wikitext
4882 http://
4883 http://;
4884 (http://)
4885 bitcoin:
4886 bitcoin:;
4887 (bitcoin:)
4888 !! html
4889 <p>http://
4890 http://;
4891 (http://)
4892 bitcoin:
4893 bitcoin:;
4894 (bitcoin:)
4895 </p>
4896 !! end
4897
4898 !! test
4899 External links: No preceding word characters allowed (T67278)
4900 !! wikitext
4901 NOPEhttp://example.com
4902 N0http://example.com
4903 ok:http://example.com
4904 ok-http://example.com
4905 !! html
4906 <p>NOPEhttp://example.com
4907 N0http://example.com
4908 ok:<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4909 ok-<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4910 </p>
4911 !! end
4912
4913 !! test
4914 External links: nofollow domain exception
4915 !! wikitext
4916 A [https://no-nofollow.org/foobar link], and another [https://example.org link].
4917 !! html
4918 <p>A <a class="external text" href="https://no-nofollow.org/foobar">link</a>, and another <a rel="nofollow" class="external text" href="https://example.org">link</a>.
4919 </p>
4920 !!end
4921
4922 !! test
4923 External image
4924 !! wikitext
4925 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4926 !! html
4927 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png"/>
4928 </p>
4929 !! end
4930
4931 !! test
4932 External image from https
4933 !! wikitext
4934 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4935 !! html
4936 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png"/>
4937 </p>
4938 !! end
4939
4940 !! test
4941 External image (when not allowed)
4942 !! options
4943 wgAllowExternalImages=0
4944 !! wikitext
4945 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4946 !! html
4947 <p>External image: <a rel="nofollow" class="external free" href="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png">http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png</a>
4948 </p>
4949 !! end
4950
4951 !! test
4952 Link to non-http image, no img tag
4953 !! wikitext
4954 Link to non-http image, no img tag: ftp://example.com/test.jpg
4955 !! html
4956 <p>Link to non-http image, no img tag: <a rel="nofollow" class="external free" href="ftp://example.com/test.jpg">ftp://example.com/test.jpg</a>
4957 </p>
4958 !! end
4959
4960 !! test
4961 External links: terminating separator
4962 !! wikitext
4963 Terminating separator: http://example.com/thing,
4964 !! html
4965 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
4966 </p>
4967 !! end
4968
4969 !! test
4970 External links: intervening separator
4971 !! wikitext
4972 Intervening separator: http://example.com/1,2,3
4973 !! html
4974 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
4975 </p>
4976 !! end
4977
4978 !! test
4979 External links: old bug with URL in query
4980 !! wikitext
4981 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
4982 !! html
4983 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
4984 </p>
4985 !! end
4986
4987 !! test
4988 External links: old URL-in-URL bug, mixed protocols
4989 !! wikitext
4990 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
4991 !! html
4992 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
4993 </p>
4994 !!end
4995
4996 # Since Parsoid is starting to emit canonical wikitext for links,
4997 # [http://example.com http://example.com] will not RT back to that
4998 # form anymore.
4999 !! test
5000 External links: URL in text
5001 !! options
5002 parsoid=wt2html
5003 !! wikitext
5004 URL in text: [http://example.com http://example.com]
5005 !! html/php
5006 <p>URL in text: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
5007 </p>
5008 !! html/parsoid
5009 <p>URL in text: <a rel="mw:ExtLink" href="http://example.com">http://example.com</a></p>
5010 !! end
5011
5012 !! test
5013 External links: Clickable images
5014 !! wikitext
5015 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
5016 !! html/php
5017 <p>ja-style clickable images: <a rel="nofollow" class="external text" href="http://example.com"><img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png"/></a>
5018 </p>
5019 !! html/parsoid
5020 <p>ja-style clickable images: <a rel="mw:ExtLink" href="http://example.com"><img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" data-parsoid='{"type":"extlink"}'/></a></p>
5021 !! end
5022
5023 !! test
5024 External links: raw ampersand
5025 !! wikitext
5026 Old &amp; use: http://x&y
5027 !! html
5028 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
5029 </p>
5030 !! end
5031
5032 !! test
5033 External links: encoded ampersand
5034 !! wikitext
5035 Old &amp; use: http://x&amp;y
5036 !! html/php
5037 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
5038 </p>
5039 !! html/parsoid
5040 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y">http://x&amp;y</a></p>
5041 !! end
5042
5043 !! test
5044 External links: encoded equals (T8102)
5045 !! wikitext
5046 http://example.com/?foo&#61;bar
5047 !! html/php
5048 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
5049 </p>
5050 !! html/parsoid
5051 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a></p>
5052 !! end
5053
5054 ##
5055 ## Note that parsoid doesn't explicit mark autonumbered links, nor
5056 ## does it number them. As discussed in T55505, we can identify
5057 ## autonumbered links via CSS.
5058 ##
5059
5060 !! test
5061 External links: [raw ampersand]
5062 !! wikitext
5063 Old &amp; use: [http://x&y]
5064 !! html/php
5065 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
5066 </p>
5067 !! html/parsoid
5068 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
5069 !! end
5070
5071 # note that parsoid html is identical to [raw ampersand] case; so html2wt
5072 # mode will return the [raw ampersand] wikitext
5073 !! test
5074 External links: [encoded ampersand]
5075 !! options
5076 parsoid=wt2html,wt2wt,html2html
5077 !! wikitext
5078 Old &amp; use: [http://x&amp;y]
5079 !! html/php
5080 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
5081 </p>
5082 !! html/parsoid
5083 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
5084 !! end
5085
5086 !! test
5087 External links: [raw equals]
5088 !! wikitext
5089 [http://example.com/?foo=bar]
5090 !! html/php
5091 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
5092 </p>
5093 !! html/parsoid
5094 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
5095 !! end
5096
5097 # note that parsoid html is identical to [raw equals] case; so html2wt
5098 # mode will return the [raw equals] wikitext
5099 !! test
5100 External links: [encoded equals] (T8102)
5101 !! options
5102 parsoid=wt2html,wt2wt,html2html
5103 !! wikitext
5104 [http://example.com/?foo&#61;bar]
5105 !! html/php
5106 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
5107 </p>
5108 !! html/parsoid
5109 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
5110 !! end
5111
5112 # xxx parsoid strips the IDN character, so the round-trip tests will
5113 # obviously fail and are disabled. --cscott
5114 !! test
5115 External links: [IDN ignored character reference in hostname; strip it right off]
5116 !! options
5117 parsoid=wt2html,wt2wt,html2html
5118 !! wikitext
5119 [http://e&zwnj;xample.com/]
5120 !! html/php
5121 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
5122 </p>
5123 !! html/parsoid
5124 <p><a rel="mw:ExtLink" href="http://example.com/"></a></p>
5125 !! end
5126
5127 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
5128 # Where an external link could easily circumvent the sanitization of the text of
5129 # a link like this (where an IDN-ignore character is in the URL somewhere), this
5130 # test demands a higher standard. That's a bit strange.
5131 #
5132 # Example:
5133 #
5134 # http://e‌xample.com -> [http://example.com|http://example.com]
5135 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
5136 #
5137 # The first example is sanitized, but the second is not. Any security benefits
5138 # from this production are trivial to circumvent. Either remove this test and
5139 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
5140 # the test accordingly.
5141 #
5142 # All our love,
5143 # The Parsoid team.
5144 # xxx parsoid strips the IDN character, so the round-trip tests will
5145 # obviously fail and are disabled. --cscott
5146 !! test
5147 External links: IDN ignored character reference in hostname; strip it right off
5148 !! options
5149 parsoid=wt2html,html2html
5150 !! wikitext
5151 http://e&zwnj;xample.com/
5152 !! html/php
5153 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
5154 </p>
5155 !! html/parsoid
5156 <p><a rel="mw:ExtLink" href="http://example.com/">http://example.com/</a></p>
5157 !! end
5158
5159 !! test
5160 External links: www.jpeg.org (T2554)
5161 !! wikitext
5162 http://www.jpeg.org
5163 !! html
5164 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
5165 </p>
5166 !! end
5167
5168 # parsoid doesn't explicitly mark autonumbered links, see T55505
5169 !! test
5170 External links: URL within URL (T2002)
5171 !! wikitext
5172 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
5173 !! html/php
5174 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
5175 </p>
5176 !! html/parsoid
5177 <p><a rel="mw:ExtLink" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp"></a></p>
5178 !! end
5179
5180 !! test
5181 T2361: URL inside bracketed URL
5182 !! wikitext
5183 [http://www.example.com/foo http://www.example.com/bar]
5184 !! html
5185 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
5186 </p>
5187 !! end
5188
5189 !! test
5190 T2361: URL within URL, not bracketed
5191 !! wikitext
5192 http://www.example.com/foo?=http://www.example.com/bar
5193 !! html
5194 <p><a rel="nofollow" class="external free" href="http://www.example.com/foo?=http://www.example.com/bar">http://www.example.com/foo?=http://www.example.com/bar</a>
5195 </p>
5196 !! end
5197
5198 !! test
5199 T2289: ">"-token in URL-tail
5200 !! wikitext
5201 http://www.example.com/<hello>
5202 !! html
5203 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
5204 </p>
5205 !!end
5206
5207 !! test
5208 T2289: literal ">"-token in URL-tail
5209 !! wikitext
5210 http://www.example.com/<b>html</b>
5211 !! html/php
5212 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
5213 </p>
5214 !! html/parsoid
5215 <p><a rel="mw:ExtLink" href="http://www.example.com/" data-parsoid='{"stx":"url"}'>http://www.example.com/</a><b data-parsoid='{"stx":"html"}'>html</b></p>
5216 !! end
5217
5218 !! test
5219 T2289: ">"-token in bracketed URL
5220 !! wikitext
5221 [http://www.example.com/<hello> stuff]
5222 !! html
5223 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
5224 </p>
5225 !!end
5226
5227 !! test
5228 T2289: literal ">"-token in bracketed URL
5229 !! wikitext
5230 [http://www.example.com/<b>html</b> stuff]
5231 !! html
5232 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
5233 </p>
5234 !!end
5235
5236 !! test
5237 T2289: literal double quote at end of URL
5238 !! wikitext
5239 http://www.example.com/"hello"
5240 !! html
5241 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
5242 </p>
5243 !!end
5244
5245 !! test
5246 T2289: literal double quote in bracketed URL
5247 !! wikitext
5248 [http://www.example.com/"hello" stuff]
5249 !! html
5250 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
5251 </p>
5252 !!end
5253
5254 !! test
5255 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (T7081)
5256 !! wikitext
5257 [http://www.example.com test]
5258 !! html
5259 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
5260 </p>
5261 !! end
5262
5263 !! test
5264 External links: link text with spaces
5265 !! wikitext
5266 [http://www.example.com a b c]
5267 [http://www.example.com ''a'' ''b'']
5268 !! html
5269 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
5270 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
5271 </p>
5272 !! end
5273
5274 !! test
5275 External links: wiki links within external link (T5695)
5276 !! options
5277 parsoid=wt2html,html2html
5278 !! wikitext
5279 [http://example.com [[wikilink]] embedded in ext link]
5280 !! html/php
5281 <p><a rel="nofollow" class="external text" href="http://example.com"></a><a href="/index.php?title=Wikilink&amp;action=edit&amp;redlink=1" class="new" title="Wikilink (page does not exist)">wikilink</a><a rel="nofollow" class="external text" href="http://example.com"> embedded in ext link</a>
5282 </p>
5283 !! html/parsoid
5284 <p><a rel="mw:ExtLink" href="http://example.com"></a><a rel="mw:WikiLink" href="./Wikilink" title="Wikilink">wikilink</a><span> embedded in ext link</span></p>
5285 !! end
5286
5287 !! test
5288 T2787: Links with one slash after the url protocol are invalid
5289 !! wikitext
5290 http:/example.com
5291
5292 [http:/example.com title]
5293 !! html
5294 <p>http:/example.com
5295 </p><p>[http:/example.com title]
5296 </p>
5297 !! end
5298
5299 !! test
5300 Bracketed external links with template-generated invalid target
5301 !! wikitext
5302 [{{echo|http:/example.com}} title]
5303 !! html
5304 <p>[http:/example.com title]
5305 </p>
5306 !! end
5307
5308 # wt2html only because Parsoid would want to add <nowiki>s coming from html
5309 !! test
5310 Broken wikilinks (but not external links) prevent templates from closing
5311 !! options
5312 parsoid=wt2html
5313 !! wikitext
5314 [http://example.com x
5315
5316 {{echo|[http://example.com x}}
5317
5318 [[Foo
5319
5320 {{echo|[[Foo}}
5321 !! html/php
5322 <p>[<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> x
5323 </p><p>[<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> x
5324 </p><p>[[Foo
5325 </p><p>{{echo|[[Foo}}
5326 </p>
5327 !! html/parsoid
5328 <p>[<a rel="mw:ExtLink" href="http://example.com">http://example.com</a> x</p>
5329 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[http://example.com x"}},"i":0}}]}'>[<a rel="mw:ExtLink" href="http://example.com">http://example.com</a> x</p>
5330 <p>[[Foo</p>
5331 <p>{{echo|[[Foo}}</p>
5332 !! end
5333
5334 !! test
5335 Broken templates
5336 !! options
5337 parsoid=wt2html
5338 !! wikitext
5339 {{echo|[[Foo|}}]]
5340
5341 [[Foo|{{echo|]]}}
5342 !! html/php
5343 <p>{{echo|<a href="/wiki/Foo" title="Foo">}}</a>
5344 </p><p>[[Foo|]]
5345 </p>
5346 !! html/parsoid
5347 <p>{{echo|<a rel="mw:WikiLink" href="./Foo" title="Foo">}}</a></p>
5348 <p>[[Foo|<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"]]"}},"i":0}}]}'>]]</span></p>
5349 !! end
5350
5351 !! test
5352 T4702: Mismatched <i>, <b> and <a> tags are invalid
5353 !! wikitext
5354 ''[http://example.com text'']
5355 [http://example.com '''text]'''
5356 ''Something [http://example.com in italic'']
5357 ''Something [http://example.com mixed''''', even bold]'''
5358 '''''Now [http://example.com both''''']
5359 !! html
5360 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
5361 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
5362 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
5363 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
5364 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
5365 </p>
5366 !! end
5367
5368
5369 !! test
5370 T6781: %26 in URL
5371 !! wikitext
5372 http://www.example.com/?title=AT%26T
5373 !! html/php
5374 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
5375 </p>
5376 !! html/parsoid
5377 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a></p>
5378 !! end
5379
5380 # According to https://www.w3.org/TR/2011/WD-html5-20110525/Overview.html#parsing-urls a plain
5381 # % is actually legal in HTML5. Any change in output would need testing though.
5382 !! test
5383 T6781, T7267: %25 in URL
5384 !! wikitext
5385 http://www.example.com/?title=100%25_Bran
5386 !! html/php
5387 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=100%25_Bran">http://www.example.com/?title=100%25_Bran</a>
5388 </p>
5389 !! html/parsoid
5390 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran">http://www.example.com/?title=100%25_Bran</a></p>
5391 !! end
5392
5393 !! test
5394 T6781, T7267: %28, %29 in URL
5395 !! wikitext
5396 http://www.example.com/?title=Ben-Hur_%281959_film%29
5397 !! html/php
5398 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">http://www.example.com/?title=Ben-Hur_%281959_film%29</a>
5399 </p>
5400 !! html/parsoid
5401 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">http://www.example.com/?title=Ben-Hur_%281959_film%29</a></p>
5402 !! end
5403
5404
5405 !! test
5406 T6781: %26 in autonumber URL
5407 !! wikitext
5408 [http://www.example.com/?title=AT%26T]
5409 !! html/php
5410 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
5411 </p>
5412 !! html/parsoid
5413 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T"></a></p>
5414 !! end
5415
5416 !! test
5417 T6781, T7267: %26 in autonumber URL
5418 !! wikitext
5419 [http://www.example.com/?title=100%25_Bran]
5420 !! html/php
5421 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
5422 </p>
5423 !! html/parsoid
5424 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran"></a></p>
5425 !! end
5426
5427 !! test
5428 T6781, T7267: %28, %29 in autonumber URL
5429 !! wikitext
5430 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
5431 !! html/php
5432 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
5433 </p>
5434 !! html/parsoid
5435 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29"></a></p>
5436 !! end
5437
5438
5439 !! test
5440 T6781: %26 in bracketed URL
5441 !! wikitext
5442 [http://www.example.com/?title=AT%26T link]
5443 !! html/php
5444 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
5445 </p>
5446 !! html/parsoid
5447 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">link</a></p>
5448 !! end
5449
5450 !! test
5451 T6781, T7267: %25 in bracketed URL
5452 !! wikitext
5453 [http://www.example.com/?title=100%25_Bran link]
5454 !! html
5455 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
5456 </p>
5457 !! end
5458
5459 !! test
5460 T6781, T7267: %28, %29 in bracketed URL
5461 !! wikitext
5462 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
5463 !! html/php
5464 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
5465 </p>
5466 !! html/parsoid
5467 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a></p>
5468 !! end
5469
5470 !! test
5471 External link containing a period in the anchor. (T65947)
5472 !! wikitext
5473 [//foo.org/bar#baz. bang]
5474
5475 [//foo.org/bar. bang]
5476 !! html/php
5477 <p><a rel="nofollow" class="external text" href="//foo.org/bar#baz.">bang</a>
5478 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar.">bang</a>
5479 </p>
5480 !! html/parsoid
5481 <p><a rel="mw:ExtLink" href="//foo.org/bar#baz.">bang</a></p>
5482 <p><a rel="mw:ExtLink" href="//foo.org/bar.">bang</a></p>
5483 !! end
5484
5485 !! test
5486 External link containing a single quote. (T65947)
5487 !! wikitext
5488 [//foo.org/bar'baz]
5489
5490 [//foo.org/bar'baz bang]
5491 !! html/php
5492 <p><a rel="nofollow" class="external autonumber" href="//foo.org/bar'baz">[1]</a>
5493 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar'baz">bang</a>
5494 </p>
5495 !! html/parsoid
5496 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz"></a></p>
5497 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz">bang</a></p>
5498 !! end
5499
5500 !! test
5501 External link containing double-single-quotes in text '' (T6598 sanity check)
5502 !! wikitext
5503 Some [http://example.com/ pretty ''italics'' and stuff]!
5504 !! html
5505 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
5506 </p>
5507 !! end
5508
5509 !! test
5510 External link containing double-single-quotes in text embedded in italics (T6598 sanity check)
5511 !! wikitext
5512 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
5513 !! html
5514 <p><i>Some </i><a rel="nofollow" class="external text" href="http://example.com/"><i>pretty </i>italics<i> and stuff</i></a><i>!</i>
5515 </p>
5516 !! end
5517
5518 !! test
5519 External link containing double-single-quotes with no space separating the url from text in italics
5520 !! wikitext
5521 [http://www.musee-picasso.fr/pages/page_id18528_u1l2.htm''La muerte de Casagemas'' (1901) en el sitio de [[Museo Picasso (París)|Museo Picasso]].]
5522 !! html/php
5523 <p><a rel="nofollow" class="external text" href="http://www.musee-picasso.fr/pages/page_id18528_u1l2.htm"><i>La muerte de Casagemas</i> (1901) en el sitio de <a href="/index.php?title=Museo_Picasso_(Par%C3%ADs)&amp;action=edit&amp;redlink=1" class="new" title="Museo Picasso (París) (page does not exist)">Museo Picasso</a>.</a>
5524 </p>
5525 !! html/php+tidy
5526 <p><a rel="nofollow" class="external text" href="http://www.musee-picasso.fr/pages/page_id18528_u1l2.htm"><i>La muerte de Casagemas</i> (1901) en el sitio de</a> <a href="/index.php?title=Museo_Picasso_(Par%C3%ADs)&amp;action=edit&amp;redlink=1" class="new" title="Museo Picasso (París) (page does not exist)">Museo Picasso</a>.</p>
5527 !! html/parsoid
5528 <p><a rel="mw:ExtLink" href="http://www.musee-picasso.fr/pages/page_id18528_u1l2.htm"><i>La muerte de Casagemas</i> (1901) en el sitio de </a><a rel="mw:WikiLink" href="./Museo_Picasso_(París)" title="Museo Picasso (París)">Museo Picasso</a><span>.</span></p>
5529 !! end
5530
5531 !! test
5532 External link with comments in link text
5533 !! wikitext
5534 [http://www.google.com Google <!-- comment -->]
5535 !! html/php
5536 <p><a rel="nofollow" class="external text" href="http://www.google.com">Google </a>
5537 </p>
5538 !! html/parsoid
5539 <p><a rel="mw:ExtLink" href="http://www.google.com">Google <!-- comment --></a></p>
5540 !! end
5541
5542 !! test
5543 External link to bare IPv4 address
5544 !! wikitext
5545 [http://192.168.0.1 Link]
5546 !! html/php
5547 <p><a rel="nofollow" class="external text" href="http://192.168.0.1">Link</a>
5548 </p>
5549 !! html/parsoid
5550 <p><a rel="mw:ExtLink" href="http://192.168.0.1">Link</a></p>
5551 !! end
5552
5553 !! test
5554 URL-encoding in URL functions (single parameter)
5555 !! wikitext
5556 {{localurl:Some page|amp=&}}
5557 !! html
5558 <p>/index.php?title=Some_page&amp;amp=&amp;
5559 </p>
5560 !! end
5561
5562 !! test
5563 URL-encoding in URL functions (multiple parameters)
5564 !! wikitext
5565 {{localurl:Some page|q=?&amp=&}}
5566 !! html
5567 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
5568 </p>
5569 !! end
5570
5571 !! test
5572 Brackets in urls
5573 !! wikitext
5574 http://example.com/index.php?foozoid%5B%5D=bar
5575
5576 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
5577 !! html/php
5578 <p><a rel="nofollow" class="external free" href="http://example.com/index.php?foozoid%5B%5D=bar">http://example.com/index.php?foozoid%5B%5D=bar</a>
5579 </p><p><a rel="nofollow" class="external free" href="http://example.com/index.php?foozoid%5B%5D=bar">http://example.com/index.php?foozoid%5B%5D=bar</a>
5580 </p>
5581 !! html/parsoid
5582 <p><a rel="mw:ExtLink" href="http://example.com/index.php?foozoid%5B%5D=bar">http://example.com/index.php?foozoid%5B%5D=bar</a></p>
5583
5584 <p><a rel="mw:ExtLink" href="http://example.com/index.php?foozoid%5B%5D=bar" data-parsoid='{"stx":"url","a":{"href":"http://example.com/index.php?foozoid%5B%5D=bar"},"sa":{"href":"http://example.com/index.php?foozoid&amp;#x5B;&amp;#x5D;=bar"}}'>http://example.com/index.php?foozoid%5B%5D=bar</a></p>
5585 !! end
5586
5587 !! test
5588 IPv6 urls, autolink format (T23261)
5589 !! wikitext
5590 http://[2404:130:0:1000::187:2]/index.php
5591
5592 Examples from RFC 2373, section 2.2:
5593 * http://[1080::8:800:200C:417A]/unicast
5594 * http://[FF01::101]/multicast
5595 * http://[::1]/loopback
5596 * http://[::]/unspecified
5597 * http://[::13.1.68.3]/ipv4compat
5598 * http://[::FFFF:129.144.52.38]/ipv4compat
5599
5600 Examples from RFC 2732, section 2:
5601 * http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html
5602 * http://[1080:0:0:0:8:800:200C:417A]/index.html
5603 * http://[3ffe:2a00:100:7031::1]
5604 * http://[1080::8:800:200C:417A]/foo
5605 * http://[::192.9.5.5]/ipng
5606 * http://[::FFFF:129.144.52.38]:80/index.html
5607 * http://[2010:836B:4179::836B:4179]
5608
5609 !! html/php
5610 <p><a rel="nofollow" class="external free" href="http://[2404:130:0:1000::187:2]/index.php">http://[2404:130:0:1000::187:2]/index.php</a>
5611 </p><p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2373">RFC 2373</a>, section 2.2:
5612 </p>
5613 <ul><li> <a rel="nofollow" class="external free" href="http://[1080::8:800:200C:417A]/unicast">http://[1080::8:800:200C:417A]/unicast</a></li>
5614 <li> <a rel="nofollow" class="external free" href="http://[FF01::101]/multicast">http://[FF01::101]/multicast</a></li>
5615 <li> <a rel="nofollow" class="external free" href="http://[::1]/loopback">http://[::1]/loopback</a></li>
5616 <li> <a rel="nofollow" class="external free" href="http://[::]/unspecified">http://[::]/unspecified</a></li>
5617 <li> <a rel="nofollow" class="external free" href="http://[::13.1.68.3]/ipv4compat">http://[::13.1.68.3]/ipv4compat</a></li>
5618 <li> <a rel="nofollow" class="external free" href="http://[::FFFF:129.144.52.38]/ipv4compat">http://[::FFFF:129.144.52.38]/ipv4compat</a></li></ul>
5619 <p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2732">RFC 2732</a>, section 2:
5620 </p>
5621 <ul><li> <a rel="nofollow" class="external free" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html</a></li>
5622 <li> <a rel="nofollow" class="external free" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">http://[1080:0:0:0:8:800:200C:417A]/index.html</a></li>
5623 <li> <a rel="nofollow" class="external free" href="http://[3ffe:2a00:100:7031::1]">http://[3ffe:2a00:100:7031::1]</a></li>
5624 <li> <a rel="nofollow" class="external free" href="http://[1080::8:800:200C:417A]/foo">http://[1080::8:800:200C:417A]/foo</a></li>
5625 <li> <a rel="nofollow" class="external free" href="http://[::192.9.5.5]/ipng">http://[::192.9.5.5]/ipng</a></li>
5626 <li> <a rel="nofollow" class="external free" href="http://[::FFFF:129.144.52.38]:80/index.html">http://[::FFFF:129.144.52.38]:80/index.html</a></li>
5627 <li> <a rel="nofollow" class="external free" href="http://[2010:836B:4179::836B:4179]">http://[2010:836B:4179::836B:4179]</a></li></ul>
5628
5629 !! html/parsoid
5630 <p><a rel="mw:ExtLink" href="http://[2404:130:0:1000::187:2]/index.php">http://[2404:130:0:1000::187:2]/index.php</a></p>
5631
5632 <p>Examples from <a href="//tools.ietf.org/html/rfc2373" rel="mw:ExtLink">RFC 2373</a>, section 2.2:</p>
5633 <ul><li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/unicast">http://[1080::8:800:200C:417A]/unicast</a></li>
5634 <li> <a rel="mw:ExtLink" href="http://[FF01::101]/multicast">http://[FF01::101]/multicast</a></li>
5635 <li> <a rel="mw:ExtLink" href="http://[::1]/loopback">http://[::1]/loopback</a></li>
5636 <li> <a rel="mw:ExtLink" href="http://[::]/unspecified">http://[::]/unspecified</a></li>
5637 <li> <a rel="mw:ExtLink" href="http://[::13.1.68.3]/ipv4compat">http://[::13.1.68.3]/ipv4compat</a></li>
5638 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]/ipv4compat">http://[::FFFF:129.144.52.38]/ipv4compat</a></li></ul>
5639
5640 <p>Examples from <a href="//tools.ietf.org/html/rfc2732" rel="mw:ExtLink">RFC 2732</a>, section 2:</p>
5641 <ul><li> <a rel="mw:ExtLink" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html</a></li>
5642 <li> <a rel="mw:ExtLink" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">http://[1080:0:0:0:8:800:200C:417A]/index.html</a></li>
5643 <li> <a rel="mw:ExtLink" href="http://[3ffe:2a00:100:7031::1]">http://[3ffe:2a00:100:7031::1]</a></li>
5644 <li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/foo">http://[1080::8:800:200C:417A]/foo</a></li>
5645 <li> <a rel="mw:ExtLink" href="http://[::192.9.5.5]/ipng">http://[::192.9.5.5]/ipng</a></li>
5646 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]:80/index.html">http://[::FFFF:129.144.52.38]:80/index.html</a></li>
5647 <li> <a rel="mw:ExtLink" href="http://[2010:836B:4179::836B:4179]">http://[2010:836B:4179::836B:4179]</a></li></ul>
5648 !! end
5649
5650 !! test
5651 IPv6 urls, bracketed format (T23261)
5652 !! wikitext
5653 [http://[2404:130:0:1000::187:2]/index.php test]
5654
5655 Examples from RFC 2373, section 2.2:
5656 * [http://[1080::8:800:200C:417A] unicast]
5657 * [http://[FF01::101] multicast]
5658 * [http://[::1]/ loopback]
5659 * [http://[::] unspecified]
5660 * [http://[::13.1.68.3] ipv4compat]
5661 * [http://[::FFFF:129.144.52.38] ipv4compat]
5662
5663 Examples from RFC 2732, section 2:
5664 * [http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html 1]
5665 * [http://[1080:0:0:0:8:800:200C:417A]/index.html 2]
5666 * [http://[3ffe:2a00:100:7031::1] 3]
5667 * [http://[1080::8:800:200C:417A]/foo 4]
5668 * [http://[::192.9.5.5]/ipng 5]
5669 * [http://[::FFFF:129.144.52.38]:80/index.html 6]
5670 * [http://[2010:836B:4179::836B:4179] 7]
5671
5672 !! html/php
5673 <p><a rel="nofollow" class="external text" href="http://[2404:130:0:1000::187:2]/index.php">test</a>
5674 </p><p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2373">RFC 2373</a>, section 2.2:
5675 </p>
5676 <ul><li> <a rel="nofollow" class="external text" href="http://[1080::8:800:200C:417A]">unicast</a></li>
5677 <li> <a rel="nofollow" class="external text" href="http://[FF01::101]">multicast</a></li>
5678 <li> <a rel="nofollow" class="external text" href="http://[::1]/">loopback</a></li>
5679 <li> <a rel="nofollow" class="external text" href="http://[::]">unspecified</a></li>
5680 <li> <a rel="nofollow" class="external text" href="http://[::13.1.68.3]">ipv4compat</a></li>
5681 <li> <a rel="nofollow" class="external text" href="http://[::FFFF:129.144.52.38]">ipv4compat</a></li></ul>
5682 <p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2732">RFC 2732</a>, section 2:
5683 </p>
5684 <ul><li> <a rel="nofollow" class="external text" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">1</a></li>
5685 <li> <a rel="nofollow" class="external text" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">2</a></li>
5686 <li> <a rel="nofollow" class="external text" href="http://[3ffe:2a00:100:7031::1]">3</a></li>
5687 <li> <a rel="nofollow" class="external text" href="http://[1080::8:800:200C:417A]/foo">4</a></li>
5688 <li> <a rel="nofollow" class="external text" href="http://[::192.9.5.5]/ipng">5</a></li>
5689 <li> <a rel="nofollow" class="external text" href="http://[::FFFF:129.144.52.38]:80/index.html">6</a></li>
5690 <li> <a rel="nofollow" class="external text" href="http://[2010:836B:4179::836B:4179]">7</a></li></ul>
5691
5692 !! html/parsoid
5693 <p><a rel="mw:ExtLink" href="http://[2404:130:0:1000::187:2]/index.php">test</a></p>
5694
5695 <p>Examples from <a href="//tools.ietf.org/html/rfc2373" rel="mw:ExtLink">RFC 2373</a>, section 2.2:</p>
5696 <ul><li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]">unicast</a></li>
5697 <li> <a rel="mw:ExtLink" href="http://[FF01::101]">multicast</a></li>
5698 <li> <a rel="mw:ExtLink" href="http://[::1]/">loopback</a></li>
5699 <li> <a rel="mw:ExtLink" href="http://[::]">unspecified</a></li>
5700 <li> <a rel="mw:ExtLink" href="http://[::13.1.68.3]">ipv4compat</a></li>
5701 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]">ipv4compat</a></li></ul>
5702
5703 <p>Examples from <a href="//tools.ietf.org/html/rfc2732" rel="mw:ExtLink">RFC 2732</a>, section 2:</p>
5704 <ul><li> <a rel="mw:ExtLink" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">1</a></li>
5705 <li> <a rel="mw:ExtLink" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">2</a></li>
5706 <li> <a rel="mw:ExtLink" href="http://[3ffe:2a00:100:7031::1]">3</a></li>
5707 <li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/foo">4</a></li>
5708 <li> <a rel="mw:ExtLink" href="http://[::192.9.5.5]/ipng">5</a></li>
5709 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]:80/index.html">6</a></li>
5710 <li> <a rel="mw:ExtLink" href="http://[2010:836B:4179::836B:4179]">7</a></li></ul>
5711 !! end
5712
5713 !! test
5714 Non-extlinks in brackets
5715 !! wikitext
5716 [foo]
5717 [foo bar]
5718 [foo ''bar'']
5719 [fool's] errand
5720 [fool's errand]
5721 [{{echo|foo}}]
5722 [{{echo|foo}} bar]
5723 [{{echo|foo}} ''bar'']
5724 [{{echo|foo}}l's] errand
5725 [{{echo|foo}}l's errand]
5726 [url={{echo|foo}}]
5727 [url=http://example.com]
5728 [http:// bare protocols don't count]
5729 !! html/php
5730 <p>[foo]
5731 [foo bar]
5732 [foo <i>bar</i>]
5733 [fool's] errand
5734 [fool's errand]
5735 [foo]
5736 [foo bar]
5737 [foo <i>bar</i>]
5738 [fool's] errand
5739 [fool's errand]
5740 [url=foo]
5741 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
5742 [http:// bare protocols don't count]
5743 </p>
5744 !! html/parsoid
5745 <p>[foo]
5746 [foo bar]
5747 [foo <i>bar</i>]
5748 [fool's] errand
5749 [fool's errand]
5750 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}"}'>foo</span>]
5751 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}"}'>foo</span> bar]
5752 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}"}'>foo</span> <i>bar</i>]
5753 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}l&#39;s"}'>fool's</span>] errand
5754 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}l&#39;s"}'>fool's</span> errand]
5755 [<span typeof="mw:Placeholder" data-parsoid='{"src":"url={{echo|foo}}"}'>url=foo</span>]
5756 [url=<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>]
5757 [http:// bare protocols don't count]</p>
5758 !! end
5759
5760 !! test
5761 Percent encoding in external links
5762 !! wikitext
5763 [https://github.com/search?l=&q=ResourceLoader+%40wikimedia Search]
5764 !! html/php
5765 <p><a rel="nofollow" class="external text" href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a>
5766 </p>
5767 !! html/parsoid
5768 <p><a rel="mw:ExtLink"
5769 href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a></p>
5770 !! end
5771
5772 !! test
5773 Use url link syntax for links where the content is equal the link target
5774 !! wikitext
5775 http://example.com
5776 !! html/php
5777 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
5778 </p>
5779 !! html/parsoid
5780 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></p>
5781 !! end
5782
5783 !! test
5784 Parenthesis in external links, especially URL links
5785 !! wikitext
5786 http://example.com)
5787
5788 http://example.com/test)
5789
5790 http://example.com/(test)
5791
5792 http://example.com/((test)
5793
5794 (http://example.com/(test))
5795
5796 (http://example.com/(test)))))
5797
5798 http://example.com/a)b
5799
5800 [http://example.com) foo]
5801 !! html/php
5802 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5803 </p><p><a rel="nofollow" class="external free" href="http://example.com/test">http://example.com/test</a>)
5804 </p><p><a rel="nofollow" class="external free" href="http://example.com/(test)">http://example.com/(test)</a>
5805 </p><p><a rel="nofollow" class="external free" href="http://example.com/((test)">http://example.com/((test)</a>
5806 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test))">http://example.com/(test))</a>
5807 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test)))))">http://example.com/(test)))))</a>
5808 </p><p><a rel="nofollow" class="external free" href="http://example.com/a)b">http://example.com/a)b</a>
5809 </p><p><a rel="nofollow" class="external text" href="http://example.com)">foo</a>
5810 </p>
5811 !! html/parsoid
5812 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)</p>
5813 <p><a rel="mw:ExtLink" href="http://example.com/test">http://example.com/test</a>)</p>
5814 <p><a rel="mw:ExtLink" href="http://example.com/(test)">http://example.com/(test)</a></p>
5815 <p><a rel="mw:ExtLink" href="http://example.com/((test)">http://example.com/((test)</a></p>
5816 <p>(<a rel="mw:ExtLink" href="http://example.com/(test))">http://example.com/(test))</a></p>
5817 <p>(<a rel="mw:ExtLink" href="http://example.com/(test)))))">http://example.com/(test)))))</a></p>
5818 <p><a rel="mw:ExtLink" href="http://example.com/a)b">http://example.com/a)b</a></p>
5819 <p><a rel="mw:ExtLink" href="http://example.com)">foo</a></p>
5820 !! end
5821
5822 !! test
5823 Parenthesis in external links, w/ transclusion or comment
5824 !! wikitext
5825 (http://example.com/{{echo|hi}})
5826
5827 (http://example.com<!-- hi -->)
5828 !! html/php
5829 <p>(<a rel="nofollow" class="external free" href="http://example.com/hi">http://example.com/hi</a>)
5830 </p><p>(<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5831 </p>
5832 !! html/parsoid
5833 <p>(<a typeof="mw:ExpandedAttrs" about="#mwt2" rel="mw:ExtLink" href="http://example.com/hi" data-parsoid='{"stx":"url","a":{"href":"http://example.com/hi"},"sa":{"href":"http://example.com/{{echo|hi}}"}}' data-mw='{"attribs":[[{"txt":"href"},{"html":"http://example.com/&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[20,31,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"hi\"}},\"i\":0}}]}&#39;>hi&lt;/span>"}]]}'>http://example.com/hi</a>)</p>
5834
5835 <p>(<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url","a":{"href":"http://example.com"},"sa":{"href":"http://example.com&lt;!-- hi -->"}}'>http://example.com</a>)</p>
5836 !! end
5837
5838 !! test
5839 Serialize <a> tags with invalid link targets as plain text
5840 !! options
5841 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
5842 !! html/parsoid
5843 <a rel="mw:WikiLink" href="[[foo]]">text</a>
5844 <a rel="mw:WikiLink" href="[[foo]]">*text</a>
5845 <a rel="mw:WikiLink" href="[[foo]]">[[foo]]</a>
5846 <a rel="mw:WikiLink" href="[[foo]]">*a [[foo]]</a>
5847 !! wikitext
5848 text
5849 <nowiki>*</nowiki>text
5850 <nowiki>[[foo]]</nowiki>
5851 <nowiki>*</nowiki>a <nowiki>[[foo]]</nowiki>
5852 !! end
5853
5854 !! test
5855 mw:ExtLink -vs- mw:WikiLink (T94723)
5856 !! options
5857 parsoid=html2wt
5858 !! html/parsoid
5859 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"piped","a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>Bar</a>
5860 <a rel="mw:WikiLink" href="./Foo" title="Foo">Bar</a>
5861 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
5862 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
5863 <p>
5864 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
5865 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
5866 </p>
5867 !! wikitext
5868 [[Foo|Bar]]
5869 [[Foo|Bar]]
5870 [[wikipedia:Foo|Bar]]
5871 [[wikipedia:Foo|Bar]]
5872
5873 [[wikipedia:European_Robin|European Robin]]
5874 [[wikipedia:European_Robin|European Robin]]
5875 !! end
5876
5877 !! test
5878 mw:ExtLink linking to a interwiki URL can be round-tripped losslessly (T94723)
5879 !! options
5880 parsoid=wt2wt
5881 !! wikitext
5882 [http://en.wikipedia.org/wiki/European_Robin European Robin]
5883 !! html/parsoid
5884 THIS SECTION IS NOT USED (but Parsoid won't run the test without it)
5885 !! end
5886
5887
5888 ###
5889 ### Quotes
5890 ###
5891
5892 !! test
5893 Quotes
5894 !! wikitext
5895 Normal text. '''Bold text.''' Normal text. ''Italic text.''
5896
5897 Normal text. '''''Bold italic text.''''' Normal text.
5898 !! html
5899 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
5900 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
5901 </p>
5902 !! end
5903
5904
5905 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
5906 # parser strips. The wikitext contains just the first half of the bold
5907 # quote pair.
5908 !! test
5909 Unclosed and unmatched quotes
5910 !! wikitext
5911 '''''Bold italic text '''with bold deactivated''' in between.'''''
5912
5913 '''''Bold italic text ''with italic deactivated'' in between.'''''
5914
5915 '''Bold text..
5916
5917 ..spanning two paragraphs (should not work).'''
5918
5919 '''Bold tag left open
5920
5921 ''Italic tag left open
5922
5923 Normal text.
5924
5925 <!-- Unmatching number of opening, closing tags: -->
5926 '''This year''''s election ''should'' beat '''last year''''s.
5927
5928 ''Tom'''s car is bigger than ''Susan'''s.
5929
5930 Plain ''italic'''s plain
5931 !! html/php
5932 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
5933 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
5934 </p><p><b>Bold text..</b>
5935 </p><p>..spanning two paragraphs (should not work).
5936 </p><p><b>Bold tag left open</b>
5937 </p><p><i>Italic tag left open</i>
5938 </p><p>Normal text.
5939 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
5940 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
5941 </p><p>Plain <i>italic'</i>s plain
5942 </p>
5943 !! html/parsoid
5944 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
5945 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
5946 </p><p><b>Bold text..</b>
5947 </p><p>..spanning two paragraphs (should not work).<b></b>
5948 </p><p><b>Bold tag left open</b>
5949 </p><p><i>Italic tag left open</i>
5950 </p><p>Normal text.
5951 </p>
5952 <!-- Unmatching number of opening, closing tags: -->
5953 <p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
5954 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
5955 </p><p>Plain <i>italic'</i>s plain
5956 </p>
5957 !! end
5958
5959 ###
5960 ### Tables
5961 ###
5962 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
5963 ###
5964
5965 # This should not produce <table></table> as <table><tr><td></td></tr></table>
5966 # is the bare minimum required by the spec, see:
5967 # https://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
5968 # Parsoid team replies: empty table tags are legal in HTML5
5969 !! test
5970 A table with no data.
5971 !! options
5972 parsoid=wt2html
5973 !! wikitext
5974 {||}
5975 !! html/php
5976
5977 !! html/parsoid
5978 <table></table>
5979
5980 !! end
5981
5982 !! test
5983 A table with stray table end tags on start tag line (wt2html)
5984 !! options
5985 parsoid=wt2html
5986 !! wikitext
5987 {|style="color: red;"|}
5988
5989 {|style="color: red;" |}
5990 |foo
5991 |}
5992
5993 {|style="color: red;"|} id="foo"
5994 |foo
5995 |}
5996
5997 {|style="color: red;" |} id="foo"
5998 |foo
5999 |}
6000 !! html
6001 <table style="color: red;"></table>
6002
6003 <table style="color: red;">
6004 <tbody><tr>
6005 <td>foo</td>
6006 </tr></tbody>
6007 </table>
6008
6009 <table style="color: red;" id="foo">
6010 <tbody><tr>
6011 <td>foo</td>
6012 </tr></tbody>
6013 </table>
6014
6015 <table style="color: red;" id="foo">
6016 <tbody><tr>
6017 <td>foo</td>
6018 </tr></tbody>
6019 </table>
6020
6021 !! end
6022
6023 !! test
6024 A table with no data (take 2)
6025 !! wikitext
6026 {|
6027 |}
6028 !! html/parsoid
6029 <table></table>
6030 !! end
6031
6032 # A table with nothing but a caption is invalid XHTML, we might want to render
6033 # this as <p>caption</p>
6034 # Parsoid team replies: table with only a caption is legal in HTML5
6035 !! test
6036 A table with nothing but a caption
6037 !! wikitext
6038 {|
6039 |+ caption
6040 |}
6041 !! html/php
6042 <table>
6043 <caption> caption
6044 </caption><tr><td></td></tr></table>
6045
6046 !! html/parsoid
6047 <table><caption> caption</caption></table>
6048 !! end
6049
6050 !! test
6051 A table with caption with default-spaced attributes and a table row
6052 !! wikitext
6053 {|
6054 |+ style="color: red;" | caption1
6055 |-
6056 | foo
6057 |}
6058 !! html
6059 <table>
6060 <caption style="color: red;"> caption1
6061 </caption>
6062 <tr>
6063 <td> foo
6064 </td></tr></table>
6065
6066 !! end
6067
6068 !! test
6069 A table with captions with non-default spaced attributes and a table row
6070 !! wikitext
6071 {|
6072 |+style="color: red;"|caption2
6073 |+ style="color: red;"| caption3
6074 |-
6075 | foo
6076 |}
6077 !! html
6078 <table>
6079 <caption style="color: red;">caption2
6080 </caption>
6081 <caption style="color: red;"> caption3
6082 </caption>
6083 <tr>
6084 <td> foo
6085 </td></tr></table>
6086
6087 !! end
6088
6089 !! test
6090 Table td-cell syntax variations
6091 !! wikitext
6092 {|
6093 | foo bar foo | baz
6094 | foo bar foo || baz
6095 | style='color:red;' | baz
6096 | style='color:red;' || baz
6097 |}
6098 !! html
6099 <table>
6100 <tr>
6101 <td> baz
6102 </td>
6103 <td> foo bar foo </td>
6104 <td> baz
6105 </td>
6106 <td style="color:red;"> baz
6107 </td>
6108 <td> style='color:red;' </td>
6109 <td> baz
6110 </td></tr></table>
6111
6112 !! end
6113
6114 !! test
6115 Simple table
6116 !! wikitext
6117 {|
6118 | 1 || 2
6119 |-
6120 | 3 || 4
6121 |}
6122 !! html
6123 <table>
6124 <tr>
6125 <td> 1 </td>
6126 <td> 2
6127 </td></tr>
6128 <tr>
6129 <td> 3 </td>
6130 <td> 4
6131 </td></tr></table>
6132
6133 !! end
6134
6135 !! test
6136 Simple table but with multiple dashes for row wikitext
6137 !! wikitext
6138 {|
6139 | foo
6140 |-----
6141 | bar
6142 |}
6143 !! html
6144 <table>
6145 <tr>
6146 <td> foo
6147 </td></tr>
6148 <tr>
6149 <td> bar
6150 </td></tr></table>
6151
6152 !! end
6153
6154 !! test
6155 Multiplication table
6156 !! wikitext
6157 {| border="1" cellpadding="2"
6158 |+Multiplication table
6159 |-
6160 ! &times; !! 1 !! 2 !! 3
6161 |-
6162 ! 1
6163 | 1 || 2 || 3
6164 |-
6165 ! 2
6166 | 2 || 4 || 6
6167 |-
6168 ! 3
6169 | 3 || 6 || 9
6170 |-
6171 ! 4
6172 | 4 || 8 || 12
6173 |-
6174 ! 5
6175 | 5 || 10 || 15
6176 |}
6177 !! html
6178 <table border="1" cellpadding="2">
6179 <caption>Multiplication table
6180 </caption>
6181 <tr>
6182 <th> &#215; </th>
6183 <th> 1 </th>
6184 <th> 2 </th>
6185 <th> 3
6186 </th></tr>
6187 <tr>
6188 <th> 1
6189 </th>
6190 <td> 1 </td>
6191 <td> 2 </td>
6192 <td> 3
6193 </td></tr>
6194 <tr>
6195 <th> 2
6196 </th>
6197 <td> 2 </td>
6198 <td> 4 </td>
6199 <td> 6
6200 </td></tr>
6201 <tr>
6202 <th> 3
6203 </th>
6204 <td> 3 </td>
6205 <td> 6 </td>
6206 <td> 9
6207 </td></tr>
6208 <tr>
6209 <th> 4
6210 </th>
6211 <td> 4 </td>
6212 <td> 8 </td>
6213 <td> 12
6214 </td></tr>
6215 <tr>
6216 <th> 5
6217 </th>
6218 <td> 5 </td>
6219 <td> 10 </td>
6220 <td> 15
6221 </td></tr></table>
6222
6223 !! end
6224
6225 !! test
6226 Accept "||" in table headings
6227 !! wikitext
6228 {|
6229 !h1 || h2
6230 |}
6231 !! html
6232 <table>
6233 <tr>
6234 <th>h1 </th>
6235 <th> h2
6236 </th></tr></table>
6237
6238 !! end
6239
6240 !! test
6241 Accept "!!" in table data
6242 !! wikitext
6243 {|
6244 | Foo!! ||
6245 |}
6246 !! html
6247 <table>
6248 <tr>
6249 <td> Foo!! </td>
6250 <td>
6251 </td></tr></table>
6252
6253 !! html/parsoid
6254 <table>
6255 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'> Foo!! </td><td data-parsoid='{"stx_v":"row","autoInsertedEnd":true}'></td></tr>
6256 </tbody></table>
6257 !! end
6258
6259 !! test
6260 Accept "||" in indented table headings
6261 !! wikitext
6262 :{|
6263 !h1 || h2
6264 |}
6265 !! html
6266 <dl><dd><table>
6267 <tr>
6268 <th>h1 </th>
6269 <th> h2
6270 </th></tr></table></dd></dl>
6271
6272 !! end
6273
6274 !! test
6275 Accept "!!" in templates
6276 !! wikitext
6277 {|
6278 !a {{echo|b!!c}}
6279 |}
6280 !! html/php
6281 <table>
6282 <tr>
6283 <th>a b</th>
6284 <th>c
6285 </th></tr></table>
6286
6287 !! html/parsoid
6288 <table>
6289 <tbody><tr><th typeof="mw:Transclusion" about="#mwt1" data-parsoid='{"autoInsertedEnd":true,"pi":[[{"k":"1"}]]}' data-mw='{"parts":["!a ",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"b!!c"}},"i":0}}]}'>a b</th><th about="#mwt1">c</th></tr>
6290 !! end
6291
6292 !! test
6293 Accept "!!" in table headings after newline
6294 !! wikitext
6295 {|
6296 !a
6297 b!!c
6298 |}
6299 !! html/php
6300 <table>
6301 <tr>
6302 <th>a
6303 <p>b!!c
6304 </p>
6305 </th></tr></table>
6306
6307 !! html/parsoid
6308 <table>
6309 <tbody><tr><th>a
6310 <p>b!!c</p></th></tr>
6311 </tbody></table>
6312 !! end
6313
6314 !! test
6315 Accept "!!" in table data of mixed wikitext / html syntax
6316 !! wikitext
6317 {|
6318 !a
6319 <tr><td>b!!c</td></tr>
6320 |}
6321 !! html+tidy
6322 <table>
6323 <tr>
6324 <th>a</th>
6325 </tr>
6326 <tr>
6327 <td>b!!c</td>
6328 </tr>
6329 </table>
6330 !! html/parsoid
6331 <table>
6332 <tbody><tr><th>a</th></tr>
6333 <tr data-parsoid='{"stx":"html"}'><td data-parsoid='{"stx":"html"}'>b!!c</td></tr>
6334 </tbody></table>
6335 !! end
6336
6337 !! test
6338 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
6339 !! wikitext
6340 {|
6341 !| h1
6342 || a
6343 |}
6344 !! html
6345 <table>
6346 <tr>
6347 <th> h1
6348 </th>
6349 <td> a
6350 </td></tr></table>
6351
6352 !! end
6353
6354 !!test
6355 Accept "| !" at start of line in tables (ignore !-attribute)
6356 !! wikitext
6357 {|
6358 |-
6359 | !style="color:red" | bar
6360 |}
6361 !! html
6362 <table>
6363
6364 <tr>
6365 <td> bar
6366 </td></tr></table>
6367
6368 !!end
6369
6370 !!test
6371 Allow +/- in 2nd and later cells in a row, in 1st cell when td-attrs are present, or in 1st cell when there is a space between "|" and +/-
6372 !! wikitext
6373 {|
6374 |-
6375 |style='color:red;'|+1
6376 |style='color:blue;'|-1
6377 |-
6378 | 1 || 2 || 3
6379 | 1 ||+2 ||-3
6380 |-
6381 | +1
6382 | -1
6383 |}
6384 !! html
6385 <table>
6386
6387 <tr>
6388 <td style="color:red;">+1
6389 </td>
6390 <td style="color:blue;">-1
6391 </td></tr>
6392 <tr>
6393 <td> 1 </td>
6394 <td> 2 </td>
6395 <td> 3
6396 </td>
6397 <td> 1 </td>
6398 <td>+2 </td>
6399 <td>-3
6400 </td></tr>
6401 <tr>
6402 <td> +1
6403 </td>
6404 <td> -1
6405 </td></tr></table>
6406
6407 !!end
6408
6409 !! test
6410 Table rowspan
6411 !! wikitext
6412 {| border=1
6413 | Cell 1, row 1
6414 |rowspan=2| Cell 2, row 1 (and 2)
6415 | Cell 3, row 1
6416 |-
6417 | Cell 1, row 2
6418 | Cell 3, row 2
6419 |}
6420 !! html
6421 <table border="1">
6422 <tr>
6423 <td> Cell 1, row 1
6424 </td>
6425 <td rowspan="2"> Cell 2, row 1 (and 2)
6426 </td>
6427 <td> Cell 3, row 1
6428 </td></tr>
6429 <tr>
6430 <td> Cell 1, row 2
6431 </td>
6432 <td> Cell 3, row 2
6433 </td></tr></table>
6434
6435 !! end
6436
6437 !! test
6438 Nested table
6439 !! wikitext
6440 {| border=1
6441 | &alpha;
6442 |
6443 {| bgcolor=#ABCDEF border=2
6444 |nested
6445 |-
6446 |table
6447 |}
6448 |the original table again
6449 |}
6450 !! html
6451 <table border="1">
6452 <tr>
6453 <td> &#945;
6454 </td>
6455 <td>
6456 <table bgcolor="#ABCDEF" border="2">
6457 <tr>
6458 <td>nested
6459 </td></tr>
6460 <tr>
6461 <td>table
6462 </td></tr></table>
6463 </td>
6464 <td>the original table again
6465 </td></tr></table>
6466
6467 !! end
6468
6469 !! test
6470 Invalid attributes in table cell (T3830)
6471 !! wikitext
6472 {|
6473 |Cell:|broken
6474 |}
6475 !! html
6476 <table>
6477 <tr>
6478 <td>broken
6479 </td></tr></table>
6480
6481 !! end
6482
6483 !! test
6484 Table cell attributes: Pipes protected by nowikis should be treated as a plain character
6485 !! wikitext
6486 {|
6487 | title="foo" |bar
6488 | title="foo<nowiki>|</nowiki>" |bar
6489 | title="foo<nowiki>|</nowiki>" bar
6490 |}
6491 !! html/php
6492 <table>
6493 <tr>
6494 <td title="foo">bar
6495 </td>
6496 <td title="foo&#124;">bar
6497 </td>
6498 <td> title="foo|" bar
6499 </td></tr></table>
6500
6501 !! html/parsoid
6502 <table>
6503 <tbody><tr><td title="foo">bar</td>
6504 <td title="foo|" data-parsoid='{"a":{"title":"foo|"},"sa":{"title":"foo&lt;nowiki>|&lt;/nowiki>"},"autoInsertedEnd":true}'>bar</td>
6505 <td> title="foo<span typeof="mw:Nowiki">|</span>" bar</td></tr>
6506 </tbody></table>
6507 !! end
6508
6509 # See: http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html
6510 # N.B. The "|}" to close the table is missing from the input, so parsoid's
6511 # *2wt modes will fail.
6512 !! test
6513 Table security: embedded pipes
6514 !! options
6515 parsoid=wt2html,html2html
6516 !! wikitext
6517 {|
6518 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
6519 !! html/php
6520 <table>
6521 <tr>
6522 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
6523 <td>]" onmouseover="alert(document.cookie)"&gt;test
6524 </td>
6525 </tr>
6526 </table>
6527
6528 !! html/parsoid
6529 <table><tbody>
6530 <tr>
6531 <td data-parsoid='{"startTagSrc":"| ","attrSepSrc":"|","autoInsertedEnd":true}'>[<a rel="mw:ExtLink" href="ftp://%7Cx" data-parsoid='{"stx":"url","a":{"href":"ftp://%7Cx"},"sa":{"href":"ftp://|x"}}'>ftp://%7Cx</a></td><td data-parsoid='{"stx_v":"row","autoInsertedEnd":true}'>]" onmouseover="alert(document.cookie)">test</td></tr></tbody></table>
6532 !! end
6533
6534 !! test
6535 Element attributes with double ! should not be broken up by <th>
6536 !! wikitext
6537 {|
6538 ! hi <div class="!!">ha</div> ho
6539 |}
6540 !! html/php
6541 <table>
6542 <tr>
6543 <th> hi <div class="!!">ha</div> ho
6544 </th></tr></table>
6545
6546 !! html/parsoid
6547 <table>
6548 <tbody><tr><th> hi <div class="!!" data-parsoid='{"stx":"html"}'>ha</div> ho</th></tr>
6549 </tbody></table>
6550 !! end
6551
6552 !! test
6553 ! and || in element attributes should not be parsed as <th>/<td>
6554 !! wikitext
6555 {|
6556 | <div style="color: red !important;" data-contrived="put this here ||">hi</div>
6557 |}
6558 !! html/php
6559 <table>
6560 <tr>
6561 <td> <div style="color: red !important;" data-contrived="put this here &#124;&#124;">hi</div>
6562 </td></tr></table>
6563
6564 !! html/parsoid
6565 <table>
6566 <tbody><tr><td> <div style="color: red !important;" data-contrived="put this here ||" data-parsoid='{"stx":"html"}'>hi</div></td></tr>
6567 </tbody></table>
6568 !! end
6569
6570 # FIXME: The output seems broken. Filed as T110268.
6571 !! test
6572 ! and || in td attributes should not be parsed as <th>/<td>
6573 !! options
6574 parsoid=wt2html
6575 !! wikitext
6576 {|
6577 | style="color: red !important;" data-contrived="put this here ||" | foo
6578 |}
6579 !! html/php
6580 <table>
6581 <tr>
6582 <td> style="color: red !important;" data-contrived="put this here </td>
6583 <td> foo
6584 </td></tr></table>
6585
6586 !! html/parsoid
6587 <table>
6588 <tbody><tr><td> style="color: red !important;" data-contrived="put this here </td><td data-parsoid='{"stx_v":"row","a":{"\"":null},"sa":{"\"":""},"autoInsertedEnd":true}'> foo</td></tr>
6589 </tbody></table>
6590 !! end
6591
6592 !! test
6593 Break on | in element attribute in template
6594 !! options
6595 parsoid=wt2html,html2html
6596 !! wikitext
6597 {{echo|1=<div class="hi|ho">ha</div>}}
6598 !! html/php
6599 <p>ho"&gt;ha&lt;/div&gt;
6600 </p>
6601 !! html/parsoid
6602 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"ho\">ha&lt;/div>"}},"i":0}}]}'>ho">ha</span>
6603 !! end
6604
6605 !! test
6606 Break on | in element attribute name in template
6607 !! wikitext
6608 {{echo|<div cla|ss="hiho">ha</div>}}
6609 !! html/parsoid
6610 <p about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"},{"k":"ss","named":true}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;div cla"},"ss":{"wt":"\"hiho\">ha&lt;/div>"}},"i":0}}]}'>&lt;div cla</p>
6611 !! end
6612
6613 !! test
6614 Don't break on | in extension attribute in template
6615 !! wikitext
6616 {{echo|<ref name="hi|ho">ha</ref>}}
6617
6618 <references />
6619 !! html/parsoid
6620 <p><span about="#mwt2" class="mw-ref" id="cite_ref-hi.7Cho_1-0" rel="dc:references" typeof="mw:Transclusion mw:Extension/ref" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;ref name=\"hi|ho\">ha&lt;/ref>"}},"i":0}}]}'><a href="./Main_Page#cite_note-hi.7Cho-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></span></p>
6621
6622 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-hi.7Cho-1" id="cite_note-hi.7Cho-1"><a href="./Main_Page#cite_ref-hi.7Cho_1-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-hi.7Cho-1" class="mw-reference-text">ha</span></li></ol>
6623 !! end
6624
6625 ## We don't support roundtripping of these attributes in Parsoid.
6626 ## Selective serialization takes care of preventing dirty diffs.
6627 ## But, on edits, we dirty-diff the invalid attribute text.
6628 !! test
6629 Invalid text in table attributes should be discarded
6630 !! options
6631 parsoid=wt2html
6632 !! wikitext
6633 {| <span>boo</span> style='border:1px solid black'
6634 | <span>boo</span> style='color:blue' | 1
6635 |<span>boo</span> style='color:blue'| 2
6636 |}
6637 !! html/php
6638 <table style="border:1px solid black">
6639 <tr>
6640 <td style="color:blue"> 1
6641 </td>
6642 <td style="color:blue"> 2
6643 </td></tr></table>
6644
6645 !! html/parsoid
6646 <table style="border:1px solid black">
6647 <tr>
6648 <td style="color:blue"> 1</td>
6649 <td style="color:blue"> 2</td>
6650 </tr>
6651 </table>
6652 !! end
6653
6654 !! test
6655 Invalid text in table attributes should be preserved by selective serializer
6656 !! options
6657 parsoid={
6658 "modes": ["selser"],
6659 "changes": [
6660 ["td:first-child", "text", "abc"],
6661 ["td + td", "text", "xyz"]
6662 ]
6663 }
6664 !! wikitext
6665 {| <span>boo</span> style='border:1px solid black'
6666 | <span>boo</span> style='color:blue' | 1
6667 |<span>boo</span> style='color:blue'| 2
6668 |}
6669 !! wikitext/edited
6670 {| <span>boo</span> style='border:1px solid black'
6671 | <span>boo</span> style='color:blue' |abc
6672 |<span>boo</span> style='color:blue'|xyz
6673 |}
6674 !! end
6675
6676 !! test
6677 1. Template-generated table cell attributes and cell content
6678 !! wikitext
6679 {|
6680 |{{table_attribs}}
6681 | {{table_attribs}}
6682 || {{table_attribs_5}}
6683 | <!--foo--> <!--bar--> <!--baz--> {{table_attribs}}
6684 |align=center {{table_attribs}}
6685 | <!--foo--> align=center <!--bar--> {{table_attribs}}
6686 |}
6687 !! html
6688 <table>
6689 <tr>
6690 <td style="color:red;">Foo
6691 </td>
6692 <td style="color:red;">Foo
6693 </td>
6694 <td> style="color:red;"</td>
6695 <td>Bar
6696 </td>
6697 <td style="color:red;">Foo
6698 </td>
6699 <td align="center" style="color:red;">Foo
6700 </td>
6701 <td align="center" style="color:red;">Foo
6702 </td></tr></table>
6703
6704 !! end
6705
6706 !! test
6707 2. Template-generated table cell attributes and cell content
6708 !! wikitext
6709 {|
6710 |{{table_attribs_2}}
6711 |}
6712 !! html/php
6713 <table>
6714 <tr>
6715 <td style="color:red;">Foo
6716 </td>
6717 <td>Bar</td>
6718 <td>Baz
6719 </td></tr></table>
6720
6721 !! html/parsoid
6722 <table>
6723 <tbody><tr><td about="#mwt1" typeof="mw:Transclusion" style="color:red;" data-mw='{"parts":["|",{"template":{"target":{"wt":"table_attribs_2","href":"./Template:Table_attribs_2"},"params":{},"i":0}}]}'>Foo</td>
6724 <td about="#mwt1">Bar</td><td about="#mwt1">Baz</td></tr>
6725 </tbody></table>
6726 !! end
6727
6728 !! test
6729 3. Template-generated table cell attributes and cell content
6730 !! wikitext
6731 {|
6732 !align=center {{table_header_cells}}
6733 |-
6734 |align=center {{table_cells}}
6735 |}
6736 !! html/php
6737 <table>
6738 <tr>
6739 <th align="center" style="color:red;">Foo</th>
6740 <th style="color:red;"><i>Bar</i></th>
6741 <th style="color:brown;"><i>Foo</i> and Baz
6742 </th></tr>
6743 <tr>
6744 <td align="center" style="color:red;">Foo</td>
6745 <td style="color:red;"><i>Bar</i></td>
6746 <td style="color:brown;"><i>Foo</i> and Baz
6747 </td></tr></table>
6748
6749 !! html/parsoid
6750 <table>
6751 <tbody><tr><th align="center" style="color:red;" typeof="mw:Transclusion" about="#mwt1" data-mw='{"parts":["!align=center ",{"template":{"target":{"wt":"table_header_cells","href":"./Template:Table_header_cells"},"params":{},"i":0}}]}'>Foo</th><th about="#mwt1" style="color:red;"><i about="#mwt1">Bar</i></th><th about="#mwt1" style="color:brown;"><i about="#mwt1">Foo</i> and Baz</th></tr><tr>
6752 <td align="center" style="color:red;" typeof="mw:Transclusion" about="#mwt1" data-mw='{"parts":["|align=center ",{"template":{"target":{"wt":"table_cells","href":"./Template:Table_cells"},"params":{},"i":0}}]}'>Foo</td><td about="#mwt1" style="color:red;"><i about="#mwt1">Bar</i></td><td about="#mwt1" style="color:brown;"><i about="#mwt1">Foo</i> and Baz</td></tr>
6753 </tbody></table>
6754 !! end
6755
6756 !! test
6757 4. Template-generated table cell attributes and cell content inside a templated table
6758 !! wikitext
6759 {{tbl-start}}
6760 !align=center {{table_header_cells}}
6761 |-
6762 |align=center {{table_cells}}
6763 {{tbl-end}}
6764 !! html/php
6765 <table>
6766 <tr>
6767 <th align="center" style="color:red;">Foo</th>
6768 <th style="color:red;"><i>Bar</i></th>
6769 <th style="color:brown;"><i>Foo</i> and Baz
6770 </th></tr>
6771 <tr>
6772 <td align="center" style="color:red;">Foo</td>
6773 <td style="color:red;"><i>Bar</i></td>
6774 <td style="color:brown;"><i>Foo</i> and Baz
6775 </td></tr></table>
6776
6777 !! html/parsoid
6778 <table about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[],[],[],[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"tbl-start","href":"./Template:Tbl-start"},"params":{},"i":0}},"\n!align=center ",{"template":{"target":{"wt":"table_header_cells","href":"./Template:Table_header_cells"},"params":{},"i":1}},"\n|-\n|align=center ",{"template":{"target":{"wt":"table_cells","href":"./Template:Table_cells"},"params":{},"i":2}},"\n",{"template":{"target":{"wt":"tbl-end","href":"./Template:Tbl-end"},"params":{},"i":3}}]}'>
6779 <tbody><tr><th align="center" style="color:red;">Foo</th><th style="color:red;"><i>Bar</i></th><th style="color:brown;"><i>Foo</i> and Baz</th></tr>
6780 <tr>
6781 <td align="center" style="color:red;">Foo</td><td style="color:red;"><i>Bar</i></td><td style="color:brown;"><i>Foo</i> and Baz</td></tr>
6782 </tbody></table>
6783 !! end
6784
6785 ## Edge case fix to prevent future regressions
6786 !! test
6787 T107652: <ref>s in templates that also generate table cell attributes should be rendered properly
6788 !! wikitext
6789 {|
6790 |{{table_attribs_7}}
6791 |}
6792 <references />
6793 !! html/parsoid
6794 <table>
6795 <tbody><tr><td style="background:#f9f9f9;" typeof="mw:Transclusion" about="#mwt1" data-mw='{"parts":["|",{"template":{"target":{"wt":"table_attribs_7","href":"./Template:Table_attribs_7"},"params":{},"i":0}}]}'>Foo<span class="mw-ref" id="cite_ref-1" rel="dc:references" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="./Main_Page#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></span></td></tr>
6796 </tbody></table>
6797 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><a href="./Main_Page#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text" data-parsoid="{}">foo</span></li></ol>
6798 !! end
6799
6800 !! test
6801 Table with row followed by newlines and table heading
6802 !! options
6803 parsoid=wt2html,html2html
6804 !! wikitext
6805 {|
6806 |-
6807
6808 ! foo
6809 |}
6810 !! html/*
6811 <table>
6812
6813
6814 <tr>
6815 <th> foo
6816 </th></tr></table>
6817
6818 !! end
6819
6820 !! test
6821 Table with empty line following the start tag
6822 !! options
6823 parsoid=wt2html,html2html
6824 !! wikitext
6825 {|
6826
6827 |-
6828 | foo
6829 |}
6830 !! html/*
6831 <table>
6832
6833
6834 <tr>
6835 <td> foo
6836 </td></tr></table>
6837
6838 !! end
6839
6840 !! test
6841 Table attributes with empty value
6842 !! options
6843 parsoid=wt2html,html2html
6844 !! wikitext
6845 {|
6846 | style=| hello
6847 |}
6848 !! html/php
6849 <table>
6850 <tr>
6851 <td style=""> hello
6852 </td></tr></table>
6853
6854 !! html/parsoid
6855 <table>
6856 <tbody><tr><td style=""> hello</td></tr>
6857 </tbody></table>
6858 !! end
6859
6860 !! test
6861 Wikitext table with a lot of comments
6862 !! wikitext
6863 {|
6864 <!-- c0 -->
6865 | foo
6866 <!-- c1 -->
6867 |-<!-- c2 -->
6868 <!-- c3 -->
6869 |<!-- c4 -->
6870 <!-- c5 -->
6871 |}
6872 !! html
6873 <table>
6874 <tr>
6875 <td> foo
6876 </td></tr>
6877 <tr>
6878 <td>
6879 </td></tr></table>
6880
6881 !! end
6882
6883 !! test
6884 Wikitext table comments represented in parsoid dom
6885 !! wikitext
6886 {|<!--c1--><!--c2-->
6887 |-<!--c3-->
6888 | x
6889 |}
6890 !! html/php+tidy
6891 <table>
6892 <tr>
6893 <td>x</td>
6894 </tr>
6895 </table>
6896 !! html/parsoid
6897 <table><!--c1--><!--c2-->
6898 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'><!--c3-->
6899 <td data-parsoid='{"autoInsertedEnd":true}'> x</td></tr>
6900 </tbody></table>
6901 !! end
6902
6903 !! test
6904 Wikitext table with double-line table cell
6905 !! wikitext
6906 {|
6907 |a
6908 b
6909 |}
6910 !! html
6911 <table>
6912 <tr>
6913 <td>a
6914 <p>b
6915 </p>
6916 </td></tr></table>
6917
6918 !! end
6919
6920 !! test
6921 Table cell with a single comment
6922 !! wikitext
6923 {|
6924 | <!-- c1 -->
6925 | a
6926 |}
6927 !! html
6928 <table>
6929 <tr>
6930 <td>
6931 </td>
6932 <td> a
6933 </td></tr></table>
6934
6935 !! end
6936
6937 !! test
6938 Table-cell after a comment-only-empty-line
6939 !! wikitext
6940 {|
6941 |a
6942 <!--c1-->
6943 <!--c2-->| b
6944 |}
6945 !! html
6946 <table>
6947 <tr>
6948 <td>a
6949 </td>
6950 <td> b
6951 </td></tr></table>
6952
6953 !! html/parsoid
6954 <table>
6955 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>a</td>
6956 <!--c1-->
6957 <!--c2--><td data-parsoid='{"autoInsertedEnd":true}'> b</td></tr>
6958 </tbody></table>
6959
6960 !! end
6961
6962 !! test
6963 Build table with {{!}}
6964 !! wikitext
6965 {{{!}} class="wikitable"
6966 ! header
6967 ! second header
6968 {{!}}- style="color:red;"
6969 {{!}} data {{!}}{{!}} style="color:red;" {{!}} second data
6970 {{!}}}
6971 !! html
6972 <table class="wikitable">
6973 <tr>
6974 <th> header
6975 </th>
6976 <th> second header
6977 </th></tr>
6978 <tr style="color:red;">
6979 <td> data </td>
6980 <td style="color:red;"> second data
6981 </td></tr></table>
6982
6983 !! end
6984
6985 !! test
6986 Build table with pipe as data
6987 !! wikitext
6988 {| class="wikitable"
6989 ! header
6990 ! second header
6991 |- style="color:red;"
6992 | data || style="color:red;" | second data
6993 |-
6994 | style="color:red;" | data with | || style="color:red;" | second data with |
6995 |-
6996 || data with | ||| second data with |
6997 |}
6998 !! html
6999 <table class="wikitable">
7000 <tr>
7001 <th> header
7002 </th>
7003 <th> second header
7004 </th></tr>
7005 <tr style="color:red;">
7006 <td> data </td>
7007 <td style="color:red;"> second data
7008 </td></tr>
7009 <tr>
7010 <td style="color:red;"> data with | </td>
7011 <td style="color:red;"> second data with |
7012 </td></tr>
7013 <tr>
7014 <td> data with | </td>
7015 <td> second data with |
7016 </td></tr></table>
7017
7018 !! end
7019
7020 !! test
7021 Build table with wikilink
7022 !! wikitext
7023 {| class="wikitable"
7024 ! header || second header
7025 |- style="color:red;"
7026 | data [[Main Page|linktext]] || second data [[Main Page|linktext]]
7027 |-
7028 | data || second data [[Main Page|link|text with pipe]]
7029 |}
7030 !! html
7031 <table class="wikitable">
7032 <tr>
7033 <th> header </th>
7034 <th> second header
7035 </th></tr>
7036 <tr style="color:red;">
7037 <td> data <a href="/wiki/Main_Page" title="Main Page">linktext</a> </td>
7038 <td> second data <a href="/wiki/Main_Page" title="Main Page">linktext</a>
7039 </td></tr>
7040 <tr>
7041 <td> data </td>
7042 <td> second data <a href="/wiki/Main_Page" title="Main Page">link|text with pipe</a>
7043 </td></tr></table>
7044
7045 !! end
7046
7047 # The expected HTML structure in this test is debatable. The PHP parser does
7048 # not parse this kind of table at all. The main focus for Parsoid is on
7049 # round-tripping, so this output is ok for now. TODO: revisit!
7050 !! test
7051 Wikitext table with html-syntax row
7052 !! wikitext
7053 {|
7054 |-
7055 <td>foo</td>
7056 |}
7057 !! html/parsoid
7058 <table>
7059 <tbody>
7060 <tr>
7061 <td>foo</td></tr></tbody></table>
7062 !! end
7063
7064 !! test
7065 Implicit <td> after a |-
7066 !! options
7067 parsoid=wt2html,html2html
7068 !! wikitext
7069 {|
7070 |-
7071 a
7072 |}
7073 !! html/php
7074 <table>
7075
7076 a
7077 </table>
7078
7079 !! html/php+tidy
7080 <p>a</p>
7081 !! html/parsoid
7082 <p data-parsoid='{"fostered":true,"autoInsertedEnd":true}'>a</p><table>
7083 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
7084
7085 </tr></tbody></table>
7086 !! end
7087
7088 !! test
7089 Lists should be recognized in an implicit <td> context
7090 !! options
7091 parsoid=wt2html,html2html
7092 !! wikitext
7093 {|
7094 |-
7095 *a
7096 |}
7097 !! html/php
7098 <table>
7099
7100 <ul><li>a</li></ul>
7101 </table>
7102
7103 !! html/php+tidy
7104 <ul>
7105 <li>a</li>
7106 </ul>
7107 !! html/parsoid
7108 <ul data-parsoid='{"fostered":true,"autoInsertedEnd":true}'><li>a</li></ul><table>
7109 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
7110
7111 </tr></tbody></table>
7112 !! end
7113
7114 !! test
7115 Table cells not properly parsed in an implicit-td context
7116 !! wikitext
7117 {|
7118 |-
7119 {{table_attribs_4}} || a || b
7120 |}
7121 !! html/php+tidy
7122 <table>
7123 <tr>
7124 <td style="background-color:#DC241f;" width="10px"></td>
7125 <td>a</td>
7126 <td>b</td>
7127 </tr>
7128 </table>
7129 !! html/parsoid
7130 <table>
7131 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
7132 <td style="background-color:#DC241f;" width="10px" about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"autoInsertedEnd":true,"pi":[[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"table_attribs_4","href":"./Template:Table_attribs_4"},"params":{},"i":0}}," || a || b"]}'> </td><td about="#mwt1"> a </td><td about="#mwt1"> b</td></tr>
7133 !! end
7134
7135 !! test
7136 Parsoid: Round-trip tables directly followed by content (T53219)
7137 !! options
7138 parsoid=wt2html,wt2wt
7139 !! wikitext
7140 {|
7141 |foo
7142 |} bar
7143
7144 {|
7145 |baz
7146 |}<b>quux</b>
7147 !! html+tidy
7148 <table>
7149 <tr>
7150 <td>foo</td>
7151 </tr>
7152 </table>
7153 <p>bar</p>
7154 <table>
7155 <tr>
7156 <td>baz</td>
7157 </tr>
7158 </table>
7159 <p><b>quux</b></p>
7160 !! end
7161
7162 !! test
7163 Parsoid: Default to a newline after tables in new content (T53219)
7164 !! options
7165 parsoid=html2wt
7166 !! html/parsoid
7167 <table><tbody>
7168 <tr><td>foo</td></tr></tbody></table> bar
7169 <table><tbody>
7170 <tr><td>baz</td></tr></tbody></table><b>quux</b>
7171 !! wikitext
7172 {|
7173 |foo
7174 |}
7175 <nowiki> </nowiki>bar
7176 {|
7177 |baz
7178 |}
7179 '''quux'''
7180 !! end
7181
7182 !! test
7183 Parsoid: newline inducing block nodes don't suppress <nowiki>
7184 !! options
7185 parsoid=html2wt
7186 !! html/parsoid
7187 a<h1>foo</h1>
7188 !! wikitext
7189 <nowiki> </nowiki>a
7190
7191 = foo =
7192 !! end
7193
7194 !! test
7195 Parsoid: Row-syntax table headings followed by comment & table cells
7196 !! options
7197 parsoid=wt2html,wt2wt
7198 !! wikitext
7199 {|
7200 ! foo || bar
7201 <!-- foo --> || baz || quux
7202 |}
7203 !! html/php
7204 <table>
7205 <tr>
7206 <th> foo </th>
7207 <th> bar
7208 </th>
7209 <td> baz </td>
7210 <td> quux
7211 </td></tr></table>
7212
7213 !! html/parsoid
7214 <table>
7215 <tbody><tr><th> foo </th><th> bar
7216 <!-- foo --> </th><td> baz </td><td> quux</td></tr>
7217 </tbody></table>
7218 !! end
7219
7220 !!test
7221 Parsoid: Recover better from broken table attributes
7222 !!options
7223 parsoid=wt2html
7224 !!wikitext
7225 {| class="foo
7226 | class="bar" |
7227 foo
7228 |}
7229 !!html/php+tidy
7230 <table class="foo">
7231 <tr>
7232 <td class="bar">
7233 <p>foo</p>
7234 </td>
7235 </tr>
7236 </table>
7237 !!html/parsoid
7238 <table class="foo">
7239 <tr>
7240 <td class="bar">
7241 <p>foo</p></td></tr>
7242 </tbody></table>
7243 !!end
7244
7245 !! test
7246 Tables: Digest broken attributes on table and tr tag
7247 !! options
7248 parsoid=wt2html
7249 !! wikitext
7250 {| || |} ++
7251 |- || || ++ --
7252 |- > [
7253 |}
7254 !! html
7255 <table>
7256 <tbody>
7257 <tr></tr>
7258 <tr></tr>
7259 </tbody></table>
7260 !! end
7261
7262 # T137406: Whitespace in the HTML
7263 !! test
7264 1. Generate correct wikitext for tables with thead/tbody/tfoot
7265 !! options
7266 parsoid=html2wt
7267 !! html/parsoid
7268 <table>
7269 <caption>Test</caption>
7270 <thead>
7271 <tr>
7272 <th>Month</th>
7273 <th>Savings</th>
7274 </tr>
7275 </thead>
7276 <tbody>
7277 <tr>
7278 <td>January</td>
7279 <td>$100</td>
7280 </tr>
7281 <tr>
7282 <td>February</td>
7283 <td>$80</td>
7284 </tr>
7285 </tbody>
7286 <tfoot>
7287 <tr>
7288 <td>Sum</td>
7289 <td>$180</td>
7290 </tr>
7291 </tfoot>
7292 </table>
7293 !! wikitext
7294 {|
7295 |+Test
7296 !Month
7297 !Savings
7298 |-
7299 |January
7300 |$100
7301 |-
7302 |February
7303 |$80
7304 |-
7305 |Sum
7306 |$180
7307 |}
7308 !! html/php+tidy
7309 <table>
7310 <caption>Test</caption>
7311 <tr>
7312 <th>Month</th>
7313 <th>Savings</th>
7314 </tr>
7315 <tr>
7316 <td>January</td>
7317 <td>$100</td>
7318 </tr>
7319 <tr>
7320 <td>February</td>
7321 <td>$80</td>
7322 </tr>
7323 <tr>
7324 <td>Sum</td>
7325 <td>$180</td>
7326 </tr>
7327 </table>
7328 !! end
7329
7330 # T137406: No whitespace in the HTML
7331 !! test
7332 2. Generate correct wikitext for tables with thead/tbody/tfoot
7333 !! options
7334 parsoid=html2wt
7335 !! html/parsoid
7336 <table><thead><tr><th>heading</th></tr></thead><tbody><tr><td>foo</td></tr></tbody></table>
7337 !! wikitext
7338 {|
7339 !heading
7340 |-
7341 |foo
7342 |}
7343 !! end
7344
7345 !! test
7346 Testing serialization after deletion in references
7347 !! options
7348 parsoid={
7349 "modes": ["wt2wt"],
7350 "changes": [
7351 ["#x", "remove"]
7352 ]
7353 }
7354 !! wikitext
7355 hi <ref><div id="x">ho</div></ref>
7356
7357 <references />
7358 !! wikitext/edited
7359 hi <ref></ref>
7360
7361 <references />
7362 !! end
7363
7364 !!test
7365 Testing serialization after deletion of table cells
7366 !!options
7367 parsoid={
7368 "modes": ["wt2wt", "selser"],
7369 "changes": [
7370 ["#x", "remove"]
7371 ]
7372 }
7373 !!wikitext
7374 {|
7375 !h1 !!h2 !!h3
7376 | id="x" |c1 {{!}}{{!}}{{!}}c2 |||c3
7377 |}
7378 !! wikitext/edited
7379 {|
7380 !h1 !!h2 !!h3
7381 |c2 |||c3
7382 |}
7383 !!end
7384
7385 !! test
7386 Testing selser after addition of new row before first row (T125419)
7387 !! options
7388 parsoid={
7389 "modes": ["wt2wt", "selser"],
7390 "changes": [
7391 [ "tr", "before", "<tr><td>X</td></tr>" ]
7392 ]
7393 }
7394 !! wikitext
7395 {|
7396 |a
7397 |}
7398 !! wikitext/edited
7399 {|
7400 |X
7401 |-
7402 |a
7403 |}
7404 !! end
7405
7406 !! test
7407 Serialize new table rows in a HTML table using HTML tags
7408 !! options
7409 parsoid={
7410 "modes": ["wt2wt", "selser"],
7411 "changes": [
7412 [ "tr", "before", "<tr><td>X</td></tr>" ]
7413 ]
7414 }
7415 !! wikitext
7416 <table><tr><td>a</td></tr></table>
7417 !! wikitext/edited
7418 <table><tr><td>X</td></tr><tr><td>a</td></tr></table>
7419 !! end
7420
7421 !! test
7422 Serialize new table cells in a HTML row using HTML tags
7423 !! options
7424 parsoid={
7425 "modes": ["wt2wt", "selser"],
7426 "changes": [
7427 [ "td", "before", "<td>X</td>" ]
7428 ]
7429 }
7430 !! wikitext
7431 <table><tr><td>a</td></tr></table>
7432 !! wikitext/edited
7433 <table><tr><td>X</td><td>a</td></tr></table>
7434 !! end
7435
7436 !! test
7437 Wikitext tables can be nested inside HTML tables
7438 !! options
7439 parsoid=html2wt
7440 !! html
7441 <table data-parsoid='{"stx":"html"}'>
7442 <tr><td>
7443 <table>
7444 <tr><td>foo</td></tr>
7445 </table>
7446 </td></tr>
7447 </table>
7448 !! wikitext
7449 <table>
7450 <tr><td>
7451 {|
7452 |foo
7453 |}
7454 </td></tr>
7455 </table>
7456 !! end
7457
7458 !! test
7459 Serialize wikitext list items as HTML list items when embedded in a HTML list
7460 !! options
7461 parsoid=html2wt
7462 !! html
7463 <ul data-parsoid='{"stx": "html"}'>
7464 <li data-parsoid='{}'>a</li>
7465 <li>b</li>
7466 </ul>
7467 !! wikitext
7468 <ul>
7469 <li>a</li>
7470 <li>b</li>
7471 </ul>
7472 !! end
7473
7474 # SSS FIXME: Is this actually a good thing given the
7475 # odd nested list output that is generated by MW?
7476 # <ul><li>foo<ul>..</ul></li></ul> instead of
7477 # <ul><li>foo</li><ul>..</ul></ul>
7478 !! test
7479 Wikitext lists can be nested inside HTML lists
7480 !! options
7481 parsoid=html2wt
7482 !! html
7483 <ul data-parsoid='{"stx": "html"}'>
7484 <li data-parsoid='{"stx": "html"}'>a
7485 <ul><li>b</li></ul>
7486 </li>
7487 </ul>
7488
7489 <ul data-parsoid='{"stx": "html"}'>
7490 <li>x
7491 <ul><li>y</li></ul>
7492 </li>
7493 </ul>
7494 !! wikitext
7495 <ul>
7496 <li>a
7497 * b
7498 </li>
7499 </ul>
7500
7501 <ul>
7502 <li>x
7503 * y
7504 </li>
7505 </ul>
7506 !! end
7507
7508 ###
7509 ### Internal links
7510 ###
7511 !! test
7512 Plain link, capitalized
7513 !! wikitext
7514 [[Main Page]]
7515 !! html
7516 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
7517 </p>
7518 !! end
7519
7520 !! test
7521 Plain link, uncapitalized
7522 !! wikitext
7523 [[main Page]]
7524 !! html
7525 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
7526 </p>
7527 !! end
7528
7529 !! test
7530 Piped link
7531 !! wikitext
7532 [[Main Page|The Main Page]]
7533 !! html
7534 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
7535 </p>
7536 !! end
7537
7538 !! test
7539 Piped link with comment in link text
7540 !! wikitext
7541 [[Main Page|The Main<!--front--> Page]]
7542 !! html
7543 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
7544 </p>
7545 !! end
7546
7547 !! test
7548 Piped link with multiple pipe characters in link text
7549 !! wikitext
7550 [[Main Page||The|Main|Page|]]
7551 !! html/php
7552 <p><a href="/wiki/Main_Page" title="Main Page">|The|Main|Page|</a>
7553 </p>
7554 !! html/parsoid
7555 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">|The|Main|Page|</a></p>
7556 !! end
7557
7558 !! test
7559 Piped link with no link text
7560 !! wikitext
7561 [[Thomas Bek (bishop of St David's)|]]
7562 !! html/php
7563 <p>[[Thomas Bek (bishop of St David's)|]]
7564 </p>
7565 !! html/parsoid
7566 <p>[[Thomas Bek (bishop of St David's)|]]</p>
7567 !! end
7568
7569 !! test
7570 Piped link with empty link text
7571 !! wikitext
7572 [[Main Page|<nowiki/>]] - empty nowiki
7573 [[Main Page| ]] - empty space
7574 [[Main Page|&nbsp;]] - empty non breaking space
7575 !! html/php
7576 <p><a href="/wiki/Main_Page" title="Main Page"></a> - empty nowiki
7577 <a href="/wiki/Main_Page" title="Main Page"> </a> - empty space
7578 <a href="/wiki/Main_Page" title="Main Page">&#160;</a> - empty non breaking space
7579 </p>
7580 !! html/parsoid
7581 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page"><span typeof="mw:Nowiki"></span></a> - empty nowiki
7582 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page"> </a> - empty space
7583 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page"><span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span></a> - empty non breaking space</p>
7584 !! end
7585
7586 !! test
7587 Broken link
7588 !! wikitext
7589 [[Zigzagzogzagzig]]
7590 !! html
7591 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
7592 </p>
7593 !! end
7594
7595 !! test
7596 Broken link with fragment
7597 !! wikitext
7598 [[Zigzagzogzagzig#zug]]
7599 !! html
7600 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
7601 </p>
7602 !! end
7603
7604 !! test
7605 Special page link with fragment
7606 !! wikitext
7607 [[Special:Version#anchor]]
7608 !! html
7609 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
7610 </p>
7611 !! end
7612
7613 !! test
7614 Nonexistent special page link with fragment
7615 !! wikitext
7616 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
7617 !! html
7618 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
7619 </p>
7620 !! end
7621
7622 !! test
7623 Link with prefix
7624 !! wikitext
7625 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
7626 !! html
7627 <p>xxx<a href="/wiki/Main_Page" title="Main Page">main Page</a>, xxx<a href="/wiki/Main_Page" title="Main Page">Main Page</a>, Xxx<a href="/wiki/Main_Page" title="Main Page">main Page</a> XXX<a href="/wiki/Main_Page" title="Main Page">main Page</a>, XXX<a href="/wiki/Main_Page" title="Main Page">Main Page</a>
7628 </p>
7629 !! end
7630
7631 !! test
7632 Link with suffix
7633 !! wikitext
7634 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
7635 !! html
7636 <p><a href="/wiki/Main_Page" title="Main Page">Main Pagexxx</a>, <a href="/wiki/Main_Page" title="Main Page">Main Page</a>XXX, <a href="/wiki/Main_Page" title="Main Page">Main Page</a>!!!
7637 </p>
7638 !! end
7639
7640 !! article
7641 prefixed article
7642 !! text
7643 Some text
7644 !! endarticle
7645
7646 !! test
7647 T45661: Piped links with identical prefixes
7648 !! wikitext
7649 [[prefixed article|prefixed articles with spaces]]
7650
7651 [[prefixed article|prefixed articlesaoeu]]
7652
7653 [[Main Page|Main Page test]]
7654 !! html
7655 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
7656 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
7657 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
7658 </p>
7659 !! end
7660
7661
7662 !! test
7663 Link with HTML entity in suffix / tail
7664 !! wikitext
7665 [[Main Page]]&quot;, [[Main Page]]&#97;
7666 !! html/php
7667 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>&quot;, <a href="/wiki/Main_Page" title="Main Page">Main Page</a>&#97;
7668 </p>
7669 !! html/parsoid
7670 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;quot;","srcContent":"\""}'>"</span>, <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#97;","srcContent":"a"}'>a</span></p>
7671 !! end
7672
7673 !! test
7674 Link with 3 brackets
7675 !! wikitext
7676 [[[Main Page]]]
7677 Foo [[[Main Page]]]
7678 !! html
7679 <p>[[[Main Page]]]
7680 Foo [[[Main Page]]]
7681 </p>
7682 !! end
7683
7684 !! test
7685 Link with 4 brackets
7686 !! wikitext
7687 [[[[Main Page]]]]
7688 !! html
7689 <p>[[<a href="/wiki/Main_Page" title="Main Page">Main Page</a>]]
7690 </p>
7691 !! end
7692
7693 !! test
7694 Piped link with 3 brackets
7695 !! wikitext
7696 [[[main page|the main page]]]
7697 !! html
7698 <p>[[[main page|the main page]]]
7699 </p>
7700 !! end
7701
7702 !! test
7703 Piped link with extlink-like text
7704 !! wikitext
7705 [[Main Page|[bar]]]
7706 [[Main Page|This is a [bar]]]
7707 !! html/php
7708 <p><a href="/wiki/Main_Page" title="Main Page">[bar]</a>
7709 <a href="/wiki/Main_Page" title="Main Page">This is a [bar]</a>
7710 </p>
7711 !! html/parsoid
7712 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>[bar]</a>
7713 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>This is a [bar]</a></p>
7714 !! end
7715
7716 !! test
7717 Link with multiple pipes
7718 !! wikitext
7719 [[Main Page|The|Main|Page]]
7720 !! html
7721 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
7722 </p>
7723 !! end
7724
7725 !! test
7726 Anchor containing a #. (T65430)
7727 !! wikitext
7728 [[Main Page#And#Link]]
7729 !! html/php
7730 <p><a href="/wiki/Main_Page#And.23Link" title="Main Page">Main Page#And#Link</a>
7731 </p>
7732 !! html/parsoid
7733 <p><a rel="mw:WikiLink" href="./Main_Page#And.23Link" title="Main Page" data-parsoid='{"stx":"simple","a":{"href":"./Main_Page#And.23Link"},"sa":{"href":"Main Page#And#Link"}}'>Main Page#And#Link</a></p>
7734 !! end
7735
7736 !! test
7737 Link to namespaces
7738 !! wikitext
7739 [[Talk:Parser testing]], [[Meta:Disclaimers]]
7740 !! html
7741 <p><a href="/index.php?title=Talk:Parser_testing&amp;action=edit&amp;redlink=1" class="new" title="Talk:Parser testing (page does not exist)">Talk:Parser testing</a>, <a href="/index.php?title=Meta:Disclaimers&amp;action=edit&amp;redlink=1" class="new" title="Meta:Disclaimers (page does not exist)">Meta:Disclaimers</a>
7742 </p>
7743 !! end
7744
7745 !! test
7746 Link with space in namespace
7747 !! wikitext
7748 [[User talk:Foo bar]]
7749 !! html
7750 <p><a href="/index.php?title=User_talk:Foo_bar&amp;action=edit&amp;redlink=1" class="new" title="User talk:Foo bar (page does not exist)">User talk:Foo bar</a>
7751 </p>
7752 !! end
7753
7754 !! article
7755 MemoryAlpha:AlphaTest
7756 !! text
7757 This is an article in the MemoryAlpha namespace
7758 (which shadows the memoryalpha interwiki link).
7759 !! endarticle
7760
7761 !! test
7762 Namespace takes precedence over interwiki link (T53680)
7763 !! wikitext
7764 [[MemoryAlpha:AlphaTest]]
7765 !! html
7766 <p><a href="/wiki/MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
7767 </p>
7768 !! end
7769
7770 # The previous test doesn't work correctly in html2*, due to not recognizing the
7771 # link as an internal one. This one checks for the correct behavior.
7772 !! test
7773 Link to namespace preferred over interwiki with correct rel attribute
7774 !! options
7775 parsoid=html2wt,html2html
7776 !! html/parsoid
7777 <p><a rel="mw:WikiLink" href="./MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a></p>
7778 !! wikitext
7779 [[MemoryAlpha:AlphaTest]]
7780 !! end
7781
7782 !! test
7783 Piped link to namespace
7784 !! wikitext
7785 [[Meta:Disclaimers|The disclaimers]]
7786 !! html
7787 <p><a href="/index.php?title=Meta:Disclaimers&amp;action=edit&amp;redlink=1" class="new" title="Meta:Disclaimers (page does not exist)">The disclaimers</a>
7788 </p>
7789 !! end
7790
7791 !! test
7792 Link containing }
7793 !! wikitext
7794 [[Usually caused by a typo (oops}]]
7795 !! html
7796 <p>[[Usually caused by a typo (oops}]]
7797 </p>
7798 !! end
7799
7800 !! article
7801 7% Solution
7802 !! text
7803 Just a test of an article title containing a percent.
7804 !! endarticle
7805
7806 !! test
7807 Link containing % (not as a hex sequence)
7808 !! wikitext
7809 [[7% Solution]]
7810 [[7% Solution|7%25 Solution]]
7811 !! html/php
7812 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
7813 <a href="/wiki/7%25_Solution" title="7% Solution">7%25 Solution</a>
7814 </p>
7815 !! html/parsoid
7816 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a>
7817 <a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7%25 Solution</a></p>
7818 !! end
7819
7820 # note that the parsoid HTML is identical to the previous test output,
7821 # so the previous test ensures that the html2wt mode will generate the
7822 # "not as a hex sequence" wikitext.
7823 !! test
7824 Link containing % as a single hex sequence interpreted to char
7825 !! options
7826 parsoid=wt2wt,wt2html,html2html
7827 !! wikitext
7828 [[7%25 Solution]]
7829 [[7%25 Solution|7%25 Solution]]
7830 !! html/php
7831 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
7832 <a href="/wiki/7%25_Solution" title="7% Solution">7%25 Solution</a>
7833 </p>
7834 !! html/parsoid
7835 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a>
7836 <a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7%25 Solution</a></p>
7837 !!end
7838
7839 !! test
7840 Link containing % as a double hex sequence interpreted to hex sequence
7841 !! wikitext
7842 [[7%2525 Solution]]
7843 !! html
7844 <p>[[7%2525 Solution]]
7845 </p>
7846 !!end
7847
7848 ## Example for such a section: == < ==
7849 !! test
7850 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
7851 !! wikitext
7852 [[%23%3c]][[%23%3e]]
7853 !! html/php
7854 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
7855 </p>
7856 !! html/parsoid
7857 <p><a rel="mw:WikiLink" href="./Main_Page#.3C" title="Main Page" data-parsoid='{"stx":"simple","a":{"href":"./Main_Page#.3C"},"sa":{"href":"%23%3c"}}'>#&lt;</a><a rel="mw:WikiLink" href="./Main_Page#.3E" title="Main Page" data-parsoid='{"stx":"simple","a":{"href":"./Main_Page#.3E"},"sa":{"href":"%23%3e"}}'>#></a></p>
7858 !! end
7859
7860 !! test
7861 Link containing "<#" and ">#" as a hex sequences
7862 !! wikitext
7863 [[%3c%23]][[%3e%23]]
7864 !! html
7865 <p>[[%3c%23]][[%3e%23]]
7866 </p>
7867 !! end
7868
7869 !! test
7870 Link containing an equals sign
7871 !! wikitext
7872 [[Special:BookSources/isbn=4-00-026157-6]]
7873 !! html/php
7874 <p><a href="/wiki/Special:BookSources/isbn%3D4-00-026157-6" title="Special:BookSources/isbn=4-00-026157-6">Special:BookSources/isbn=4-00-026157-6</a>
7875 </p>
7876 !! html/parsoid
7877 <p><a rel="mw:WikiLink" href="./Special:BookSources/isbn=4-00-026157-6" title="Special:BookSources/isbn=4-00-026157-6">Special:BookSources/isbn=4-00-026157-6</a></p>
7878 !! end
7879
7880 !! article
7881 Foo~bar
7882 !! text
7883 Just a test of an article title containing a tilde.
7884 !! endarticle
7885
7886 # note that links containing signatures, like [[Foo~~~~]], are
7887 # massaged by the pre-save transform (PST) and so the tildes are never
7888 # seen by the parser.
7889 !! test
7890 Link containing a tilde
7891 !! wikitext
7892 [[Foo~bar]]
7893 !! html/php
7894 <p><a href="/wiki/Foo~bar" title="Foo~bar">Foo~bar</a>
7895 </p>
7896 !! html/parsoid
7897 <p><a rel="mw:WikiLink" href="./Foo~bar" title="Foo~bar">Foo~bar</a></p>
7898 !! end
7899
7900 !! test
7901 Link containing double-single-quotes '' (T6598)
7902 !! wikitext
7903 [[Lista d''e paise d''o munno]]
7904 !! html/php
7905 <p><a href="/index.php?title=Lista_d%27%27e_paise_d%27%27o_munno&amp;action=edit&amp;redlink=1" class="new" title="Lista d''e paise d''o munno (page does not exist)">Lista d''e paise d''o munno</a>
7906 </p>
7907 !! html/parsoid
7908 <p><a rel="mw:WikiLink" href="./Lista_d''e_paise_d''o_munno" title="Lista d''e paise d''o munno">Lista d''e paise d''o munno</a></p>
7909 !! end
7910
7911 !! test
7912 Link containing double quotes and spaces
7913 !! wikitext
7914 [[Cool "Gator"]]
7915 !! html/php
7916 <p><a href="/index.php?title=Cool_%22Gator%22&amp;action=edit&amp;redlink=1" class="new" title="Cool &quot;Gator&quot; (page does not exist)">Cool "Gator"</a>
7917 </p>
7918 !! html/parsoid
7919 <p><a rel="mw:WikiLink" href="./Cool_%22Gator%22" title='Cool "Gator"'>Cool "Gator"</a></p>
7920 !! end
7921
7922 !! test
7923 File containing double quotes and spaces
7924 !! wikitext
7925 [[File:Cool "Gator".png]]
7926 !! html/parsoid
7927 <p><span class="mw-default-size" typeof="mw:Error mw:Image" data-parsoid='{"optList":[]}' data-mw='{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}]}'><a href="./File:Cool_%22Gator%22.png" data-parsoid='{"a":{"href":"./File:Cool_%22Gator%22.png"},"sa":{"href":"File:Cool \"Gator\".png"}}'><img resource='./File:Cool_"Gator".png' src="./Special:FilePath/Cool_%22Gator%22.png" height="220" width="220" data-parsoid='{"a":{"resource":"./File:Cool_\"Gator\".png","height":"220","width":"220","src":"./Special:FilePath/Cool_%22Gator%22.png"},"sa":{"resource":"File:Cool \"Gator\".png","src":"./Special:FilePath/Cool_\"Gator\".png"}}'/></a></span></p>
7928 !! end
7929
7930 !! test
7931 Redirect containing double quotes and spaces
7932 !! wikitext
7933 #REDIRECT [[Cool "Gator"]]
7934 !! html/parsoid
7935 <link rel="mw:PageProp/redirect" href="./Cool_%22Gator%22" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Cool_%22Gator%22"},"sa":{"href":"Cool \"Gator\""}}'/>
7936 !! end
7937
7938 !! test
7939 Link containing double-single-quotes '' in text (T6598 sanity check)
7940 !! wikitext
7941 Some [[Link|pretty ''italics'' and stuff]]!
7942 !! html/php
7943 <p>Some <a href="/index.php?title=Link&amp;action=edit&amp;redlink=1" class="new" title="Link (page does not exist)">pretty <i>italics</i> and stuff</a>!
7944 </p>
7945 !! html/parsoid
7946 <p>Some <a rel="mw:WikiLink" href="./Link" title="Link">pretty <i>italics</i> and stuff</a>!</p>
7947 !! end
7948
7949 !! test
7950 Link containing double-single-quotes '' in text embedded in italics (T6598 sanity check)
7951 !! wikitext
7952 ''Some [[Link|pretty ''italics'' and stuff]]!''
7953 !! html
7954 <p><i>Some <a href="/index.php?title=Link&amp;action=edit&amp;redlink=1" class="new" title="Link (page does not exist)">pretty <i>italics</i> and stuff</a>!</i>
7955 </p>
7956 !! end
7957
7958 !! test
7959 Link with double quotes in title part (literal) and alternate part (interpreted)
7960 !! wikitext
7961 [[File:Denys_Savchenko_''Pentecoste''.jpg]]
7962
7963 [[''Pentecoste'']]
7964
7965 [[''Pentecoste''|Pentecoste]]
7966
7967 [[''Pentecoste''|''Pentecoste'']]
7968 !! html/php
7969 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Denys_Savchenko_%27%27Pentecoste%27%27.jpg" class="new" title="File:Denys Savchenko &#39;&#39;Pentecoste&#39;&#39;.jpg">File:Denys Savchenko <i>Pentecoste</i>.jpg</a>
7970 </p><p><a href="/index.php?title=%27%27Pentecoste%27%27&amp;action=edit&amp;redlink=1" class="new" title="''Pentecoste'' (page does not exist)">''Pentecoste''</a>
7971 </p><p><a href="/index.php?title=%27%27Pentecoste%27%27&amp;action=edit&amp;redlink=1" class="new" title="''Pentecoste'' (page does not exist)">Pentecoste</a>
7972 </p><p><a href="/index.php?title=%27%27Pentecoste%27%27&amp;action=edit&amp;redlink=1" class="new" title="''Pentecoste'' (page does not exist)"><i>Pentecoste</i></a>
7973 </p>
7974 !! html/parsoid
7975 <p><span class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}]}'><a href="./File:Denys_Savchenko_''Pentecoste''.jpg"><img resource="./File:Denys_Savchenko_''Pentecoste''.jpg" src="./Special:FilePath/Denys_Savchenko_''Pentecoste''.jpg" height="220" width="220"/></a></span></p>
7976 <p><a rel="mw:WikiLink" href="./''Pentecoste''" title="''Pentecoste''">''Pentecoste''</a></p>
7977 <p><a rel="mw:WikiLink" href="./''Pentecoste''" title="''Pentecoste''">Pentecoste</a></p>
7978 <p><a rel="mw:WikiLink" href="./''Pentecoste''" title="''Pentecoste''"><i>Pentecoste</i></a></p>
7979 !! end
7980
7981 !! test
7982 Broken image links with HTML captions (T41700)
7983 !! wikitext
7984 [[File:Nonexistent|<script></script>]]
7985 [[File:Nonexistent|100x100px|<script></script>]]
7986 [[File:Nonexistent|&lt;]]
7987 [[File:Nonexistent|a<i>b</i>c]]
7988 !! html/php
7989 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
7990 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
7991 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
7992 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
7993 </p>
7994 !! html/parsoid
7995 <p><span class="mw-default-size" typeof="mw:Error mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"&lt;script>&lt;/script>"}]}' data-mw='{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}],"caption":"&amp;lt;script>&amp;lt;/script>"}'><a href="./File:Nonexistent" data-parsoid='{"a":{"href":"./File:Nonexistent"},"sa":{}}'><img resource="./File:Nonexistent" src="./Special:FilePath/Nonexistent" height="220" width="220" data-parsoid='{"a":{"resource":"./File:Nonexistent","height":"220","width":"220"},"sa":{"resource":"File:Nonexistent"}}'/></a></span>
7996 <span typeof="mw:Error mw:Image" data-parsoid='{"optList":[{"ck":"width","ak":"100x100px"},{"ck":"caption","ak":"&lt;script>&lt;/script>"}]}' data-mw='{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}],"caption":"&amp;lt;script>&amp;lt;/script>"}'><a href="./File:Nonexistent" data-parsoid='{"a":{"href":"./File:Nonexistent"},"sa":{}}'><img resource="./File:Nonexistent" src="./Special:FilePath/Nonexistent" height="100" width="100" data-parsoid='{"a":{"resource":"./File:Nonexistent","height":"100","width":"100"},"sa":{"resource":"File:Nonexistent"}}'/></a></span>
7997 <span class="mw-default-size" typeof="mw:Error mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"&amp;lt;"}]}' data-mw='{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}],"caption":"&lt;span typeof=\"mw:Entity\" data-parsoid=&#39;{\"src\":\"&amp;amp;lt;\",\"srcContent\":\"&amp;lt;\",\"dsr\":[107,111,null,null]}&#39;>&amp;lt;&lt;/span>"}'><a href="./File:Nonexistent" data-parsoid='{"a":{"href":"./File:Nonexistent"},"sa":{}}'><img resource="./File:Nonexistent" src="./Special:FilePath/Nonexistent" height="220" width="220" data-parsoid='{"a":{"resource":"./File:Nonexistent","height":"220","width":"220"},"sa":{"resource":"File:Nonexistent"}}'/></a></span>
7998 <span class="mw-default-size" typeof="mw:Error mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"a&lt;i>b&lt;/i>c"}]}' data-mw='{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}],"caption":"a&lt;i data-parsoid=&#39;{\"stx\":\"html\",\"dsr\":[134,142,3,4]}&#39;>b&lt;/i>c"}'><a href="./File:Nonexistent" data-parsoid='{"a":{"href":"./File:Nonexistent"},"sa":{}}'><img resource="./File:Nonexistent" src="./Special:FilePath/Nonexistent" height="220" width="220" data-parsoid='{"a":{"resource":"./File:Nonexistent","height":"220","width":"220"},"sa":{"resource":"File:Nonexistent"}}'/></a></span></p>
7999 !! end
8000
8001 !! test
8002 Plain link to URL
8003 !! wikitext
8004 [[http://www.example.com]]
8005 !! html/php
8006 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
8007 </p>
8008 !! html/parsoid
8009 <p>[<a rel="mw:ExtLink" href="http://www.example.com"></a>]</p>
8010 !! end
8011
8012 !! test
8013 Plain link to URL with link text
8014 !! wikitext
8015 [[http://www.example.com Link text]]
8016 !! html
8017 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
8018 </p>
8019 !! end
8020
8021 !! test
8022 Plain link to protocol-relative URL
8023 !! wikitext
8024 [[//www.example.com]]
8025 !! html/php
8026 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
8027 </p>
8028 !! html/parsoid
8029 <p>[<a rel="mw:ExtLink" href="//www.example.com"></a>]</p>
8030 !! end
8031
8032 !! test
8033 Plain link to protocol-relative URL with link text
8034 !! wikitext
8035 [[//www.example.com Link text]]
8036 !! html
8037 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
8038 </p>
8039 !! end
8040
8041 !! test
8042 Plain link to page with question mark in title
8043 !! wikitext
8044 [[A?b]]
8045
8046 [[A?b|Baz]]
8047 !! html
8048 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
8049 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
8050 </p>
8051 !! end
8052
8053
8054 # I'm fairly sure the expected result here is wrong.
8055 # We want these to be URL links, not pseudo-pages with URLs for titles....
8056 # However the current output is also pretty screwy.
8057 #
8058 # ----
8059 # I'm changing it to match the current output--it arguably makes more
8060 # sense in the light of the test above. Old expected result was:
8061 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
8062 #</p>
8063 # But I think this test is bordering on "garbage in, garbage out" anyway.
8064 # -- wtm
8065 !! test
8066 Piped link to URL
8067 !! wikitext
8068 Piped link to URL: [[http://www.example.com|an example URL]]
8069 !! html/php
8070 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
8071 </p>
8072 !! html/parsoid
8073 <p>Piped link to URL: [<a rel="mw:ExtLink" href="http://www.example.com%7Can" data-parsoid='{"a":{"href":"http://www.example.com%7Can"},"sa":{"href":"http://www.example.com|an"}}'>example URL</a>]</p>
8074 !! end
8075
8076 !! test
8077 T2002: [[page|http://url/]] should link to page, not http://url/
8078 !! wikitext
8079 [[Main Page|http://url/]]
8080 !! html/php
8081 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
8082 </p>
8083 !! html/parsoid
8084 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">http://url/</a></p>
8085 !! end
8086
8087 # Parsoid does not mark self-links, by design.
8088 !! test
8089 T2337: Escaped self-links should be bold
8090 !! options
8091 title=[[Bug462]]
8092 !! wikitext
8093 [[Bu&#103;462]] [[Bug462]]
8094 !! html/php
8095 <p><a class="mw-selflink selflink">Bu&#103;462</a> <a class="mw-selflink selflink">Bug462</a>
8096 </p>
8097 !! html/php+tidy
8098 <p><a class="mw-selflink selflink">Bug462</a> <a class="mw-selflink selflink">Bug462</a></p>
8099 !! html/parsoid
8100 <p><a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a> <a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a></p>
8101 !! end
8102
8103 !! test
8104 Self-link to section should not be bold
8105 !! options
8106 title=[[Main Page]]
8107 !! wikitext
8108 [[Main Page#section]]
8109 !! html
8110 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
8111 </p>
8112 !! end
8113
8114 !! article
8115 00
8116 !! text
8117 This is 00.
8118 !! endarticle
8119
8120 !!test
8121 Self-link to numeric title
8122 !!options
8123 title=[[0]]
8124 !! wikitext
8125 [[0]]
8126 !! html
8127 <p><a class="mw-selflink selflink">0</a>
8128 </p>
8129 !!end
8130
8131 !!test
8132 Link to numeric-equivalent title
8133 !!options
8134 title=[[0]]
8135 !! wikitext
8136 [[00]]
8137 !! html
8138 <p><a href="/wiki/00" title="00">00</a>
8139 </p>
8140 !!end
8141
8142 !! test
8143 <nowiki> inside a link
8144 !! wikitext
8145 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
8146 !! html
8147 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
8148 </p>
8149 !! end
8150
8151 !! test
8152 Non-breaking spaces in title
8153 !! wikitext
8154 [[&nbsp; Main &nbsp; Page &nbsp;]]
8155 !! html
8156 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
8157 </p>
8158 !!end
8159
8160 !! test
8161 Internal link with ca linktrail, surrounded by bold apostrophes (T29473 primary issue)
8162 !! options
8163 language=ca
8164 !! wikitext
8165 '''[[Main Page]]'''
8166 !! html
8167 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
8168 </p>
8169 !! end
8170
8171 !! test
8172 Internal link with ca linktrail, surrounded by italic apostrophes (T29473 primary issue)
8173 !! options
8174 language=ca
8175 !! wikitext
8176 ''[[Main Page]]''
8177 !! html
8178 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
8179 </p>
8180 !! end
8181
8182 !! test
8183 Internal link with en linktrail: no apostrophes (T29473)
8184 !! options
8185 language=en
8186 !! wikitext
8187 [[Something]]'nice
8188 !! html
8189 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
8190 </p>
8191 !! end
8192
8193 !! test
8194 Internal link with ca linktrail with apostrophes (T29473)
8195 !! options
8196 language=ca
8197 !! wikitext
8198 [[Something]]'nice
8199 !! html
8200 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
8201 </p>
8202 !! end
8203
8204 !! test
8205 Internal link with kaa linktrail with apostrophes (T29473)
8206 !! options
8207 language=kaa
8208 !! wikitext
8209 [[Something]]'nice
8210 !! html
8211 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (bet ele jaratılmag'an)">Something'nice</a>
8212 </p>
8213 !! end
8214
8215 !! test
8216 Link with multiple ":" in a subpage-supporting namespace (T65636)
8217 !! wikitext
8218 [[User:Foo/Test/63636:Bar|Test]]
8219 !! html/php
8220 <p><a href="/index.php?title=User:Foo/Test/63636:Bar&amp;action=edit&amp;redlink=1" class="new" title="User:Foo/Test/63636:Bar (page does not exist)">Test</a>
8221 </p>
8222 !! html/parsoid
8223 <p><a rel="mw:WikiLink" href="./User:Foo/Test/63636:Bar" title="User:Foo/Test/63636:Bar">Test</a></p>
8224 !! end
8225
8226 ## Mainly a sanity check for Parsoid
8227 !! test
8228 Handle title parsing for subpages
8229 !! options
8230 title=[[/123123]]
8231 subpage
8232 !! wikitext
8233 123
8234 !! html/php
8235 <p>123
8236 </p>
8237 !! html/parsoid
8238 <p>123</p>
8239 !! end
8240
8241 !! article
8242 User:Test/123
8243 !! text
8244 test 123
8245 !! endarticle
8246
8247 !! test
8248 Link to a subpage from a namespace other than main
8249 !! options
8250 title=[[User:Test]]
8251 subpage
8252 !! wikitext
8253 [[/123]]
8254 !! html/php
8255 <p><a href="/wiki/User:Test/123" title="User:Test/123">/123</a>
8256 </p>
8257 !! html/parsoid
8258 <p><a rel="mw:WikiLink" href="./User:Test/123" title="User:Test/123" data-parsoid='{"stx":"simple","a":{"href":"./User:Test/123"},"sa":{"href":"/123"}}'>/123</a></p>
8259 !! end
8260
8261 !! test
8262 Ensure that transclusion titles are not url-decoded
8263 !! options
8264 subpage title=[[Test]]
8265 parsoid=wt2html
8266 !! wikitext
8267 {{Bar%C3%A9}} {{/Bar%C3%A9}}
8268 !! html/php
8269 <p>{{Bar%C3%A9}} {{/Bar%C3%A9}}
8270 </p>
8271 !! html/parsoid
8272 <p>{{Bar%C3%A9}} {{/Bar%C3%A9}}</p>
8273 !! end
8274
8275 !! test
8276 Purely hash wikilink
8277 !! options
8278 title=[[User:Test/123]]
8279 subpage
8280 !! wikitext
8281 [[#a|b]]
8282 !! html/php
8283 <p><a href="#a">b</a>
8284 </p>
8285 !! html/parsoid
8286 <p><a rel="mw:WikiLink" href="./User:Test/123#a" data-parsoid='{"stx":"piped","a":{"href":"./User:Test/123#a"},"sa":{"href":"#a"}}'>b</a></p>
8287 !! end
8288
8289 !! test
8290 1. Interaction of linktrail and template encapsulation
8291 !! wikitext
8292 {{echo|[[Foo]]}}l
8293 !! html/parsoid
8294 <p><a rel="mw:WikiLink" href="./Foo" title="Foo" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[Foo]]"}},"i":0}},"l"]}'>Fool</a></p>
8295 !! end
8296
8297 !! test
8298 2. Interaction of linktrail and template encapsulation
8299 !! options
8300 parsoid
8301 !! wikitext
8302 {{echo|Some [[Fool]]}}s
8303 !! html
8304 <p><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Some [[Fool]]"}},"i":0}},"s"]}' data-parsoid='{"pi":[[{"k":"1"}]]}'>Some </span><a rel="mw:WikiLink" href="./Fool" title="Fool" about="#mwt1" data-parsoid='{"stx":"simple","a":{"href":"./Fool"},"sa":{"href":"Fool"},"tail":"s"}'>Fools</a></p>
8305 !! end
8306
8307 !! test
8308 3. Interaction of linktrail and template encapsulation
8309 !! options
8310 parsoid
8311 !! wikitext
8312 {{echo|Some [[Fool]]s are '''bold and foolish'''}}
8313 !! html
8314 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Some [[Fool]]s are &#39;&#39;&#39;bold and foolish&#39;&#39;&#39;"}},"i":0}}]}' data-parsoid='{"pi":[[{"k":"1"}]]}'>Some <a rel="mw:WikiLink" href="./Fool" title="Fool" data-parsoid='{"stx":"simple","a":{"href":"./Fool"},"sa":{"href":"Fool"},"tail":"s"}'>Fools</a> are <b>bold and foolish</b></p>
8315 !! end
8316
8317 !! article
8318 Söfnuður
8319 !! text
8320 Test.
8321 !! endarticle
8322
8323 !! test
8324 Internal link with is link prefix
8325 !! options
8326 language=is
8327 !! wikitext
8328 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
8329 !! html
8330 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
8331 </p>
8332 !! end
8333
8334 !! article
8335 Mótmælendatrú
8336 !! text
8337 Test.
8338 !! endarticle
8339
8340 !! test
8341 Internal link with is link trail and link prefix
8342 !! options
8343 language=is
8344 !! wikitext
8345 [[mótmælendatrú|xxx]]ar
8346 [[mótmælendatrú]]ar
8347 mótmælenda[[söfnuður]]
8348 mótmælenda[[söfnuður|söfnuðir]]
8349 mótmælenda[[söfnuður|söfnuðir]]xxx
8350 !! html
8351 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
8352 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
8353 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
8354 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
8355 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
8356 </p>
8357 !! end
8358
8359 !! test
8360 Parsoid link trail escaping
8361 !! options
8362 parsoid=html2wt,html2html
8363 !! html/parsoid
8364 <p><a rel="mw:WikiLink" href="./Apple" title="Apple">apple</a>s</p>
8365 !! wikitext
8366 [[apple]]<nowiki/>s
8367 !! end
8368
8369 !! test
8370 Parsoid link prefix escaping
8371 !! options
8372 language=is
8373 parsoid=html2wt,html2html
8374 !! html/parsoid
8375 <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="./Söfnuður" title="Söfnuður">söfnuður</a></p>
8376 !! wikitext
8377 Aðrir mótmælenda<nowiki/>[[söfnuður]]
8378 !! end
8379
8380 !! test
8381 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
8382 !! wikitext
8383 [[Foo| bar]]
8384
8385 [[Foo| ''bar'']]
8386
8387 [http://wp.org foo]
8388
8389 [http://wp.org ''foo'']
8390 !! html
8391 <p><a href="/wiki/Foo" title="Foo"> bar</a>
8392 </p><p><a href="/wiki/Foo" title="Foo"> <i>bar</i></a>
8393 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
8394 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
8395 </p>
8396 !! end
8397
8398 !! test
8399 Parsoid: Scoped parsing should handle mixed transclusions and plain text
8400 !! wikitext
8401 [[Foo|{{echo|a}} b {{echo|c}}]]
8402 !! html/parsoid
8403 <p><a rel="mw:WikiLink" href="./Foo" title="Foo"><span about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a"}},"i":0}}]}'>a</span> b <span about="#mwt3" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"c"}},"i":0}}]}'>c</span></a></p>
8404 !! end
8405
8406 !! test
8407 Link with angle bracket after anchor
8408 !! wikitext
8409 [[Foo#<bar>]]
8410 !! html/php
8411 <p><a href="/wiki/Foo#.3Cbar.3E" title="Foo">Foo#&lt;bar&gt;</a>
8412 </p>
8413 !! html/parsoid
8414 <p><a rel="mw:WikiLink" href="./Foo#.3Cbar.3E" title="Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo#.3Cbar.3E"},"sa":{"href":"Foo#&lt;bar>"}}'>Foo#&lt;bar></a></p>
8415 !! end
8416
8417 ###
8418 ### Interwiki links (see maintenance/interwiki.sql)
8419 ###
8420
8421 !! test
8422 Inline interwiki link
8423 !! options
8424 parsoid=wt2html,wt2wt,html2html
8425 !! wikitext
8426 [[MeatBall:SoftSecurity]]
8427 !! html/php
8428 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
8429 </p>
8430 !! html/parsoid
8431 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a></p>
8432 !! end
8433
8434 !! test
8435 Inline interwiki link with empty title (T4372)
8436 !! options
8437 parsoid=wt2html,wt2wt,html2html
8438 !! wikitext
8439 [[MeatBall:]]
8440 !! html/php
8441 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
8442 </p>
8443 !! html/parsoid
8444 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?" title="meatball:">MeatBall:</a></p>
8445 !! end
8446
8447 !! test
8448 Interwiki link encoding conversion (T3636)
8449 !! wikitext
8450 *[[Wikipedia:ro:Olteni&#0355;a]]
8451 *[[Wikipedia:ro:Olteni&#355;a]]
8452 !! html
8453 <ul><li><a href="http://en.wikipedia.org/wiki/ro:Olteni%C5%A3a" class="extiw" title="wikipedia:ro:Olteniţa">Wikipedia:ro:Olteni&#355;a</a></li>
8454 <li><a href="http://en.wikipedia.org/wiki/ro:Olteni%C5%A3a" class="extiw" title="wikipedia:ro:Olteniţa">Wikipedia:ro:Olteni&#355;a</a></li></ul>
8455
8456 !! html+tidy
8457 <ul>
8458 <li><a href="http://en.wikipedia.org/wiki/ro:Olteni%C5%A3a" class="extiw" title="wikipedia:ro:Olteniţa">Wikipedia:ro:Olteniţa</a></li>
8459 <li><a href="http://en.wikipedia.org/wiki/ro:Olteni%C5%A3a" class="extiw" title="wikipedia:ro:Olteniţa">Wikipedia:ro:Olteniţa</a></li>
8460 </ul>
8461 !! end
8462
8463 !! test
8464 Interwiki link with fragment (T4130)
8465 !! wikitext
8466 [[MeatBall:SoftSecurity#foo]]
8467 !! html
8468 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
8469 </p>
8470 !! end
8471
8472 !! test
8473 Link scenarios with escaped fragments
8474 !! wikitext
8475 [[#Is this great?]]
8476 [[Foo#Is this great?]]
8477 [[meatball:Foo#Is this great?]]
8478 !! html/php
8479 <p><a href="#Is_this_great.3F">#Is this great?</a>
8480 <a href="/wiki/Foo#Is_this_great.3F" title="Foo">Foo#Is this great?</a>
8481 <a href="http://www.usemod.com/cgi-bin/mb.pl?Foo#Is_this_great.3F" class="extiw" title="meatball:Foo">meatball:Foo#Is this great?</a>
8482 </p>
8483 !! html/parsoid
8484 <p><a rel="mw:WikiLink" href="./Main_Page#Is_this_great.3F" data-parsoid='{"stx":"simple","a":{"href":"./Main_Page#Is_this_great.3F"},"sa":{"href":"#Is this great?"}}'>#Is this great?</a>
8485 <a rel="mw:WikiLink" href="./Foo#Is_this_great.3F" title="Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo#Is_this_great.3F"},"sa":{"href":"Foo#Is this great?"}}'>Foo#Is this great?</a>
8486 <a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?Foo#Is_this_great.3F" title="meatball:Foo" data-parsoid='{"stx":"simple","a":{"href":"http://www.usemod.com/cgi-bin/mb.pl?Foo#Is_this_great.3F"},"sa":{"href":"meatball:Foo#Is this great?"},"isIW":true}'>meatball:Foo#Is this great?</a></p>
8487 !! end
8488
8489 # Ideally the wikipedia: prefix here should be proto-relative too
8490 # [CSA]: this is kind of a bogus test, as the PHP parser test doesn't
8491 # define the 'en' prefix, and originally the test used 'wikipedia',
8492 # which isn't a localinterwiki prefix hence the links to the 'en:Foo'
8493 # article.
8494 !! test
8495 Different interwiki prefixes mapping to the same URL
8496 !! wikitext
8497 [[:en:Foo]]
8498
8499 [[:en:Foo|Foo]]
8500
8501 [[wikipedia:Foo]]
8502
8503 [[:wikipedia:Foo|Foo]]
8504
8505 [[wikipedia:en:Foo]]
8506
8507 [[:wikipedia:en:Foo]]
8508
8509 [[ wikiPEdia :Foo]]
8510 !! html/parsoid
8511 <p><a rel="mw:ExtLink" href="//en.wikipedia.org/wiki/Foo" data-parsoid='{"stx":"simple","a":{"href":"//en.wikipedia.org/wiki/Foo"},"sa":{"href":":en:Foo"},"isIW":true}' title="en:Foo">en:Foo</a></p>
8512
8513 <p><a rel="mw:ExtLink" href="//en.wikipedia.org/wiki/Foo" data-parsoid='{"stx":"piped","a":{"href":"//en.wikipedia.org/wiki/Foo"},"sa":{"href":":en:Foo"},"isIW":true}' title="en:Foo">Foo</a></p>
8514
8515 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" data-parsoid='{"stx":"simple","a":{"href":"http://en.wikipedia.org/wiki/Foo"},"sa":{"href":"wikipedia:Foo"},"isIW":true}' title="wikipedia:Foo">wikipedia:Foo</a></p>
8516
8517 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" data-parsoid='{"stx":"piped","a":{"href":"http://en.wikipedia.org/wiki/Foo"},"sa":{"href":":wikipedia:Foo"},"isIW":true}' title="wikipedia:Foo">Foo</a></p>
8518
8519 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/en:Foo" data-parsoid='{"stx":"simple","a":{"href":"http://en.wikipedia.org/wiki/en:Foo"},"sa":{"href":"wikipedia:en:Foo"},"isIW":true}' title="wikipedia:en:Foo">wikipedia:en:Foo</a></p>
8520
8521 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/en:Foo" data-parsoid='{"stx":"simple","a":{"href":"http://en.wikipedia.org/wiki/en:Foo"},"sa":{"href":":wikipedia:en:Foo"},"isIW":true}' title="wikipedia:en:Foo">wikipedia:en:Foo</a></p>
8522
8523 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" data-parsoid='{"stx":"simple","a":{"href":"http://en.wikipedia.org/wiki/Foo"},"sa":{"href":" wikiPEdia :Foo"},"isIW":true}' title="wikipedia:Foo"> wikiPEdia :Foo</a></p>
8524 !! end
8525
8526 !! test
8527 Interwiki links that cannot be represented in wiki syntax
8528 !! wikitext
8529 [[meatball:ok]]
8530 [[meatball:ok#foo|ok with fragment]]
8531 [[meatball:ok_as_well?|ok ending with ? mark]]
8532 [http://de.wikipedia.org/wiki/Foo?action=history has query]
8533 [http://de.wikipedia.org/wiki/#foo is just fragment]
8534
8535 !! html/php
8536 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?ok" class="extiw" title="meatball:ok">meatball:ok</a>
8537 <a href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" class="extiw" title="meatball:ok">ok with fragment</a>
8538 <a href="http://www.usemod.com/cgi-bin/mb.pl?ok_as_well%3F" class="extiw" title="meatball:ok as well?">ok ending with ? mark</a>
8539 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
8540 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a>
8541 </p>
8542 !! html/parsoid
8543 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok" title="meatball:ok">meatball:ok</a>
8544 <a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" title="meatball:ok">ok with fragment</a>
8545 <a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok_as_well?" title="meatball:ok as well?">ok ending with ? mark</a>
8546 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
8547 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a></p>
8548 !! end
8549
8550 !! test
8551 Interwiki links: trail
8552 !! wikitext
8553 [[wikipedia:Foo|Ba]]r
8554 !! html/php
8555 <p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
8556 </p>
8557 !! html/parsoid
8558 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" data-parsoid='{"stx":"piped","a":{"href":"http://en.wikipedia.org/wiki/Foo"},"sa":{"href":"wikipedia:Foo"},"isIW":true,"tail":"r"}' title="wikipedia:Foo">Bar</a></p>
8559 !! end
8560
8561 !! test
8562 Local interwiki link
8563 !! options
8564 parsoid=wt2html,wt2wt,html2html
8565 !! wikitext
8566 [[local:Template:Foo]]
8567 !! html/php
8568 <p><a href="/wiki/Template:Foo" title="Template:Foo">local:Template:Foo</a>
8569 </p>
8570 !! html/parsoid
8571 <p><a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">local:Template:Foo</a></p>
8572 !! end
8573
8574 # Parsoid does not mark self-links, by design.
8575 !! test
8576 Local interwiki link: self-link to current page
8577 !! options
8578 title=[[Main Page]]
8579 parsoid=wt2html,wt2wt,html2html
8580 !! wikitext
8581 [[local:Main Page]]
8582 !! html/php
8583 <p><a class="mw-selflink selflink">local:Main Page</a>
8584 </p>
8585 !! html/parsoid
8586 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:Main Page</a></p>
8587 !! end
8588
8589 !! test
8590 Local interwiki link: prefix only (T66167)
8591 !! options
8592 parsoid=wt2html,wt2wt,html2html
8593 !! wikitext
8594 [[local:]]
8595 !! html/php
8596 <p><a href="/wiki/Main_Page" title="Main Page">local:</a>
8597 </p>
8598 !! html/parsoid
8599 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:</a></p>
8600 !! end
8601
8602 !! test
8603 Local interwiki link: with additional interwiki prefix (T63357)
8604 !! options
8605 parsoid=wt2html,wt2wt,html2html
8606 !! wikitext
8607 [[local:meatball:Hello]]
8608 !! html/php
8609 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?Hello" class="extiw" title="meatball:Hello">local:meatball:Hello</a>
8610 </p>
8611 !! html/parsoid
8612 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?Hello" title="meatball:Hello">local:meatball:Hello</a></p>
8613 !! end
8614
8615 !! test
8616 Multiple local interwiki link prefixes
8617 !! wikitext
8618 [[local:local:local:local:mi:local:Foo]]
8619 !! options
8620 parsoid=wt2html,wt2wt,html2html
8621 !! html/php
8622 <p><a href="/wiki/Foo" title="Foo">local:local:local:local:mi:local:Foo</a>
8623 </p>
8624 !! html/parsoid
8625 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">local:local:local:local:mi:local:Foo</a></p>
8626 !! end
8627
8628 ###
8629 ### Interlanguage links
8630 ### Language links (so that searching for '### language' matches..)
8631 ###
8632
8633 !! test
8634 Interlanguage link
8635 !! wikitext
8636 Blah blah blah
8637 [[zh:Chinese]]
8638 !! html/php
8639 <p>Blah blah blah
8640 </p>
8641 !! html/parsoid
8642 <p>Blah blah blah</p>
8643 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8644 !! end
8645
8646 ## parsoid html2wt will lose the space variations
8647 !! test
8648 Interlanguage link with spacing
8649 !! options
8650 parsoid=wt2html,wt2wt,html2html
8651 !! wikitext
8652 Blah blah blah
8653 [[ zh : Chinese ]]
8654 !! html/php
8655 <p>Blah blah blah
8656 </p>
8657 !! html/parsoid
8658 <p>Blah blah blah</p>
8659 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8660 !! end
8661
8662 !! test
8663 Double interlanguage link
8664 !! wikitext
8665 Blah blah blah
8666 [[es:Spanish]]
8667 [[zh:Chinese]]
8668 !! html/php
8669 <p>Blah blah blah
8670 </p>
8671 !! html/parsoid
8672 <p>Blah blah blah</p>
8673 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
8674 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8675 !! end
8676
8677 ## parsoid html2wt will lose the space variations
8678 !! test
8679 Interlanguage link variations
8680 !! options
8681 parsoid=wt2html,wt2wt,html2html
8682 !! wikitext
8683 Blah blah blah
8684 [[ es :Spanish]]
8685 [[ ZH :Chinese]]
8686 [[es:Foo_bar]]
8687 !! html/php
8688 <p>Blah blah blah
8689 </p>
8690 !! html/parsoid
8691 <p>Blah blah blah</p>
8692 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish" />
8693 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese" />
8694 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar" />
8695 !! end
8696
8697 !! test
8698 Escaping of interlanguage links (T129218, T156308)
8699 !! wikitext
8700 Blah blah blah
8701 [[:es:Spanish]]
8702 [[ : zh : Chinese ]]
8703 !! html/php
8704 <p>Blah blah blah
8705 <a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">es:Spanish</a>
8706 <a href="http://zh.wikipedia.org/wiki/Chinese" class="extiw" title="zh:Chinese"> zh : Chinese </a>
8707 </p>
8708 !! html/parsoid
8709 <p>Blah blah blah
8710 <a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">es:Spanish</a>
8711 <a rel="mw:ExtLink" href="http://zh.wikipedia.org/wiki/Chinese" title="zh:Chinese"> zh : Chinese </a></p>
8712 !! end
8713
8714 ## parsoid html2wt will normalize the space to _
8715 !! test
8716 Space and question mark encoding in interlanguage links (T95473)
8717 !! options
8718 parsoid=wt2html,wt2wt,html2html
8719 !! wikitext
8720 Blah blah blah
8721 [[es:Foo bar?]]
8722 !! html/php
8723 <p>Blah blah blah
8724 </p>
8725 !! html/parsoid
8726 <p>Blah blah blah</p>
8727 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar%3F" />
8728 !! end
8729
8730 !! test
8731 Interlanguage link, with prefix links
8732 !! options
8733 language=ln
8734 !! wikitext
8735 Blah blah blah
8736 [[zh:Chinese]]
8737 !! html/php
8738 <p>Blah blah blah
8739 </p>
8740 !! html/parsoid
8741 <p>Blah blah blah</p>
8742 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8743 !! end
8744
8745 !! test
8746 Double interlanguage link, with prefix links (T10897)
8747 !! options
8748 language=ln
8749 !! wikitext
8750 Blah blah blah
8751 [[es:Spanish]]
8752 [[zh:Chinese]]
8753 !! html/php
8754 <p>Blah blah blah
8755 </p>
8756 !! html/parsoid
8757 <p>Blah blah blah</p>
8758 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
8759 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8760 !! end
8761
8762 !! test
8763 "Extra" interlanguage links (T34189 / gerrit 111390)
8764 !! wikitext
8765 Blah blah blah
8766 [[mul:Article]]
8767 !! html/php
8768 <p>Blah blah blah
8769 </p>
8770 !! html/parsoid
8771 <p>Blah blah blah</p>
8772 <link rel="mw:PageProp/Language" title="Multilingual" href="http://wikisource.org/wiki/Article"/>
8773 !! end
8774
8775 ## PHP parser tests script needs an update
8776 ## Parsoid html2wt will normalize output to [[:zh:Chinese]]
8777 !! test
8778 Language links render as inline links if $wgInterwikiMagic=false
8779 !! options
8780 wgInterwikiMagic=false
8781 parsoid=wt2html,wt2wt,html2html
8782 !! wikitext
8783 Blah blah blah
8784 [[zh:Chinese]]
8785 !! html/parsoid
8786 <p>Blah blah blah <a rel="mw:ExtLink" href="http://zh.wikipedia.org/wiki/Chinese" title="zh:Chinese">zh:Chinese</a></p>
8787 !! end
8788
8789 ## PHP parser tests script needs an update
8790 ## Parsoid html2wt will normalize output to [[:zh:Chinese]]
8791 !! test
8792 Language links render as inline links in the Talk namespace
8793 !! options
8794 title=Talk:Foo
8795 parsoid=wt2html,wt2wt,html2html
8796 !! wikitext
8797 Blah blah blah
8798 [[zh:Chinese]]
8799 !! html/parsoid
8800 <p>Blah blah blah <a rel="mw:ExtLink" href="http://zh.wikipedia.org/wiki/Chinese" title="zh:Chinese">zh:Chinese</a></p>
8801 !! end
8802
8803 !! test
8804 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
8805 !! options
8806 language=ln
8807 !! wikitext
8808 [[WW&nbsp;II]]
8809 !! html
8810 <p><a href="/index.php?title=WW_II&amp;action=edit&amp;redlink=1" class="new" title="WW II (lonkásá ezalí tɛ̂)">WW&#160;II</a>
8811 </p>
8812 !! end
8813
8814 !! test
8815 Parsoid T55221: Wikilinks should be properly entity-escaped
8816 !! options
8817 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
8818 !! html/parsoid
8819 <p>He&amp;nbsp;llo <a href="./Foo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
8820 <p>He&amp;nbsp;llo <a href="./He&amp;nbsp;llo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
8821 !! wikitext
8822 He&amp;nbsp;llo [[Foo|He&amp;nbsp;llo]]
8823
8824 He&amp;nbsp;llo He&amp;nbsp;llo
8825 !! html/php
8826 <p>He&amp;nbsp;llo <a href="/wiki/Foo" title="Foo">He&amp;nbsp;llo</a>
8827 </p><p>He&amp;nbsp;llo He&amp;nbsp;llo
8828 </p>
8829 !! end
8830
8831 # html2wt will fail because of title normalization without data-parsoid
8832 !! test
8833 Parsoid: handle constructor well
8834 !! options
8835 parsoid=wt2html,wt2wt
8836 !! wikitext
8837 [[constructor]]
8838
8839 [[constructor:foo]]
8840 !! html/php
8841 <p><a href="/index.php?title=Constructor&amp;action=edit&amp;redlink=1" class="new" title="Constructor (page does not exist)">constructor</a>
8842 </p><p><a href="/index.php?title=Constructor:foo&amp;action=edit&amp;redlink=1" class="new" title="Constructor:foo (page does not exist)">constructor:foo</a>
8843 </p>
8844 !! html/parsoid
8845 <p><a rel="mw:WikiLink" href="./Constructor" title="Constructor" data-parsoid='{"stx":"simple","a":{"href":"./Constructor"},"sa":{"href":"constructor"}}'>constructor</a></p>
8846
8847 <p><a rel="mw:WikiLink" href="./Constructor:foo" title="Constructor:foo" data-parsoid='{"stx":"simple","a":{"href":"./Constructor:foo"},"sa":{"href":"constructor:foo"}}'>constructor:foo</a></p>
8848 !! end
8849
8850 !! article
8851 ko:
8852 !! text
8853 Test.
8854 !! endarticle
8855
8856 # Note that `ko` isn't a known interlanguage prefix
8857 !! test
8858 Parsoid: recognize interlanguage links without a target page
8859 !! options
8860 ill
8861 !! wikitext
8862 [[es:]]
8863
8864 [[ko:]]
8865 !! html/php
8866 es:
8867 !! html/parsoid
8868 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/"/>
8869
8870 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
8871 !! end
8872
8873 # Note that `ko` isn't a known interwiki prefix
8874 !! test
8875 Parsoid: recognize interwiki links without a target page
8876 !! options
8877 parsoid=wt2html,wt2wt,html2html
8878 !! wikitext
8879 [[:es:]]
8880
8881 [[:ko:]]
8882 !! html/php
8883 <p><a href="http://es.wikipedia.org/wiki/" class="extiw" title="es:">es:</a>
8884 </p><p><a href="/wiki/Ko:" title="Ko:">ko:</a>
8885 </p>
8886 !! html/parsoid
8887 <p><a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/" title="es:">es:</a></p>
8888 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
8889 !! end
8890
8891 !! test
8892 Handle interwiki links pointing to the current wiki as plain wiki links (T47209)
8893 !! wikitext
8894 [[mi:Foo]]
8895 !! html/php
8896 <p><a href="/wiki/Foo" title="Foo">mi:Foo</a>
8897 </p>
8898 !! html/parsoid
8899 <p><a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo"},"sa":{"href":"mi:Foo"}}'>mi:Foo</a></p>
8900 !! end
8901
8902 !! test
8903 Interlanguage link with preceding local interwiki link (T70085)
8904 !! options
8905 parsoid=wt2html,wt2wt,html2html
8906 !! wikitext
8907 Blah blah blah
8908 [[local:es:Spanish]]
8909 !! html/php
8910 <p>Blah blah blah
8911 <a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">local:es:Spanish</a>
8912 </p>
8913 !! html/parsoid
8914 <p>Blah blah blah
8915 <a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">local:es:Spanish</a></p>
8916 !! end
8917
8918 !! test
8919 Looks like an interlanguage link, but is actually a local interwiki
8920 !! options
8921 parsoid=wt2html,wt2wt,html2html
8922 !! wikitext
8923 Blah blah blah
8924 [[mi:Template:Foo]]
8925 !! html/php
8926 <p>Blah blah blah
8927 <a href="/wiki/Template:Foo" title="Template:Foo">mi:Template:Foo</a>
8928 </p>
8929 !! html/parsoid
8930 <p>Blah blah blah
8931 <a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">mi:Template:Foo</a></p>
8932 !! end
8933
8934 ###
8935 ### Redirects, Parsoid-only
8936 ###
8937
8938 !! test
8939 1. Simple redirect to page
8940 !! wikitext
8941 #REDIRECT [[Main Page]]
8942 !! html/parsoid
8943 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8944 !! end
8945
8946 !! test
8947 2. Other redirect variants
8948 !! wikitext
8949 #REDIRECT [[Main_Page]]
8950 !! html/parsoid
8951 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Main_Page"},"sa":{"href":"Main_Page"}}'/>
8952 !! end
8953
8954 # Not a valid redirect in PHP (although perhaps it was, once upon a time)
8955 # This tests the Parsoid bail-out code.
8956 !! test
8957 3. Other redirect variants
8958 !! wikitext
8959 #REDIRECT [[<nowiki>[[Bar]]</nowiki>]]
8960 !! html/parsoid
8961 <ol><li data-parsoid>REDIRECT [[[[Bar]]]]</li></ol>
8962 !! end
8963
8964 !! test
8965 4. Redirect to a templated destination
8966 !! wikitext
8967 #REDIRECT [[{{echo|Foo}}bar]]
8968 !! html/parsoid
8969 <link about="#mwt2" typeof="mw:ExpandedAttrs" rel="mw:PageProp/redirect" href="./Foobar" data-parsoid='{"a":{"href":"./Foobar"},"sa":{"href":"{{echo|Foo}}bar"}}' data-mw='{"attribs":[[{"txt":"href"},{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[12,24,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"Foo\"}},\"i\":0}}]}&#39;>Foo&lt;/span>bar"}]]}'/>
8970 !! end
8971
8972 !! test
8973 Empty redirect
8974 !! options
8975 parsoid=wt2html,wt2wt
8976 !! wikitext
8977 #REDIRECT [[]]
8978 !! html/parsoid
8979 <ol>
8980 <li>REDIRECT [[]]</li></ol>
8981 !! end
8982
8983 !! test
8984 Optional colon in #REDIRECT
8985 !! options
8986 # the colon is archaic syntax. we support it for wt2html, but we
8987 # don't care that it roundtrips back to the modern syntax.
8988 parsoid=wt2html,html2html
8989 !! wikitext
8990 #REDIRECT:[[Main Page]]
8991 !! html/parsoid
8992 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8993 !! end
8994
8995 !! test
8996 Whitespace in #REDIRECT with optional colon
8997 !! options
8998 # the colon and gratuitous whitespace is archaic syntax. we support
8999 # it for wt2html, but we don't care that it roundtrips back to the
9000 # modern syntax (without extra whitespace)
9001 parsoid=wt2html,html2html
9002 !! wikitext
9003
9004 #REDIRECT
9005 :
9006 [[Main Page]]
9007 !! html/parsoid
9008 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
9009 !! end
9010
9011 !! test
9012 Piped link in #REDIRECT
9013 !! options
9014 # content after piped link is ignored. we support this syntax,
9015 # but don't care that the piped link is lost when we roundtrip this.
9016 parsoid=wt2html
9017 !! wikitext
9018 #REDIRECT [[Main Page|bar]]
9019 !! html/parsoid
9020 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
9021 !! end
9022
9023 !! test
9024 Redirect to category (T104502)
9025 !! options
9026 parsoid=wt2html,wt2wt
9027 !! wikitext
9028 #REDIRECT [[Category:Foo]]
9029 !! html/parsoid
9030 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
9031 !! end
9032
9033 !! test
9034 Redirect to category with URL encoding (T104502)
9035 !! options
9036 parsoid=wt2html
9037 !! wikitext
9038 #REDIRECT [[Category%3AFoo]]
9039 !! html/parsoid
9040 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
9041 !! end
9042
9043 !! test
9044 Redirect to category page
9045 !! wikitext
9046 #REDIRECT [[:Category:Foo]]
9047 !! html/parsoid
9048 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
9049 !! end
9050
9051 !! test
9052 Redirect to image page (1)
9053 !! wikitext
9054 #REDIRECT [[File:Wiki.png]]
9055 !! html/parsoid
9056 <link rel="mw:PageProp/redirect" href="./File:Wiki.png"/>
9057 !! end
9058
9059 !! test
9060 Redirect to image page (2)
9061 !! wikitext
9062 #REDIRECT [[Image:Wiki.png]]
9063 !! html/parsoid
9064 <link rel="mw:PageProp/redirect" href="./File:Wiki.png" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./File:Wiki.png"},"sa":{"href":"Image:Wiki.png"}}'/>
9065 !! end
9066
9067 # html2wt disabled because wts serializes as "#REDIRECT [[:en:File:Wiki.png]]"
9068 # Next test confirms this.
9069 !! test
9070 Redirect to language (1) (T104918)
9071 !! options
9072 parsoid=wt2html,wt2wt,html2html
9073 !! wikitext
9074 #REDIRECT [[en:File:Wiki.png]]
9075 !! html/parsoid
9076 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
9077 !! end
9078
9079 !! test
9080 Redirect to language (2) (T104918)
9081 !! wikitext
9082 #REDIRECT [[:en:File:Wiki.png]]
9083 !! html/parsoid
9084 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
9085 !! end
9086
9087 !! test
9088 Redirect to interwiki (T104918)
9089 !! wikitext
9090 #REDIRECT [[meatball:File:Wiki.png]]
9091 !! html/parsoid
9092 <link rel="mw:PageProp/redirect" href="http://www.usemod.com/cgi-bin/mb.pl?File:Wiki.png"/>
9093 !! end
9094
9095 !! test
9096 Non-English #REDIRECT
9097 !! options
9098 language=is
9099 !! wikitext
9100 #TILVÍSUN [[Main Page]]
9101 !! html/parsoid
9102 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#TILVÍSUN ","a":{"href":"./Main_Page"},"sa":{"href":"Main Page"}}'/>
9103 !! end
9104
9105 !! test
9106 Redirect syntax under text isn't considered a redirect
9107 !! wikitext
9108 some text
9109 #redirect [[Main Page]]
9110 !! html/parsoid
9111 <p>some text</p>
9112 <ol data-parsoid='{}'><li data-parsoid='{}'>redirect <a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"simple","a":{"href":"./Main_Page"},"sa":{"href":"Main Page"}}'>Main Page</a></li></ol>
9113 !! end
9114
9115 # FIXME: Should hoist the redirect to the top of the page and ensure there
9116 # is only one.
9117 !! test
9118 New redirect
9119 !! options
9120 parsoid=html2wt
9121 !! html/parsoid
9122 <p>Foo<link rel="mw:PageProp/redirect" href="./Foo"/></p>
9123 !! wikitext
9124 Foo
9125 #REDIRECT [[Foo]]
9126 !! end
9127
9128 ##
9129 ## XHTML tidiness
9130 ###
9131
9132 !! test
9133 <br> to <br />
9134 !! wikitext
9135 1<br>2<br />3
9136 !! html
9137 <p>1<br />2<br />3
9138 </p>
9139 !! end
9140
9141 !! test
9142 Broken br tag sanitization
9143 !! wikitext
9144 </br>
9145 !! html/php
9146 <p>&lt;/br&gt;
9147 </p>
9148 !! end
9149
9150 # TODO: Fix html2html mode (T53055)!
9151 !! test
9152 Parsoid: Broken br tag recognition
9153 !! options
9154 parsoid=wt2html
9155 !! wikitext
9156 </br>
9157
9158 <br/ >
9159 !! html+tidy
9160 <p><br /></p>
9161 <p><br /></p>
9162 !! end
9163
9164 !! test
9165 Incorrecly removing closing slashes from correctly formed XHTML
9166 !! wikitext
9167 <br style="clear:both;" />
9168 !! html
9169 <p><br style="clear:both;" />
9170 </p>
9171 !! end
9172
9173 !! test
9174 Failing to transform badly formed HTML into correct XHTML
9175 !! wikitext
9176 <br style="clear: left;">
9177 <br style="clear: right;">
9178 <br style="clear: both;">
9179 !! html
9180 <p><br style="clear: left;" />
9181 <br style="clear: right;" />
9182 <br style="clear: both;" />
9183 </p>
9184 !!end
9185
9186 ## FIXME: Is Parsoid's acceptance of self-closing html-tags
9187 ## a feature or a bug? See https://phabricator.wikimedia.org/T76962
9188 !! test
9189 Handling html with a div self-closing tag
9190 !! wikitext
9191 <div title />
9192 <div title/>
9193 <div title/ >
9194 <div title=bar />
9195 <div title=bar/>
9196 <div title=bar/ >
9197 !! html/php
9198 <p>&lt;div title /&gt;
9199 &lt;div title/&gt;
9200 </p>
9201 <div>
9202 <p>&lt;div title=bar /&gt;
9203 &lt;div title=bar/&gt;
9204 </p>
9205 <div title="bar/"></div>
9206 </div>
9207
9208 !! html/parsoid
9209 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
9210 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
9211 <div title="" data-parsoid='{"stx":"html","selfClose":true,"brokenHTMLTag":true}'></div>
9212 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
9213 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
9214 <div title="bar/" data-parsoid='{"stx":"html","autoInsertedEnd":true}'></div>
9215 !! end
9216
9217 !! test
9218 Handling html with a br self-closing tag
9219 !! wikitext
9220 <br title />
9221 <br title/>
9222 <br title/ >
9223 <br title=bar />
9224 <br title=bar/>
9225 <br title=bar/ >
9226 !! html/php
9227 <p><br title="" />
9228 <br title="" />
9229 <br />
9230 <br title="bar" />
9231 <br title="bar" />
9232 <br title="bar/" />
9233 </p>
9234 !! html/parsoid
9235 <p><br title="" />
9236 <br title="" />
9237 <br title="" />
9238 <br title="bar" />
9239 <br title="bar" />
9240 <br title="bar/" />
9241 </p>
9242 !! end
9243
9244 !! test
9245 Horizontal ruler (should it add that extra space?)
9246 !! wikitext
9247 <hr>
9248 <hr >
9249 foo <hr
9250 > bar
9251 !! html+tidy
9252 <hr />
9253 <hr />
9254 <p>foo</p>
9255 <hr />
9256 <p>bar</p>
9257 !! end
9258
9259 !! test
9260 Horizontal ruler -- 4+ dashes render hr
9261 !! wikitext
9262 ----
9263 !! html
9264 <hr />
9265
9266 !! end
9267
9268 !! test
9269 Horizontal ruler -- eats additional dashes on the same line
9270 !! wikitext
9271 ---------
9272 !! html
9273 <hr />
9274
9275 !! end
9276
9277 !! test
9278 Horizontal ruler -- does not collapse dashes on consecutive lines
9279 !! wikitext
9280 ----
9281 ----
9282 !! html
9283 <hr />
9284 <hr />
9285
9286 !! end
9287
9288 !! test
9289 Horizontal ruler -- <4 dashes render as plain text
9290 !! wikitext
9291 ---
9292 !! html
9293 <p>---
9294 </p>
9295 !! end
9296
9297 !! test
9298 Horizontal ruler -- Supports content following dashes on same line
9299 !! wikitext
9300 ---- Foo
9301 !! html
9302 <hr /> Foo
9303
9304 !! html+tidy
9305 <hr />
9306 <p>Foo</p>
9307 !! end
9308
9309 ###
9310 ### Block-level elements
9311 ###
9312 !! test
9313 Common list
9314 !! wikitext
9315 *Common list
9316 * item 2
9317 *item 3
9318 !! html
9319 <ul><li>Common list</li>
9320 <li> item 2</li>
9321 <li>item 3</li></ul>
9322
9323 !! end
9324
9325 !! test
9326 Numbered list
9327 !! wikitext
9328 #Numbered list
9329 #item 2
9330 # item 3
9331 !! html
9332 <ol><li>Numbered list</li>
9333 <li>item 2</li>
9334 <li> item 3</li></ol>
9335
9336 !! end
9337
9338 !! test
9339 Mixed list
9340 !! wikitext
9341 *Mixed list
9342 *# with numbers
9343 ** and bullets
9344 *# and numbers
9345 *bullets again
9346 **bullet level 2
9347 ***bullet level 3
9348 ***#Number on level 4
9349 **bullet level 2
9350 **#Number on level 3
9351 **#Number on level 3
9352 *#number level 2
9353 *Level 1
9354 *** Level 3
9355 #** Level 3, but ordered
9356 !! html
9357 <ul><li>Mixed list
9358 <ol><li> with numbers</li></ol>
9359 <ul><li> and bullets</li></ul>
9360 <ol><li> and numbers</li></ol></li>
9361 <li>bullets again
9362 <ul><li>bullet level 2
9363 <ul><li>bullet level 3
9364 <ol><li>Number on level 4</li></ol></li></ul></li>
9365 <li>bullet level 2
9366 <ol><li>Number on level 3</li>
9367 <li>Number on level 3</li></ol></li></ul>
9368 <ol><li>number level 2</li></ol></li>
9369 <li>Level 1
9370 <ul><li><ul><li> Level 3</li></ul></li></ul></li></ul>
9371 <ol><li><ul><li><ul><li> Level 3, but ordered</li></ul></li></ul></li></ol>
9372
9373 !! end
9374
9375 !! test
9376 1. Nested mixed wikitext and html list
9377 !! wikitext
9378 * hi
9379 * <ul><li>ho</li></ul>
9380 * hi
9381 ** ho
9382 !! html/php
9383 <ul><li> hi</li>
9384 <li> <ul><li>ho</li></ul></li>
9385 <li> hi
9386 <ul><li> ho</li></ul></li></ul>
9387
9388 !! html/parsoid
9389 <ul><li> hi</li>
9390 <li> <ul data-parsoid='{"stx":"html"}'><li data-parsoid='{"stx":"html"}'>ho</li></ul></li>
9391 <li> hi
9392 <ul><li> ho</li></ul></li></ul>
9393 !! end
9394
9395 !! test
9396 2. Nested mixed wikitext and html list (incompatible)
9397 !! wikitext
9398 ; hi
9399 : {{echo|<li>ho</li>}}
9400 !! html/php
9401 <dl><dt> hi</dt>
9402 <dd> <li>ho</li></dd></dl>
9403
9404 !! html/parsoid
9405 <dl><dt> hi</dt>
9406 <dd> <li about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"stx":"html","pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;li>ho&lt;/li>"}},"i":0}}]}'>ho</li></dd></dl>
9407 !! end
9408
9409 !! test
9410 Nested lists 1
9411 !! wikitext
9412 *foo
9413 **bar
9414 !! html
9415 <ul><li>foo
9416 <ul><li>bar</li></ul></li></ul>
9417
9418 !! end
9419
9420 !! test
9421 Nested lists 2
9422 !! wikitext
9423 **foo
9424 *bar
9425 !! html
9426 <ul><li><ul><li>foo</li></ul></li>
9427 <li>bar</li></ul>
9428
9429 !! end
9430
9431 !! test
9432 Nested lists 3 (first element empty)
9433 !! wikitext
9434 *
9435 **bar
9436 !! html
9437 <ul><li>
9438 <ul><li>bar</li></ul></li></ul>
9439
9440 !! end
9441
9442 !! test
9443 Nested lists 4 (first element empty)
9444 !! wikitext
9445 **
9446 *bar
9447 !! html
9448 <ul><li><ul><li></li></ul></li>
9449 <li>bar</li></ul>
9450
9451 !! end
9452
9453 !! test
9454 Nested lists 5 (both elements empty)
9455 !! wikitext
9456 **
9457 *
9458 !! html
9459 <ul><li><ul><li></li></ul></li>
9460 <li></li></ul>
9461
9462 !! end
9463
9464 !! test
9465 Nested lists 6 (both elements empty)
9466 !! wikitext
9467 *
9468 **
9469 !! html
9470 <ul><li>
9471 <ul><li></li></ul></li></ul>
9472
9473 !! end
9474
9475 !! test
9476 Nested lists 7 (skip initial nesting levels)
9477 !! wikitext
9478 *** foo
9479 !! html
9480 <ul><li><ul><li><ul><li> foo</li></ul></li></ul></li></ul>
9481
9482 !! end
9483
9484 !! test
9485 Nested lists 8 (multiple nesting transitions)
9486 !! wikitext
9487 * foo
9488 *** bar
9489 ** baz
9490 * boo
9491 !! html
9492 <ul><li> foo
9493 <ul><li><ul><li> bar</li></ul></li>
9494 <li> baz</li></ul></li>
9495 <li> boo</li></ul>
9496
9497 !! end
9498
9499 !! test
9500 Nested lists 9 (extension interaction)
9501 !! options
9502 parsoid
9503 !! wikitext
9504 *<references />
9505 !! html/parsoid
9506 <ul><li data-parsoid='{}'><ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-parsoid='{}' data-mw='{"name":"references","attrs":{}}'></ol></li></ul>
9507 !! end
9508
9509 !! test
9510 1. Lists with start-of-line-transparent tokens before bullets: Comments
9511 !! wikitext
9512 *foo
9513 *<!--cmt-->bar
9514 <!--cmt-->*baz
9515 !! html
9516 <ul><li>foo</li>
9517 <li>bar</li>
9518 <li>baz</li></ul>
9519
9520 !! end
9521
9522 !! test
9523 2. Lists with start-of-line-transparent tokens before bullets: Template close
9524 !! wikitext
9525 *foo {{echo|bar
9526 }}*baz
9527 !! html
9528 <ul><li>foo bar</li>
9529 <li>baz</li></ul>
9530
9531 !! end
9532
9533 !! test
9534 List items are not parsed correctly following a <pre> block (T2785)
9535 !! wikitext
9536 * <pre>foo</pre>
9537 * <pre>bar</pre>
9538 * zar
9539 !! html/php
9540 <ul><li> <pre>foo</pre></li>
9541 <li> <pre>bar</pre></li>
9542 <li> zar</li></ul>
9543
9544 !! html/parsoid
9545 <ul><li> <pre typeof="mw:Extension/pre" about="#mwt2" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"foo"}}'>foo</pre></li>
9546 <li> <pre typeof="mw:Extension/pre" about="#mwt4" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"bar"}}'>bar</pre></li>
9547 <li> zar</li></ul>
9548 !! end
9549
9550 !! test
9551 List items from template
9552 !! wikitext
9553
9554 {{inner list}}
9555 * item 2
9556
9557 * item 0
9558 {{inner list}}
9559 * item 2
9560
9561 * item 0
9562 * notSOL{{inner list}}
9563 * item 2
9564 !! html
9565 <ul><li> item 1</li>
9566 <li> item 2</li></ul>
9567 <ul><li> item 0</li>
9568 <li> item 1</li>
9569 <li> item 2</li></ul>
9570 <ul><li> item 0</li>
9571 <li> notSOL</li>
9572 <li> item 1</li>
9573 <li> item 2</li></ul>
9574
9575 !! end
9576
9577 !! test
9578 List interrupted by empty line or heading
9579 !! wikitext
9580 * foo
9581
9582 ** bar
9583 == A heading ==
9584 * Another list item
9585 !! html
9586 <ul><li> foo</li></ul>
9587 <ul><li><ul><li> bar</li></ul></li></ul>
9588 <h2><span class="mw-headline" id="A_heading">A heading</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: A heading">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
9589 <ul><li> Another list item</li></ul>
9590
9591 !!end
9592
9593 !!test
9594 Multiple list tags generated by templates
9595 !! wikitext
9596 {{echo|<li>}}a
9597 {{echo|<li>}}b
9598 {{echo|<li>}}c
9599 !! html
9600 <li>a
9601 <li>b
9602 <li>c</li>
9603 </li>
9604 </li>
9605
9606 !! html+tidy
9607 <ul>
9608 <li>a</li>
9609 <li>b</li>
9610 <li>c</li>
9611 </ul>
9612 !!end
9613
9614 !!test
9615 Single-comment whitespace lines dont break lists, and neither do multi-comment whitespace lines
9616 !! wikitext
9617 *a
9618 <!--This line will NOT split the list-->
9619 *b
9620 <!--This line will NOT split the list either-->
9621 *c
9622 <!--foo--> <!----> <!--This line NOT split the list either-->
9623 *d
9624 !! html
9625 <ul><li>a</li>
9626 <li>b</li>
9627 <li>c</li>
9628 <li>d</li></ul>
9629
9630 !!end
9631
9632 !!test
9633 Replacing whitespace with tabs still doesn't break the list (gerrit 78327)
9634 !! wikitext
9635 *a
9636 <!--This line will NOT split the list-->
9637 *b
9638 <!--This line will NOT split the list either-->
9639 *c
9640 <!--foo--> <!----> <!--This line NOT split the list
9641 either-->
9642 *d
9643 !! html
9644 <ul><li>a</li>
9645 <li>b</li>
9646 <li>c</li>
9647 <li>d</li></ul>
9648
9649 !!end
9650
9651 !!test
9652 Test the li-hack
9653 (The PHP parser relies on Tidy for the hack)
9654 !!options
9655 parsoid=wt2html,wt2wt
9656 !! wikitext
9657 * foo
9658 * <li>li-hack
9659 * {{echo|<li>templated li-hack}}
9660 * <!--foo--> <li> unsupported li-hack with preceding comments
9661
9662 <ul>
9663 <li><li>not a li-hack
9664 </li>
9665 </ul>
9666 !! html+tidy
9667 <ul>
9668 <li>foo</li>
9669 <li>li-hack</li>
9670 <li>templated li-hack</li>
9671 <li>unsupported li-hack with preceding comments</li>
9672 </ul>
9673 <ul>
9674 <li>not a li-hack</li>
9675 </ul>
9676 !!end
9677
9678 !! test
9679 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
9680 !! options
9681 parsoid
9682 !! wikitext
9683 # foo
9684 ## bar
9685 * foo
9686 ** bar
9687 : foo
9688 :: bar
9689 !! html
9690 <ol>
9691 <li> foo<ol>
9692 <li> bar</li>
9693 </ol></li>
9694 </ol><ul>
9695 <li> foo<ul>
9696 <li> bar</li>
9697 </ul></li>
9698 </ul><dl>
9699 <dd> foo<dl>
9700 <dd> bar</dd>
9701 </dl></dd>
9702 </dl>
9703 !! end
9704
9705 !! test
9706 Parsoid: Test of whitespace serialization with Templated bullets
9707 !! options
9708 parsoid
9709 !! wikitext
9710 * {{bullet}}
9711 !! html
9712 <ul>
9713 <li> </li><li about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"bullet","href":"./Template:Bullet"},"params":{},"i":0}}]}'> Bar</li>
9714 </ul>
9715 !! end
9716
9717 # ------------------------------------------------------------------------
9718 # The next set of tests are about Parsoid's ability to handle badly nested
9719 # tags (parse, minimize scope of fixup, and roundtrip back)
9720 # ------------------------------------------------------------------------
9721
9722 !! test
9723 Unbalanced closing block tags break a list
9724 (php parser relies on Tidy to fix up)
9725 !! wikitext
9726 <div>
9727 *a</div><div>
9728 *b</div>
9729 !! html+tidy
9730 <div>
9731 <ul>
9732 <li>a</li>
9733 </ul>
9734 </div>
9735 <div>
9736 <ul>
9737 <li>b</li>
9738 </ul>
9739 </div>
9740 !! end
9741
9742 # Parsoid fails this test, but it might be tricky to support properly.
9743 # See T70395.
9744 !! test
9745 Unbalanced closing non-block tags don't break a list
9746 (php parser relies on Tidy to fix up)
9747 !! wikitext
9748 <span>
9749 *a</span><span>
9750 *b</span>
9751 !! html/php+tidy
9752 <ul>
9753 <li><span>a</span></li>
9754 <li><span>b</span></li>
9755 </ul>
9756 !! html/parsoid
9757 <span>
9758 <ul>
9759 <li>a<span></span>
9760 </li>
9761 <li>b
9762 </li>
9763 </ul>
9764 </span>
9765 !! end
9766
9767 !! test
9768 Unclosed formatting tags that straddle lists are closed and reopened
9769 (php parser relies on Tidy to fix up)
9770 !! options
9771 parsoid=wt2html,wt2wt,html2html
9772 !! wikitext
9773 # <s> a
9774 # b </s>
9775 !! html/php+tidy
9776 <ol>
9777 <li><s>a</s></li>
9778 <li><s>b</s></li>
9779 </ol>
9780 !! html/parsoid
9781 <ol><li> <s> a</s></li>
9782 <li><s> b </s></li></ol>
9783 !! end
9784
9785 # See T70395.
9786 !!test
9787 1. List embedded in a formatting tag
9788 !! wikitext
9789 <small>
9790 * foo
9791 </small>
9792 !! html/php+tidy
9793 <ul>
9794 <li><small>foo</small></li>
9795 </ul>
9796 !! html/parsoid
9797 <small>
9798 <ul>
9799 <li> foo</li>
9800 </ul>
9801 </small>
9802 !!end
9803
9804 ## Ugly Parsoid output here
9805 ## Not sure what the right output is.
9806 !!test
9807 2. List embedded in a formatting tag
9808 !! wikitext
9809 <small>
9810 *a
9811 *b</small>
9812 !! html/php+tidy
9813 <ul>
9814 <li><small>a</small></li>
9815 <li><small>b</small></li>
9816 </ul>
9817 !! html/parsoid
9818 <small></small>
9819 <ul><small>
9820 <li>a</li>
9821 </small>
9822 <li><small>b</small></li>
9823 </ul>
9824 !!end
9825
9826 # Ugly Parsoid and PHP parser output here
9827 # Not sure if we want to make this a test!
9828 #
9829 ## !!test
9830 ## 3. Unclosed formatting tags in list elements
9831 ## !! wikitext
9832 ## *<small>a
9833 ## *<small>b
9834 ## !! html/php+tidy
9835 ## <ul>
9836 ## <li><small>a</small></li>
9837 ## <li><small><small>b</small></small></li>
9838 ## </ul>
9839 ## !! html/parsoid
9840 ## <ul>
9841 ## <li><small>a</small></li>
9842 ## <small>
9843 ## <li><small>b</small></li>
9844 ## </small></ul>
9845 ## !!end
9846
9847 # This is a bug in the PHP parser + tidy combination.
9848 # (The </tr> tag gets parsed as text and html-escaped by PHP,
9849 # and then fostered out of the table by tidy.)
9850 # We believe the Parsoid output to be correct.
9851 !! test
9852 Table with missing opening <tr> tag
9853 !! options
9854 parsoid=wt2html,wt2wt
9855 !! wikitext
9856 <table>
9857 <td>foo</td>
9858 </tr>
9859 </table>
9860 !! html+tidy
9861 <table>
9862 <tr>
9863 <td>foo</td>
9864 </tr>
9865 </table>
9866 !! end
9867
9868 ###
9869 ### Magic Words
9870 ###
9871
9872 # Note that the current date is hard-coded as
9873 # 1970-01-01T00:02:03Z (a Thursday)
9874 # when running parser tests. The timezone is also fixed to GMT, so
9875 # local date will be identical to current date.
9876
9877 !! test
9878 Magic Word: {{CURRENTDAY}}
9879 !! wikitext
9880 {{CURRENTDAY}}
9881 !! html
9882 <p>1
9883 </p>
9884 !! end
9885
9886 !! test
9887 Magic Word: {{CURRENTDAY2}}
9888 !! wikitext
9889 {{CURRENTDAY2}}
9890 !! html
9891 <p>01
9892 </p>
9893 !! end
9894
9895 !! test
9896 Magic Word: {{CURRENTDAYNAME}}
9897 !! wikitext
9898 {{CURRENTDAYNAME}}
9899 !! html
9900 <p>Thursday
9901 </p>
9902 !! end
9903
9904 !! test
9905 Magic Word: {{CURRENTDOW}}
9906 !! wikitext
9907 {{CURRENTDOW}}
9908 !! html
9909 <p>4
9910 </p>
9911 !! end
9912
9913 !! test
9914 Magic Word: {{CURRENTMONTH}}
9915 !! wikitext
9916 {{CURRENTMONTH}}
9917 !! html
9918 <p>01
9919 </p>
9920 !! end
9921
9922 !! test
9923 Magic Word: {{CURRENTMONTH1}}
9924 !! wikitext
9925 {{CURRENTMONTH1}}
9926 !! html
9927 <p>1
9928 </p>
9929 !! end
9930
9931 !! test
9932 Magic Word: {{CURRENTMONTHABBREV}}
9933 !! wikitext
9934 {{CURRENTMONTHABBREV}}
9935 !! html
9936 <p>Jan
9937 </p>
9938 !! end
9939
9940 !! test
9941 Magic Word: {{CURRENTMONTHNAME}}
9942 !! wikitext
9943 {{CURRENTMONTHNAME}}
9944 !! html
9945 <p>January
9946 </p>
9947 !! end
9948
9949 !! test
9950 Magic Word: {{CURRENTMONTHNAMEGEN}}
9951 !! wikitext
9952 {{CURRENTMONTHNAMEGEN}}
9953 !! html
9954 <p>January
9955 </p>
9956 !! end
9957
9958 !! test
9959 Magic Word: {{CURRENTTIME}}
9960 !! wikitext
9961 {{CURRENTTIME}}
9962 !! html
9963 <p>00:02
9964 </p>
9965 !! end
9966
9967 !! test
9968 Magic Word: {{CURRENTHOUR}}
9969 !! wikitext
9970 {{CURRENTHOUR}}
9971 !! html
9972 <p>00
9973 </p>
9974 !! end
9975
9976 !! test
9977 Magic Word: {{CURRENTWEEK}} (T6594)
9978 !! wikitext
9979 {{CURRENTWEEK}}
9980 !! html
9981 <p>1
9982 </p>
9983 !! end
9984
9985 !! test
9986 Magic Word: {{CURRENTYEAR}}
9987 !! wikitext
9988 {{CURRENTYEAR}}
9989 !! html
9990 <p>1970
9991 </p>
9992 !! end
9993
9994 !! test
9995 Magic Word: {{CURRENTTIMESTAMP}}
9996 !! wikitext
9997 {{CURRENTTIMESTAMP}}
9998 !! html
9999 <p>19700101000203
10000 </p>
10001 !! end
10002
10003 !! test
10004 Magic Words LOCAL (UTC)
10005 !! wikitext
10006 * {{LOCALMONTH}}
10007 * {{LOCALMONTH1}}
10008 * {{LOCALMONTHNAME}}
10009 * {{LOCALMONTHNAMEGEN}}
10010 * {{LOCALMONTHABBREV}}
10011 * {{LOCALDAY}}
10012 * {{LOCALDAY2}}
10013 * {{LOCALDAYNAME}}
10014 * {{LOCALYEAR}}
10015 * {{LOCALTIME}}
10016 * {{LOCALHOUR}}
10017 * {{LOCALWEEK}}
10018 * {{LOCALDOW}}
10019 * {{LOCALTIMESTAMP}}
10020 !! html
10021 <ul><li> 01</li>
10022 <li> 1</li>
10023 <li> January</li>
10024 <li> January</li>
10025 <li> Jan</li>
10026 <li> 1</li>
10027 <li> 01</li>
10028 <li> Thursday</li>
10029 <li> 1970</li>
10030 <li> 00:02</li>
10031 <li> 00</li>
10032 <li> 1</li>
10033 <li> 4</li>
10034 <li> 19700101000203</li></ul>
10035
10036 !! end
10037
10038 !! test
10039 Magic Word: {{FULLPAGENAME}}
10040 !! options
10041 title=[[User:Ævar Arnfjörð Bjarmason]]
10042 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10043 !! wikitext
10044 {{FULLPAGENAME}}
10045 !! html/*
10046 <p>User:Ævar Arnfjörð Bjarmason
10047 </p>
10048 !! end
10049
10050 !! test
10051 Magic Word: {{FULLPAGENAMEE}}
10052 !! options
10053 title=[[User:Ævar Arnfjörð Bjarmason]]
10054 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10055 !! wikitext
10056 {{FULLPAGENAMEE}}
10057 !! html/*
10058 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10059 </p>
10060 !! end
10061
10062 !! test
10063 Magic Word: {{TALKSPACE}}
10064 !! options
10065 title=[[User:Ævar Arnfjörð Bjarmason]]
10066 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10067 !! wikitext
10068 {{TALKSPACE}}
10069 !! html/*
10070 <p>User talk
10071 </p>
10072 !! end
10073
10074 !! test
10075 Magic Word: {{TALKSPACE}}, same namespace
10076 !! options
10077 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10078 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10079 !! wikitext
10080 {{TALKSPACE}}
10081 !! html/*
10082 <p>User talk
10083 </p>
10084 !! end
10085
10086 !! test
10087 Magic Word: {{TALKSPACE}}, main namespace
10088 !! options
10089 title=[[Parser Test]]
10090 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10091 !! wikitext
10092 {{TALKSPACE}}
10093 !! html/*
10094 <p>Talk
10095 </p>
10096 !! end
10097
10098 !! test
10099 Magic Word: {{TALKSPACEE}}
10100 !! options
10101 title=[[User:Ævar Arnfjörð Bjarmason]]
10102 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10103 !! wikitext
10104 {{TALKSPACEE}}
10105 !! html/*
10106 <p>User_talk
10107 </p>
10108 !! end
10109
10110 !! test
10111 Magic Word: {{SUBJECTSPACE}}
10112 !! options
10113 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10114 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10115 !! wikitext
10116 {{SUBJECTSPACE}}
10117 !! html/*
10118 <p>User
10119 </p>
10120 !! end
10121
10122 !! test
10123 Magic Word: {{SUBJECTSPACE}}, same namespace
10124 !! options
10125 title=[[User:Ævar Arnfjörð Bjarmason]]
10126 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10127 !! wikitext
10128 {{SUBJECTSPACE}}
10129 !! html/*
10130 <p>User
10131 </p>
10132 !! end
10133
10134 !! test
10135 Magic Word: {{SUBJECTSPACE}}, main namespace
10136 !! options
10137 title=[[Parser Test]]
10138 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10139 !! wikitext
10140 {{SUBJECTSPACE}}
10141 !! html/*
10142
10143 !! end
10144
10145 !! test
10146 Magic Word: {{SUBJECTSPACEE}}
10147 !! options
10148 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10149 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10150 !! wikitext
10151 {{SUBJECTSPACEE}}
10152 !! html/*
10153 <p>User
10154 </p>
10155 !! end
10156
10157 !! test
10158 Magic Word: {{NAMESPACE}}
10159 !! options
10160 title=[[User:Ævar Arnfjörð Bjarmason]]
10161 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10162 !! wikitext
10163 {{NAMESPACE}}
10164 !! html/*
10165 <p>User
10166 </p>
10167 !! end
10168
10169 !! test
10170 Magic Word: {{NAMESPACEE}}
10171 !! options
10172 title=[[User:Ævar Arnfjörð Bjarmason]]
10173 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10174 !! wikitext
10175 {{NAMESPACEE}}
10176 !! html/*
10177 <p>User
10178 </p>
10179 !! end
10180
10181 !! test
10182 Magic Word: {{NAMESPACENUMBER}}
10183 !! options
10184 title=[[User:Ævar Arnfjörð Bjarmason]]
10185 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10186 !! wikitext
10187 {{NAMESPACENUMBER}}
10188 !! html/*
10189 <p>2
10190 </p>
10191 !! end
10192
10193 !! test
10194 Magic Word: {{SUBPAGENAME}}
10195 !! options
10196 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
10197 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10198 !! wikitext
10199 {{SUBPAGENAME}}
10200 !! html/*
10201 <p>sub ö
10202 </p>
10203 !! end
10204
10205 !! test
10206 Magic Word: {{SUBPAGENAMEE}}
10207 !! options
10208 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
10209 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10210 !! wikitext
10211 {{SUBPAGENAMEE}}
10212 !! html/*
10213 <p>sub_%C3%B6
10214 </p>
10215 !! end
10216
10217 !! test
10218 Magic Word: {{ROOTPAGENAME}}
10219 !! options
10220 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
10221 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10222 !! wikitext
10223 {{ROOTPAGENAME}}
10224 !! html/*
10225 <p>Ævar Arnfjörð Bjarmason
10226 </p>
10227 !! end
10228
10229 !! test
10230 Magic Word: {{ROOTPAGENAMEE}}
10231 !! options
10232 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
10233 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10234 !! wikitext
10235 {{ROOTPAGENAMEE}}
10236 !! html/*
10237 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10238 </p>
10239 !! end
10240
10241 !! test
10242 Magic Word: {{BASEPAGENAME}}
10243 !! options
10244 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
10245 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10246 !! wikitext
10247 {{BASEPAGENAME}}
10248 !! html/*
10249 <p>Ævar Arnfjörð Bjarmason
10250 </p>
10251 !! end
10252
10253 !! test
10254 Magic Word: {{BASEPAGENAMEE}}
10255 !! options
10256 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
10257 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10258 !! wikitext
10259 {{BASEPAGENAMEE}}
10260 !! html/*
10261 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10262 </p>
10263 !! end
10264
10265 !! test
10266 Magic Word: {{TALKPAGENAME}}
10267 !! options
10268 title=[[User:Ævar Arnfjörð Bjarmason]]
10269 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10270 !! wikitext
10271 {{TALKPAGENAME}}
10272 !! html/*
10273 <p>User talk:Ævar Arnfjörð Bjarmason
10274 </p>
10275 !! end
10276
10277 !! test
10278 Magic Word: {{TALKPAGENAMEE}}
10279 !! options
10280 title=[[User:Ævar Arnfjörð Bjarmason]]
10281 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10282 !! wikitext
10283 {{TALKPAGENAMEE}}
10284 !! html/*
10285 <p>User_talk:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10286 </p>
10287 !! end
10288
10289 !! test
10290 Magic Word: {{SUBJECTPAGENAME}}
10291 !! options
10292 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10293 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10294 !! wikitext
10295 {{SUBJECTPAGENAME}}
10296 !! html/*
10297 <p>User:Ævar Arnfjörð Bjarmason
10298 </p>
10299 !! end
10300
10301 !! test
10302 Magic Word: {{SUBJECTPAGENAMEE}}
10303 !! options
10304 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10305 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10306 !! wikitext
10307 {{SUBJECTPAGENAMEE}}
10308 !! html/*
10309 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10310 </p>
10311 !! end
10312
10313 !! test
10314 Magic Word: {{NUMBEROFFILES}}
10315 !! options
10316 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10317 !! wikitext
10318 {{NUMBEROFFILES}}
10319 !! html/*
10320 <p>7
10321 </p>
10322 !! end
10323
10324 !! test
10325 Magic Word: {{PAGENAME}}
10326 !! options
10327 title=[[User:Ævar Arnfjörð Bjarmason]]
10328 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10329 !! wikitext
10330 {{PAGENAME}}
10331 !! html/*
10332 <p>Ævar Arnfjörð Bjarmason
10333 </p>
10334 !! end
10335
10336 !! test
10337 Magic Word: {{PAGENAME}} with metacharacters
10338 !! options
10339 title=[['foo & bar = baz']]
10340 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10341 !! wikitext
10342 ''{{PAGENAME}}''
10343 !! html/php
10344 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
10345 </p>
10346 !! html+tidy
10347 <p><i>'foo &amp; bar = baz'</i></p>
10348 !! end
10349
10350 !! test
10351 Magic Word: {{PAGENAME}} with metacharacters (T28781)
10352 !! options
10353 title=[[*RFC 1234 http://example.com/]]
10354 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10355 !! wikitext
10356 {{PAGENAME}}
10357 !! html/php
10358 <p>&#42;RFC&#32;1234 http&#58;//example.com/
10359 </p>
10360 !! html+tidy
10361 <p>*RFC 1234 http://example.com/</p>
10362 !! end
10363
10364 !! test
10365 Magic Word: {{PAGENAMEE}}
10366 !! options
10367 title=[[User:Ævar Arnfjörð Bjarmason]]
10368 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10369 !! wikitext
10370 {{PAGENAMEE}}
10371 !! html/*
10372 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10373 </p>
10374 !! end
10375
10376 !! test
10377 Magic Word: {{PAGENAMEE}} with metacharacters (T28781)
10378 !! options
10379 title=[[*RFC 1234 http://example.com/]]
10380 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10381 !! wikitext
10382 {{PAGENAMEE}}
10383 !! html/php
10384 <p>&#42;RFC_1234_http&#58;//example.com/
10385 </p>
10386 !! html+tidy
10387 <p>*RFC_1234_http://example.com/</p>
10388 !! end
10389
10390 !! test
10391 Magic Word: {{REVISIONID}}
10392 !! options
10393 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10394 !! wikitext
10395 {{REVISIONID}}
10396 !! html/*
10397 <p>1337
10398 </p>
10399 !! end
10400
10401 !! test
10402 Magic Word: {{SCRIPTPATH}}
10403 !! options
10404 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10405 !! wikitext
10406 {{SCRIPTPATH}}
10407 !! html/*
10408
10409 !! end
10410
10411 !! test
10412 Magic Word: {{STYLEPATH}}
10413 !! options
10414 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10415 !! wikitext
10416 {{STYLEPATH}}
10417 !! html/*
10418 <p>/skins
10419 </p>
10420 !! end
10421
10422 !! test
10423 Magic Word: {{SERVER}}
10424 !! options
10425 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10426 !! wikitext
10427 {{SERVER}}
10428 !! html/*
10429 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
10430 </p>
10431 !! end
10432
10433 !! test
10434 Magic Word: {{SERVERNAME}}
10435 !! options
10436 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10437 !! wikitext
10438 {{SERVERNAME}}
10439 !! html/*
10440 <p>example.org
10441 </p>
10442 !! end
10443
10444 !! test
10445 Magic Word: {{SITENAME}}
10446 !! options
10447 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10448 !! wikitext
10449 {{SITENAME}}
10450 !! html/*
10451 <p>MediaWiki
10452 </p>
10453 !! end
10454
10455 !! test
10456 Magic Word: {{PAGELANGUAGE}}
10457 !! options
10458 language=fr
10459 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10460 !! wikitext
10461 {{PAGELANGUAGE}}
10462 !! html/*
10463 <p>fr
10464 </p>
10465 !! end
10466
10467 !! test
10468 Magic Word: {{PAGELANGUAGE}} on a page with no explicitly set language
10469 !! options
10470 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10471 !! wikitext
10472 {{PAGELANGUAGE}}
10473 !! html/*
10474 <p>en
10475 </p>
10476 !! end
10477
10478 !! test
10479 Case-sensitive magic words, when cased differently, should just be template transclusions
10480 !! wikitext
10481 {{CurrentMonth}}
10482 {{currentday}}
10483 {{cURreNTweEK}}
10484 {{currentHour}}
10485 !! html
10486 <p><a href="/index.php?title=Template:CurrentMonth&amp;action=edit&amp;redlink=1" class="new" title="Template:CurrentMonth (page does not exist)">Template:CurrentMonth</a>
10487 <a href="/index.php?title=Template:Currentday&amp;action=edit&amp;redlink=1" class="new" title="Template:Currentday (page does not exist)">Template:Currentday</a>
10488 <a href="/index.php?title=Template:CURreNTweEK&amp;action=edit&amp;redlink=1" class="new" title="Template:CURreNTweEK (page does not exist)">Template:CURreNTweEK</a>
10489 <a href="/index.php?title=Template:CurrentHour&amp;action=edit&amp;redlink=1" class="new" title="Template:CurrentHour (page does not exist)">Template:CurrentHour</a>
10490 </p>
10491 !! end
10492
10493 !! test
10494 Case-insensitive magic words should still work with weird casing.
10495 !! wikitext
10496 {{sErVeRNaMe}}
10497 {{LCFirst:AOEU}}
10498 {{ucFIRST:aoeu}}
10499 {{SERver}}
10500 !! html
10501 <p>example.org
10502 aOEU
10503 Aoeu
10504 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
10505 </p>
10506 !! end
10507
10508 # From plwiki:PLOS_ONE
10509 !! test
10510 Parsoid: Page property magic word with magic word contents
10511 !! wikitext
10512 {{DISPLAYTITLE:''{{PAGENAME}}''}}
10513 !! html/parsoid
10514 <meta property="mw:PageProp/displaytitle" content="Main Page" about="#mwt3" typeof="mw:ExpandedAttrs" data-parsoid='{"src":"{{DISPLAYTITLE:&#39;&#39;{{PAGENAME}}&#39;&#39;}}"}' data-mw='{"attribs":[[{"txt":"content"},{"html":"DISPLAYTITLE:&lt;i data-parsoid=&#39;{\"dsr\":[15,31,2,2]}&#39;>&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[]],\"dsr\":[17,29,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"PAGENAME\",\"function\":\"pagename\"},\"params\":{},\"i\":0}}]}&#39;>Main Page&lt;/span>&lt;/i>"}]]}'/>
10515 !! end
10516
10517 # NOTE: mw:ExpandedAttrs is not the best typeof here. mw:Transclusion is better.
10518 # But, this is a limitation of our representation and is documented in
10519 # TemplateHandler.js in processSpecialMagicWord
10520 !! test
10521 Parsoid: Template-generated DISPLAYTITLE
10522 !! wikitext
10523 {{{{echo|DISPLAYTITLE}}:Foo}}
10524 !! options
10525 showtitle
10526 !! config
10527 wgAllowDisplayTitle=true
10528 wgRestrictDisplayTitle=false
10529 !! html/php
10530 Foo
10531
10532 !! html/parsoid
10533 <meta property="mw:PageProp/displaytitle" content="Foo" about="#mwt1" typeof="mw:ExpandedAttrs" data-parsoid='{"pi":[[]]}' data-mw='{"attribs":[[{"txt":"content"},{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[2,23,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"DISPLAYTITLE\"}},\"i\":0}}]}&#39;>DISPLAYTITLE&lt;/span>:Foo"}]]}'/>
10534 !! end
10535
10536 !! test
10537 Namespace 1 {{ns:1}}
10538 !! wikitext
10539 {{ns:1}}
10540 !! html
10541 <p>Talk
10542 </p>
10543 !! end
10544
10545 !! test
10546 Namespace 1 {{ns:01}}
10547 !! wikitext
10548 {{ns:01}}
10549 !! html
10550 <p>Talk
10551 </p>
10552 !! end
10553
10554 !! test
10555 Namespace 0 {{ns:0}} (T6783)
10556 !! wikitext
10557 {{ns:0}}
10558 !! html
10559
10560 !! end
10561
10562 !! test
10563 Namespace 0 {{ns:00}} (T6783)
10564 !! wikitext
10565 {{ns:00}}
10566 !! html
10567
10568 !! end
10569
10570 !! test
10571 Namespace -1 {{ns:-1}}
10572 !! wikitext
10573 {{ns:-1}}
10574 !! html
10575 <p>Special
10576 </p>
10577 !! end
10578
10579 !! test
10580 Namespace User {{ns:User}}
10581 !! wikitext
10582 {{ns:User}}
10583 !! html
10584 <p>User
10585 </p>
10586 !! end
10587
10588 !! test
10589 Namespace User talk {{ns:User_talk}}
10590 !! wikitext
10591 {{ns:User_talk}}
10592 !! html
10593 <p>User talk
10594 </p>
10595 !! end
10596
10597 !! test
10598 Namespace User talk {{ns:uSeR tAlK}}
10599 !! wikitext
10600 {{ns:uSeR tAlK}}
10601 !! html
10602 <p>User talk
10603 </p>
10604 !! end
10605
10606 !! test
10607 Namespace File {{ns:File}}
10608 !! wikitext
10609 {{ns:File}}
10610 !! html
10611 <p>File
10612 </p>
10613 !! end
10614
10615 !! test
10616 Namespace File {{ns:Image}}
10617 !! wikitext
10618 {{ns:Image}}
10619 !! html
10620 <p>File
10621 </p>
10622 !! end
10623
10624 !! test
10625 Namespace (lang=de) Benutzer {{ns:User}}
10626 !! options
10627 language=de
10628 !! wikitext
10629 {{ns:User}}
10630 !! html
10631 <p>Benutzer
10632 </p>
10633 !! end
10634
10635 !! test
10636 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
10637 !! options
10638 language=de
10639 !! wikitext
10640 {{ns:3}}
10641 !! html
10642 <p>Benutzer Diskussion
10643 </p>
10644 !! end
10645
10646 !! test
10647 Urlencode
10648 !! wikitext
10649 {{urlencode:hi world?!}}
10650 {{urlencode:hi world?!|WIKI}}
10651 {{urlencode:hi world?!|PATH}}
10652 {{urlencode:hi world?!|QUERY}}
10653 !! html/php
10654 <p>hi+world%3F%21
10655 hi_world%3F!
10656 hi%20world%3F%21
10657 hi+world%3F%21
10658 </p>
10659 !! end
10660
10661 !! test
10662 Magic Word: prioritize type info over data-parsoid
10663 !! options
10664 parsoid=html2wt
10665 !! html/parsoid
10666 <meta property="mw:PageProp/forcetoc" data-parsoid='{"magicSrc":"__NOTOC__"}'/>
10667 !! wikitext
10668 __FORCETOC__
10669 !! end
10670
10671 !! test
10672 Magic Word: serialize on separate line (parsoid)
10673 !! options
10674 parsoid=wt2wt,html2wt
10675 !! wikitext
10676 foo
10677 __NOTOC__
10678 bar
10679 !! html/parsoid
10680 foo<meta property="mw:PageProp/notoc"/>bar
10681 !! end
10682
10683 !! test
10684 Magic Word: rt non-english wikis
10685 !! options
10686 parsoid=wt2wt
10687 language=de
10688 !! wikitext
10689 __NOEDITSECTION__
10690 !! html/parsoid
10691 <meta property="mw:PageProp/noeditsection" data-parsoid='{"magicSrc":"__NOEDITSECTION__"}'/>
10692 !! end
10693
10694 !!test
10695 __proto__ is treated as normal wikitext (T105997)
10696 !!wikitext
10697 __proto__
10698 !!html
10699 <p>__proto__
10700 </p>
10701 !!end
10702
10703 ###
10704 ### Magic links
10705 ###
10706 !! test
10707 Magic links: internal link to RFC (T2479)
10708 !! wikitext
10709 [[RFC 123]]
10710 !! html/php
10711 <p><a href="/index.php?title=RFC_123&amp;action=edit&amp;redlink=1" class="new" title="RFC 123 (page does not exist)">RFC 123</a>
10712 </p>
10713 !! html/parsoid
10714 <p><a rel="mw:WikiLink" href="./RFC_123" title="RFC 123">RFC 123</a></p>
10715 !! end
10716
10717 !! test
10718 Magic links: RFC (T2479)
10719 !! wikitext
10720 RFC 822
10721 !! html/php
10722 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
10723 </p>
10724 !! html/parsoid
10725 <p><a href="//tools.ietf.org/html/rfc822" rel="mw:ExtLink">RFC 822</a></p>
10726 !! end
10727
10728 !! test
10729 Magic links: RFC (T67278)
10730 !! wikitext
10731 This is RFC 822 but thisRFC 822 is not RFC 822linked.
10732 !! html/php
10733 <p>This is <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a> but thisRFC 822 is not RFC 822linked.
10734 </p>
10735 !! html/parsoid
10736 <p>This is <a href="//tools.ietf.org/html/rfc822" rel="mw:ExtLink">RFC 822</a> but thisRFC 822 is not RFC 822linked.</p>
10737 !! end
10738
10739 !! test
10740 Magic links: RFC (w/ non-newline whitespace, T30950/T31025)
10741 !! wikitext
10742 RFC &nbsp;&#160;&#0160;&#xA0;&#Xa0; 822
10743 RFC
10744 822
10745 !! html/php
10746 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
10747 RFC
10748 822
10749 </p>
10750 !! html/parsoid
10751 <p><a href="//tools.ietf.org/html/rfc822" rel="mw:ExtLink">RFC <span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#160;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#0160;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#xA0;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#Xa0;","srcContent":" "}'> </span> 822</a>
10752 RFC
10753 822</p>
10754 !! end
10755
10756 !! test
10757 Magic links: ISBN (T3937)
10758 !! wikitext
10759 ISBN 0-306-40615-2
10760 !! html/php
10761 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
10762 </p>
10763 !! html/parsoid
10764 <p><a href="./Special:BookSources/0306406152" rel="mw:WikiLink">ISBN 0-306-40615-2</a></p>
10765 !! end
10766
10767 !! test
10768 Magic links: ISBN (T67278)
10769 !! wikitext
10770 This is ISBN 978-0-316-09811-3 but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.
10771 !! html/php
10772 <p>This is <a href="/wiki/Special:BookSources/9780316098113" class="internal mw-magiclink-isbn">ISBN 978-0-316-09811-3</a> but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.
10773 </p>
10774 !! html/parsoid
10775 <p>This is <a href="./Special:BookSources/9780316098113" rel="mw:WikiLink">ISBN 978-0-316-09811-3</a> but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.</p>
10776 !! end
10777
10778 !! test
10779 Magic links: ISBN (w/ non-newline whitespace, T30950/T31025)
10780 !! wikitext
10781 ISBN &nbsp;&#160;&#0160;&#xA0;&#Xa0; 978&nbsp;0&#160;316&#0160;09811&#xA0;3
10782 ISBN
10783 9780316098113
10784 ISBN 978
10785 0316098113
10786 !! html/php
10787 <p><a href="/wiki/Special:BookSources/9780316098113" class="internal mw-magiclink-isbn">ISBN 978 0 316 09811 3</a>
10788 ISBN
10789 9780316098113
10790 ISBN 978
10791 0316098113
10792 </p>
10793 !! html/parsoid
10794 <p><a href="./Special:BookSources/9780316098113" rel="mw:WikiLink">ISBN <span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#160;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#0160;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#xA0;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#Xa0;","srcContent":" "}'> </span> 978<span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span>0<span typeof="mw:Entity" data-parsoid='{"src":"&amp;#160;","srcContent":" "}'> </span>316<span typeof="mw:Entity" data-parsoid='{"src":"&amp;#0160;","srcContent":" "}'> </span>09811<span typeof="mw:Entity" data-parsoid='{"src":"&amp;#xA0;","srcContent":" "}'> </span>3</a>
10795 ISBN
10796 9780316098113
10797 ISBN 978
10798 0316098113</p>
10799 !! end
10800
10801 !! test
10802 Magic links: PMID incorrectly converts space to underscore
10803 !! wikitext
10804 PMID 1234
10805 !! html/php
10806 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
10807 </p>
10808 !! html/parsoid
10809 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract" rel="mw:ExtLink">PMID 1234</a></p>
10810 !! end
10811
10812 !! test
10813 Magic links: PMID (T67278)
10814 !! wikitext
10815 This is PMID 1234 but thisPMID 1234 is not PMID 1234linked.
10816 !! html/php
10817 <p>This is <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a> but thisPMID 1234 is not PMID 1234linked.
10818 </p>
10819 !! html/parsoid
10820 <p>This is <a href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract" rel="mw:ExtLink">PMID 1234</a> but thisPMID 1234 is not PMID 1234linked.</p>
10821 !! end
10822
10823 !! test
10824 Magic links: PMID (w/ non-newline whitespace, T30950/T31025)
10825 !! wikitext
10826 PMID &nbsp;&#160;&#0160;&#xA0;&#Xa0; 1234
10827 PMID
10828 1234
10829 !! html/php
10830 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
10831 PMID
10832 1234
10833 </p>
10834 !! html/parsoid
10835 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract" rel="mw:ExtLink">PMID <span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#160;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#0160;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#xA0;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#Xa0;","srcContent":" "}'> </span> 1234</a>
10836 PMID
10837 1234</p>
10838 !! end
10839
10840 # <nowiki> nodes shouldn't be inserted during html2wt by Parsoid,
10841 # since these are ExtLinkText, not MagicLinkText
10842 !! test
10843 Magic links: use appropriate serialization for "almost" magic links.
10844 !! wikitext
10845 X[[Special:BookSources/0978739256|foo]]
10846
10847 X[//tools.ietf.org/html/rfc1234 foo]
10848 !! html/php
10849 <p>X<a href="/wiki/Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a>
10850 </p><p>X<a rel="nofollow" class="external text" href="//tools.ietf.org/html/rfc1234">foo</a>
10851 </p>
10852 !! html/parsoid
10853 <p>X<a rel="mw:WikiLink" href="./Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a></p>
10854 <p>X<a rel="mw:ExtLink" href="//tools.ietf.org/html/rfc1234">foo</a></p>
10855 !! end
10856
10857 !! test
10858 Magic links: All disabled (T47942)
10859 !! options
10860 wgEnableMagicLinks={"ISBN":false, "PMID":false, "RFC":false}
10861 !! wikitext
10862 ISBN 0-306-40615-2
10863 PMID 1234
10864 RFC 4321
10865 !! html/php
10866 <p>ISBN 0-306-40615-2
10867 PMID 1234
10868 RFC 4321
10869 </p>
10870 !! end
10871
10872 ###
10873 ### Templates
10874 ####
10875
10876 !! test
10877 Nonexistent template
10878 !! wikitext
10879 {{thistemplatedoesnotexist}}
10880 !! html
10881 <p><a href="/index.php?title=Template:Thistemplatedoesnotexist&amp;action=edit&amp;redlink=1" class="new" title="Template:Thistemplatedoesnotexist (page does not exist)">Template:Thistemplatedoesnotexist</a>
10882 </p>
10883 !! end
10884
10885 !! test
10886 Template with invalid target containing tags
10887 !! wikitext
10888 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
10889 !! html
10890 <p>{{a<b>b</b>|foo|a=b|a = b}}
10891 </p>
10892 !! end
10893
10894 !! test
10895 Template with invalid target containing unclosed tag
10896 !! wikitext
10897 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
10898 !! html
10899 <p>{{a<b>|foo|a=b|a = b}}</b>
10900 </p>
10901 !! end
10902
10903 !! test
10904 Template with invalid target containing wikilink
10905 !! wikitext
10906 {{[[Main Page]]}}
10907 !! html/php
10908 <p>{{<a href="/wiki/Main_Page" title="Main Page">Main Page</a>}}
10909 </p>
10910 !! html/parsoid
10911 <p><span typeof="mw:Transclusion" about="#mwt1" data-mw='{"parts":[{"template":{"target":{"wt":"[[Main Page]]"},"params":{},"i":0}}]}'>{{</span><a rel="mw:WikiLink" href="./Main_Page" about="#mwt1">Main Page</a><span about="#mwt1">}}</span></p>
10912 !! end
10913
10914 !! test
10915 Template with just whitespace in it, T70421
10916 !! wikitext
10917 {{echo|{{ }}}}
10918 !! html/parsoid
10919 <p about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"{{ }}"}},"i":0}}]}'>{{ }}</p>
10920 !! end
10921
10922 !! article
10923 Template:test
10924 !! text
10925 This is a test template
10926 !! endarticle
10927
10928 !! test
10929 Simple template
10930 !! wikitext
10931 {{test}}
10932 !! html
10933 <p>This is a test template
10934 </p>
10935 !! end
10936
10937 !! test
10938 Template with explicit namespace
10939 !! wikitext
10940 {{Template:test}}
10941 !! html
10942 <p>This is a test template
10943 </p>
10944 !! end
10945
10946
10947 !! article
10948 Template:paramtest
10949 !! text
10950 This is a test template with parameter {{{param}}}
10951 !! endarticle
10952
10953 !! test
10954 Template parameter
10955 !! wikitext
10956 {{paramtest|param=foo}}
10957 !! html
10958 <p>This is a test template with parameter foo
10959 </p>
10960 !! end
10961
10962 !! article
10963 Template:paramtestnum
10964 !! text
10965 [[{{{1}}}|{{{2}}}]]
10966 !! endarticle
10967
10968 !! test
10969 Template unnamed parameter
10970 !! wikitext
10971 {{paramtestnum|Main Page|the main page}}
10972 !! html
10973 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
10974 </p>
10975 !! end
10976
10977 !! article
10978 Template:templatesimple
10979 !! text
10980 (test)
10981 !! endarticle
10982
10983 !! article
10984 Template:templateredirect
10985 !! text
10986 #redirect [[Template:templatesimple]]
10987 !! endarticle
10988
10989 !! article
10990 Template:templateasargtestnum
10991 !! text
10992 {{{{{1}}}}}
10993 !! endarticle
10994
10995 !! article
10996 Template:templateasargtest
10997 !! text
10998 {{template{{{templ}}}}}
10999 !! endarticle
11000
11001 !! article
11002 Template:templateasargtest2
11003 !! text
11004 {{{{{templ}}}}}
11005 !! endarticle
11006
11007 !! test
11008 Template with template name as unnamed argument
11009 !! wikitext
11010 {{templateasargtestnum|templatesimple}}
11011 !! html
11012 <p>(test)
11013 </p>
11014 !! end
11015
11016 !! test
11017 Template with template name as argument
11018 !! wikitext
11019 {{templateasargtest|templ=simple}}
11020 !! html
11021 <p>(test)
11022 </p>
11023 !! end
11024
11025 !! test
11026 Template with template name as argument (2)
11027 !! wikitext
11028 {{templateasargtest2|templ=templatesimple}}
11029 !! html
11030 <p>(test)
11031 </p>
11032 !! end
11033
11034 !! article
11035 Template:templateasargtestdefault
11036 !! text
11037 {{{{{templ|templatesimple}}}}}
11038 !! endarticle
11039
11040 !! article
11041 Template:templa
11042 !! text
11043 '''templ'''
11044 !! endarticle
11045
11046 !! test
11047 Template with default value
11048 !! wikitext
11049 {{templateasargtestdefault}}
11050 !! html
11051 <p>(test)
11052 </p>
11053 !! end
11054
11055 !! test
11056 Template with default value (value set)
11057 !! wikitext
11058 {{templateasargtestdefault|templ=templa}}
11059 !! html
11060 <p><b>templ</b>
11061 </p>
11062 !! end
11063
11064 !! test
11065 Template redirect
11066 !! wikitext
11067 {{templateredirect}}
11068 !! html/php
11069 <p>(test)
11070 </p>
11071 !! html/parsoid
11072 <link rel="mw:PageProp/redirect" href="./Template:Templatesimple" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"templateredirect","href":"./Template:Templateredirect"},"params":{},"i":0}}]}'/>
11073 !! end
11074
11075 !! test
11076 Template with argument in separate line
11077 !! wikitext
11078 {{ templateasargtest |
11079 templ = simple }}
11080 !! html
11081 <p>(test)
11082 </p>
11083 !! end
11084
11085 !! test
11086 Template with complex template as argument
11087 !! wikitext
11088 {{paramtest|
11089 param ={{ templateasargtest |
11090 templ = simple }}}}
11091 !! html
11092 <p>This is a test template with parameter (test)
11093 </p>
11094 !! end
11095
11096 !! test
11097 Templates with templated name
11098 !! wikitext
11099 {{{{echo|echo}}|foo}}
11100 {{{{echo|inner list}} }}
11101 !! html
11102 <p>foo
11103 </p>
11104 <ul><li> item 1</li></ul>
11105
11106 !! html/parsoid
11107 <p about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"{{echo|echo}}","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
11108 <ul about="#mwt4" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"{{echo|inner list}} ","href":"./Template:Inner_list"},"params":{},"i":0}}]}'><li> item 1</li></ul>
11109 !! end
11110
11111 # Parsoid markup is deliberate "broken". This is an edge case.
11112 # See long comment in TemplateHandler.js:convertAttribsToString.
11113 !! test
11114 Templates with invalid templated targets
11115 !! wikitext
11116 {{echo
11117 {{echo|foo}}
11118 }}
11119 !! html/php
11120 <p>{{echo
11121 foo
11122 }}
11123 </p>
11124 !! html/parsoid
11125 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo\n{{echo|foo}}\n"},"params":{},"i":0}}]}'>{{echo
11126 foo }}</p>
11127 !! end
11128
11129 !! test
11130 Template with thumb image (with link in description)
11131 !! wikitext
11132 {{paramtest|param=[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
11133 !! html/php
11134 This is a test template with parameter <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/index.php?title=Special:Upload&amp;wpDestFile=Noimage.png" class="new" title="File:Noimage.png">File:Noimage.png</a> <div class="thumbcaption"><a href="/index.php?title=No_link&amp;action=edit&amp;redlink=1" class="new" title="No link (page does not exist)">link</a> <a href="/index.php?title=No_link&amp;action=edit&amp;redlink=1" class="new" title="No link (page does not exist)">caption</a></div></div></div>
11135
11136 !! html+tidy
11137 <p>This is a test template with parameter</p>
11138 <div class="thumb tright">
11139 <div class="thumbinner" style="width:182px;"><a href="/index.php?title=Special:Upload&amp;wpDestFile=Noimage.png" class="new" title="File:Noimage.png">File:Noimage.png</a>
11140 <div class="thumbcaption"><a href="/index.php?title=No_link&amp;action=edit&amp;redlink=1" class="new" title="No link (page does not exist)">link</a> <a href="/index.php?title=No_link&amp;action=edit&amp;redlink=1" class="new" title="No link (page does not exist)">caption</a></div>
11141 </div>
11142 </div>
11143 !! html/parsoid
11144 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"paramtest","href":"./Template:Paramtest"},"params":{"param":{"wt":"[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]"}},"i":0}}]}'>This is a test template with parameter </p><figure class="mw-default-size" typeof="mw:Error mw:Image/Thumb" about="#mwt1" data-mw='{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}]}'><a href="./File:Noimage.png" ><img resource="./File:Noimage.png" src="./Special:FilePath/Noimage.png" height="220" width="220"/></a><figcaption><a rel="mw:WikiLink" href="./No_link" title="No link">link</a> <a rel="mw:WikiLink" href="./No_link" title="No link">caption</a></figcaption></figure>
11145 !! end
11146
11147 !! article
11148 Template:complextemplate
11149 !! text
11150 {{{1}}} {{paramtest|
11151 param ={{{param}}}}}
11152 !! endarticle
11153
11154 !! test
11155 Template with complex arguments
11156 !! wikitext
11157 {{complextemplate|
11158 param ={{ templateasargtest |
11159 templ = simple }}|[[Template:complextemplate|link]]}}
11160 !! html
11161 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
11162 </p>
11163 !! end
11164
11165 !! test
11166 T2553: link with two variables in a piped link
11167 !! wikitext
11168 {|
11169 |[[{{{1}}}|{{{2}}}]]
11170 |}
11171 !! html/php
11172 <table>
11173 <tr>
11174 <td>[[{{{1}}}|{{{2}}}]]
11175 </td></tr></table>
11176
11177 !! html/parsoid
11178 <table>
11179 <tbody><tr><td>[[<span about="#mwt5" typeof="mw:Param" data-mw='{"parts":[{"templatearg":{"target":{"wt":"1"},"params":{},"i":0}}]}'>{{{1}}}</span>|<span about="#mwt2" typeof="mw:Param" data-mw='{"parts":[{"templatearg":{"target":{"wt":"2"},"params":{},"i":0}}]}'>{{{2}}}</span>]]</td></tr>
11180 </tbody></table>
11181 !! end
11182
11183 # See: T2553
11184 !! test
11185 Abort table cell attribute parsing on wikilink
11186 !! wikitext
11187 {|
11188 | testing [[one|two]] | three || four
11189 | testing one two | three || four
11190 | testing="[[one|two]]" | three || four
11191 |}
11192 !! html/php
11193 <table>
11194 <tr>
11195 <td> testing <a href="/index.php?title=One&amp;action=edit&amp;redlink=1" class="new" title="One (page does not exist)">two</a> | three </td>
11196 <td> four
11197 </td>
11198 <td> three </td>
11199 <td> four
11200 </td>
11201 <td> testing="<a href="/index.php?title=One&amp;action=edit&amp;redlink=1" class="new" title="One (page does not exist)">two</a>" | three </td>
11202 <td> four
11203 </td></tr></table>
11204
11205 !! html/parsoid
11206 <table>
11207 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'> testing <a rel="mw:WikiLink" href="./One" title="One" data-parsoid='{"stx":"piped","a":{"href":"./One"},"sa":{"href":"one"}}'>two</a> | three </td><td data-parsoid='{"stx_v":"row","autoInsertedEnd":true}'> four</td>
11208 <td data-parsoid='{"a":{"testing":null,"one":null,"two":null},"sa":{"testing":"","one":"","two":""},"autoInsertedEnd":true}'> three </td><td data-parsoid='{"stx_v":"row","autoInsertedEnd":true}'> four</td>
11209 <td> testing="<a rel="mw:WikiLink" href="./One" title="One" data-parsoid='{"stx":"piped","a":{"href":"./One"},"sa":{"href":"one"}}'>two</a>" | three </td><td data-parsoid='{"stx_v":"row","autoInsertedEnd":true}'> four</td></tr>
11210 </tbody></table>
11211 !! end
11212
11213 !! test
11214 Don't abort table cell attribute parsing if wikilink is found in template arg
11215 !! wikitext
11216 {|
11217 | Test {{#tag:ref|One two "[[three]]" four}}
11218 |}
11219 !! html/parsoid
11220 <table>
11221 <tbody><tr><td> Test <ref about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"#tag:ref","function":"#tag"},"params":{"1":{"wt":"One two \"[[three]]\" four"}},"i":0}}]}'>One two "<a rel="mw:WikiLink" href="./Three" title="Three">three</a>" four</ref></td></tr>
11222 </tbody></table>
11223 !! end
11224
11225 !! test
11226 Magic variable as template parameter
11227 !! wikitext
11228 {{paramtest|param={{SITENAME}}}}
11229 !! html
11230 <p>This is a test template with parameter MediaWiki
11231 </p>
11232 !! end
11233
11234 !! article
11235 Template:linktest
11236 !! text
11237 [[{{{param}}}|link]]
11238 !! endarticle
11239
11240 !! test
11241 Template parameter as link source
11242 !! wikitext
11243 {{linktest|param=Main Page}}
11244 !! html
11245 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
11246 </p>
11247 !! end
11248
11249 !!article
11250 Template:paramtest2
11251 !! text
11252 including another template, {{paramtest|param={{{arg}}}}}
11253 !! endarticle
11254
11255 !! test
11256 Template passing argument to another template
11257 !! wikitext
11258 {{paramtest2|arg='hmm'}}
11259 !! html
11260 <p>including another template, This is a test template with parameter 'hmm'
11261 </p>
11262 !! end
11263
11264 !! article
11265 Template:Linktest2
11266 !! text
11267 Main Page
11268 !! endarticle
11269
11270 !! test
11271 Template as link source
11272 !! wikitext
11273 [[{{linktest2}}]]
11274
11275 [[{{linktest2}}|Main Page]]
11276
11277 [[{{linktest2}}]]Page
11278 !! html
11279 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
11280 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
11281 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
11282 </p>
11283 !! end
11284
11285
11286 !! article
11287 Template:loop1
11288 !! text
11289 {{loop2}}
11290 !! endarticle
11291
11292 !! article
11293 Template:loop2
11294 !! text
11295 {{loop1}}
11296 !! endarticle
11297
11298 !! test
11299 Template infinite loop
11300 !! wikitext
11301 {{loop1}}
11302 !! html
11303 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
11304 </p>
11305 !! end
11306
11307 !! test
11308 Template from main namespace
11309 !! wikitext
11310 {{:Main Page}}
11311 !! html
11312 <p>blah blah
11313 </p>
11314 !! end
11315
11316 !! article
11317 Template:table
11318 !! text
11319 {|
11320 | 1 || 2
11321 |-
11322 | 3 || 4
11323 |}
11324 !! endarticle
11325
11326 !! test
11327 T2529: Template with table, not included at beginning of line
11328 !! wikitext
11329 foo {{table}}
11330 !! html
11331 <p>foo
11332 </p>
11333 <table>
11334 <tr>
11335 <td> 1 </td>
11336 <td> 2
11337 </td></tr>
11338 <tr>
11339 <td> 3 </td>
11340 <td> 4
11341 </td></tr></table>
11342
11343 !! end
11344
11345 !! test
11346 T2523: Template shouldn't eat newline (or add an extra one before table)
11347 !! wikitext
11348 foo
11349 {{table}}
11350 !! html
11351 <p>foo
11352 </p>
11353 <table>
11354 <tr>
11355 <td> 1 </td>
11356 <td> 2
11357 </td></tr>
11358 <tr>
11359 <td> 3 </td>
11360 <td> 4
11361 </td></tr></table>
11362
11363 !! end
11364
11365 !! test
11366 T2041: Template parameters shown as broken links
11367 !! wikitext
11368 {{{parameter}}}
11369 !! html
11370 <p>{{{parameter}}}
11371 </p>
11372 !! end
11373
11374 !! test
11375 Template with targets containing wikilinks
11376 !! options
11377 parsoid=wt2html
11378 !! wikitext
11379 {{[[foo]]}}
11380
11381 {{[[{{echo|foo}}]]}}
11382
11383 {{{{echo|[[foo}}]]}}
11384 !! html/php
11385 <p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
11386 </p><p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
11387 </p><p>{{[[foo}}]]
11388 </p>
11389 !! html/parsoid
11390 <p>{{<a rel="mw:WikiLink" href="./Foo" title="Foo">foo</a>}}</p>
11391 <p>{{<a typeof="mw:ExpandedAttrs" rel="mw:WikiLink" href="./Foo" title="Foo" data-mw='{"attribs":[[{"txt":"href"},{"html":"&lt;span about=\"#mwt3\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[17,29,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"foo\"}},\"i\":0}}]}&#39;>foo&lt;/span>"}]]}'>foo</a>}}</p>
11392 <p>{{<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[foo}}]]"}},"i":0}}]}'>[[foo}}]]</span></p>
11393 !! end
11394
11395 !! article
11396 Template:''
11397 !! text
11398 bar
11399 !! endarticle
11400
11401 !! test
11402 Templates: Double quotes as template target
11403 !! wikitext
11404 foo {{''}} baz
11405 !! html/php
11406 <p>foo bar baz
11407 </p>
11408 !! html/parsoid
11409 <p>foo <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"&#39;&#39;","href":"./Template:&#39;&#39;"},"params":{},"i":0}}]}'>bar</span> baz
11410 </p>
11411 !! end
11412
11413 ## This test is about making sure Parsoid's data-mw is well formed in the
11414 ## face of multiple templates with intersecting and overlapping ranges. The
11415 ## wikitext itself is wretched.
11416 !! test
11417 Templates with intersecting and overlapping ranges
11418 !! wikitext
11419 {|{{echo|
11420 <p>ha</p>}}
11421 {|{{echo|
11422 <p>ho</p>}}
11423 {{echo|{{!}}hi}}
11424 |}
11425 !! html/php+tidy
11426 <p>ha</p>
11427 <p>ho</p>
11428 <table>
11429 <tr>
11430 <td></td>
11431 </tr>
11432 <tr>
11433 <td>hi</td>
11434 </tr>
11435 </table>
11436 <table>
11437 <tr>
11438 <td></td>
11439 </tr>
11440 </table>
11441 !! html/parsoid
11442 <p about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"stx":"html","autoInsertedEnd":true,"pi":[[{"k":"1"}],[{"k":"1"}],[{"k":"1"}]],"firstWikitextNode":"table"}' data-mw='{"parts":["{|",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"\n&lt;p>ha&lt;/p>"}},"i":0}},"\n","{|",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"\n&lt;p>ho&lt;/p>"}},"i":1}},"\n",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"{{!}}hi"}},"i":2}},"\n|}"]}'>ha</p><table about="#mwt1" typeof="mw:ExpandedAttrs" data-mw='{"attribs":[[{"txt":"","html":""},{"html":""}]]}'>
11443
11444 </table><p about="#mwt1">ho</p><table about="#mwt1" typeof="mw:ExpandedAttrs" data-mw='{"attribs":[[{"txt":"","html":""},{"html":""}]]}'>
11445
11446 <tbody><tr><td>hi</td></tr>
11447 </tbody></table>
11448 !! end
11449
11450 !! article
11451 Template:MSGNW test
11452 !! text
11453 ''None'' of '''this''' should be
11454 * interpreted
11455 but rather passed unmodified
11456 {{test}}
11457 <gallery>
11458 File:Foobar.jpg
11459 </gallery>
11460 <!-- comment -->
11461 !! endarticle
11462
11463 # hmm, fix this or just deprecate msgnw and document its behavior?
11464 !! test
11465 msgnw keyword
11466 !! wikitext
11467 {{msgnw:MSGNW test}}
11468 !! html/php
11469 <p>&#39;&#39;None&#39;&#39; of &#39;&#39;&#39;this&#39;&#39;&#39; should be
11470 &#42; interpreted
11471 &#32;but rather passed unmodified
11472 &#123;&#123;test&#125;&#125;
11473 &#60;gallery&#62;
11474 File:Foobar.jpg
11475 &#60;/gallery&#62;
11476 &#60;!-- comment --&#62;
11477 </p>
11478 !! end
11479
11480 !! test
11481 int keyword
11482 !! wikitext
11483 {{int:youhavenewmessages|lots of money|not!}}
11484 !! html
11485 <p>You have lots of money (not!).
11486 </p>
11487 !! end
11488
11489 !! test
11490 int keyword - non-existing message
11491 !! wikitext
11492 {{int:var}}
11493 !! html
11494 <p>⧼var⧽
11495 </p>
11496 !! end
11497
11498 !! article
11499 Template:Includes
11500 !! text
11501 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
11502 !! endarticle
11503
11504 !! test
11505 <includeonly> and <noinclude> being included
11506 !! wikitext
11507 {{Includes}}
11508 !! html
11509 <p>Foobar
11510 </p>
11511 !! end
11512
11513 !! article
11514 Template:Includes2
11515 !! text
11516 <onlyinclude>Foo</onlyinclude>bar
11517 !! endarticle
11518
11519 !! test
11520 <onlyinclude> being included
11521 !! wikitext
11522 {{Includes2}}
11523 !! html
11524 <p>Foo
11525 </p>
11526 !! end
11527
11528
11529 !! article
11530 Template:Includes3
11531 !! text
11532 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
11533 !! endarticle
11534
11535 !! test
11536 <onlyinclude> and <includeonly> being included
11537 !! wikitext
11538 {{Includes3}}
11539 !! html
11540 <p>Foo
11541 </p>
11542 !! end
11543
11544 !! test
11545 <includeonly> and <noinclude> on a page
11546 !! wikitext
11547 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
11548 !! html
11549 <p>Foozar
11550 </p>
11551 !! end
11552
11553 !! test
11554 Un-closed <noinclude>
11555 !! wikitext
11556 <noinclude>
11557 !! html
11558 !! end
11559
11560 !! test
11561 <onlyinclude> on a page
11562 !! wikitext
11563 <onlyinclude>Foo</onlyinclude>bar
11564 !! html
11565 <p>Foobar
11566 </p>
11567 !! end
11568
11569 !! test
11570 Un-closed <onlyinclude>
11571 !! wikitext
11572 <onlyinclude>
11573 !! html
11574 !! end
11575
11576 !!test
11577 Self-closed noinclude, includeonly, onlyinclude tags
11578 !! wikitext
11579 <noinclude />
11580 <includeonly />
11581 <onlyinclude />
11582 !! html
11583 <p><br />
11584 </p>
11585 !!end
11586
11587 !!test
11588 Unbalanced includeonly and noinclude tags
11589 !! wikitext
11590 {|
11591 |a</noinclude>
11592 |b</noinclude></noinclude>
11593 |c</noinclude></includeonly>
11594 |d</includeonly></includeonly>
11595 |}
11596 !! html
11597 <table>
11598 <tr>
11599 <td>a
11600 </td>
11601 <td>b
11602 </td>
11603 <td>c&lt;/includeonly&gt;
11604 </td>
11605 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
11606 </td></tr></table>
11607
11608 !!end
11609
11610 !! article
11611 Template:Includeonly section
11612 !! text
11613 <includeonly>
11614 ==Includeonly section==
11615 </includeonly>
11616 ==Section T-1==
11617 !!endarticle
11618
11619 !! test
11620 T8563: Edit link generation for section shown by <includeonly>
11621 !! wikitext
11622 {{includeonly section}}
11623 !! html
11624 <h2><span class="mw-headline" id="Includeonly_section">Includeonly section</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Template:Includeonly_section&amp;action=edit&amp;section=T-1" title="Template:Includeonly section">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
11625 <h2><span class="mw-headline" id="Section_T-1">Section T-1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Template:Includeonly_section&amp;action=edit&amp;section=T-2" title="Template:Includeonly section">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
11626
11627 !! end
11628
11629 # Uses same input as the contents of [[Template:Includeonly section]]
11630 !! test
11631 T8563: Section extraction for section shown by <includeonly>
11632 !! options
11633 section=T-2
11634 !! wikitext
11635 <includeonly>
11636 ==Includeonly section==
11637 </includeonly>
11638 ==Section T-2==
11639 !! html
11640 ==Section T-2==
11641 !! end
11642
11643 !! test
11644 T8563: Edit link generation for section suppressed by <includeonly>
11645 !! wikitext
11646 <includeonly>
11647 ==Includeonly section==
11648 </includeonly>
11649 ==Section 1==
11650 !! html
11651 <h2><span class="mw-headline" id="Section_1">Section 1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Section 1">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
11652
11653 !! end
11654
11655 !! test
11656 T8563: Section extraction for section suppressed by <includeonly>
11657 !! options
11658 section=1
11659 !! wikitext
11660 <includeonly>
11661 ==Includeonly section==
11662 </includeonly>
11663 ==Section 1==
11664 !! html
11665 ==Section 1==
11666 !! end
11667
11668 !! test
11669 Un-closed <includeonly>
11670 !! wikitext
11671 <includeonly>
11672 !! html/php
11673 !! html/parsoid
11674 <meta typeof="mw:Includes/IncludeOnly" data-parsoid='{"src":"&lt;includeonly>"}'/>
11675 !! end
11676
11677 ## We used to, but no longer wt2wt this test since the default serializer
11678 ## will normalize the include directives to serialize on their own line.
11679 ## Selser will take care of preserving formatting in scenarios where they
11680 ## intermingled with other wikitext.
11681 !! test
11682 Includes and comments at SOL
11683 !! options
11684 parsoid=wt2html,html2html
11685 !! wikitext
11686 <!-- comment --><noinclude><!-- comment --></noinclude><!-- comment -->== hu ==
11687
11688 <noinclude>
11689 some
11690 </noinclude>* stuff
11691 * here
11692
11693 <includeonly>can have stuff</includeonly>=== here ===
11694
11695 !! html/php
11696 <h2><span class="mw-headline" id="hu">hu</span></h2>
11697 <p>some
11698 </p>
11699 <ul><li> stuff</li>
11700 <li> here</li></ul>
11701 <h3><span class="mw-headline" id="here">here</span></h3>
11702
11703 !! html/parsoid
11704 <!-- comment --><meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/><!-- comment --><meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"&lt;/noinclude>"}'/><!-- comment --><h2> hu </h2>
11705
11706 <meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/>
11707 <p>some</p>
11708 <meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"&lt;/noinclude>"}'/><ul><li> stuff</li>
11709 <li> here</li></ul>
11710
11711 <meta typeof="mw:Includes/IncludeOnly" data-parsoid='{"src":"&lt;includeonly>can have stuff&lt;/includeonly>"}'/><meta typeof="mw:Includes/IncludeOnly/End" data-parsoid='{"src":""}'/><h3> here </h3>
11712
11713 !! end
11714
11715 # TODO: test with DOM fragment reuse!
11716 !! test
11717 Parsoid: DOM fragment reuse
11718 !! options
11719 parsoid=wt2wt,wt2html
11720 !! wikitext
11721 a{{echo|b<table></table>c}}d
11722
11723 a{{echo|b
11724 <table></table>
11725 c}}d
11726
11727 {{echo|a
11728
11729 <table></table>
11730
11731 b}}
11732 !! html
11733 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":["a",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"b&lt;table>&lt;/table>c"}},"i":0}},"d"]}' data-parsoid='{"pi":[[{"k":"1"}]]}'>ab</p><table about="#mwt1" data-parsoid='{"stx":"html"}'></table><p about="#mwt1">cd</p>
11734
11735 <p about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":["a",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"b\n&lt;table>&lt;/table>\nc"}},"i":0}},"d"]}' data-parsoid='{"pi":[[{"k":"1"}]]}'>ab</p><span about="#mwt2">
11736 </span><table about="#mwt2" data-parsoid='{"stx":"html"}'></table><span about="#mwt2">
11737 </span><p about="#mwt2">cd</p>
11738
11739 <p about="#mwt3" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\n\n&lt;table>&lt;/table>\n\nb"}},"i":0}}]}' data-parsoid='{"pi":[[{"k":"1"}]]}'>a</p><span about="#mwt3">
11740
11741 </span><table about="#mwt3" data-parsoid='{"stx":"html"}'></table><span about="#mwt3">
11742
11743 </span><p about="#mwt3">b</p>
11744 !! end
11745
11746 !! test
11747 Parsoid: Merge double tds (T52603)
11748 !! options
11749 parsoid
11750 !! wikitext
11751 {|
11752 |{{echo|{{!}} foo}}
11753 |}
11754 !! html
11755 <table><tbody>
11756 <tr><td about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":["|",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"{{!}} foo"}},"i":0}}]}'> foo</td></tr>
11757 </tbody></table>
11758 !! end
11759
11760 !! test
11761 Parsoid: Merge double tds in nested transclusion content (T52603)
11762 !! options
11763 parsoid
11764 !! wikitext
11765 {{echo|<div>}}
11766 {|
11767 |{{echo|{{!}} foo}}
11768 |}
11769 {{echo|</div>}}
11770 !! html
11771 <div about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<div>"}},"i":0}},"\n{|\n|",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"{{!}} foo"}},"i":1}},"\n|}\n",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"</div>"}},"i":2}}]}'>
11772 <table><tbody>
11773 <tr><td data-mw='{"parts":["|"]}'> foo</td></tr>
11774 </tbody></table>
11775 </div>
11776 !! end
11777
11778 ###
11779 ### <includeonly> and <noinclude> in attributes
11780 ###
11781 !!test
11782 0. includeonly around the entire attribute
11783 !! wikitext
11784 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
11785 !! html
11786 <p><span id="v2">bar</span>
11787 </p>
11788 !!end
11789
11790 !!test
11791 1. includeonly in html attr key
11792 !! wikitext
11793 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
11794 !! html
11795 <p><span id="foo">bar</span>
11796 </p>
11797 !!end
11798
11799 !!test
11800 2. includeonly in html attr value
11801 !! wikitext
11802 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
11803 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
11804 !! html
11805 <p><span id="v1">bar</span>
11806 <span id="v1">bar</span>
11807 </p>
11808 !!end
11809
11810 !!test
11811 3. includeonly in part of an attr value
11812 !! wikitext
11813 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
11814 !! html
11815 <p><span style="color:red;">bar</span>
11816 </p>
11817 !!end
11818
11819 !!test
11820 4. includeonly in table attributes
11821 !! wikitext
11822 {|
11823 |- <noinclude>
11824 |-
11825 |a
11826 </noinclude>
11827 |- <includeonly>
11828 |-
11829 |b
11830 </includeonly>
11831 |}
11832 !! html
11833 <table>
11834
11835
11836 <tr>
11837 <td>a
11838 </td></tr>
11839 </table>
11840
11841 !!end
11842
11843 ###
11844 ### Token Stream Patcher tests
11845 ###
11846 ### These tests won't always pass wt2wt and other modes because
11847 ### on serialization, the table will be output on a new line.
11848 ### For now, we are blacklisting them, and using this to test selser.
11849 ###
11850
11851 !!test
11852 1. Table tag in SOL posn. should get reparsed correctly with valid TSR
11853 !!options
11854 parsoid=wt2html,wt2wt
11855 !!wikitext
11856 {{echo|}}{| width = '100%'
11857 |foo
11858 |}
11859 !!html/parsoid
11860 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":""}},"i":0}}]}'></span><table width="100%">
11861 <tbody><tr><td>foo</td></tr>
11862 </tbody></table>
11863 !!end
11864
11865 ## We used to, but no longer wt2wt this test since the default serializer
11866 ## will normalize the include directives to serialize on their own line.
11867 ## Selser will take care of preserving formatting in scenarios where they
11868 ## intermingled with other wikitext.
11869 !!test
11870 2. Table tag in SOL posn. should get reparsed correctly with valid TSR
11871 !!options
11872 parsoid=wt2html
11873 !!wikitext
11874 <includeonly>a</includeonly>{| {{{b}}}
11875 |c
11876 |}
11877 !!html/parsoid
11878 <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":""}]]}'>
11879 <tbody><tr><td>c</td></tr>
11880 </tbody></table>
11881 !!end
11882
11883 !! test
11884 Table wikitext syntax outside wiki-tables
11885 !! wikitext
11886 a
11887 |+ not a caption
11888 ! not a table heading
11889 |- not a table row
11890 | not a table cell
11891 | class="foo bar" | baz
11892 b
11893 |}
11894 |-
11895 c
11896 !! html
11897 <p>a
11898 |+ not a caption
11899 ! not a table heading
11900 |- not a table row
11901 | not a table cell
11902 | class="foo bar" | baz
11903 b
11904 |}
11905 |-
11906 c
11907 </p>
11908 !! end
11909
11910 ###
11911 ### Testing parsing of templates where a template arg
11912 ### has the same name as the template itself.
11913 ###
11914
11915 !! article
11916 Template:quote
11917 !! text
11918 {{{quote|{{{1}}}}}}
11919 !! endarticle
11920
11921 !!test
11922 Templates: Template Name/Arg clash: 1. Use of positional param
11923 !! wikitext
11924 {{quote|foo}}
11925 !! html
11926 <p>foo
11927 </p>
11928 !!end
11929
11930 !!test
11931 Templates: Template Name/Arg clash: 2. Use of named param
11932 !! wikitext
11933 {{quote|quote=foo}}
11934 !! html
11935 <p>foo
11936 </p>
11937 !!end
11938
11939 !!test
11940 Templates: Template Name/Arg clash: 3. Use of named param with empty input
11941 !! wikitext
11942 {{quote|quote}}
11943 !! html
11944 <p>quote
11945 </p>
11946 !!end
11947
11948 ###
11949 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
11950 ###
11951
11952 !!test
11953 Templates: 1. Simple use
11954 !! wikitext
11955 {{echo|Foo}}
11956 !! html
11957 <p>Foo
11958 </p>
11959 !!end
11960
11961 !!test
11962 Templates: 2. Inside a block tag
11963 !! wikitext
11964 <div>{{echo|Foo}}</div>
11965 <blockquote>{{echo|Foo}}</blockquote>
11966 !! html
11967 <div>Foo</div>
11968 <blockquote>Foo</blockquote>
11969
11970 !! html+tidy
11971 <div>Foo</div>
11972 <blockquote>
11973 <p>Foo</p>
11974 </blockquote>
11975 !!end
11976
11977 !!test
11978 Templates: P-wrapping: 1a. Templates on consecutive lines
11979 !! wikitext
11980 {{echo|Foo}}
11981 {{echo|bar}}
11982 !! html
11983 <p>Foo
11984 bar
11985 </p>
11986 !!end
11987
11988 !!test
11989 Templates: P-wrapping: 1b. Templates on consecutive lines
11990 !! wikitext
11991 Foo
11992
11993 {{echo|bar}}
11994 {{echo|baz}}
11995 !! html
11996 <p>Foo
11997 </p><p>bar
11998 baz
11999 </p>
12000 !!end
12001
12002 !!test
12003 Templates: P-wrapping: 1c. Templates on consecutive lines
12004 !! wikitext
12005 {{echo|Foo}}
12006 {{echo|bar}} <div>baz</div>
12007 !! html
12008 <p>Foo
12009 </p>
12010 bar <div>baz</div>
12011
12012 !! html+tidy
12013 <p>Foo</p>
12014 <p>bar</p>
12015 <div>baz</div>
12016 !! end
12017
12018 !!test
12019 Templates: P-wrapping: 1d. Template preceded by comment-only line
12020 !!options
12021 parsoid
12022 !! wikitext
12023 <!-- foo -->
12024 {{echo|Bar}}
12025 !! html
12026 <!-- foo -->
12027
12028 <p about="#mwt223" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Bar"}},"i":0}}]}'>Bar</p>
12029 !!end
12030
12031 !!test
12032 Templates: Inline Text: 1. Multiple template uses
12033 !! wikitext
12034 {{echo|Foo}}bar{{echo|baz}}
12035 !! html
12036 <p>Foobarbaz
12037 </p>
12038 !!end
12039
12040 !!test
12041 Templates: Inline Text: 2. Back-to-back template uses
12042 !! wikitext
12043 {{echo|Foo}}{{echo|bar}}
12044 !! html
12045 <p>Foobar
12046 </p>
12047 !!end
12048
12049 !!test
12050 Templates: Block Tags: 1. Multiple template uses
12051 !! wikitext
12052 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
12053 !! html
12054 <div>Foo</div><div>bar</div><div>baz</div>
12055
12056 !!end
12057
12058 !!test
12059 Templates: Block Tags: 2. Back-to-back template uses
12060 !! wikitext
12061 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
12062 !! html
12063 <div>Foo</div><div>bar</div>
12064
12065 !!end
12066
12067 # This is an edge case relating to paragraph wrapping.
12068 !!test
12069 Templates: Correctly encapsulate templates producing </p> tag without a corresponding <p> tag
12070 !! wikitext
12071 {{echo|a
12072 b</p>}}
12073 !! html/parsoid
12074 <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
12075 b</p>
12076 !!end
12077
12078 !!test
12079 Templates: Links: 1. Simple example
12080 !! wikitext
12081 {{echo|[[Foo|bar]]}}
12082 !! html
12083 <p><a href="/wiki/Foo" title="Foo">bar</a>
12084 </p>
12085 !!end
12086
12087 !!test
12088 Templates: Links: 2. Generation of link href
12089 !! wikitext
12090 [[{{echo|Foo}}|bar]]
12091 !! html
12092 <p><a href="/wiki/Foo" title="Foo">bar</a>
12093 </p>
12094 !!end
12095
12096 !!test
12097 Templates: Links: 3. Generation of part of a link href
12098 !! wikitext
12099 [[Fo{{echo|o}}|bar]]
12100
12101 [[Foo{{echo|bar}}]]
12102
12103 [[Foo{{echo|bar}}baz]]
12104
12105 [[Foo{{echo|bar}}|bar]]
12106
12107 [[:Foo{{echo|bar}}]]
12108
12109 [[:Foo{{echo|bar}}|bar]]
12110 !! html
12111 <p><a href="/wiki/Foo" title="Foo">bar</a>
12112 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
12113 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
12114 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
12115 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
12116 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
12117 </p>
12118 !!end
12119
12120 !!test
12121 Templates: Links: 4. Multiple templates generating link href
12122 !! wikitext
12123 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
12124 !! html
12125 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
12126 </p>
12127 !!end
12128
12129 !!test
12130 Templates: Links: 5. Generation of link text
12131 !! wikitext
12132 [[Foo|{{echo|bar}}]]
12133 !! html
12134 <p><a href="/wiki/Foo" title="Foo">bar</a>
12135 </p>
12136 !!end
12137
12138 !!test
12139 Templates: Links: 5. Nested templates (only outermost template should be marked)
12140 !! wikitext
12141 {{echo|[[{{echo|Foo}}|bar]]}}
12142 !! html
12143 <p><a href="/wiki/Foo" title="Foo">bar</a>
12144 </p>
12145 !!end
12146
12147 !!test
12148 Templates: HTML Tag: 1. Generation of HTML attr. key
12149 !! wikitext
12150 <div {{echo|style}}="color:red;">foo</div>
12151 !! html
12152 <div style="color:red;">foo</div>
12153
12154 !!end
12155
12156 !!test
12157 Templates: HTML Tag: 2. Generation of HTML attr. value
12158 !! wikitext
12159 <div style={{echo|'color:red;'}}>foo</div>
12160 !! html
12161 <div style="color:red;">foo</div>
12162
12163 !!end
12164
12165 !!test
12166 Templates: HTML Tag: 3. Generation of HTML attr key and value
12167 !! wikitext
12168 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
12169 !! html
12170 <div style="color:red;">foo</div>
12171
12172 !!end
12173
12174 !!test
12175 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
12176 !! wikitext
12177 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
12178 !! html
12179 <div title="This is a long title with just one piece templated">foo</div>
12180
12181 !!end
12182
12183 !!test
12184 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
12185 !! wikitext
12186 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
12187 !! html
12188 <div title="This is a long title with just one piece templated">foo</div>
12189
12190 !!end
12191
12192 !!test
12193 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
12194 !! wikitext
12195 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
12196 !! html
12197 <div title="This is a long title with just one piece templated">foo</div>
12198
12199 !!end
12200
12201 # SSS FIXME: While it is great we added support for all this,
12202 # do we want to make this part of the spec? Maybe we want to
12203 # deprecate this kind of usage in the future?
12204 !!test
12205 Templates: HTML Tag: 7. Generation of partial attribute key string
12206 !! wikitext
12207 <div st{{echo|yle}}="color:red;">foo</div>
12208 !! html
12209 <div style="color:red;">foo</div>
12210
12211 !!end
12212
12213 !! test
12214 Templates: HTML Tag: 8. Template-generated attribute (k=v)
12215 !! wikitext
12216 <div {{echo|1=id="v1"}}>bar</div>
12217 !! html
12218 <div id="v1">bar</div>
12219
12220 !!end
12221
12222 !! test
12223 Templates: HTML Tag: 9. Multiple template-generated attributes
12224 !! wikitext
12225 <div {{echo|1=id="v1" title="foo"}}>bar</div>
12226 !! html
12227 <div id="v1" title="foo">bar</div>
12228
12229 !!end
12230
12231 !! test
12232 Templates: Support for templates generating attributes and content
12233 !! wikitext
12234 {| {{mixed_attr_content_template}}
12235 |-
12236 |bar
12237 |}
12238 !! html/php
12239 <table style="color:red;" title="T48811">
12240
12241 <tr>
12242 <td>foo
12243 </td></tr>
12244 <tr>
12245 <td>bar
12246 </td></tr></table>
12247
12248 !! html/parsoid
12249 <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|}"]}'>
12250 <tbody><tr>
12251 <td>foo</td></tr>
12252 <tr>
12253 <td>bar</td></tr>
12254 </tbody></table>
12255 !!end
12256
12257 !! test
12258 1. Entities and nowikis inside templated attributes should be handled correctly
12259 !! wikitext
12260 <div {{echo|style{{=}}"background:&#35;f9f9f9;"}}>foo</div>
12261 !! html/php
12262 <div style="background:#f9f9f9;">foo</div>
12263
12264 !! html/parsoid
12265 <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>
12266 !! end
12267
12268 !! test
12269 2. Entities and nowikis inside templated attributes should be handled correctly
12270 !! wikitext
12271 {|
12272 |{{table_attribs_3}}
12273 |}
12274 !! html/php
12275 <table>
12276 <tr>
12277 <td style="background:#f9f9f9;">Foo
12278 </td></tr></table>
12279
12280 !! html/parsoid
12281 <table>
12282 <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>
12283 </tbody></table>
12284 !! end
12285
12286 !! test
12287 3. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
12288 !! wikitext
12289 {{tbl-start}}
12290 |{{table_attribs_3}}
12291 {{tbl-end}}
12292 !! html/php
12293 <table>
12294 <tr>
12295 <td style="background:#f9f9f9;">Foo
12296 </td></tr></table>
12297
12298 !! html/parsoid
12299 <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}}]}'>
12300 <tbody><tr><td style="background:#f9f9f9;">Foo</td></tr>
12301 </tbody></table>
12302 !! end
12303
12304 # T107622
12305 !! test
12306 4. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
12307 !! wikitext
12308 {|
12309 | {{table_attribs_6}} hi
12310 |}
12311 !! html/php
12312 <table>
12313 <tr>
12314 <td style="background: red;"> hi
12315 </td></tr></table>
12316
12317 !! html/parsoid
12318 <table>
12319 <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>
12320 </tbody></table>
12321 !! end
12322
12323 !!test
12324 Templates: HTML Tables: 1. Generating start of a HTML table
12325 !! wikitext
12326 {{echo|<table><tr><td>foo</td>}}</tr></table>
12327 !! html
12328 <table><tr><td>foo</td></tr></table>
12329
12330 !!end
12331
12332 !!test
12333 Templates: HTML Tables: 2a. Generating middle of a HTML table
12334 !! wikitext
12335 <table><tr>{{echo|<td>foo</td>}}</tr></table>
12336 !! html
12337 <table><tr><td>foo</td></tr></table>
12338
12339 !!end
12340
12341 !!test
12342 Templates: HTML Tables: 2b. Generating middle of a HTML table
12343 !! wikitext
12344 <table>{{echo|<tr><td>foo</td></tr>}}</table>
12345 !! html
12346 <table><tr><td>foo</td></tr></table>
12347
12348 !!end
12349
12350 !!test
12351 Templates: HTML Tables: 3. Generating end of a HTML table
12352 !! wikitext
12353 <table><tr>{{echo|<td>foo</td></tr></table>}}
12354 !! html
12355 <table><tr><td>foo</td></tr></table>
12356
12357 !!end
12358
12359 !!test
12360 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
12361 !! wikitext
12362 {{echo|<table>}}<tr><td>foo</td></tr></table>
12363 !! html
12364 <table><tr><td>foo</td></tr></table>
12365
12366 !!end
12367
12368 !!test
12369 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
12370 !! wikitext
12371 <table>{{echo|<tr>}}<td>foo</td></tr></table>
12372 !! html
12373 <table><tr><td>foo</td></tr></table>
12374
12375 !!end
12376
12377 !!test
12378 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
12379 !! wikitext
12380 <table><tr>{{echo|<td>}}foo</td></tr></table>
12381 !! html
12382 <table><tr><td>foo</td></tr></table>
12383
12384 !!end
12385
12386 !!test
12387 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
12388 !! wikitext
12389 <table><tr><td>foo{{echo|</td>}}</tr></table>
12390 !! html
12391 <table><tr><td>foo</td></tr></table>
12392
12393 !!end
12394
12395 !!test
12396 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
12397 !! wikitext
12398 <table><tr><td>foo</td>{{echo|</tr>}}</table>
12399 !! html
12400 <table><tr><td>foo</td></tr></table>
12401
12402 !!end
12403
12404 !!test
12405 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
12406 !! wikitext
12407 <table><tr><td>foo</td></tr>{{echo|</table>}}
12408 !! html
12409 <table><tr><td>foo</td></tr></table>
12410
12411 !!end
12412
12413 !!test
12414 Templates: HTML Tables: 5. Proper fostering of categories from inside
12415 !!options
12416 parsoid=wt2html,wt2wt
12417 !! wikitext
12418 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
12419 <!--Two categories (T52330)-->
12420 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
12421 !! html
12422 <link rel="mw:PageProp/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
12423 <!--Two categories (T52330)-->
12424 <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>
12425 !!end
12426
12427 !!test
12428 Templates: Wiki Tables: 1a. Fostering of entire template content
12429 !! wikitext
12430 {|
12431 {{echo|a}}
12432 |}
12433 !! html
12434 <table>
12435 a
12436 <tr><td></td></tr></table>
12437
12438 !! html+tidy
12439 <p>a</p>
12440 <table>
12441 <tr>
12442 <td></td>
12443 </tr>
12444 </table>
12445 !! end
12446
12447 !!test
12448 Templates: Wiki Tables: 1b. Fostering of entire template content
12449 !! wikitext
12450 {|
12451 {{echo|<div>}}
12452 foo
12453 {{echo|</div>}}
12454 |}
12455 !! html
12456 <table>
12457 <div>
12458 <p>foo
12459 </p>
12460 </div>
12461 <tr><td></td></tr></table>
12462
12463 !! html+tidy
12464 <div>
12465 <p>foo</p>
12466 </div>
12467 <table>
12468 <tr>
12469 <td></td>
12470 </tr>
12471 </table>
12472 !! end
12473
12474 !!test
12475 Templates: Wiki Tables: 2. Fostering of partial template content
12476 !! wikitext
12477 {|
12478 {{echo|a
12479 <div>b</div>}}
12480 |}
12481 !! html
12482 <table>
12483 a
12484 <div>b</div>
12485 <tr><td></td></tr></table>
12486
12487 !! html+tidy
12488 <p>a</p>
12489 <div>b</div>
12490 <table>
12491 <tr>
12492 <td></td>
12493 </tr>
12494 </table>
12495 !! end
12496
12497 !!test
12498 Templates: Wiki Tables: 3. td-content via multiple templates
12499 !! wikitext
12500 {|
12501 {{echo|{{pipe}}a}}{{echo|b}}
12502 |}
12503 !! html
12504 <table>
12505 <tr>
12506 <td>ab
12507 </td></tr></table>
12508
12509 !!end
12510
12511 !!test
12512 Templates: Wiki Tables: 4. Templated tags, no content
12513 !! wikitext
12514 {{tbl-start}}
12515 {{tbl-end}}
12516 !! html
12517 <table>
12518 <tr><td></td></tr></table>
12519
12520 !!end
12521
12522 !!test
12523 Templates: Wiki Tables: 5. Templated tags, regular td-tags
12524 !! wikitext
12525 {{tbl-start}}
12526 |foo
12527 {{tbl-end}}
12528 !! html
12529 <table>
12530 <tr>
12531 <td>foo
12532 </td></tr></table>
12533
12534 !!end
12535
12536 !!test
12537 Templates: Wiki Tables: 6. Templated tags, templated td-tags
12538 !! wikitext
12539 {{tbl-start}}
12540 {{!}}foo
12541 {{tbl-end}}
12542 !! html
12543 <table>
12544 <tr>
12545 <td>foo
12546 </td></tr></table>
12547
12548 !!end
12549
12550 ## This test case is very specific to Parsoid's internals
12551 ## and is hence only tested for Parsoid's code. Parsoid uses
12552 ## a <meta> marker tag for <ref> tags and they are expanded
12553 ## much later. We are verifying that this <meta> tag usage
12554 ## doesn't prevent foster parenting.
12555 !!test
12556 Templates: Wiki Tables: 7. Fosterable <ref>s should get fostered
12557 !!wikitext
12558 {{PartialTable}}<ref>foo</ref>
12559 |}
12560
12561 <references />
12562 !!html/parsoid
12563 <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">
12564 <tbody>
12565 </tbody></table>
12566
12567 <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>
12568 !!end
12569
12570 !! test
12571 Templates: Wiki Tables: 8. Fosterable meta-tags should get fostered
12572 !! wikitext
12573 {{echo|
12574 {{{!}}
12575 {{!}}-}}
12576 <onlyinclude>
12577 |foo
12578 </onlyinclude>
12579 {{!}}}
12580 !! html/parsoid
12581 <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{{!}}}"]}'>
12582 </span><meta typeof="mw:Includes/OnlyInclude" about="#mwt1"/><table about="#mwt1">
12583 <tbody><tr>
12584
12585 <td>foo
12586 <meta typeof="mw:Includes/OnlyInclude/End"/></td></tr>
12587 </tbody></table>
12588 !! end
12589
12590 !!test
12591 Templates: Lists: Multi-line list-items via templates
12592 !! wikitext
12593 *{{echo|a {{nonexistent|
12594 unused}}}}
12595 *{{echo|b {{nonexistent|
12596 unused}}}}
12597 !! html
12598 <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>
12599 <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>
12600
12601 !!end
12602
12603 !!test
12604 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
12605 !! wikitext
12606 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
12607 !! html
12608 <p><i>ab</i>c<i>d</i>e
12609 </p>
12610 !!end
12611
12612 !!test
12613 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
12614 (PHP parser generates misnested html)
12615 !! wikitext
12616 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
12617 !! html/parsoid
12618 <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>
12619 !!end
12620
12621 !!test
12622 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
12623 (PHP parser generates misnested html; Parsoid html2wt mode adds newlines between {{echo}}s)
12624 !! options
12625 parsoid=wt2html,wt2wt
12626 !! wikitext
12627 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
12628 !! html
12629 <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>
12630 <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>
12631 <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>
12632 !!end
12633
12634 !!test
12635 Templates: Ugly nesting: 4. Divs opened/closed across templates
12636 !! wikitext
12637 a<div>b{{echo|c</div>d}}e
12638 !! html
12639 a<div>bc</div>de
12640
12641 !! html+tidy
12642 <p>a</p>
12643 <div>bc</div>
12644 <p>de</p>
12645 !! end
12646
12647 !!test
12648 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
12649 (Parsoid-centric)
12650 !! options
12651 parsoid
12652 !! wikitext
12653 {|
12654 |{{echo|foo</table>}}
12655 |bar
12656 |}
12657 !! html
12658 <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|}"]}'>
12659
12660 <tbody>
12661 <tr>
12662 <td>foo</td></tr></tbody></table><span about="#mwt1">
12663 </span><span about="#mwt1">|bar</span><span about="#mwt1">
12664 |}</span>
12665 !!end
12666
12667 !!test
12668 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
12669 (Parsoid-centric)
12670 !! options
12671 parsoid
12672 !! wikitext
12673 <table>
12674 <tr>
12675 <td>
12676 <table>
12677 <tr>
12678 <td>1. {{echo|foo </table>}}</td>
12679 <td> bar </td>
12680 <td>2. {{echo|baz </table>}}</td>
12681 </tr>
12682 <tr>
12683 <td>abc</td>
12684 </tr>
12685 </table>
12686 </td>
12687 </tr>
12688 <tr>
12689 <td>xyz</td>
12690 </tr>
12691 </table>
12692 !! html
12693 <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>"]}'>
12694 <tbody><tr>
12695 <td>
12696 <table>
12697 <tbody><tr>
12698 <td>1. foo </td></tr></tbody></table></td>
12699 <td> bar </td>
12700 <td>2. baz </td></tr></tbody></table><span about="#mwt2">
12701 </span><span about="#mwt2">
12702 </span><span about="#mwt2">
12703 </span><span about="#mwt2">abc</span><span about="#mwt2">
12704 </span><span about="#mwt2">
12705 </span><span about="#mwt2">
12706 </span><span about="#mwt2">
12707 </span><span about="#mwt2">
12708 </span><span about="#mwt2">
12709 </span><span about="#mwt2">xyz</span><span about="#mwt2">
12710 </span><span about="#mwt2">
12711 </span>
12712 !!end
12713
12714 !! test
12715 Templates: Ugly templates: 3. newline-only template parameter
12716 !! wikitext
12717 foo {{echo|
12718 }}
12719 !! html
12720 <p>foo
12721 </p>
12722 !! end
12723
12724 # This looks like a bug: a single newline triggers p/br for some reason.
12725 !! test
12726 Templates: Ugly templates: 4. newline-only template parameter inconsistency
12727 !! wikitext
12728 {{echo|
12729 }}
12730 !! html
12731 <p><br />
12732 </p>
12733 !! end
12734
12735 # T66017 -- ugly wikitext with fostered content generates two template ranges that
12736 # have a true overlap (T1-start - T2-start - T1-end - T2-end).
12737 !! test
12738 Templates: Ugly templates: 5. Template encapsulation test: Non-trivial overlap of template ranges is properly handled
12739 !! wikitext
12740 {{echo|<table>}}
12741 {{echo|<div>foo}}
12742 {{echo|</table>}}
12743 !! html/parsoid
12744 <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
12745 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
12746 </table>
12747 !! end
12748
12749 # T66017 -- ugly wikitext with fostered content generates two template ranges
12750 # that are "identical" and generate nesting cycles in the algorithm
12751 !! test
12752 Templates: Ugly templates: 6. Template encapsulation test: Cyclical nesting of template ranges is properly handled
12753 !! wikitext
12754 {{echo|<table><tr><td><table>}}
12755 {{echo|<div>}}
12756 {{echo|</div>}}
12757 !! html/parsoid
12758 <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"}'>
12759 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
12760 </table></td></tr></tbody></table>
12761 !! end
12762
12763 !! test
12764 Templates: Parameters substituted at the top-level
12765 !! wikitext
12766 {{{foo|''who'' {{echo|me}}? '''never!'''}}}
12767
12768 {{{foo|bar|baz}}}
12769 !! html/php
12770 <p><i>who</i> me? <b>never!</b>
12771 </p><p>bar
12772 </p>
12773 !! html/parsoid
12774 <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>
12775
12776 <p about="#mwt3" typeof="mw:Param" data-mw='{"parts":[{"templatearg":{"target":{"wt":"foo"},"params":{"1":{"wt":"bar"},"2":{"wt":"baz"}},"i":0}}]}'>bar</p>
12777 !! end
12778
12779 !!test
12780 Parser Functions: 1. Simple example
12781 !! wikitext
12782 {{uc:foo}}
12783 !! html
12784 <p>FOO
12785 </p>
12786 !!end
12787
12788 !!test
12789 Parser Functions: 2. Nested use (only outermost should be marked up)
12790 !! wikitext
12791 {{uc:{{lc:FOO}}}}
12792 !! html
12793 <p>FOO
12794 </p>
12795 !!end
12796
12797 ###
12798 ### Pre-save transform tests
12799 ###
12800 !! test
12801 pre-save transform: subst:
12802 !! options
12803 pst
12804 !! wikitext
12805 {{subst:test}}
12806 !! html/php
12807 This is a test template
12808 !! end
12809
12810 !! test
12811 pre-save transform: normal template
12812 !! options
12813 pst
12814 !! wikitext
12815 {{test}}
12816 !! html/php
12817 {{test}}
12818 !! end
12819
12820 !! test
12821 pre-save transform: nonexistent template
12822 !! options
12823 pst
12824 !! wikitext
12825 {{thistemplatedoesnotexist}}
12826 !! html/php
12827 {{thistemplatedoesnotexist}}
12828 !! end
12829
12830 !! test
12831 pre-save transform: subst magic variables
12832 !! options
12833 pst
12834 !! wikitext
12835 {{subst:SITENAME}}
12836 !! html/php
12837 MediaWiki
12838 !! end
12839
12840 # This is T2089, which I fixed. -- wtm
12841 !! test
12842 pre-save transform: subst: templates with parameters
12843 !! options
12844 pst
12845 !! wikitext
12846 {{subst:paramtest|param="something else"}}
12847 !! html/php
12848 This is a test template with parameter "something else"
12849 !! end
12850
12851 !! article
12852 Template:nowikitest
12853 !! text
12854 <nowiki>'''not wiki'''</nowiki>
12855 !! endarticle
12856
12857 !! test
12858 pre-save transform: nowiki in subst (T3188)
12859 !! options
12860 pst
12861 !! wikitext
12862 {{subst:nowikitest}}
12863 !! html/php
12864 <nowiki>'''not wiki'''</nowiki>
12865 !! end
12866
12867 !! article
12868 Template:commenttest
12869 !! text
12870 This template has <!-- a comment --> in it.
12871 !! endarticle
12872
12873 !! test
12874 pre-save transform: comment in subst (T3936)
12875 !! options
12876 pst
12877 !! wikitext
12878 {{subst:commenttest}}
12879 !! html/php
12880 This template has <!-- a comment --> in it.
12881 !! end
12882
12883 !! test
12884 pre-save transform: unclosed tag
12885 !! options
12886 pst
12887 !! wikitext
12888 <nowiki>'''not wiki'''
12889 !! html/php
12890 <nowiki>'''not wiki'''
12891 !! end
12892
12893 !! test
12894 pre-save transform: mixed tag case
12895 !! options
12896 pst
12897 !! wikitext
12898 <NOwiki>'''not wiki'''</noWIKI>
12899 !! html/php
12900 <NOwiki>'''not wiki'''</noWIKI>
12901 !! end
12902
12903 !! test
12904 pre-save transform: unclosed comment in <nowiki>
12905 !! options
12906 pst
12907 !! wikitext
12908 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
12909 !! html/php
12910 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
12911 !!end
12912
12913 # Leading @ in this template definition works around a limitation
12914 # in parsoid's parserTests which otherwise strips the <span> from the
12915 # result (confusing it for a template wrapper)
12916 !! article
12917 Template:dangerous
12918 !!text
12919 @<span onmouseover="alert('crap')">Oh no</span>
12920 !!endarticle
12921
12922 !!test
12923 (confirming safety of fix for subst T3936)
12924 !! wikitext
12925 {{Template:dangerous}}
12926 !! html
12927 <p>@<span>Oh no</span>
12928 </p>
12929 !! end
12930
12931 !! test
12932 pre-save transform: comment containing gallery (T7024)
12933 !! options
12934 pst
12935 !! wikitext
12936 <!-- <gallery>data</gallery> -->
12937 !! html/php
12938 <!-- <gallery>data</gallery> -->
12939 !!end
12940
12941 !! test
12942 pre-save transform: comment containing extension
12943 !! options
12944 pst
12945 !! wikitext
12946 <!-- <tag>data</tag> -->
12947 !! html/php
12948 <!-- <tag>data</tag> -->
12949 !!end
12950
12951 !! test
12952 pre-save transform: comment containing nowiki
12953 !! options
12954 pst
12955 !! wikitext
12956 <!-- <nowiki>data</nowiki> -->
12957 !! html/php
12958 <!-- <nowiki>data</nowiki> -->
12959 !!end
12960
12961 !! test
12962 pre-save transform: <noinclude> in subst (T5298)
12963 !! options
12964 pst
12965 !! wikitext
12966 {{subst:Includes}}
12967 !! html/php
12968 Foobar
12969 !! end
12970
12971 !! test
12972 pre-save transform: <onlyinclude> in subst (T5298)
12973 !! options
12974 pst
12975 !! wikitext
12976 {{subst:Includes2}}
12977 !! html/php
12978 Foo
12979 !! end
12980
12981 !! article
12982 Template:SubstTest
12983 !!text
12984 {{<includeonly>subst:</includeonly>Includes}}
12985 !! endarticle
12986
12987 !! article
12988 Template:SafeSubstTest
12989 !! text
12990 {{<includeonly>safesubst:</includeonly>Includes}}
12991 !! endarticle
12992
12993 !! test
12994 T24297: safesubst: works during PST
12995 !! options
12996 pst
12997 !! wikitext
12998 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
12999 !! html/php
13000 FoobarFoobar
13001 !! end
13002
13003 !! test
13004 T24297: safesubst: works during normal parse
13005 !! wikitext
13006 {{SafeSubstTest}}
13007 !! html
13008 <p>Foobar
13009 </p>
13010 !! end
13011
13012 !! test
13013 subst: does not work during normal parse
13014 !! wikitext
13015 {{SubstTest}}
13016 !! html
13017 <p>{{subst:Includes}}
13018 </p>
13019 !! end
13020
13021 !! test
13022 pre-save transform: context links ("pipe trick")
13023 !! options
13024 pst
13025 !! wikitext
13026 [[Article (context)|]]
13027 [[Bar:Article|]]
13028 [[:Bar:Article|]]
13029 [[Bar:Article (context)|]]
13030 [[:Bar:Article (context)|]]
13031 [[|Article]]
13032 [[|Article (context)]]
13033 [[Bar:X (Y) Z|]]
13034 [[:Bar:X (Y) Z|]]
13035 !! html/php
13036 [[Article (context)|Article]]
13037 [[Bar:Article|Article]]
13038 [[:Bar:Article|Article]]
13039 [[Bar:Article (context)|Article]]
13040 [[:Bar:Article (context)|Article]]
13041 [[Article]]
13042 [[Article (context)]]
13043 [[Bar:X (Y) Z|X (Y) Z]]
13044 [[:Bar:X (Y) Z|X (Y) Z]]
13045 !! end
13046
13047 !! test
13048 pre-save transform: context links ("pipe trick") with interwiki prefix
13049 !! options
13050 pst
13051 !! wikitext
13052 [[interwiki:Article|]]
13053 [[:interwiki:Article|]]
13054 [[interwiki:Bar:Article|]]
13055 [[:interwiki:Bar:Article|]]
13056 !! html/php
13057 [[interwiki:Article|Article]]
13058 [[:interwiki:Article|Article]]
13059 [[interwiki:Bar:Article|Bar:Article]]
13060 [[:interwiki:Bar:Article|Bar:Article]]
13061 !! end
13062
13063 !! test
13064 pre-save transform: context links ("pipe trick") with parens in title
13065 !! options
13066 pst title=[[Somearticle (context)]]
13067 !! wikitext
13068 [[|Article]]
13069 !! html/php
13070 [[Article (context)|Article]]
13071 !! end
13072
13073 !! test
13074 pre-save transform: context links ("pipe trick") with comma in title
13075 !! options
13076 pst title=[[Someplace, Somewhere]]
13077 !! wikitext
13078 [[|Otherplace]]
13079 [[Otherplace, Elsewhere|]]
13080 [[Otherplace, Elsewhere, Anywhere|]]
13081 !! html/php
13082 [[Otherplace, Somewhere|Otherplace]]
13083 [[Otherplace, Elsewhere|Otherplace]]
13084 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
13085 !! end
13086
13087 !! test
13088 pre-save transform: context links ("pipe trick") with parens and comma
13089 !! options
13090 pst title=[[Someplace (IGNORED), Somewhere]]
13091 !! wikitext
13092 [[|Otherplace]]
13093 [[Otherplace (place), Elsewhere|]]
13094 !! html/php
13095 [[Otherplace, Somewhere|Otherplace]]
13096 [[Otherplace (place), Elsewhere|Otherplace]]
13097 !! end
13098
13099 !! test
13100 pre-save transform: context links ("pipe trick") with comma and parens
13101 !! options
13102 pst title=[[Who, me? (context)]]
13103 !! wikitext
13104 [[|Yes, you.]]
13105 [[Me, Myself, and I (1937 song)|]]
13106 !! html/php
13107 [[Yes, you. (context)|Yes, you.]]
13108 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
13109 !! end
13110
13111 !! test
13112 pre-save transform: context links ("pipe trick") with namespace
13113 !! options
13114 pst title=[[Ns:Somearticle]]
13115 !! wikitext
13116 [[|Article]]
13117 !! html/php
13118 [[Ns:Article|Article]]
13119 !! end
13120
13121 !! test
13122 pre-save transform: context links ("pipe trick") with namespace and parens
13123 !! options
13124 pst title=[[Ns:Somearticle (context)]]
13125 !! wikitext
13126 [[|Article]]
13127 !! html/php
13128 [[Ns:Article (context)|Article]]
13129 !! end
13130
13131 !! test
13132 pre-save transform: context links ("pipe trick") with namespace and comma
13133 !! options
13134 pst title=[[Ns:Somearticle, Context, Whatever]]
13135 !! wikitext
13136 [[|Article]]
13137 !! html/php
13138 [[Ns:Article, Context, Whatever|Article]]
13139 !! end
13140
13141 !! test
13142 pre-save transform: context links ("pipe trick") with namespace, comma and parens
13143 !! options
13144 pst title=[[Ns:Somearticle, Context (context)]]
13145 !! wikitext
13146 [[|Article]]
13147 !! html/php
13148 [[Ns:Article (context)|Article]]
13149 !! end
13150
13151 !! test
13152 pre-save transform: context links ("pipe trick") with namespace, parens and comma
13153 !! options
13154 pst title=[[Ns:Somearticle (IGNORED), Context]]
13155 !! wikitext
13156 [[|Article]]
13157 !! html/php
13158 [[Ns:Article, Context|Article]]
13159 !! end
13160
13161 !! test
13162 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, T32149)
13163 !! options
13164 pst
13165 !! wikitext
13166 [[Article(context)|]]
13167 [[Bar:Article(context)|]]
13168 [[:Bar:Article(context)|]]
13169 [[|Article(context)]]
13170 [[Bar:X(Y)Z|]]
13171 [[:Bar:X(Y)Z|]]
13172 !! html/php
13173 [[Article(context)|Article]]
13174 [[Bar:Article(context)|Article]]
13175 [[:Bar:Article(context)|Article]]
13176 [[Article(context)]]
13177 [[Bar:X(Y)Z|X(Y)Z]]
13178 [[:Bar:X(Y)Z|X(Y)Z]]
13179 !! end
13180
13181 !! test
13182 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, T32149)
13183 !! options
13184 pst
13185 !! wikitext
13186 [[Article (context)|]]
13187 [[Bar:Article (context)|]]
13188 [[:Bar:Article (context)|]]
13189 [[|Article (context)]]
13190 [[Bar:X (Y) Z|]]
13191 [[:Bar:X (Y) Z|]]
13192 !! html/php
13193 [[Article (context)|Article]]
13194 [[Bar:Article (context)|Article]]
13195 [[:Bar:Article (context)|Article]]
13196 [[Article (context)]]
13197 [[Bar:X (Y) Z|X (Y) Z]]
13198 [[:Bar:X (Y) Z|X (Y) Z]]
13199 !! end
13200
13201 !! test
13202 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, T32149)
13203 !! options
13204 pst
13205 !! wikitext
13206 [[Article(context)|]]
13207 [[Bar:Article(context)|]]
13208 [[:Bar:Article(context)|]]
13209 [[|Article(context)]]
13210 [[Bar:X(Y)Z|]]
13211 [[:Bar:X(Y)Z|]]
13212 !! html/php
13213 [[Article(context)|Article]]
13214 [[Bar:Article(context)|Article]]
13215 [[:Bar:Article(context)|Article]]
13216 [[Article(context)]]
13217 [[Bar:X(Y)Z|X(Y)Z]]
13218 [[:Bar:X(Y)Z|X(Y)Z]]
13219 !! end
13220
13221 !! test
13222 pre-save transform: context links ("pipe trick") with commas (T23660)
13223 !! options
13224 pst
13225 !! wikitext
13226 [[Article (context), context|]]
13227 [[Article (context),context|]]
13228 [[Bar:Article (context), context|]]
13229 [[Bar:Article (context),context|]]
13230 [[:Bar:Article (context), context|]]
13231 [[:Bar:Article (context),context|]]
13232 !! html/php
13233 [[Article (context), context|Article]]
13234 [[Article (context),context|Article]]
13235 [[Bar:Article (context), context|Article]]
13236 [[Bar:Article (context),context|Article]]
13237 [[:Bar:Article (context), context|Article]]
13238 [[:Bar:Article (context),context|Article]]
13239 !! end
13240
13241 !! test
13242 Parsoid: backwards pipe trick
13243 !! wikitext
13244 [[|'''bar''']]
13245 !! html/php
13246 <p>[[|<b>bar</b>]]
13247 </p>
13248 !! html/parsoid
13249 <p>[[|<b>bar</b>]]</p>
13250 !! end
13251
13252 !! test
13253 pre-save transform: trim trailing empty lines
13254 !! options
13255 pst
13256 !! wikitext
13257 Empty lines are trimmed
13258
13259
13260
13261
13262 !! html/php
13263 Empty lines are trimmed
13264 !! end
13265
13266 !! test
13267 pre-save transform: Signature expansion
13268 !! options
13269 pst
13270 !! wikitext
13271 * ~~~
13272 * <noinclude>~~~</noinclude>
13273 * <includeonly>~~~</includeonly>
13274 * <onlyinclude>~~~</onlyinclude>
13275 !! html/php
13276 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
13277 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
13278 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
13279 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
13280 !! end
13281
13282
13283 !! test
13284 pre-save transform: Signature expansion in nowiki tags (T2093)
13285 !! options
13286 pst disabled
13287 !! wikitext
13288 Shall not expand:
13289
13290 <nowiki>~~~~</nowiki>
13291
13292 <includeonly><nowiki>~~~~</nowiki></includeonly>
13293
13294 <noinclude><nowiki>~~~~</nowiki></noinclude>
13295
13296 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
13297
13298 {{subst:Foo}} shall be converted to FOO
13299
13300 As well as inside noinclude/onlyinclude
13301 <noinclude>{{subst:Foo}}</noinclude>
13302 <onlyinclude>{{subst:Foo}}</onlyinclude>
13303
13304 But not inside includeonly
13305 <includeonly>{{subst:Foo}}</includeonly>
13306 !! html/php
13307 Shall not expand:
13308
13309 <nowiki>~~~~</nowiki>
13310
13311 <includeonly><nowiki>~~~~</nowiki></includeonly>
13312
13313 <noinclude><nowiki>~~~~</nowiki></noinclude>
13314
13315 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
13316
13317 FOO shall be converted to FOO
13318
13319 As well as inside noinclude/onlyinclude
13320 <noinclude>FOO</noinclude>
13321 <onlyinclude>FOO</onlyinclude>
13322
13323 But not inside includeonly
13324 <includeonly>{{subst:Foo}}</includeonly>
13325 !! end
13326
13327 !! test
13328 Parsoid: Recognize nowiki with trailing space in tags
13329 !! options
13330 parsoid=wt2html
13331 !! wikitext
13332 <nowiki ><div>[[foo]]</nowiki >
13333
13334 a<nowiki / >b
13335
13336 c<nowiki />d
13337
13338 e<nowiki/ >f
13339 !! html
13340 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
13341 <p>ab</p>
13342 <p>cd</p>
13343 <p>ef</p>
13344 !! end
13345
13346 !! test
13347 Parsoid: Recognize nowiki with odd capitalization
13348 !! options
13349 parsoid=wt2html
13350 !! wikitext
13351 <noWikI ><div>[[foo]]</Nowiki >
13352 !! html
13353 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
13354 !! end
13355
13356
13357 !! test
13358 Parsoid: Escape nowiki with trailing space in tags
13359 !! options
13360 parsoid=html2wt
13361 !! html/parsoid
13362 <p>&lt;nowiki &gt; foo &lt/nowiki ></p>
13363 <p>a&lt;nowiki /&gt;b</p>
13364 <p>c&lt;nowiki/ &gt;d</p>
13365 !! wikitext
13366 &lt;nowiki &gt; foo &lt;/nowiki &gt;
13367
13368 a&lt;nowiki /&gt;b
13369
13370 c&lt;nowiki/ &gt;d
13371 !! end
13372
13373 !! test
13374 Parsoid: Escape weird noWikI capitalizations
13375 !! options
13376 parsoid=html2wt
13377 !! html/parsoid
13378 <p>&lt;noWikI &gt; foo &lt/NoWikI ></p>
13379 !! wikitext
13380 &lt;noWikI &gt; foo &lt;/NoWikI &gt;
13381 !! end
13382
13383 ###
13384 ### Message transform tests
13385 ###
13386 !! test
13387 message transform: magic variables
13388 !! options
13389 msg
13390 !! wikitext
13391 {{SITENAME}}
13392 !! html
13393 MediaWiki
13394 !! end
13395
13396 !! test
13397 message transform: should not transform wiki markup
13398 !! options
13399 msg
13400 !! wikitext
13401 ''test''
13402 !! html
13403 ''test''
13404 !! end
13405
13406 !! test
13407 message transform: <noinclude> in transcluded template (T6926)
13408 !! options
13409 msg
13410 !! wikitext
13411 {{Includes}}
13412 !! html
13413 Foobar
13414 !! end
13415
13416 !! test
13417 message transform: <onlyinclude> in transcluded template (T6926)
13418 !! options
13419 msg
13420 !! wikitext
13421 {{Includes2}}
13422 !! html
13423 Foo
13424 !! end
13425
13426 !! test
13427 {{#special:}} page name, known
13428 !! options
13429 msg
13430 !! wikitext
13431 {{#special:Recentchanges}}
13432 !! html
13433 Special:RecentChanges
13434 !! end
13435
13436 !! test
13437 {{#special:}} page name with subpage, known
13438 !! options
13439 msg
13440 !! wikitext
13441 {{#special:Recentchanges/param}}
13442 !! html
13443 Special:RecentChanges/param
13444 !! end
13445
13446 !! test
13447 {{#special:}} page name, unknown
13448 !! options
13449 msg
13450 !! wikitext
13451 {{#special:foobar nonexistent}}
13452 !! html
13453 Special:Foobar nonexistent
13454 !! end
13455
13456 !! test
13457 {{#speciale:}} page name, known
13458 !! options
13459 msg
13460 !! wikitext
13461 {{#speciale:Recentchanges}}
13462 !! html
13463 Special:RecentChanges
13464 !! end
13465
13466 !! test
13467 {{#speciale:}} page name with subpage, known
13468 !! options
13469 msg
13470 !! wikitext
13471 {{#speciale:Recentchanges/param}}
13472 !! html
13473 Special:RecentChanges/param
13474 !! end
13475
13476 !! test
13477 {{#speciale:}} page name, unknown
13478 !! options
13479 msg
13480 !! wikitext
13481 {{#speciale:foobar nonexistent}}
13482 !! html
13483 Special:Foobar_nonexistent
13484 !! end
13485
13486 ###
13487 ### Images
13488 ###
13489 ### For Parsoid-specific tests, see
13490 #### https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
13491
13492 !! test
13493 Simple image
13494 !! options
13495 parsoid=wt2html,wt2wt,html2html
13496 !! wikitext
13497 [[Image:foobar.jpg]]
13498 !! html/php
13499 <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>
13500 </p>
13501 !! html/parsoid
13502 <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>
13503 !! end
13504
13505 !! test
13506 Simple image (using File: namespace, now canonical)
13507 !! wikitext
13508 [[File:Foobar.jpg]]
13509 !! html/php
13510 <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>
13511 </p>
13512 !! html/parsoid
13513 <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>
13514 !! end
13515
13516 !! test
13517 Right-aligned image
13518 !! wikitext
13519 [[File:Foobar.jpg|right]]
13520 !! html/php
13521 <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>
13522
13523 !! html/parsoid
13524 <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>
13525 !! end
13526
13527 !! test
13528 Image with caption
13529 !! wikitext
13530 [[File:Foobar.jpg|right|Caption text]]
13531 !! html/php
13532 <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>
13533
13534 !! html/parsoid
13535 <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>
13536 !! end
13537
13538 !! test
13539 Image with caption, T55312 #1
13540 !! wikitext
13541 [[File:Foobar.jpg|right|Caption page stuff]]
13542 !! html/php
13543 <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>
13544
13545 !! html/parsoid
13546 <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>
13547 !! end
13548
13549 !! test
13550 Image with caption, T55312 #2
13551 !! wikitext
13552 [[File:Foobar.jpg|right|Caption page=]]
13553 !! html/php
13554 <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>
13555
13556 !! html/parsoid
13557 <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>
13558 !! end
13559
13560 !! test
13561 Image with caption, T55312 #3
13562 !! wikitext
13563 [[File:Foobar.jpg|right|Caption page=stuff]]
13564 !! html/php
13565 <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>
13566
13567 !! html/parsoid
13568 <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>
13569 !! end
13570
13571 !! test
13572 Allow empty links in image captions (T62753)
13573 !! options
13574 thumbsize=220
13575 !! wikitext
13576 [[File:Foobar.jpg|thumb|Caption [[Link1]]
13577 [[]]
13578 [[Link2]]
13579 ]]
13580 !! html/php
13581 <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>
13582
13583 !! html/parsoid
13584 <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>
13585 [[]]
13586 <a rel="mw:WikiLink" href="./Link2" title="Link2" data-parsoid='{"stx":"simple","a":{"href":"./Link2"},"sa":{"href":"Link2"}}'>Link2</a>
13587 </figcaption></figure>
13588 !! end
13589
13590 !! test
13591 Titles in unlinked images (T23454)
13592 !! wikitext
13593 [[File:Foobar.jpg|link=|stuff]]
13594 !! html/php
13595 <p><img alt="stuff" src="http://example.com/images/3/3a/Foobar.jpg" title="stuff" width="1941" height="220" />
13596 </p>
13597 !! end
13598
13599 !! test
13600 Link with empty target
13601 !! wikitext
13602 [[]]
13603 !! html
13604 <p>[[]]
13605 </p>
13606 !! end
13607
13608 !! test
13609 Image with link trail
13610 !! wikitext
13611 Linktrails should not work for images: [[File:Foobar.jpg]]s
13612 !! html/php
13613 <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
13614 </p>
13615 !! html/parsoid
13616 <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>
13617 !! end
13618
13619 !! test
13620 Image with empty attribute
13621 !! options
13622 parsoid=wt2html,wt2wt,html2html
13623 !! wikitext
13624 [[File:Foobar.jpg|right||Caption text]]
13625 !! html/php
13626 <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>
13627
13628 !! html/parsoid
13629 <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>
13630 !! end
13631
13632 !! test
13633 1. Block image with individual attributes from templates
13634 !! wikitext
13635 [[File:Foobar.jpg|thumb|{{echo|137px}}|This is a caption]]
13636 !! html/php
13637 <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>
13638
13639 !! html/parsoid
13640 <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>
13641 !! end
13642
13643 !! test
13644 2. Block Image with individual attributes from templates
13645 !! wikitext
13646 [[File:Foobar.jpg|{{echo|thumb}}|{{echo|137px}}|This is a caption]]
13647 !! html/php
13648 <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>
13649
13650 !! html/parsoid
13651 <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>
13652 !! end
13653
13654 !! test
13655 3. Inline image with individual attributes from templates
13656 !! wikitext
13657 [[File:Foobar.jpg|{{echo|50px}}]]
13658 !! html/php
13659 <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>
13660 </p>
13661 !! html/parsoid
13662 <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>
13663 !! end
13664
13665 ## Parsoid does not provide editing support for images where templates produce multiple image attributes.
13666 ## To signal this, we add a 'mw:Placeholder' type to such images. This could change in the future.
13667 !! test
13668 Image with multiple attributes from the same template
13669 !! wikitext
13670 [[File:Foobar.jpg|{{image_attribs}}]]
13671 !! html/php
13672 <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>
13673
13674 !! html/parsoid
13675 <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>
13676 !! end
13677
13678 !! test
13679 Image with link tails
13680 !! options
13681 thumbsize=220
13682 !! wikitext
13683 123[[File:Foobar.jpg]]456
13684 123[[File:Foobar.jpg|right]]456
13685 123[[File:Foobar.jpg|thumb]]456
13686 !! html/php
13687 <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
13688 </p>
13689 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
13690 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
13691
13692 !! html/php+tidy
13693 <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>
13694 <p>123</p>
13695 <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>
13696 <p>456 123</p>
13697 <div class="thumb tright">
13698 <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>
13699 <div class="thumbcaption">
13700 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
13701 </div>
13702 </div>
13703 </div>
13704 <p>456</p>
13705 !! html/parsoid
13706 <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>
13707 <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>
13708 <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>
13709 !! end
13710
13711 !! test
13712 Image with multiple captions -- only last one is accepted
13713 !! wikitext
13714 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
13715 !! html/php
13716 <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>
13717
13718 !! html/parsoid
13719 <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>
13720 !! end
13721
13722 !! test
13723 Image with multiple widths -- use last
13724 !! wikitext
13725 [[File:Foobar.jpg|200px|300px|caption]]
13726 !! html/php
13727 <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>
13728 </p>
13729 !! html/parsoid
13730 <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>
13731 !! end
13732
13733 !! test
13734 Image with multiple alignments -- use first (T50664)
13735 !! options
13736 thumbsize=220
13737 !! wikitext
13738 [[File:Foobar.jpg|thumb|left|right|center|caption]]
13739
13740 [[File:Foobar.jpg|middle|text-top|caption]]
13741 !! html/php
13742 <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>
13743 <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>
13744 </p>
13745 !! html/parsoid
13746 <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>
13747 <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>
13748 !! end
13749
13750 !! test
13751 Image with width attribute at different positions
13752 !! wikitext
13753 [[File:Foobar.jpg|200px|right|Caption]]
13754 [[File:Foobar.jpg|right|200px|Caption]]
13755 [[File:Foobar.jpg|right|Caption|200px]]
13756 !! html/php
13757 <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>
13758 <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>
13759 <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>
13760
13761 !! html/parsoid
13762 <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>
13763 <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>
13764 <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>
13765 !! end
13766
13767 # a sad bit of backward-compatibility
13768 !! test
13769 Image with size specified with pxpx (T15500, T53628)
13770 !! options
13771 parsoid=wt2html,wt2wt,html2html
13772 !! wikitext
13773 [[File:Foobar.jpg|20pxpx]]
13774 [[File:Foobar.jpg|200x20pxpx]]
13775 !! html/php
13776 <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>
13777 <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>
13778 </p>
13779 !! html/parsoid
13780 <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>
13781 !! end
13782
13783 !! test
13784 Image with link parameter, wiki target
13785 !! wikitext
13786 [[File:Foobar.jpg|link=Main Page]]
13787 !! html/php
13788 <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>
13789 </p>
13790 !! html/parsoid
13791 <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>
13792 !! end
13793
13794 # parsoid T51293 (part 1)
13795 !! test
13796 Image with link parameter, URL target
13797 !! wikitext
13798 [[File:Foobar.jpg|link=http://example.com/]]
13799 !! html/php
13800 <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>
13801 </p>
13802 !! html/parsoid
13803 <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>
13804 !! end
13805
13806 # parsoid T51293 (part 2)
13807 !! test
13808 Image with link parameter, protocol-less URL target
13809 !! wikitext
13810 [[File:Foobar.jpg|link=//example.com/]]
13811 !! html/php
13812 <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>
13813 </p>
13814 !! html/parsoid
13815 <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>
13816 !! end
13817
13818 !! test
13819 Escaping non-block captions (T107435)
13820 !! options
13821 parsoid={
13822 "modes": ["wt2wt"],
13823 "changes": [
13824 ["[typeof~='mw:Image']", "attr", "data-mw", "{\"caption\": \"|\"}"]
13825 ]
13826 }
13827 !! wikitext
13828 [[Image:Foobar.jpg|caption]]
13829 !! wikitext/edited
13830 [[Image:Foobar.jpg|<nowiki>|</nowiki>]]
13831 !! end
13832
13833 # wgExternalLinkTarget not supported by Parsoid
13834 !! test
13835 Image with link parameter, wgExternalLinkTarget
13836 !! wikitext
13837 [[Image:foobar.jpg|link=http://example.com/]]
13838 !! config
13839 wgExternalLinkTarget='foobar'
13840 !! html/php
13841 <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>
13842 </p>
13843 !! end
13844
13845 !! test
13846 Image with link parameter, wgNoFollowLinks set to false
13847 !! wikitext
13848 [[Image:foobar.jpg|link=http://example.com/]]
13849 !! config
13850 wgNoFollowLinks=false
13851 !! html
13852 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
13853 </p>
13854 !! end
13855
13856 !! test
13857 Image with link parameter, wgNoFollowDomainExceptions
13858 !! wikitext
13859 [[Image:foobar.jpg|link=http://example.com/]]
13860 !! config
13861 wgNoFollowDomainExceptions='example.com'
13862 !! html
13863 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
13864 </p>
13865 !! end
13866
13867 # wgExternalLinkTarget not supported by Parsoid
13868 !! test
13869 Image with link parameter, wgExternalLinkTarget, unnamed parameter
13870 !! wikitext
13871 [[Image:foobar.jpg|link=http://example.com/|Title]]
13872 !! config
13873 wgExternalLinkTarget='foobar'
13874 !! html/php
13875 <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>
13876 </p>
13877 !! end
13878
13879 !! test
13880 Image with empty link parameter
13881 !! wikitext
13882 [[File:Foobar.jpg|link=]]
13883 !! html/php
13884 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
13885 </p>
13886 !! html/parsoid
13887 <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>
13888 !! end
13889
13890 !! test
13891 Image with link parameter (wiki target) and unnamed parameter
13892 !! wikitext
13893 [[File:Foobar.jpg|link=Main_Page|Title]]
13894 !! html/php
13895 <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>
13896 </p>
13897 !! html/parsoid
13898 <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>
13899 !! end
13900
13901 !! test
13902 Image with link parameter (URL target) and unnamed parameter
13903 !! wikitext
13904 [[File:Foobar.jpg|link=http://example.com/|Title]]
13905 !! html/php
13906 <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>
13907 </p>
13908 !! html/parsoid
13909 <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>
13910 !! end
13911
13912 !! test
13913 Thumbnail image with link parameter
13914 !! options
13915 thumbsize=220
13916 parsoid=wt2html,wt2wt,html2html
13917 !! wikitext
13918 [[File:Foobar.jpg|thumb|link=http://example.com/|Title]]
13919 !! html/php
13920 <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>
13921
13922 !! html/parsoid
13923 <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>
13924 !! end
13925
13926 !! test
13927 Manually-specified thumbnail image
13928 !! options
13929 thumbsize=220
13930 !! wikitext
13931 [[File:Foobar.jpg|thumbnail=Thumb.png|Title]]
13932 !! html/php
13933 <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>
13934
13935 !! html/parsoid
13936 <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>
13937 !! end
13938
13939 !! test
13940 Manually-specified thumbnail image with explicit link to wiki page
13941 !! options
13942 thumbsize=220
13943 parsoid=wt2html,wt2wt,html2html
13944 !! wikitext
13945 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|Title]]
13946 !! html/php
13947 <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>
13948
13949 !! html/parsoid
13950 <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>
13951 !! end
13952
13953 !! test
13954 Manually-specified thumbnail image with explicit link to url
13955 !! options
13956 thumbsize=220
13957 parsoid=wt2html,wt2wt,html2html
13958 !! wikitext
13959 [[File:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
13960 !! html/php
13961 <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>
13962
13963 !! html/parsoid
13964 <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>
13965 !! end
13966
13967 !! test
13968 Manually-specified thumbnail image with explicit no link
13969 !! options
13970 thumbsize=220
13971 parsoid=wt2html,wt2wt,html2html
13972 !! wikitext
13973 [[File:Foobar.jpg|thumb=Thumb.png|link=|Title]]
13974 !! html/php
13975 <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>
13976
13977 !! html/parsoid
13978 <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>
13979 !! end
13980
13981 !! test
13982 Manually-specified thumbnail image with explicit link and alt text
13983 !! options
13984 thumbsize=220
13985 parsoid=wt2html,wt2wt,html2html
13986 !! wikitext
13987 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|alt=alttext|Title]]
13988 !! html/php
13989 <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>
13990
13991 !! html/parsoid
13992 <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>
13993 !! end
13994
13995 !! test
13996 Image with frame and link
13997 !! options
13998 parsoid=wt2html,wt2wt,html2html
13999 !! wikitext
14000 [[File:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
14001 !! html/php
14002 <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>
14003
14004 !! html/parsoid
14005 <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>
14006 !! end
14007
14008 !! test
14009 Image with frame and link and explicit alt
14010 !! options
14011 parsoid=wt2html,wt2wt,html2html
14012 !! wikitext
14013 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
14014 !! html/php
14015 <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>
14016
14017 !! html/parsoid
14018 <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>
14019 !! end
14020
14021 !! test
14022 Image with wiki markup in implicit alt
14023 !! wikitext
14024 [[Image:Foobar.jpg|testing '''bold''' in alt]]
14025
14026 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
14027 !! html/php
14028 <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>
14029 </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>
14030 </p>
14031 !! html/parsoid
14032 <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>
14033
14034 <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>
14035 !! end
14036
14037 !! test
14038 Alt image option should handle most kinds of wikitext without barfing
14039 !! wikitext
14040 [[Image:Foobar.jpg|thumb|This is the image caption|alt=This is a [[link]] and a {{echo|''bold template''}}.]]
14041 !! html/php
14042 <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>
14043
14044 !! html/parsoid
14045 <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>
14046 !! end
14047
14048 ###################
14049 # Conflicting image format options.
14050 # First option specified should 'win'.
14051 # All three cases in each test should be identical.
14052
14053 !! test
14054 Image with 'frameless' first.
14055 !! options
14056 parsoid=wt2html,wt2wt,html2html
14057 !! wikitext
14058 [[File:Foobar.jpg|frameless|caption]]
14059
14060 [[File:Foobar.jpg|frameless|frame|caption]]
14061
14062 [[File:Foobar.jpg|frameless|thumb|caption]]
14063 !! html/php
14064 <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>
14065 </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>
14066 </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>
14067 </p>
14068 !! html/parsoid
14069 <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>
14070 <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>
14071 <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>
14072 !! end
14073
14074 !! test
14075 Image with 'frame' first.
14076 !! options
14077 parsoid=wt2html,wt2wt,html2html
14078 !! wikitext
14079 [[File:Foobar.jpg|frame|caption]]
14080 [[File:Foobar.jpg|frame|frameless|caption]]
14081 [[File:Foobar.jpg|frame|thumb|caption]]
14082 !! html/php
14083 <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>
14084 <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>
14085 <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>
14086
14087 !! html/parsoid
14088 <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>
14089 <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>
14090 <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>
14091 !! end
14092
14093 !! test
14094 Image with 'thumb' first.
14095 !! options
14096 parsoid=wt2html,wt2wt,html2html
14097 !! wikitext
14098 [[File:Foobar.jpg|thumb|caption]]
14099 [[File:Foobar.jpg|thumb|frameless|caption]]
14100 [[File:Foobar.jpg|thumb|frame|caption]]
14101 !! html/php
14102 <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>
14103 <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>
14104 <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>
14105
14106 !! html/parsoid
14107 <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>
14108 <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>
14109 <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>
14110 !! end
14111
14112 ###################
14113 # Image sizing.
14114 # See https://www.mediawiki.org/wiki/Help:Images#Size_and_frame
14115 # and https://phabricator.wikimedia.org/T64258
14116 # Foobar has actual size of 1941x220
14117 # 1. Thumbs & frameless always reduce, can't be enlarged unless it's
14118 # a scalable format.
14119 # 2. Framed images always ignore size options; always render at default size.
14120 # 3. "Unspecified format" and border are the only types which can be
14121 # enlarged.
14122
14123 !! test
14124 Image: "unspecified format" and border enlarge
14125 !! options
14126 parsoid=wt2html,wt2wt,html2html
14127 !! wikitext
14128 [[File:Foobar.jpg|2000px]]
14129
14130 [[File:Foobar.jpg|border|2000px]]
14131 !! html/php
14132 <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>
14133 </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>
14134 </p>
14135 !! html/parsoid
14136 <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>
14137 <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>
14138 !! end
14139
14140 !! test
14141 Image: "unspecified format" and border reduce
14142 !! options
14143 parsoid=wt2html,wt2wt,html2html
14144 !! wikitext
14145 [[File:Foobar.jpg|1000px]]
14146
14147 [[File:Foobar.jpg|border|1000px]]
14148 !! html/php
14149 <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>
14150 </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>
14151 </p>
14152 !! html/parsoid
14153 <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>
14154 <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>
14155 !! end
14156
14157 !! test
14158 Image: thumbs reduce
14159 !! options
14160 parsoid=wt2html,wt2wt,html2html
14161 !! wikitext
14162 [[File:Foobar.jpg|thumb|50px]]
14163 !! html/php
14164 <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>
14165
14166 !! html/parsoid
14167 <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>
14168 !! end
14169
14170 !! test
14171 Image: bitmap thumbs can't be enlarged past original size, but vector can.
14172 !! options
14173 parsoid=wt2html,wt2wt,html2html
14174 !! wikitext
14175 [[File:Foobar.jpg|thumb|2000px]]
14176
14177 [[File:Foobar.svg|thumb|2000px]]
14178 !! html/php
14179 <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>
14180 <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>
14181
14182 !! html/parsoid
14183 <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>
14184 <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>
14185 !! end
14186
14187 !! test
14188 Image: frameless can reduce in size
14189 !! options
14190 parsoid=wt2html,wt2wt,html2html
14191 !! wikitext
14192 [[File:Foobar.jpg|frameless|50px]]
14193 !! html/php
14194 <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>
14195 </p>
14196 !! html/parsoid
14197 <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>
14198 !! end
14199
14200 !! test
14201 Image: bitmap frameless can't be enlarged past original size, but vector can
14202 !! options
14203 parsoid=wt2html,wt2wt,html2html
14204 !! wikitext
14205 [[File:Foobar.jpg|frameless|2000px]]
14206
14207 [[File:Foobar.svg|frameless|2000px]]
14208 !! html/php
14209 <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>
14210 </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>
14211 </p>
14212 !! html/parsoid
14213 <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>
14214 <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>
14215 !! end
14216
14217 !! test
14218 Image: framed images are always unscaled.
14219 !! options
14220 parsoid=wt2html,wt2wt,html2html
14221 !! wikitext
14222 [[File:Foobar.jpg|frame]]
14223
14224 [[File:Foobar.jpg|frame|50px]]
14225
14226 [[File:Foobar.jpg|frame|50x50px]]
14227
14228 [[File:Foobar.jpg|frame|2000px]]
14229 !! html/php
14230 <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>
14231 <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>
14232 <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>
14233 <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>
14234
14235 !! html/parsoid
14236 <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>
14237 <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>
14238 <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>
14239 <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>
14240 !! end
14241
14242 ###################
14243
14244 !! test
14245 Link to image page- image page normally doesn't exists, hence edit link
14246 Add test with existing image page
14247 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
14248 !! wikitext
14249 [[:Image:test]]
14250 !! html
14251 <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>
14252 </p>
14253 !! end
14254
14255 !! test
14256 T20784 Link to non-existent image page with caption should use caption as link text
14257 !! wikitext
14258 [[:Image:test|caption]]
14259 !! html
14260 <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>
14261 </p>
14262 !! end
14263
14264 !! test
14265 Frameless image caption with a free URL
14266 !! wikitext
14267 [[File:Foobar.jpg|http://example.com]]
14268 !! html/php
14269 <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>
14270 </p>
14271 !! html/parsoid
14272 <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>
14273 !! end
14274
14275 !! test
14276 Thumbnail image caption with a free URL
14277 !! options
14278 thumbsize=220
14279 !! wikitext
14280 [[File:Foobar.jpg|thumb|http://example.com]]
14281 !! html/php
14282 <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>
14283
14284 !! html/parsoid
14285 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></figcaption></figure>
14286 !! end
14287
14288 !! test
14289 Thumbnail image caption with a free URL and explicit alt
14290 !! options
14291 thumbsize=220
14292 parsoid=wt2html,wt2wt,html2html
14293 !! wikitext
14294 [[File:Foobar.jpg|thumb|http://example.com|alt=Alteration]]
14295 !! html/php
14296 <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>
14297
14298 !! html/parsoid
14299 <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>
14300 !! end
14301
14302 !! test
14303 SVG thumbnails with no language set
14304 !! options
14305 !! wikitext
14306 [[File:Foobar.svg|thumb|caption]]
14307 !! html/php
14308 <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>
14309
14310 !! html/parsoid
14311 <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>
14312 !! end
14313
14314 !! test
14315 SVG thumbnails with language de
14316 !! options
14317 parsoid=wt2html,wt2wt,html2html
14318 !! wikitext
14319 [[File:Foobar.svg|thumb|caption|lang=de]]
14320 !! html/php
14321 <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>
14322
14323 !! html/parsoid
14324 <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>
14325 !! end
14326
14327 !! test
14328 SVG thumbnails with invalid language code
14329 !! options
14330 parsoid=wt2html,wt2wt,html2html
14331 !! wikitext
14332 [[File:Foobar.svg|thumb|caption|lang=invalid.language.code]]
14333 !! html/php
14334 <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>
14335
14336 !! html/parsoid
14337 <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>
14338 !! end
14339
14340 !! test
14341 T3887: A ISBN with a thumbnail
14342 !! wikitext
14343 [[File:Foobar.jpg|thumb|ISBN 1235467890]]
14344 !! html/php
14345 <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>
14346
14347 !! html/parsoid
14348 <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>
14349 !! end
14350
14351 !! test
14352 T3887: A RFC with a thumbnail
14353 !! wikitext
14354 [[File:Foobar.jpg|thumb|This is RFC 12354]]
14355 !! html/php
14356 <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>
14357
14358 !! html/parsoid
14359 <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>
14360 !! end
14361
14362 !! test
14363 T3887: A mailto link with a thumbnail
14364 !! wikitext
14365 [[File:Foobar.jpg|thumb|Please mailto:nobody@example.com]]
14366 !! html/php
14367 <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>
14368
14369 !! html/parsoid
14370 <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>
14371 !! end
14372
14373 # Pending resolution to T2368
14374 !! test
14375 T2648: Frameless image caption with a link
14376 !! wikitext
14377 [[File:Foobar.jpg|text with a [[link]] in it]]
14378 !! html/php
14379 <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>
14380 </p>
14381 !! html/parsoid
14382 <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>
14383 !! end
14384
14385 !! test
14386 T2648: Frameless image caption with a link (suffix)
14387 !! wikitext
14388 [[File:Foobar.jpg|text with a [[link]]foo in it]]
14389 !! html/php
14390 <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>
14391 </p>
14392 !! html/parsoid
14393 <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>
14394 !! end
14395
14396 !! test
14397 T2648: Frameless image caption with an interwiki link
14398 !! wikitext
14399 [[File:Foobar.jpg|text with a [[MeatBall:Link]] in it]]
14400 !! html/php
14401 <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>
14402 </p>
14403 !! html/parsoid
14404 <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>
14405 !! end
14406
14407 !! test
14408 T2648: Frameless image caption with a piped interwiki link
14409 !! wikitext
14410 [[File:Foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
14411 !! html/php
14412 <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>
14413 </p>
14414 !! html/parsoid
14415 <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>
14416 !! end
14417
14418 !! test
14419 T107474: Frameless image caption with <nowiki>
14420 !! wikitext
14421 [[File:Foobar.jpg|<nowiki>text with a [[MeatBall:Link|link]] in it</nowiki>]]
14422 !! html/parsoid
14423 <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>
14424 !! end
14425
14426 !! test
14427 Escape HTML special chars in image alt text
14428 !! wikitext
14429 [[File:Foobar.jpg|& < > "]]
14430 !! html/php
14431 <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>
14432 </p>
14433 !! html/parsoid
14434 <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>
14435 !! end
14436
14437 !! test
14438 Escape HTML special chars in image alt text with LanguageConverter
14439 !! options
14440 language=zh
14441 !! wikitext
14442 [[File:Foobar.jpg|& < > "]]
14443 !! html/php
14444 <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>
14445 </p>
14446 !! html/parsoid
14447 <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>
14448 !! end
14449
14450 !! test
14451 Entities in file name and attributes
14452 !! wikitext
14453 [[File:7%25 solution.gif|manualthumb=7%25 solution.gif|link=7%25 solution|[[7%25 solution]]]]
14454 !! html/php
14455 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=7%25_solution.gif" class="new" title="File:7% solution.gif">7% solution</a>
14456 </p>
14457 !! html/parsoid
14458 <p><span class="mw-default-size" typeof="mw:Error mw:Image" data-parsoid='{"optList":[{"ck":"bogus","ak":"manualthumb=7%25 solution.gif"},{"ck":"link","ak":"link=7%25 solution"},{"ck":"caption","ak":"[[7%25 solution]]"}]}' data-mw='{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}],"caption":"&lt;a rel=\"mw:WikiLink\" href=\"./7%25_solution\" title=\"7% solution\" data-parsoid=&#39;{\"stx\":\"simple\",\"a\":{\"href\":\"./7%25_solution\"},\"sa\":{\"href\":\"7%25 solution\"},\"dsr\":[74,91,2,2]}&#39;>7% solution&lt;/a>"}'><a href="./7%25_solution" data-parsoid='{"a":{"href":"./7%25_solution"},"sa":{"href":"link=7%25 solution"}}'><img resource="./File:7%25_solution.gif" src="./Special:FilePath/7%25_solution.gif" height="220" width="220" data-parsoid='{"a":{"resource":"./File:7%25_solution.gif","height":"220","width":"220"},"sa":{"resource":"File:7%25 solution.gif"}}'/></a></span></p>
14459 !! end
14460
14461 !! test
14462 T2499: Alt text should have &#1234;, not &amp;1234;
14463 !! wikitext
14464 [[File:Foobar.jpg|&#9792;]]
14465 !! html/php
14466 <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>
14467 </p>
14468 !! html/parsoid
14469 <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>
14470 !! end
14471
14472 !! test
14473 Broken image caption with link
14474 !! options
14475 parsoid=wt2html,wt2wt,html2html
14476 !! wikitext
14477 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
14478 !! html/php
14479 <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.
14480 </p>
14481 !! html/parsoid
14482 <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>
14483 !! end
14484
14485 !! test
14486 Image caption containing another image
14487 !! wikitext
14488 [[File:Foobar.jpg|thumb|This is a caption with another [[File:Thumb.png|image]] inside it!]]
14489 !! html/php
14490 <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>
14491
14492 !! html/parsoid
14493 <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>
14494 !! end
14495
14496 !! test
14497 Image: caption containing a newline
14498 !! wikitext
14499 [[File:Foobar.jpg|This
14500 *is some text]]
14501 !! html/php
14502 <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>
14503 </p>
14504 !! html/parsoid
14505 <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>
14506 !!end
14507
14508 !!test
14509 Image: caption containing leading space
14510 (The leading space should not trigger nowiki escaping in wt2wt mode)
14511 !! wikitext
14512 [[File:Foobar.jpg|thumb| bar]]
14513 !! html/php
14514 <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>
14515
14516 !! html/parsoid
14517 <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>
14518 !!end
14519
14520 !! test
14521 Image: caption containing a table
14522 !! options
14523 parsoid=wt2html,wt2wt,html2html
14524 !! wikitext
14525 [[Image:Foobar.jpg|thumb|200px|This is an example image thumbnail caption with a table
14526 {|
14527 ! Foo !! Bar
14528 |-
14529 | Foo1 || Bar1
14530 |}
14531 and some more text.]]
14532 !! html/php
14533 <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>
14534
14535 !! html/parsoid
14536 <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
14537 <table>
14538 <tbody>
14539 <tr><th>Foo </th><th>Bar</th></tr>
14540 <tr>
14541 <td>Foo1 </td>
14542 <td>Bar1</td></tr></tbody></table>and some more text.</figcaption></figure>
14543 !! end
14544
14545 !! test
14546 T5090: External links other than http: in image captions
14547 !! wikitext
14548 [[File:Foobar.jpg|thumb|200x200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
14549 !! html/php
14550 <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>
14551
14552 !! html/parsoid
14553 <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>
14554 !! end
14555
14556 !! test
14557 Custom class
14558 !! options
14559 parsoid=wt2html,wt2wt,html2html
14560 !! wikitext
14561 [[Image:foobar.jpg|a|class=b]]
14562 !! html/php
14563 <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>
14564 </p>
14565 !! html/parsoid
14566 <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>
14567 !! end
14568
14569 !! test
14570 Localized image handling (1).
14571 !! options
14572 parsoid=wt2html,wt2wt,html2html
14573 language=es
14574 !! wikitext
14575 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
14576 !! html/php
14577 <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>
14578
14579 !! html/parsoid
14580 <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>
14581 !! end
14582
14583 !! test
14584 Localized image handling (2).
14585 !! options
14586 thumbsize=220
14587 parsoid=wt2html,wt2wt,html2html
14588 language=es
14589 !! wikitext
14590 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
14591 !! html/php
14592 <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>
14593
14594 !! html/parsoid
14595 <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>
14596 !! end
14597
14598 !! test
14599 Localized image handling (3).
14600 !! options
14601 language=fa
14602 parsoid=html2wt
14603 !! html/parsoid
14604 <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>
14605 !! wikitext
14606 [[File:Foobar.jpg|بندانگشتی]]
14607 !! end
14608
14609 !! test
14610 "border", "frameless" and "class" attributes on an image.
14611 !! options
14612 thumbsize=220
14613 parsoid=wt2html,wt2wt,html2html
14614 !! wikitext
14615 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
14616 !! html/php
14617 <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>
14618 </p>
14619 !! html/parsoid
14620 <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>
14621 !! end
14622
14623 # Note that 'right' is the default alignment, despite the misspelled 'righ' below
14624 !! test
14625 Invalid image attributes (T64500)
14626 !! options
14627 thumbsize=220
14628 parsoid=wt2html,wt2wt,html2html
14629 !! wikitext
14630 [[File:Foobar.jpg|thumb|float|left|caption]]
14631
14632 [[File:Foobar.jpg|thumb|righ|caption]]
14633
14634 [[File:Foobar.jpg|bogus1|thumb|bogus2|left|bogus3|caption]]
14635 !! html/php
14636 <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>
14637 <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>
14638 <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>
14639
14640 !! html/parsoid
14641 <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>
14642 <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>
14643 <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>
14644 !! end
14645
14646 !! article
14647 File:Barfoo.jpg
14648 !! text
14649 #REDIRECT [[File:Barfoo.jpg]]
14650 !! endarticle
14651
14652 # FIXME: Parsoid should run this test -- but we'd need to teach the
14653 # mockAPI about the redirected Barfoo.jpg image.
14654 !! test
14655 Redirected image
14656 !! wikitext
14657 [[Image:Barfoo.jpg]]
14658 !! html/php
14659 <p><a href="/wiki/File:Barfoo.jpg" class="mw-redirect" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
14660 </p>
14661 !! end
14662
14663 !! test
14664 Missing image with uploads disabled
14665 !! options
14666 wgEnableUploads=0
14667 !! wikitext
14668 [[File:Foobaz.jpg]]
14669 !! html/php
14670 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
14671 </p>
14672 !! html/parsoid
14673 <p><span class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}]}'><a href="./File:Foobaz.jpg"><img resource="./File:Foobaz.jpg" src="./Special:FilePath/Foobaz.jpg" height="220" width="220"/></a></span></p>
14674 !! end
14675
14676 # Parsoid-specific testing for images
14677 # https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
14678 # Currently imperfect due to a flaw in the Parsoid testrunner
14679 # Work in progress
14680 # THESE TESTS SHOULD BE MOVED UP and merged with the php-specific
14681 # image tests.
14682
14683 !! test
14684 Parsoid-specific image handling - simple image with size and middle alignment
14685 !! wikitext
14686 [[File:Foobar.jpg|middle|50px]]
14687 !! html/parsoid
14688 <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>
14689 !! end
14690
14691 !! test
14692 Parsoid-specific image handling - simple image with size, middle alignment,
14693 non-standard namespace alias
14694 !! options
14695 parsoid=wt2wt,wt2html,html2html
14696 !! wikitext
14697 [[Image:Foobar.jpg|middle|50px]]
14698 !! html/parsoid
14699 <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>
14700 !! end
14701
14702 !! test
14703 Parsoid-specific image handling - simple image with size and middle alignment
14704 (existing content)
14705 !! wikitext
14706 [[File:Foobar.jpg|50px|middle]]
14707 !! html/parsoid
14708 <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>
14709 !! end
14710
14711 !! test
14712 Parsoid-specific image handling - simple image with size and middle alignment
14713 and non-standard namespace name
14714 !! options
14715 parsoid=wt2html,wt2wt,html2html
14716 !! wikitext
14717 [[Image:Foobar.jpg|50px|middle]]
14718 !! html/parsoid
14719 <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>
14720 !! end
14721
14722 !! test
14723 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
14724 !! wikitext
14725 [[File:Foobar.jpg|500x10px|baseline|caption]]
14726 !! html/parsoid
14727 <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>
14728 !! end
14729
14730 !! test
14731 Parsoid-specific image handling - simple image with border and size spec
14732 !! wikitext
14733 [[File:Foobar.jpg|50px|border|caption]]
14734 !! html/parsoid
14735 <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>
14736 !! end
14737
14738 !! test
14739 Parsoid-specific image handling - thumbnail with halign, valign, and caption
14740 !! wikitext
14741 [[File:Foobar.jpg|left|baseline|thumb|caption content]]
14742 !! html/parsoid
14743 <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>
14744 !! end
14745
14746 !! test
14747 Parsoid-specific image handling - thumbnail with halign, valign, and caption
14748 (existing content)
14749 !! wikitext
14750 [[File:Foobar.jpg|thumb|left|baseline|caption content]]
14751 !! html/parsoid
14752 <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>
14753 !! end
14754
14755 !! test
14756 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
14757 !! wikitext
14758 [[Image:Foobar.jpg|right|middle|thumb|50x50px|caption]]
14759 !! html/parsoid
14760 <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>
14761 !! end
14762
14763 !! test
14764 Parsoid-specific image handling - thumbnail with specific size, halign,
14765 valign, and caption (existing content)
14766 !! wikitext
14767 [[File:Foobar.jpg|thumb|50x50px|right|middle|caption]]
14768 !! html/parsoid
14769 <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>
14770 !! end
14771
14772 !! test
14773 Parsoid-specific image handling - framed image with specific size and caption
14774 (size is ignored)
14775 !! options
14776 parsoid=wt2html,wt2wt,html2html
14777 !! wikitext
14778 [[File:Foobar.jpg|frame|500x50px|caption]]
14779 !! html/parsoid
14780 <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>
14781 !! end
14782
14783 !! test
14784 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption
14785 (size is ignored)
14786 !! options
14787 parsoid=wt2html,wt2wt,html2html
14788 !! wikitext
14789 [[File:Foobar.jpg|left|baseline|frame|500x50px|caption]]
14790 !! html/parsoid
14791 <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>
14792 !! end
14793
14794 !! test
14795 Parsoid-specific image handling - frameless image with specific size, border, and caption
14796 !! wikitext
14797 [[File:Foobar.jpg|frameless|442x50px|border|caption]]
14798 !! html/parsoid
14799 <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>
14800 !! end
14801
14802 !! test
14803 Parsoid-specific image handling - simple image with a formatted caption
14804 !! wikitext
14805 [[File:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
14806 !! html/parsoid
14807 <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>
14808 !! end
14809
14810 !! test
14811 Parsoid-specific image handling - caption with a template in it
14812 !! wikitext
14813 [[File:Foobar.jpg|thumb|200x23px|This caption has a {{echo|transclusion}} in it.]]
14814 !! html/parsoid
14815 <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>
14816 !! end
14817
14818 !! test
14819 Parsoid-specific image handling - caption with unbalanced tags in it
14820 !! options
14821 parsoid=wt2html,wt2wt,html2html
14822 !! wikitext
14823 foo
14824 [[File:Foobar.jpg|thumb|200x200px|This caption has a <center>unbalanced tag in it.]]
14825 bar
14826 !! html/parsoid
14827 <p>foo</p>
14828 <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>
14829 <p>bar</p>
14830 !! end
14831
14832 !! test
14833 Parsoid-specific image handling - empty caption (1)
14834 !! options
14835 parsoid=wt2html,wt2wt
14836 !! wikitext
14837 [[File:Foobar.jpg|thumb|]]
14838 !! html/parsoid
14839 <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>
14840 !! end
14841
14842 # empty captions don't get serialized unless we're in the "round trip" case
14843 !! test
14844 Parsoid-specific image handling - empty caption (2)
14845 !! options
14846 parsoid=html2wt
14847 !! html/parsoid
14848 <figure class="mw-default-size" typeof="mw:Image/Thumb">
14849 <a href="./File:Foobar.jpg">
14850 <img resource="./File:Foobar.jpg"
14851 src="//example.com/images/3/3a/Foobar.jpg"
14852 data-file-width="1941" data-file-height="220" data-file-type="bitmap"
14853 height="25" width="220"/>
14854 </a>
14855 <figcaption></figcaption>
14856 </figure>
14857 !! wikitext
14858 [[File:Foobar.jpg|thumb]]
14859 !! end
14860
14861 !! test
14862 Parsoid-specific image handling - whitespace caption
14863 !! wikitext
14864 [[File:Foobar.jpg|thumb| ]]
14865 !! html/parsoid
14866 <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>
14867 !! end
14868
14869 !! test
14870 Parsoid-specific image handling - lang option
14871 !! wikitext
14872 foo
14873 [[File:Foobar.svg|lang=de|caption]]
14874 bar
14875 !! html/parsoid
14876 <p>foo
14877 <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>
14878 bar</p>
14879 !! end
14880
14881 ## Edge case bugs in Parsoid from T93580
14882 !! test
14883 T93580: 1. Templated <ref> inside block images
14884 !! wikitext
14885 [[File:Foobar.jpg|thumb|Caption with templated ref: {{echo|<ref>foo</ref>}}]]
14886
14887 <references />
14888 !! html/parsoid
14889 <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>
14890
14891 <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>
14892 !! end
14893
14894 !! test
14895 T93580: 2. <ref> inside inline images
14896 !! wikitext
14897 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: <ref>foo</ref>]]
14898
14899 <references />
14900 !! html/parsoid
14901 <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>
14902
14903 <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>
14904 !! end
14905
14906 !! test
14907 T93580: 3. Templated <ref> inside inline images
14908 !! wikitext
14909 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: {{echo|<ref>{{echo|foo}}</ref>}}]]
14910
14911 <references />
14912 !! html/parsoid
14913 <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>
14914
14915 <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>
14916 !! end
14917
14918 ###
14919 ### Subpages
14920 ###
14921 !! article
14922 Subpage test/subpage
14923 !! text
14924 foo
14925 !! endarticle
14926
14927 !! test
14928 Subpage link
14929 !! options
14930 subpage title=[[Subpage test]]
14931 !! wikitext
14932 [[/subpage]]
14933 !! html
14934 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
14935 </p>
14936 !! end
14937
14938 !! test
14939 Subpage noslash link
14940 !! options
14941 subpage title=[[Subpage test]]
14942 !! wikitext
14943 [[/subpage/]]
14944 !! html
14945 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
14946 </p>
14947 !! end
14948
14949 !! article
14950 Subpage test/1/2/subpage
14951 !! text
14952 blah
14953 !! endarticle
14954
14955 !! test
14956 Relative subpage noslash link
14957 !! options
14958 parsoid=wt2wt,wt2html,html2html
14959 subpage title=[[Subpage test/1/2/3/4]]
14960 !! wikitext
14961 [[../../subpage/]]
14962
14963 [[../../subpage]]
14964 !! html/php
14965 <p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a>
14966 </p><p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage test/1/2/subpage</a>
14967 </p>
14968 !! html/parsoid
14969 <p><a rel="mw:WikiLink" href="./Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a></p>
14970 <p><a rel="mw:WikiLink" href="./Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
14971 !! end
14972
14973 !! test
14974 Parsoid: dot-slash prefixed wikilinks
14975 !! wikitext
14976 [[./foo]]
14977
14978 [[././bar]]
14979
14980 [[././baz/]]
14981 !! html/php
14982 <p>[[./foo]]
14983 </p><p>[[././bar]]
14984 </p><p>[[././baz/]]
14985 </p>
14986 !! html/parsoid
14987 <p>[[./foo]]
14988 </p><p>[[././bar]]
14989 </p><p>[[././baz/]]
14990 </p>
14991 !! end
14992
14993 !! test
14994 Render invalid page names as plain text (T53090)
14995 !! wikitext
14996 [[./../foo|bar]]
14997 [[foo�|bar]]
14998 [[foo/.|bar]]
14999 [[foo/..|bar]]
15000 [[foo~~~bar]]
15001 [[foo>bar]]
15002 [[foo[bar]]
15003 [[.]]
15004 [[..]]
15005 [[foo././bar]]
15006 [[foo[http://example.com]xyz]]
15007
15008 [[{{echo|./../foo}}|bar]]
15009 [[{{echo|foo/.}}|bar]]
15010 [[{{echo|foo/..}}|bar]]
15011 [[{{echo|foo~~~~bar}}]]
15012 [[{{echo|foo>bar}}]]
15013 [[{{echo|foo././bar}}]]
15014 [[{{echo|foo{bar}}]]
15015 [[{{echo|foo}bar}}]]
15016 [[{{echo|foo[bar}}]]
15017 [[{{echo|foo]bar}}]]
15018 [[{{echo|foo<bar}}]]
15019 !!html/php
15020 <p>[[./../foo|bar]]
15021 [[foo�|bar]]
15022 [[foo/.|bar]]
15023 [[foo/..|bar]]
15024 [[foo~~~bar]]
15025 [[foo&gt;bar]]
15026 [[foo[bar]]
15027 [[.]]
15028 [[..]]
15029 [[foo././bar]]
15030 [[foo<a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>xyz]]
15031 </p><p>[[./../foo|bar]]
15032 [[foo/.|bar]]
15033 [[foo/..|bar]]
15034 [[foo~~~~bar]]
15035 [[foo&gt;bar]]
15036 [[foo././bar]]
15037 [[foo{bar]]
15038 [[foo}bar]]
15039 [[foo[bar]]
15040 [[foo]bar]]
15041 [[foo&lt;bar]]
15042 </p>
15043 !!html/parsoid
15044 <p>[[./../foo|bar]]
15045 [[foo�|bar]]
15046 [[foo/.|bar]]
15047 [[foo/..|bar]]
15048 [[foo~~~bar]]
15049 [[foo>bar]]
15050 [[foo[bar]]
15051 [[.]]
15052 [[..]]
15053 [[foo././bar]]
15054 [[foo<a rel="mw:ExtLink" href="http://example.com"></a>xyz]]</p>
15055
15056 <p>[[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"./../foo"}},"i":0}}]}'>./../foo</span>|bar]]
15057 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/."}},"i":0}}]}'>foo/.</span>|bar]]
15058 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/.."}},"i":0}}]}'>foo/..</span>|bar]]
15059 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo~~~~bar"}},"i":0}}]}'>foo~~~~bar</span>]]
15060 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo>bar"}},"i":0}}]}'>foo>bar</span>]]
15061 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo././bar"}},"i":0}}]}'>foo././bar</span>]]
15062 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo{bar"}},"i":0}}]}'>foo{bar</span>]]
15063 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo}bar"}},"i":0}}]}'>foo}bar</span>]]
15064 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo[bar"}},"i":0}}]}'>foo[bar</span>]]
15065 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo]bar"}},"i":0}}]}'>foo]bar</span>]]
15066 [[<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>
15067 !!end
15068
15069 !! test
15070 Disabled subpages
15071 !! wikitext
15072 [[/subpage]]
15073 !! html
15074 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
15075 </p>
15076 !! end
15077
15078 !! test
15079 T2561: {{/Subpage}}
15080 !! options
15081 subpage title=[[Page]]
15082 !! wikitext
15083 {{/Subpage}}
15084 !! html
15085 <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>
15086 </p>
15087 !! end
15088
15089 ###
15090 ### Categories
15091 ###
15092 !! article
15093 Category:MediaWiki User's Guide
15094 !! text
15095 blah
15096 !! endarticle
15097
15098 !! test
15099 Link to category
15100 !! wikitext
15101 [[:Category:MediaWiki User's Guide]]
15102 !! html
15103 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
15104 </p>
15105 !! end
15106
15107 !! test
15108 Simple category
15109 !! options
15110 cat
15111 !! wikitext
15112 [[Category:MediaWiki User's Guide]]
15113 !! html/php
15114 cat=MediaWiki_User's_Guide sort=
15115 !! html/parsoid
15116 <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"}}'/>
15117 !! end
15118
15119 !! test
15120 PAGESINCATEGORY invalid title fatal (r33546 fix)
15121 !! wikitext
15122 {{PAGESINCATEGORY:<bogus>}}
15123 !! html
15124 <p>0
15125 </p>
15126 !! end
15127
15128 !! test
15129 Category with different sort key
15130 !! options
15131 cat
15132 !! wikitext
15133 [[Category:MediaWiki User's Guide|Foo]]
15134 !! html/php
15135 cat=MediaWiki_User's_Guide sort=Foo
15136 !! html/parsoid
15137 <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"}}'/>
15138 !! end
15139
15140 !! test
15141 Category with identical sort key
15142 !! options
15143 cat
15144 !! wikitext
15145 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
15146 !! html/php
15147 cat=MediaWiki_User's_Guide sort=MediaWiki User's Guide
15148 !! html/parsoid
15149 <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"}}'/>
15150 !! end
15151
15152 !! test
15153 Category with empty sort key
15154 !! options
15155 cat
15156 pst
15157 !! wikitext
15158 [[Category:MediaWiki User's Guide|]]
15159 !! html/php
15160 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
15161 !! end
15162
15163 !! test
15164 Category with empty sort key and parentheses
15165 !! options
15166 cat
15167 pst
15168 !! wikitext
15169 [[Category:Foo (bar)|]]
15170 !! html/php
15171 [[Category:Foo (bar)|Foo]]
15172 !! end
15173
15174 !! test
15175 Category with link tail
15176 !! options
15177 cat
15178 pst
15179 !! wikitext
15180 123[[Category:Foo]]456
15181 !! html/php
15182 123[[Category:Foo]]456
15183 !! end
15184
15185 !! test
15186 Category with template
15187 !! options
15188 cat
15189 pst
15190 !! wikitext
15191 [[Category:{{echo|Foo}}]]
15192 !! html/php
15193 [[Category:{{echo|Foo}}]]
15194 !! end
15195
15196 !! test
15197 Category with template in sort key
15198 !! options
15199 cat
15200 pst
15201 !! wikitext
15202 [[Category:Foo|{{echo|Bar}}]]
15203 !! html/php
15204 [[Category:Foo|{{echo|Bar}}]]
15205 !! end
15206
15207 !! test
15208 Category with template in sort key and title
15209 !! options
15210 cat
15211 pst
15212 !! wikitext
15213 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
15214 !! html/php
15215 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
15216 !! end
15217
15218 ## We used to, but no longer wt2wt this test since the default serializer
15219 ## will normalize all categories to serialize on their own line.
15220 ## This wikitext usage is going to be fairly uncommon in production and
15221 ## selser will take care of preserving formatting in those scenarios.
15222 !! test
15223 Category / paragraph interactions
15224 !! options
15225 parsoid=wt2html
15226 !! wikitext
15227 Foo [[Category:Baz]] Bar
15228
15229 Foo [[Category:Baz]]
15230 Bar
15231
15232 Foo
15233 [[Category:Baz]]
15234 Bar
15235
15236 Foo
15237 [[Category:Baz]] Bar
15238
15239 Foo
15240 [[Category:Baz]]
15241 [[Category:Baz]]
15242 [[Category:Baz]]
15243 Bar
15244
15245 [[Category:Baz]]
15246 [[Category:Baz]]
15247 [[Category:Baz]]
15248
15249 [[Category:Baz]]
15250 {{echo|[[Category:Baz]]}}
15251 [[Category:Baz]]
15252 !! html/php
15253 <p>Foo Bar
15254 </p><p>Foo
15255 Bar
15256 </p><p>Foo
15257 Bar
15258 </p><p>Foo Bar
15259 </p><p>Foo
15260 Bar
15261 </p>
15262 !! html/parsoid
15263 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
15264 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
15265 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
15266 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
15267 <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>
15268 <link rel="mw:PageProp/Category" href="./Category:Baz"/>
15269 !! end
15270
15271 ## We used to, but no longer wt2wt this test since the default serializer
15272 ## will normalize all categories to serialize on their own line.
15273 ## This wikitext usage is going to be fairly uncommon in production and
15274 ## selser will take care of preserving formatting in those scenarios.
15275 ##
15276 ## The whitespace on the empty line is part of the test. Please do not delete
15277 !! test
15278 1. Categories and newlines: All preceding newlines should be suppressed (courtesy T2087)
15279 !! options
15280 parsoid=wt2html
15281 !! wikitext
15282 This
15283
15284 [[Category:Foo]] and this should be part of same paragraph (not an indent-pre)
15285
15286 {{echo|[[Category:Foo]] and so should this!}}
15287 !! html/php
15288 <p>This and this should be part of same paragraph (not an indent-pre) and so should this!
15289 </p>
15290 !! html/parsoid
15291 <p>This
15292
15293 <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of same paragraph (not an indent-pre)
15294
15295 <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>
15296 !! end
15297
15298 ## Parsoid will not try to wt2wt this while preserving newlines because
15299 ## it suppresses excess newlines within list items -- and we don't want to
15300 ## introduce a special case just for categories, which is, in reality somewhat
15301 ## odd behavior -- categories are unlikely to be used in list items like this
15302 ## in top-level pages and are only likely to show up in template-generated
15303 ## list items where this RT-ing is a non-issue.
15304 ##
15305 ## The whitespace on the empty line is part of the test. Please do not delete
15306 !! test
15307 2. Categories and newlines: All preceding newlines should be suppressed (courtesy T2087)
15308 !! options
15309 parsoid=wt2html
15310 !! wikitext
15311 * This
15312
15313 [[Category:Foo]] and this should be part of the same list item
15314 * So should this
15315
15316 {{echo|[[Category:Foo]] and this should be part of the same list item}}
15317 !! html
15318 <ul><li>This and this should be part of the same list item</li>
15319 <li>So should this and this should be part of the same list item</li></ul>
15320 !! html/parsoid
15321 <ul>
15322 <li>This <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of the same list item</li>
15323 <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>
15324 </ul>
15325 !! end
15326
15327 ## Newlines and categories that follow the last item of a list
15328 ## are treated differently because this (list followed by categories)
15329 ## is an extremely common pattern on wikis.
15330 !! test
15331 3. Categories and newlines: newline suppression for last list item should RT properly
15332 !! wikitext
15333 * a
15334 * b
15335
15336 [[Category:Foo]]
15337
15338 [[Category:Bar]]
15339 [[Category:Baz]]
15340 !! html/parsoid
15341 <ul><li> a</li>
15342 <li> b</li></ul>
15343
15344 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
15345
15346 <link rel="mw:PageProp/Category" href="./Category:Bar" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
15347 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
15348 !! end
15349
15350 !! test
15351 4. Categories and newlines: newline suppression for last list item should RT properly
15352 !! wikitext
15353 * a
15354 **** b
15355
15356 [[Category:Foo]]
15357 !! html/parsoid
15358 <ul><li> a
15359 <ul><li><ul><li><ul><li> b</li></ul></li></ul></li></ul></li></ul>
15360
15361 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
15362 !! end
15363
15364 ## only wt2html for this to make sure the algo only applies to the rightmost path
15365 !! test
15366 5. Categories and newlines: migrateTrailingCategories dom pass should only run on the rightmost path of nested lists
15367 !! options
15368 parsoid=wt2html
15369 !! wikitext
15370 * a
15371 ** b
15372 [[Category:Foo]]
15373 * c
15374 ** d
15375 [[Category:Foo]]
15376 !! html/parsoid
15377 <ul><li> a
15378 <ul><li> b
15379 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/></li></ul></li>
15380 <li> c
15381 <ul><li> d</li></ul></li></ul>
15382 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
15383 !! end
15384
15385 ## We used to, but no longer wt2wt this test since the default serializer
15386 ## will normalize all categories to serialize on their own line.
15387 ## This wikitext usage is going to be fairly uncommon in production and
15388 ## selser will take care of preserving formatting in those scenarios.
15389 !! test
15390 6. Categories and newlines: migrateTrailingCategories dom pass should not migrate categories not preceded by newlines
15391 !! options
15392 parsoid=wt2html
15393 !! wikitext
15394 * a [[Category:Foo]]
15395 !! html/parsoid
15396 <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>
15397 !! end
15398
15399 # This test also demonstrates because of newline+category tunneling
15400 # through the list hander, template wrapping doesn't expand to the
15401 # containing list when the list item swallows the category.
15402 !! test
15403 7. Categories and newlines: migrateTrailingCategories dom pass should leave template content alone
15404 !! wikitext
15405 * {{echo|a
15406 [[Category:Foo]]}}
15407 !! html/parsoid
15408 <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
15409 </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>
15410 !! end
15411
15412 !! test
15413 8. Categories and newlines: migrateTrailingCategories dom pass should not get tripped by intervening templates
15414 !! wikitext
15415 * a
15416
15417 {{echo|[[Category:Foo]]
15418 [[Category:Bar]]}}
15419 [[Category:Baz]]
15420 !! html/parsoid
15421 <ul><li> a</li></ul>
15422
15423 <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">
15424 </span><link rel="mw:PageProp/Category" href="./Category:Bar" about="#mwt1" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
15425 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
15426 !! end
15427
15428 !! test
15429 Category links with multiple namespaces
15430 !! wikitext
15431 [[Category:Project:Foo]]
15432 !! html/parsoid
15433 <link rel="mw:PageProp/Category" href="./Category:Project:Foo" />
15434 !! end
15435
15436 !! test
15437 Parsoid: Serialize link to category page with colon escape
15438 !! options
15439 parsoid
15440 !! wikitext
15441
15442 [[:Category:Foo]]
15443 [[:Category:Foo|Bar]]
15444 !! html
15445 <p>
15446 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Category:Foo</a>
15447 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Bar</a>
15448 </p>
15449 !! end
15450
15451 # We used to, but no longer wt2wt this test since the default serializer
15452 # will normalize all categories to serialize on their own line.
15453 # This wikitext usage is going to be fairly uncommon in production and
15454 # selser will take care of preventing whitespace insertion if this
15455 # occurs in an article.
15456 #
15457 # html2html disabled for the same reason (whitespace insertion between
15458 # x and y).
15459 #
15460 # html2wt disabled because it localizes the "Category" namespace.
15461 !! test
15462 Link prefix/suffixes aren't applied to category links
15463 !! options
15464 parsoid=wt2html
15465 language=is
15466 !! wikitext
15467 x[[Category:Foo]]y
15468 !! html/php
15469 <p>xy
15470 </p>
15471 !! html/parsoid
15472 <p>x<link rel="mw:PageProp/Category" href="./Flokkur:Foo" data-parsoid=""/>y</p>
15473 !! end
15474
15475 !! test
15476 Parsoid: Serialize link to file page with colon escape
15477 !! options
15478 parsoid
15479 !! wikitext
15480
15481 [[:File:Foo.png]]
15482 [[:File:Foo.png|Bar]]
15483 !! html
15484 <p>
15485 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">File:Foo.png</a>
15486 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">Bar</a>
15487 </p>
15488 !! end
15489
15490 !! test
15491 Parsoid: Serialize a genuine category link without colon escape
15492 !! options
15493 parsoid
15494 !! wikitext
15495 [[Category:Foo]]
15496 [[Category:Foo|Bar]]
15497 !! html
15498 <link rel="mw:PageProp/Category" href="./Category:Foo">
15499 <link rel="mw:PageProp/Category" href="./Category:Foo#Bar">
15500 !! end
15501
15502 !! test
15503 Normalize hrefs properly before testing for invalid link targets (T72894)
15504 !! options
15505 parsoid=html2wt
15506 !! html/parsoid
15507 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne"/>
15508 !! wikitext
15509 [[Category:Toxine bactérienne]]
15510 !! end
15511
15512 !! test
15513 Parsoid: Defaultsort
15514 !! wikitext
15515 {{DEFAULTSORT:Foo}}
15516 !! html/parsoid
15517 <meta property="mw:PageProp/categorydefaultsort" content="Foo"/>
15518 !! end
15519
15520 # NOTE: mw:ExpandedAttrs is not the best typeof here. mw:Transclusion is better.
15521 # But, this is a limitation of our representation and is documented in
15522 # TemplateHandler.js in processSpecialMagicWord
15523 !! test
15524 Parsoid: Defaultsort (template-generated)
15525 !! wikitext
15526 {{{{echo|DEFAULTSORT}}:Foo}}
15527 !! html/parsoid
15528 <meta property="mw:PageProp/categorydefaultsort" content="Foo" about="#mwt3" typeof="mw:ExpandedAttrs" data-parsoid='{"src":"{{{{echo|DEFAULTSORT}}:Foo}}","dsr":[0,26,null,null]}' data-mw='{"attribs":[[{"txt":"content"},{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[2,22,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"DEFAULTSORT\"}},\"i\":0}}]}&#39;>DEFAULTSORT&lt;/span>:Foo"}]]}'/>
15529 !! end
15530
15531 ###
15532 ### Inter-language links
15533 ###
15534 !! test
15535 Interlanguage links
15536 !! options
15537 ill
15538 !! wikitext
15539 [[es:Alimento]]
15540 [[fr:Nourriture]]
15541 [[zh:食品]]
15542 !! html/php
15543 es:Alimento fr:Nourriture zh:食品
15544 !! html/parsoid
15545 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Alimento"/>
15546 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/Nourriture"/>
15547 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/食品"/>
15548 !! end
15549
15550 !! test
15551 Duplicate interlanguage links (T26502)
15552 !! options
15553 ill
15554 !! wikitext
15555 [[es:1]]
15556 [[es:2]]
15557 [[fr:1]]
15558 [[fr:2]]
15559 !! html/php
15560 es:1 fr:1
15561 !! html/parsoid
15562 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/1"/>
15563 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/2"/>
15564 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/1"/>
15565 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/2"/>
15566 !! end
15567
15568 ###
15569 ### Sections
15570 ###
15571 !! test
15572 Basic section headings
15573 !! wikitext
15574 == Headline 1 ==
15575 Some text
15576
15577 ==Headline 2==
15578 More
15579 ===Smaller headline===
15580 Blah blah
15581 !! html
15582 <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>
15583 <p>Some text
15584 </p>
15585 <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>
15586 <p>More
15587 </p>
15588 <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>
15589 <p>Blah blah
15590 </p>
15591 !! end
15592
15593 !! test
15594 Section headings with TOC
15595 !! wikitext
15596 == Headline 1 ==
15597 === Subheadline 1 ===
15598 ===== Skipping a level =====
15599 ====== Skipping a level ======
15600
15601 == Headline 2 ==
15602 Some text
15603 ===Another headline===
15604 !! html
15605 <div id="toc" class="toc"><div id="toctitle" class="toctitle"><h2>Contents</h2></div>
15606 <ul>
15607 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
15608 <ul>
15609 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
15610 <ul>
15611 <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>
15612 <ul>
15613 <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>
15614 </ul>
15615 </li>
15616 </ul>
15617 </li>
15618 </ul>
15619 </li>
15620 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
15621 <ul>
15622 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
15623 </ul>
15624 </li>
15625 </ul>
15626 </div>
15627
15628 <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>
15629 <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>
15630 <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>
15631 <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>
15632 <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>
15633 <p>Some text
15634 </p>
15635 <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>
15636
15637 !! end
15638
15639 !! test
15640 TOC anchors don't collide
15641 !! wikitext
15642 __FORCETOC__
15643 == Headline 2 ==
15644 == Headline ==
15645 == Headline 2 ==
15646 == Headline ==
15647 !! html/php
15648 <div id="toc" class="toc"><div id="toctitle" class="toctitle"><h2>Contents</h2></div>
15649 <ul>
15650 <li class="toclevel-1 tocsection-1"><a href="#Headline_2"><span class="tocnumber">1</span> <span class="toctext">Headline 2</span></a></li>
15651 <li class="toclevel-1 tocsection-2"><a href="#Headline"><span class="tocnumber">2</span> <span class="toctext">Headline</span></a></li>
15652 <li class="toclevel-1 tocsection-3"><a href="#Headline_2_2"><span class="tocnumber">3</span> <span class="toctext">Headline 2</span></a></li>
15653 <li class="toclevel-1 tocsection-4"><a href="#Headline_3"><span class="tocnumber">4</span> <span class="toctext">Headline</span></a></li>
15654 </ul>
15655 </div>
15656
15657 <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>
15658 <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>
15659 <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>
15660 <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>
15661
15662 !! end
15663
15664 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
15665 !! test
15666 Handling of sections up to level 6 and beyond
15667 !! wikitext
15668 = Level 1 Heading=
15669 == Level 2 Heading==
15670 === Level 3 Heading===
15671 ==== Level 4 Heading====
15672 ===== Level 5 Heading=====
15673 ====== Level 6 Heading======
15674 ======= Level 7 Heading=======
15675 ======== Level 8 Heading========
15676 ========= Level 9 Heading=========
15677 ========== Level 10 Heading==========
15678 !! html
15679 <div id="toc" class="toc"><div id="toctitle" class="toctitle"><h2>Contents</h2></div>
15680 <ul>
15681 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
15682 <ul>
15683 <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>
15684 <ul>
15685 <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>
15686 <ul>
15687 <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>
15688 <ul>
15689 <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>
15690 <ul>
15691 <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>
15692 <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>
15693 <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>
15694 <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>
15695 <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>
15696 </ul>
15697 </li>
15698 </ul>
15699 </li>
15700 </ul>
15701 </li>
15702 </ul>
15703 </li>
15704 </ul>
15705 </li>
15706 </ul>
15707 </div>
15708
15709 <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>
15710 <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>
15711 <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>
15712 <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>
15713 <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>
15714 <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>
15715 <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>
15716 <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>
15717 <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>
15718 <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>
15719
15720 !! end
15721
15722 !! test
15723 TOC regression (T11764)
15724 !! wikitext
15725 == title 1 ==
15726 === title 1.1 ===
15727 ==== title 1.1.1 ====
15728 === title 1.2 ===
15729 == title 2 ==
15730 === title 2.1 ===
15731 !! html
15732 <div id="toc" class="toc"><div id="toctitle" class="toctitle"><h2>Contents</h2></div>
15733 <ul>
15734 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
15735 <ul>
15736 <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>
15737 <ul>
15738 <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>
15739 </ul>
15740 </li>
15741 <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>
15742 </ul>
15743 </li>
15744 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
15745 <ul>
15746 <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>
15747 </ul>
15748 </li>
15749 </ul>
15750 </div>
15751
15752 <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>
15753 <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>
15754 <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>
15755 <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>
15756 <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>
15757 <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>
15758
15759 !! end
15760
15761 !! test
15762 TOC for heading containing <span id="..."></span> (T96153)
15763 !! wikitext
15764 __FORCETOC__
15765 ==<span id="old-anchor"></span>New title==
15766 !! html/php
15767 <div id="toc" class="toc"><div id="toctitle" class="toctitle"><h2>Contents</h2></div>
15768 <ul>
15769 <li class="toclevel-1 tocsection-1"><a href="#New_title"><span class="tocnumber">1</span> <span class="toctext">New title</span></a></li>
15770 </ul>
15771 </div>
15772
15773 <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>
15774
15775 !! end
15776
15777 !! test
15778 TOC with wgMaxTocLevel=3 (T8204)
15779 !! options
15780 wgMaxTocLevel=3
15781 !! wikitext
15782 == title 1 ==
15783 === title 1.1 ===
15784 ==== title 1.1.1 ====
15785 === title 1.2 ===
15786 == title 2 ==
15787 === title 2.1 ===
15788 !! html
15789 <div id="toc" class="toc"><div id="toctitle" class="toctitle"><h2>Contents</h2></div>
15790 <ul>
15791 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
15792 <ul>
15793 <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>
15794 <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>
15795 </ul>
15796 </li>
15797 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
15798 <ul>
15799 <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>
15800 </ul>
15801 </li>
15802 </ul>
15803 </div>
15804
15805 <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>
15806 <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>
15807 <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>
15808 <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>
15809 <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>
15810 <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>
15811
15812 !! end
15813
15814 !! test
15815 TOC with wgMaxTocLevel=3 and two level four headings (T8204)
15816 !! options
15817 wgMaxTocLevel=3
15818 !! wikitext
15819 ==Section 1==
15820 ===Section 1.1===
15821 ====Section 1.1.1====
15822 ====Section 1.1.1.1====
15823 ==Section 2==
15824 !! html
15825 <div id="toc" class="toc"><div id="toctitle" class="toctitle"><h2>Contents</h2></div>
15826 <ul>
15827 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
15828 <ul>
15829 <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>
15830 </ul>
15831 </li>
15832 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
15833 </ul>
15834 </div>
15835
15836 <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>
15837 <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>
15838 <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>
15839 <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>
15840 <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>
15841
15842 !! end
15843
15844
15845 !! test
15846 Resolving duplicate section names
15847 !! wikitext
15848 == Foo bar ==
15849 == Foo bar ==
15850 !! html
15851 <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>
15852 <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>
15853
15854 !! end
15855
15856 !! test
15857 Resolving duplicate section names with differing case (T12721)
15858 !! wikitext
15859 == Foo bar ==
15860 == Foo Bar ==
15861 !! html
15862 <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>
15863 <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>
15864
15865 !! end
15866
15867 !! article
15868 Template:sections
15869 !! text
15870 ===Section 1===
15871 ==Section 2==
15872 !! endarticle
15873
15874 !! test
15875 Template with sections, __NOTOC__
15876 !! wikitext
15877 __NOTOC__
15878 ==Section 0==
15879 {{sections}}
15880 ==Section 4==
15881 !! html
15882 <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>
15883 <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>
15884 <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>
15885 <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>
15886
15887 !! end
15888
15889 !! test
15890 __NOEDITSECTION__ keyword
15891 !! wikitext
15892 __NOEDITSECTION__
15893 ==Section 1==
15894 ==Section 2==
15895 !! html
15896 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
15897 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
15898
15899 !! end
15900
15901 !! test
15902 Link inside a section heading
15903 !! wikitext
15904 ==Section with a [[Main Page|link]] in it==
15905 !! html
15906 <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>
15907
15908 !! end
15909
15910 !! test
15911 TOC regression (T14077)
15912 !! wikitext
15913 __TOC__
15914 == title 1 ==
15915 === title 1.1 ===
15916 == title 2 ==
15917 !! html
15918 <div id="toc" class="toc"><div id="toctitle" class="toctitle"><h2>Contents</h2></div>
15919 <ul>
15920 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
15921 <ul>
15922 <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>
15923 </ul>
15924 </li>
15925 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
15926 </ul>
15927 </div>
15928
15929 <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>
15930 <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>
15931 <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>
15932
15933 !! end
15934
15935 !! test
15936 T3219 URL next to image (good)
15937 !! wikitext
15938 http://example.com [[File:Foobar.jpg]]
15939 !! html/php
15940 <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>
15941 </p>
15942 !! html/parsoid
15943 <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>
15944 !!end
15945
15946 !! test
15947 Short headings with trailing space should match behavior of Parser::doHeadings (T21910)
15948 !! wikitext
15949 ===
15950 The line above must have a trailing space!
15951 === <!--
15952 --> <!-- -->
15953 But just in case it doesn't...
15954 !! html
15955 <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>
15956 <p>The line above must have a trailing space!
15957 </p>
15958 <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>
15959 <p>But just in case it doesn't...
15960 </p>
15961 !! end
15962
15963 !! test
15964 Header with special characters (T27462)
15965 !! wikitext
15966 The tooltips shall not show entities to the user (ie. be double escaped)
15967
15968 == text > text ==
15969 section 1
15970
15971 == text < text ==
15972 section 2
15973
15974 == text & text ==
15975 section 3
15976
15977 == text ' text ==
15978 section 4
15979
15980 == text " text ==
15981 section 5
15982 !! html
15983 <p>The tooltips shall not show entities to the user (ie. be double escaped)
15984 </p>
15985 <div id="toc" class="toc"><div id="toctitle" class="toctitle"><h2>Contents</h2></div>
15986 <ul>
15987 <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>
15988 <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>
15989 <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>
15990 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
15991 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
15992 </ul>
15993 </div>
15994
15995 <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>
15996 <p>section 1
15997 </p>
15998 <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>
15999 <p>section 2
16000 </p>
16001 <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>
16002 <p>section 3
16003 </p>
16004 <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>
16005 <p>section 4
16006 </p>
16007 <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>
16008 <p>section 5
16009 </p>
16010 !! end
16011
16012 !! test
16013 Header with space, plus and underscore as entity
16014 !! wikitext
16015 Id should not contain + for spaces
16016
16017 == Space between Text ==
16018 section 1
16019
16020 == Space-Entity&#32;between&#32;Text ==
16021 section 2
16022
16023 == Plus+between+Text ==
16024 section 3
16025
16026 == Plus-Entity&#43;between&#43;Text ==
16027 section 4
16028
16029 == Underscore_between_Text ==
16030 section 5
16031
16032 == Underscore-Entity&#95;between&#95;Text ==
16033 section 6
16034
16035 [[#Space between Text]]
16036 [[#Space-Entity&#32;between&#32;Text]]
16037 [[#Plus+between+Text]]
16038 [[#Plus-Entity&#43;between&#43;Text]]
16039 [[#Underscore_between_Text]]
16040 [[#Underscore-Entity&#95;between&#95;Text]]
16041 !! html
16042 <p>Id should not contain + for spaces
16043 </p>
16044 <div id="toc" class="toc"><div id="toctitle" class="toctitle"><h2>Contents</h2></div>
16045 <ul>
16046 <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>
16047 <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>
16048 <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>
16049 <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>
16050 <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>
16051 <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>
16052 </ul>
16053 </div>
16054
16055 <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>
16056 <p>section 1
16057 </p>
16058 <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>
16059 <p>section 2
16060 </p>
16061 <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>
16062 <p>section 3
16063 </p>
16064 <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>
16065 <p>section 4
16066 </p>
16067 <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>
16068 <p>section 5
16069 </p>
16070 <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>
16071 <p>section 6
16072 </p><p><a href="#Space_between_Text">#Space between Text</a>
16073 <a href="#Space-Entity_between_Text">#Space-Entity&#32;between&#32;Text</a>
16074 <a href="#Plus.2Bbetween.2BText">#Plus+between+Text</a>
16075 <a href="#Plus-Entity.2Bbetween.2BText">#Plus-Entity&#43;between&#43;Text</a>
16076 <a href="#Underscore_between_Text">#Underscore_between_Text</a>
16077 <a href="#Underscore-Entity_between_Text">#Underscore-Entity&#95;between&#95;Text</a>
16078 </p>
16079 !! end
16080
16081 !! test
16082 Headers with excess '=' characters
16083 (Are similar tests necessary beyond the 1st level?)
16084 !! wikitext
16085 =foo==
16086 ==foo=
16087 =''italic'' heading==
16088 ==''italic'' heading=
16089 !! html
16090 <div id="toc" class="toc"><div id="toctitle" class="toctitle"><h2>Contents</h2></div>
16091 <ul>
16092 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
16093 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
16094 <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>
16095 <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>
16096 </ul>
16097 </div>
16098
16099 <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>
16100 <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>
16101 <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>
16102 <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>
16103
16104 !! end
16105
16106 !! test
16107 HTML headers vs TOC (T25393)
16108 (__NOEDITSECTION__ for clearer output, doesn't matter here)
16109 !! wikitext
16110 <h1>Header 1</h1>
16111 == Header 1.1 ==
16112 == Header 1.2 ==
16113
16114 <h1>Header 2
16115 </h1>
16116 == Header 2.1 ==
16117 == Header 2.2 ==
16118 __NOEDITSECTION__
16119 !! html
16120 <div id="toc" class="toc"><div id="toctitle" class="toctitle"><h2>Contents</h2></div>
16121 <ul>
16122 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
16123 <ul>
16124 <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>
16125 <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>
16126 </ul>
16127 </li>
16128 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
16129 <ul>
16130 <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>
16131 <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>
16132 </ul>
16133 </li>
16134 </ul>
16135 </div>
16136
16137 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
16138 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
16139 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
16140 <h1><span class="mw-headline" id="Header_2">Header 2</span></h1>
16141 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
16142 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
16143
16144 !! end
16145
16146 !! test
16147 Single-line or multiline-comments can follow headings
16148 !! options
16149 parsoid=wt2html,wt2wt
16150 !! wikitext
16151 ==foo==<!---->
16152 ==bar==<!--c1-->
16153 ==baz==<!--
16154 c2
16155 c3-->
16156 !! html
16157 <h2><span class="mw-headline" id="foo">foo</span></h2>
16158 <h2><span class="mw-headline" id="bar">bar</span></h2>
16159 <h2><span class="mw-headline" id="baz">baz</span></h2>
16160
16161 !! end
16162
16163 !! test
16164 T3219 URL next to image (broken)
16165 !! wikitext
16166 http://example.com[[File:Foobar.jpg]]
16167 !! html/php
16168 <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>
16169 </p>
16170 !! html/parsoid
16171 <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>
16172 !!end
16173
16174 !! test
16175 T3186 news: in the middle of text
16176 !! wikitext
16177 http://en.wikinews.org/wiki/Wikinews:Workplace
16178 !! html
16179 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
16180 </p>
16181 !!end
16182
16183
16184 !! test
16185 Namespaced link must have a title
16186 !! wikitext
16187 [[Project:]]
16188 !! html
16189 <p>[[Project:]]
16190 </p>
16191 !!end
16192
16193 !! test
16194 Namespaced link must have a title (bad fragment version)
16195 !! wikitext
16196 [[Project:#fragment]]
16197 !! html
16198 <p>[[Project:#fragment]]
16199 </p>
16200 !!end
16201
16202
16203 ###
16204 ### HTML tags and HTML attributes
16205 ###
16206
16207 !! test
16208 div with no attributes
16209 !! wikitext
16210 <div>HTML rocks</div>
16211 !! html
16212 <div>HTML rocks</div>
16213
16214 !! end
16215
16216 !! test
16217 div with double-quoted attribute
16218 !! wikitext
16219 <div id="rock">HTML rocks</div>
16220 !! html
16221 <div id="rock">HTML rocks</div>
16222
16223 !! end
16224
16225 !! test
16226 div with single-quoted attribute
16227 !! wikitext
16228 <div id='rock'>HTML rocks</div>
16229 !! html
16230 <div id="rock">HTML rocks</div>
16231
16232 !! end
16233
16234 !! test
16235 div with unquoted attribute
16236 !! wikitext
16237 <div id=rock>HTML rocks</div>
16238 !! html
16239 <div id="rock">HTML rocks</div>
16240
16241 !! end
16242
16243 !! test
16244 div with illegal double attributes
16245 !! wikitext
16246 <div id="a" id="b">HTML rocks</div>
16247 !! html
16248 <div id="b">HTML rocks</div>
16249
16250 !!end
16251
16252 !! test
16253 div with empty attribute value, space before equals
16254 !! options
16255 parsoid=wt2html,html2html
16256 !! wikitext
16257 <div class =>HTML rocks</div>
16258 !! html/php
16259 <div class="">HTML rocks</div>
16260
16261 !! html/parsoid
16262 <div class="" data-parsoid='{"stx":"html"}'>HTML rocks</div>
16263 !! end
16264
16265 !! test
16266 div with multiple empty attribute values
16267 !! options
16268 parsoid=wt2html,html2html
16269 !! wikitext
16270 <div id= title=>HTML rocks</div>
16271 !! html/php
16272 <div id="title.3D">HTML rocks</div>
16273
16274 !! html/parsoid
16275 <div id="title.3D" data-parsoid='{"stx":"html"}'>HTML rocks</div>
16276 !! end
16277
16278 !! test
16279 table with multiple empty attribute values
16280 !! options
16281 parsoid=wt2html,html2html
16282 !! wikitext
16283 {| title= id=
16284 | hi
16285 |}
16286 !! html/php
16287 <table title="id=">
16288 <tr>
16289 <td> hi
16290 </td></tr></table>
16291
16292 !! html/parsoid
16293 <table title="id=">
16294 <tbody><tr><td> hi</td></tr>
16295 </tbody></table>
16296 !! end
16297
16298 !! test
16299 div with braces in attribute value
16300 !! wikitext
16301 <div title="{}">Foo</div>
16302 !! html/php
16303 <div title="&#123;&#125;">Foo</div>
16304
16305 !! html/parsoid
16306 <div title="{}">Foo</div>
16307 !! end
16308
16309 !! test
16310 div with empty attribute value, no space before equals
16311 !! options
16312 parsoid=wt2html,html2html
16313 !! wikitext
16314 <div class=>HTML rocks</div>
16315 !! html/php
16316 <div class="">HTML rocks</div>
16317
16318 !! html/parsoid
16319 <div class="">HTML rocks</div>
16320 !! end
16321
16322 !! test
16323 HTML multiple attributes correction
16324 !! wikitext
16325 <p class="error" class="awesome">Awesome!</p>
16326 !! html
16327 <p class="awesome">Awesome!</p>
16328
16329 !!end
16330
16331 !! test
16332 Table multiple attributes correction
16333 !! wikitext
16334 {|
16335 !+ class="error" class="awesome"| status
16336 |}
16337 !! html
16338 <table>
16339 <tr>
16340 <th class="awesome"> status
16341 </th></tr></table>
16342
16343 !!end
16344
16345 !! test
16346 DIV IN UPPERCASE
16347 !! wikitext
16348 <DIV ID="x">HTML ROCKS</DIV>
16349 !! html
16350 <div id="x">HTML ROCKS</div>
16351
16352 !!end
16353
16354 !! test
16355 Non-ASCII pseudo-tags are rendered as text
16356 !! wikitext
16357 <khyô>
16358 !! html
16359 <p>&lt;khyô&gt;
16360 </p>
16361 !! end
16362
16363 !! test
16364 Pseudo-tag with URL 'name' renders as url link
16365 !! wikitext
16366 <http://example.com/>
16367 !! html
16368 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
16369 </p>
16370 !! end
16371
16372 !! test
16373 text with amp in the middle of nowhere
16374 !! wikitext
16375 Remember AT&T?
16376 !! html
16377 <p>Remember AT&amp;T?
16378 </p>
16379 !! end
16380
16381 !! test
16382 text with character entity: eacute
16383 !! wikitext
16384 I always thought &eacute; was a cute letter.
16385 !! html
16386 <p>I always thought &#233; was a cute letter.
16387 </p>
16388 !! html+tidy
16389 <p>I always thought é was a cute letter.</p>
16390 !! end
16391
16392 !! test
16393 text with entity-escaped character entity-like string: eacute
16394 !! wikitext
16395 I always thought &amp;eacute; was a cute letter.
16396 !! html
16397 <p>I always thought &amp;eacute; was a cute letter.
16398 </p>
16399 !! end
16400
16401 !! test
16402 text with undefined character entity: xacute
16403 !! wikitext
16404 I always thought &xacute; was a cute letter.
16405 !! html
16406 <p>I always thought &amp;xacute; was a cute letter.
16407 </p>
16408 !! end
16409
16410 !! test
16411 HTML5 tags
16412 !! wikitext
16413 <data value="5">five</data>
16414 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
16415 <mark>This highlighted text</mark>
16416 !! html
16417 <p><data value="5">five</data>
16418 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
16419 <mark>This highlighted text</mark>
16420 </p>
16421 !! end
16422
16423 !! test
16424 HTML tag with leading space is parsed as text
16425 !! wikitext
16426 < div>foo< /div>
16427 !! html
16428 <p>&lt; div&gt;foo&lt; /div&gt;
16429 </p>
16430 !! end
16431
16432 ###
16433 ### Nesting tests (see T43545, T52604, T53081)
16434 ###
16435
16436 # This test case is fixed in Parsoid by domino 1.0.12. (T52604)
16437 # Note that html2wt is considerably more difficult if we use <b> in
16438 # the test case, instead of <small>
16439 !! test
16440 Ensure that HTML adoption agency algorithm is properly implemented.
16441 !! wikitext
16442 <small>X<small>Y</small>Z</small>
16443 !! html
16444 <p><small>X<small>Y</small>Z</small>
16445 </p>
16446 !! end
16447
16448 # This was T43545 in the PHP parser.
16449 # Note that tidy doesn't handle this correctly.
16450 !! test
16451 Nesting of <kbd>
16452 !! wikitext
16453 <kbd>X<kbd>Y</kbd>Z</kbd>
16454 !! html
16455 <p><kbd>X<kbd>Y</kbd>Z</kbd>
16456 </p>
16457 !! end
16458
16459 # The following cases were T53081 in the PHP parser.
16460 # Note that there are some other nestable tags (b, i, etc) which are
16461 # not covered; see T53081 for discussion.
16462
16463 # Note that tidy doesn't handle this correctly.
16464 !! test
16465 Nesting of <em>
16466 !! wikitext
16467 <em>X<em>Y</em>Z</em>
16468 !! html
16469 <p><em>X<em>Y</em>Z</em>
16470 </p>
16471 !! end
16472
16473 # Note that tidy doesn't handle this correctly.
16474 !! test
16475 Nesting of <strong>
16476 !! wikitext
16477 <strong>X<strong>Y</strong>Z</strong>
16478 !! html
16479 <p><strong>X<strong>Y</strong>Z</strong>
16480 </p>
16481 !! end
16482
16483 !! test
16484 Nesting of <q>
16485 !! wikitext
16486 <q>X<q>Y</q>Z</q>
16487 !! html+tidy
16488 <p><q>X<q>Y</q>Z</q></p>
16489 !! end
16490
16491 # Note that tidy doesn't handle this correctly.
16492 !! test
16493 Nesting of <ruby>
16494 !! wikitext
16495 <ruby>X<ruby>Y</ruby>Z</ruby>
16496 !! html
16497 <p><ruby>X<ruby>Y</ruby>Z</ruby>
16498 </p>
16499 !! end
16500
16501 # Note that tidy doesn't handle this correctly.
16502 !! test
16503 Nesting of <bdo>
16504 !! wikitext
16505 <bdo>X<bdo>Y</bdo>Z</bdo>
16506 !! html
16507 <p><bdo>X<bdo>Y</bdo>Z</bdo>
16508 </p>
16509 !! end
16510
16511
16512 ###
16513 ### Media links
16514 ###
16515
16516 !! test
16517 Media link
16518 !! wikitext
16519 [[Media:Foobar.jpg]]
16520 !! html/php
16521 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
16522 </p>
16523 !! html/parsoid
16524 <p><a rel="mw:MediaLink" href="//example.com/images/3/3a/Foobar.jpg" title="Foobar.jpg">Media:Foobar.jpg</a></p>
16525 !! end
16526
16527 !! test
16528 Media link with text
16529 !! wikitext
16530 [[Media:Foobar.jpg|A neat file to look at]]
16531 !! html/php
16532 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
16533 </p>
16534 !! html/parsoid
16535 <p><a rel="mw:MediaLink" href="//example.com/images/3/3a/Foobar.jpg" title="Foobar.jpg">A neat file to look at</a></p>
16536 !! end
16537
16538 # FIXME: this is still bad HTML tag nesting
16539 # FIXME: doBlockLevels won't wrap this in a paragraph because it contains a div
16540 !! test
16541 Media link with nasty text
16542 !! wikitext
16543 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
16544 !! html/php
16545 <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>
16546
16547 !! html+php/tidy
16548 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Safe Link</a></p>
16549 <div style="display:none">" onmouseover="alert(document.cookie)" onfoo="</div>
16550 !! html/parsoid
16551 <p><a rel="mw:MediaLink" href="//example.com/images/3/3a/Foobar.jpg" title="Foobar.jpg" data-parsoid='{"autoInsertedEnd":true}'>Safe Link</a></p><div style="display:none" data-parsoid='{"stx":"html"}'><a rel="mw:MediaLink" href="//example.com/images/3/3a/Foobar.jpg" title="Foobar.jpg" data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'>" onmouseover="alert(document.cookie)" onfoo="</a></div>
16552
16553 !! end
16554
16555 !! test
16556 Media link to nonexistent file (T3702)
16557 !! wikitext
16558 [[Media:No such.jpg]]
16559 [[Media:No_such file.jpg]]
16560 !! html/php
16561 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
16562 <a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such_file.jpg" class="new" title="No such file.jpg">Media:No_such file.jpg</a>
16563 </p>
16564 !! html/parsoid
16565 <p><a rel="mw:MediaLink" href="./Special:FilePath/No_such.jpg" title="No such.jpg" typeof="mw:Error" data-mw='{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}]}' data-parsoid='{"a":{"fileName":"No_such.jpg"},"sa":{"fileName":"No such.jpg"}}'>Media:No such.jpg</a>
16566 <a rel="mw:MediaLink" href="./Special:FilePath/No_such_file.jpg" title="No such file.jpg" typeof="mw:Error" data-mw='{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}]}' data-parsoid='{"a":{"fileName":"No_such_file.jpg"},"sa":{"fileName":"No_such file.jpg"}}'>Media:No_such file.jpg</a></p>
16567 !! end
16568
16569 !! test
16570 Image link to nonexistent file (T3850 - good)
16571 !! wikitext
16572 [[File:No_such.jpg]]
16573 !! html/php
16574 <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>
16575 </p>
16576 !! html/parsoid
16577 <p><span class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}]}'><a href="./File:No_such.jpg"><img resource="./File:No_such.jpg" src="./Special:FilePath/No_such.jpg" height="220" width="220"/></a></span></p>
16578 !! end
16579
16580 !! test
16581 :Image link to nonexistent file (T3850 - bad)
16582 !! wikitext
16583 [[:Image:No such.jpg]]
16584 !! html/php
16585 <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>
16586 </p>
16587 !! html/parsoid
16588 <p><a rel="mw:WikiLink" href="./File:No_such.jpg" title="File:No such.jpg">Image:No such.jpg</a></p>
16589 !! end
16590
16591
16592
16593 !! test
16594 Character reference normalization in link text (T3938)
16595 !! wikitext
16596 [[Main Page|this&that]]
16597 !! html
16598 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
16599 </p>
16600 !!end
16601
16602 !! article
16603 אַ
16604 !! text
16605 Test for unicode normalization
16606
16607 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
16608 !! endarticle
16609
16610 !! test
16611 (T21451) Links should refer to the normalized form.
16612 !! wikitext
16613 [[&#xFB2E;]]
16614 [[&#x5d0;&#x5b7;]]
16615 [[&#x5d0;ַ]]
16616 [[א&#x5b7;]]
16617 [[אַ]]
16618 !! html
16619 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
16620 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
16621 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
16622 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
16623 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
16624 </p>
16625 !! end
16626
16627 !! test
16628 Empty attribute crash test (T4067)
16629 !! wikitext
16630 <font color="">foo</font>
16631 !! html
16632 <p><font color="">foo</font>
16633 </p>
16634 !! end
16635
16636 !! test
16637 Empty attribute crash test single-quotes (T4067)
16638 !! wikitext
16639 <font color=''>foo</font>
16640 !! html
16641 <p><font color="">foo</font>
16642 </p>
16643 !! end
16644
16645 !! test
16646 Attribute test: equals, then nothing
16647 !! options
16648 parsoid=wt2html,html2html
16649 !! wikitext
16650 <font color=>foo</font>
16651 !! html/php
16652 <p><font color="">foo</font>
16653 </p>
16654 !! html/parsoid
16655 <p><font color="" data-parsoid='{"stx":"html"}'>foo</font></p>
16656 !! end
16657
16658 !! test
16659 Attribute test: unquoted value
16660 !! options
16661 parsoid=wt2html,html2html
16662 !! wikitext
16663 <font color=x>foo</font>
16664 !! html/php
16665 <p><font color="x">foo</font>
16666 </p>
16667 !! html/parsoid
16668 <p><font color="x" data-parsoid='{"stx":"html"}'>foo</font></p>
16669 !! end
16670
16671 !! test
16672 Attribute test: unquoted but illegal value (hash)
16673 !! wikitext
16674 <font color=#x>foo</font>
16675 !! html
16676 <p><font color="#x">foo</font>
16677 </p>
16678 !! end
16679
16680 # Parsoid does not serialize to empty attribute syntax,
16681 # so wt2wt and html2wt cases are skipped
16682 !! test
16683 Attribute test: no value (T54330)
16684 !! options
16685 parsoid=wt2html,html2html
16686 !! wikitext
16687 <font color>foo</font>
16688 !! html/php
16689 <p><font color="">foo</font>
16690 </p>
16691 !! html/parsoid
16692 <p><font color="">foo</font></p>
16693 !! end
16694
16695 !! test
16696 T4095: link with three closing brackets
16697 !! wikitext
16698 [[Main Page]]]
16699 !! html/php
16700 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
16701 </p>
16702 !! html/parsoid
16703 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a>]</p>
16704 !! end
16705
16706 !! test
16707 T4095: link with pipe and three closing brackets
16708 !! wikitext
16709 [[Main Page|link]]]
16710 !! html/php
16711 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
16712 </p>
16713 !! html/parsoid
16714 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">link</a>]</p>
16715 !! end
16716
16717 !! test
16718 T4095: link with pipe and three closing brackets, version 2
16719 !! wikitext
16720 [[Main Page|[http://example.com/]]]
16721 !! html/php
16722 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
16723 </p>
16724 !! html/parsoid
16725 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">[http://example.com/]</a></p>
16726 !! end
16727
16728
16729 ###
16730 ### Safety
16731 ###
16732
16733 !! article
16734 Template:Dangerous attribute
16735 !! text
16736 " onmouseover="alert(document.cookie)
16737 !! endarticle
16738
16739 !! article
16740 Template:Dangerous style attribute
16741 !! text
16742 border-size: expression(alert(document.cookie))
16743 !! endarticle
16744
16745 !! article
16746 Template:Div style
16747 !! text
16748 <div style="float: right; {{{1}}}">Magic div</div>
16749 !! endarticle
16750
16751 !! test
16752 T4304: HTML attribute safety (safe template; regression T4309)
16753 !! wikitext
16754 <div title="{{test}}"></div>
16755 !! html/php
16756 <div title="This is a test template"></div>
16757
16758 !! html/parsoid
16759 <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>
16760 !! end
16761
16762 # Parsoid has enough context to handle this case
16763 !! test
16764 T4304: HTML attribute safety (dangerous template; 2309)
16765 !! wikitext
16766 <div title="{{dangerous attribute}}"></div>
16767 !! html/php
16768 <div title=""></div>
16769
16770 !! html/parsoid
16771 <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>
16772 !! end
16773
16774 !! test
16775 T4304: HTML attribute safety (dangerous style template; 2309)
16776 !! wikitext
16777 <div style="{{dangerous style attribute}}"></div>
16778 !! html/php
16779 <div style="/* insecure input */"></div>
16780
16781 !! html/parsoid
16782 <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>
16783 !! end
16784
16785 !! test
16786 T4304: HTML attribute safety (safe parameter; 2309)
16787 !! wikitext
16788 {{div style|width: 200px}}
16789 !! html/php
16790 <div style="float: right; width: 200px">Magic div</div>
16791
16792 !! html/parsoid
16793 <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>
16794 !! end
16795
16796 !! test
16797 T4304: HTML attribute safety (unsafe parameter; 2309)
16798 !! wikitext
16799 {{div style|width: expression(alert(document.cookie))}}
16800 !! html/php
16801 <div style="/* insecure input */">Magic div</div>
16802
16803 !! html/parsoid
16804 <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>
16805 !! end
16806
16807 ## Parsoid output here differs; needs investigation.
16808 !! test
16809 T4304: HTML attribute safety (unsafe breakout parameter; 2309)
16810 !! wikitext
16811 {{div style|"><script>alert(document.cookie)</script>}}
16812 !! html
16813 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
16814
16815 !! end
16816
16817 ## Parsoid output here differs; needs investigation.
16818 !! test
16819 T4304: HTML attribute safety (unsafe breakout parameter 2; 2309)
16820 !! wikitext
16821 {{div style|" ><script>alert(document.cookie)</script>}}
16822 !! html
16823 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
16824
16825 !! end
16826
16827 !! test
16828 T4304: HTML attribute safety (link)
16829 !! wikitext
16830 <div title="[[Main Page]]"></div>
16831 !! html
16832 <div title="&#91;&#91;Main Page]]"></div>
16833
16834 !! end
16835
16836 !! test
16837 T4304: HTML attribute safety (italics)
16838 !! wikitext
16839 <div title="''foobar''"></div>
16840 !! html
16841 <div title="&#39;&#39;foobar&#39;&#39;"></div>
16842
16843 !! end
16844
16845 !! test
16846 T4304: HTML attribute safety (bold)
16847 !! wikitext
16848 <div title="'''foobar'''"></div>
16849 !! html
16850 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
16851
16852 !! end
16853
16854 !! test
16855 T4304: HTML attribute safety (ISBN)
16856 !! wikitext
16857 <div title="ISBN 1234567890"></div>
16858 !! html
16859 <div title="&#73;SBN 1234567890"></div>
16860
16861 !! end
16862
16863 !! test
16864 T4304: HTML attribute safety (RFC)
16865 !! wikitext
16866 <div title="RFC 1234"></div>
16867 !! html
16868 <div title="&#82;FC 1234"></div>
16869
16870 !! end
16871
16872 !! test
16873 T4304: HTML attribute safety (PMID)
16874 !! wikitext
16875 <div title="PMID 1234567890"></div>
16876 !! html
16877 <div title="&#80;MID 1234567890"></div>
16878
16879 !! end
16880
16881 !! test
16882 T4304: HTML attribute safety (web link)
16883 !! wikitext
16884 <div title="http://example.com/"></div>
16885 !! html
16886 <div title="http&#58;//example.com/"></div>
16887
16888 !! end
16889
16890 !! test
16891 T4304: HTML attribute safety (named web link)
16892 !! wikitext
16893 <div title="[http://example.com/ link]"></div>
16894 !! html
16895 <div title="&#91;http&#58;//example.com/ link]"></div>
16896
16897 !! end
16898
16899 !! test
16900 T5244: HTML attribute safety (extension; safe)
16901 !! wikitext
16902 <div style="<nowiki>background:blue</nowiki>"></div>
16903 !! html/php
16904 <div style="background:blue"></div>
16905
16906 !! html/parsoid
16907 <div style="background:blue" data-parsoid='{"stx":"html","a":{"style":"background:blue"},"sa":{"style":"&lt;nowiki>background:blue&lt;/nowiki>"}}'></div>
16908 !! end
16909
16910 !! test
16911 T5244: HTML attribute safety (extension; unsafe)
16912 !! wikitext
16913 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
16914 !! html/php
16915 <div style="/* insecure input */"></div>
16916
16917 !! html/parsoid
16918 <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>
16919 !! end
16920
16921 # More MSIE fun discovered by Tom Gilder
16922
16923 !! test
16924 MSIE CSS safety test: spurious slash
16925 !! wikitext
16926 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
16927 !! html/php
16928 <div style="/* insecure input */">evil</div>
16929
16930 !! html/parsoid
16931 <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>
16932 !! end
16933
16934 !! test
16935 MSIE CSS safety test: hex code
16936 !! wikitext
16937 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
16938 !! html/php
16939 <div style="/* insecure input */">evil</div>
16940
16941 !! html/parsoid
16942 <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>
16943 !! end
16944
16945 !! test
16946 MSIE CSS safety test: comment in url
16947 !! wikitext
16948 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
16949 !! html/php
16950 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
16951
16952 !! html/parsoid
16953 <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>
16954 !! end
16955
16956 !! test
16957 MSIE CSS safety test: comment in expression
16958 !! wikitext
16959 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
16960 !! html/php
16961 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
16962
16963 !! html/parsoid
16964 <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>
16965 !! end
16966
16967 !! test
16968 CSS safety test (all browsers): vertical tab (T57332 / CVE-2013-4567)
16969 !! wikitext
16970 <p style="font-size: 100px; background-image:url\b(https://www.google.com/images/srpr/logo6w.png)">A</p>
16971 !! html/php
16972 <p style="/* invalid control char */">A</p>
16973
16974 !! html/parsoid
16975 <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>
16976 !! end
16977
16978 !! test
16979 MSIE 6 CSS safety test: Fullwidth (T57332)
16980 !! wikitext
16981 <p style="font-size: 100px; color: expression((title='XSSed'),'red')">A</p>
16982 <div style="top:EXPRESSION(alert())">B</div>
16983 !! html/php
16984 <p style="/* insecure input */">A</p>
16985 <div style="/* insecure input */">B</div>
16986
16987 !! html/parsoid
16988 <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>
16989 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"top:EXPRESSION(alert())"}}'>B</div>
16990 !! end
16991
16992 !! test
16993 MSIE 6 CSS safety test: IPA extensions (T57332)
16994 !! wikitext
16995 <div style="background-image:uʀʟ(javascript:alert())">A</div>
16996 <p style="font-size: 100px; color: expʀessɪoɴ((title='XSSed'),'red')">B</p>
16997 !! html/php
16998 <div style="/* insecure input */">A</div>
16999 <p style="/* insecure input */">B</p>
17000
17001 !! html/parsoid
17002 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"background-image:uʀʟ(javascript:alert())"}}'>A</div>
17003 <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>
17004 !! end
17005
17006 !! test
17007 MSIE 6 CSS safety test: sup/sub script (T57332)
17008 !! wikitext
17009 <div style="background-image:url⁽javascript:alert())">A</div>
17010 <div style="background-image:url₍javascript:alert())">B</div>
17011 <p style="font-size: 100px; color: expressioⁿ((title='XSSed'),'red')">C</p>
17012 !! html/php
17013 <div style="/* insecure input */">A</div>
17014 <div style="/* insecure input */">B</div>
17015 <p style="/* insecure input */">C</p>
17016
17017 !! html/parsoid
17018 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"background-image:url⁽javascript:alert())"}}'>A</div>
17019 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"background-image:url₍javascript:alert())"}}'>B</div>
17020 <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>
17021 !! end
17022
17023 !! test
17024 Opera -o-link CSS
17025 !! options
17026 parsoid=wt2html,html2html
17027 !! wikitext
17028 <div
17029 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;"
17030 style="-o-link:attr(title);-o-link-source:current">X</div>
17031 !! html/php
17032 <div title="data:text/html,&lt;img src=1 onerror=alert(1)&gt;" style="/* insecure input */">X</div>
17033
17034 !! html/parsoid
17035 <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>
17036 !! end
17037
17038 !! test
17039 MSIE 6 CSS safety test: Repetition markers (T57332)
17040 !! wikitext
17041 <p style="font-size: 100px; color: expres〱ion((title='XSSed'),'red')">A</p>
17042 <p style="font-size: 100px; color: expresゝion((title='XSSed'),'red')">B</p>
17043 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">C</p>
17044 <p style="font-size: 100px; color: expresヽion((title='XSSed'),'red')">D</p>
17045 <p style="font-size: 100px; color: expresﹽion((title='XSSed'),'red')">E</p>
17046 <p style="font-size: 100px; color: expresﹼion((title='XSSed'),'red')">F</p>
17047 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">G</p>
17048 !! html/php
17049 <p style="/* insecure input */">A</p>
17050 <p style="/* insecure input */">B</p>
17051 <p style="/* insecure input */">C</p>
17052 <p style="/* insecure input */">D</p>
17053 <p style="/* insecure input */">E</p>
17054 <p style="/* insecure input */">F</p>
17055 <p style="/* insecure input */">G</p>
17056
17057 !! html/parsoid
17058 <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>
17059 <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>
17060 <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>
17061 <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>
17062 <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>
17063 <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>
17064 <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>
17065 !! end
17066
17067 !! test
17068 Table attribute legitimate extension
17069 !! wikitext
17070 {|
17071 !+ style="<nowiki>color:blue</nowiki>"| status
17072 |}
17073 !! html
17074 <table>
17075 <tr>
17076 <th style="color:blue"> status
17077 </th></tr></table>
17078
17079 !!end
17080
17081 !! test
17082 Table attribute safety
17083 !! wikitext
17084 {|
17085 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
17086 |}
17087 !! html
17088 <table>
17089 <tr>
17090 <th style="/* insecure input */"> status
17091 </th></tr></table>
17092
17093 !! end
17094
17095 !! test
17096 CSS line continuation 1
17097 !! wikitext
17098 <div style="background-image: u\&#10;rl(test.jpg);"></div>
17099 !! html
17100 <div style="/* insecure input */"></div>
17101
17102 !! end
17103
17104 !! test
17105 CSS line continuation 2
17106 !! wikitext
17107 <div style="background-image: u\&#13;rl(test.jpg); "></div>
17108 !! html
17109 <div style="/* invalid control char */"></div>
17110
17111 !! end
17112
17113 !! article
17114 Template:Identity
17115 !! text
17116 {{{1}}}
17117 !! endarticle
17118
17119 !! test
17120 Expansion of multi-line templates in attribute values (T8255)
17121 !! wikitext
17122 <div style="background: {{identity|#00FF00}}">-</div>
17123 !! html
17124 <div style="background: #00FF00">-</div>
17125
17126 !! end
17127
17128 !! test
17129 Expansion of multi-line templates in attribute values (T8255 sanity check)
17130 !! wikitext
17131 <div style="background:
17132 #00FF00">-</div>
17133 !! html/php
17134 <div style="background: #00FF00">-</div>
17135
17136 !! html/parsoid
17137 <div style="background:
17138 #00FF00">-</div>
17139 !! end
17140
17141 !! test
17142 Expansion of multi-line templates in attribute values (T8255 sanity check 2)
17143 !! wikitext
17144 <div style="background: &#10;#00FF00">-</div>
17145 !! html
17146 <div style="background: &#10;#00FF00">-</div>
17147
17148 !! end
17149
17150 !! test
17151 Tags which are hidden from Tidy cannot pass through the Sanitizer
17152 !! wikitext
17153 <mw:toc><script>alert();</script></mw:toc>
17154 !! html+tidy
17155 <p>&lt;mw:toc&gt;&lt;script&gt;alert();&lt;/script&gt;&lt;/mw:toc&gt;</p>
17156 !! end
17157
17158 ###
17159 ### Parser hooks (see tests/parser/parserTestsParserHook.php for the <tag> extension)
17160 ###
17161
17162 !! test
17163 Parser hook: empty input
17164 !! wikitext
17165 <tag></tag>
17166 !! html/php
17167 <pre>
17168 ''
17169 array (
17170 )
17171 </pre>
17172
17173 !! html/parsoid
17174 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
17175 !! end
17176
17177 ## Don't expect parsoid to rt this form.
17178 !! test
17179 Parser hook: empty input using terminated empty elements
17180 !! options
17181 parsoid=wt2html,html2html
17182 !! wikitext
17183 <tag/>
17184 !! html/php
17185 <pre>
17186 NULL
17187 array (
17188 )
17189 </pre>
17190
17191 !! html/parsoid
17192 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":null}' data-parsoid='{}' about="#mwt2"></pre>
17193 !! end
17194
17195 !! test
17196 Parser hook: empty input using terminated empty elements (space before)
17197 !! wikitext
17198 <tag />
17199 !! html/php
17200 <pre>
17201 NULL
17202 array (
17203 )
17204 </pre>
17205
17206 !! html/parsoid
17207 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":null}' data-parsoid='{}' about="#mwt2"></pre>
17208 !! end
17209
17210 !! test
17211 Parser hook: basic input
17212 !! wikitext
17213 <tag>input</tag>
17214 !! html/php
17215 <pre>
17216 'input'
17217 array (
17218 )
17219 </pre>
17220
17221 !! html/parsoid
17222 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
17223 !! end
17224
17225 ## Don't expect parsoid to rt this form.
17226 !! test
17227 Parser hook: case insensitive
17228 !! options
17229 parsoid=wt2html,html2html
17230 !! wikitext
17231 <TAG>input</TAG>
17232 !! html/php
17233 <pre>
17234 'input'
17235 array (
17236 )
17237 </pre>
17238
17239 !! html/parsoid
17240 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
17241 !! end
17242
17243 ## Don't expect parsoid to rt this form.
17244 !! test
17245 Parser hook: case insensitive, redux
17246 !! options
17247 parsoid=wt2html,html2html
17248 !! wikitext
17249 <TaG>input</TAg>
17250 !! html/php
17251 <pre>
17252 'input'
17253 array (
17254 )
17255 </pre>
17256
17257 !! html/parsoid
17258 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
17259 !! end
17260
17261 !! test
17262 Parser hook: nested tags
17263 !! wikitext
17264 <tag><tag></tag></tag>
17265 !! html/php
17266 <pre>
17267 '<tag>'
17268 array (
17269 )
17270 </pre>&lt;/tag&gt;
17271
17272 !! html/parsoid
17273 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"&lt;tag>"}}' data-parsoid='{}' about="#mwt2"></pre>&lt;/tag>
17274 !! end
17275
17276 !! test
17277 Parser hook: basic arguments
17278 !! wikitext
17279 <tag width="200" height="100" depth="50" square=""></tag>
17280 !! html/php
17281 <pre>
17282 ''
17283 array (
17284 'width' => '200',
17285 'height' => '100',
17286 'depth' => '50',
17287 'square' => '',
17288 )
17289 </pre>
17290
17291 !! html/parsoid
17292 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
17293 !! end
17294
17295 ## Don't expect parsoid to rt this form.
17296 !! test
17297 Parser hook: basic arguments, variations
17298 !! options
17299 parsoid=wt2html,html2html
17300 !! wikitext
17301 <tag width=200 height = "100" depth = '50' square></tag>
17302 !! html/php
17303 <pre>
17304 ''
17305 array (
17306 'width' => '200',
17307 'height' => '100',
17308 'depth' => '50',
17309 'square' => '',
17310 )
17311 </pre>
17312
17313 !! html/parsoid
17314 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
17315 !! end
17316
17317 !! test
17318 Parser hook: argument containing a forward slash (T7344)
17319 !! wikitext
17320 <tag filename="/tmp/bla"></tag>
17321 !! html/php
17322 <pre>
17323 ''
17324 array (
17325 'filename' => '/tmp/bla',
17326 )
17327 </pre>
17328
17329 !! html/parsoid
17330 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"filename":"/tmp/bla"},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
17331 !! end
17332
17333 ## Don't expect parsoid to rt this form.
17334 !! test
17335 Parser hook: empty input using terminated empty elements (T4374)
17336 !! options
17337 parsoid=wt2html,html2html
17338 !! wikitext
17339 <tag foo=bar/>text
17340 !! html/php
17341 <pre>
17342 NULL
17343 array (
17344 'foo' => 'bar',
17345 )
17346 </pre>text
17347
17348 !! html/parsoid
17349 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"foo":"bar"},"body":null}' data-parsoid='{}' about="#mwt2"></pre>text
17350 !! end
17351
17352 ## </tag> should be output literally since there is no matching tag that begins it
17353 ## Don't expect parsoid to rt this form.
17354 !! test
17355 Parser hook: basic arguments using terminated empty elements (T4374)
17356 !! options
17357 parsoid=wt2html
17358 !! wikitext
17359 <tag width=200 height = "100" depth = '50' square/>
17360 other stuff
17361 </tag>
17362 !! html/php
17363 <pre>
17364 NULL
17365 array (
17366 'width' => '200',
17367 'height' => '100',
17368 'depth' => '50',
17369 'square' => '',
17370 )
17371 </pre>
17372 <p>other stuff
17373 &lt;/tag&gt;
17374 </p>
17375 !! html/parsoid
17376 <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
17377 &lt;/tag></p>
17378 !! end
17379
17380 ## Don't expect parsoid to rt this form.
17381 !! test
17382 Parser hook: Don't allow unclosed extension tags
17383 !! options
17384 parsoid=wt2html
17385 !! wikitext
17386 test <tag>123
17387
17388 this is a '''test'''
17389 !! html/php
17390 <p>test &lt;tag&gt;123
17391 </p><p>this is a <b>test</b>
17392 </p>
17393 !! html/parsoid
17394 <p>test &lt;tag>123</p>
17395
17396 <p>this is a <b>test</b></p>
17397 !! end
17398
17399 ###
17400 ### (see tests/parser/parserTestsParserHook.php for the <statictag> extension)
17401 ###
17402
17403 !! test
17404 Parser hook: static parser hook not inside a comment
17405 !! wikitext
17406 <statictag>hello, world</statictag>
17407
17408 <statictag action="flush" />
17409 !! html/php
17410 <p><br />
17411 hello, world
17412 </p>
17413 !! html/parsoid
17414 <p><span typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{},"body":{"extsrc":"hello, world"}}' data-parsoid='{}' about="#mwt2"></span></p>
17415 <p typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{"action":"flush"},"body":null}' data-parsoid='{}' about="#mwt4">hello, world</p>
17416 !! end
17417
17418 !! test
17419 Parser hook: static parser hook inside a comment
17420 !! wikitext
17421 <!-- <statictag>hello, world</statictag> -->
17422 <statictag action="flush" />
17423 !! html/php
17424 <p><br />
17425 </p>
17426 !! html/parsoid
17427 <!-- <statictag&#x3E;hello, world</statictag&#x3E; -->
17428 <p typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{"action":"flush"},"body":null}' data-parsoid='{}' about="#mwt2"></p>
17429 !! end
17430
17431 # Nested template calls; this case was broken by Parser.php rev 1.506,
17432 # since reverted.
17433
17434 !! article
17435 Template:One-parameter
17436 !! text
17437 (My parameter is: {{{1}}})
17438 !! endarticle
17439
17440 !! article
17441 Template:Map-one-parameter
17442 !! text
17443 {{{{{1}}}|{{{2}}}}}
17444 !! endarticle
17445
17446 !! test
17447 Nested template calls
17448 !! wikitext
17449 {{Map-one-parameter|One-parameter|param}}
17450 !! html
17451 <p>(My parameter is: param)
17452 </p>
17453 !! end
17454
17455
17456 ###
17457 ### Sanitizer
17458 ###
17459
17460 # HTML+Tidy effectively strips out the empty tags completely
17461 # But since Parsoid doesn't it wraps the <s></s> tags in p-tags
17462 # which Tidy would have done for the PHP parser had there been content inside it.
17463 !! test
17464 Sanitizer: Closing of open tags
17465 !! wikitext
17466 <s></s><table></table>
17467 !! html
17468 <s></s><table></table>
17469
17470 !! html/parsoid
17471 <p><s></s></p><table></table>
17472 !! end
17473
17474 !! test
17475 Sanitizer: Closing of open but not closed tags
17476 !! wikitext
17477 <s>foo
17478 !! html
17479 <p><s>foo</s>
17480 </p>
17481 !! end
17482
17483 !! test
17484 Sanitizer: Closing of closed but not open tags
17485 !! options
17486 parsoid=wt2html
17487 !! wikitext
17488 </s>
17489 !! html/php+tidy
17490 !! html/parsoid
17491 !! end
17492
17493 !! test
17494 Sanitizer: Closing of closed but not open table tags
17495 !! options
17496 parsoid=wt2html
17497 !! wikitext
17498 Table not started</td></tr></table>
17499 !! html/php+tidy
17500 <p>Table not started</p>
17501 !! html/parsoid
17502 <p>Table not started</p>
17503 !! end
17504
17505 !! test
17506 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
17507 !! wikitext
17508 <span id="æ: v">byte</span>[[#æ: v|backlink]]
17509 !! html/php
17510 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
17511 </p>
17512 !! html/parsoid
17513 <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>
17514 !! end
17515
17516 # In HTML5, the restrictions are that id must contain at least one character,
17517 # and must not contain any space characters.
17518 !! test
17519 Sanitizer: Validating the contents of the id attribute (T6515)
17520 !! options
17521 disabled
17522 !! wikitext
17523 <br id="" /><br id="a space" />
17524 !! html
17525 Something ...
17526 !! end
17527
17528 # In HTML5, id must be unique amongst all the ids in the element's home subtree.
17529 !! test
17530 Sanitizer: Validating id attribute uniqueness (T6515, T8301)
17531 !! options
17532 disabled
17533 !! wikitext
17534 <br id="foo" /><br id="foo" />
17535 !! html
17536 Something need to be done. foo-2 ?
17537 !! end
17538
17539 !! test
17540 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
17541 !! wikitext
17542 <div itemscope>
17543 <meta itemprop="hello" content="world">
17544 <meta http-equiv="refresh" content="5">
17545 <meta itemprop="hello" http-equiv="refresh" content="5">
17546 <link itemprop="hello" href="{{SERVER}}">
17547 <link rel="stylesheet" href="{{SERVER}}">
17548 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
17549 </div>
17550 !! html
17551 <div itemscope="">
17552 <p> <meta itemprop="hello" content="world" />
17553 &lt;meta http-equiv="refresh" content="5"&gt;
17554 <meta itemprop="hello" content="5" />
17555 <link itemprop="hello" href="http&#58;//example.org" />
17556 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
17557 <link itemprop="hello" href="http&#58;//example.org" />
17558 </p>
17559 </div>
17560
17561 !! end
17562
17563 !! test
17564 Language converter: output gets cut off unexpectedly (T7757)
17565 !! options
17566 language=zh
17567 !! wikitext
17568 this bit is safe: }-
17569
17570 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
17571
17572 then we get cut off here: }-
17573
17574 all additional text is vanished
17575 !! html
17576 <p>this bit is safe: }-
17577 </p><p>but if we add a conversion instance: xxx
17578 </p><p>then we get cut off here: }-
17579 </p><p>all additional text is vanished
17580 </p>
17581 !! end
17582
17583 !! test
17584 Self closed html pairs (T7487)
17585 !! wikitext
17586 <center><font id="bug" />Centered text</center>
17587 <div><font id="bug2" />In div text</div>
17588 !! html+tidy
17589 <center><font id="bug"></font>Centered text</center>
17590 <div><font id="bug2"></font>In div text</div>
17591 !! end
17592
17593 #
17594 #
17595 #
17596
17597 !! test
17598 Punctuation: nbsp before exclamation
17599 !! wikitext
17600 C'est grave !
17601 !! html
17602 <p>C'est grave&#160;!
17603 </p>
17604 !! end
17605
17606 !! test
17607 Punctuation: CSS !important (T13874)
17608 !! wikitext
17609 <div style="width:50% !important">important</div>
17610 !! html
17611 <div style="width:50% !important">important</div>
17612
17613 !!end
17614
17615 !! test
17616 Punctuation: CSS ! important (T13874; with space after)
17617 !! wikitext
17618 <div style="width:50% ! important">important</div>
17619 !! html
17620 <div style="width:50% ! important">important</div>
17621
17622 !!end
17623
17624 !! test
17625 HTML bullet list, closed tags (T7497)
17626 !! wikitext
17627 <ul>
17628 <li>One</li>
17629 <li>Two</li>
17630 </ul>
17631 !! html/php
17632 <ul>
17633 <li>One</li>
17634 <li>Two</li>
17635 </ul>
17636
17637 !! html/parsoid
17638 <ul data-parsoid='{"stx":"html"}'>
17639 <li data-parsoid='{"stx":"html"}'>One</li>
17640 <li data-parsoid='{"stx":"html"}'>Two</li>
17641 </ul>
17642
17643 !! end
17644
17645 !! test
17646 HTML bullet list, unclosed tags (T7497)
17647 !! wikitext
17648 <ul>
17649 <li>One
17650 <li>Two
17651 </ul>
17652 !! html/php+tidy
17653 <ul>
17654 <li>One</li>
17655 <li>Two</li>
17656 </ul>
17657 !! html/parsoid
17658 <ul data-parsoid='{"stx":"html"}'>
17659 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
17660 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
17661 </ul>
17662
17663 !! end
17664
17665 !! test
17666 HTML ordered list, closed tags (T7497)
17667 !! wikitext
17668 <ol>
17669 <li>One</li>
17670 <li>Two</li>
17671 </ol>
17672 !! html/php
17673 <ol>
17674 <li>One</li>
17675 <li>Two</li>
17676 </ol>
17677
17678 !! html/parsoid
17679 <ol data-parsoid='{"stx":"html"}'>
17680 <li data-parsoid='{"stx":"html"}'>One</li>
17681 <li data-parsoid='{"stx":"html"}'>Two</li>
17682 </ol>
17683
17684 !! end
17685
17686 !! test
17687 HTML ordered list, unclosed tags (T7497)
17688 !! options
17689 !! wikitext
17690 <ol>
17691 <li>One
17692 <li>Two
17693 </ol>
17694 !! html/php+tidy
17695 <ol>
17696 <li>One</li>
17697 <li>Two</li>
17698 </ol>
17699 !! html/parsoid
17700 <ol data-parsoid='{"stx":"html"}'>
17701 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
17702 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
17703 </ol>
17704
17705 !! end
17706
17707 !! test
17708 HTML nested bullet list, closed tags (T7497)
17709 !! wikitext
17710 <ul>
17711 <li>One</li>
17712 <li>Two:
17713 <ul>
17714 <li>Sub-one</li>
17715 <li>Sub-two</li>
17716 </ul>
17717 </li>
17718 </ul>
17719 !! html/php
17720 <ul>
17721 <li>One</li>
17722 <li>Two:
17723 <ul>
17724 <li>Sub-one</li>
17725 <li>Sub-two</li>
17726 </ul>
17727 </li>
17728 </ul>
17729
17730 !! html/parsoid
17731 <ul data-parsoid='{"stx":"html"}'>
17732 <li data-parsoid='{"stx":"html"}'>One</li>
17733 <li data-parsoid='{"stx":"html"}'>Two:
17734 <ul data-parsoid='{"stx":"html"}'>
17735 <li data-parsoid='{"stx":"html"}'>Sub-one</li>
17736 <li data-parsoid='{"stx":"html"}'>Sub-two</li>
17737 </ul>
17738 </li>
17739 </ul>
17740 !! end
17741
17742 !! test
17743 HTML nested bullet list, open tags (T7497)
17744 !! wikitext
17745 <ul>
17746 <li>One
17747 <li>Two:
17748 <ul>
17749 <li>Sub-one
17750 <li>Sub-two
17751 </ul>
17752 </ul>
17753 !! html/php+tidy
17754 <ul>
17755 <li>One</li>
17756 <li>Two:
17757 <ul>
17758 <li>Sub-one</li>
17759 <li>Sub-two</li>
17760 </ul>
17761 </li>
17762 </ul>
17763 !! html/parsoid
17764 <ul>
17765 <li>One
17766 </li>
17767 <li>Two:
17768 <ul>
17769 <li>Sub-one
17770 </li>
17771 <li>Sub-two
17772 </li>
17773 </ul>
17774 </li>
17775 </ul>
17776
17777 !! end
17778
17779 !! test
17780 HTML nested ordered list, closed tags (T7497)
17781 !! wikitext
17782 <ol>
17783 <li>One</li>
17784 <li>Two:
17785 <ol>
17786 <li>Sub-one</li>
17787 <li>Sub-two</li>
17788 </ol>
17789 </li>
17790 </ol>
17791 !! html
17792 <ol>
17793 <li>One</li>
17794 <li>Two:
17795 <ol>
17796 <li>Sub-one</li>
17797 <li>Sub-two</li>
17798 </ol>
17799 </li>
17800 </ol>
17801
17802 !! end
17803
17804 !! test
17805 HTML nested ordered list, open tags (T7497)
17806 !! wikitext
17807 <ol>
17808 <li>One
17809 <li>Two:
17810 <ol>
17811 <li>Sub-one
17812 <li>Sub-two
17813 </ol>
17814 </ol>
17815 !! html/php
17816 <ol>
17817 <li>One
17818 <li>Two:
17819 <ol>
17820 <li>Sub-one
17821 <li>Sub-two
17822 </ol>
17823 </ol>
17824
17825 !! html/parsoid
17826 <ol>
17827 <li>One
17828 </li>
17829 <li>Two:
17830 <ol>
17831 <li>Sub-one
17832 </li>
17833 <li>Sub-two
17834 </li>
17835 </ol>
17836 </li>
17837 </ol>
17838
17839 !! end
17840
17841 !! test
17842 HTML ordered list item with parameters oddity
17843 !! wikitext
17844 <ol><li id="fragment">One</li>
17845 </ol>
17846 !! html
17847 <ol><li id="fragment">One</li>
17848 </ol>
17849
17850 !! end
17851
17852 # parsoid doesn't explicitly mark autonumbered links, see T55505
17853 !!test
17854 T7918: autonumbering
17855 !! wikitext
17856 [http://first/] [http://second] [ftp://ftp]
17857
17858 ftp://inlineftp
17859
17860 [mailto:enclosed@mail.tld With target]
17861
17862 [mailto:enclosed@mail.tld]
17863
17864 mailto:inline@mail.tld
17865 !! html/php
17866 <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>
17867 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
17868 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
17869 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
17870 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
17871 </p>
17872 !! html/parsoid
17873 <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>
17874 <p><a rel="mw:ExtLink" href="ftp://inlineftp">ftp://inlineftp</a></p>
17875 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld">With target</a></p>
17876 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld"></a></p>
17877 <p><a rel="mw:ExtLink" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a></p>
17878 !! end
17879
17880
17881 #
17882 # Security and HTML correctness
17883 # From Nick Jenkins' fuzz testing
17884 #
17885
17886 !! test
17887 Fuzz testing: Parser13
17888 !! wikitext
17889 {|
17890 | http://a|
17891 !! html
17892 <table>
17893 <tr>
17894 <td>
17895 </td>
17896 </tr>
17897 </table>
17898
17899 !! end
17900
17901 !! test
17902 Fuzz testing: Parser14
17903 !! wikitext
17904 == onmouseover= ==
17905 http://__TOC__
17906 !! html
17907 <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>
17908 http://<div id="toc" class="toc"><div id="toctitle" class="toctitle"><h2>Contents</h2></div>
17909 <ul>
17910 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
17911 </ul>
17912 </div>
17913
17914
17915 !! html+tidy
17916 <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>
17917 <p>http://</p>
17918 <div id="toc" class="toc">
17919 <div id="toctitle" class="toctitle">
17920 <h2>Contents</h2>
17921 </div>
17922 <ul>
17923 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
17924 </ul>
17925 </div>
17926 <p></p>
17927 !! end
17928
17929 !! test
17930 Fuzz testing: Parser14-table
17931 !! options
17932 parsoid=wt2html,html2html
17933 !! wikitext
17934 ==a==
17935 {| STYLE=__TOC__
17936 !! html
17937 <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>
17938 <table style="&#95;_TOC&#95;_">
17939 <tr><td></td></tr>
17940 </table>
17941
17942 !! html+tidy
17943 <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>
17944 <table style="__TOC__">
17945 <tr>
17946 <td></td>
17947 </tr>
17948 </table>
17949 !! html/parsoid
17950 <h2>a</h2>
17951 <table style="__TOC__"></table>
17952 !! end
17953
17954 # Known to produce bogus xml (extra </td>)
17955 !! test
17956 Fuzz testing: Parser16
17957 !! wikitext
17958 {|
17959 !https://||||||
17960 !! html
17961 <table>
17962 <tr>
17963 <th>https://</th>
17964 <th></th>
17965 <th></th>
17966 <th>
17967 </td>
17968 </tr>
17969 </table>
17970
17971 !! html+tidy
17972 <table>
17973 <tr>
17974 <th>https://</th>
17975 <th></th>
17976 <th></th>
17977 <th></th>
17978 </tr>
17979 </table>
17980 !! end
17981
17982 !! test
17983 Fuzz testing: Parser21
17984 !! wikitext
17985 {|
17986 ! irc://{{ftp://a" onmouseover="alert('hello world');"
17987 |
17988 !! html
17989 <table>
17990 <tr>
17991 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
17992 </th>
17993 <td>
17994 </td>
17995 </tr>
17996 </table>
17997
17998 !! end
17999
18000 !! test
18001 Fuzz testing: Parser22
18002 !! wikitext
18003 http://===r:::https://b
18004
18005 {|
18006 !! html
18007 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
18008 </p>
18009 <table>
18010 <tr><td></td></tr>
18011 </table>
18012
18013 !! end
18014
18015 # Known to produce bad XML for now
18016 !! test
18017 Fuzz testing: Parser24
18018 !! options
18019 parsoid=wt2html
18020 !! wikitext
18021 {|
18022 {{{|
18023 <u CLASS=
18024 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
18025 <br style="onmouseover='alert(document.cookie);' " />
18026
18027 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
18028 |
18029 !! html/php
18030 <table>
18031 {{{|
18032 <u class="&#124;">}}}} &gt;
18033 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
18034
18035 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
18036 <tr>
18037 <td></u>
18038 </td>
18039 </tr>
18040 </table>
18041
18042 !! html/parsoid
18043 <p data-parsoid='{"fostered":true,"autoInsertedEnd":true}'>{{{|
18044 <u class="|" data-parsoid='{"stx":"html","a":{"{{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--":null},"sa":{"{{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--":""},"autoInsertedEnd":true}'><meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/>}}}} >
18045 <br style="onmouseover='alert(document.cookie);' " data-parsoid='{"stx":"html","selfClose":true}'/></u></p><p data-parsoid='{"fostered":true,"autoInsertedEnd":true}'><u class="|" data-parsoid='{"stx":"html","a":{"{{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--":null},"sa":{"{{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--":""},"autoInsertedEnd":true,"autoInsertedStart":true}'>MOVE YOUR MOUSE CURSOR OVER THIS TEXT</u></p><table data-parsoid='{"autoInsertedEnd":true}'>
18046
18047
18048
18049 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'></td></tr></tbody></table>
18050 !! end
18051
18052 # Note: the current result listed for this is not what the original one was,
18053 # but the original bug was JavaScript injection, which is fixed in any case.
18054 # It's not clear that the original result listed was any more correct than the
18055 # current one. Original result:
18056 # <p>{{{|
18057 # </p>
18058 # <li class="&#124;&#124;">
18059 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
18060 !!test
18061 Fuzz testing: Parser25 (T8055)
18062 !! wikitext
18063 {{{
18064 |
18065 <LI CLASS=||
18066 >
18067 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
18068 !! html/php
18069 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
18070 </p>
18071 !! html/parsoid
18072 <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"]}'>
18073 </span><p about="#mwt1">&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b></p>
18074 !! end
18075
18076 !!test
18077 Fuzz testing: URL adjacent extension (with space, clean)
18078 !! wikitext
18079 http://example.com <nowiki>junk</nowiki>
18080 !! html/php
18081 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
18082 </p>
18083 !! html/parsoid
18084 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a> <span typeof="mw:Nowiki">junk</span></p>
18085 !! end
18086
18087 !!test
18088 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
18089 !! wikitext
18090 http://example.com<nowiki>junk</nowiki>
18091 !! html/php
18092 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
18093 </p>
18094 !! html/parsoid
18095 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a><span typeof="mw:Nowiki">junk</span></p>
18096 !! end
18097
18098 !! test
18099 Fuzz testing: URL adjacent extension (no space, dirty; pre)
18100 !! wikitext
18101 http://example.com<pre>junk</pre>
18102 !! html/php
18103 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
18104
18105 !! html/php+tidy
18106 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></p>
18107 <pre>
18108 junk
18109 </pre>
18110 !! html/parsoid
18111 <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>
18112 !! end
18113
18114 !! test
18115 Fuzz testing: image with bogus manual thumbnail
18116 !! wikitext
18117 [[Image:foobar.jpg|thumbnail= ]]
18118 !! html/php
18119 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
18120
18121 !! html/parsoid
18122 <figure class="mw-default-size" typeof="mw:Error mw:Image/Thumb" data-parsoid='{"optList":[{"ck":"manualthumb","ak":"thumbnail= "}]}' data-mw='{"errors":[{"key":"apierror-invalidtitle","message":"Invalid thumbnail title.","params":{"name":""}}],"thumb":""}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{"href":"Image:foobar.jpg"}}'><img resource="./File:Foobar.jpg" src="./Special:FilePath/Foobar.jpg" height="220" width="220" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"220"},"sa":{"resource":"Image:foobar.jpg"}}'/></a></figure>
18123 !! end
18124
18125 !! test
18126 Fuzz testing: encoded newline in generated HTML replacements (T8577)
18127 !! wikitext
18128 <pre dir="&#10;"></pre>
18129 !! html/php
18130 <pre dir="&#10;"></pre>
18131
18132 !! html/parsoid
18133 <pre typeof="mw:Extension/pre" about="#mwt2" dir="&amp;#10;" data-mw='{"name":"pre","attrs":{"dir":"&amp;#10;"},"body":{"extsrc":""}}'></pre>
18134 !! end
18135
18136 !! test
18137 Parsing optional HTML elements (T8171)
18138 !! options
18139 !! wikitext
18140 <table>
18141 <tr>
18142 <td> Some tabular data</td>
18143 <td> More tabular data ...
18144 <td> And yet som tabular data</td>
18145 </tr>
18146 </table>
18147 !! html
18148 <table>
18149 <tr>
18150 <td> Some tabular data</td>
18151 <td> More tabular data ...
18152 </td><td> And yet som tabular data</td>
18153 </tr>
18154 </table>
18155
18156 !! end
18157
18158 !! test
18159 Correct handling of <td>, <tr> (T8171)
18160 !! options
18161 !! wikitext
18162 <table>
18163 <tr>
18164 <td> Some tabular data</td>
18165 <td> More tabular data ...</td>
18166 <td> And yet som tabular data</td>
18167 </tr>
18168 </table>
18169 !! html
18170 <table>
18171 <tr>
18172 <td> Some tabular data</td>
18173 <td> More tabular data ...</td>
18174 <td> And yet som tabular data</td>
18175 </tr>
18176 </table>
18177
18178 !! end
18179
18180
18181 !! test
18182 Parsing crashing regression (fr:JavaScript)
18183 !! wikitext
18184 </body></x>
18185 !! html
18186 <p>&lt;/body&gt;&lt;/x&gt;
18187 </p>
18188 !! end
18189
18190 !! test
18191 Inline wiki vs wiki block nesting
18192 !! wikitext
18193 '''Bold paragraph
18194
18195 New wiki paragraph
18196 !! html
18197 <p><b>Bold paragraph</b>
18198 </p><p>New wiki paragraph
18199 </p>
18200 !! end
18201
18202 # FIXME: The current php output is documented
18203 # and desired output is the parsoid target.
18204 !! test
18205 Inline HTML vs wiki block nesting
18206 !! wikitext
18207 <b>Bold paragraph
18208
18209 New wiki paragraph
18210 !! html/php
18211 <p><b>Bold paragraph
18212 </p><p>New wiki paragraph</b>
18213 </p>
18214 !! html/parsoid
18215 <p><b>Bold paragraph</b>
18216 </p><p>New wiki paragraph
18217 </p>
18218 !! end
18219
18220 # Original result was this:
18221 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
18222 # </p>
18223 # While that might be marginally more intuitive, maybe, the six-apostrophe
18224 # construct is clearly pathological and the result stated here (which is what
18225 # the parser actually does) is about as reasonable as anything.
18226 !!test
18227 Mixing markup for italics and bold
18228 !! options
18229 !! wikitext
18230 '''bold''''''bold''bolditalics'''''
18231 !! html
18232 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
18233 </p>
18234 !! end
18235
18236
18237 !! article
18238 Xyzzyx
18239 !! text
18240 Article for special page transclusion test
18241 !! endarticle
18242
18243 !! test
18244 Special page transclusion
18245 !! options
18246 !! wikitext
18247 {{Special:Prefixindex/Xyzzyx}}
18248 !! html
18249 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
18250 </ul>
18251
18252 !! end
18253
18254 !! test
18255 Special page transclusion twice (T7021)
18256 !! options
18257 !! wikitext
18258 {{Special:Prefixindex/Xyzzyx}}
18259 {{Special:Prefixindex/Xyzzyx}}
18260 !! html
18261 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
18262 </ul>
18263 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
18264 </ul>
18265
18266 !! end
18267
18268 !! test
18269 Transclusion of default MediaWiki message
18270 !! wikitext
18271 {{MediaWiki:Mainpage}}
18272 !! html
18273 <p>Main Page
18274 </p>
18275 !! end
18276
18277 !! test
18278 Transclusion of nonexistent MediaWiki message
18279 !! wikitext
18280 {{MediaWiki:Mainpagexxx}}
18281 !! html
18282 <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>
18283 </p>
18284 !! end
18285
18286 !! test
18287 Transclusion of MediaWiki message with underscore
18288 !! wikitext
18289 {{MediaWiki:history_short}}
18290 !! html
18291 <p>History
18292 </p>
18293 !! end
18294
18295 !! test
18296 Transclusion of MediaWiki message with space
18297 !! wikitext
18298 {{MediaWiki:history short}}
18299 !! html
18300 <p>History
18301 </p>
18302 !! end
18303
18304 !! test
18305 Invalid header with following text
18306 !! wikitext
18307 = x = y
18308 !! html
18309 <p>= x = y
18310 </p>
18311 !! end
18312
18313
18314 !! test
18315 Section extraction test (section 0)
18316 !! options
18317 section=0
18318 !! wikitext
18319 start
18320 ==a==
18321 ===aa===
18322 ====aaa====
18323 ==b==
18324 ===ba===
18325 ===bb===
18326 ====bba====
18327 ===bc===
18328 ==c==
18329 ===ca===
18330 !! html/php
18331 start
18332 !! end
18333
18334 !! test
18335 Section extraction test (section 1)
18336 !! options
18337 section=1
18338 !! wikitext
18339 start
18340 ==a==
18341 ===aa===
18342 ====aaa====
18343 ==b==
18344 ===ba===
18345 ===bb===
18346 ====bba====
18347 ===bc===
18348 ==c==
18349 ===ca===
18350 !! html/php
18351 ==a==
18352 ===aa===
18353 ====aaa====
18354 !! end
18355
18356 !! test
18357 Section extraction test (section 2)
18358 !! options
18359 section=2
18360 !! wikitext
18361 start
18362 ==a==
18363 ===aa===
18364 ====aaa====
18365 ==b==
18366 ===ba===
18367 ===bb===
18368 ====bba====
18369 ===bc===
18370 ==c==
18371 ===ca===
18372 !! html/php
18373 ===aa===
18374 ====aaa====
18375 !! end
18376
18377 !! test
18378 Section extraction test (section 3)
18379 !! options
18380 section=3
18381 !! wikitext
18382 start
18383 ==a==
18384 ===aa===
18385 ====aaa====
18386 ==b==
18387 ===ba===
18388 ===bb===
18389 ====bba====
18390 ===bc===
18391 ==c==
18392 ===ca===
18393 !! html/php
18394 ====aaa====
18395 !! end
18396
18397 !! test
18398 Section extraction test (section 4)
18399 !! options
18400 section=4
18401 !! wikitext
18402 start
18403 ==a==
18404 ===aa===
18405 ====aaa====
18406 ==b==
18407 ===ba===
18408 ===bb===
18409 ====bba====
18410 ===bc===
18411 ==c==
18412 ===ca===
18413 !! html/php
18414 ==b==
18415 ===ba===
18416 ===bb===
18417 ====bba====
18418 ===bc===
18419 !! end
18420
18421 !! test
18422 Section extraction test (section 5)
18423 !! options
18424 section=5
18425 !! wikitext
18426 start
18427 ==a==
18428 ===aa===
18429 ====aaa====
18430 ==b==
18431 ===ba===
18432 ===bb===
18433 ====bba====
18434 ===bc===
18435 ==c==
18436 ===ca===
18437 !! html/php
18438 ===ba===
18439 !! end
18440
18441 !! test
18442 Section extraction test (section 6)
18443 !! options
18444 section=6
18445 !! wikitext
18446 start
18447 ==a==
18448 ===aa===
18449 ====aaa====
18450 ==b==
18451 ===ba===
18452 ===bb===
18453 ====bba====
18454 ===bc===
18455 ==c==
18456 ===ca===
18457 !! html/php
18458 ===bb===
18459 ====bba====
18460 !! end
18461
18462 !! test
18463 Section extraction test (section 7)
18464 !! options
18465 section=7
18466 !! wikitext
18467 start
18468 ==a==
18469 ===aa===
18470 ====aaa====
18471 ==b==
18472 ===ba===
18473 ===bb===
18474 ====bba====
18475 ===bc===
18476 ==c==
18477 ===ca===
18478 !! html/php
18479 ====bba====
18480 !! end
18481
18482 !! test
18483 Section extraction test (section 8)
18484 !! options
18485 section=8
18486 !! wikitext
18487 start
18488 ==a==
18489 ===aa===
18490 ====aaa====
18491 ==b==
18492 ===ba===
18493 ===bb===
18494 ====bba====
18495 ===bc===
18496 ==c==
18497 ===ca===
18498 !! html/php
18499 ===bc===
18500 !! end
18501
18502 !! test
18503 Section extraction test (section 9)
18504 !! options
18505 section=9
18506 !! wikitext
18507 start
18508 ==a==
18509 ===aa===
18510 ====aaa====
18511 ==b==
18512 ===ba===
18513 ===bb===
18514 ====bba====
18515 ===bc===
18516 ==c==
18517 ===ca===
18518 !! html/php
18519 ==c==
18520 ===ca===
18521 !! end
18522
18523 !! test
18524 Section extraction test (section 10)
18525 !! options
18526 section=10
18527 !! wikitext
18528 start
18529 ==a==
18530 ===aa===
18531 ====aaa====
18532 ==b==
18533 ===ba===
18534 ===bb===
18535 ====bba====
18536 ===bc===
18537 ==c==
18538 ===ca===
18539 !! html/php
18540 ===ca===
18541 !! end
18542
18543 !! test
18544 Section extraction test (nonexistent section 11)
18545 !! options
18546 section=11
18547 !! wikitext
18548 start
18549 ==a==
18550 ===aa===
18551 ====aaa====
18552 ==b==
18553 ===ba===
18554 ===bb===
18555 ====bba====
18556 ===bc===
18557 ==c==
18558 ===ca===
18559 !! html/php
18560 !! end
18561
18562 !! test
18563 Section extraction test with bogus heading (section 1)
18564 !! options
18565 section=1
18566 !! wikitext
18567 ==a==
18568 ==bogus== not a legal section
18569 ==b==
18570 !! html/php
18571 ==a==
18572 ==bogus== not a legal section
18573 !! end
18574
18575 !! test
18576 Section extraction test with bogus heading (section 2)
18577 !! options
18578 section=2
18579 !! wikitext
18580 ==a==
18581 ==bogus== not a legal section
18582 ==b==
18583 !! html/php
18584 ==b==
18585 !! end
18586
18587 !! test
18588 Section extraction test with comment after heading (section 1)
18589 !! options
18590 section=1
18591 !! wikitext
18592 ==a==
18593 ==b== <!-- -->
18594 ==c==
18595 !! html/php
18596 ==a==
18597 !! end
18598
18599 !! test
18600 Section extraction test with comment after heading (section 2)
18601 !! options
18602 section=2
18603 !! wikitext
18604 ==a==
18605 ==b== <!-- -->
18606 ==c==
18607 !! html/php
18608 ==b== <!-- -->
18609 !! end
18610
18611 !! test
18612 Section extraction test with bogus <nowiki> heading (section 1)
18613 !! options
18614 section=1
18615 !! wikitext
18616 ==a==
18617 ==bogus== <nowiki>not a legal section</nowiki>
18618 ==b==
18619 !! html/php
18620 ==a==
18621 ==bogus== <nowiki>not a legal section</nowiki>
18622 !! end
18623
18624 !! test
18625 Section extraction test with bogus <nowiki> heading (section 2)
18626 !! options
18627 section=2
18628 !! wikitext
18629 ==a==
18630 ==bogus== <nowiki>not a legal section</nowiki>
18631 ==b==
18632 !! html/php
18633 ==b==
18634 !! end
18635
18636 # Formerly testing for T4587, now resolved by the use of unmarked sections
18637 # instead of respecting commented sections
18638 !! test
18639 Section extraction prefixed by comment (section 1)
18640 !! options
18641 section=1
18642 !! wikitext
18643 <!-- -->==sec1==
18644 ==sec2==
18645 !! html/php
18646 ==sec2==
18647 !!end
18648
18649 !! test
18650 Section extraction prefixed by comment (section 2)
18651 !! options
18652 section=2
18653 !! wikitext
18654 <!-- -->==sec1==
18655 ==sec2==
18656 !! html/php
18657
18658 !!end
18659
18660 # Formerly testing for T4607, now resolved by the use of unmarked sections
18661 # instead of respecting HTML-style headings
18662 !! test
18663 Section extraction, mixed wiki and html (section 1)
18664 !! options
18665 section=1
18666 !! wikitext
18667 <h2>unmarked</h2>
18668 unmarked
18669 ==1==
18670 one
18671 ==2==
18672 two
18673 !! html/php
18674 ==1==
18675 one
18676 !! end
18677
18678 !! test
18679 Section extraction, mixed wiki and html (section 2)
18680 !! options
18681 section=2
18682 !! wikitext
18683 <h2>unmarked</h2>
18684 unmarked
18685 ==1==
18686 one
18687 ==2==
18688 two
18689 !! html/php
18690 ==2==
18691 two
18692 !! end
18693
18694
18695 # Formerly testing for T5342
18696 !! test
18697 Section extraction, heading surrounded by <noinclude>
18698 !! options
18699 section=1
18700 !! wikitext
18701 <noinclude>==unmarked==</noinclude>
18702 ==marked==
18703 !! html/php
18704 ==marked==
18705 !!end
18706
18707 # Test behavior of T21910
18708 !! test
18709 Sectiion with all-equals
18710 !! options
18711 section=2
18712 !! wikitext
18713 ===
18714 The line above must have a trailing space
18715 === <!--
18716 --> <!-- -->
18717 But just in case it doesn't...
18718 !! html/php
18719 === <!--
18720 --> <!-- -->
18721 But just in case it doesn't...
18722 !! end
18723
18724 !! test
18725 Section replacement test (section 0)
18726 !! options
18727 replace=0,"xxx"
18728 !! wikitext
18729 start
18730 ==a==
18731 ===aa===
18732 ====aaa====
18733 ==b==
18734 ===ba===
18735 ===bb===
18736 ====bba====
18737 ===bc===
18738 ==c==
18739 ===ca===
18740 !! html/php
18741 xxx
18742
18743 ==a==
18744 ===aa===
18745 ====aaa====
18746 ==b==
18747 ===ba===
18748 ===bb===
18749 ====bba====
18750 ===bc===
18751 ==c==
18752 ===ca===
18753 !! end
18754
18755 !! test
18756 Section replacement test (section 1)
18757 !! options
18758 replace=1,"xxx"
18759 !! wikitext
18760 start
18761 ==a==
18762 ===aa===
18763 ====aaa====
18764 ==b==
18765 ===ba===
18766 ===bb===
18767 ====bba====
18768 ===bc===
18769 ==c==
18770 ===ca===
18771 !! html/php
18772 start
18773 xxx
18774
18775 ==b==
18776 ===ba===
18777 ===bb===
18778 ====bba====
18779 ===bc===
18780 ==c==
18781 ===ca===
18782 !! end
18783
18784 !! test
18785 Section replacement test (section 2)
18786 !! options
18787 replace=2,"xxx"
18788 !! wikitext
18789 start
18790 ==a==
18791 ===aa===
18792 ====aaa====
18793 ==b==
18794 ===ba===
18795 ===bb===
18796 ====bba====
18797 ===bc===
18798 ==c==
18799 ===ca===
18800 !! html/php
18801 start
18802 ==a==
18803 xxx
18804
18805 ==b==
18806 ===ba===
18807 ===bb===
18808 ====bba====
18809 ===bc===
18810 ==c==
18811 ===ca===
18812 !! end
18813
18814 !! test
18815 Section replacement test (section 3)
18816 !! options
18817 replace=3,"xxx"
18818 !! wikitext
18819 start
18820 ==a==
18821 ===aa===
18822 ====aaa====
18823 ==b==
18824 ===ba===
18825 ===bb===
18826 ====bba====
18827 ===bc===
18828 ==c==
18829 ===ca===
18830 !! html/php
18831 start
18832 ==a==
18833 ===aa===
18834 xxx
18835
18836 ==b==
18837 ===ba===
18838 ===bb===
18839 ====bba====
18840 ===bc===
18841 ==c==
18842 ===ca===
18843 !! end
18844
18845 !! test
18846 Section replacement test (section 4)
18847 !! options
18848 replace=4,"xxx"
18849 !! wikitext
18850 start
18851 ==a==
18852 ===aa===
18853 ====aaa====
18854 ==b==
18855 ===ba===
18856 ===bb===
18857 ====bba====
18858 ===bc===
18859 ==c==
18860 ===ca===
18861 !! html/php
18862 start
18863 ==a==
18864 ===aa===
18865 ====aaa====
18866 xxx
18867
18868 ==c==
18869 ===ca===
18870 !! end
18871
18872 !! test
18873 Section replacement test (section 5)
18874 !! options
18875 replace=5,"xxx"
18876 !! wikitext
18877 start
18878 ==a==
18879 ===aa===
18880 ====aaa====
18881 ==b==
18882 ===ba===
18883 ===bb===
18884 ====bba====
18885 ===bc===
18886 ==c==
18887 ===ca===
18888 !! html/php
18889 start
18890 ==a==
18891 ===aa===
18892 ====aaa====
18893 ==b==
18894 xxx
18895
18896 ===bb===
18897 ====bba====
18898 ===bc===
18899 ==c==
18900 ===ca===
18901 !! end
18902
18903 !! test
18904 Section replacement test (section 6)
18905 !! options
18906 replace=6,"xxx"
18907 !! wikitext
18908 start
18909 ==a==
18910 ===aa===
18911 ====aaa====
18912 ==b==
18913 ===ba===
18914 ===bb===
18915 ====bba====
18916 ===bc===
18917 ==c==
18918 ===ca===
18919 !! html/php
18920 start
18921 ==a==
18922 ===aa===
18923 ====aaa====
18924 ==b==
18925 ===ba===
18926 xxx
18927
18928 ===bc===
18929 ==c==
18930 ===ca===
18931 !! end
18932
18933 !! test
18934 Section replacement test (section 7)
18935 !! options
18936 replace=7,"xxx"
18937 !! wikitext
18938 start
18939 ==a==
18940 ===aa===
18941 ====aaa====
18942 ==b==
18943 ===ba===
18944 ===bb===
18945 ====bba====
18946 ===bc===
18947 ==c==
18948 ===ca===
18949 !! html/php
18950 start
18951 ==a==
18952 ===aa===
18953 ====aaa====
18954 ==b==
18955 ===ba===
18956 ===bb===
18957 xxx
18958
18959 ===bc===
18960 ==c==
18961 ===ca===
18962 !! end
18963
18964 !! test
18965 Section replacement test (section 8)
18966 !! options
18967 replace=8,"xxx"
18968 !! wikitext
18969 start
18970 ==a==
18971 ===aa===
18972 ====aaa====
18973 ==b==
18974 ===ba===
18975 ===bb===
18976 ====bba====
18977 ===bc===
18978 ==c==
18979 ===ca===
18980 !! html/php
18981 start
18982 ==a==
18983 ===aa===
18984 ====aaa====
18985 ==b==
18986 ===ba===
18987 ===bb===
18988 ====bba====
18989 xxx
18990
18991 ==c==
18992 ===ca===
18993 !!end
18994
18995 !! test
18996 Section replacement test (section 9)
18997 !! options
18998 replace=9,"xxx"
18999 !! wikitext
19000 start
19001 ==a==
19002 ===aa===
19003 ====aaa====
19004 ==b==
19005 ===ba===
19006 ===bb===
19007 ====bba====
19008 ===bc===
19009 ==c==
19010 ===ca===
19011 !! html/php
19012 start
19013 ==a==
19014 ===aa===
19015 ====aaa====
19016 ==b==
19017 ===ba===
19018 ===bb===
19019 ====bba====
19020 ===bc===
19021 xxx
19022 !! end
19023
19024 !! test
19025 Section replacement test (section 10)
19026 !! options
19027 replace=10,"xxx"
19028 !! wikitext
19029 start
19030 ==a==
19031 ===aa===
19032 ====aaa====
19033 ==b==
19034 ===ba===
19035 ===bb===
19036 ====bba====
19037 ===bc===
19038 ==c==
19039 ===ca===
19040 !! html/php
19041 start
19042 ==a==
19043 ===aa===
19044 ====aaa====
19045 ==b==
19046 ===ba===
19047 ===bb===
19048 ====bba====
19049 ===bc===
19050 ==c==
19051 xxx
19052 !! end
19053
19054 !! test
19055 Section replacement test with initial whitespace (T15728)
19056 !! options
19057 replace=2,"xxx"
19058 !! wikitext
19059 Preformatted initial line
19060 ==a==
19061 ===a===
19062 !! html/php
19063 Preformatted initial line
19064 ==a==
19065 xxx
19066 !! end
19067
19068
19069 !! test
19070 Section extraction, heading followed by pre with 20 spaces (T8398)
19071 !! options
19072 section=1
19073 !! wikitext
19074 ==a==
19075 a
19076 !! html/php
19077 ==a==
19078 a
19079 !! end
19080
19081 !! test
19082 Section extraction, heading followed by pre with 19 spaces (T8398 sanity check)
19083 !! options
19084 section=1
19085 !! wikitext
19086 ==a==
19087 a
19088 !! html/php
19089 ==a==
19090 a
19091 !! end
19092
19093
19094 !! test
19095 Section extraction, <pre> around bogus header (T12309)
19096 !! options
19097 section=2
19098 !! wikitext
19099 == Section One ==
19100 <pre>
19101 =======
19102 </pre>
19103
19104 == Section Two ==
19105 stuff
19106 !! html/php
19107 == Section Two ==
19108 stuff
19109 !! end
19110
19111 !! test
19112 Section replacement, <pre> around bogus header (T12309)
19113 !! options
19114 replace=2,"xxx"
19115 !! wikitext
19116 == Section One ==
19117 <pre>
19118 =======
19119 </pre>
19120
19121 == Section Two ==
19122 stuff
19123 !! html/php
19124 == Section One ==
19125 <pre>
19126 =======
19127 </pre>
19128
19129 xxx
19130 !! end
19131
19132 !! test
19133 Handling of &#x0A; in URLs
19134 !! wikitext
19135 ** irc://&#x0A;a
19136 !! html/php
19137 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
19138
19139 !! html/parsoid
19140 <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>
19141 !! end
19142
19143 !! test
19144 Handling of %0A in URLs
19145 !! wikitext
19146 ** irc://%0Aa
19147 !! html/php
19148 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
19149
19150 !! html/parsoid
19151 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
19152 !! end
19153
19154 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
19155 !! test
19156 5 quotes, code coverage +1 line
19157 !! options
19158 parsoid=wt2html
19159 !! wikitext
19160 '''''
19161 !! html/php
19162 !! html/parsoid
19163 <p><b><i></i></b></p>
19164 !! end
19165
19166 # same html as previous, but wikitext adjusted to match parsoid html2wt
19167 # note that wt2html and html2html will put the <i> before the <b>
19168 !! test
19169 5 quotes, code coverage +1 line w/ nowiki (1)
19170 !! options
19171 parsoid=wt2wt,html2wt
19172 !! wikitext
19173 '''''<nowiki/>'''''
19174 !! html/php
19175 <p><i></i>
19176 </p>
19177 !! html/parsoid
19178 <p><b><i></i></b></p>
19179 !! end
19180
19181 # same as previous, just swapping the <i> and <b>
19182 !! test
19183 5 quotes, code coverage +1 line w/ nowiki (2)
19184 !! wikitext
19185 '''''<nowiki/>'''''
19186 !! html/php
19187 <p><i></i>
19188 </p>
19189 !! html/parsoid
19190 <p><i><b></b></i></p>
19191 !! end
19192
19193 !! test
19194 Special:Search page linking.
19195 !! wikitext
19196 {{Special:search}}
19197 !! html
19198 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
19199 </p>
19200 !! end
19201
19202 !! test
19203 {{!}} is a magic word
19204 !! wikitext
19205 {{!}} is a magic word there and {{!}} is still a magic word here
19206 | is not a magic word here but {{!}} is still a magic word here
19207 !! html/php
19208 <p>| is a magic word there and | is still a magic word here
19209 | is not a magic word here but | is still a magic word here
19210 </p>
19211 !! html/parsoid
19212 <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
19213 | 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>
19214
19215 !! end
19216
19217 !! test
19218 Say the magic word
19219 !! options
19220 title=[[Parser test]]
19221 !! wikitext
19222 * {{PAGENAME}}
19223 * {{PAGENAMEE}}
19224 * {{FULLPAGENAME}}
19225 * {{FULLPAGENAMEE}}
19226 * {{BASEPAGENAME}}
19227 * {{BASEPAGENAMEE}}
19228 * {{SUBPAGENAME}}
19229 * {{SUBPAGENAMEE}}
19230 * {{ROOTPAGENAME}}
19231 * {{ROOTPAGENAMEE}}
19232 * {{TALKPAGENAME}}
19233 * {{TALKPAGENAMEE}}
19234 * {{SUBJECTPAGENAME}}
19235 * {{SUBJECTPAGENAMEE}}
19236 * {{NAMESPACEE}}
19237 * {{NAMESPACE}}
19238 * {{NAMESPACENUMBER}}
19239 * {{TALKSPACE}}
19240 * {{TALKSPACEE}}
19241 * {{SUBJECTSPACE}}
19242 * {{SUBJECTSPACEE}}
19243 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
19244 !! html
19245 <ul><li> Parser test</li>
19246 <li> Parser_test</li>
19247 <li> Parser test</li>
19248 <li> Parser_test</li>
19249 <li> Parser test</li>
19250 <li> Parser_test</li>
19251 <li> Parser test</li>
19252 <li> Parser_test</li>
19253 <li> Parser test</li>
19254 <li> Parser_test</li>
19255 <li> Talk:Parser test</li>
19256 <li> Talk:Parser_test</li>
19257 <li> Parser test</li>
19258 <li> Parser_test</li>
19259 <li> </li>
19260 <li> </li>
19261 <li> 0</li>
19262 <li> Talk</li>
19263 <li> Talk</li>
19264 <li> </li>
19265 <li> </li>
19266 <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>
19267
19268 !! end
19269 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
19270
19271 !! test
19272 Gallery with valid attributes
19273 !! wikitext
19274 <gallery type="123" summary="345">
19275 File:File:Foobar.jpg
19276 </gallery>
19277 !! html/php
19278 <ul class="gallery mw-gallery-traditional" type="123">
19279 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19280 <div class="thumb" style="height: 150px;">File:Foobar.jpg</div>
19281 <div class="gallerytext">
19282 </div>
19283 </div></li>
19284 </ul>
19285
19286 !! html/parsoid
19287 <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"}}'>
19288 <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>
19289 </ul>
19290 !! end
19291
19292 ## Parsoid thinks the "centre" here is a property, not a caption.
19293 !! test
19294 Gallery
19295 !! options
19296 parsoid={
19297 "modes": ["wt2html"],
19298 "nativeGallery": true
19299 }
19300 !! wikitext
19301 <gallery>
19302 image1.png |
19303 image2.gif|||||
19304
19305 image3|
19306 image4 |300px| centre
19307 image5.svg| http://///////
19308 [[x|xx]]]]
19309 * image6
19310 </gallery>
19311 !! html/php
19312 <ul class="gallery mw-gallery-traditional">
19313 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19314 <div class="thumb" style="height: 150px;">Image1.png</div>
19315 <div class="gallerytext">
19316 </div>
19317 </div></li>
19318 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19319 <div class="thumb" style="height: 150px;">Image2.gif</div>
19320 <div class="gallerytext">
19321 </div>
19322 </div></li>
19323 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19324 <div class="thumb" style="height: 150px;">Image3</div>
19325 <div class="gallerytext">
19326 </div>
19327 </div></li>
19328 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19329 <div class="thumb" style="height: 150px;">Image4</div>
19330 <div class="gallerytext">
19331 <pre>centre
19332 </pre>
19333 </div>
19334 </div></li>
19335 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19336 <div class="thumb" style="height: 150px;">Image5.svg</div>
19337 <div class="gallerytext">
19338 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
19339 </p>
19340 </div>
19341 </div></li>
19342 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19343 <div class="thumb" style="height: 150px;">* image6</div>
19344 <div class="gallerytext">
19345 </div>
19346 </div></li>
19347 </ul>
19348
19349 !! html/parsoid
19350 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt3" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
19351 <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>
19352 <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>
19353 <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>
19354 <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>
19355 <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>
19356 <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>
19357 </ul>
19358 !! end
19359
19360 !! test
19361 Gallery (with options, html)
19362 !! options
19363 parsoid={
19364 "modes": ["wt2html", "html2html"],
19365 "nativeGallery": true
19366 }
19367 !! wikitext
19368 <gallery widths="70px" heights="40px" perrow="2" caption="Foo [[Main Page]]">
19369 File:Nonexistent.jpg|caption
19370 File:Nonexistent.jpg
19371 image:foobar.jpg|some '''caption''' [[Main Page]]
19372 image:foobar.jpg
19373 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
19374 </gallery>
19375 !! html/php
19376 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
19377 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
19378 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19379 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
19380 <div class="gallerytext">
19381 <p>caption
19382 </p>
19383 </div>
19384 </div></li>
19385 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19386 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
19387 <div class="gallerytext">
19388 </div>
19389 </div></li>
19390 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19391 <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>
19392 <div class="gallerytext">
19393 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
19394 </p>
19395 </div>
19396 </div></li>
19397 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19398 <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>
19399 <div class="gallerytext">
19400 </div>
19401 </div></li>
19402 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19403 <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>
19404 <div class="gallerytext">
19405 <p>blabla.
19406 </p>
19407 </div>
19408 </div></li>
19409 </ul>
19410
19411 !! html/parsoid
19412 <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":{}}'>
19413 <li class="gallerycaption">Foo <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a></li>
19414 <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>
19415 <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>
19416 <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>
19417 <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>
19418 <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>
19419 </ul>
19420 !! end
19421
19422 !! test
19423 Gallery (with options, extsrc)
19424 !! options
19425 parsoid={
19426 "nativeGallery": false
19427 }
19428 !! wikitext
19429 <gallery widths="70px" heights="40px" perrow="2" caption="Foo [[Main Page]]">
19430 File:Nonexistent.jpg|caption
19431 File:Nonexistent.jpg
19432 image:foobar.jpg|some '''caption''' [[Main Page]]
19433 image:foobar.jpg
19434 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
19435 </gallery>
19436 !! html/php
19437 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
19438 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
19439 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19440 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
19441 <div class="gallerytext">
19442 <p>caption
19443 </p>
19444 </div>
19445 </div></li>
19446 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19447 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
19448 <div class="gallerytext">
19449 </div>
19450 </div></li>
19451 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19452 <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>
19453 <div class="gallerytext">
19454 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
19455 </p>
19456 </div>
19457 </div></li>
19458 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19459 <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>
19460 <div class="gallerytext">
19461 </div>
19462 </div></li>
19463 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19464 <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>
19465 <div class="gallerytext">
19466 <p>blabla.
19467 </p>
19468 </div>
19469 </div></li>
19470 </ul>
19471
19472 !! html/parsoid
19473 <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"}}'>
19474 <li class="gallerycaption">Foo <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a></li>
19475 <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>
19476 <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>
19477 <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>
19478 <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>
19479 <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>
19480 </ul>
19481 !! end
19482
19483 !! test
19484 Gallery with link that has fragment
19485 !! options
19486 parsoid={
19487 "modes": ["wt2html", "html2html"],
19488 "nativeGallery": true
19489 }
19490 !! wikitext
19491 <gallery>
19492 image:foobar.jpg|link=Main_Page
19493 image:foobar.jpg|link=Main_Page#section
19494 image:foobar.jpg|link=Main Page#section|caption
19495 </gallery>
19496 !! html/php
19497 <ul class="gallery mw-gallery-traditional">
19498 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19499 <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>
19500 <div class="gallerytext">
19501 </div>
19502 </div></li>
19503 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19504 <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>
19505 <div class="gallerytext">
19506 </div>
19507 </div></li>
19508 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19509 <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>
19510 <div class="gallerytext">
19511 <p>caption
19512 </p>
19513 </div>
19514 </div></li>
19515 </ul>
19516
19517 !! html/parsoid
19518 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
19519 <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>
19520 <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>
19521 <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>
19522 </ul>
19523 !! end
19524
19525 ## Whoops, Parsoid shouldn't be parsing templates in the attribute caption!
19526 !! test
19527 Gallery with template inside caption
19528 !! options
19529 parsoid={
19530 "nativeGallery": true
19531 }
19532 !! wikitext
19533 <gallery caption="{{echo|hi}}">
19534 File:Foobar.jpg|{{echo|ho}}
19535 </gallery>
19536 !! html/php
19537 <ul class="gallery mw-gallery-traditional">
19538 <li class='gallerycaption'>{{echo|hi}}</li>
19539 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19540 <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>
19541 <div class="gallerytext">
19542 <p>ho
19543 </p>
19544 </div>
19545 </div></li>
19546 </ul>
19547
19548 !! html/parsoid
19549 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt6" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
19550 <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>
19551 <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>
19552 </ul>
19553 !! end
19554
19555 !! test
19556 Gallery with wikitext inside caption
19557 !! options
19558 parsoid={
19559 "nativeGallery": true
19560 }
19561 !! wikitext
19562 <gallery>
19563 File:Foobar.jpg|alt=galleryalt|[[File:Foobar.jpg|alt=inneralt|20x20px|desc]]
19564 File:Foobar.jpg|alt=galleryalt|{{Test|unamedParam|alt=param}}
19565 </gallery>
19566 !! html/php
19567 <ul class="gallery mw-gallery-traditional">
19568 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19569 <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>
19570 <div class="gallerytext">
19571 <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>
19572 </p>
19573 </div>
19574 </div></li>
19575 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19576 <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>
19577 <div class="gallerytext">
19578 <p>This is a test template
19579 </p>
19580 </div>
19581 </div></li>
19582 </ul>
19583
19584 !! html/parsoid
19585 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt6" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
19586 <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>
19587 <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>
19588 </ul>
19589 !! end
19590
19591 !! test
19592 Gallery (with showfilename option)
19593 !! options
19594 parsoid={
19595 "nativeGallery": true
19596 }
19597 !! wikitext
19598 <gallery showfilename="">
19599 File:Nonexistent.jpg|caption
19600 File:Nonexistent.jpg
19601 File:Foobar.jpg|some '''caption''' [[Main Page]]
19602 File:Foobar.jpg
19603 </gallery>
19604 !! html/php
19605 <ul class="gallery mw-gallery-traditional">
19606 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19607 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
19608 <div class="gallerytext">
19609 <p><a href="/wiki/File:Nonexistent.jpg" class="galleryfilename galleryfilename-truncate" title="File:Nonexistent.jpg">Nonexistent.jpg</a>
19610 caption
19611 </p>
19612 </div>
19613 </div></li>
19614 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19615 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
19616 <div class="gallerytext">
19617 <p><a href="/wiki/File:Nonexistent.jpg" class="galleryfilename galleryfilename-truncate" title="File:Nonexistent.jpg">Nonexistent.jpg</a>
19618 </p>
19619 </div>
19620 </div></li>
19621 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19622 <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>
19623 <div class="gallerytext">
19624 <p><a href="/wiki/File:Foobar.jpg" class="galleryfilename galleryfilename-truncate" title="File:Foobar.jpg">Foobar.jpg</a>
19625 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
19626 </p>
19627 </div>
19628 </div></li>
19629 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19630 <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>
19631 <div class="gallerytext">
19632 <p><a href="/wiki/File:Foobar.jpg" class="galleryfilename galleryfilename-truncate" title="File:Foobar.jpg">Foobar.jpg</a>
19633 </p>
19634 </div>
19635 </div></li>
19636 </ul>
19637
19638 !! html/parsoid
19639 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt3" data-mw='{"name":"gallery","attrs":{"showfilename":""},"body":{}}'>
19640 <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>
19641 <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>
19642 <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>
19643 <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>
19644 </ul>
19645 !! end
19646
19647 ## Should Parsoid be preserving these variations?
19648 !! test
19649 Gallery (with namespace-less filenames)
19650 !! options
19651 parsoid={
19652 "modes": ["wt2html", "html2html"],
19653 "nativeGallery": true
19654 }
19655 !! wikitext
19656 <gallery>
19657 File:Nonexistent.jpg
19658 Nonexistent.jpg
19659 image:foobar.jpg
19660 foobar.jpg
19661 </gallery>
19662 !! html/php
19663 <ul class="gallery mw-gallery-traditional">
19664 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19665 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
19666 <div class="gallerytext">
19667 </div>
19668 </div></li>
19669 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19670 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
19671 <div class="gallerytext">
19672 </div>
19673 </div></li>
19674 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19675 <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>
19676 <div class="gallerytext">
19677 </div>
19678 </div></li>
19679 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19680 <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>
19681 <div class="gallerytext">
19682 </div>
19683 </div></li>
19684 </ul>
19685
19686 !! html/parsoid
19687 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
19688 <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>
19689 <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>
19690 <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>
19691 <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>
19692 </ul>
19693 !! end
19694
19695 !! test
19696 Gallery override link with WikiLink (T36852)
19697 !! options
19698 parsoid={
19699 "nativeGallery": true
19700 }
19701 !! wikitext
19702 <gallery>
19703 File:Foobar.jpg|alt=galleryalt|link=InterWikiLink
19704 </gallery>
19705 !! html/php
19706 <ul class="gallery mw-gallery-traditional">
19707 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19708 <div class="thumb" style="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>
19709 <div class="gallerytext">
19710 </div>
19711 </div></li>
19712 </ul>
19713
19714 !! html/parsoid
19715 <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":{}}'>
19716 <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>
19717 </ul>
19718 !! end
19719
19720 !! test
19721 Gallery override link with absolute external link (T36852)
19722 !! options
19723 parsoid={
19724 "nativeGallery": true
19725 }
19726 !! wikitext
19727 <gallery>
19728 File:Foobar.jpg|alt=galleryalt|link=http://www.example.org
19729 </gallery>
19730 !! html/php
19731 <ul class="gallery mw-gallery-traditional">
19732 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19733 <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>
19734 <div class="gallerytext">
19735 </div>
19736 </div></li>
19737 </ul>
19738
19739 !! html/parsoid
19740 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
19741 <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>
19742 </ul>
19743 !! end
19744
19745 !! test
19746 Gallery override link with absolute external link with LanguageConverter
19747 !! options
19748 language=zh
19749 !! input
19750 <gallery>
19751 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
19752 </gallery>
19753 !! result
19754 <ul class="gallery mw-gallery-traditional">
19755 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19756 <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>
19757 <div class="gallerytext">
19758 <p>caption
19759 </p>
19760 </div>
19761 </div></li>
19762 </ul>
19763
19764 !! end
19765
19766 !! test
19767 Gallery override link with malicious javascript (T36852)
19768 !! options
19769 parsoid={
19770 "modes": ["wt2html", "html2html"],
19771 "nativeGallery": true
19772 }
19773 !! wikitext
19774 <gallery>
19775 File:Foobar.jpg|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
19776 </gallery>
19777 !! html/php
19778 <ul class="gallery mw-gallery-traditional">
19779 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19780 <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>
19781 <div class="gallerytext">
19782 </div>
19783 </div></li>
19784 </ul>
19785
19786 !! html/parsoid
19787 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
19788 <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>
19789 </ul>
19790 !! end
19791
19792 !! test
19793 Gallery with invalid title as link (T45964)
19794 !! options
19795 parsoid={
19796 "modes": ["wt2html", "html2html"],
19797 "nativeGallery": true
19798 }
19799 !! wikitext
19800 <gallery>
19801 File:Foobar.jpg|link=<
19802 </gallery>
19803 !! html/php
19804 <ul class="gallery mw-gallery-traditional">
19805 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19806 <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>
19807 <div class="gallerytext">
19808 </div>
19809 </div></li>
19810 </ul>
19811
19812 !! html/parsoid
19813 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
19814 <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>
19815 </ul>
19816 !! end
19817
19818 !! test
19819 Serialize gallery without attrs in data-mw
19820 !! options
19821 parsoid={
19822 "modes": ["html2wt"],
19823 "nativeGallery": true
19824 }
19825 !! html/parsoid
19826 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","body":{}}'>
19827 <li class="gallerycaption">123</li>
19828 <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>
19829 </ul>
19830 !! wikitext
19831 <gallery caption="123">
19832 File:Test.png
19833 </gallery>
19834 !! end
19835
19836 !! test
19837 Gallery with class and style attributes
19838 !! options
19839 parsoid={
19840 "nativeGallery": true
19841 }
19842 !! wikitext
19843 <gallery class="center" style="text-align: center;">
19844 File:Foobar.jpg
19845 </gallery>
19846 !! html/php
19847 <ul class="gallery mw-gallery-traditional center" style="text-align: center;">
19848 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19849 <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>
19850 <div class="gallerytext">
19851 </div>
19852 </div></li>
19853 </ul>
19854
19855 !! html/parsoid
19856 <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":{}}'>
19857 <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>
19858 </ul>
19859 !! end
19860
19861 !! test
19862 Gallery in slideshow mode
19863 !! options
19864 parsoid={
19865 "nativeGallery": true
19866 }
19867 !! wikitext
19868 <gallery mode="slideshow" showthumbnails="">
19869 File:Foobar.jpg
19870 </gallery>
19871 !! html/php
19872 <ul class="gallery mw-gallery-slideshow" data-showthumbnails="1">
19873 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19874 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/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>
19875 <div class="gallerytext">
19876 </div>
19877 </div></li>
19878 </ul>
19879
19880 !! html/parsoid
19881 <ul class="gallery mw-gallery-slideshow" data-showthumbnails="1" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{"mode":"slideshow","showthumbnails":""},"body":{}}'>
19882 <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>
19883 </ul>
19884 !! end
19885
19886 !! test
19887 HTML Hex character encoding (spells the word "JavaScript")
19888 !! options
19889 parsoid=wt2html,wt2wt,html2html
19890 !! wikitext
19891 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
19892 !! html/php
19893 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
19894 </p>
19895 !! html/php+tidy
19896 <p>JavaScript</p>
19897 !! html/parsoid
19898 <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>
19899 !! end
19900
19901 !! test
19902 HTML Hex character encoding bogus encoding (T28437 regression check)
19903 !! wikitext
19904 &#xsee;&#XSEE;
19905 !! html/php
19906 <p>&amp;#xsee;&amp;#XSEE;
19907 </p>
19908 !! html/parsoid
19909 <p>&amp;#xsee;&amp;#XSEE;</p>
19910 !! end
19911
19912 !! test
19913 HTML Hex character encoding mixed case
19914 !! options
19915 parsoid=wt2html,wt2wt,html2html
19916 !! wikitext
19917 &#xEE;&#Xee;
19918 !! html/php
19919 <p>&#xee;&#xee;
19920 </p>
19921 !! html/php+tidy
19922 <p>îî</p>
19923 !! html/parsoid
19924 <p><span typeof="mw:Entity">î</span><span typeof="mw:Entity">î</span></p>
19925 !! end
19926
19927 # See: https://www.w3.org/TR/html5/syntax.html#character-references
19928 # Note that U+000C (form feed) is not a valid XML character, so
19929 # it is banned even though allowed in HTML5.
19930 !! test
19931 Illegal character references (T106578)
19932 !! wikitext
19933 ; Null: &#00;
19934 ; FF: &#xC;
19935 ; CR: &#xD;
19936 ; Control (low): &#8;
19937 ; Control (high): &#x7F; &#x9F;
19938 ; Surrogate: &#xD83D;&#xDCA9;
19939 ; This is an okay astral character: &#x1F4A9;
19940 !! html+tidy
19941 <dl>
19942 <dt>Null</dt>
19943 <dd>&amp;#00;</dd>
19944 <dt>FF</dt>
19945 <dd>&amp;#xC;</dd>
19946 <dt>CR</dt>
19947 <dd>&amp;#xD;</dd>
19948 <dt>Control (low)</dt>
19949 <dd>&amp;#8;</dd>
19950 <dt>Control (high)</dt>
19951 <dd>&amp;#x7F; &amp;#x9F;</dd>
19952 <dt>Surrogate</dt>
19953 <dd>&amp;#xD83D;&amp;#xDCA9;</dd>
19954 <dt>This is an okay astral character</dt>
19955 <dd>💩</dd>
19956 </dl>
19957 !! end
19958
19959 !! test
19960 __FORCETOC__ override
19961 !! wikitext
19962 __NEWSECTIONLINK__
19963 __FORCETOC__
19964 !! html/php
19965 <p><br />
19966 </p>
19967 !! end
19968
19969 !! test
19970 ISBN code coverage
19971 !! wikitext
19972 ISBN 978-0-1234-56&#x20;789
19973 !! html
19974 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
19975 </p>
19976 !! html+tidy
19977 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a> 789</p>
19978 !! html/parsoid
19979 <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>
19980 !! end
19981
19982 !! test
19983 ISBN followed by 5 spaces
19984 !! wikitext
19985 ISBN
19986 !! html
19987 <p>ISBN
19988 </p>
19989 !! end
19990
19991 !! test
19992 Double ISBN
19993 !! wikitext
19994 ISBN ISBN 1234567890
19995 !! html/php
19996 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
19997 </p>
19998 !! html/parsoid
19999 <p>ISBN <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a></p>
20000 !! end
20001
20002 # Uppercase X and lowercase x as well
20003 !! test
20004 ISBN with an X
20005 !! wikitext
20006 ISBN 3-462-04561-X
20007 ISBN 3-462-04561-x
20008 ISBN 080442957X
20009 ISBN 080442957x
20010 ISBN 978080442957X
20011 ISBN 978080442957x
20012 !! html/php
20013 <p><a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-X</a>
20014 <a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-x</a>
20015 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957X</a>
20016 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957x</a>
20017 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957X</a>
20018 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957x</a>
20019 </p>
20020 !! html/parsoid
20021 <p><a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-X</a>
20022 <a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-x</a>
20023 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957X</a>
20024 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957x</a>
20025 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957X</a>
20026 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957x</a></p>
20027 !! end
20028
20029 !! test
20030 ISBN with empty prefix (parsoid test)
20031 !! wikitext
20032 ISBN 1234567890
20033 !! html/php
20034 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
20035 </p>
20036 !! html/parsoid
20037 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink">ISBN 1234567890</a></p>
20038 !! end
20039
20040 !! test
20041 T24905: <abbr> followed by ISBN followed by </a>
20042 !! wikitext
20043 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
20044 !! html/php
20045 <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>
20046 </p>
20047 !! html/parsoid
20048 <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>
20049 !! end
20050
20051 !! test
20052 Double RFC
20053 !! wikitext
20054 RFC RFC 1234
20055 !! html
20056 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
20057 </p>
20058 !! end
20059
20060 !! test
20061 Double RFC with a wiki link
20062 !! wikitext
20063 RFC [[RFC 1234]]
20064 !! html
20065 <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>
20066 </p>
20067 !! end
20068
20069 !! test
20070 RFC code coverage
20071 !! wikitext
20072 RFC 983&#x20;987
20073 !! html
20074 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
20075 </p>
20076 !! html+tidy
20077 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a> 987</p>
20078 !! end
20079
20080 !! test
20081 Centre-aligned image
20082 !! wikitext
20083 [[Image:foobar.jpg|centre]]
20084 !! html
20085 <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>
20086
20087 !!end
20088
20089 !! test
20090 None-aligned image
20091 !! wikitext
20092 [[Image:foobar.jpg|none]]
20093 !! html
20094 <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>
20095
20096 !!end
20097
20098 !! test
20099 Width + Height sized image (using px) (height is ignored)
20100 !! wikitext
20101 [[Image:foobar.jpg|640x480px]]
20102 !! html
20103 <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>
20104 </p>
20105 !!end
20106
20107 !! test
20108 Width-sized image (using px, no following whitespace)
20109 !! wikitext
20110 [[Image:foobar.jpg|640px]]
20111 !! html
20112 <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>
20113 </p>
20114 !!end
20115
20116 !! test
20117 Width-sized image (using px, with following whitespace - test regression from r39467)
20118 !! wikitext
20119 [[Image:foobar.jpg|640px ]]
20120 !! html
20121 <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>
20122 </p>
20123 !!end
20124
20125 !! test
20126 Width-sized image (using px, with preceding whitespace - test regression from r39467)
20127 !! wikitext
20128 [[Image:foobar.jpg| 640px]]
20129 !! html
20130 <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>
20131 </p>
20132 !!end
20133
20134 !! test
20135 Image with page parameter
20136 !! options
20137 djvu
20138 !! wikitext
20139 [[File:LoremIpsum.djvu|page=2]]
20140 !! html/php
20141 <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>
20142 </p>
20143 !! html/parsoid
20144 <p><span class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"page","ak":"page=2"}]}' data-mw='{"page":"2"}'><a href="./File:LoremIpsum.djvu" data-parsoid='{"a":{"href":"./File:LoremIpsum.djvu"},"sa":{"href":"File:LoremIpsum.djvu"}}'><img resource="./File:LoremIpsum.djvu" src="//example.com/images/5/5f/LoremIpsum.djvu" data-file-width="2480" data-file-height="3508" data-file-type="bitmap" height="3508" width="2480" data-parsoid='{"a":{"resource":"./File:LoremIpsum.djvu","height":"3508","width":"2480"},"sa":{"resource":"File:LoremIpsum.djvu"}}'/></a></span></p>
20145 !! end
20146
20147 !! test
20148 Another italics / bold test
20149 !! wikitext
20150 ''' ''x'
20151 !! html
20152 <pre>'<i> </i>x'
20153 </pre>
20154 !!end
20155
20156 # FIXME: The php output seems broken. It's interleaving some open/close tags.
20157 !! test
20158 dt/dd/dl test
20159 !! wikitext
20160 :;;;::
20161 !! html/php
20162 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dt></dl></dd></dl></dd></dl></dd></dl></dd></dl></dd></dl>
20163
20164 !! html/parsoid
20165 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dd></dl></dd></dl></dt></dl></dt></dl></dt></dl></dd></dl>
20166
20167 !!end
20168
20169 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
20170 !! test
20171 Images with the "|" character in the comment
20172 !! wikitext
20173 [[File:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
20174 !! html/php
20175 <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>
20176
20177 !! html/parsoid
20178 <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>
20179 !! end
20180
20181 !! test
20182 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
20183 !! wikitext
20184 <html><script>alert(1);</script></html>
20185 !! html
20186 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
20187 </p>
20188 !! end
20189
20190 !! test
20191 HTML with raw HTML ($wgRawHtml==true)
20192 !! options
20193 wgRawHtml=1
20194 !! wikitext
20195 <html><script>alert(1);</script></html>
20196 !! html
20197 <p><script>alert(1);</script>
20198 </p>
20199 !! end
20200
20201 !! test
20202 Parents of subpages, one level up
20203 !! options
20204 subpage title=[[Subpage test/L1/L2/L3]]
20205 !! wikitext
20206 [[../|L2]]
20207 !! html
20208 <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>
20209 </p>
20210 !! end
20211
20212
20213 !! test
20214 Parents of subpages, one level up, not named
20215 !! options
20216 subpage title=[[Subpage test/L1/L2/L3]]
20217 !! wikitext
20218 [[../]]
20219 !! html
20220 <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>
20221 </p>
20222 !! end
20223
20224
20225
20226 !! test
20227 Parents of subpages, two levels up
20228 !! options
20229 subpage title=[[Subpage test/L1/L2/L3]]
20230 !! wikitext
20231 [[../../|L1]]2
20232
20233 [[../../|L1]]l
20234 !! html
20235 <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
20236 </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>
20237 </p>
20238 !! end
20239
20240 !! test
20241 Parents of subpages, two levels up, without trailing slash or name.
20242 !! options
20243 subpage title=[[Subpage test/L1/L2/L3]]
20244 !! wikitext
20245 [[../..]]
20246 !! html
20247 <p>[[../..]]
20248 </p>
20249 !! end
20250
20251 !! test
20252 Parents of subpages, two levels up, with lots of extra trailing slashes.
20253 !! options
20254 subpage title=[[Subpage test/L1/L2/L3]]
20255 !! wikitext
20256 [[../../////]]
20257 !! html
20258 <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>
20259 </p>
20260 !! end
20261
20262 !! article
20263 Subpage test/L1/L2/L3Sibling
20264 !! text
20265 Sibling article
20266 !! endarticle
20267
20268 !! test
20269 Transclusion of a sibling page (one level up)
20270 !! options
20271 subpage title=[[Subpage test/L1/L2/L3]]
20272 !! wikitext
20273 {{../L3Sibling}}
20274 !! html
20275 <p>Sibling article
20276 </p>
20277 !! end
20278
20279 !! test
20280 Transclusion of a child page
20281 !! options
20282 subpage title=[[Subpage test/L1/L2]]
20283 !! wikitext
20284 {{/L3Sibling}}
20285 !! html
20286 <p>Sibling article
20287 </p>
20288 !! end
20289
20290 # This is wt2html only in Parsoid because we add <nowiki>
20291 # because of {{..}} and we don't expect to fix that to
20292 # eliminate the nowikis selective for {{..}} markup.
20293 !! test
20294 Non-transclusion because of too many up levels
20295 !! options
20296 subpage title=[[Subpage test/L1/L2/L3]]
20297 parsoid=wt2html
20298 !! wikitext
20299 {{../../../../More than parent}}
20300 !! html/php
20301 <p>{{../../../../More than parent}}
20302 </p>
20303 !! html/parsoid
20304 <p>{{../../../../More than parent}}</p>
20305 !! end
20306
20307 !! test
20308 Definition list code coverage
20309 !! wikitext
20310 ; title : def
20311 ; title : def
20312 ;title: def
20313 !! html/php
20314 <dl><dt> title &#160;</dt>
20315 <dd> def</dd>
20316 <dt> title&#160;</dt>
20317 <dd> def</dd>
20318 <dt>title</dt>
20319 <dd> def</dd></dl>
20320
20321 !! html/parsoid
20322 <dl><dt> title <span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
20323 <dt> title<span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
20324 <dt>title</dt><dd> def</dd></dl>
20325 !! end
20326
20327 !! test
20328 Don't fall for the self-closing div
20329 !! wikitext
20330 <div>hello world</div/>
20331 !! html
20332 <div>hello world</div>
20333
20334 !! end
20335
20336 !! test
20337 MSGNW magic word
20338 !! wikitext
20339 {{MSGNW:msg}}
20340 !! html/php
20341 <p>&#91;&#91;:Template:Msg&#93;&#93;
20342 </p>
20343 !! end
20344
20345 !! test
20346 RAW magic word
20347 !! wikitext
20348 {{RAW:QUERTY}}
20349 !! html
20350 <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>
20351 </p>
20352 !! end
20353
20354 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
20355 !! test
20356 Always escape literal '>' in output, not just after '<'
20357 !! wikitext
20358 ><>
20359 !! html
20360 <p>&gt;&lt;&gt;
20361 </p>
20362 !! end
20363
20364 !! test
20365 Template caching
20366 !! wikitext
20367 {{Test}}
20368 {{Test}}
20369 !! html
20370 <p>This is a test template
20371 This is a test template
20372 </p>
20373 !! end
20374
20375
20376 !! article
20377 MediaWiki:Fake
20378 !! text
20379 ==header==
20380 !! endarticle
20381
20382 !! test
20383 Inclusion of !userCanEdit() content
20384 !! wikitext
20385 {{MediaWiki:Fake}}
20386 !! html
20387 <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>
20388
20389 !! end
20390
20391
20392 !! test
20393 Out-of-order TOC heading levels
20394 !! wikitext
20395 ==2==
20396 ======6======
20397 ===3===
20398 =1=
20399 =====5=====
20400 ==2==
20401 !! html
20402 <div id="toc" class="toc"><div id="toctitle" class="toctitle"><h2>Contents</h2></div>
20403 <ul>
20404 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
20405 <ul>
20406 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
20407 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
20408 </ul>
20409 </li>
20410 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
20411 <ul>
20412 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
20413 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
20414 </ul>
20415 </li>
20416 </ul>
20417 </div>
20418
20419 <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>
20420 <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>
20421 <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>
20422 <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>
20423 <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>
20424 <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>
20425
20426 !! end
20427
20428
20429 !! test
20430 ISBN with a dummy number
20431 !! wikitext
20432 ISBN ---
20433 !! html
20434 <p>ISBN ---
20435 </p>
20436 !! end
20437
20438
20439 !! test
20440 ISBN with space-delimited number
20441 !! wikitext
20442 ISBN 92 9017 032 8
20443 !! html/php
20444 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
20445 </p>
20446 !! html/parsoid
20447 <p data-parsoid='{"dsr":[0,18,0,0]}'><a href="./Special:BookSources/9290170328" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink","dsr":[0,18,2,2]}'>ISBN 92 9017 032 8</a></p>
20448 !! end
20449
20450
20451 !! test
20452 ISBN with multiple spaces, no number
20453 !! wikitext
20454 ISBN foo
20455 !! html
20456 <p>ISBN foo
20457 </p>
20458 !! end
20459
20460
20461 !! test
20462 ISBN length
20463 !! wikitext
20464 ISBN 123456789
20465
20466 ISBN 1234567890
20467
20468 ISBN 12345678901
20469 !! html/php
20470 <p>ISBN 123456789
20471 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
20472 </p><p>ISBN 12345678901
20473 </p>
20474 !! html/parsoid
20475 <p>ISBN 123456789</p>
20476
20477 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a></p>
20478
20479 <p>ISBN 12345678901</p>
20480 !! end
20481
20482
20483 !! test
20484 ISBN with trailing year (T9110)
20485 !! wikitext
20486 ISBN 1-234-56789-0 - 2006
20487
20488 ISBN 1 234 56789 0 - 2006
20489 !! html/php
20490 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
20491 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
20492 </p>
20493 !! html/parsoid
20494 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1-234-56789-0</a> - 2006</p>
20495
20496 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1 234 56789 0</a> - 2006</p>
20497 !! end
20498
20499
20500 !! test
20501 anchorencode
20502 !! wikitext
20503 {{anchorencode:foo bar©#%n}}
20504 !! html
20505 <p>foo_bar.C2.A9.23.25n
20506 </p>
20507 !! end
20508
20509 !! test
20510 anchorencode trims spaces
20511 !! wikitext
20512 {{anchorencode: __pretty__please__}}
20513 !! html
20514 <p>pretty_please
20515 </p>
20516 !! end
20517
20518 !! test
20519 anchorencode deals with links
20520 !! wikitext
20521 {{anchorencode: [[hello|world]] [[hi]]}}
20522 !! html
20523 <p>world_hi
20524 </p>
20525 !! end
20526
20527 !! test
20528 anchorencode deals with templates
20529 !! wikitext
20530 {{anchorencode: {{Foo}} }}
20531 !! html
20532 <p>FOO
20533 </p>
20534 !! end
20535
20536 !! test
20537 anchorencode encodes like the TOC generator: (T20431)
20538 !! wikitext
20539 === _ +:.3A%3A&&amp;]] ===
20540 {{anchorencode: _ +:.3A%3A&&amp;]] }}
20541 __NOEDITSECTION__
20542 !! html
20543 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
20544 <p>.2B:.3A.253A.26.26.5D.5D
20545 </p>
20546 !! end
20547
20548 !! test
20549 T8200: blockquotes and paragraph formatting
20550 !! wikitext
20551 <blockquote>
20552 foo
20553 </blockquote>
20554
20555 bar
20556
20557 baz
20558 !! html
20559 <blockquote>
20560 <p>foo
20561 </p>
20562 </blockquote>
20563 <p>bar
20564 </p>
20565 <pre>baz
20566 </pre>
20567 !! end
20568
20569 !! test
20570 T10293: Use of center tag ruins paragraph formatting
20571 !! wikitext
20572 <center>
20573 foo
20574 </center>
20575
20576 bar
20577
20578 baz
20579 !! html
20580 <center>
20581 <p>foo
20582 </p>
20583 </center>
20584 <p>bar
20585 </p>
20586 <pre>baz
20587 </pre>
20588 !! end
20589
20590 !!test
20591 Parsing of overlapping (improperly nested) inline html tags
20592 !! wikitext
20593 <span><s>x</span></s>
20594 !! html/php
20595 <p><span><s>x&lt;/span&gt;</s></span>
20596 </p>
20597 !! html/parsoid
20598 <p><span><s>x</s></span>
20599 </p>
20600 !!end
20601
20602 ###
20603 ### Language variants related tests
20604 ###
20605 !! test
20606 Self-link in language variants
20607 !! options
20608 title=[[Dunav]] language=sr
20609 !! wikitext
20610 Both [[Dunav]] and [[Дунав]] are names for this river.
20611 !! html
20612 <p>Both <a class="mw-selflink selflink">Dunav</a> and <a class="mw-selflink selflink">Дунав</a> are names for this river.
20613 </p>
20614 !!end
20615
20616 !! article
20617 Дуна
20618 !! text
20619 content
20620 !! endarticle
20621
20622 !! test
20623 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
20624 !! options
20625 title=[[Duna]] language=sr
20626 !! wikitext
20627 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
20628 !! html
20629 <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.
20630 </p>
20631 !! end
20632
20633 !! test
20634 Link to a section of a variant of this title shouldn't be parsed as self-link
20635 !! options
20636 title=[[Duna]] language=sr
20637 !! wikitext
20638 [[Dуна]] is a self-link while [[Dunа#Foo]] and [[Dуна#Foo]] are not self-links.
20639 !! html
20640 <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.
20641 </p>
20642 !! end
20643
20644 !! test
20645 Link to pages in language variants
20646 !! options
20647 language=sr
20648 !! wikitext
20649 Main Page can be written as [[Маин Паге]]
20650 !! html
20651 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
20652 </p>
20653 !!end
20654
20655
20656 !! test
20657 Multiple links to pages in language variants
20658 !! options
20659 language=sr
20660 !! wikitext
20661 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
20662 !! html
20663 <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>.
20664 </p>
20665 !!end
20666
20667
20668 !! test
20669 Simple template in language variants
20670 !! options
20671 language=sr
20672 !! wikitext
20673 {{тест}}
20674 !! html
20675 <p>This is a test template
20676 </p>
20677 !! end
20678
20679
20680 !! test
20681 Template with explicit namespace in language variants
20682 !! options
20683 language=sr
20684 !! wikitext
20685 {{Template:тест}}
20686 !! html
20687 <p>This is a test template
20688 </p>
20689 !! end
20690
20691
20692 !! test
20693 Basic test for template parameter in language variants
20694 !! options
20695 language=sr
20696 !! wikitext
20697 {{парамтест|param=foo}}
20698 !! html
20699 <p>This is a test template with parameter foo
20700 </p>
20701 !! end
20702
20703 !! test
20704 Simple category in language variants
20705 !! options
20706 language=sr cat
20707 !! wikitext
20708 [[Category:МедиаWики Усер'с Гуиде]]
20709 !! html/php
20710 cat=МедиаWики_Усер'с_Гуиде sort=
20711 !! html/parsoid
20712 <link rel="mw:PageProp/Category" href="./Категорија:МедиаWики_Усер'с_Гуиде" data-parsoid='{"stx":"simple","a":{"href":"./Категорија:МедиаWики_Усер&#39;с_Гуиде"},"sa":{"href":"Category:МедиаWики Усер&#39;с Гуиде"}}'/>
20713 !! end
20714
20715 !! article
20716 Category:分类
20717 !! text
20718 blah
20719 !! endarticle
20720
20721 !! article
20722 Category:分類
20723 !! text
20724 blah
20725 !! endarticle
20726
20727 ## We used to, but no longer wt2wt this test since the default serializer
20728 ## will normalize all categories to serialize on their own line.
20729 ## This wikitext usage is going to be fairly uncommon in production and
20730 ## selser will take care of preserving formatting in those scenarios.
20731 !! test
20732 Don't convert blue categorylinks to another variant (T35210)
20733 !! options
20734 cat
20735 language=zh
20736 parsoid=wt2html
20737 !! wikitext
20738 [[A]][[Category:分类]]
20739 !! html/php
20740 cat=分类 sort=
20741 !! html/parsoid
20742 <p><a rel="mw:WikiLink" href="./A" title="A">A</a></p>
20743 <link rel="mw:PageProp/Category" href="./Category:分类"/>
20744 !! end
20745
20746 !! test
20747 Stripping -{}- tags (language variants)
20748 !! options
20749 language=sr
20750 !! wikitext
20751 Latin proverb: -{Ne nuntium necare}-
20752 !! html
20753 <p>Latin proverb: Ne nuntium necare
20754 </p>
20755 !! end
20756
20757
20758 !! test
20759 Prevent conversion with -{}- tags (language variants)
20760 !! options
20761 language=sr variant=sr-ec
20762 !! wikitext
20763 Latinski: -{Ne nuntium necare}-
20764 !! html
20765 <p>Латински: Ne nuntium necare
20766 </p>
20767 !! end
20768
20769
20770 !! test
20771 Prevent conversion of text with -{}- tags (language variants)
20772 !! options
20773 language=sr variant=sr-ec
20774 !! wikitext
20775 Latinski: -{Ne nuntium necare}-
20776 !! html
20777 <p>Латински: Ne nuntium necare
20778 </p>
20779 !! end
20780
20781
20782 !! test
20783 Prevent conversion of links with -{}- tags (language variants)
20784 !! options
20785 language=sr variant=sr-ec
20786 !! wikitext
20787 -{[[Main Page]]}-
20788 !! html
20789 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
20790 </p>
20791 !! end
20792
20793
20794 !! test
20795 -{}- tags within headlines (within html for parserConvert())
20796 !! options
20797 language=sr variant=sr-ec
20798 !! wikitext
20799 == -{Naslov}- ==
20800 !! html
20801 <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>
20802
20803 !! end
20804
20805
20806 !! test
20807 Explicit definition of language variant alternatives
20808 !! options
20809 language=zh variant=zh-tw
20810 !! wikitext
20811 -{zh:China;zh-tw:Taiwan}-, not China
20812 !! html
20813 <p>Taiwan, not China
20814 </p>
20815 !! end
20816
20817
20818 !! test
20819 Conversion around HTML tags
20820 !! options
20821 language=sr variant=sr-ec
20822 !! wikitext
20823 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
20824 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
20825 !! html
20826 <p>
20827 <span title="ЛаCтин">ски</span>
20828 </p>
20829 !! end
20830
20831
20832 !! test
20833 Explicit session-wise language variant mapping (A flag and - flag)
20834 !! options
20835 language=zh variant=zh-tw
20836 !! wikitext
20837 Taiwan is not China.
20838 But -{A|zh:China;zh-tw:Taiwan}- is China,
20839 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
20840 and -{China}- is China.
20841 !! html
20842 <p>Taiwan is not China.
20843 But Taiwan is Taiwan,
20844 (This should be stripped!)
20845 and China is China.
20846 </p>
20847 !! end
20848
20849 !! test
20850 Explicit session-wise language variant mapping (H flag for hide)
20851 !! options
20852 language=zh variant=zh-tw
20853 !! wikitext
20854 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
20855 Taiwan is China.
20856 !! html
20857 <p>(This should be stripped!)
20858 Taiwan is Taiwan.
20859 </p>
20860 !! end
20861
20862 !! test
20863 Adding explicit conversion rule for title (T flag)
20864 !! options
20865 language=zh variant=zh-tw showtitle
20866 !! wikitext
20867 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
20868 !! html
20869 Taiwan
20870 <p>Should be stripped!
20871 </p>
20872 !! end
20873
20874 !! test
20875 Testing that changing the language variant here in the tests actually works
20876 !! options
20877 language=zh variant=zh showtitle
20878 !! wikitext
20879 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
20880 !! html
20881 China
20882 <p>Should be stripped!
20883 </p>
20884 !! end
20885
20886 !! test
20887 Recursive conversion of alt and title attrs shouldn't clear converter state
20888 !! options
20889 language=zh variant=zh-cn showtitle
20890 !! wikitext
20891 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
20892 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
20893 !! html
20894 China
20895 <p>
20896 Should be stripped<span title="Exclamation">!</span>
20897 </p>
20898 !! end
20899
20900 !! test
20901 T26072: more test on conversion rule for title
20902 !! options
20903 language=zh variant=zh-tw showtitle
20904 !! wikitext
20905 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
20906 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
20907 !! html
20908 Taiwan
20909 <p>This should be stripped!
20910 This won't take interferes with the title rule.
20911 </p>
20912 !! end
20913
20914 !! test
20915 Partly disable title conversion if variant == main language code
20916 !! options
20917 language=zh variant=zh title=[[ZH]] showtitle
20918 !! wikitext
20919 -{T|zh-cn:CN;zh-tw:TW}-
20920 !! html
20921 ZH
20922 <p>
20923 </p>
20924 !! end
20925
20926 !! test
20927 Partly disable title conversion if variant == main language code, more
20928 !! options
20929 language=zh variant=zh title=[[ZH]] showtitle
20930 !! wikitext
20931 -{T|TW}-
20932 !! html
20933 ZH
20934 <p>
20935 </p>
20936 !! end
20937
20938 !! test
20939 Raw output of variant escape tags (R flag)
20940 !! options
20941 language=zh variant=zh-tw
20942 !! wikitext
20943 Raw: -{R|zh:China;zh-tw:Taiwan}-
20944 !! html
20945 <p>Raw: zh:China;zh-tw:Taiwan
20946 </p>
20947 !! end
20948
20949 !! test
20950 Strings evaluating false shouldn't be ignored by Language converter (T51072)
20951 !! options
20952 language=zh variant=zh-cn
20953 !! input
20954 -{zh-cn:0;zh-sg:1;zh-tw:2;zh-hk:3}-
20955 !! result
20956 <p>0
20957 </p>
20958 !! end
20959
20960 !! test
20961 Conversion rules from [numeric-only string] to [something else] (T48634)
20962 !! options
20963 language=zh variant=zh-cn
20964 !! input
20965 -{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
20966 !! result
20967 <p>D12345EE12345
20968 </p>
20969 !! end
20970
20971 !! test
20972 Bidirectional converter rule entries with an empty value should be ignored (T53551)
20973 !! options
20974 language=zh variant=zh-cn
20975 !! input
20976 -{H|zh-cn:foo;zh-tw:;}-foobar
20977 !! result
20978 <p>foobar
20979 </p>
20980 !! end
20981
20982 !! test
20983 Unidirectional converter rule entries with an empty "from" string should be ignored (T53551)
20984 !! options
20985 language=zh variant=zh-cn
20986 !! input
20987 -{H|=>zh-cn:foo;}-foobar
20988 !! result
20989 <p>foobar
20990 </p>
20991 !! end
20992
20993 !! test
20994 Empty converter rule entries shouldn't be inserted into the conversion table (T53551)
20995 !! options
20996 language=zh variant=zh-cn
20997 !! input
20998 -{H|}-foobar
20999 !! result
21000 <p>foobar
21001 </p>
21002 !! end
21003
21004 !! test
21005 Nested using of manual convert syntax
21006 !! options
21007 language=zh variant=zh-hk
21008 !! wikitext
21009 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
21010 !! html
21011 <p>Nested: Hello Hong Kong!
21012 </p>
21013 !! end
21014
21015 !! test
21016 HTML markups with conversion syntax in attribs, nested in other conversion blocks
21017 !! options
21018 language=zh variant=zh-cn
21019 !! wikitext
21020 -{zh;zh-hans;zh-hant|<span title="-{X}-">A</span>}-
21021 !! html
21022 <p><span title="X">A</span>
21023 </p>
21024 !! end
21025
21026 !! test
21027 HTML markups with conversion syntax in attribs, nested in other conversion blocks (not working yet)
21028 !! options
21029 language=zh variant=zh-cn disabled
21030 !! wikitext
21031 -{<span title="-{X}-">A</span>}-
21032 !! html
21033 <p><span title="X">A</span>
21034 </p>
21035 !! end
21036
21037 # Since Parsoid is starting to emit canonical wikitext for links,
21038 # [http://example.com http://example.com] will not RT back to that
21039 # form anymore.
21040 !! test
21041 Proper conversion of text in external links
21042 !! options
21043 language=sr variant=sr-ec
21044 parsoid=wt2html
21045 !! wikitext
21046 http://www.google.com
21047 gopher://www.google.com
21048 [http://www.google.com http://www.google.com]
21049 [gopher://www.google.com gopher://www.google.com]
21050 [https://www.google.com irc://www.google.com]
21051 [ftp://www.google.com www.google.com/ftp://dir]
21052 [//www.google.com www.google.com]
21053 !! html/php
21054 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
21055 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
21056 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
21057 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
21058 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
21059 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
21060 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
21061 </p>
21062 !! html/parsoid
21063 <p><a rel="mw:ExtLink" href="http://www.google.com">http://www.google.com</a>
21064 <a rel="mw:ExtLink" href="gopher://www.google.com">gopher://www.google.com</a>
21065 <a rel="mw:ExtLink" href="http://www.google.com">http://www.google.com</a>
21066 <a rel="mw:ExtLink" href="gopher://www.google.com">gopher://www.google.com</a>
21067 <a rel="mw:ExtLink" href="https://www.google.com">irc://www.google.com</a>
21068 <a rel="mw:ExtLink" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
21069 <a rel="mw:ExtLink" href="//www.google.com">www.гоогле.цом</a></p>
21070 !! end
21071
21072 !! test
21073 Do not convert roman numbers to language variants
21074 !! options
21075 language=sr variant=sr-ec
21076 !! wikitext
21077 Fridrih IV je car.
21078 !! html
21079 <p>Фридрих IV је цар.
21080 </p>
21081 !! end
21082
21083 !! test
21084 Unclosed language converter markup "-{"
21085 !! options
21086 language=sr
21087 !! wikitext
21088 -{T|hello
21089 !! html
21090 <p>-{T|hello
21091 </p>
21092 !! end
21093
21094 !! test
21095 Don't convert raw rule "-{R|=&gt;}-" to "=>"
21096 !! options
21097 language=sr
21098 !! wikitext
21099 -{R|=&gt;}-
21100 !! html
21101 <p>=&gt;
21102 </p>
21103 !!end
21104
21105 !! test
21106 Don't break link parsing if language converter markup is in the caption.
21107 !! options
21108 language=sr variant=sr-ec
21109 !! wikitext
21110 [[Main Page|-{R|main page}-]]
21111 !! html
21112 <p><a href="/wiki/Main_Page" title="Маин Паге">main page</a>
21113 </p>
21114 !! end
21115
21116 # FIXME: This test is currently broken in the PHP parser T153761
21117 !! test
21118 T146304: Don't break template parsing if language converter markup is in the parameter.
21119 !! options
21120 language=sr variant=sr-ec
21121 disabled
21122 !! wikitext
21123 {{echo|-{R|foo}-}}
21124 !! html/php
21125 <p>foo
21126 </p>
21127 !! end
21128
21129 !! test
21130 T146305: Don't break image parsing if language converter markup is in the caption.
21131 !! options
21132 language=sr
21133 !! wikitext
21134 [[File:Foobar.jpg|thumb|-{R|caption:}-]]
21135 !! html/php
21136 <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>
21137
21138 !! html/parsoid
21139 <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>
21140 !! end
21141
21142 !! test
21143 T146305: Don't break image parsing if nested language converter markup is in the caption.
21144 !! options
21145 language=zh variant=zh-cn
21146 !! wikitext
21147 [[File:Foobar.jpg|thumb|-{zh-cn:blog (hk: -{zh-hans|WEBJOURNAL}-, tw: -{zh-hans|WEBLOG}-)}-]]
21148 !! html/php
21149 <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>
21150
21151 !! html/parsoid
21152 <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>
21153 !! end
21154
21155 !! test
21156 Don't break gallery if language converter markup is inside.
21157 !! options
21158 language=zh
21159 !! wikitext
21160 <gallery>
21161 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=-{R|foo}-|-{R|bar}-]]|alt=-{R|bat}-
21162 File:foobar.jpg|{{Test|unamedParam|alt=-{R|param}-}}|alt=galleryalt
21163 </gallery>
21164 !! html
21165 <ul class="gallery mw-gallery-traditional">
21166 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21167 <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>
21168 <div class="gallerytext">
21169 <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>
21170 </p>
21171 </div>
21172 </div></li>
21173 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21174 <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>
21175 <div class="gallerytext">
21176 <p>This is a test template
21177 </p>
21178 </div>
21179 </div></li>
21180 </ul>
21181
21182 !! end
21183
21184 !! test
21185 T153135: Don't break list handling if language converter markup is in the item.
21186 !! options
21187 language=zh variant=zh-cn
21188 !! wikitext
21189 ;-{zh-cn:AAA;zh-tw:BBB}-
21190 ;-{R|foo:bar}-
21191 !! html/php
21192 <dl><dt>AAA</dt>
21193 <dt>foo:bar</dt></dl>
21194
21195 !! html/parsoid
21196 <dl>
21197 <dt><span typeof="mw:LanguageVariant" data-mw='{"bidir":[{"l":"zh-cn","t":"AAA"},{"l":"zh-tw","t":"BBB"}],"show":true}'></span></dt>
21198 <dt><span typeof="mw:LanguageVariant" data-mw='{"disabled":true,"show":true,"text":"foo:bar"}'></span></dt>
21199 </dl>
21200 !! end
21201
21202 // Note that parsoid does not protect colons unless language converter
21203 // markup is properly nested, because it is a backtracking parser.
21204 !! test
21205 T153135: Unclosed markup in definition list (code coverage)
21206 !! options
21207 language=zh variant=zh-cn
21208 !! wikitext
21209 ;<b>foo:bar
21210 ;-{zh-cn:AAA
21211 !! html/php
21212 <dl><dt><b>foo:bar</dt>
21213 <dt>-{zh-cn:AAA</b></dt></dl>
21214
21215 !! html/parsoid
21216 <dl>
21217 <dt><b>foo:bar</b></dt>
21218 <b>
21219 <dt>-{zh-cn</dt>
21220 <dd>AAA</dd>
21221 </b></dl>
21222 !! end
21223
21224 !! test
21225 T153135: Nested language converter markup in definition list (code coverage)
21226 !! options
21227 language=zh variant=zh-cn
21228 !! wikitext
21229 ;-{zh-cn:AAA -{zh-hans|foo:bar}- -{R|bat:baz}-}-:def
21230 !! html/php
21231 <dl><dt>AAA foo:bar bat:baz</dt>
21232 <dd>def</dd></dl>
21233
21234 !! html/parsoid
21235 <dl>
21236 <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>
21237 <dd>def</dd>
21238 </dl>
21239 !! end
21240
21241 !! test
21242 T153140: Don't break table handling if language converter markup is in the cell.
21243 !! options
21244 language=sr variant=sr-ec
21245 !! wikitext
21246 {|
21247 |-
21248 | -{R|B}-
21249 |}
21250 !! html/php
21251 <table>
21252
21253 <tr>
21254 <td> B
21255 </td></tr></table>
21256
21257 !! html/parsoid
21258 <table>
21259
21260 <tr>
21261 <td> B
21262 </td></tr></table>
21263
21264 !! end
21265
21266 !! test
21267 T2529: Uncovered bullet
21268 !! wikitext
21269 * Foo {{bullet}}
21270 !! html
21271 <ul><li> Foo </li>
21272 <li> Bar</li></ul>
21273
21274 !! end
21275
21276 # Plain MediaWiki does not remove empty lists, but tidy actually does.
21277 # Templates in Wikipedia rely on this behavior, as tidy has always been
21278 # enabled there. These tests are normally run *without* tidy, so specify the
21279 # full output here.
21280 # To test realistic parsing behavior, apply a tidy-like transformation to both
21281 # the expected output and your parser's output.
21282 !! test
21283 T2529: Uncovered bullet leaving empty list, normally removed by tidy
21284 !! wikitext
21285 ******* Foo {{bullet}}
21286 !! html
21287 <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>
21288 <li> Bar</li></ul>
21289
21290 !! end
21291
21292 !! test
21293 T2529: Uncovered table already at line-start
21294 !! wikitext
21295 x
21296
21297 {{table}}
21298 y
21299 !! html
21300 <p>x
21301 </p>
21302 <table>
21303 <tr>
21304 <td> 1 </td>
21305 <td> 2
21306 </td></tr>
21307 <tr>
21308 <td> 3 </td>
21309 <td> 4
21310 </td></tr></table>
21311 <p>y
21312 </p>
21313 !! end
21314
21315 !! test
21316 T2529: Uncovered bullet in parser function result
21317 !! wikitext
21318 * Foo {{lc:{{bullet}} }}
21319 !! html
21320 <ul><li> Foo </li>
21321 <li> bar</li></ul>
21322
21323 !! end
21324
21325 !! test
21326 T7678: Double-parsed template argument
21327 !! wikitext
21328 {{lc:{{{1}}}|hello}}
21329 !! html
21330 <p>{{{1}}}
21331 </p>
21332 !! end
21333
21334 !! test
21335 T7678: Double-parsed template invocation
21336 !! wikitext
21337 {{lc:{{paramtest {{!}} param = hello }} }}
21338 !! html
21339 <p>{{paramtest | param = hello }}
21340 </p>
21341 !! end
21342
21343 !! test
21344 Case insensitivity of parser functions for non-ASCII characters (T10143)
21345 !! options
21346 language=cs
21347 title=[[Main Page]]
21348 !! wikitext
21349 {{PRVNÍVELKÉ:ěščř}}
21350 {{prvnívelké:ěščř}}
21351 {{PRVNÍMALÉ:ěščř}}
21352 {{prvnímalé:ěščř}}
21353 {{MALÁ:ěščř}}
21354 {{malá:ěščř}}
21355 {{VELKÁ:ěščř}}
21356 {{velká:ěščř}}
21357 !! html
21358 <p>Ěščř
21359 Ěščř
21360 ěščř
21361 ěščř
21362 ěščř
21363 ěščř
21364 ĚŠČŘ
21365 ĚŠČŘ
21366 </p>
21367 !! end
21368
21369 !! test
21370 Morwen/13: Unclosed link followed by heading
21371 !! wikitext
21372 [[link
21373 ==heading==
21374 !! html
21375 <p>[[link
21376 </p>
21377 <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>
21378
21379 !! end
21380
21381 !! test
21382 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
21383 !! wikitext
21384 {{foo|
21385 =heading=
21386 !! html
21387 <p>{{foo|
21388 </p>
21389 <h1><span class="mw-headline" id="heading">heading</span></h1>
21390
21391 !! end
21392
21393 !! test
21394 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
21395 !! wikitext
21396 {{foo|
21397 ==heading==
21398 !! html
21399 <p>{{foo|
21400 </p>
21401 <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>
21402
21403 !! end
21404
21405 !! test
21406 Tildes in comments
21407 !! options
21408 pst
21409 !! wikitext
21410 <!-- ~~~~ -->
21411 !! html/php
21412 <!-- ~~~~ -->
21413 !! end
21414
21415 !! test
21416 Paragraphs inside divs (no extra line breaks)
21417 !! wikitext
21418 <div>Line one
21419
21420 Line two</div>
21421 !! html
21422 <div>Line one
21423 Line two</div>
21424
21425 !! end
21426
21427 !! test
21428 Paragraphs inside divs (extra line break on open)
21429 !! wikitext
21430 <div>
21431 Line one
21432
21433 Line two</div>
21434 !! html
21435 <div>
21436 <p>Line one
21437 </p>
21438 Line two</div>
21439
21440 !! end
21441
21442 !! test
21443 Paragraphs inside divs (extra line break on close)
21444 !! wikitext
21445 <div>Line one
21446
21447 Line two
21448 </div>
21449 !! html
21450 <div>Line one
21451 <p>Line two
21452 </p>
21453 </div>
21454
21455 !! end
21456
21457 !! test
21458 Paragraphs inside divs (extra line break on open and close)
21459 !! wikitext
21460 <div>
21461 Line one
21462
21463 Line two
21464 </div>
21465 !! html
21466 <div>
21467 <p>Line one
21468 </p><p>Line two
21469 </p>
21470 </div>
21471
21472 !! end
21473
21474 !! test
21475 Nesting tags, paragraphs on lines which begin with <div>
21476 !! wikitext
21477 <div></div><strong>A
21478 B</strong>
21479 !! html/php+tidy
21480 <p><strong>A</strong></p>
21481 <p><strong>B</strong></p>
21482 !! html/parsoid
21483 <div></div>
21484 <p><strong>A
21485 B</strong>
21486 </p>
21487 !! end
21488
21489 # T8200: <blockquote> should behave like <div> with respect to line breaks
21490 !! test
21491 T8200: paragraphs inside blockquotes (no extra line breaks)
21492 !! wikitext
21493 <blockquote>Line one
21494
21495 Line two</blockquote>
21496 !! html
21497 <blockquote>Line one
21498 Line two</blockquote>
21499
21500 !! html+tidy
21501 <blockquote>
21502 <p>Line one Line two</p>
21503 </blockquote>
21504 !! end
21505
21506 !! test
21507 T8200: paragraphs inside blockquotes (extra line break on open)
21508 !! wikitext
21509 <blockquote>
21510 Line one
21511
21512 Line two</blockquote>
21513 !! html
21514 <blockquote>
21515 <p>Line one
21516 </p>
21517 Line two</blockquote>
21518
21519 !! html+tidy
21520 <blockquote>
21521 <p>Line one</p>
21522 Line two</blockquote>
21523 !! end
21524
21525 !! test
21526 T8200: paragraphs inside blockquotes (extra line break on close)
21527 !! wikitext
21528 <blockquote>Line one
21529
21530 Line two
21531 </blockquote>
21532 !! html
21533 <blockquote>Line one
21534 <p>Line two
21535 </p>
21536 </blockquote>
21537
21538 !! html+tidy
21539 <blockquote>
21540 <p>Line one</p>
21541 <p>Line two</p>
21542 </blockquote>
21543 !! end
21544
21545 !! test
21546 T8200: paragraphs inside blockquotes (extra line break on open and close)
21547 !! wikitext
21548 <blockquote>
21549 Line one
21550
21551 Line two
21552 </blockquote>
21553 !! html
21554 <blockquote>
21555 <p>Line one
21556 </p><p>Line two
21557 </p>
21558 </blockquote>
21559
21560 !! html+tidy
21561 <blockquote>
21562 <p>Line one</p>
21563 <p>Line two</p>
21564 </blockquote>
21565 !! end
21566
21567 !! test
21568 Paragraphs inside blockquotes/divs (no extra line breaks)
21569 !! wikitext
21570 <blockquote><div>Line one
21571
21572 Line two</div></blockquote>
21573 !! html
21574 <blockquote><div>Line one
21575 Line two</div></blockquote>
21576
21577 !! end
21578
21579 !! test
21580 Paragraphs inside blockquotes/divs (extra line break on open)
21581 !! wikitext
21582 <blockquote><div>
21583 Line one
21584
21585 Line two</div></blockquote>
21586 !! html
21587 <blockquote><div>
21588 <p>Line one
21589 </p>
21590 Line two</div></blockquote>
21591
21592 !! end
21593
21594 !! test
21595 Paragraphs inside blockquotes/divs (extra line break on close)
21596 !! wikitext
21597 <blockquote><div>Line one
21598
21599 Line two
21600 </div></blockquote>
21601 !! html
21602 <blockquote><div>Line one
21603 <p>Line two
21604 </p>
21605 </div></blockquote>
21606
21607 !! end
21608
21609 !! test
21610 Paragraphs inside blockquotes/divs (extra line break on open and close)
21611 !! wikitext
21612 <blockquote><div>
21613 Line one
21614
21615 Line two
21616 </div></blockquote>
21617 !! html
21618 <blockquote><div>
21619 <p>Line one
21620 </p><p>Line two
21621 </p>
21622 </div></blockquote>
21623
21624 !! end
21625
21626 !! test
21627 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
21628 !! options
21629 wgLinkHolderBatchSize=0
21630 !! wikitext
21631 [[meatball:1]]
21632 [[meatball:2]]
21633 [[meatball:3]]
21634 !! html
21635 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
21636 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
21637 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
21638 </p>
21639 !! end
21640
21641 !! test
21642 Free external link invading image caption
21643 !! wikitext
21644 [[Image:Foobar.jpg|thumb|http://x|hello]]
21645 !! html
21646 <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>
21647
21648 !! end
21649
21650 !! test
21651 T17196: localised external link numbers
21652 !! options
21653 language=fa
21654 !! wikitext
21655 [http://en.wikipedia.org/]
21656 !! html/php
21657 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
21658 </p>
21659 !! html/parsoid
21660 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/"></a></p>
21661 !! end
21662
21663 !! test
21664 Multibyte character in padleft
21665 !! wikitext
21666 {{padleft:-Hello|7|Æ}}
21667 !! html
21668 <p>Æ-Hello
21669 </p>
21670 !! end
21671
21672 !! test
21673 Multibyte character in padright
21674 !! wikitext
21675 {{padright:Hello-|7|Æ}}
21676 !! html
21677 <p>Hello-Æ
21678 </p>
21679 !! end
21680
21681 !!test
21682 formatdate parser function
21683 !! wikitext
21684 {{#formatdate:2009-03-24}}
21685 !! html
21686 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
21687 </p>
21688 !! end
21689
21690 !!test
21691 formatdate parser function, with default format
21692 !! wikitext
21693 {{#formatdate:2009-03-24|mdy}}
21694 !! html
21695 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
21696 </p>
21697 !! end
21698
21699 !! test
21700 Spacing of numbers in formatted dates
21701 !! wikitext
21702 {{#formatdate:January 15}}
21703 !! html
21704 <p><span class="mw-formatted-date" title="01-15">January 15</span>
21705 </p>
21706 !! end
21707
21708 !! test
21709 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
21710 !! options
21711 language=nl title=[[MediaWiki:Common.css]]
21712 !! wikitext
21713 {{#formatdate:2009-03-24|dmy}}
21714 !! html
21715 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
21716 </p>
21717 !! end
21718
21719 #
21720 #
21721 #
21722
21723 #
21724 # Edit comments
21725 #
21726
21727 !! test
21728 Edit comment with link
21729 !! options
21730 comment
21731 !! wikitext
21732 I like the [[Main Page]] a lot
21733 !! html/php
21734 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
21735 !!end
21736
21737 !! test
21738 Edit comment with link and link text
21739 !! options
21740 comment
21741 !! wikitext
21742 I like the [[Main Page|best pages]] a lot
21743 !! html/php
21744 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
21745 !!end
21746
21747 !! test
21748 Edit comment with link and link text with suffix
21749 !! options
21750 comment
21751 !! wikitext
21752 I like the [[Main Page|best page]]s a lot
21753 !! html/php
21754 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
21755 !!end
21756
21757 !! test
21758 Edit comment with section link (non-local, eg in history list)
21759 !! options
21760 comment title=[[Main Page]]
21761 !! wikitext
21762 /* External links */ removed bogus entries
21763 !! html/php
21764 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
21765 !!end
21766
21767 !! test
21768 Edit comment with section link and text before it (non-local, eg in history list)
21769 !! options
21770 comment title=[[Main Page]]
21771 !! wikitext
21772 pre-comment text /* External links */ removed bogus entries
21773 !! html/php
21774 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>
21775 !!end
21776
21777 !! test
21778 Edit comment with section link (local, eg in diff view)
21779 !! options
21780 comment local title=[[Main Page]]
21781 !! wikitext
21782 /* External links */ removed bogus entries
21783 !! html/php
21784 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
21785 !!end
21786
21787 !! test
21788 Edit comment with subpage link (T16080)
21789 !! options
21790 comment
21791 subpage
21792 title=[[Subpage test]]
21793 !! wikitext
21794 Poked at a [[/subpage]] here...
21795 !! html/php
21796 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
21797 !!end
21798
21799 !! test
21800 Edit comment with subpage link and link text (T16080)
21801 !! options
21802 comment
21803 subpage
21804 title=[[Subpage test]]
21805 !! wikitext
21806 Poked at a [[/subpage|neat little page]] here...
21807 !! html/php
21808 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
21809 !!end
21810
21811 !! test
21812 Edit comment with bogus subpage link in non-subpage NS (T16080)
21813 !! options
21814 comment
21815 title=[[Subpage test]]
21816 !! wikitext
21817 Poked at a [[/subpage]] here...
21818 !! html/php
21819 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...
21820 !!end
21821
21822 !! test
21823 Edit comment with bare anchor link (local, as on diff)
21824 !! options
21825 comment
21826 local
21827 title=[[Main Page]]
21828 !! wikitext
21829 [[#section]]
21830 !! html/php
21831 <a href="#section">#section</a>
21832 !! end
21833
21834 !! test
21835 Edit comment with bare anchor link (non-local, as on history)
21836 !! options
21837 comment
21838 title=[[Main Page]]
21839 !! wikitext
21840 [[#section]]
21841 !! html/php
21842 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
21843 !! end
21844
21845 !! test
21846 Anchor starting with underscore
21847 !! options
21848 title=[[Foo]]
21849 !! wikitext
21850 [[#_ref|One]]
21851 !! html/php
21852 <p><a href="#_ref">One</a>
21853 </p>
21854 !! html/parsoid
21855 <p><a rel="mw:WikiLink" href="./Foo#_ref" data-parsoid='{"stx":"piped","a":{"href":"./Foo#_ref"},"sa":{"href":"#_ref"}}'>One</a></p>
21856 !! end
21857
21858 !! test
21859 Id starting with underscore
21860 !! wikitext
21861 <div id="_ref"></div>
21862 !! html/*
21863 <div id="_ref"></div>
21864
21865 !! end
21866
21867 !! test
21868 Edit comment with link with more than one pipe (T99346)
21869 !! options
21870 comment
21871 !! wikitext
21872 [[Main Page|Many|pipes]]
21873 !! html/php
21874 <a href="/wiki/Main_Page" title="Main Page">Many|pipes</a>
21875 !! end
21876
21877 !! test
21878 Complex edit comment with link with more than one pipe (T99346)
21879 !! options
21880 comment
21881 !! wikitext
21882 Created page with "<noinclude>[[Category:Requests for permissions/Bot|{{subst:#titleparts:{{subst:PAGENAME}}|1|3}}]]</noinclude> === [[User:MineoBot|]] 8=== {{Request for permissions/links|Mineo..."
21883 !! html/php
21884 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;
21885 !! end
21886
21887 !! test
21888 Space normalisation on autocomment (T24784)
21889 !! options
21890 comment
21891 title=[[Main Page]]
21892 !! wikitext
21893 /* __hello__world__ */
21894 !! html/php
21895 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
21896 !! end
21897
21898 !! test
21899 percent-encoding and + signs in comments (T28410)
21900 !! options
21901 comment
21902 !! wikitext
21903 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
21904 !! html/php
21905 <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>
21906 !! end
21907
21908 # Parsoid doesn't support this yet: see T75581
21909 # but it *should* omit the 'src' attribute if the image is bad.
21910 # PHP side of tests was disabled in
21911 # mediawiki/core:6bd31e7d95161a6e88fa86df60871051da997c3c
21912 # because of issues in the PHP parserTests infrastructure
21913 # (but the output below is indeed what the PHP side emits)
21914 !! test
21915 Bad images - basic functionality
21916 !! wikitext
21917 [[File:Bad.jpg]]
21918 !! DISABLED/html/php
21919 !! html/parsoid
21920 <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>
21921 !! end
21922
21923 !! test
21924 Bad images - T18039: text after bad image disappears
21925 !! wikitext
21926 Foo bar
21927 [[File:Bad.jpg]]
21928 Bar foo
21929 !! DISABLED/html/php
21930 <p>Foo bar
21931 </p><p>Bar foo
21932 </p>
21933 !! html/parsoid
21934 <p>Foo bar
21935 <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>
21936 Bar foo</p>
21937 !! end
21938
21939 !! test
21940 Verify that displaytitle works (T24501) no displaytitle
21941 !! options
21942 showtitle
21943 !! config
21944 wgAllowDisplayTitle=true
21945 wgRestrictDisplayTitle=false
21946 !! wikitext
21947 this is not the the title
21948 !! html/php
21949 Parser test
21950 <p>this is not the the title
21951 </p>
21952 !! end
21953
21954 !! test
21955 Verify that displaytitle works (T24501) RestrictDisplayTitle=false
21956 !! options
21957 showtitle
21958 title=[[Screen]]
21959 !! config
21960 wgAllowDisplayTitle=true
21961 wgRestrictDisplayTitle=false
21962 !! wikitext
21963 this is not the the title
21964 {{DISPLAYTITLE:whatever}}
21965 !! html/php
21966 whatever
21967 <p>this is not the the title
21968 </p>
21969 !! end
21970
21971 !! test
21972 Verify that displaytitle works (T24501) RestrictDisplayTitle=true mismatch
21973 !! options
21974 showtitle
21975 title=[[Screen]]
21976 !! config
21977 wgAllowDisplayTitle=true
21978 wgRestrictDisplayTitle=true
21979 !! wikitext
21980 this is not the the title
21981 {{DISPLAYTITLE:whatever}}
21982 !! html/php
21983 Screen
21984 <p>this is not the the title
21985 </p>
21986 !! end
21987
21988 !! test
21989 Verify that displaytitle works (T24501) RestrictDisplayTitle=true matching
21990 !! options
21991 showtitle
21992 title=[[Screen]]
21993 !! config
21994 wgAllowDisplayTitle=true
21995 wgRestrictDisplayTitle=true
21996 !! wikitext
21997 this is not the the title
21998 {{DISPLAYTITLE:screen}}
21999 !! html/php
22000 screen
22001 <p>this is not the the title
22002 </p>
22003 !! end
22004
22005 !! test
22006 Verify that displaytitle works (T24501) AllowDisplayTitle=false
22007 !! options
22008 showtitle
22009 title=[[Screen]]
22010 !! config
22011 wgAllowDisplayTitle=false
22012 !! wikitext
22013 this is not the the title
22014 {{DISPLAYTITLE:screen}}
22015 !! html/php
22016 Screen
22017 <p>this is not the the title
22018 <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>
22019 </p>
22020 !! end
22021
22022 !! test
22023 Verify that displaytitle works (T24501) AllowDisplayTitle=false no DISPLAYTITLE
22024 !! options
22025 showtitle
22026 title=[[Screen]]
22027 !! config
22028 wgAllowDisplayTitle=false
22029 !! wikitext
22030 this is not the the title
22031 !! html/php
22032 Screen
22033 <p>this is not the the title
22034 </p>
22035 !! end
22036
22037 !! test
22038 Verify that displaytitle handles inline CSS styles (T28547) - rejected value
22039 !! options
22040 showtitle
22041 title=[[Screen]]
22042 !! config
22043 wgAllowDisplayTitle=true
22044 wgRestrictDisplayTitle=true
22045 !! wikitext
22046 this is not the the title
22047 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
22048 !! html/php
22049 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
22050 <p>this is not the the title
22051 </p>
22052 !! end
22053
22054 !! test
22055 Verify that displaytitle handles inline CSS styles (T28547) - accepted value
22056 !! options
22057 showtitle
22058 title=[[Screen]]
22059 !! config
22060 wgAllowDisplayTitle=true
22061 wgRestrictDisplayTitle=true
22062 !! wikitext
22063 this is not the the title
22064 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
22065 !! html/php
22066 <span style="color: red;">s</span>creen
22067 <p>this is not the the title
22068 </p>
22069 !! end
22070
22071 !! test
22072 Page status indicators: Empty name is invalid
22073 !! options
22074 showindicators
22075 !! wikitext
22076 <indicator name=" "></indicator>
22077 <indicator></indicator>
22078 !! html/php
22079 <p><span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
22080 <span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
22081 </p>
22082 !! end
22083
22084 !! test
22085 Page status indicators: Weird syntaxes that are okay
22086 !! options
22087 showindicators
22088 !! wikitext
22089 <indicator name="empty" />
22090 <indicator name="name"></indicator>
22091 !! html/php
22092 empty=
22093 name=
22094 <p><br />
22095 </p>
22096 !! end
22097
22098 !! test
22099 Page status indicators: Torture test
22100 !! options
22101 showindicators
22102 !! wikitext
22103 <indicator name="01">hello world</indicator>
22104 <indicator name="02">[[Main Page]]</indicator>
22105 <indicator name="03">[[File:Foobar.jpg|25px|link=]]</indicator>
22106 <indicator name="04">[[File:Foobar.jpg|25px]]</indicator>
22107 <indicator name="05">* foo
22108 * bar</indicator>
22109 <indicator name="06"><nowiki>foo</nowiki></indicator>
22110 <indicator name="07"> Preformatted</indicator>
22111 <indicator name="08"><div>Broken tag</indicator>
22112 <indicator name="09">{| class=wikitable
22113 | cell
22114 |}</indicator>
22115 <indicator name="10">Two
22116
22117 paragraphs</indicator>
22118 !! html/php
22119 01=hello world
22120 02=<a href="/wiki/Main_Page" title="Main Page">Main Page</a>
22121 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" />
22122 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>
22123 05=<ul><li> foo</li>
22124 <li> bar</li></ul>
22125
22126 06=foo
22127 07=<pre>Preformatted
22128 </pre>
22129 08=<div>Broken tag</div>
22130
22131 09=<table class="wikitable">
22132 <tr>
22133 <td> cell
22134 </td></tr></table>
22135
22136 10=<p>Two
22137 </p><p>paragraphs
22138 </p>
22139 <p><br />
22140 </p><p><br />
22141 </p><p><br />
22142 </p><p><br />
22143 </p><p><br />
22144 </p>
22145 !! end
22146
22147 !! test
22148 preload: check <noinclude> and <includeonly>
22149 !! options
22150 preload
22151 !! wikitext
22152 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
22153 !! html/php
22154 Hello kind world.
22155 !! end
22156
22157 !! test
22158 preload: check <onlyinclude>
22159 !! options
22160 preload
22161 !! wikitext
22162 Goodbye <onlyinclude>Hello world</onlyinclude>
22163 !! html/php
22164 Hello world
22165 !! end
22166
22167 !! test
22168 preload: can pass tags through if we want to
22169 !! options
22170 preload
22171 !! wikitext
22172 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
22173 !! html/php
22174 <includeonly>Hello world</includeonly>
22175 !! end
22176
22177 !! test
22178 preload: check that it doesn't try to do tricks
22179 !! options
22180 preload
22181 !! wikitext
22182 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
22183 !! html/php
22184 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
22185 !! end
22186
22187 !! test
22188 Play a bit with r67090 and T5158
22189 !! wikitext
22190 <div style="width:50% !important">&nbsp;</div>
22191 <div style="width:50%&nbsp;!important">&nbsp;</div>
22192 <div style="width:50%&#160;!important">&nbsp;</div>
22193 <div style="border : solid;">&nbsp;</div>
22194 !! html/php
22195 <div style="width:50% !important">&#160;</div>
22196 <div style="width:50% !important">&#160;</div>
22197 <div style="width:50% !important">&#160;</div>
22198 <div style="border&#160;: solid;">&#160;</div>
22199
22200 !! html/parsoid
22201 <div style="width:50% !important" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
22202 <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>
22203 <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>
22204 <div style="border : solid;" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
22205
22206 !! end
22207
22208 !! test
22209 HTML5 data attributes
22210 !! wikitext
22211 <span data-foo="bar">Baz</span>
22212 <p data-abc-def_hij="">Quuz</p>
22213 !! html/php
22214 <p><span data-foo="bar">Baz</span>
22215 </p>
22216 <p data-abc-def_hij="">Quuz</p>
22217
22218 !! html/parsoid
22219 <p><span data-foo="bar" data-parsoid='{"stx":"html"}'>Baz</span></p>
22220 <p data-abc-def_hij="" data-parsoid='{"stx":"html"}'>Quuz</p>
22221 !! end
22222
22223 !! test
22224 Strip reserved data attributes
22225 !! wikitext
22226 <div data-mw="foo" data-parsoid="bar" data-mw-someext="baz" data-ok="fred" data-ooui="xyzzy" data-bad:ns="ns">d</div>
22227 !! html/php
22228 <div data-ok="fred">d</div>
22229
22230 !! html/parsoid
22231 <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>
22232 !! end
22233
22234 !! test
22235 percent-encoding and + signs in internal links (T28410)
22236 !! wikitext
22237 [[User:+%]] [[Page+title%]]
22238 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
22239 [[%]] [[+]] [[File:%+abc%39|foo|[[bar]]]]
22240 [[%33%45]] [[%33%45+]]
22241 !! html/php
22242 <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>
22243 <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>
22244 <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>
22245 <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>
22246 </p>
22247 !! html/parsoid
22248 <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>
22249 <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>
22250 <a rel="mw:WikiLink" href="./%25" title="%" data-parsoid='{"stx":"simple","a":{"href":"./%25"},"sa":{"href":"%"}}'>%</a> <a rel="mw:WikiLink" href="./+" title="+" data-parsoid='{"stx":"simple","a":{"href":"./+"},"sa":{"href":"+"}}'>+</a> <span class="mw-default-size" typeof="mw:Error mw:Image" data-parsoid='{"optList":[{"ck":"bogus","ak":"foo"},{"ck":"caption","ak":"[[bar]]"}]}' data-mw='{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}],"caption":"&lt;a rel=\"mw:WikiLink\" href=\"./Bar\" title=\"Bar\" data-parsoid=&#39;{\"stx\":\"simple\",\"a\":{\"href\":\"./Bar\"},\"sa\":{\"href\":\"bar\"},\"dsr\":[94,101,2,2]}&#39;>bar&lt;/a>"}'><a href="./File:%25+abc9" data-parsoid='{"a":{"href":"./File:%25+abc9"},"sa":{}}'><img resource="./File:%25+abc9" src="./Special:FilePath/%25+abc9" height="220" width="220" data-parsoid='{"a":{"resource":"./File:%25+abc9","height":"220","width":"220"},"sa":{"resource":"File:%+abc%39"}}'/></a></span>
22251 <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>
22252 !! end
22253
22254 !! test
22255 Special characters in embedded file links (T29679)
22256 !! wikitext
22257 [[File:Contains & ampersand.jpg]]
22258 [[File:Does not exist.jpg|Title with & ampersand]]
22259 !! html/php
22260 <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>
22261 <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>
22262 </p>
22263 !! html/parsoid
22264 <p><span class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}]}'><a href="./File:Contains_&amp;_ampersand.jpg"><img resource="./File:Contains_&amp;_ampersand.jpg" src="./Special:FilePath/Contains_&amp;_ampersand.jpg" height="220" width="220"/></a></span>
22265 <span class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}],"caption":"Title with &amp;amp; ampersand"}'><a href="./File:Does_not_exist.jpg"><img resource="./File:Does_not_exist.jpg" src="./Special:FilePath/Does_not_exist.jpg" height="220" width="220"/></a></span></p>
22266 !! end
22267
22268 !! test
22269 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
22270 !! wikitext
22271 Text&apos;s been normalized?
22272 !! html
22273 <p>Text&#39;s been normalized?
22274 </p>
22275 !! end
22276
22277 !! test
22278 T21052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
22279 !! wikitext
22280 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
22281 !! html
22282 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
22283 </p>
22284 !! end
22285
22286 !! test
22287 T21052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
22288 !! wikitext
22289 [http://www.example.org/ ideograms]
22290 !! html
22291 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
22292 </p>
22293 !! end
22294
22295 !! test
22296 T21052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
22297 !! wikitext
22298 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
22299 !! html
22300 <p><img src="http://www.example.org/pic.png" alt="pic.png"/> &lt;-- U+3000 (vim: ^Vu3000)
22301 </p>
22302 !! end
22303
22304 !! article
22305 Mediawiki:loop1
22306 !! text
22307 {{Identical|A}}
22308 !! endarticle
22309
22310 !! article
22311 Mediawiki:loop2
22312 !! text
22313 {{Identical|B}}
22314 !! endarticle
22315
22316 !! article
22317 Template:Identical
22318 !! text
22319 {{int:loop1}}
22320 {{int:loop2}}
22321 !! endarticle
22322
22323 !! test
22324 T33098 Template which includes system messages which includes the template
22325 !! wikitext
22326 {{Identical}}
22327 !! html
22328 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
22329 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
22330 </p>
22331 !! end
22332
22333 !! test
22334 T33490 Turkish: ucfirst 'blah'
22335 !! options
22336 language=tr
22337 !! wikitext
22338 {{ucfirst:blah}}
22339 !! html
22340 <p>Blah
22341 </p>
22342 !! end
22343
22344 !! test
22345 T33490 Turkish: ucfirst 'ix'
22346 !! options
22347 language=tr
22348 !! wikitext
22349 {{ucfirst:ix}}
22350 !! html
22351 <p>İx
22352 </p>
22353 !! end
22354
22355 !! test
22356 T33490 Turkish: lcfirst 'BLAH'
22357 !! options
22358 language=tr
22359 !! wikitext
22360 {{lcfirst:BLAH}}
22361 !! html
22362 <p>bLAH
22363 </p>
22364 !! end
22365
22366 !! test
22367 T33490 Turkish: ucfırst (with a dotless i)
22368 !! options
22369 language=tr
22370 !! wikitext
22371 {{ucfırst:blah}}
22372 !! html
22373 <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>
22374 </p>
22375 !! end
22376
22377 !! test
22378 T33490 ucfırst (with a dotless i) with English language
22379 !! options
22380 language=en
22381 !! wikitext
22382 {{ucfırst:blah}}
22383 !! html
22384 <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>
22385 </p>
22386 !! end
22387
22388 # Note that Parsoid doesn't emit an explicit TOC.
22389 # Note also that the html2wt direction tends to emit an extra newline
22390 # between the __TOC__ magicword and the first heading unless *both*
22391 # the <meta> and the <h2> have a data-parsoid attribute set (even if
22392 # it's "{}").
22393
22394 !! test
22395 T28375: TOC with italics
22396 !! options
22397 title=[[Main Page]]
22398 !! wikitext
22399 __TOC__
22400 == ''Lost'' episodes ==
22401 !! html/php
22402 <div id="toc" class="toc"><div id="toctitle" class="toctitle"><h2>Contents</h2></div>
22403 <ul>
22404 <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>
22405 </ul>
22406 </div>
22407
22408 <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>
22409
22410 !! html/parsoid
22411 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
22412 <h2 data-parsoid='{}'> <i>Lost</i> episodes </h2>
22413 !! end
22414
22415 !! test
22416 T28375: TOC with bold
22417 !! options
22418 title=[[Main Page]]
22419 !! wikitext
22420 __TOC__
22421 == '''should be bold''' then normal text ==
22422 !! html/php
22423 <div id="toc" class="toc"><div id="toctitle" class="toctitle"><h2>Contents</h2></div>
22424 <ul>
22425 <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>
22426 </ul>
22427 </div>
22428
22429 <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>
22430
22431 !! html/parsoid
22432 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
22433 <h2 data-parsoid='{}'> <b>should be bold</b> then normal text </h2>
22434 !! end
22435
22436 !! test
22437 T35845: Headings become cursive in TOC when they contain an image
22438 !! options
22439 title=[[Main Page]]
22440 !! wikitext
22441 __TOC__
22442 == Image [[Image:foobar.jpg]] ==
22443 !! html/php
22444 <div id="toc" class="toc"><div id="toctitle" class="toctitle"><h2>Contents</h2></div>
22445 <ul>
22446 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
22447 </ul>
22448 </div>
22449
22450 <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>
22451
22452 !! html/parsoid
22453 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
22454 <h2 data-parsoid='{}'> Image <span class="mw-default-size" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"Image:foobar.jpg"}}'/></a></span> </h2>
22455 !! end
22456
22457 !! test
22458 T35845 (2): Headings become bold in TOC when they contain a blockquote
22459 !! options
22460 title=[[Main Page]]
22461 !! wikitext
22462 __TOC__
22463 == <blockquote>Quote</blockquote> ==
22464 !! html/php
22465 <div id="toc" class="toc"><div id="toctitle" class="toctitle"><h2>Contents</h2></div>
22466 <ul>
22467 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
22468 </ul>
22469 </div>
22470
22471 <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>
22472
22473 !! html/php+tidy
22474 <p></p>
22475 <div id="toc" class="toc">
22476 <div id="toctitle" class="toctitle">
22477 <h2>Contents</h2>
22478 </div>
22479 <ul>
22480 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
22481 </ul>
22482 </div>
22483 <p></p>
22484 <h2><span class="mw-headline" id="Quote"></span></h2>
22485 <blockquote>
22486 <p><span class="mw-headline" id="Quote">Quote</span></p>
22487 </blockquote>
22488 <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>
22489 !! html/parsoid
22490 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
22491 <h2 data-parsoid='{}'> <blockquote>Quote</blockquote> </h2>
22492 !! end
22493
22494 !! test
22495 Unclosed tags in TOC
22496 !! options
22497 title=[[Main Page]]
22498 !! wikitext
22499 __TOC__
22500 == Proof: 2 < 3 ==
22501 <small>Hanc marginis exiguitas non caperet.</small>
22502 QED
22503 !! html/php
22504 <div id="toc" class="toc"><div id="toctitle" class="toctitle"><h2>Contents</h2></div>
22505 <ul>
22506 <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>
22507 </ul>
22508 </div>
22509
22510 <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>
22511 <p><small>Hanc marginis exiguitas non caperet.</small>
22512 QED
22513 </p>
22514 !! html/parsoid
22515 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
22516 <h2 data-parsoid='{}'> Proof: 2 &lt; 3 </h2>
22517 <p><small>Hanc marginis exiguitas non caperet.</small>
22518 QED</p>
22519 !! end
22520
22521 !! test
22522 Multiple tags in TOC
22523 !! wikitext
22524 __TOC__
22525 == <i>Foo</i> <b>Bar</b> ==
22526
22527 == <i>Foo</i> <blockquote>Bar</blockquote> ==
22528 !! html/php
22529 <div id="toc" class="toc"><div id="toctitle" class="toctitle"><h2>Contents</h2></div>
22530 <ul>
22531 <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>
22532 <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>
22533 </ul>
22534 </div>
22535
22536 <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>
22537 <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>
22538
22539 !! html/php+tidy
22540 <p></p>
22541 <div id="toc" class="toc">
22542 <div id="toctitle" class="toctitle">
22543 <h2>Contents</h2>
22544 </div>
22545 <ul>
22546 <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>
22547 <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>
22548 </ul>
22549 </div>
22550 <p></p>
22551 <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>
22552 <h2><span class="mw-headline" id="Foo_Bar_2"><i>Foo</i></span></h2>
22553 <blockquote>
22554 <p><span class="mw-headline" id="Foo_Bar_2">Bar</span></p>
22555 </blockquote>
22556 <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>
22557 !! html/parsoid
22558 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
22559 <h2 data-parsoid='{}'> <i data-parsoid='{"stx":"html"}'>Foo</i> <b data-parsoid='{"stx":"html"}'>Bar</b> </h2>
22560 <h2> <i data-parsoid='{"stx":"html"}'>Foo</i> <blockquote>Bar</blockquote> </h2>
22561 !! end
22562
22563 # Don't expect Parsoid to roundtrip this until the php parser comes closer to
22564 # html5 tag parsing.
22565 !! test
22566 Tags with parameters in TOC
22567 !! options
22568 parsoid=wt2html
22569 !! wikitext
22570 __TOC__
22571 == <sup class="in-h2">Hello</sup> ==
22572
22573 == <sup class="a > b">Evilbye</sup> ==
22574 !! html/php
22575 <div id="toc" class="toc"><div id="toctitle" class="toctitle"><h2>Contents</h2></div>
22576 <ul>
22577 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
22578 <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>
22579 </ul>
22580 </div>
22581
22582 <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>
22583 <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>
22584
22585 !! html/parsoid
22586 <meta property="mw:PageProp/toc" />
22587 <h2> <sup class="in-h2" data-parsoid='{"stx":"html"}'>Hello</sup> </h2>
22588
22589 <h2> <sup class="a " data-parsoid='{"stx":"html"}'> b">Evilbye</sup> </h2>
22590 !! end
22591
22592 !! test
22593 span tags with directionality in TOC
22594 !! wikitext
22595 __TOC__
22596 == <span dir="ltr">C++</span> ==
22597
22598 == <span dir="rtl">זבנג!</span> ==
22599
22600 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
22601
22602 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
22603
22604 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
22605 !! html/php
22606 <div id="toc" class="toc"><div id="toctitle" class="toctitle"><h2>Contents</h2></div>
22607 <ul>
22608 <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>
22609 <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>
22610 <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>
22611 <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>
22612 <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>
22613 </ul>
22614 </div>
22615
22616 <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>
22617 <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>
22618 <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>
22619 <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>
22620 <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>
22621
22622 !! html/parsoid
22623 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
22624 <h2 data-parsoid='{}'> <span dir="ltr">C++</span> </h2>
22625 <h2> <span dir="rtl">זבנג!</span> </h2>
22626 <h2> <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> </h2>
22627 <h2> <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> </h2>
22628 <h2> <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> </h2>
22629 !! end
22630
22631 !! test
22632 T74884: bdi element in ToC
22633 !! wikitext
22634 __TOC__
22635 == <bdi>test</bdi> ==
22636 !! html/php
22637 <div id="toc" class="toc"><div id="toctitle" class="toctitle"><h2>Contents</h2></div>
22638 <ul>
22639 <li class="toclevel-1 tocsection-1"><a href="#test"><span class="tocnumber">1</span> <span class="toctext"><bdi>test</bdi></span></a></li>
22640 </ul>
22641 </div>
22642
22643 <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>
22644
22645 !! html/parsoid
22646 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
22647 <h2 data-parsoid='{}'> <bdi>test</bdi> </h2>
22648 !! end
22649
22650 !! test
22651 T35715: s/strike element in ToC
22652 !! wikitext
22653 __TOC__
22654 == <s>test</s> test <strike>test</strike> ==
22655 !! html/php
22656 <div id="toc" class="toc"><div id="toctitle" class="toctitle"><h2>Contents</h2></div>
22657 <ul>
22658 <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>
22659 </ul>
22660 </div>
22661
22662 <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>
22663
22664 !! html/parsoid
22665 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
22666 <h2 data-parsoid='{}'> <s>test</s> test <strike>test</strike> </h2>
22667 !! end
22668
22669 # Note that the html output does not have the <p></p>, but the
22670 # html+tidy output *does*. This is because the empty <p></p> is
22671 # removed by the sanitizer, but only when tidy is *not* enabled (!).
22672 !! test
22673 Empty <p> tag in TOC, removed by Sanitizer (T92892)
22674 !! wikitext
22675 __TOC__
22676 == x ==
22677 !! html/php
22678 <div id="toc" class="toc"><div id="toctitle" class="toctitle"><h2>Contents</h2></div>
22679 <ul>
22680 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
22681 </ul>
22682 </div>
22683
22684 <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>
22685
22686 !! html/php+tidy
22687 <p></p>
22688 <div id="toc" class="toc">
22689 <div id="toctitle" class="toctitle">
22690 <h2>Contents</h2>
22691 </div>
22692 <ul>
22693 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
22694 </ul>
22695 </div>
22696 <p></p>
22697 <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>
22698 !! html/parsoid
22699 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
22700 <h2 data-parsoid='{}'> x </h2>
22701 !! end
22702
22703 !! article
22704 MediaWiki:T34057
22705 !! text
22706 == {{int:headline_sample}} ==
22707 !! endarticle
22708
22709 !! test
22710 T34057: Title needed when expanding <h> nodes.
22711 !! options
22712 title=[[Main Page]]
22713 !! wikitext
22714 {{int:T34057}}
22715 !! html
22716 <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>
22717
22718 !! end
22719
22720 !! test
22721 Strip marker in urlencode
22722 !! wikitext
22723 {{urlencode:x<nowiki/>y}}
22724 {{urlencode:x<nowiki/>y|wiki}}
22725 {{urlencode:x<nowiki/>y|path}}
22726 {{urlencode:x<pre id="one">two</pre>y}}
22727 !! html/php
22728 <p>xy
22729 xy
22730 xy
22731 xy
22732 </p>
22733 !! end
22734
22735 !! test
22736 Strip marker in lc
22737 !! wikitext
22738 {{lc:x<nowiki/>y}}
22739 !! html
22740 <p>xy
22741 </p>
22742 !! end
22743
22744 !! test
22745 Strip marker in uc
22746 !! wikitext
22747 {{uc:x<nowiki/>y}}
22748 !! html
22749 <p>XY
22750 </p>
22751 !! end
22752
22753 !! test
22754 Strip marker in formatNum
22755 !! wikitext
22756 {{formatnum:1<nowiki/>2}}
22757 {{formatnum:1<nowiki/>2|R}}
22758 !! html
22759 <p>12
22760 12
22761 </p>
22762 !! end
22763
22764 !! test
22765 Check noCommafy in formatNum
22766 !! options
22767 language=be-tarask
22768 !! wikitext
22769 {{formatnum:123456.78}}
22770 {{formatnum:123456.78|NOSEP}}
22771 !! html
22772 <p>123 456,78
22773 123456.78
22774 </p>
22775 !! end
22776
22777 !! test
22778 Wrong option for formatNum (T58199)
22779 !! wikitext
22780 {{formatnum:1,234.56|Random}}
22781 {{formatnum:1,234.56|EVERYTHING}}
22782 {{formatnum:1234.56|any argument that has the string 'NOSEP'}}
22783 !! html
22784 <p>1,234.56
22785 1,234.56
22786 1,234.56
22787 </p>
22788 !! end
22789
22790 !! test
22791 Strip marker in grammar
22792 !! options
22793 language=fi
22794 !! wikitext
22795 {{grammar:elative|foo<nowiki/>bar}}
22796 !! html
22797 <p>foobarista
22798 </p>
22799 !! end
22800
22801 !! test
22802 Strip marker in padleft
22803 !! wikitext
22804 {{padleft:|2|x<nowiki/>y}}
22805 !! html
22806 <p>xy
22807 </p>
22808 !! end
22809
22810 !! test
22811 Strip marker in padright
22812 !! wikitext
22813 {{padright:|2|x<nowiki/>y}}
22814 !! html
22815 <p>xy
22816 </p>
22817 !! end
22818
22819 !! test
22820 Strip marker in anchorencode
22821 !! wikitext
22822 {{anchorencode:x<nowiki/>y}}
22823 !! html
22824 <p>xy
22825 </p>
22826 !! end
22827
22828 !! test
22829 nowiki inside link inside heading (T20295)
22830 !! wikitext
22831 ==[[foo|x<nowiki>y</nowiki>z]]==
22832 !! html
22833 <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>
22834
22835 !! end
22836
22837 !! test
22838 new support for bdi element (T33817)
22839 !! wikitext
22840 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
22841 !! html
22842 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
22843
22844 !!end
22845
22846 !! test
22847 Ignore pipe between table row attributes
22848 !! wikitext
22849 {|
22850 | quux
22851 |- id=foo | style='color: red'
22852 | bar
22853 |}
22854 !! html
22855 <table>
22856 <tr>
22857 <td> quux
22858 </td></tr>
22859 <tr id="foo" style="color: red">
22860 <td> bar
22861 </td></tr></table>
22862
22863 !! end
22864
22865 !!test
22866 Language parser function
22867 !! wikitext
22868 {{#language:ar}}
22869 !! html
22870 <p>العربية
22871 </p>
22872 !! end
22873
22874 !!test
22875 Padleft and padright as substr
22876 !! wikitext
22877 {{padleft:|3|abcde}}
22878 {{padright:|3|abcde}}
22879 !! html
22880 <p>abc
22881 abc
22882 </p>
22883 !! end
22884
22885 !!test
22886 Special parser function
22887 !! wikitext
22888 {{#special:RandomPage}}
22889 {{#special:BaDtItLe}}
22890 {{#special:Foobar}}
22891 !! html
22892 <p>Special:Random
22893 Special:Badtitle
22894 Special:Foobar
22895 </p>
22896 !! end
22897
22898 !!test
22899 T36939 - Case insensitive link parsing ([HttP://])
22900 !! wikitext
22901 [HttP://MediaWiki.Org/]
22902 !! html/php
22903 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
22904 </p>
22905 !! html/parsoid
22906 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/"></a></p>
22907 !! end
22908
22909 !!test
22910 T36939 - Case insensitive link parsing ([HttP:// title])
22911 !! wikitext
22912 [HttP://MediaWiki.Org/ MediaWiki]
22913 !! html
22914 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
22915 </p>
22916 !! end
22917
22918 !!test
22919 T36939 - Case insensitive link parsing (HttP://)
22920 !! wikitext
22921 HttP://MediaWiki.Org/
22922 !! html/php
22923 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
22924 </p>
22925 !! html/parsoid
22926 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a></p>
22927 !! end
22928
22929 !!test
22930 Disable TOC
22931 !! options
22932 notoc
22933 !! wikitext
22934 Lead
22935 == Section 1 ==
22936 == Section 2 ==
22937 == Section 3 ==
22938 == Section 4 ==
22939 == Section 5 ==
22940 !! html
22941 <p>Lead
22942 </p>
22943
22944 <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>
22945 <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>
22946 <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>
22947 <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>
22948 <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>
22949
22950 !! end
22951
22952
22953 ###
22954 ### Parsoid-specific tests
22955 ### Parsoid-PHP parser incompatibilities
22956 ###
22957 !!test
22958 1. SOL-sensitive wikitext tokens as template-args
22959 !!options
22960 parsoid=wt2html,wt2wt
22961 !! wikitext
22962 {{echo|*a}}
22963 {{echo|#a}}
22964 {{echo|:a}}
22965 !! html
22966 <span about="#mwt1" typeof="mw:Transclusion">
22967 </span><ul about="#mwt1"><li>a</li>
22968 </ul>
22969 <span about="#mwt2" typeof="mw:Transclusion">
22970 </span><ol about="#mwt2"><li>a</li>
22971 </ol>
22972 <span about="#mwt3" typeof="mw:Transclusion">
22973 </span><dl about="#mwt3"><dd>a</dd>
22974 </dl>
22975 !!end
22976
22977 #### -----------------------------------------------------------------
22978 #### Parsoid-specific functionality tests
22979 #### -----------------------------------------------------------------
22980
22981 # T65642/T68749: Formatting elt fixup around images is cleaned up.
22982 # We know wt2wt will fail, but we expect selser to pass.
22983 # Due to the nature of our testing, wt2wt and selser tests will enter the
22984 # blacklist and we'll catch selser regressions based on changes to the
22985 # blacklist entries for selser tests.
22986 !! test
22987 1. Bad treebuilder fixup of formatting elt is cleaned up
22988 !! options
22989 parsoid=wt2html,wt2wt
22990 !! wikitext
22991 {|
22992 |
22993 <small>
22994 [[Image:Foobar.jpg|right|Test]]
22995 </small>
22996 |}
22997 !! html/parsoid
22998 <table>
22999 <tbody><tr><td>
23000 <small>
23001 <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>
23002 </small>
23003 </td></tr>
23004 </tbody></table>
23005 !! end
23006
23007 !! test
23008 2. Bad treebuilder fixup of formatting elt is cleaned up
23009 !! options
23010 parsoid=wt2html,wt2wt
23011 !! wikitext
23012 '''foo[[File:Foobar.jpg|thumb|caption]]bar'''
23013
23014 <small>[[Image:Foobar.jpg|right|300px]]</small>
23015 !! html/parsoid
23016
23017 <p><b>foo</b></p>
23018 <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>
23019 <p><b>bar</b></p>
23020 <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>
23021 !! end
23022
23023 !! test
23024 3. Bad treebuilder fixup of formatting elt is cleaned up
23025 !! options
23026 parsoid=wt2html,wt2wt
23027 !! wikitext
23028 <small>'''foo[[File:Foobar.jpg|thumb|caption]]bar'''</small>
23029 !! html/parsoid
23030 <p><small><b>foo</b></small></p>
23031 <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>
23032 <p><small><b>bar</b></small></p>
23033 !! end
23034
23035 !! test
23036 4. Bad treebuilder fixup of formatting elt is cleaned up: formatting tags around captionless images are ignored
23037 !! options
23038 parsoid=wt2html,wt2wt
23039 !! wikitext
23040 '''<small>[[Image:Foobar.jpg|right|300px]]</small>'''
23041 !! html/parsoid
23042 <p><b><small></small></b></p>
23043 <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>
23044 <p></p>
23045 !! end
23046
23047 #### ----------------------------------------------------------------
23048 #### Parsoid-only testing of Parsoid's impl of LST
23049 #### Not implemented yet, see
23050 #### https://www.mediawiki.org/wiki/Parsoid/HTML_based_LST
23051 #### ----------------------------------------------------------------
23052
23053 ## We still need to support serializing the older format while content is stored.
23054 !! test
23055 LST Sections: Backwards compatibility
23056 !! options
23057 parsoid={
23058 "suppressErrors": true,
23059 "modes": ["html2wt"]
23060 }
23061 !! wikitext
23062 <section begin="2011-05-16" />
23063 <section end="2014-04-10 (MW 1.23wmf22)" />
23064 !! html/parsoid
23065 <p><meta typeof="mw:Extension/LabeledSectionTransclusion/begin" content="2011-05-16"/>
23066 <meta typeof="mw:Extension/LabeledSectionTransclusion/end" content="2014-04-10 (MW 1.23wmf22)"/></p>
23067 !! end
23068
23069 ## The unconventional output is the result of `usePHPPreProcessor` being
23070 ## disabled in parserTests.js. This test is mainly just to show <section> is
23071 ## recognized as an extension tag w/o a native handler.
23072 !! test
23073 LST Sections: Newfangled approach
23074 !! wikitext
23075 <section begin="2011-05-16" />
23076 <section end="2014-04-10 (MW 1.23wmf22)" />
23077 !! html/parsoid
23078 <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>
23079 <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>
23080 !! end
23081
23082 #--------- Test stripping of empty nodes in template content ----------
23083 !!test
23084 Empty LI and TR nodes should be stripped from template content
23085 !!wikitext
23086 {{EmptyLITest}}
23087 {{EmptyTRTest}}
23088 !!html/parsoid
23089 <ul about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyLITest","href":"./Template:EmptyLITest"},"params":{},"i":0}}]}'>
23090 <li>a</li>
23091 <li>b</li>
23092 </ul>
23093 <table about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRTest","href":"./Template:EmptyTRTest"},"params":{},"i":0}}]}'>
23094 <tbody>
23095 <tr>
23096 <td>foo</td>
23097 </tr>
23098 <tr>
23099 <td>bar</td>
23100 </tr>
23101 </tbody>
23102 </table>
23103 !!end
23104
23105 !!test
23106 Empty LI and TR nodes should not be stripped from top-level content
23107 !!wikitext
23108 * a
23109 *
23110 * b
23111 {|
23112 |-
23113 |-
23114 |foo
23115 |}
23116 !!html/parsoid
23117 <ul>
23118 <li> a</li>
23119 <li></li>
23120 <li> b</li>
23121 </ul>
23122 <table>
23123 <tbody>
23124 <tr></tr>
23125 <tr>
23126 <td>foo</td>
23127 </tr>
23128 </tbody>
23129 </table>
23130 !!end
23131
23132 !!test
23133 Empty TR nodes should not be stripped if they have any attributes set
23134 !!wikitext
23135 {{EmptyTRWithHTMLAttrTest}}
23136 !!html/parsoid
23137 <table about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRWithHTMLAttrTest","href":"./Template:EmptyTRWithHTMLAttrTest"},"params":{},"i":0}}]}'>
23138 <tr align="center"></tr>
23139 <tr><td>foo</td></tr>
23140 <tr align="center"></tr>
23141 <tr><td>bar</td></tr>
23142 </table>
23143 !!end
23144
23145 #### ----------------------------------------------------------------
23146 #### The following section of tests are primarily to test
23147 #### wikitext escaping capabilities of Parsoid. Given that
23148 #### escaping can be done any number of ways, the wikitext (input)
23149 #### is always adjusted to reflect how Parsoid adds nowiki
23150 #### escape tags.
23151 ####
23152 #### We are marking several tests as parsoid-only since the
23153 #### HTML in the result section is different from what the
23154 #### PHP parser generates for it.
23155 #### ----------------------------------------------------------------
23156
23157
23158 #### --------------- Headings ---------------
23159 #### 0. Unnested
23160 #### 1. Nested inside html <h1>=foo=</h1>
23161 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
23162 #### 3. Nested inside html with wikitext split by html tags
23163 #### 4. No escape needed
23164 #### 5. Empty headings <h1></h1>
23165 #### 6. Heading chars in SOL context
23166 #### ----------------------------------------
23167 !! test
23168 Headings: 0. Unnested
23169 !! options
23170 parsoid=html2wt
23171 !! html/parsoid
23172 <p>=foo=</p>
23173
23174 <p> =foo=
23175 <!--cmt-->
23176 =foo=</p>
23177
23178 <p>=foo<i>a</i>=</p>
23179 !! wikitext
23180 <nowiki>=foo=</nowiki>
23181
23182 <nowiki> </nowiki>=foo=
23183 <!--cmt-->
23184 <nowiki>=foo=</nowiki>
23185
23186 =foo''a''<nowiki>=</nowiki>
23187 !!end
23188
23189 # New headings and existing headings are handled differently
23190 !! test
23191 Headings: 1. Nested inside html
23192 !! options
23193 parsoid=html2wt
23194 !! html/parsoid
23195 <h1>=foo=</h1>
23196 <h2>=foo=</h2>
23197 <h3>=foo=</h3>
23198
23199 <h1 data-parsoid=''>=foo=</h1>
23200 <h2 data-parsoid=''>=foo=</h2>
23201 <h3 data-parsoid=''>=foo=</h3>
23202 <h4 data-parsoid=''>=foo=</h4>
23203 <h5 data-parsoid=''>=foo=</h5>
23204 <h6 data-parsoid=''>=foo=</h6>
23205 !! wikitext
23206 = =foo= =
23207
23208 == =foo= ==
23209
23210 === =foo= ===
23211
23212 =<nowiki>=foo=</nowiki>=
23213 ==<nowiki>=foo=</nowiki>==
23214 ===<nowiki>=foo=</nowiki>===
23215 ====<nowiki>=foo=</nowiki>====
23216 =====<nowiki>=foo=</nowiki>=====
23217 ======<nowiki>=foo=</nowiki>======
23218
23219 !!end
23220
23221 !! test
23222 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
23223 !! options
23224 parsoid=html2wt
23225 !! html/parsoid
23226 <h1>foo</h1>*bar
23227 <h1>foo</h1>=bar
23228 <h1>foo</h1>=bar=
23229 !! wikitext
23230 = foo =
23231 <nowiki>*</nowiki>bar
23232
23233 = foo =
23234 =bar
23235
23236 = foo =
23237 <nowiki>=bar=</nowiki>
23238 !!end
23239
23240 !! test
23241 Headings: 3. Nested inside html with wikitext split by html tags
23242 !! options
23243 parsoid=html2wt
23244 !! html/parsoid
23245 <h1>=<b>bold</b>foo=</h1>
23246 !! wikitext
23247 = ='''bold'''foo= =
23248 !!end
23249
23250 !! test
23251 Headings: 4a. No escaping needed (testing just h1 and h2)
23252 !! options
23253 parsoid=html2wt
23254 !! html/parsoid
23255 <h1>=foo</h1>
23256 <h1>foo=</h1>
23257 <h1> =foo= </h1>
23258 <h1>=foo= bar</h1>
23259 <h2>=foo</h2>
23260 <h2>foo=</h2>
23261 <h1>=</h1>
23262 <h1><i>=</i>foo=</h1>
23263 !! wikitext
23264 = =foo =
23265
23266 = foo= =
23267
23268 = =foo= =
23269
23270 = =foo= bar =
23271
23272 == =foo ==
23273
23274 == foo= ==
23275
23276 = = =
23277
23278 = ''=''foo= =
23279 !!end
23280
23281 !! test
23282 Headings: 4b. No escaping needed (inside p-tags)
23283 !! options
23284 parsoid=html2wt
23285 !! html/parsoid
23286 <p>===
23287 =foo= x
23288 =foo= <s></s>
23289 </p>
23290 !! wikitext
23291 ===
23292 =foo= x
23293 =foo= <s></s>
23294 !!end
23295
23296 !! test
23297 Headings: 5. Empty headings
23298 !! options
23299 parsoid=html2wt
23300 !! html/parsoid
23301 <h1 data-parsoid='{}'></h1>
23302
23303 <h2 data-parsoid='{}'></h2>
23304
23305 <h3 data-parsoid='{}'></h3>
23306
23307 <h4 data-parsoid='{}'></h4>
23308
23309 <h5 data-parsoid='{}'></h5>
23310
23311 <h6 data-parsoid='{}'></h6>
23312 !! wikitext
23313 =<nowiki/>=
23314
23315 ==<nowiki/>==
23316
23317 ===<nowiki/>===
23318
23319 ====<nowiki/>====
23320
23321 =====<nowiki/>=====
23322
23323 ======<nowiki/>======
23324 !!end
23325
23326 !! test
23327 Headings: 6a. Heading chars in SOL context (with trailing spaces)
23328 !! options
23329 parsoid=html2wt
23330 !! html/parsoid
23331 <p>=a=</p>
23332
23333 <p>=a=</p>
23334
23335 <p>=a=</p>
23336 !! wikitext
23337 <nowiki>=a=</nowiki>
23338
23339 <nowiki>=a=</nowiki>
23340
23341 <nowiki>=a=</nowiki>
23342 !!end
23343
23344 !! test
23345 Headings: 6b. Heading chars in SOL context (with trailing newlines)
23346 !! options
23347 parsoid=html2wt
23348 !! html/parsoid
23349 <p>=a=
23350 b</p>
23351
23352 <p>=a=
23353 b</p>
23354
23355 <p>=a=
23356 b</p>
23357 !! wikitext
23358 <nowiki>=a=</nowiki>
23359 b
23360
23361 <nowiki>=a=</nowiki>
23362 b
23363
23364 <nowiki>=a=</nowiki>
23365 b
23366 !!end
23367
23368 !! test
23369 Headings: 6c. Heading chars in SOL context (leading newline break)
23370 !! options
23371 parsoid=html2wt
23372 !! html/parsoid
23373 <p>a
23374 =b=</p>
23375 !! wikitext
23376 a
23377 <nowiki>=b=</nowiki>
23378 !!end
23379
23380 !! test
23381 Headings: 6d. Heading chars in SOL context (with interspersed comments)
23382 !! options
23383 parsoid=html2wt
23384 !! html/parsoid
23385 <!--c0--><p>=a=</p>
23386
23387 <!--c1--><p>=a=</p> <!--c2--> <!--c3-->
23388 !! wikitext
23389 <!--c0--><nowiki>=a=</nowiki>
23390
23391 <!--c1--><nowiki>=a=</nowiki> <!--c2--> <!--c3-->
23392 !!end
23393
23394 !! test
23395 Headings: 6d. Heading chars in SOL context (No escaping needed)
23396 !! options
23397 parsoid=html2wt
23398 !! html/parsoid
23399 =a=<div>b</div>
23400 !! wikitext
23401 =a=<div>b</div>
23402 !!end
23403
23404 !! test
23405 Headings: 7. Insert a newline between new content and headings
23406 !! options
23407 parsoid=html2wt
23408 !! html/parsoid
23409 <h2>NEW</h2>
23410 <p>new</p>
23411 <h2 data-parsoid='{}'>A</h2>
23412 <p data-parsoid='{}'>a</p>
23413 !! wikitext
23414 == NEW ==
23415 new
23416
23417 ==A==
23418 a
23419
23420 !! end
23421
23422 #### --------------- Lists ---------------
23423 #### 0. Outside nests (*foo, etc.)
23424 #### 1. Nested inside html <ul><li>*foo</li></ul>
23425 #### 2. Inside definition lists
23426 #### 3. Only bullets at start should be escaped
23427 #### 4. No escapes needed
23428 #### 5. No unnecessary escapes
23429 #### 6. Escape bullets in SOL position
23430 #### 7. Escape bullets in a multi-line context
23431 #### ----------------------------------------
23432
23433 !! test
23434 Lists: 0. Outside nests
23435 !! options
23436 parsoid=html2wt
23437 !! html/parsoid
23438 <p>*foo</p>
23439
23440 <p>#foo</p>
23441
23442 <p>;Foo:bar</p>
23443 !! wikitext
23444 <nowiki>*</nowiki>foo
23445
23446 <nowiki>#</nowiki>foo
23447
23448 <nowiki>;</nowiki>Foo<nowiki>:</nowiki>bar
23449 !!end
23450
23451 ## Making these next 3 tests Parsoid-only since they are html2wt tests
23452 ## to test wikitext escaping, and insignificant whitespace diffs
23453 ## cause PHP parser tests to barf
23454 !! test
23455 Lists: 1. Nested inside html (No unnecessary escapes)
23456 !! options
23457 parsoid=html2wt
23458 !! html/parsoid
23459 <ul>
23460 <li>*foo</li>
23461 <li>#foo</li>
23462 <li>:foo</li>
23463 <li>;foo</li>
23464 <li data-parsoid='{}'>*foo</li>
23465 <li data-parsoid='{}'>#foo</li>
23466 <li data-parsoid='{}'>:foo</li>
23467 <li data-parsoid='{}'>;foo</li>
23468 </ul>
23469
23470 <ol>
23471 <li>*foo</li>
23472 <li>#foo</li>
23473 <li>:foo</li>
23474 <li>;foo</li>
23475 <li data-parsoid='{}'>*foo</li>
23476 <li data-parsoid='{}'>#foo</li>
23477 <li data-parsoid='{}'>:foo</li>
23478 <li data-parsoid='{}'>;foo</li>
23479 </ol>
23480 !! wikitext
23481 * *foo
23482 * #foo
23483 * :foo
23484 * ;foo
23485 *<nowiki>*foo</nowiki>
23486 *<nowiki>#foo</nowiki>
23487 *<nowiki>:foo</nowiki>
23488 *<nowiki>;foo</nowiki>
23489
23490 # *foo
23491 # #foo
23492 # :foo
23493 # ;foo
23494 #<nowiki>*foo</nowiki>
23495 #<nowiki>#foo</nowiki>
23496 #<nowiki>:foo</nowiki>
23497 #<nowiki>;foo</nowiki>
23498 !!end
23499
23500 !! test
23501 Lists: 2. Inside definition lists
23502 !! options
23503 parsoid=html2wt
23504 !! html/parsoid
23505 <dl><dt>;foo</dt></dl>
23506 <dl><dt>:foo</dt></dl>
23507 <dl><dt>:foo</dt>
23508 <dd>bar</dd></dl>
23509 <dl><dd>:foo</dd></dl>
23510 !! wikitext
23511 ; ;foo
23512
23513 ; <nowiki>:foo</nowiki>
23514
23515 ; <nowiki>:foo</nowiki>
23516 : bar
23517
23518 : :foo
23519 !!end
23520
23521 !! test
23522 Lists: 3. Only bullets at start of text in wikitext-generated HTML should be escaped
23523 !! options
23524 parsoid=html2wt
23525 !! html/parsoid
23526 <ul>
23527 <li>*foo*bar</li>
23528 <li data-parsoid='{}'>*foo<i>it</i>*bar</li>
23529 </ul>
23530 !! wikitext
23531 * *foo*bar
23532 *<nowiki>*foo</nowiki>''it''*bar
23533 !!end
23534
23535 !! test
23536 Lists: 4. No escapes needed
23537 !! options
23538 parsoid=html2wt
23539 !! html/parsoid
23540 <ul>
23541 <li>foo*bar
23542 </li>
23543 </ul>
23544 <ul>
23545 <li><i>foo</i>*bar
23546 </li>
23547 </ul>
23548 <ul>
23549 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>: bar
23550 </li>
23551 </ul>
23552 <ul>
23553 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>*bar
23554 </li>
23555 </ul>
23556 !! wikitext
23557 *foo*bar
23558
23559 *''foo''*bar
23560
23561 *[[Foo]]: bar
23562
23563 *[[Foo]]*bar
23564 !!end
23565
23566 !! test
23567 Lists: 5. No unnecessary escapes
23568 !! options
23569 parsoid=html2wt
23570 !! html/parsoid
23571 <ul><li> bar <span>[[foo]]</span></li></ul>
23572 <ul><li> =bar <span>[[foo]]</span></li></ul>
23573 <ul><li> [[bar <span>[[foo]]</span></li></ul>
23574 <ul><li> ]]bar <span>[[foo]]</span></li></ul>
23575 <ul><li> =bar <span>foo]]</span>=</li></ul>
23576 <ul><li> <s></s>: a</li></ul>
23577 <ul><li> <i>* foo</i></li></ul>
23578
23579 !! wikitext
23580 * bar <span><nowiki>[[foo]]</nowiki></span>
23581
23582 * =bar <span><nowiki>[[foo]]</nowiki></span>
23583
23584 * [[bar <span><nowiki>[[foo]]</nowiki></span>
23585
23586 * ]]bar <span><nowiki>[[foo]]</nowiki></span>
23587
23588 * =bar <span>foo]]</span>=
23589
23590 * <s></s>: a
23591
23592 * ''* foo''
23593 !!end
23594
23595 !! test
23596 Lists: 6. Escape bullets in SOL position
23597 !! options
23598 parsoid=html2wt
23599 !! html/parsoid
23600 <p><!--cmt-->*foo</p>
23601 !! wikitext
23602 <!--cmt--><nowiki>*</nowiki>foo
23603 !!end
23604
23605 !! test
23606 Lists: 7. Escape bullets in a multi-line context
23607 !! options
23608 parsoid=html2wt
23609 !! html/parsoid
23610 <p>a
23611 *b
23612 </p>
23613 !! wikitext
23614 a
23615 <nowiki>*</nowiki>b
23616 !!end
23617
23618 !! test
23619 Lists: 8. Escape colons only if not present in tags
23620 !! options
23621 parsoid=html2wt
23622 !! html/parsoid
23623 <dl><dt>a:b<i>c:d</i></dt></dl>
23624 !! wikitext
23625 ; <nowiki>a:b</nowiki>''c:d''
23626 !! end
23627
23628 #### --------------- HRs ---------------
23629 #### 1. Single line
23630 #### -----------------------------------
23631
23632 !! test
23633 HRs: 1. Single line
23634 !! options
23635 parsoid=html2wt
23636 !! html/parsoid
23637 <hr />----
23638 <hr />=foo=
23639 <hr />*foo
23640 !! wikitext
23641 ----<nowiki>----</nowiki>
23642 ----=foo=
23643 ----*foo
23644 !! end
23645
23646 #### --------------- Tables ---------------
23647 #### 1a. Simple example
23648 #### 1b. No escaping needed (!foo)
23649 #### 1c. No escaping needed (|foo)
23650 #### 1d. No escaping needed (|}foo)
23651 ####
23652 #### 2a. Nested in td (<td>foo|bar</td>)
23653 #### 2b. Nested in td (<td>foo||bar</td>)
23654 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
23655 ####
23656 #### 3a. Nested in th (<th>foo!bar</th>)
23657 #### 3b. Nested in th (<th>foo!!bar</th>)
23658 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
23659 ####
23660 #### 4a. Escape -
23661 #### 4b. Escape +
23662 #### 4c. No escaping needed
23663 #### --------------------------------------
23664
23665 !! test
23666 Tables: 1a. Simple example
23667 !! options
23668 parsoid=html2wt
23669 !! html/parsoid
23670 <p>{|
23671 |}
23672 </p>
23673 !! wikitext
23674 <nowiki>{|</nowiki>
23675 |}
23676 !! end
23677
23678 !! test
23679 Tables: 1b. No escaping needed
23680 !! options
23681 parsoid=html2wt
23682 !! html/parsoid
23683 <p>!foo
23684 </p>
23685 !! wikitext
23686 !foo
23687 !! end
23688
23689 !! test
23690 Tables: 1c. No escaping needed
23691 !! options
23692 parsoid=html2wt
23693 !! html/parsoid
23694 <p>|foo
23695 </p>
23696 !! wikitext
23697 |foo
23698 !! end
23699
23700 !! test
23701 Tables: 1d. No escaping needed
23702 !! options
23703 parsoid=html2wt
23704 !! html/parsoid
23705 <p>|}foo
23706 </p>
23707 !! wikitext
23708 |}foo
23709 !! end
23710
23711 !! test
23712 Tables: 2a. Nested in td
23713 !! options
23714 parsoid=html2wt
23715 !! html/parsoid
23716 <table><tbody><tr>
23717 <td>foo|bar</td></tr>
23718 <tr><td>x<div>a|b</div></td>
23719 </tbody></table>
23720 !! wikitext
23721 {|
23722 |<nowiki>foo|bar</nowiki>
23723 |-
23724 |x<div><nowiki>a|b</nowiki></div>
23725 |}
23726 !! html/php+tidy
23727 <table>
23728 <tr>
23729 <td>foo|bar</td>
23730 </tr>
23731 <tr>
23732 <td>x
23733 <div>a|b</div>
23734 </td>
23735 </tr>
23736 </table>
23737 !! end
23738
23739 !! test
23740 Tables: 2b. Nested in td
23741 !! options
23742 parsoid=html2wt
23743 !! html/parsoid
23744 <table><tbody><tr>
23745 <td>foo||bar</td>
23746 <td>a<i>b||c</i></td>
23747 <td>a<i><div>b||c</div></i></td>
23748 </tr></tbody></table>
23749 !! wikitext
23750 {|
23751 |<nowiki>foo||bar</nowiki>
23752 |a''<nowiki>b||c</nowiki>''
23753 |a''<div><nowiki>b||c</nowiki></div>''
23754 |}
23755 !! html/php
23756 <table>
23757 <tr>
23758 <td>foo||bar
23759 </td>
23760 <td>a<i>b||c</i>
23761 </td>
23762 <td>a<i><div>b||c</div></i>
23763 </td></tr></table>
23764
23765 !! end
23766
23767 !! test
23768 Tables: 2c. Nested in td -- no escaping needed
23769 !! options
23770 parsoid=html2wt
23771 !! html/*
23772 <table>
23773 <tr>
23774 <td>foo!!bar
23775 </td></tr></table>
23776
23777 !! wikitext
23778 {|
23779 |foo!!bar
23780 |}
23781 !! end
23782
23783 !! test
23784 Tables: 3a. Nested in th
23785 !! options
23786 parsoid=html2wt
23787 !! html/*
23788 <table>
23789 <tr>
23790 <th>foo!bar
23791 </th></tr></table>
23792
23793 !! wikitext
23794 {|
23795 !foo!bar
23796 |}
23797 !! end
23798
23799 !! test
23800 Tables: 3b. Nested in th
23801 !! options
23802 parsoid=html2wt
23803 !! html/parsoid
23804 <table><tbody>
23805 <tr><th>foo!!bar</th>
23806 <th><i>foo|bar</i></th>
23807 <th><i>foo!!bar</i></th>
23808 <th><i><span>foo!!bar</span></i></th>
23809 </tr></tbody></table>
23810 !! wikitext
23811 {|
23812 !<nowiki>foo!!bar</nowiki>
23813 !''<nowiki>foo|bar</nowiki>''
23814 !''<nowiki>foo!!bar</nowiki>''
23815 !''<span><nowiki>foo!!bar</nowiki></span>''
23816 |}
23817 !! html/php
23818 <table>
23819 <tr>
23820 <th>foo!!bar
23821 </th>
23822 <th><i>foo|bar</i>
23823 </th>
23824 <th><i>foo!!bar</i>
23825 </th>
23826 <th><i><span>foo!!bar</span></i>
23827 </th></tr></table>
23828
23829 !! end
23830
23831 !! test
23832 Tables: 3c. Nested in th
23833 !! options
23834 parsoid=html2wt
23835 !! html/parsoid
23836 <table><tbody>
23837 <tr><th>foo||bar</th>
23838 <th><span typeof="mw:Nowiki">foo||bar</span></th>
23839 </tr></tbody></table>
23840 !! wikitext
23841 {|
23842 !<nowiki>foo||bar</nowiki>
23843 !<nowiki>foo||bar</nowiki>
23844 |}
23845 !! html/php
23846 <table>
23847 <tr>
23848 <th>foo||bar
23849 </th>
23850 <th>foo||bar
23851 </th></tr></table>
23852
23853 !! end
23854
23855 !! test
23856 Tables: 4a. Escape -
23857 !! options
23858 parsoid=html2wt
23859 !! html/*
23860 <table>
23861 <tr>
23862 <th>-bar
23863 </th></tr>
23864 <tr>
23865 <td>-bar
23866 </td></tr></table>
23867
23868 !! wikitext
23869 {|
23870 !-bar
23871 |-
23872 |<nowiki>-bar</nowiki>
23873 |}
23874 !! end
23875
23876 !! test
23877 Tables: 4b. Escape +
23878 !! options
23879 parsoid=html2wt
23880 !! html/*
23881 <table>
23882 <tr>
23883 <th>+bar
23884 </th></tr>
23885 <tr>
23886 <td>+bar
23887 </td></tr></table>
23888
23889 !! wikitext
23890 {|
23891 !+bar
23892 |-
23893 |<nowiki>+bar</nowiki>
23894 |}
23895 !! end
23896
23897 !! test
23898 Tables: 4c. No escaping needed
23899 !! options
23900 parsoid=html2wt
23901 !! html/parsoid
23902 <table><tbody>
23903 <tr><td>foo-bar</td><td>foo+bar</td></tr>
23904 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
23905 <tr><td>foo
23906 <p>bar|baz
23907 +bar
23908 -bar</p></td></tr>
23909 <tr><td>x
23910 <div>a|b</div></td>
23911 </tbody></table>
23912 !! wikitext
23913 {|
23914 |foo-bar
23915 |foo+bar
23916 |-
23917 |''foo''-bar
23918 |''foo''+bar
23919 |-
23920 |foo
23921 bar|baz
23922 +bar
23923 -bar
23924 |-
23925 |x
23926 <div>a|b</div>
23927 |}
23928 !! html/php
23929 <table>
23930 <tr>
23931 <td>foo-bar
23932 </td>
23933 <td>foo+bar
23934 </td></tr>
23935 <tr>
23936 <td><i>foo</i>-bar
23937 </td>
23938 <td><i>foo</i>+bar
23939 </td></tr>
23940 <tr>
23941 <td>foo
23942 <p>bar|baz
23943 +bar
23944 -bar
23945 </p>
23946 </td></tr>
23947 <tr>
23948 <td>x
23949 <div>a|b</div>
23950 </td></tr></table>
23951
23952 !! end
23953
23954 !! test
23955 Tables: 4d. No escaping needed
23956 !! options
23957 parsoid=html2wt
23958 !! html/parsoid
23959 <table>
23960 <tbody><tr><td><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>-bar</td>
23961 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>+1</td>
23962 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>-2</td></tr>
23963 </tbody></table>
23964 !! wikitext
23965 {|
23966 |[[Foo]]-bar
23967 ||+1
23968 ||-2
23969 |}
23970 !! html/php
23971 <table>
23972 <tr>
23973 <td><a href="/wiki/Foo" title="Foo">Foo</a>-bar
23974 </td>
23975 <td>+1
23976 </td>
23977 <td>-2
23978 </td></tr></table>
23979
23980 !! end
23981
23982 !! test
23983 T97430: Don't emit empty nowiki pairs around marker meta tags
23984 !! options
23985 parsoid=html2wt
23986 !! html/parsoid
23987 <p>*This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
23988 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.</p>
23989 !! wikitext
23990 <nowiki>*</nowiki>This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
23991 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.
23992 !! end
23993
23994 !! test
23995 Unclosed xmlish element in table line shouldn't eat end delimiters
23996 !! options
23997 parsoid=html2wt
23998 !! html/parsoid
23999 <table>
24000 <tbody><tr><td> &lt;foo</td>
24001 <td> bar></td></tr>
24002 </tbody></table>
24003 !! wikitext
24004 {|
24005 | <foo
24006 | bar>
24007 |}
24008 !! html/php
24009 <table>
24010 <tr>
24011 <td> &lt;foo
24012 </td>
24013 <td> bar&gt;
24014 </td></tr></table>
24015
24016 !! end
24017
24018 #### --------------- Links ----------------
24019 #### 1. Quote marks in link text
24020 #### 2. Wikilinks: Escapes needed
24021 #### 3. Wikilinks: No escapes needed
24022 #### 4. Extlinks: Escapes needed
24023 #### 5. Extlinks: No escapes needed
24024 #### --------------------------------------
24025 !! test
24026 Links 1. WikiLinks: No escapes needed
24027 !! options
24028 parsoid=html2wt
24029 !! html/parsoid
24030 <p><a rel="mw:WikiLink" href="Foo" title="Foo">Foo<i>boo</i></a>
24031 <a rel="mw:WikiLink" href="Foo" title="Foo">[Foobar]</a>
24032 <a rel="mw:WikiLink" href="Foo" title="Foo">x [Foobar] x</a></p>
24033 !! wikitext
24034 [[Foo|Foo''boo'']]
24035 [[Foo|[Foobar]]]
24036 [[Foo|x [Foobar] x]]
24037 !! html/php
24038 <p><a href="/wiki/Foo" title="Foo">Foo<i>boo</i></a>
24039 <a href="/wiki/Foo" title="Foo">[Foobar]</a>
24040 <a href="/wiki/Foo" title="Foo">x [Foobar] x</a>
24041 </p>
24042 !! end
24043
24044 !! test
24045 Links 2. WikiLinks: Escapes needed
24046 !! options
24047 parsoid=html2wt
24048 !! html/parsoid
24049 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
24050 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
24051 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
24052 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
24053 <a href="Foo" rel="mw:WikiLink">|Bar</a>
24054 <a href="Foo" rel="mw:WikiLink">]]bar</a>
24055 <a href="Foo" rel="mw:WikiLink">[[bar</a>
24056 <a href="Foo" rel="mw:WikiLink">x [[ y</a>
24057 <a href="Foo" rel="mw:WikiLink">x ]] y</a>
24058 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
24059 !! wikitext
24060 [[Foo|<nowiki>Foobar]</nowiki>]]
24061 [[Foo|x <nowiki>[http://google.com g]</nowiki> x]]
24062 [[Foo|<nowiki>[[Bar]]</nowiki>]]
24063 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
24064 [[Foo|<nowiki>|Bar</nowiki>]]
24065 [[Foo|<nowiki>]]bar</nowiki>]]
24066 [[Foo|<nowiki>[[bar</nowiki>]]
24067 [[Foo|<nowiki>x [[ y</nowiki>]]
24068 [[Foo|<nowiki>x ]] y</nowiki>]]
24069 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
24070 !! html/php
24071 <p><a href="/wiki/Foo" title="Foo">Foobar]</a>
24072 <a href="/wiki/Foo" title="Foo">x [http://google.com g] x</a>
24073 <a href="/wiki/Foo" title="Foo">[[Bar]]</a>
24074 <a href="/wiki/Foo" title="Foo">x [[Bar]] x</a>
24075 <a href="/wiki/Foo" title="Foo">|Bar</a>
24076 <a href="/wiki/Foo" title="Foo">]]bar</a>
24077 <a href="/wiki/Foo" title="Foo">[[bar</a>
24078 <a href="/wiki/Foo" title="Foo">x [[ y</a>
24079 <a href="/wiki/Foo" title="Foo">x ]] y</a>
24080 <a href="/wiki/Foo" title="Foo">x ]] y [[ z</a>
24081 </p>
24082 !! end
24083
24084 !! test
24085 Links 3. WikiLinks: No escapes needed
24086 !! options
24087 parsoid=html2wt
24088 !! html/parsoid
24089 <p><a rel="mw:WikiLink" href="Foo">[Foobar</a>
24090 <a rel="mw:WikiLink" href="Foo" title="Foo">foo|bar</a></p>
24091 !! wikitext
24092 [[Foo|[Foobar]]
24093 [[Foo|foo|bar]]
24094 !! html/php
24095 <p><a href="/wiki/Foo" title="Foo">[Foobar</a>
24096 <a href="/wiki/Foo" title="Foo">foo|bar</a>
24097 </p>
24098 !! end
24099
24100 !! test
24101 Links 4. ExtLinks: Escapes needed
24102 !! options
24103 parsoid=html2wt
24104 !! html/parsoid
24105 <p><a rel="mw:ExtLink" href="http://google.com">[google]</a>
24106 <a rel="mw:ExtLink" href="http://google.com">google]</a>
24107 <a rel="mw:ExtLink" href="http://google.com">goog] le</a></p>
24108 <p>[http://google.com]</p>
24109 <p>[http://google.com google]</p>
24110 <p>[<a rel="mw:ExtLink" href="http://google.com">http://google.com</a>]</p>
24111 <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>
24112 !! wikitext
24113 [http://google.com <nowiki>[google]</nowiki>]
24114 [http://google.com <nowiki>google]</nowiki>]
24115 [http://google.com <nowiki>goog] le</nowiki>]
24116
24117 <nowiki>[http://google.com]</nowiki>
24118
24119 <nowiki>[http://google.com google]</nowiki>
24120
24121 [http://google.com<nowiki>]</nowiki>
24122
24123 [{{echo|http://google.com}}<nowiki>]</nowiki>
24124 !! html/php
24125 <p><a rel="nofollow" class="external text" href="http://google.com">[google]</a>
24126 <a rel="nofollow" class="external text" href="http://google.com">google]</a>
24127 <a rel="nofollow" class="external text" href="http://google.com">goog] le</a>
24128 </p><p>[http://google.com]
24129 </p><p>[http://google.com google]
24130 </p><p>[<a rel="nofollow" class="external free" href="http://google.com">http://google.com</a>]
24131 </p><p>[<a rel="nofollow" class="external free" href="http://google.com">http://google.com</a>]
24132 </p>
24133 !! end
24134
24135 !! test
24136 Links 5. ExtLinks: No escapes needed
24137 !! options
24138 parsoid=html2wt
24139 !! html/parsoid
24140 <p><a rel="mw:ExtLink" href="http://google.com">[google</a></p>
24141 <p>[<a ref="mw:ExtLink" href="http://google.com"></a>]</p>
24142 !! wikitext
24143 [http://google.com [google]
24144
24145 [[http://google.com]]
24146 !! html/php
24147 <p><a rel="nofollow" class="external text" href="http://google.com">[google</a>
24148 </p><p>[<a rel="nofollow" class="external autonumber" href="http://google.com">[1]</a>]
24149 </p>
24150 !! end
24151
24152 !! test
24153 Links 6. Add <nowiki/>s between text-nodes and url-links when required (T66300)
24154 !! options
24155 parsoid=html2wt
24156 !! html/parsoid
24157 <p>x<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>y
24158 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>?x
24159 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>&amp;x
24160 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>'x
24161 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,x
24162 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.x
24163 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
24164 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>:x
24165 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
24166 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>!x
24167 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>=x
24168 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>(x)
24169 <a rel="mw:ExtLink" href="http://example.com(x" data-parsoid='{"stx":"url"}'>http://example.com(x</a>)
24170 </p>
24171 !! wikitext
24172 x<nowiki/>http://example.com<nowiki/>y
24173 http://example.com<nowiki/>?x
24174 http://example.com<nowiki/>&x
24175 http://example.com<nowiki/>'x
24176 http://example.com<nowiki/>,x
24177 http://example.com<nowiki/>.x
24178 http://example.com<nowiki/>;x
24179 http://example.com<nowiki/>:x
24180 http://example.com<nowiki/>;x
24181 http://example.com<nowiki/>!x
24182 http://example.com<nowiki/>=x
24183 http://example.com<nowiki/>(x)
24184 http://example.com(x<nowiki/>)
24185 !! end
24186
24187 !! test
24188 Links 7a. Don't add spurious <nowiki/>s between text-nodes and url-links (T66300)
24189 !! options
24190 parsoid=html2wt
24191 !! html/parsoid
24192 <p>x
24193 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>
24194 y
24195 "<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>"
24196 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>)
24197 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>) foo
24198 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,
24199 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>, foo
24200 </p>
24201 !! wikitext
24202 x
24203 http://example.com
24204 y
24205 "http://example.com"
24206 (http://example.com)
24207 (http://example.com) foo
24208 http://example.com,
24209 http://example.com, foo
24210 !! html/php
24211 <p>x
24212 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
24213 y
24214 "<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>"
24215 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
24216 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>) foo
24217 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
24218 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>, foo
24219 </p>
24220 !! end
24221
24222 !! test
24223 Links 7b. Don't add spurious <nowiki/>s between text-nodes and url-links (T66300)
24224 !! options
24225 parsoid=html2wt
24226 !! html/parsoid
24227 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.,;:!?\
24228 -<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:</p>
24229 !! wikitext
24230 http://example.com.,;:!?\
24231 -http://example.com:
24232 !! html/php
24233 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.,;:!?\
24234 -<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
24235 </p>
24236 !! end
24237
24238 !! test
24239 Links 8. Add <nowiki/>s between text-nodes and RFC-links when required (T66300)
24240 !! options
24241 parsoid=html2wt
24242 !! html/parsoid
24243 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>4
24244 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
24245 X<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y</p>
24246 !! wikitext
24247 RFC 123<nowiki/>4
24248 RFC 123<nowiki/>y
24249 X<nowiki/>RFC 123<nowiki/>y
24250 !! end
24251
24252 !! test
24253 Links 9. Don't add spurious <nowiki/>s between text-nodes and RFC-links (T66300)
24254 !! options
24255 parsoid=html2wt
24256 !! html/parsoid
24257 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>?foo
24258 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>&amp;foo
24259 -<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>-
24260 </p>
24261 !! wikitext
24262 RFC 123?foo
24263 RFC 123&foo
24264 -RFC 123-
24265 !! html/php
24266 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>?foo
24267 <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>&amp;foo
24268 -<a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>-
24269 </p>
24270 !! end
24271
24272 !! test
24273 Links 10. Add <nowiki/>s between text-nodes and PMID-links when required (T66300)
24274 !! options
24275 parsoid=html2wt
24276 !! html/parsoid
24277 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>4
24278 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
24279 X<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
24280 !! wikitext
24281 PMID 123<nowiki/>4
24282 PMID 123<nowiki/>y
24283 X<nowiki/>PMID 123<nowiki/>y
24284 !! end
24285
24286 !! test
24287 Links 11. Don't add spurious <nowiki/>s between text-nodes and PMID-links (T66300)
24288 !! options
24289 parsoid=html2wt
24290 !! html/parsoid
24291 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>?foo
24292 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>&foo
24293 -<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>-
24294 </p>
24295 !! wikitext
24296 PMID 123?foo
24297 PMID 123&foo
24298 -PMID 123-
24299 !! html/php
24300 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>?foo
24301 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>&amp;foo
24302 -<a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>-
24303 </p>
24304 !! end
24305
24306 !! test
24307 Links 12. Add <nowiki/>s between text-nodes and ISBN-links when required (T66300)
24308 !! options
24309 parsoid=html2wt
24310 !! html/parsoid
24311 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>1
24312 <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>x
24313 a<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>b
24314 </p>
24315 !! wikitext
24316 ISBN 1234567890<nowiki/>1
24317 ISBN 1234567890<nowiki/>x
24318 a<nowiki/>ISBN 1234567890<nowiki/>b
24319 !! end
24320
24321 !! test
24322 Links 13. Don't add spurious <nowiki/>s between text-nodes and ISBN-links (T66300)
24323 !! options
24324 parsoid=html2wt
24325 !! html/parsoid
24326 <p>-<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>'s
24327 !! wikitext
24328 -ISBN 1234567890's
24329 !! html/php
24330 <p>-<a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>'s
24331 </p>
24332 !! end
24333
24334 !! test
24335 Links 14. Protect link-like plain text. (Parsoid bug T78425)
24336 !! options
24337 parsoid=html2wt
24338 !! html/*
24339 <p>this is not a link: http://example.com
24340 </p>
24341 !! wikitext
24342 this is not a link: <nowiki>http://example.com</nowiki>
24343 !! end
24344
24345 !! test
24346 Links 15. Link trails can't become link prefixes.
24347 !! options
24348 language=is
24349 parsoid=html2wt
24350 !! html/parsoid
24351 <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>
24352 !! wikitext
24353 [[Söfnuður]]-[[00]]
24354 !! html/php
24355 <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>
24356 </p>
24357 !! end
24358
24359 #### --------------- Quotes ---------------
24360 #### 1. Quotes inside <b> and <i>
24361 #### 2. Link fragments separated by <i> and <b> tags
24362 #### 3. Link fragments inside <i> and <b>
24363 #### 4. No escaping needed
24364 #### --------------------------------------
24365 !! test
24366 1a. Quotes inside <b> and <i>
24367 !! options
24368 parsoid=html2wt
24369 !! html/*
24370 <p><i>'foo'</i>
24371 <i>''foo''</i>
24372 <i>'''foo'''</i>
24373 <i>foo</i>'s
24374 <b>'foo'</b>
24375 <b>''foo''</b>
24376 <b>'''foo'''</b>
24377 <b>foo'<i>bar'</i>baz</b>
24378 <b>foo</b>'s
24379 '<i>foo</i>
24380 <i>foo</i>'
24381 <i>foo'</i>'
24382 '<i>foo</i>'
24383 '<b>foo</b>
24384 <b>foo</b>'
24385 '<b>foo</b>'
24386 <i>fools'<span> errand</span></i>
24387 <i><span>fool</span>'s errand</i>
24388 '<i>foo</i> bar '<i>baz</i>
24389 a|!*#-:;+-~[]{}b'<i>x</i>
24390 </p>
24391 !! wikitext
24392 ''<nowiki/>'foo'''
24393 ''<nowiki>''foo''</nowiki>''
24394 ''<nowiki>'''foo'''</nowiki>''
24395 ''foo''<nowiki/>'s
24396 '''<nowiki/>'foo''''
24397 '''<nowiki>''foo''</nowiki>'''
24398 '''<nowiki>'''foo'''</nowiki>'''
24399 '''foo'<nowiki/>''bar'<nowiki/>''baz'''
24400 '''foo'''<nowiki/>'s
24401 '''foo''
24402 ''foo''<nowiki/>'
24403 ''foo'''<nowiki/>'
24404 '''foo''<nowiki/>'
24405 ''''foo'''
24406 '''foo'''<nowiki/>'
24407 ''''foo'''<nowiki/>'
24408 ''fools'<span> errand</span>''
24409 ''<span>fool</span>'s errand''
24410 '<nowiki/>''foo'' bar '''baz''
24411 a|!*#-:;+-~[]{}b'''x''
24412 !! end
24413
24414 !! test
24415 1b. Quotes inside <b> and <i> with other tags on same line
24416 !! options
24417 parsoid=html2wt
24418 !! html/parsoid
24419 '<i>a</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
24420 <i>a'</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
24421 <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>
24422 <a rel="mw:WikiLink" href="Foo" title="Foo">foo</a> x'<i><a href="Bar" rel="mw:WikiLink" title="Bar">bar</a></i>
24423 '<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>
24424 '<i>foo</i> <div title="name">test</div>
24425 '<i>foo</i> and <br data-parsoid='{"stx":"html","noClose":true}'/> bar
24426 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
24427 <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>
24428 </ol>
24429 !! wikitext
24430 '''a'' foo ''[[bar]]''
24431 ''a''' foo ''[[bar]]''
24432 ''a''' foo '''{{echo|[[bar]]}}'''
24433 [[foo]] x'''[[bar]]''
24434 '''foo'' <ref>test</ref>
24435 '''foo'' <div title="name">test</div>
24436 '''foo'' and <br> bar
24437 <references />
24438 !! end
24439
24440 !! test
24441 2. Link fragments separated by <i> and <b> tags
24442 !! options
24443 parsoid=html2wt
24444 !! html/parsoid
24445 <p>[[<i>foo</i>hello]]</p>
24446 <p>[[<b>foo</b>hello]]</p>
24447 !! wikitext
24448 [[''foo''<nowiki>hello]]</nowiki>
24449
24450 [['''foo'''<nowiki>hello]]</nowiki>
24451 !! end
24452
24453 # FIXME: Escaping one or both of [[ and ]] is also acceptable --
24454 # this is one of the shortcomings of this format
24455 !! test
24456 3. Link fragments inside <i> and <b>
24457 !! options
24458 parsoid=html2wt
24459 !! html/parsoid
24460 <p><i>[[foo</i>]]</p>
24461 <p><b>[[foo</b>]]</p>
24462 !! wikitext
24463 ''[[foo''<nowiki>]]</nowiki>
24464
24465 '''[[foo'''<nowiki>]]</nowiki>
24466 !! end
24467
24468 !! test
24469 4. No escaping needed
24470 !! options
24471 parsoid=html2wt
24472 !! html/parsoid
24473 <p>'<span><i>bar</i></span>'
24474 '<span><b>bar</b></span>'
24475 'a:b'foo
24476 </p>
24477 !! wikitext
24478 '<span>''bar''</span>'
24479 '<span>'''bar'''</span>'
24480 'a:b'foo
24481 !! end
24482
24483 #### ----------- Paragraphs ---------------
24484 #### 1. No unnecessary escapes
24485 #### --------------------------------------
24486
24487 !! test
24488 1. No unnecessary escapes
24489 !! options
24490 parsoid=html2wt
24491 !! html/parsoid
24492 <p>bar <span>[[foo]]</span>
24493 </p><p>=bar <span>[[foo]]</span>
24494 </p><p>[[bar <span>[[foo]]</span>
24495 </p><p>]]bar <span>[[foo]]</span>
24496 </p><p>=bar <span>foo]]</span>=
24497 </p>
24498 !! wikitext
24499 bar <span><nowiki>[[foo]]</nowiki></span>
24500
24501 =bar <span><nowiki>[[foo]]</nowiki></span>
24502
24503 [[bar <span><nowiki>[[foo]]</nowiki></span>
24504
24505 ]]bar <span><nowiki>[[foo]]</nowiki></span>
24506
24507 =bar <span>foo]]</span><nowiki>=</nowiki>
24508 !!end
24509
24510 #### ----------------------- PRE --------------------------
24511 #### 1. Leading whitespace in SOL context should be escaped
24512 #### ------------------------------------------------------
24513 !! test
24514 1. Leading whitespace in SOL context should be escaped
24515 !! options
24516 parsoid=html2wt
24517 !! html/parsoid
24518 <p> a</p>
24519
24520 <p> a</p>
24521
24522 <p> a(tab)</p>
24523
24524 <p> a
24525 <!--cmt-->
24526 a</p>
24527
24528 <p>a
24529 b</p>
24530
24531 <p>a
24532 b</p>
24533
24534 <p>a
24535 b</p>
24536 !! wikitext
24537 <nowiki> </nowiki>a
24538
24539 <nowiki> </nowiki> a
24540
24541 a(tab)
24542
24543 <nowiki> </nowiki> a
24544 <!--cmt-->
24545 <nowiki> </nowiki>a
24546
24547 a
24548 <nowiki> </nowiki>b
24549
24550 a
24551 b
24552
24553 a
24554 b
24555 !! html/php
24556 <p> a
24557 </p><p> a
24558 </p><p> a(tab)
24559 </p><p> a
24560 a
24561 </p><p>a
24562 b
24563 </p><p>a
24564 b
24565 </p><p>a
24566 b
24567 </p>
24568 !! end
24569
24570 !! test
24571 2. Leading whitespace in non-indent-pre contexts should not be escaped
24572 !! options
24573 parsoid=html2wt
24574 !! html/parsoid
24575 <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>
24576 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
24577 <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>
24578 b</span></li>
24579 </ol>
24580 !! wikitext
24581 foo <ref>''a''
24582 b</ref>
24583 <references />
24584 !! end
24585
24586 !! test
24587 3. Leading whitespace in indent-pre suppressing contexts should not be escaped
24588 !! options
24589 parsoid=html2wt
24590 !! html/parsoid
24591 <blockquote>
24592 <p>
24593 a
24594 <span>b</span>
24595 c</p>
24596 </blockquote>
24597 !! wikitext
24598 <blockquote>
24599 a
24600 <span>b</span>
24601 c
24602 </blockquote>
24603 !! end
24604
24605 !! test
24606 4. Leading whitespace in indent-pre suppressing contexts should not be escaped
24607 !! options
24608 parsoid=html2wt
24609 !! html/parsoid
24610 <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>
24611 !! wikitext
24612 [[File:Foobar.jpg|thumb|caption]]
24613 !! end
24614
24615 !! test
24616 5. Nowiki escaping should account for indent-pres
24617 !! options
24618 parsoid=html2wt
24619 !! html/parsoid
24620 <pre>==foo==</pre>
24621 !! wikitext
24622 ==foo==
24623 !! end
24624
24625 !!test
24626 T95794: nowiki escaping should account for leading space at start-of-line in an indent-pre block
24627 !! options
24628 parsoid=html2wt
24629 !! html/parsoid
24630 <pre>
24631 * foo
24632 * bar
24633 </pre>
24634 !! wikitext
24635 * foo
24636 * bar
24637 !! end
24638
24639 #### --------------- Behavior Switches --------------------
24640
24641 !! test
24642 1. Valid behavior switches should be escaped
24643 !! options
24644 parsoid=html2wt
24645 !! html/parsoid
24646 __TOC__
24647 <i>__TOC__</i>
24648 !! wikitext
24649 <nowiki>__TOC__</nowiki>
24650 ''<nowiki>__TOC__</nowiki>''
24651 !! end
24652
24653 !! test
24654 2. Invalid behavior switches should not be escaped
24655 !! options
24656 parsoid=html2wt
24657 !! html/parsoid
24658 __TOO__
24659 __|__
24660 !! wikitext
24661 __TOO__
24662 __|__
24663 !! end
24664
24665 # We use indent-pre as an indirect way to test for sol-transparent behavior.
24666 !! test
24667 Behavior switches should be SOL-transparent
24668 !! options
24669 parsoid=html2wt
24670 !! html/parsoid
24671 <meta property="mw:PageProp/toc" />
24672
24673 <!-- this one's bogus -->
24674 <pre>__TOO__</pre>
24675
24676 <pre data-parsoid='{}'><meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/> foo</pre>
24677
24678 <meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/><pre data-parsoid='{}'>bar</pre>
24679 !! wikitext
24680 __TOC__
24681
24682 <!-- this one's bogus -->
24683 __TOO__
24684
24685 __TOC__ foo
24686
24687 __TOC__
24688 bar
24689 !! end
24690
24691 #### --------------- HTML tags ---------------
24692 #### 1. a tags
24693 #### 2. other tags
24694 #### 3. multi-line html tag
24695 #### 4. extension tags
24696 #### -----------------------------------------
24697 !! test
24698 1. a tags
24699 !! options
24700 parsoid=html2wt
24701 !! html/parsoid
24702 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
24703 !! wikitext
24704 <a href="http://google.com">google</a>
24705 !! end
24706
24707 !! test
24708 2. other tags
24709 !! options
24710 parsoid=html2wt
24711 !! html/parsoid
24712 <ul><li> &lt;div&gt;foo&lt;/div&gt;</li>
24713 <li> &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;</li>
24714 <li> &lt;td&gt;</li></ul>
24715
24716 !! wikitext
24717 * <nowiki><div>foo</div></nowiki>
24718 * <nowiki><div style="color:red">foo</div></nowiki>
24719 * <nowiki><td></nowiki>
24720 !! end
24721
24722 !! test
24723 3. multi-line html tag
24724 !! options
24725 parsoid=html2wt
24726 !! html/parsoid
24727 <p>&lt;div
24728 &gt;foo&lt;/div
24729 &gt;
24730 </p>
24731 !! wikitext
24732 <nowiki><div
24733 >foo</div
24734 ></nowiki>
24735 !! end
24736
24737 !! test
24738 4. extension tags
24739 !! options
24740 parsoid=html2wt
24741 !! html/parsoid
24742 <p>&lt;ref&gt;foo&lt;/ref&gt;
24743 </p><p>&lt;ref&gt;bar
24744 </p><p>baz&lt;/ref&gt;
24745 </p>
24746 !! wikitext
24747 <nowiki><ref>foo</ref></nowiki>
24748
24749 <nowiki><ref>bar</nowiki>
24750
24751 baz<nowiki></ref></nowiki>
24752 !! end
24753
24754 #### --------------- Others ---------------
24755 !! test
24756 Escaping nowikis
24757 !! options
24758 parsoid=html2wt
24759 !! html/parsoid
24760 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
24761 </p>
24762 !! wikitext
24763 &lt;nowiki&gt;foo&lt;/nowiki&gt;
24764 !! end
24765
24766 ## The quote-char in the input is necessary for triggering the bug
24767 !! test
24768 (T54035) Nowiki-escaping should not get tripped by " :" in text
24769 !! options
24770 parsoid=html2wt
24771 !! html/parsoid
24772 <p>foo's bar :</p>
24773 !! wikitext
24774 foo's bar :
24775 !! end
24776
24777 #----------- End of wikitext escaping tests --------------
24778
24779 !! test
24780
24781 Tag-like HTML structures are passed through as text
24782 !! wikitext
24783 <x y>
24784
24785 <x.y>
24786
24787 <x-y>
24788
24789 1>2
24790
24791 x<y
24792
24793 a>b
24794
24795 1<d e>f
24796 !! html
24797 <p>&lt;x y&gt;
24798 </p><p>&lt;x.y&gt;
24799 </p><p>&lt;x-y&gt;
24800 </p><p>1&gt;2
24801 </p><p>x&lt;y
24802 </p><p>a&gt;b
24803 </p><p>1&lt;d e&gt;f
24804 </p>
24805 !! end
24806
24807 !! test
24808 HTML tag with necessary entities in attributes
24809 !! wikitext
24810 <span title="&amp;amp;">foo</span>
24811 !! html
24812 <p><span title="&amp;amp;">foo</span>
24813 </p>
24814 !! end
24815
24816 !! test
24817 HTML tag with 'unnecessary' entity encoding in attributes
24818 !! wikitext
24819 <span title="&amp;">foo</span>
24820 !! html
24821 <p><span title="&amp;">foo</span>
24822 </p>
24823 !! end
24824
24825 !! test
24826 HTML tag with broken attribute value quoting
24827 !! options
24828 parsoid=wt2html,html2html
24829 !! wikitext
24830 <span title="Hello world>Foo</span>
24831 !! html/php
24832 <p><span title="Hello world">Foo</span>
24833 </p>
24834 !! html/parsoid
24835 <p><span title="Hello world">Foo</span></p>
24836 !! end
24837
24838 !! test
24839 Self-closed tag with broken attribute value quoting
24840 !! options
24841 parsoid=wt2html,html2html
24842 !! wikitext
24843 <div title="Hello world />Foo
24844 !! html/php+tidy
24845 <div title="Hello world"></div>
24846 <p>Foo</p>
24847 !! html/parsoid
24848 <div title="Hello world " data-parsoid='{"stx":"html","selfClose":true}'></div><p>Foo</p>
24849 !! end
24850
24851 !! test
24852 Table with broken attribute value quoting
24853 !! options
24854 parsoid=wt2html,html2html
24855 !! wikitext
24856 {|
24857 | title="Hello world|Foo
24858 |}
24859 !! html/php
24860 <table>
24861 <tr>
24862 <td title="Hello world">Foo
24863 </td></tr></table>
24864
24865 !! html/parsoid
24866 <table>
24867 <tr>
24868 <td title="Hello world">Foo
24869 </td></tr></table>
24870
24871 !! end
24872
24873 !! test
24874 Table with broken attribute value quoting on consecutive lines
24875 !! options
24876 parsoid=wt2html,html2html
24877 !! wikitext
24878 {|
24879 | title="Hello world|Foo
24880 | style="color:red|Bar
24881 |}
24882 !! html/php
24883 <table>
24884 <tr>
24885 <td title="Hello world">Foo
24886 </td>
24887 <td style="color:red">Bar
24888 </td></tr></table>
24889
24890 !! html/parsoid
24891 <table><tbody>
24892 <tr>
24893 <td title="Hello world">Foo
24894 </td><td style="color: red">Bar
24895 </td></tr></tbody></table>
24896
24897 !! end
24898
24899 !!test
24900 Accept empty td cell attribute
24901 !! wikitext
24902 {|
24903 | align="center" | foo || |
24904 |}
24905 !! html
24906 <table>
24907 <tr>
24908 <td align="center"> foo </td>
24909 <td>
24910 </td></tr></table>
24911
24912 !!end
24913
24914 !!test
24915 Non-empty attributes in th-cells
24916 !! wikitext
24917 {|
24918 ! Foo !! style="color: red" | Bar
24919 |}
24920 !! html
24921 <table>
24922 <tr>
24923 <th> Foo </th>
24924 <th style="color: red"> Bar
24925 </th></tr></table>
24926
24927 !!end
24928
24929 !!test
24930 Accept empty attributes in th-cells
24931 !! wikitext
24932 {|
24933 !| foo !!| bar
24934 |}
24935 !! html
24936 <table>
24937 <tr>
24938 <th> foo </th>
24939 <th> bar
24940 </th></tr></table>
24941
24942 !!end
24943
24944 !!test
24945 Empty table rows go away
24946 !! wikitext
24947 {|
24948 | Hello
24949 | there
24950 |- class="foo"
24951 |-
24952 |}
24953 !! html
24954 <table>
24955 <tr>
24956 <td> Hello
24957 </td>
24958 <td> there
24959 </td></tr>
24960
24961 </table>
24962
24963 !! end
24964
24965 ###
24966 ### Parsoid-centric tests for testing RTing of inter-element separators
24967 ### Edge cases not tested by existing parser tests and specific to
24968 ### Parsoid-specific serialization strategies.
24969 ###
24970
24971 !!test
24972 RT-ed inter-element separators should be valid separators
24973 !! wikitext
24974 {|
24975 |- [[foo]]
24976 |}
24977 !! html/php
24978 <table>
24979
24980 </table>
24981
24982 !! html/parsoid
24983 <table>
24984 <tbody><tr data-parsoid='{"startTagSrc":"|-","a":{"[[foo]]":null},"sa":{"[[foo]]":""},"autoInsertedEnd":true}'></tr>
24985 </tbody></table>
24986 !!end
24987
24988 # Parsoid-only since PHP parser relies on Tidy for correct output
24989 !!test
24990 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
24991 !!options
24992 parsoid
24993 !! wikitext
24994 {|
24995 |<small>foo
24996 bar
24997 |}
24998
24999 {|
25000 |<small>foo<small>
25001 |}
25002 !! html
25003 <table>
25004 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'>foo
25005 <p>bar</p></small></td></tr>
25006 </tbody></table>
25007
25008 <table>
25009 <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>
25010 </tbody></table>
25011 !!end
25012
25013 # Note that the "style" attribute is really a template parameter here.
25014 # The = would have to be {{=}} if you wanted the literal.
25015 !!test
25016 Empty TD followed by TD with tpl-generated attribute
25017 !! wikitext
25018 {|
25019 |-
25020 |
25021 |{{echo|style='color:red'}}|foo
25022 |}
25023 !! html
25024 <table>
25025
25026 <tr>
25027 <td>
25028 </td>
25029 <td>foo
25030 </td></tr></table>
25031
25032 !!end
25033
25034 !!test
25035 Indented table with an empty td
25036 !! wikitext
25037 {|
25038 |-
25039 |
25040 |foo
25041 |}
25042 !! html
25043 <table>
25044
25045 <tr>
25046 <td>
25047 </td>
25048 <td>foo
25049 </td></tr></table>
25050
25051 !!end
25052
25053 ## We have some newline diffs RT-ing this edge case
25054 ## and it is not important enough -- we seem to be emitting
25055 ## at most 2 newlines after a </tr> and this is unrelated to
25056 ## the issue from T85627 that this is testing.
25057 !!test
25058 Indented table with blank lines in between (T85627)
25059 !! options
25060 parsoid=wt2html
25061 !! wikitext
25062 {|
25063 |foo
25064
25065
25066 |}
25067 !! html
25068 <table>
25069
25070 <tr>
25071 <td>foo
25072 </td></tr></table>
25073
25074 !!end
25075
25076 !!test
25077 Indented block & table
25078 !! wikitext
25079 <div>foo</div>
25080 {|
25081 |foo
25082 |}
25083 !! html/php
25084 <div>foo</div>
25085 <table>
25086 <tr>
25087 <td>foo
25088 </td></tr></table>
25089
25090 !! html/parsoid
25091 <div data-parsoid='{"stx":"html"}'>foo</div>
25092 <table><tbody>
25093 <tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>foo</td></tr>
25094 </tbody></table>
25095 !!end
25096
25097 !! test
25098 Indent and comment before table row
25099 !! wikitext
25100 {|
25101 <!--hi-->|-
25102 | there
25103 |}
25104 !! html/php
25105 <table>
25106
25107 <tr>
25108 <td> there
25109 </td></tr></table>
25110
25111 !! html/parsoid
25112 <table>
25113 <!--hi--><tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
25114 <td data-parsoid='{"autoInsertedEnd":true}'> there</td></tr>
25115 </tbody></table>
25116 !! end
25117
25118 # Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext
25119 !!test
25120 Empty TR followed by a template-generated TR
25121 !!options
25122 parsoid
25123 !! wikitext
25124 {|
25125 |-
25126 {{echo|<tr><td>foo</td></tr>}}
25127 |}
25128 !! html
25129 <table>
25130 <tbody>
25131 <tr></tr>
25132 <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}}]}'>
25133 <td>foo</td></tr>
25134 </tbody></table>
25135 !!end
25136
25137 ## PHP and parsoid output differ for this, and since this is primarily
25138 ## for testing Parsoid's serializer, marking this Parsoid only
25139 !!test
25140 Empty TR followed by mixed-ws-comment line should RT correctly
25141 !!options
25142 parsoid
25143 !! wikitext
25144 {|
25145 |-
25146 <!--c-->
25147 |-
25148 <!--c--> <!--d-->
25149 |}
25150 !! html
25151 <table>
25152 <tbody>
25153 <tr></tr>
25154 <!--c-->
25155 <tr>
25156 <!--c--> </tr><!--d-->
25157 </tbody></table>
25158
25159 !!end
25160
25161 !!test
25162 Multi-line image caption generated by templates with/without trailing newlines
25163 !! wikitext
25164 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
25165 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
25166 !! html/parsoid
25167 <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>
25168 <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>
25169 !!end
25170
25171 !! test
25172 New element inserted (without intervening newlines) after an old sol-transparent node should serialize correctly
25173 !! options
25174 parsoid=html2wt
25175 !! html/parsoid
25176 <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>
25177
25178 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{}'/><h1>new heading</h1>
25179 !! wikitext
25180 <includeonly>foo</includeonly>
25181 new para
25182
25183 [[Category:Foo]]
25184
25185 = new heading =
25186 !! end
25187
25188 ## PHP emits broken html for this, and since this is primarily
25189 ## a Parsoid serializer test, marking this Parsoid only
25190 !!test
25191 Improperly nested inline or quotes tags with whitespace in between
25192 !! wikitext
25193 <span> <s>x</span> </s>
25194 ''' ''x''' ''
25195 !! html/parsoid
25196 <p><span> <s>x</s></span><s> </s>
25197 <b> <i>x</i></b><i> </i>
25198 </p>
25199 !!end
25200
25201 !!test
25202 Encapsulate protected attributes from wt
25203 !! wikitext
25204 <div typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
25205
25206 {| typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true"
25207 | ok
25208 |}
25209 !! html/parsoid
25210 <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>
25211
25212 <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">
25213 <tbody><tr><td data-parsoid='{"autoInsertedEnd":true}'> ok</td></tr>
25214 </tbody></table>
25215 !!end
25216
25217 ## Currently the p-wrapper is fragile in how it adds / removes transformations.
25218 ## Having nested or stray pre tags results in the attempt to add duplicates,
25219 ## causing an assertion fail. This test tries to prevent that situation.
25220 !!test
25221 Ensure ParagraphWrapper can deal with stray closing pre tags
25222 !!options
25223 parsoid=wt2html
25224 !! wikitext
25225 plain text</pre>
25226 !! html/parsoid
25227 plain text
25228 !!end
25229
25230 !!test
25231 1. Ensure fostered text content is wrapped in element nodes
25232 !!options
25233 parsoid=wt2html
25234 !! wikitext
25235 <table>hi</table><table>ho</table>
25236 !! html/parsoid
25237 <p>hi</p>
25238 <table></table>
25239 <p>ho</p>
25240 <table></table>
25241 !!end
25242
25243 !!test
25244 2. Ensure fostered text content is wrapped in element nodes (traps regressions around fostered marker on the element getting lost)
25245 !!options
25246 parsoid=wt2html,wt2wt
25247 !! wikitext
25248 <table>
25249 <tr> || ||
25250 <td> a
25251 </table>
25252 !! html/parsoid
25253 <p> || ||
25254 </p><table>
25255 <tbody><tr><td> a</td></tr>
25256 </tbody></table>
25257 !!end
25258
25259 !!test
25260 Encapsulation properly handles null DSR information from foster box
25261 !!options
25262 parsoid=wt2html,wt2wt
25263 !! wikitext
25264 {{echo|<table>foo<tr><td>bar</td></tr></table>}}
25265 !! html/parsoid
25266 <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>
25267 !!end
25268
25269 !!test
25270 1. Encapsulate foster-parented transclusion content
25271 !!options
25272 parsoid=wt2wt,wt2html
25273 !! wikitext
25274 <table>{{echo|foo<tr><td>bar</td></tr>}}</table>
25275 !! html/parsoid
25276 <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>
25277 <tbody>
25278 <tr>
25279 <td>bar</td>
25280 </tr>
25281 </tbody>
25282 </table>
25283 !!end
25284
25285 !!test
25286 2. Encapsulate foster-parented transclusion content
25287 !!options
25288 parsoid=wt2wt,wt2html
25289 !! wikitext
25290 <table><div>{{echo|foo}}</div><tr><td>bar</td></tr></table>
25291 !! html/parsoid
25292 <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>
25293 <table>
25294 <tbody>
25295 <tr>
25296 <td>bar</td>
25297 </tr>
25298 </tbody>
25299 </table>
25300 !!end
25301
25302 !!test
25303 3. Encapsulate foster-parented transclusion content
25304 !!options
25305 parsoid=wt2wt,wt2html
25306 !! wikitext
25307 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
25308 !! html/parsoid
25309 <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;]}">
25310 <p>foo</p>
25311 </div>
25312 <table>
25313 <tbody>
25314 <tr>
25315 <td>bar</td>
25316 </tr>
25317 </tbody>
25318 </table>
25319 !!end
25320
25321 !!test
25322 4. Encapsulate foster-parented transclusion content
25323 !!options
25324 parsoid=wt2wt,wt2html
25325 !! wikitext
25326 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
25327 !! html/parsoid
25328 <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;]}">
25329 <p>foo</p>
25330 </div>
25331 <table>
25332 <tbody>
25333 <tr>
25334 <td>bar</td>
25335 </tr>
25336 </tbody>
25337 </table>
25338 !!end
25339
25340 !!test
25341 5. Encapsulate foster-parented transclusion content
25342 !!options
25343 parsoid=wt2wt,wt2html
25344 !! wikitext
25345 <table><tr><td><div><p>{{echo|foo</p></div></td>foo}}</tr></table>
25346 !! html/parsoid
25347 <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>
25348 <table>
25349 <tbody>
25350 <tr>
25351 <td>
25352 <div>
25353 <p>foo</p>
25354 </div>
25355 </td>
25356 </tr>
25357 </tbody>
25358 </table>
25359 !!end
25360
25361 !!test
25362 6. Encapsulate foster-parented transclusion content
25363 !!options
25364 parsoid=wt2wt,wt2html
25365 !! wikitext
25366 <table><tr><td><div><p>{{echo|foo</p></div></td>foo</tr></table>}}<p>ok</p>
25367 !! html/parsoid
25368 <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>
25369 <table>
25370 <tbody>
25371 <tr>
25372 <td>
25373 <div>
25374 <p>foo</p>
25375 </div>
25376 </td>
25377 </tr>
25378 </tbody>
25379 </table>
25380 <p>ok</p>
25381 !!end
25382
25383 !!test
25384 7. Encapsulate foster-parented transclusion content
25385 !!options
25386 parsoid=wt2wt,wt2html
25387 !! wikitext
25388 <table>{{echo|<p>foo</p>}}<td>bar</td></table>
25389 !! html/parsoid
25390 <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>
25391 <table>
25392 <tbody>
25393 <tr>
25394 <td>bar</td>
25395 </tr>
25396 </tbody>
25397 </table>
25398 !!end
25399
25400 # Note that the wt is broken on purpose: the = should be {{=}} if you
25401 # don't want it to be a template parameter key.
25402 !!test
25403 8. Encapsulate foster-parented transclusion content
25404 !!options
25405 parsoid=wt2wt,wt2html
25406 !! wikitext
25407 {{echo|a
25408 }}{|{{echo|style='color:red'}}
25409 |-
25410 |b
25411 |}
25412 !! html/parsoid
25413 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\n"}},"i":0}}]}'>a</p>
25414 <span> </span>
25415 <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>
25416 <table>
25417 <tbody>
25418 <tr>
25419 <td>b</td>
25420 </tr>
25421 </tbody>
25422 </table>
25423 !!end
25424
25425 !!test
25426 9. Encapsulate foster-parented transclusion content
25427 !!options
25428 parsoid=wt2wt,wt2html
25429 !! wikitext
25430 <table>{{echo|hi</table>hello}}
25431 !! html/parsoid
25432 <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>
25433 !!end
25434
25435 !!test
25436 Table in fosterable position
25437 !!options
25438 parsoid=wt2html
25439 !! wikitext
25440 {{OpenTable}}
25441 <div>
25442 {|
25443 |}
25444 </div>
25445 |}
25446 !! html/parsoid
25447 <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">
25448 </span>
25449 <table about="#mwt1" data-parsoid='{"autoInsertedEnd":true}'></table>
25450
25451 <table>
25452 </table>
25453 !!end
25454
25455 # Parsoid only for T66747
25456 !! test
25457 Properly encapsulate empty-content transclusions in fosterable positions
25458 !! wikitext
25459 <table>
25460 {{#if:|
25461 <td>foo</td>
25462 }}
25463 </table>
25464 !! html/parsoid
25465 <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"}]]}'>
25466
25467 </table>
25468 !! end
25469
25470 !! test
25471 Always encapsulate foster box when template range is expanded to table
25472 !! options
25473 parsoid=wt2wt
25474 !! wikitext
25475 {|
25476 hello
25477 {{OpenTable}}
25478 |}
25479 !! html/parsoid
25480
25481 !! end
25482
25483 !! test
25484 T115289: Unclosed table
25485 !! wikitext
25486 {{echo|<table>}}<!--c-->[[Category:Two]]
25487 !! html/parsoid
25488 <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>
25489 !! end
25490
25491 !! test
25492 T115289: Don't migrate newlines out of tables with fostered content
25493 !! wikitext
25494 <table><td></td>{{echo|<tr>[[Category:One]]}}<!--c-->[[Category:Two]]
25495 !! html/parsoid
25496 <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>
25497 !! end
25498
25499 !! test
25500 T73074: More fostering fun
25501 !! wikitext
25502 <table><td></td>{{echo|<tr>}}<!--c-->[[Category:Two]]
25503 !! html/parsoid
25504 <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>
25505 !! end
25506
25507 !!test
25508 Support <object> element with .data attribute
25509 !!options
25510 parsoid=html2wt
25511 !! html/parsoid
25512 <object data="test.swf"></object>
25513 !! wikitext
25514 <object data="test.swf"></object>
25515 !!end
25516
25517 !! test
25518 Don't block XML namespace declaration
25519 !! wikitext
25520 <span xmlns:dct="http://purl.org/dc/terms/" property="dct:title">MediaWiki</span>
25521 !! html/php
25522 <p><span xmlns:dct="http&#58;//purl.org/dc/terms/" property="dct:title">MediaWiki</span>
25523 </p>
25524 !! html/parsoid
25525 <p><span xmlns:dct="http://purl.org/dc/terms/" data-x-property="dct:title" data-parsoid='{"stx":"html"}'>MediaWiki</span></p>
25526 !! end
25527
25528 # -----------------------------------------------------------------
25529 # The following section of tests are primarily to spec requirements
25530 # around Parsoid's serialization (old, new, edited content)
25531 #
25532 # All these tests are marked Parsoid html2wt and html2html only
25533 # ----------------------------------------------------------------
25534
25535 !! test
25536 Ignore rel attribute in a-tags during serialization to url-links
25537 !! options
25538 parsoid=html2wt
25539 !! html/parsoid
25540 <a href='http://en.wikipedia.org/wiki/Foobar'>http://en.wikipedia.org/wiki/Foobar</a>
25541 <a href='http://en.wikipedia.org/wiki/Foobar' rel='mw:ExtLink'>http://en.wikipedia.org/wiki/Foobar</a>
25542 <a href='http://en.wikipedia.org/wiki/Foobar' rel='mw:WikiLink'>http://en.wikipedia.org/wiki/Foobar</a>
25543 !! wikitext
25544 http://en.wikipedia.org/wiki/Foobar
25545 http://en.wikipedia.org/wiki/Foobar
25546 http://en.wikipedia.org/wiki/Foobar
25547 !! end
25548
25549 # 'mi' is a localinterwiki prefix as well as a language
25550 !! test
25551 Serialize interwiki links pointing to the current wiki as plain wiki links (T67869)
25552 !! options
25553 parsoid=html2wt
25554 !! html/parsoid
25555 <p><a rel="mw:ExtLink" href="http://mi.wikipedia.org/wiki/Foo">Foo</a></p>
25556 !! wikitext
25557 [[Foo]]
25558 !! end
25559
25560 # See T93839
25561 !! test
25562 New wikilinks should be serialized properly
25563 !! options
25564 parsoid=html2wt
25565 !! html/parsoid
25566 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{}'>Foo</a>
25567 <a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>
25568 <a href="//en.wikipedia.org/wiki/Foo">//en.wikipedia.org/wiki/Foo</a>
25569 <a href="http://en.wikipedia.org/wiki/Foo">http://en.wikipedia.org/wiki/Foo</a>
25570 <a href="//en.wikipedia.org/wiki/Foo_bar">//en.wikipedia.org/wiki/Foo bar</a>
25571 !! wikitext
25572 [[Foo]]
25573 [[Foo]]
25574 [[:en:Foo|//en.wikipedia.org/wiki/Foo]]
25575 http://en.wikipedia.org/wiki/Foo
25576 [[:en:Foo_bar|//en.wikipedia.org/wiki/Foo bar]]
25577 !! end
25578
25579 !! test
25580 New wiki links (href variations)
25581 !! options
25582 parsoid=html2wt
25583 !! html/parsoid
25584 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
25585 <a rel="mw:WikiLink" href="Foo_bar">Foo_bar</a>
25586 <a rel="mw:WikiLink" href="Foo bar">Foo_bar</a>
25587 <a rel="mw:WikiLink" href="./Toxine_bact%C3%A9rienne">Toxine bactérienne</a>
25588 !! wikitext
25589 [[Foo_bar]]
25590 [[Foo_bar]]
25591 [[Foo_bar]]
25592 [[Toxine bactérienne]]
25593 !! end
25594
25595 !! test
25596 New wiki links (content string variations)
25597 !! options
25598 parsoid=html2wt
25599 !! html/parsoid
25600 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
25601 <a rel="mw:WikiLink" href="./Foo_bar">Foo bar</a>
25602 <a rel="mw:WikiLink" href="./Foo_bar">./Foo_bar</a>
25603 !! wikitext
25604 [[Foo_bar]]
25605 [[Foo bar]]
25606 [[Foo_bar|./Foo_bar]]
25607 !! end
25608
25609 !! test
25610 New category links (href variations)
25611 !! options
25612 parsoid=html2wt
25613 !! html/parsoid
25614 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne" />
25615 <link rel="mw:PageProp/Category" href="./Category:Toxine_bact%C3%A9rienne" />
25616 <link rel="mw:PageProp/Category" href="Category:Toxine_bact%C3%A9rienne" />
25617 !! wikitext
25618 [[Category:Toxine bactérienne]]
25619 [[Category:Toxine bactérienne]]
25620 [[Category:Toxine bactérienne]]
25621 !! end
25622
25623 !! test
25624 New sol transparent links don't need indent-pre nowiki protection
25625 !! options
25626 parsoid=html2wt
25627 language=de
25628 !! html/parsoid
25629 <link rel="mw:PageProp/redirect" href="./Main_Page">
25630 <!-- this is good --> <link rel="mw:PageProp/Category" href="./Category:Good" />
25631 <!-- this is great --> <link rel="mw:PageProp/Category" href="./Kategorie:Great" />
25632 !! wikitext
25633 #WEITERLEITUNG [[Main Page]]
25634 <!-- this is good --> [[Category:Good]]
25635 <!-- this is great --> [[Kategorie:Great]]
25636 !! end
25637
25638 !! test
25639 New interlanguage links (href variations)
25640 !! options
25641 parsoid=html2wt
25642 !! html/parsoid
25643 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine bactérienne" />
25644 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bactérienne" />
25645 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bact%C3%A9rienne" />
25646 !! wikitext
25647 [[es:Toxine bactérienne]]
25648 [[es:Toxine_bactérienne]]
25649 [[es:Toxine_bactérienne]]
25650 !! end
25651
25652 !! test
25653 Image: Modifying size of an image (1)
25654 !! options
25655 parsoid={
25656 "modes": ["wt2wt"],
25657 "changes": [
25658 ["img[height]", "attr", "height", "22"],
25659 ["img[width]", "attr", "width", "200"]
25660 ]
25661 }
25662 !! wikitext
25663 [[Image:Foobar.jpg|230x230px]]
25664 !! wikitext/edited
25665 [[Image:Foobar.jpg|200x200px]]
25666 !!end
25667
25668 !! test
25669 Image: Modifying size of an image (2)
25670 !! options
25671 parsoid={
25672 "modes": ["wt2wt"],
25673 "changes": [
25674 ["img[height]", "attr", "height", "100"],
25675 ["img[width]", "attr", "width", "500"]
25676 ]
25677 }
25678 !! wikitext
25679 [[Image:Foobar.jpg|230x230px]]
25680 !! wikitext/edited
25681 [[Image:Foobar.jpg|500x500px]]
25682 !!end
25683
25684 # Change in size is ignored so long as class='mw-default-size'
25685 !! test
25686 Image: Modifying size of an image (3)
25687 !! options
25688 parsoid={
25689 "modes": ["wt2wt"],
25690 "changes": [
25691 ["figure[class]", "removeClass", "mw-default-size"],
25692 ["figure img", "attr", "height", "19"],
25693 ["figure img", "attr", "width", "170"]
25694 ]
25695 }
25696 !! wikitext
25697 [[Image:Foobar.jpg|thumb]]
25698 !! wikitext/edited
25699 [[Image:Foobar.jpg|thumb|170x170px]]
25700 !!end
25701
25702 !! test
25703 Image: Modifying alignment of an image (T50665)
25704 !! options
25705 parsoid={
25706 "modes": ["wt2wt"],
25707 "changes": [
25708 ["figure[class]", "removeClass", "mw-halign-right"],
25709 ["figure[class]", "addClass", "mw-halign-left"]
25710 ]
25711 }
25712 !! wikitext
25713 [[Image:Foobar.jpg|thumb|caption|right]]
25714 !! wikitext/edited
25715 [[Image:Foobar.jpg|thumb|caption|left]]
25716 !! end
25717
25718 !! test
25719 Image: Modifying mw-default-size of an frameless image (T64805)
25720 !! options
25721 parsoid={
25722 "modes": ["wt2wt"],
25723 "changes": [
25724 ["figure.mw-default-size", "removeClass", "mw-default-size"]
25725 ]
25726 }
25727 !! wikitext
25728 [[Image:Foobar.jpg|frameless|right]]
25729 !! wikitext/edited
25730 [[Image:Foobar.jpg|frameless|right|220x220px]]
25731 !! end
25732
25733 !! test
25734 Image: Modifying valign of an image (T51221)
25735 !! options
25736 parsoid={
25737 "modes": ["wt2wt"],
25738 "changes": [
25739 ["*[typeof=\"mw:Image\"]", "removeClass", "mw-valign-middle"],
25740 ["*[typeof=\"mw:Image\"]", "addClass", "mw-valign-text-top"]
25741 ]
25742 }
25743 !! wikitext
25744 [[File:Foobar.jpg|20px|middle]]
25745 !! wikitext/edited
25746 [[File:Foobar.jpg|20px|text-top]]
25747 !! end
25748
25749 !! test
25750 Image: Modifying alt attribute of an image (T58400)
25751 !! options
25752 parsoid={
25753 "modes": ["wt2wt"],
25754 "changes": [
25755 ["img[alt]", "attr", "alt", "some alternate edited text"]
25756 ]
25757 }
25758 !! wikitext
25759 [[File:Foobar.jpg|thumb|some caption|alt=some alternate text]]
25760 !! wikitext/edited
25761 [[File:Foobar.jpg|thumb|some caption|alt=some alternate edited text]]
25762 !!end
25763
25764 !! test
25765 Image: Modifying caption of an image
25766 !! options
25767 parsoid={
25768 "modes": ["wt2wt"],
25769 "changes": [
25770 ["figcaption", "text", "new caption"]
25771 ]
25772 }
25773 !! wikitext
25774 [[Image:Foobar.jpg|thumb|original caption]]
25775 !! wikitext/edited
25776 [[Image:Foobar.jpg|thumb|new caption]]
25777 !!end
25778
25779 !! test
25780 Image: empty alt attribute (T50924)
25781 !! options
25782 parsoid
25783 !! wikitext
25784 [[File:Foobar.jpg|thumb|alt=|bar]]
25785 !! html
25786 <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>
25787 !! end
25788
25789 !! test
25790 Image: new attributes should be serialized in wiki's language for RTL languages (T53852)
25791 !! options
25792 parsoid=html2wt
25793 language=ar
25794 disabled
25795 !! html/parsoid
25796 <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>
25797 !! wikitext
25798 [[Imagen:Foobar.jpg|derecha|miniaturadeimagen]]
25799 !! end
25800
25801 !! test
25802 Image: Block level image should have \n before and after
25803 !! wikitext
25804 123
25805 [[File:Foobar.jpg|right|thumb|150x150px]]
25806 456
25807 !! html/parsoid
25808 <p>123</p>
25809 <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>
25810 <p>456</p>
25811 !!end
25812
25813 !! test
25814 Image: New block level image should have \n before and after (existing content)
25815 !! wikitext
25816 123
25817 [[File:Foobar.jpg|right|thumb|150x150px]]
25818 456
25819 !! html/parsoid
25820 <p>123</p>
25821 <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>
25822 <p>456</p>
25823 !!end
25824
25825 !! test
25826 Image: upright option (parsoid)
25827 !! wikitext
25828 [[File:Foobar.jpg|thumb|upright|caption]]
25829 [[File:Foobar.jpg|thumb|upright=0.5|caption]]
25830 [[File:Foobar.jpg|thumb|500x500px|upright=0.5|caption]]
25831 !! html/parsoid
25832 <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>
25833 <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>
25834 <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>
25835 !!end
25836
25837 !! test
25838 Image: upright option is ignored on inline and frame images (parsoid)
25839 !! wikitext
25840 [[File:Foobar.jpg|500x500px|upright=0.5|caption]]
25841 !! html/parsoid
25842 <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>
25843 !!end
25844
25845 !! test
25846 Image: from basic HTML (1)
25847 !! options
25848 parsoid=html2wt
25849 !! html/parsoid
25850 <span typeof="mw:Image">
25851 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
25852 </span>
25853 !! wikitext
25854 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
25855 !! end
25856
25857 !! test
25858 Image: from basic HTML (2)
25859 !! options
25860 parsoid=html2wt
25861 !! html/parsoid
25862 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
25863 !! wikitext
25864 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
25865 !! end
25866
25867 !! test
25868 Image: from basic HTML (3)
25869 !! options
25870 parsoid=html2wt
25871 !! html/parsoid
25872 <a href="Main"><img src="./File:Foobar.jpg" width=100 height=100 alt="Alt"></a>
25873 !! wikitext
25874 [[File:Foobar.jpg|link=Main|alt=Alt|100x100px]]
25875 !! end
25876
25877 !! test
25878 Image: from basic HTML (4)
25879 !! options
25880 parsoid=html2wt
25881 !! html/parsoid
25882 <img src="./File:Foobar.jpg">
25883 !! wikitext
25884 [[File:Foobar.jpg|link=]]
25885 !! end
25886
25887 !! test
25888 Image: Invalid title as link
25889 !! wikitext
25890 [[File:Foobar.jpg|link=<]]
25891 !! html/php
25892 <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>
25893 </p>
25894 !! html/parsoid
25895 <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>
25896 !! end
25897
25898 !! test
25899 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
25900 !! options
25901 parsoid=html2wt
25902 !! html/parsoid
25903 <ul>
25904 <li><p>foo</p></li>
25905 </ul>
25906 !! wikitext
25907 * foo
25908 !! end
25909
25910 !! test
25911 Lists: Serialize correctly even when list tags has unneeded whitespace between tags
25912 !! options
25913 parsoid=html2wt
25914 !! html/parsoid
25915 <ul> <li>foo</li></ul>
25916 !! wikitext
25917 * foo
25918 !! end
25919
25920 !! test
25921 Don't strip leading whitespace when handling indent-pre suppressing tags
25922 !! options
25923 parsoid=html2wt
25924 !! html/parsoid
25925 <table>
25926 <tr><td> indented row</td></tr>
25927 </table>
25928 <blockquote><p>
25929 <b>This is very bold of you!</b>
25930 </p>
25931 <table><tr><td>
25932 indented cell (no pre-wrapping!)
25933 </td></tr></table>
25934 </blockquote>
25935 <p>foo</p>
25936 <div>bar</div>
25937 !! wikitext
25938 {|
25939 | indented row
25940 |}
25941 <blockquote>
25942 '''This is very bold of you!'''
25943
25944 {|
25945 |
25946 indented cell (no pre-wrapping!)
25947 |}
25948 </blockquote>
25949 foo
25950 <div>bar</div>
25951 !! end
25952
25953 !! test
25954 Nowiki-wrap leading whitespace when handling indent-pre inducing tags
25955 !! options
25956 parsoid=html2wt
25957 !! html/parsoid
25958 <p>foo</p>
25959 <span>bar</span>
25960
25961 <span>foo2
25962 </span>bar2
25963
25964 <div>foo</div>
25965 <span>bar</span>
25966
25967 <div>
25968 <span>foo</span>
25969 </div>
25970 !! wikitext
25971 foo
25972
25973 <span>bar</span>
25974
25975 <span>foo2
25976 <nowiki> </nowiki></span>bar2
25977
25978 <div>foo</div>
25979 <nowiki> </nowiki><span>bar</span>
25980
25981 <div>
25982 <nowiki> </nowiki><span>foo</span>
25983 </div>
25984 !! end
25985
25986 !! test
25987 Lists: Dont insert newlines in a serialized list item.
25988 !! options
25989 parsoid=html2wt
25990 !! html/parsoid
25991 <ul><li>a<br>b</li><li>c</li></ul>
25992 !! wikitext
25993 * a<br>b
25994 * c
25995 !! end
25996
25997 !! test
25998 1. Headings: Force sol-transparent links and behavior switches to serialize before/after
25999 !! options
26000 parsoid={
26001 "modes": ["html2wt"],
26002 "scrubWikitext": false
26003 }
26004 !! html/parsoid
26005 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
26006 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
26007
26008 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
26009 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
26010
26011 <h2 data-parsoid='{}'>howdy<link href="./Category:A5" rel="mw:PageProp/Category" /></h2>
26012
26013 <h2><meta property="mw:PageProp/toc" /> ok</h2>
26014 !! wikitext
26015 == hello there [[Category:A1]] ==
26016
26017 == [[Category:A2]] hi pal ==
26018
26019 == <!--foo--> [[Category:A3]] how goes it ==
26020
26021 == it goes well [[Category:A4]] <!--bar--> ==
26022
26023 ==howdy [[Category:A5]]==
26024
26025 == __TOC__ ok ==
26026 !! end
26027
26028 !! test
26029 2. Headings: Force sol-transparent links and behavior switches to serialize before/after
26030 !! options
26031 parsoid={
26032 "modes": ["html2wt"],
26033 "scrubWikitext": true
26034 }
26035 !! html/parsoid
26036 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
26037 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
26038
26039 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
26040 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
26041
26042 <h2><meta property="mw:PageProp/toc" /> ok</h2>
26043 !! wikitext
26044 == hello there ==
26045 [[Category:A1]]
26046 [[Category:A2]]
26047
26048 == hi pal ==
26049
26050 <!--foo--> [[Category:A3]]
26051
26052 == how goes it ==
26053
26054 == it goes well ==
26055 [[Category:A4]] <!--bar-->
26056
26057 __TOC__
26058
26059 == ok ==
26060 !! end
26061
26062 !! test
26063 Headings: Don't hoist metas that come from templates
26064 !! options
26065 parsoid={
26066 "modes": ["html2wt"],
26067 "scrubWikitext": true
26068 }
26069 !! html/parsoid
26070 <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>
26071 !! wikitext
26072 == {{echo|foo [[Category:Foo]]}} ==
26073 !! end
26074
26075 !! test
26076 Headings: Category in ref isn't hoisted
26077 !! options
26078 parsoid={
26079 "modes": ["html2wt"],
26080 "scrubWikitext": true
26081 }
26082 !! html/parsoid
26083 <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>
26084
26085 <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>
26086 !! wikitext
26087 == foo <ref>bar
26088 [[Category:Baz]] </ref> ==
26089
26090 <references />
26091 !! end
26092
26093 !! test
26094 Parsoid: Serialize positional parameters with = in them as named parameter
26095 !! options
26096 parsoid=html2wt
26097 !! html/parsoid
26098 <p about="#mwt1" typeof="mw:Transclusion"
26099 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
26100
26101 <p about="#mwt1" typeof="mw:Transclusion"
26102 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}, "2":{"wt":"bar"}},"i":0}}]}'>foo</p>
26103
26104 <!--Orig params with data-parsoid has heuristics for handling = chars-->
26105 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
26106 <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>
26107 !! wikitext
26108 {{echo|1=f=oo}}
26109
26110 {{echo|1=f=oo|2=bar}}
26111
26112 <!--Orig params with data-parsoid has heuristics for handling = chars-->
26113 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
26114 {{echo|<nowiki>f=oo</nowiki>|bar}}
26115 !! end
26116
26117 !! test
26118 Parsoid: Serialize positional parameters with = in extlink as named parameter
26119 !! options
26120 parsoid=html2wt
26121 !! html/parsoid
26122 <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>
26123 !! wikitext
26124 {{echo|1=http://stuff?is=ok}}
26125 !! end
26126
26127 !! test
26128 Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
26129 !! options
26130 parsoid=html2wt
26131 !! html/parsoid
26132 <div>a<p>b</p></div>
26133 <div>a
26134 <p>b</p></div>
26135 <div>
26136 a
26137 <p>b</p></div>
26138 !! wikitext
26139 <div>a
26140 b
26141 </div>
26142 <div>a
26143 b
26144 </div>
26145 <div>
26146 a
26147
26148 b
26149 </div>
26150 !! end
26151
26152 !! test
26153 Substrings resembling wikitext in hrefs should not get nowiki escapes
26154 !! options
26155 parsoid=html2wt
26156 !! html/parsoid
26157 <a rel="mw:WikiLink" href="./Foo''bar''baz">Foo''bar''baz</a>
26158 !! wikitext
26159 [[Foo''bar''baz]]
26160 !! end
26161
26162 !! test
26163 Enforce single-line context in the serializer
26164 !! options
26165 parsoid=html2wt
26166 !! html/parsoid
26167 <h2>testing
26168 123</h2>
26169
26170 <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">
26171 </span><span about="#mwt1">you</span> </h2>
26172
26173 <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>
26174
26175 <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
26176 there</span></li></ol>
26177
26178 <ul><li>asd
26179 sdf</li></ul>
26180
26181 <ul><li>foo
26182 bar
26183 baz</li>
26184 <li>foo <b>bar</b>
26185 baz</li></ul>
26186
26187 <dl><dt>hi
26188 ho </dt><dd data-parsoid='{"stx":"row"}'> hi
26189 ho</dd></dl>
26190
26191 <dl><dd> <table>
26192 <tbody><tr><td> ha
26193 ha
26194 ha</td></tr>
26195 </tbody></table></dd></dl>
26196 !! wikitext
26197 == testing 123 ==
26198
26199 == hi {{bogus|there
26200 you}} ==
26201
26202 == foo <ref>hello
26203 there</ref> ==
26204
26205 <references />
26206
26207 * asd sdf
26208
26209 * foo bar baz
26210 * foo '''bar''' baz
26211
26212 ; hi ho : hi ho
26213
26214 : {|
26215 | ha
26216 ha
26217 ha
26218 |}
26219 !! end
26220
26221 !! test
26222 Serialize new placeholder space without spans
26223 !! options
26224 parsoid=html2wt
26225 !! html/parsoid
26226 <p>foo<span typeof="mw:Placeholder"> </span>: bar</p>
26227
26228 <p>foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span>: bar</p>
26229
26230 <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>
26231 !! wikitext
26232 foo : bar
26233
26234 foo : bar
26235
26236 <ref>foo : bar</ref>ok
26237 !! end
26238
26239
26240 #-----------------------
26241 # Tag minimization tests
26242 #-----------------------
26243
26244 !! test
26245 1. I/B quote minimization: wikitext-only tags should be combined
26246 !! options
26247 parsoid=html2wt
26248 !! html/parsoid
26249 <p><i>A</i><i>B</i></p>
26250 <p><b>A</b><b>B</b></p>
26251 <p><i>A</i><b><i>B</i></b></p>
26252 <p><b>A</b><i><b>B</b></i></p>
26253 <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
26254 <p><i><b>A</b></i><i><b>B</b></i></p>
26255 <p><i><b>A</b></i><b><i>B</i></b></p>
26256 <p><b><i>A</i></b><i><b>B</b></i></p>
26257 !! wikitext
26258 ''AB''
26259
26260 '''AB'''
26261
26262 ''A'''B'''''
26263
26264 '''A''B'''''
26265
26266 '''A''BC''D'''
26267
26268 '''''AB'''''
26269
26270 '''''AB'''''
26271
26272 '''''AB'''''
26273 !! end
26274
26275 !! test
26276 2. I/B quote minimization: wikitext and html tags should not be combined
26277 !! options
26278 parsoid=html2wt
26279 !! html/parsoid
26280 <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
26281 <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
26282 !! wikitext
26283 ''A''<i>B</i>
26284
26285 ''A''<nowiki/>'''<i>B</i>'''
26286 !! end
26287
26288 !! test
26289 3. I/B quote minimization: templated content stops minimization
26290 !! options
26291 parsoid=html2wt
26292 !! html/parsoid
26293 <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>
26294 <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>
26295 !! wikitext
26296 ''A''{{echo|''B''}}
26297
26298 ''A''{{echo|'''''B'''''}}
26299 !! end
26300
26301 !! test
26302 4. I/B quote minimization: new content should be mimimized with adjacent old content
26303 !! options
26304 parsoid=html2wt
26305 !! html/parsoid
26306 <p><i>A</i><i>B</i></p>
26307 <p><b>A</b><b>B</b></p>
26308 <p><i>A</i><b><i>B</i></b></p>
26309 !! wikitext
26310 ''AB''
26311
26312 '''AB'''
26313
26314 ''A'''B'''''
26315 !! end
26316
26317 !! test
26318 5a. Merge adjacent quote nodes if they've been edited
26319 !! options
26320 parsoid={
26321 "modes": ["wt2wt", "selser"],
26322 "changes": [
26323 ["p", "contents", "remove", ":contains('b')"]
26324 ]
26325 }
26326 !! wikitext
26327 ''a''b''c''
26328 !! wikitext/edited
26329 ''ac''
26330 !! end
26331
26332 !! test
26333 5b. Merge adjacent quote nodes if they've been edited
26334 !! options
26335 parsoid={
26336 "modes": ["wt2wt", "selser"],
26337 "changes": [
26338 ["#x", "remove"]
26339 ]
26340 }
26341 !! wikitext
26342 ''a''<span id="x">b</span>''c''
26343 !! wikitext/edited
26344 ''ac''
26345 !! end
26346
26347 !! test
26348 1. Merge adjacent link nodes as long as at least one element is new
26349 !! options
26350 parsoid={
26351 "modes": ["html2wt"],
26352 "scrubWikitext": true
26353 }
26354 !! html/parsoid
26355 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
26356 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
26357 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a data-parsoid="{}" rel="mw:WikiLink" href="./Football">ball</a>
26358 !! wikitext
26359 [[Football]]
26360 [[Football]]
26361 [[Football|Foot]][[Football|ball]]
26362 !! end
26363
26364 !! test
26365 2. Merge adjacent link nodes and enable additional normalizations
26366 !! options
26367 parsoid={
26368 "modes": ["html2wt"],
26369 "scrubWikitext": true
26370 }
26371 !! html/parsoid
26372 <a rel="mw:WikiLink" href="./Football"><i>Foot</i></a><a rel="mw:WikiLink" href="./Football"><i>ball</i></a>
26373 !! wikitext
26374 [[Football|''Football'']]
26375 !! end
26376
26377 !! test
26378 3. Don't merge adjacent link nodes if scrubWikitext is false
26379 !! options
26380 parsoid={
26381 "modes": ["html2wt"],
26382 "scrubWikitext": false
26383 }
26384 !! html/parsoid
26385 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
26386 !! wikitext
26387 [[Football|Foot]][[Football|ball]]
26388 !! end
26389
26390 #------------------------------
26391 # End of tag minimization tests
26392 #------------------------------
26393
26394 !!test
26395 T56262: New entities
26396 !! options
26397 parsoid=html2wt
26398 !! html/parsoid
26399 <span typeof="mw:Entity">&nbsp;</span>
26400 !! wikitext
26401 &nbsp;
26402 !! end
26403
26404 ## Note that there is no wikitext output for 'unknownproperty' ##
26405 ## Unknown magic words are silently dropped ##
26406
26407 !! test
26408 Magic words
26409 !! options
26410 parsoid=html2wt
26411 !! html/parsoid
26412 <meta property='mw:PageProp/toc' />
26413 <meta property='mw:PageProp/notoc' />
26414 <meta property='mw:PageProp/forcetoc' />
26415 <meta property='mw:PageProp/index' />
26416 <meta property='mw:PageProp/noindex' />
26417 <meta property='mw:PageProp/nogallery' />
26418 <meta property='mw:PageProp/noeditsection' />
26419 <meta property='mw:PageProp/notitleconvert' />
26420 <meta property='mw:PageProp/nocontentconvert' />
26421 <meta property='mw:PageProp/unknownproperty' />
26422 !! wikitext
26423 __TOC__
26424 __NOTOC__
26425 __FORCETOC__
26426 __INDEX__
26427 __NOINDEX__
26428 __NOGALLERY__
26429 __NOEDITSECTION__
26430 __NOTITLECONVERT__
26431 __NOCONTENTCONVERT__
26432 !! end
26433
26434 !! test
26435 Consecutive <pre>s should not get merged
26436 !! options
26437 parsoid=html2wt,html2html
26438 !! html/parsoid
26439 <pre>a</pre><pre>b</pre>
26440
26441 <pre>c
26442 </pre><pre>
26443 d</pre>
26444
26445 <pre>e
26446
26447 </pre><pre>
26448
26449 f</pre>
26450 !! wikitext
26451 a
26452
26453 b
26454
26455 c
26456
26457 d
26458
26459 e
26460
26461
26462
26463 f
26464 !! end
26465
26466 !! test
26467 Edited ISBN links not serializable as ISBN links should serialize as wikilinks
26468 !! options
26469 parsoid=html2wt
26470 !! html/parsoid
26471 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink">ISBN 1234567895</a>
26472 !! wikitext
26473 [[Special:BookSources/1234567890|ISBN 1234567895]]
26474 !! end
26475
26476 !! test
26477 Edited RFC links not serializable as RFC links should serialize as extlinks
26478 !! options
26479 parsoid=html2wt
26480 !! html/parsoid
26481 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink">New RFC</a>
26482 !! wikitext
26483 [//tools.ietf.org/html/rfc123 New RFC]
26484 !! end
26485
26486 !! test
26487 Edited PMID links not serializable as PMID links should serialize as extlinks
26488 !! options
26489 parsoid=html2wt
26490 !! html/parsoid
26491 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink">New PMID</a>
26492 !! wikitext
26493 [//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract New PMID]
26494 !! end
26495
26496 !! test
26497 WTS of autolinks with trailing/surrounding context
26498 !! options
26499 parsoid=html2wt
26500 !! html/parsoid
26501 <p><a href="http://cscott.net">http://cscott.net</a><b>foo</b></p>
26502 <p><a href="http://cscott.net">http://cscott.net</a><b data-parsoid='{"stx":"html"}'>foo</b></p>
26503 <p><b><a href="http://cscott.net">http://cscott.net</a></b></p>
26504 <p><b><a href="http://cscott.net">http://cscott.net</a> </b></p>
26505 <p><b><a href="http://cscott.net">http://cscott.net</a>x</b></p>
26506 <p><a href="http://cscott.net">http://cscott.net</a>x</p>
26507 !! wikitext
26508 http://cscott.net'''foo'''
26509
26510 http://cscott.net<b>foo</b>
26511
26512 '''http://cscott.net'''
26513
26514 '''http://cscott.net '''
26515
26516 '''http://cscott.net<nowiki/>x'''
26517
26518 http://cscott.net<nowiki/>x
26519 !! end
26520
26521 !! test
26522 WTS of autolinks with nowikis (round-trip)
26523 !! wikitext
26524 x<nowiki/>http://cscott.net<nowiki/>x
26525 !! html/parsoid
26526 <p>x<a rel="mw:ExtLink" href="http://cscott.net">http://cscott.net</a>x</p>
26527 !! end
26528
26529 # this is the "easy" test because it leaves in place all the
26530 # data-parsoid information indicating this is an autolink
26531 !! test
26532 WTS of autolinks with escapes (editing)
26533 !! options
26534 parsoid={
26535 "modes": ["wt2wt"],
26536 "changes": [
26537 [ "span", "remove" ]
26538 ]
26539 }
26540 !! wikitext
26541 x<nowiki/>http://cscott.net<nowiki/>x
26542 !! wikitext/edited
26543 x<nowiki/>http://cscott.net<nowiki/>x
26544 !! end
26545
26546 !! test
26547 WTS of edited autolink-like text (T103364)
26548 !! options
26549 parsoid={
26550 "modes": ["wt2wt"],
26551 "changes": [
26552 [ "span[typeof]", "removeAttr", "typeof" ]
26553 ]
26554 }
26555 !! wikitext
26556 Not a link: <nowiki>http://example.com</nowiki>.
26557 !! wikitext/edited
26558 Not a link: <span><nowiki>http://example.com</nowiki></span>.
26559 !! end
26560
26561 !! test
26562 WTS of newly-authored autolink-like text (T103364)
26563 !! options
26564 parsoid=html2wt
26565 !! html/parsoid
26566 <p>http://example.com is not a link.</p>
26567 !! wikitext
26568 <nowiki>http://example.com</nowiki> is not a link.
26569 !! end
26570
26571 !! test
26572 WTS of autolink-like text after an autolink (T108563)
26573 !! options
26574 parsoid=html2wt
26575 !! html/parsoid
26576 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a> http://example.com is not a link.</p>
26577 !! wikitext
26578 http://example.com <nowiki>http://example.com</nowiki> is not a link.
26579 !! end
26580
26581 !! test
26582 Magic links inside links (not autolinked)
26583 !! wikitext
26584 [[Foo|http://example.com]]
26585 [[Foo|RFC 1234]]
26586 [[Foo|PMID 1234]]
26587 [[Foo|ISBN 123456789x]]
26588
26589 [http://foo.com http://example.com]
26590 [http://foo.com RFC 1234]
26591 [http://foo.com PMID 1234]
26592 [http://foo.com ISBN 123456789x]
26593 !! html+tidy
26594 <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>
26595 <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>
26596 !! html/parsoid
26597 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">http://example.com</a>
26598 <a rel="mw:WikiLink" href="./Foo" title="Foo">RFC 1234</a>
26599 <a rel="mw:WikiLink" href="./Foo" title="Foo">PMID 1234</a>
26600 <a rel="mw:WikiLink" href="./Foo" title="Foo">ISBN 123456789x</a></p>
26601
26602 <p><a rel="mw:ExtLink" href="http://foo.com">http://example.com</a>
26603 <a rel="mw:ExtLink" href="http://foo.com">RFC 1234</a>
26604 <a rel="mw:ExtLink" href="http://foo.com">PMID 1234</a>
26605 <a rel="mw:ExtLink" href="http://foo.com">ISBN 123456789x</a></p>
26606 !! end
26607
26608 !! test
26609 Magic links inside image captions (autolinked)
26610 !! wikitext
26611 [[File:Foobar.jpg|thumb|http://example.com]]
26612 [[File:Foobar.jpg|thumb|RFC 1234]]
26613 [[File:Foobar.jpg|thumb|PMID 1234]]
26614 [[File:Foobar.jpg|thumb|ISBN 123456789x]]
26615 !! html+tidy
26616 <div class="thumb tright">
26617 <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>
26618 <div class="thumbcaption">
26619 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
26620 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></div>
26621 </div>
26622 </div>
26623 <div class="thumb tright">
26624 <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>
26625 <div class="thumbcaption">
26626 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
26627 <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a></div>
26628 </div>
26629 </div>
26630 <div class="thumb tright">
26631 <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>
26632 <div class="thumbcaption">
26633 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
26634 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a></div>
26635 </div>
26636 </div>
26637 <div class="thumb tright">
26638 <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>
26639 <div class="thumbcaption">
26640 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
26641 <a href="/wiki/Special:BookSources/123456789X" class="internal mw-magiclink-isbn">ISBN 123456789x</a></div>
26642 </div>
26643 </div>
26644 !! html/parsoid
26645 <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>
26646 <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>
26647 <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>
26648 <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>
26649 !! end
26650
26651 !! test
26652 WTS of magic word text (T109371)
26653 !! options
26654 parsoid=html2wt
26655 !! html/parsoid
26656 <p>RFC 1234</p>
26657 <p><a href="http://foo.com" rel="mw:ExtLink">RFC 1234</a></p>
26658 <p><a href="./Foo" rel="mw:WikiLink">RFC 1234</a></p>
26659 !! wikitext
26660 <nowiki>RFC 1234</nowiki>
26661
26662 [http://foo.com RFC 1234]
26663
26664 [[Foo|RFC 1234]]
26665 !! end
26666
26667 !! test
26668 Edited Redirect link should emit a non-piped wikitext link
26669 !! options
26670 parsoid=html2wt
26671 !! html/parsoid
26672 <link rel="mw:PageProp/redirect" href="Bar" data-parsoid='{"a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>
26673 !! wikitext
26674 #REDIRECT [[Bar]]
26675 !! end
26676
26677 !! test
26678 T75121: Infer extension name from typeOf if data-mw is not present
26679 !! options
26680 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
26681 !! html/parsoid
26682 <div typeOf="mw:Extension/foo"></div>
26683 !! wikitext
26684 <foo />
26685 !! end
26686
26687 # Note that the <p> wrapping isn't present in PHP parser output
26688 # The important thing for this test is that P-wrapping doesn't
26689 # interfere with the <nowiki> protection for leading - in <td>
26690 # (which isn't necessary for <th>).
26691 !! test
26692 T88318: p-wrapped dash in table.
26693 !! options
26694 parsoid=html2wt,wt2wt
26695 !! html/parsoid
26696 <table><tbody>
26697 <tr><th><p>-</p></th><th><p>- </p></th></tr>
26698 <tr><td><p>-</p></td><td><p>- </p></td></tr>
26699 <tr><td><small>-</small></td><td><br/><p>-</p></td><td><br/>-</td></tr>
26700 </tbody></table>
26701 !! wikitext
26702 {|
26703 !-
26704 !-
26705 |-
26706 |<nowiki>-</nowiki>
26707 |<nowiki>- </nowiki>
26708 |-
26709 |<small>-</small>
26710 |<br>
26711 -
26712 |<br>
26713 -
26714 |}
26715 !! html/php+tidy
26716 <table>
26717 <tr>
26718 <th>-</th>
26719 <th>-</th>
26720 </tr>
26721 <tr>
26722 <td>-</td>
26723 <td>-</td>
26724 </tr>
26725 <tr>
26726 <td><small>-</small></td>
26727 <td><br />
26728 <p>-</p>
26729 </td>
26730 <td><br />
26731 <p>-</p>
26732 </td>
26733 </tr>
26734 </table>
26735 !! end
26736
26737 !! test
26738 T149209: WTS: Handle newlines in table cells properly
26739 !! options
26740 parsoid=html2wt
26741 !! html/parsoid
26742 <table>
26743 <tbody>
26744 <tr><td>a
26745 b
26746 </td><td data-parsoid='{"stx_v":"row"}'>c</td></tr>
26747 <tr><td><p>x</p>
26748 </td><td data-parsoid='{"stx_v":"row", "startTagSrc": "{{!}}{{!}}"}'>y</td></tr>
26749 </tbody></table>
26750 <table>
26751 <tbody>
26752 <tr><th>a
26753 b
26754 </th><th data-parsoid='{"stx_v":"row"}'>c</th></tr>
26755 <tr><th><p>x</h>
26756 </th><th data-parsoid='{"stx_v":"row"}'>y</th></tr>
26757 </tbody></table>
26758 !! wikitext
26759 {|
26760 |a
26761 b
26762 |c
26763 |-
26764 |x
26765 {{!}}y
26766 |}
26767 {|
26768 !a
26769 b
26770 !c
26771 |-
26772 !x
26773 !y
26774 |}
26775 !! end
26776
26777 !! test
26778 T149209: Selser: Handle newlines in table cells properly
26779 !! options
26780 parsoid={
26781 "modes": ["selser"],
26782 "changes": [
26783 [ "#h1", "html", "a\nb\n" ],
26784 [ "#h2", "html", "a\nb\n" ],
26785 [ "#c1", "html", "a\nb\n" ],
26786 [ "#c2", "html", "<p>a</p>" ],
26787 [ "#c3", "html", "<p>a</p>" ],
26788 [ "#c4", "html", "edit-me<p>a</p>" ]
26789 ]
26790 }
26791 !! wikitext
26792 {|
26793 ! id="h1" |edit-me!!1
26794 |-
26795 ! id="h2" |edit-me||2
26796 |-
26797 | id="c1" |edit-me||3
26798 |-
26799 | id="c2" |edit-me||4
26800 |-
26801 | id="c3" |edit-me||p||q||r
26802 |-
26803 | id="c4" |edit-me||p||q||r
26804 |}
26805 !! wikitext/edited
26806 {|
26807 ! id="h1" |a
26808 b
26809 !1
26810 |-
26811 ! id="h2" |a
26812 b
26813 !2
26814 |-
26815 | id="c1" |a
26816 b
26817 |3
26818 |-
26819 | id="c2" |a
26820 |4
26821 |-
26822 | id="c3" |a
26823 |p||q||r
26824 |-
26825 | id="c4" |edit-me
26826 a
26827 |p||q||r
26828 |}
26829 !! end
26830
26831 !! test
26832 HTML id attribute with Parsoid-like element ids should not be serialized to wikitext
26833 !! options
26834 parsoid=html2wt
26835 !! html/parsoid
26836 <table id='mwAb'>
26837 <td id='mwAc'>foo</td>
26838 <td id='serialize-this'>bar</td>
26839 </table>
26840 !! wikitext
26841 {|
26842 |foo
26843 | id="serialize-this" |bar
26844 |}
26845 !! end
26846
26847 !! test
26848 Parsoid-like element ids should not be serialized to wikitext unless shadowed
26849 !! options
26850 parsoid=html2wt
26851 !! html/parsoid
26852 <div id="mwAQ" data-parsoid='{"stx":"html","a":{"id":"mwAQ"},"sa":{"id":"hello"}}'>ok</div>
26853 !! wikitext
26854 <div id="hello">ok</div>
26855 !! end
26856
26857 !! test
26858 WTS change modes
26859 !! options
26860 parsoid={
26861 "modes": ["wt2wt"],
26862 "changes": [
26863 [ "#xyz", "before", "<b>before</b> stuff " ],
26864 [ "#xyz", "after", " stuff <i>after</i>" ],
26865 [ "#xyz", "html", "x <b>y</b> z" ]
26866 ]
26867 }
26868 !! wikitext
26869 <span id="xyz">hello</span>
26870 !! wikitext/edited
26871 '''before''' stuff <span id="xyz">x '''y''' z</span> stuff ''after''
26872 !! end
26873
26874 !! test
26875 Never serialize a-tag as html, regardless of what data-parsoid has to say
26876 !! options
26877 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
26878 !! html/parsoid
26879 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"html"}'>Foo</a>
26880 !! wikitext
26881 [[Foo]]
26882 !! end
26883
26884 ## SSS FIXME: This is broken output nevertheless.
26885 ## What might be a reasonable non-broken output for this?
26886 ## This is an edge case unlikely to be seen in production
26887 ## that I am not wasting more time on this right now.
26888 !! test
26889 Never serialize a-tag as html, no matter what attributes it has
26890 !! options
26891 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
26892 !! html/parsoid
26893 <a bad='true' href='http://boo.org'><img src='http://boohoo.org' /></a>
26894 !! wikitext
26895 [http://boo.org http://boohoo.org]
26896 !! end
26897
26898 # Misnested is an indication that selser can reuse the source but these have
26899 # shown to sneak through on occasion. See T101768.
26900 # The original wikitext here is: [http://test.com [[one]] two three]
26901 !! test
26902 Strip span tags added to mark misnested links
26903 !! options
26904 parsoid=html2wt
26905 !! html/parsoid
26906 <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>
26907 !! wikitext
26908 [http://test.com][[one]] two three
26909 !! end
26910
26911 !! test
26912 Catch regression when unpacking misnested links
26913 !! options
26914 parsoid=wt2html
26915 !! wikitext
26916 {{echo|hi}}[http://example.com [[ho]]]
26917 !! html/parsoid
26918 <p><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"hi"}},"i":0}}]}'>hi</span><a rel="mw:ExtLink" href="http://example.com"></a><a rel="mw:WikiLink" href="./Ho" title="Ho" data-parsoid='{"misnested":true}'>ho</a></p>
26919 !! end
26920
26921 !! test
26922 Use data-parsoid.firstWikitextNode to compute newline constraints for template content
26923 !! options
26924 parsoid=html2wt
26925 !! html/parsoid
26926 <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|}"]}'>
26927 <tbody><tr><td>d
26928 </td></tr>
26929 </tbody></table>
26930 !! wikitext
26931 {{echo|a}}
26932 {|{{echo|c
26933 {{!}}d
26934 }}
26935 |}
26936 !! end
26937
26938 ## This test verifies the presence and computation of this attribute indirectly
26939 ## by making an edit and ensuring that the serialization is correct (which it would be
26940 ## only if firstWikitextNode is properly set).
26941 !! test
26942 data-parsoid.firstWikitextNode should be computed properly in the presence of fostered content
26943 !! options
26944 parsoid= {
26945 "modes": ["wt2wt"],
26946 "changes": [
26947 [ "div#x", "remove" ],
26948 [ "div", "before", "<div>new</div>" ]
26949 ]
26950 }
26951 !! wikitext
26952 <div id="x">foo</div>
26953 {|
26954 {{echo|<div>boo</div>
26955 {{!}}b}}
26956 |c
26957 |}
26958 !! wikitext/edited
26959
26960 <div>new</div>
26961 {|
26962 {{echo|<div>boo</div>
26963 {{!}}b}}
26964 |c
26965 |}
26966 !! end
26967
26968 # --------------------------------------------
26969 # Tests spec'ing wikitext serialization norms |
26970 # --------------------------------------------
26971
26972 !! test
26973 Serialize multi-line indent-pre starting with wikitext syntax
26974 !! options
26975 parsoid=html2wt
26976 !! html/parsoid
26977 <pre>* 1
26978 ** 2
26979 * 3</pre>
26980 !! wikitext
26981 * 1
26982 ** 2
26983 * 3
26984 !! end
26985
26986 !! test
26987 1. Categories should always be serialized on their own line
26988 !! options
26989 parsoid=html2wt
26990 !! html/parsoid
26991 foo<link rel="mw:PageProp/Category" href="./Category:Foo">bar
26992 !! wikitext
26993 foo
26994 [[Category:Foo]]
26995 bar
26996 !! end
26997
26998 !! test
26999 2. Categories that are part of templates should not introduce a line break
27000 !! wikitext
27001 foo {{echo|<span>bar</span> [[Category:baz]]}} bar
27002 !! html/parsoid
27003 <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>
27004 !! end
27005
27006 # Careful while editing these next 2 tests. There are \u200f characters
27007 # before and after the <link> tags in the HTML and following some
27008 # of the categories in wikitext
27009 # Do not remove these characters in edits.
27010 #
27011 # As part of the serialization, these bidi characters will get stripped.
27012 !! test
27013 RTL (\u200f) and LTR (\u200e) markers around category tags should be stripped
27014 !! options
27015 parsoid={
27016 "modes": ["html2wt"],
27017 "scrubWikitext": true
27018 }
27019 !! html/parsoid
27020 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏
27021 ‏<link rel="mw:PageProp/Category" href="./קטגוריה:_שיטות_משפט" />‏</p>
27022 !! wikitext
27023 [[קטגוריה:טקסים]]
27024 [[קטגוריה: שיטות משפט]]
27025 !! end
27026
27027 !! test
27028 RTL (\u200f) and LTR (\u200e) markers should not be stripped if followed by a text node
27029 !! options
27030 parsoid={
27031 "modes": ["html2wt"],
27032 "scrubWikitext": true
27033 }
27034 !! html/parsoid
27035 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏y</p>
27036 !! wikitext
27037 [[קטגוריה:טקסים]]
27038 ‏y
27039 !! end
27040
27041 !! test
27042 Lists: Add space after bullets
27043 !! options
27044 parsoid=html2wt
27045 !! html/parsoid
27046 <ul>
27047 <li>foo</li>
27048 <li> bar</li>
27049 <li><span> baz</span></li>
27050 </ul>
27051 !! wikitext
27052 * foo
27053 * bar
27054 * <span> baz</span>
27055 !! end
27056
27057 !! test
27058 1. Headings: Add space before/after == (T53744)
27059 !! options
27060 parsoid=html2wt
27061 !! html/parsoid
27062 <h2>foo</h2>
27063 <h2> bar</h2>
27064 <h2>baz </h2>
27065 <h2><span> baz</span></h2>
27066 !! wikitext
27067 == foo ==
27068
27069 == bar ==
27070
27071 == baz ==
27072
27073 == <span> baz</span> ==
27074 !! end
27075
27076 !! test
27077 2. Headings: Add space before/after == even after hoisted content
27078 !! options
27079 parsoid={
27080 "modes": ["html2wt"],
27081 "scrubWikitext": true
27082 }
27083 !! html/parsoid
27084 <h2> <link href="./Category:A2" rel="mw:PageProp/Category" />ok</h2>
27085 !! wikitext
27086 [[Category:A2]]
27087
27088 == ok ==
27089 !! end
27090
27091 !! test
27092 1. Headings: suppress newly created empty headings
27093 !! options
27094 parsoid={
27095 "modes": ["html2wt"],
27096 "scrubWikitext": true
27097 }
27098 !! html/parsoid
27099 <h2></h2>
27100 !! wikitext
27101 !! end
27102
27103 !! test
27104 2. Headings: don't suppress empty headings if scrubWikitext is false
27105 !! options
27106 parsoid=html2wt
27107 !! html/parsoid
27108 <h2></h2>
27109 !! wikitext
27110 ==<nowiki/>==
27111 !! end
27112
27113 !! test
27114 3. Headings: suppress empty headings on edits
27115 !! options
27116 parsoid={
27117 "modes": ["selser"],
27118 "scrubWikitext": true,
27119 "changes": [
27120 [ "#x", "remove"]
27121 ]
27122 }
27123 !! wikitext
27124 ==<span id="x">foo</span>==
27125 !! wikitext/edited
27126 !! end
27127
27128 !! test
27129 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = true)
27130 !! options
27131 parsoid={
27132 "modes": ["html2wt"],
27133 "scrubWikitext": true
27134 }
27135 !! html/parsoid
27136 <h2>foo<br/>bar</h2>
27137 <h2>foo <span><br/>bar</span> baz</h2>
27138 !! wikitext
27139 == foo bar ==
27140
27141 == foo <span> bar</span> baz ==
27142 !! end
27143
27144 !! test
27145 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = false)
27146 !! options
27147 parsoid={
27148 "modes": ["html2wt"],
27149 "scrubWikitext": false
27150 }
27151 !! html/parsoid
27152 <h2>foo<br/>bar</h2>
27153 !! wikitext
27154 == foo<br> bar ==
27155 !! end
27156
27157 !! test
27158 1. WT Quote Tags: suppress newly created empty style tags
27159 !! options
27160 parsoid={
27161 "modes": ["html2wt"],
27162 "scrubWikitext": true
27163 }
27164 !! html/parsoid
27165 <i></i><b></b>
27166 !! wikitext
27167 !! end
27168
27169 !! test
27170 2. WT Quote Tags: don't suppress empty style tags if scrubWikitext is false
27171 !! options
27172 parsoid=html2wt
27173 !! html/parsoid
27174 <i></i><b></b>
27175 !! wikitext
27176 ''<nowiki/>'''''<nowiki/>'''
27177 !! end
27178
27179 !! test
27180 3. WT Quote Tags: suppress empty style tags on edits
27181 !! options
27182 parsoid={
27183 "modes": ["selser"],
27184 "scrubWikitext": true,
27185 "changes": [
27186 [ "#x", "remove"]
27187 ]
27188 }
27189 !! wikitext
27190 '''<span id="x">foo</span>'''
27191 !! wikitext/edited
27192 !! end
27193
27194 !! test
27195 1. Anchors: suppress newly created empty anchors
27196 !! options
27197 parsoid={
27198 "modes": ["html2wt"],
27199 "scrubWikitext": true
27200 }
27201 !! html/parsoid
27202 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
27203 !! wikitext
27204 !! end
27205
27206 !! test
27207 2. Anchors: don't suppress empty anchors if scrubWikitext is false
27208 !! options
27209 parsoid={
27210 "modes": ["html2wt"],
27211 "scrubWikitext": false
27212 }
27213 !! html/parsoid
27214 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
27215 !! wikitext
27216 [[Test|<nowiki/>]]
27217 !! end
27218
27219 !! test
27220 3. Anchors: suppress empty anchors on edits
27221 !! options
27222 parsoid={
27223 "modes": ["selser"],
27224 "scrubWikitext": true,
27225 "changes": [
27226 [ "#x", "remove"]
27227 ]
27228 }
27229 !! wikitext
27230 [[Test|<span id="x">foo</span>]]
27231 !! wikitext/edited
27232 !! end
27233
27234 !! test
27235 3a. Anchors: do not suppress numbered extlinks
27236 !! options
27237 parsoid={
27238 "modes": ["wt2wt"],
27239 "scrubWikitext": true
27240 }
27241 !! wikitext
27242 [http://foo.com]
27243 !! html/parsoid
27244 <a rel="mw:ExtLink" href="http://foo.com"></a>
27245 !! end
27246
27247 !! test
27248 3b. Anchors: do not suppress numbered extlinks
27249 !! options
27250 parsoid={
27251 "modes": ["wt2wt"],
27252 "scrubWikitext": true,
27253 "changes": [
27254 [ "#x", "remove"]
27255 ]
27256 }
27257 !! wikitext
27258 [http://foo.com <span id="x">foo</span>]
27259 !! wikitext/edited
27260 [http://foo.com]
27261 !! end
27262
27263 !!test
27264 Normalizations should be restricted to edited content
27265 !!options
27266 parsoid={
27267 "modes": ["selser"],
27268 "scrubWikitext": true,
27269 "changes": [
27270 [ "h1", "before", "<i></i>"]
27271 ]
27272 }
27273 !!wikitext
27274 a
27275 = =
27276 b
27277 !!wikitext/edited
27278 a
27279 = =
27280 b
27281 !!end
27282
27283 !! test
27284 1. Multiple normalizations (html2wt)
27285 !! options
27286 parsoid={
27287 "modes": ["html2wt"],
27288 "scrubWikitext": true
27289 }
27290 !! html
27291 <h2><i></i></h2>
27292 <p><a href='Foo' rel='mw:WikiLink'>foo<i></i>
27293 </a><b><i></i></b>x</p>
27294 !! wikitext
27295
27296 [[foo]]
27297 x
27298
27299 !! end
27300
27301 !! test
27302 2. Multiple normalizations (selser)
27303 !! options
27304 parsoid={
27305 "modes": ["selser"],
27306 "scrubWikitext": true,
27307 "changes": [
27308 [ "#x", "after", "<h1><i></i></h1>\n<p> x<b></b></p>"]
27309 ]
27310 }
27311 !! wikitext
27312 <span id="x">foo</span>
27313 !! wikitext/edited
27314 <span id="x">foo</span>
27315
27316 x
27317 !! end
27318
27319 !! test
27320 1. Indent Pre Nowiki: suppress whitespace at the start of new paragraph
27321 !! options
27322 parsoid={
27323 "modes": ["html2wt"],
27324 "scrubWikitext": true
27325 }
27326 !! html/parsoid
27327 <p> hi</p>
27328 <p> hello</p>
27329 !! wikitext
27330 hi
27331
27332 hello
27333 !! end
27334
27335 !! test
27336 2. Indent Pre Nowiki: don't suppress whitespace at the start of new paragraph if scrubWikitext is false
27337 !! options
27338 parsoid=html2wt
27339 !! html/parsoid
27340 <p> hi</p>
27341 <p> hello</p>
27342 !! wikitext
27343 <nowiki> </nowiki>hi
27344
27345 <nowiki> </nowiki> hello
27346 !! end
27347
27348 !! test
27349 3. Indent Pre Nowiki: suppress whitespace after newlines in new paragraph or table cell
27350 !! options
27351 parsoid={
27352 "modes": ["html2wt"],
27353 "scrubWikitext": true
27354 }
27355 !! html/parsoid
27356 <p>Foo
27357 bar
27358 baz</p>
27359
27360 <table><tr><td>Foo
27361 bar
27362 baz bang</td></tr></table>
27363
27364 <p><!--boo--> foo
27365 bar</p>
27366
27367 <p> foo
27368 bar<span>boo</span></p>
27369 !! wikitext
27370 Foo
27371 bar
27372 baz
27373
27374 {|
27375 |Foo
27376 bar
27377 baz bang
27378 |}
27379
27380 <!--boo-->foo
27381 bar
27382
27383 foo
27384 bar<span>boo</span>
27385 !! end
27386
27387 !! test
27388 4. Indent Pre Nowiki: suppress leading whitespace in edited paragraphs
27389 !! options
27390 parsoid={
27391 "modes": ["selser"],
27392 "scrubWikitext": true,
27393 "changes": [
27394 [ "p", "html", " a\n b" ]
27395 ]
27396 }
27397 !! wikitext
27398 xyz
27399 !! wikitext/edited
27400 a
27401 b
27402 !! end
27403
27404 !! test
27405 1. New links that end in spaces
27406 !! options
27407 parsoid={
27408 "modes": ["html2wt"],
27409 "scrubWikitext": false
27410 }
27411 !! html/parsoid
27412 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
27413 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
27414 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
27415 !! wikitext
27416 [[Berlin ]]<nowiki/>is the capital of Germany.
27417
27418 [[Foo ]]'''bar'''
27419
27420 [[Boston ]] is a city.
27421 !! end
27422
27423 !! test
27424 2. New links that end in spaces
27425 !! options
27426 parsoid={
27427 "modes": ["html2wt"],
27428 "scrubWikitext": true
27429 }
27430 !! html/parsoid
27431 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
27432 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
27433 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
27434 !! wikitext
27435 [[Berlin]] is the capital of Germany.
27436
27437 [[Foo]] '''bar'''
27438
27439 [[Boston]] is a city.
27440 !! end
27441
27442 !! test
27443 1. Table cells with escapable prefixes
27444 !! options
27445 parsoid={
27446 "modes": ["html2wt"],
27447 "scrubWikitext": false
27448 }
27449 !! html
27450 <table>
27451 <tr><td>a</td></tr>
27452 <tr><td>-</td></tr>
27453 <tr><td>+</td></tr>
27454 </table>
27455 !! wikitext
27456 {|
27457 |a
27458 |-
27459 |<nowiki>-</nowiki>
27460 |-
27461 |<nowiki>+</nowiki>
27462 |}
27463 !! end
27464
27465 !! test
27466 2. Table cells with escapable prefixes
27467 !! options
27468 parsoid={
27469 "modes": ["html2wt"],
27470 "scrubWikitext": true
27471 }
27472 !! html
27473 <table>
27474 <tr><td>a</td></tr>
27475 <tr><td>-</td></tr>
27476 <tr><td>+</td></tr>
27477 </table>
27478 !! wikitext
27479 {|
27480 |a
27481 |-
27482 | -
27483 |-
27484 | +
27485 |}
27486 !! end
27487
27488 !! test
27489 3a. Table cells with escapable prefixes after edits
27490 !! options
27491 parsoid={
27492 "modes": ["selser"],
27493 "scrubWikitext": true,
27494 "changes": [
27495 [ "table tbody tr:first-child td:first-child", "remove"]
27496 ]
27497 }
27498 !! wikitext
27499 {|
27500 |a||-
27501 |}
27502 !! wikitext/edited
27503 {|
27504 | -
27505 |}
27506 !! end
27507
27508 !! test
27509 3b. Table cells with escapable prefixes after edits
27510 !! options
27511 parsoid={
27512 "modes": ["selser"],
27513 "scrubWikitext": true,
27514 "changes": [
27515 [ "table tbody tr:first-child td:first-child", "html", "-" ],
27516 [ "#x", "remove" ]
27517 ]
27518 }
27519 !! wikitext
27520 {|
27521 |pqr
27522 |<span id="x">foo</span>+
27523 |}
27524 !! wikitext/edited
27525 {|
27526 | -
27527 | +
27528 |}
27529 !! end
27530
27531 # FIXME: This test will fail because
27532 # normalization doesn't realize that the id attribute
27533 # will eliminate the escapable scenario
27534 !! test
27535 4a. Table cells without escapable prefixes after edits
27536 !! options
27537 parsoid={
27538 "modes": ["selser"],
27539 "scrubWikitext": true,
27540 "changes": [
27541 [ "#x", "html", "-" ]
27542 ]
27543 }
27544 !! wikitext
27545 {|
27546 | id="x" |abcd
27547 |}
27548 !! wikitext/edited
27549 {|
27550 | id="x" |-
27551 |}
27552 !! end
27553
27554 ## This tests normalizer's ability to discriminate between
27555 ## cells having identical content.
27556 !! test
27557 4b. Table cells without escapable prefixes after edits
27558 !! options
27559 parsoid={
27560 "modes": ["selser"],
27561 "scrubWikitext": true,
27562 "changes": [
27563 [ "td", "html", "-" ]
27564 ]
27565 }
27566 !! wikitext
27567 {|
27568 |a||b
27569 |}
27570 !! wikitext/edited
27571 {|
27572 | -||-
27573 |}
27574 !! end
27575
27576 ## This tests normalizer's ability to not be tripped by
27577 ## comments (and whitespace)
27578 !! test
27579 4c. Table cells without escapable prefixes after edits
27580 !! options
27581 parsoid={
27582 "modes": ["selser"],
27583 "scrubWikitext": true,
27584 "changes": [
27585 [ "table tbody tr td:first-child", "remove" ]
27586 ]
27587 }
27588 !! wikitext
27589 {|
27590 |-
27591 <!--foo--> |a||-
27592 |}
27593 !! wikitext/edited
27594 {|
27595 |-
27596 <!--foo--> | -
27597 |}
27598 !! end
27599
27600 ## This tests normalizer's ability to handle HTML cells
27601 !! test
27602 4d. Table cells without escapable prefixes after edits
27603 !! options
27604 parsoid={
27605 "modes": ["selser"],
27606 "scrubWikitext": true,
27607 "changes": [
27608 [ "td", "html", "-" ]
27609 ]
27610 }
27611 !! wikitext
27612 <table>
27613 <tr><td>a</td></tr>
27614 </table>
27615 !! wikitext/edited
27616 <table>
27617 <tr><td>-</td></tr>
27618 </table>
27619 !! end
27620
27621 ## T111151 Remove font elements without attributes
27622 !! test
27623 5a. font tags without attributes should be dropped in scrubWikitext mode
27624 !! options
27625 parsoid={
27626 "modes": ["html2wt"],
27627 "scrubWikitext": true
27628 }
27629 !! html
27630 <font>foo</font>
27631 <font><font>bar</font></font>
27632 <font class="x">boo</font>
27633 !! wikitext
27634 foo
27635 bar
27636 <font class="x">boo</font>
27637 !! end
27638
27639 !! test
27640 5b. font tags should not be dropped without scrubWikitext being enabled
27641 !! options
27642 parsoid={
27643 "modes": ["html2wt"],
27644 "scrubWikitext": false
27645 }
27646 !! html
27647 <font>foo</font>
27648 !! wikitext
27649 <font>foo</font>
27650 !! end
27651
27652 !! test
27653 Escape nowiki DOM elements
27654 !! options
27655 parsoid=html2wt
27656 !! html/parsoid
27657 <nowiki><i>foo</i></nowiki>
27658 !! wikitext
27659 &lt;nowiki&gt;''foo''&lt;/nowiki&gt;
27660 !! end
27661
27662 # This is meant to be an interim fix while we go about figuring out
27663 # how to not introduce these trailing <nowiki/>s in the first place.
27664 !! test
27665 T115717: Strip trailing <nowiki/>s (without affecting valid uses)
27666 !! options
27667 parsoid=html2wt
27668 !! html/parsoid
27669 <p>x<meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/>
27670 y</p>
27671 <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>
27672 <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>
27673 !! wikitext
27674 x
27675 y
27676
27677 {{echo|
27678 1 = <nowiki/>}}
27679
27680 {{echo|
27681 1 = <nowiki/>
27682 }}
27683 !! end
27684
27685 # ---------------------------------------------------
27686 # End of tests spec'ing wikitext serialization norms |
27687 # ---------------------------------------------------
27688
27689 # T104032
27690 !! test
27691 Bare inline nodes not wrapped inside p-tags should be treated as p-wrapped
27692 !! options
27693 parsoid=html2wt
27694 !! html/parsoid
27695 a<p>b</p>
27696 <b>c</b><p>d</p>
27697 <table><tr>
27698 <td>a<p>b</p></td>
27699 <td><b>c</b><p>d</p></td>
27700 </tr></table>
27701 !! wikitext
27702 a
27703
27704 b
27705
27706 '''c'''
27707
27708 d
27709 {|
27710 |a
27711 b
27712 |'''c'''
27713 d
27714 |}
27715 !! end
27716
27717 !! test
27718 Anchor without href scenarios
27719 !! options
27720 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
27721 !! html/parsoid
27722 <a class="bc"></a>
27723 <a class="no">dice</a>
27724 <a name="foo"></a>
27725 !! wikitext
27726
27727 dice
27728 <span name="foo"></span>
27729 !! end
27730
27731 # -----------------------------------------------------------------
27732 # End of section for Parsoid-only html2wt tests for serialization
27733 # of new content
27734 # -----------------------------------------------------------------
27735
27736 # -----------------------------------------------------------------
27737 # The following section of tests are primarily to spec behavior of
27738 # the selective serializer. All these tests have manual selser
27739 # changes. The automated selser changes for all tests handle the
27740 # wide variation of changes, but these tests here capture specs
27741 # deterministically.
27742 # ----------------------------------------------------------------
27743
27744 ## T90517
27745 !! test
27746 Selser: New comments should not be lost
27747 !! options
27748 parsoid={
27749 "modes": ["selser"],
27750 "changes": [
27751 [ "#a", "after", "<!--c1-->" ],
27752 [ "#b", "before", "<!--c2-->" ]
27753 ]
27754 }
27755 !! wikitext
27756 <span id="a">a</span>
27757
27758 <span id="b">b</span>
27759 !! wikitext/edited
27760 <span id="a">a</span><!--c1-->
27761
27762 <!--c2--><span id="b">b</span>
27763 !! end
27764
27765 ## T89383
27766 !! test
27767 Selser: Check for validity of DSR before using it
27768 !! options
27769 parsoid={
27770 "modes": ["selser"],
27771 "changes": [
27772 [ "#a", "before", "<meta property='mw:PageProp/displaytitle' content='foo'>" ]
27773 ]
27774 }
27775 !! wikitext
27776 <span id="a">a</span>
27777 !! wikitext/edited
27778 {{DISPLAYTITLE:foo}}
27779 <span id="a">a</span>
27780 !! end
27781
27782 !! test
27783 1. DOMDiff: Changes to <ref> content should be looked up using id
27784 !! options
27785 parsoid={
27786 "modes": ["selser"],
27787 "changes": [
27788 ["#X", "after", "bar"],
27789 ["#Y", "after", "baz"]
27790 ]
27791 }
27792 !! wikitext
27793 X <ref><span id="X">foo</span></ref>
27794 Y <ref name="a" />
27795 <references>
27796 <ref name="a"><span id="Y">foo</span></ref>
27797 </references>
27798 !! wikitext/edited
27799 X <ref><span id="X">foo</span>bar</ref>
27800 Y <ref name="a" />
27801 <references>
27802 <ref name="a"><span id="Y">foo</span>baz</ref>
27803 </references>
27804 !! end
27805
27806 !! test
27807 2. DOMDiff: Changes to <ref> content should be looked up using id
27808 !! options
27809 parsoid={
27810 "modes": ["selser"],
27811 "changes": [
27812 ["#Z", "after", "bar"]
27813 ]
27814 }
27815 !! wikitext
27816 A <ref>foo bar for a</ref>
27817 B <ref group="X" name="b" />
27818
27819 <references />
27820
27821 <references group="X">
27822 <ref name="b"><span id="Z">foo</span></ref>
27823 </references>
27824 !! wikitext/edited
27825 A <ref>foo bar for a</ref>
27826 B <ref group="X" name="b" />
27827
27828 <references />
27829
27830 <references group="X">
27831 <ref name="b"><span id="Z">foo</span>bar</ref>
27832 </references>
27833 !! end
27834
27835 !! test
27836 DOMDiff: Edits to content nested in elements with templated attributes should not be lost (T139388)
27837 !! options
27838 parsoid={
27839 "modes": ["selser"],
27840 "changes": [
27841 [ "div:first-child", "text", "bar" ]
27842 ]
27843 }
27844 !! wikitext
27845 <div style="{{1x|color:red;}}%">foo</div>
27846 !! wikitext/edited
27847 <div style="{{1x|color:red;}}%">bar</div>
27848 !! end
27849
27850 !! test
27851 Empty LI (T49673)
27852 !! wikitext
27853 * a
27854 *
27855 *
27856 * b
27857 !! html/php+tidy
27858 <ul>
27859 <li>a</li>
27860 <li class="mw-empty-elt"></li>
27861 <li class="mw-empty-elt"></li>
27862 <li>b</li>
27863 </ul>
27864 !! end
27865
27866 !! test
27867 Thumbnail output
27868 !! wikitext
27869 [[File:Thumb.png|thumb]]
27870 !! html/php+tidy
27871 <div class="thumb tright">
27872 <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>
27873 <div class="thumbcaption">
27874 <div class="magnify"><a href="/wiki/File:Thumb.png" class="internal" title="Enlarge"></a></div>
27875 </div>
27876 </div>
27877 </div>
27878 !! end
27879
27880 !! test
27881 unclosed internal link XSS (T137264)
27882 !! wikitext
27883 [[#%3Cscript%3Ealert(1)%3C/script%3E|
27884 !! html/php
27885 <p>[[#&lt;script&gt;alert(1)&lt;/script&gt;|
27886 </p>
27887 !! html/parsoid
27888 <p>[[#%3Cscript%3Ealert(1)%3C/script%3E|</p>
27889 !! end