Remove duplicate test
[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 #
36 # You can also set the following parser properties via test options:
37 # wgEnableUploads, wgAllowExternalImages, wgMaxTocLevel,
38 # wgLinkHolderBatchSize, wgRawHtml, wgInterwikiMagic,
39 # wgEnableMagicLinks
40 #
41 # For testing purposes, temporary articles can created:
42 # !!article / NAMESPACE:TITLE / !!text / ARTICLE TEXT / !!endarticle
43 # where '/' denotes a newline.
44
45 # This is the standard article assumed to exist.
46 !! article
47 Main Page
48 !! text
49 blah blah
50 !! endarticle
51
52 !!article
53 Foo
54 !!text
55 FOO
56 !!endarticle
57
58 !!article
59 Template:Foo
60 !!text
61 FOO
62 !!endarticle
63
64 !! article
65 Template:Blank
66 !! text
67 !! endarticle
68
69 !! article
70 Template:pipe
71 !! text
72 |
73 !! endarticle
74
75 !! article
76 Template:=
77 !! text
78 <nowiki>=</nowiki>
79 !! endarticle
80
81 !!article
82 MediaWiki:bad image list
83 !!text
84 * [[File:Bad.jpg]] except [[Nasty page]]
85 !!endarticle
86
87 !! article
88 Template:inner list
89 !! text
90 * item 1
91 !! endarticle
92
93 !! article
94 Template:tbl-start
95 !! text
96 {|
97 !! endarticle
98
99 !! article
100 Template:tbl-end
101 !! text
102 |}
103 !! endarticle
104
105 !! article
106 Template:echo
107 !! text
108 {{{1}}}
109 !! endarticle
110
111 !! article
112 Template:echo_with_span
113 !! text
114 <span>{{{1}}}</span>
115 !! endarticle
116
117 !! article
118 Template:echo_with_div
119 !! text
120 <div>{{{1}}}</div>
121 !! endarticle
122
123 !! article
124 Template:blank_param
125 !! text
126 {{{1}}}
127 {{{}}}
128 !! endarticle
129
130 !! article
131 Template:table_attribs
132 !! text
133 <noinclude>
134 |</noinclude>style="color:red;"|Foo
135 !! endarticle
136
137 !! article
138 Template:table_attribs_2
139 !! text
140 <noinclude>
141 |</noinclude>style="color:red;"|Foo
142 |Bar||Baz
143 !! endarticle
144
145 !! article
146 Template:table_attribs_3
147 !! text
148 <noinclude>
149 |</noinclude>style{{=}}"background:&#35;f9f9f9;"|Foo
150 !! endarticle
151
152 !! article
153 Template:table_attribs_4
154 !! text
155 | style="background-color:#DC241f;" width="10px" |
156 !! endarticle
157
158 !! article
159 Template:table_attribs_5
160 !! text
161 <noinclude>
162 |</noinclude>style="color:red;"||Bar
163 !! endarticle
164
165 !! article
166 Template:table_attribs_6
167 !! text
168 style="background: <nowiki>
169
170
171 red;</nowiki>" |
172 !! endarticle
173
174 !! article
175 Template:table_attribs_7
176 !! text
177 <noinclude>
178 |</noinclude>style{{=}}"background:&#35;f9f9f9;"|Foo<ref>foo</ref>
179 !! endarticle
180
181 !! article
182 Template:table_header_cells
183 !! text
184 {{table_attribs}}!!style='color:red;'|''Bar''||style='color:brown;'|''Foo'' and Baz
185 !! endarticle
186
187 !! article
188 Template:table_cells
189 !! text
190 {{table_attribs}}||style='color:red;'|''Bar''||style='color:brown;'|''Foo'' and Baz
191 !! endarticle
192
193 !! article
194 Template:PartialTable
195 !! text
196 {|
197 |-
198 !! endarticle
199
200 !! article
201 Template:image_attribs
202 !! text
203 <noinclude>
204 [[File:foobar.jpg|</noinclude>right|Caption text<noinclude>]]</noinclude>
205 !! endarticle
206
207 ## See T48811 for details
208 !! article
209 Template:mixed_attr_content_template
210 !! text
211 style="color:red;" title="T48811"
212 |-
213 |foo
214 !! endarticle
215
216 !! article
217 Template:definition_list
218 !! text
219 one
220 ::two
221 !! endarticle
222
223 !! article
224 A?b
225 !! text
226 Weirdo titles!
227 !! endarticle
228
229 !!article
230 Template:Bullet
231 !!text
232 * Bar
233 !!endarticle
234
235 !!article
236 Template:OpenTable
237 !!text
238 {|
239 !!endarticle
240
241 !!article
242 Template:EmptyLITest
243 !!text
244 *a
245 *
246 *
247 *b
248 !!endarticle
249
250 !!article
251 Template:EmptyTRTest
252 !!text
253 {|
254 |-
255 |-
256 |foo
257 |-
258 |-
259 |bar
260 |}
261 !!endarticle
262
263 !!article
264 Template:EmptyTRWithHTMLAttrTest
265 !!text
266 <table>
267 <tr align="center"></tr>
268 <tr><td>foo</td></tr>
269 <tr align="center"></tr>
270 <tr><td>bar</td></tr>
271 </table>
272 !!endarticle
273
274 !! article
275 Template:CircularRef
276 !! text
277 <ref>{{CircularRef}}</ref>
278 !! endarticle
279
280 ###
281 ### Basic tests
282 ###
283 !! test
284 Blank input
285 !! wikitext
286 !! html
287 !! end
288
289 !! test
290 CircularRef
291 !! wikitext
292 {{CircularRef}}
293 <references />
294 !! html/parsoid
295 <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>
296 <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>
297 !! end
298
299 !! test
300 Simple paragraph
301 !! wikitext
302 This is a simple paragraph.
303 !! html
304 <p>This is a simple paragraph.
305 </p>
306 !! end
307
308 !! test
309 Paragraphs with extra newline spacing
310 !! wikitext
311 foo
312
313 bar
314
315
316 baz
317
318
319
320 booz
321 !! html
322 <p>foo
323 </p><p>bar
324 </p><p><br />
325 baz
326 </p><p><br />
327 </p><p>booz
328 </p>
329 !! end
330
331 !! test
332 Paragraphs with newline spacing with comment lines in between
333 !! wikitext
334 ----
335 a
336 <!--foo-->
337 b
338 ----
339 a
340 <!--foo--><!--More than 1 comment, still stripped-->
341 b
342 ----
343 a
344 <!--foo--> <!----> <!-- bar -->
345 b
346 ----
347 a
348 <!--foo-->
349
350 b
351 ----
352 a
353
354 <!--foo-->
355 b
356 ----
357 a
358 <!--foo-->
359
360
361 b
362 ----
363 a
364
365
366 <!--foo-->
367 b
368 ----
369 !! html
370 <hr />
371 <p>a
372 b
373 </p>
374 <hr />
375 <p>a
376 b
377 </p>
378 <hr />
379 <p>a
380 b
381 </p>
382 <hr />
383 <p>a
384 </p><p>b
385 </p>
386 <hr />
387 <p>a
388 </p><p>b
389 </p>
390 <hr />
391 <p>a
392 </p><p><br />
393 b
394 </p>
395 <hr />
396 <p>a
397 </p><p><br />
398 b
399 </p>
400 <hr />
401
402 !! end
403
404 !! test
405 Paragraphs with newline spacing with non-empty white-space lines in between
406 !! wikitext
407 ----
408 a
409
410 b
411 ----
412 a
413
414
415 b
416 ----
417 !! html
418 <hr />
419 <p>a
420 </p><p>b
421 </p>
422 <hr />
423 <p>a
424 </p><p><br />
425 b
426 </p>
427 <hr />
428
429 !! end
430
431 !! test
432 Paragraphs with newline spacing with non-empty mixed comment and white-space lines in between
433 !! wikitext
434 ----
435 a
436 <!--foo-->
437 b
438 ----
439 a
440 <!--foo--><!--More than 1 comment doesn't disable stripping of this line!-->
441 b
442 ----
443 a
444
445 <!--foo-->
446 <!--bar-->
447 b
448 ----
449 a
450
451 <!--foo-->
452 <!--bar-->
453
454 b
455 ----
456 !! html
457 <hr />
458 <p>a
459 b
460 </p>
461 <hr />
462 <p>a
463 b
464 </p>
465 <hr />
466 <p>a
467 </p><p>b
468 </p>
469 <hr />
470 <p>a
471 </p><p><br />
472 b
473 </p>
474 <hr />
475
476 !! end
477
478 !! test
479 Extra newlines: More paragraphs with indented comment
480 !! wikitext
481 a
482
483 <!--boo-->
484
485 b
486 !! html
487 <p>a
488 </p><p><br />
489 b
490 </p>
491 !!end
492
493 !! test
494 Extra newlines followed by heading
495 !! wikitext
496 a
497
498
499
500 =b=
501 [[a]]
502
503
504 =b=
505 !! html
506 <p>a
507 </p><p><br />
508 </p>
509 <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>
510 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
511 </p><p><br />
512 </p>
513 <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>
514
515 !! end
516
517 !! test
518 Extra newlines between heading and content are swallowed
519 !! wikitext
520 =b=
521
522
523
524 [[a]]
525 !! html
526 <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>
527 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
528 </p>
529 !! end
530
531 !! test
532 Heading with line break in nowiki
533 !! options
534 parsoid=wt2html
535 !! wikitext
536 == A <nowiki>B
537 C</nowiki> ==
538 !! html
539 <h2><span class="mw-headline" id="A_B.0AC">A B
540 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>
541
542 !! html/parsoid
543 <h2 id="A_B.0AC">A <span typeof="mw:Nowiki">B
544 C</span> </h2>
545 !! end
546
547 !! test
548 Parsing an URL
549 !! wikitext
550 http://fr.wikipedia.org/wiki/🍺
551 <!-- EasterEgg we love beer, better be able be able to link to it -->
552 !! html
553 <p><a rel="nofollow" class="external free" href="http://fr.wikipedia.org/wiki/🍺">http://fr.wikipedia.org/wiki/🍺</a>
554 </p>
555 !! end
556
557 # Note that the html+tidy output removes the spaces after the <li>,
558 # which is a bug (https://sourceforge.net/p/tidy/bugs/945/, etc).
559 # This is an issue for all tests with lists. We intentionally do
560 # *not* add html+tidy clauses for these, as we don't want to
561 # document/test the broken behavior. (Parsoid matches the non-tidy
562 # output in these cases.)
563
564 !! test
565 Simple list
566 !! wikitext
567 * Item 1
568 * Item 2
569 !! html
570 <ul><li> Item 1</li>
571 <li> Item 2</li></ul>
572
573 !! end
574
575 !! test
576 Italics and bold
577 !! wikitext
578 * plain
579 * plain''italic''plain
580 * plain''italic''plain''italic''plain
581 * plain'''bold'''plain
582 * plain'''bold'''plain'''bold'''plain
583 * plain''italic''plain'''bold'''plain
584 * plain'''bold'''plain''italic''plain
585 * plain''italic'''bold-italic'''italic''plain
586 * plain'''bold''bold-italic''bold'''plain
587 * plain'''''bold-italic'''italic''plain
588 * plain'''''bold-italic''bold'''plain
589 * plain''italic'''bold-italic'''''plain
590 * plain'''bold''bold-italic'''''plain
591 * plain l'''italic''plain
592 * plain l''''bold''' plain
593 !! html
594 <ul><li> plain</li>
595 <li> plain<i>italic</i>plain</li>
596 <li> plain<i>italic</i>plain<i>italic</i>plain</li>
597 <li> plain<b>bold</b>plain</li>
598 <li> plain<b>bold</b>plain<b>bold</b>plain</li>
599 <li> plain<i>italic</i>plain<b>bold</b>plain</li>
600 <li> plain<b>bold</b>plain<i>italic</i>plain</li>
601 <li> plain<i>italic<b>bold-italic</b>italic</i>plain</li>
602 <li> plain<b>bold<i>bold-italic</i>bold</b>plain</li>
603 <li> plain<i><b>bold-italic</b>italic</i>plain</li>
604 <li> plain<b><i>bold-italic</i>bold</b>plain</li>
605 <li> plain<i>italic<b>bold-italic</b></i>plain</li>
606 <li> plain<b>bold<i>bold-italic</i></b>plain</li>
607 <li> plain l'<i>italic</i>plain</li>
608 <li> plain l'<b>bold</b> plain</li></ul>
609
610 !! end
611
612 # this example taken from the [[simple:Moon]] article (T49326)
613 !! test
614 Italics and possessives (1)
615 !! wikitext
616 obtained by ''[[Lunar Prospector]]'''s gamma-ray spectrometer
617 !! html
618 <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
619 </p>
620 !! end
621
622 # this example taken from [[en:Flaming Pie]] (T51926)
623 !! test
624 Italics and possessives (2)
625 !! wikitext
626 '''''Flaming Pie''''' is ... released in 1997. In ''Flaming Pie'''s liner notes
627 !! html
628 <p><i><b>Flaming Pie</b></i> is ... released in 1997. In <i>Flaming Pie'</i>s liner notes
629 </p>
630 !! end
631
632 # this example taken from [[en:Dictionary]] (T51926)
633 !! test
634 Italics and possessives (3)
635 !! wikitext
636 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''.
637 !! html
638 <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>.
639 </p>
640 !! end
641
642
643 ###
644 ### 2-quote opening sequence tests
645 ###
646 !! test
647 Italics and bold: 2-quote opening sequence: (2,2)
648 !! wikitext
649 ''foo''
650 !! html
651 <p><i>foo</i>
652 </p>
653 !!end
654
655 !! test
656 Italics and bold: 2-quote opening sequence: (2,3)
657 !! wikitext
658 ''foo'''
659 !! html/*
660 <p><i>foo'</i>
661 </p>
662 !!end
663
664 !! test
665 Italics and bold: 2-quote opening sequence: (2,4)
666 !! options
667 parsoid=wt2html
668 !! wikitext
669 ''foo''''
670 !! html/*
671 <p><i>foo''</i>
672 </p>
673 !!end
674
675 # same html as previous, but wikitext adjusted to match parsoid html2wt
676 !! test
677 Italics and bold: 2-quote opening sequence: (2,4) w/ nowiki
678 !! wikitext
679 ''foo<nowiki>''</nowiki>''
680 !! html
681 <p><i>foo''</i>
682 </p>
683 !! end
684
685 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
686 !! test
687 Italics and bold: 2-quote opening sequence: (2,5)
688 !! options
689 parsoid=wt2html
690 !! wikitext
691 ''foo'''''
692 !! html/php
693 <p><i>foo</i>
694 </p>
695 !! html/parsoid
696 <p><i>foo</i><b></b>
697 </p>
698 !!end
699
700 # same html as previous, but wikitext adjusted to match parsoid html2wt
701 !! test
702 Italics and bold: 2-quote opening sequence: (2,5+3) w/ nowiki
703 !! wikitext
704 ''foo'''''<nowiki/>'''
705 !! html/php
706 <p><i>foo</i>
707 </p>
708 !! html/parsoid
709 <p><i>foo</i><b></b>
710 </p>
711 !! end
712
713
714 ###
715 ### 3-quote opening sequence tests
716 ###
717
718 !! test
719 Italics and bold: 3-quote opening sequence: (3,2)
720 !! wikitext
721 '''foo''
722 !! html/*
723 <p>'<i>foo</i>
724 </p>
725 !!end
726
727 !! test
728 Italics and bold: 3-quote opening sequence: (3,3)
729 !! wikitext
730 '''foo'''
731 !! html
732 <p><b>foo</b>
733 </p>
734 !!end
735
736 !! test
737 Italics and bold: 3-quote opening sequence: (3,4)
738 !! wikitext
739 '''foo''''
740 !! html/*
741 <p><b>foo'</b>
742 </p>
743 !!end
744
745 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
746 !! test
747 Italics and bold: 3-quote opening sequence: (3,5)
748 !! options
749 parsoid=wt2html
750 !! wikitext
751 '''foo'''''
752 !! html/php
753 <p><b>foo</b>
754 </p>
755 !! html/parsoid
756 <p><b>foo</b><i></i>
757 </p>
758 !!end
759
760 # same html as previous, but wikitext adjusted to match parsoid html2wt
761 !! test
762 Italics and bold: 3-quote opening sequence: (3,5+2) w/ nowiki
763 !! wikitext
764 '''foo'''''<nowiki/>''
765 !! html/php
766 <p><b>foo</b>
767 </p>
768 !! html/parsoid
769 <p><b>foo</b><i></i>
770 </p>
771 !! end
772
773
774 ###
775 ### 4-quote opening sequence tests
776 ###
777
778 !! test
779 Italics and bold: 4-quote opening sequence: (4,2)
780 !! options
781 parsoid=wt2html
782 !! wikitext
783 ''''foo''
784 !! html/*
785 <p>''<i>foo</i>
786 </p>
787 !!end
788
789 # same html as previous, but wikitext adjusted to match parsoid html2wt
790 !! test
791 Italics and bold: 4-quote opening sequence: (4,2) w/ nowiki
792 !! wikitext
793 <nowiki>''</nowiki>''foo''
794 !! html
795 <p>''<i>foo</i>
796 </p>
797 !! end
798
799 !! test
800 Italics and bold: 4-quote opening sequence: (4,3)
801 !! wikitext
802 ''''foo'''
803 !! html/*
804 <p>'<b>foo</b>
805 </p>
806 !!end
807
808 !! test
809 Italics and bold: 4-quote opening sequence: (4,4)
810 !! options
811 parsoid=wt2html
812 !! wikitext
813 ''''foo''''
814 !! html/*
815 <p>'<b>foo'</b>
816 </p>
817 !!end
818
819 # same html as previous, but wikitext adjusted to match parsoid html2wt
820 !! test
821 Italics and bold: 4-quote opening sequence: (4,4) w/ nowiki
822 !! wikitext
823 '<nowiki/>'''foo''''
824 !! html
825 <p>'<b>foo'</b>
826 </p>
827 !! end
828
829 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
830 !! test
831 Italics and bold: 4-quote opening sequence: (4,5)
832 !! options
833 parsoid=wt2html
834 !! wikitext
835 ''''foo'''''
836 !! html/php
837 <p>'<b>foo</b>
838 </p>
839 !! html/parsoid
840 <p>'<b>foo</b><i></i>
841 </p>
842 !!end
843
844 # same html as previous, but wikitext adjusted to match parsoid html2wt
845 !! test
846 Italics and bold: 4-quote opening sequence: (4,5+2) w/ nowiki
847 !! wikitext
848 '<nowiki/>'''foo'''''<nowiki/>''
849 !! html/php
850 <p>'<b>foo</b>
851 </p>
852 !! html/parsoid
853 <p>'<b>foo</b><i></i>
854 </p>
855 !! end
856
857
858 ###
859 ### 5-quote opening sequence tests
860 ###
861
862 !! test
863 Italics and bold: 5-quote opening sequence: (5,2)
864 !! options
865 parsoid=wt2html
866 !! wikitext
867 '''''foo''
868 !! html/*
869 <p><b><i>foo</i></b>
870 </p>
871 !!end
872
873 # same html as previous, but wikitext adjusted to match parsoid html2wt
874 !! test
875 Italics and bold: 5-quote opening sequence: (5,2+3)
876 !! wikitext
877 '''''foo'''''
878 !! html/*
879 <p><i><b>foo</b></i>
880 </p>
881 !! end
882
883 !! test
884 Italics and bold: 5-quote opening sequence: (5,3)
885 !! options
886 parsoid=wt2html
887 !! wikitext
888 '''''foo'''
889 !! html/*
890 <p><i><b>foo</b></i>
891 </p>
892 !!end
893
894 # same html as previous, but wikitext adjusted to match parsoid html2wt
895 !! test
896 Italics and bold: 5-quote opening sequence: (5,3+2)
897 !! wikitext
898 '''''foo'''''
899 !! html
900 <p><i><b>foo</b></i>
901 </p>
902 !! end
903
904 !! test
905 Italics and bold: 5-quote opening sequence: (5,4)
906 !! options
907 parsoid=wt2html
908 !! wikitext
909 '''''foo''''
910 !! html/*
911 <p><i><b>foo'</b></i>
912 </p>
913 !!end
914
915 !! test
916 Italics and bold: 5-quote opening sequence: (5,5)
917 !! wikitext
918 '''''foo'''''
919 !! html
920 <p><i><b>foo</b></i>
921 </p>
922 !!end
923
924 !! test
925 Italics and bold: 5-quote opening sequence: (5,6)
926 !! wikitext
927 '''''foo''''''
928 !! html/*
929 <p><i><b>foo'</b></i>
930 </p>
931 !! end
932
933 ###
934 ### multiple quote sequences in a line
935 ###
936
937 !! test
938 Italics and bold: multiple quote sequences: (2,4,2)
939 !! options
940 parsoid=wt2html
941 !! wikitext
942 ''foo''''bar''
943 !! html/*
944 <p><i>foo'<b>bar</b></i>
945 </p>
946 !! end
947
948 # same html as previous, but wikitext adjusted to match parsoid html2wt
949 !! test
950 Italics and bold: multiple quote sequences: (2,4,2+3) w/ nowiki
951 !! wikitext
952 ''foo'<nowiki/>'''bar'''''
953 !! html
954 <p><i>foo'<b>bar</b></i>
955 </p>
956 !! end
957
958 !! test
959 Italics and bold: multiple quote sequences: (2,4,3)
960 !! options
961 parsoid=wt2html
962 !! wikitext
963 ''foo''''bar'''
964 !! html/*
965 <p><i>foo'<b>bar</b></i>
966 </p>
967 !! end
968
969 # same html as previous, but wikitext adjusted to match parsoid html2wt
970 !! test
971 Italics and bold: multiple quote sequences: (2,4,3+2) w/ nowiki
972 !! wikitext
973 ''foo'<nowiki/>'''bar'''''
974 !! html
975 <p><i>foo'<b>bar</b></i>
976 </p>
977 !! end
978
979 !! test
980 Italics and bold: multiple quote sequences: (2,4,4)
981 !! options
982 parsoid=wt2html
983 !! wikitext
984 ''foo''''bar''''
985 !! html/*
986 <p><i>foo'<b>bar'</b></i>
987 </p>
988 !! end
989
990 # same html as previous, but wikitext adjusted to match parsoid html2wt
991 !! test
992 Italics and bold: multiple quote sequences: (2,4,4+2) w/ nowiki
993 !! wikitext
994 ''foo'<nowiki/>'''bar'<nowiki/>'''''
995 !! html
996 <p><i>foo'<b>bar'</b></i>
997 </p>
998 !! end
999
1000 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
1001 !! test
1002 Italics and bold: multiple quote sequences: (3,4,2)
1003 !! options
1004 parsoid=wt2html
1005 !! wikitext
1006 '''foo''''bar''
1007 !! html/php
1008 <p><b>foo'</b>bar
1009 </p>
1010 !! html/parsoid
1011 <p><b>foo'</b>bar<i></i>
1012 </p>
1013 !! end
1014
1015 # same html as previous, but wikitext adjusted to match parsoid html2wt
1016 !! test
1017 Italics and bold: multiple quote sequences: (3,4,2+2) w/ nowiki
1018 !! wikitext
1019 '''foo''''bar''<nowiki/>''
1020 !! html/php
1021 <p><b>foo'</b>bar
1022 </p>
1023 !! html/parsoid
1024 <p><b>foo'</b>bar<i></i>
1025 </p>
1026 !! end
1027
1028 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
1029 !! test
1030 Italics and bold: multiple quote sequences: (3,4,3)
1031 !! options
1032 parsoid=wt2html
1033 !! wikitext
1034 '''foo''''bar'''
1035 !! html/php
1036 <p><b>foo'</b>bar
1037 </p>
1038 !! html/parsoid
1039 <p><b>foo'</b>bar<b></b>
1040 </p>
1041 !! end
1042
1043 # same html as previous, but wikitext adjusted to match parsoid html2wt
1044 !! test
1045 Italics and bold: multiple quote sequences: (3,4,3+3) w/ nowiki
1046 !! wikitext
1047 '''foo''''bar'''<nowiki/>'''
1048 !! html/php
1049 <p><b>foo'</b>bar
1050 </p>
1051 !! html/parsoid
1052 <p><b>foo'</b>bar<b></b>
1053 </p>
1054 !! end
1055
1056 ###
1057 ### other quote tests
1058 ###
1059 !! test
1060 Italics and bold: other quote tests: (2,3,5)
1061 !! wikitext
1062 ''this is about '''foo's family'''''
1063 !! html
1064 <p><i>this is about <b>foo's family</b></i>
1065 </p>
1066 !!end
1067
1068
1069 !! test
1070 Italics and bold: other quote tests: (2,(3,3),2)
1071 !! wikitext
1072 ''this is about '''foo's''' family''
1073 !! html
1074 <p><i>this is about <b>foo's</b> family</i>
1075 </p>
1076 !!end
1077
1078
1079 !! test
1080 Italics and bold: other quote tests: (3,2,3,2)
1081 !! options
1082 parsoid=wt2html
1083 !! wikitext
1084 '''this is about ''foo'''s family''
1085 !! html/*
1086 <p><b>this is about <i>foo</i></b><i>s family</i>
1087 </p>
1088 !!end
1089
1090
1091 # same html as previous, but wikitext adjusted to match parsoid html2wt
1092 !! test
1093 Italics and bold: other quote tests: (3,2,3+2+2,2)
1094 !! wikitext
1095 '''this is about ''foo'''''<nowiki/>''s family''
1096 !! html
1097 <p><b>this is about <i>foo</i></b><i>s family</i>
1098 </p>
1099 !! end
1100
1101
1102 !! test
1103 Italics and bold: other quote tests: (3,2,3,3)
1104 !! wikitext
1105 '''this is about ''foo'''s family'''
1106 !! html/*
1107 <p>'<i>this is about </i>foo<b>s family</b>
1108 </p>
1109 !!end
1110
1111
1112 !! test
1113 Italics and bold: other quote tests: (3,(2,2),3)
1114 !! wikitext
1115 '''this is about ''foo's'' family'''
1116 !! html
1117 <p><b>this is about <i>foo's</i> family</b>
1118 </p>
1119 !!end
1120
1121
1122 !! test
1123 Italicized possessive
1124 !! wikitext
1125 The ''[[Main Page]]'''s talk page.
1126 !! html/php
1127 <p>The <i><a href="/wiki/Main_Page" title="Main Page">Main Page</a>'</i>s talk page.
1128 </p>
1129 !! html/parsoid
1130 <p>The <i><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a>'</i>s talk page.</p>
1131 !! end
1132
1133 !! test
1134 Parsoid only: Quote balancing context should be restricted to td/th cells on the same wikitext line
1135 (Requires tidy for PHP parser output to be fixed up)
1136 !! options
1137 parsoid=wt2html,wt2wt
1138 !! wikitext
1139 {|
1140 !''a!!''b
1141 |''a||''b
1142 |}
1143 !! html/php+tidy
1144 <table>
1145 <tr>
1146 <th><i>a</i></th>
1147 <th><i>b</i></th>
1148 <td><i>a</i></td>
1149 <td><i>b</i></td>
1150 </tr>
1151 </table>
1152 !! html/parsoid
1153 <table>
1154 <tbody><tr><th><i>a</i></th><th><i>b</i></th>
1155 <td><i>a</i></td><td><i>b</i></td></tr>
1156 </tbody></table>
1157 !! end
1158
1159 ###
1160 ### Non-html5 tags
1161 ###
1162
1163 !! test
1164 Non-html5 tags should be accepted
1165 !! wikitext
1166 <center>''foo''</center>
1167 <big>''foo''</big>
1168 <font>''foo''</font>
1169 <strike>''foo''</strike>
1170 <tt>''foo''</tt>
1171 !! html
1172 <center><i>foo</i></center>
1173 <p><big><i>foo</i></big>
1174 <font><i>foo</i></font>
1175 <strike><i>foo</i></strike>
1176 <tt><i>foo</i></tt>
1177 </p>
1178 !! end
1179
1180 !! test
1181 <wbr> is valid wikitext (T54468)
1182 !! wikitext
1183 <wbr>
1184 !! html
1185 <p><wbr />
1186 </p>
1187 !! end
1188
1189 # <strike> is HTML4, <s> is HTML4/5.
1190 !! test
1191 <s> or <strike> for strikethrough
1192 !! wikitext
1193 <strike>strike</strike>
1194
1195 <s>s</s>
1196 !! html
1197 <p><strike>strike</strike>
1198 </p><p><s>s</s>
1199 </p>
1200 !! end
1201
1202 ## a not permitted
1203 ## i,b,br omitted
1204 !! test
1205 Text-level semantic html elements in wikitext
1206 !! wikitext
1207 <em>text</em>
1208 <strong>text</strong>
1209 <small>text</small>
1210 <s>text</s>
1211 <cite>text</cite>
1212 <q>text</q>
1213 <dfn>text</dfn>
1214 <abbr>text</abbr>
1215 <data>text</data>
1216 <time>text</time>
1217 <code>text</code>
1218 <var>text</var>
1219 <samp>text</samp>
1220 <kbd>text</kbd>
1221 <sub>text</sub>
1222 <u>text</u>
1223 <mark>text</mark>
1224 <ruby><rb>明日</rb><rp>(</rp><rt>Ashita</rt><rp> </rp><rtc>あした</rtc><rp>)</rp></ruby>
1225 <bdi>text</bdi>
1226 <bdo>text</bdo>
1227 <span>text</span>
1228 <wbr />
1229 !! html
1230 <p><em>text</em>
1231 <strong>text</strong>
1232 <small>text</small>
1233 <s>text</s>
1234 <cite>text</cite>
1235 <q>text</q>
1236 <dfn>text</dfn>
1237 <abbr>text</abbr>
1238 <data>text</data>
1239 <time>text</time>
1240 <code>text</code>
1241 <var>text</var>
1242 <samp>text</samp>
1243 <kbd>text</kbd>
1244 <sub>text</sub>
1245 <u>text</u>
1246 <mark>text</mark>
1247 <ruby><rb>明日</rb><rp>(</rp><rt>Ashita</rt><rp> </rp><rtc>あした</rtc><rp>)</rp></ruby>
1248 <bdi>text</bdi>
1249 <bdo>text</bdo>
1250 <span>text</span>
1251 <wbr />
1252 </p>
1253 !! end
1254
1255 # test cases taken from
1256 # https://www.w3.org/TR/html5/text-level-semantics.html#the-ruby-element
1257 !! test
1258 Ruby markup (W3C-style)
1259 !! wikitext
1260 ; Mono-ruby for individual base characters
1261 : <ruby>日<rt>に</rt>本<rt>ほん</rt>語<rt>ご</rt></ruby>
1262 ; Group ruby
1263 : <ruby>今日<rt>きょう</rt></ruby>
1264 ; Jukugo ruby
1265 : <ruby>法<rb>華</rb><rb>経</rb><rt>ほ</rt><rt>け</rt><rt>きょう</rt></ruby>
1266 ; Inline ruby
1267 : <ruby>東<rb>京</rb><rp>(</rp><rt>とう</rt><rt>きょう</rt><rp>)</rp></ruby>
1268 ; Double-sided ruby
1269 : <ruby><rb>旧</rb><rb>金</rb><rb>山</rb><rt>jiù</rt><rt>jīn</rt><rt>shān</rt><rtc>San Francisco</rtc></ruby>
1270 <ruby>
1271 <rb>♥</rb><rtc><rt>Heart</rt></rtc><rtc lang="fr"><rt>Cœur</rt></rtc>
1272 <rb>☘</rb><rtc><rt>Shamrock</rt></rtc><rtc lang="fr"><rt>Trèfle</rt></rtc>
1273 <rb>✶</rb><rtc><rt>Star</rt></rtc><rtc lang="fr"><rt>Étoile</rt></rtc>
1274 </ruby>
1275 !! html
1276 <dl><dt> Mono-ruby for individual base characters</dt>
1277 <dd> <ruby>日<rt>に</rt>本<rt>ほん</rt>語<rt>ご</rt></ruby></dd>
1278 <dt> Group ruby</dt>
1279 <dd> <ruby>今日<rt>きょう</rt></ruby></dd>
1280 <dt> Jukugo ruby</dt>
1281 <dd> <ruby>法<rb>華</rb><rb>経</rb><rt>ほ</rt><rt>け</rt><rt>きょう</rt></ruby></dd>
1282 <dt> Inline ruby</dt>
1283 <dd> <ruby>東<rb>京</rb><rp>(</rp><rt>とう</rt><rt>きょう</rt><rp>)</rp></ruby></dd>
1284 <dt> Double-sided ruby</dt>
1285 <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>
1286 <p><ruby>
1287 <rb>♥</rb><rtc><rt>Heart</rt></rtc><rtc lang="fr"><rt>Cœur</rt></rtc>
1288 <rb>☘</rb><rtc><rt>Shamrock</rt></rtc><rtc lang="fr"><rt>Trèfle</rt></rtc>
1289 <rb>✶</rb><rtc><rt>Star</rt></rtc><rtc lang="fr"><rt>Étoile</rt></rtc>
1290 </ruby>
1291 </p>
1292 !! end
1293
1294 # The next two test different paths in the sanitizer.
1295 !! test
1296 Non-word characters don't terminate tag names (T19663, T42670, T54022)
1297 !! wikitext
1298 <blockquote|>a</blockquote>
1299
1300 <b→> doesn't terminate </b→>
1301
1302 <bä> doesn't terminate </bä>
1303
1304 <boo> doesn't terminate </boo>
1305
1306 <s.foo> doesn't terminate </s.foo>
1307
1308 <sub-ID#1>
1309 !! html
1310 <p>&lt;blockquote|&gt;a&lt;/blockquote&gt;
1311 </p><p>&lt;b→&gt; doesn't terminate &lt;/b→&gt;
1312 </p><p>&lt;bä&gt; doesn't terminate &lt;/bä&gt;
1313 </p><p>&lt;boo&gt; doesn't terminate &lt;/boo&gt;
1314 </p><p>&lt;s.foo&gt; doesn't terminate &lt;/s.foo&gt;
1315 </p><p>&lt;sub-ID#1&gt;
1316 </p>
1317 !! end
1318
1319 # There is a tidy bug here: https://sourceforge.net/p/tidy/bugs/946/
1320 # If the non-word-character tag made it through the sanitizer, tidy
1321 # would munge it up.
1322 !! test
1323 Non-word characters don't terminate tag names + tidy
1324 !! wikitext
1325 <blockquote|>a</blockquote>
1326
1327 <b→> doesn't terminate </b→>
1328
1329 <bä> doesn't terminate </bä>
1330
1331 <boo> doesn't terminate </boo>
1332
1333 <s.foo> doesn't terminate </s.foo>
1334
1335 <sub-ID#1>
1336 !! html+tidy
1337 <p>&lt;blockquote|&gt;a</p>
1338 <p>&lt;b→&gt; doesn't terminate &lt;/b→&gt;</p>
1339 <p>&lt;bä&gt; doesn't terminate &lt;/bä&gt;</p>
1340 <p>&lt;boo&gt; doesn't terminate &lt;/boo&gt;</p>
1341 <p>&lt;s.foo&gt; doesn't terminate &lt;/s.foo&gt;</p>
1342 <p>&lt;sub-ID#1&gt;</p>
1343 !! end
1344
1345 ###
1346 ### See tests/parser/parserTestsParserHook.php for the <tåg> extension)
1347 ### This checks that HTML5 tags (with non-word characters in the tag
1348 ### name) make it safely through the parser -- the Sanitizer will
1349 ### munge them later, as it should.
1350 ###
1351 !! test
1352 Non-word characters are valid in extension tags (T19663)
1353 !! wikitext
1354 <tåg>tåg</tåg>
1355 !! html/php
1356 <pre>
1357 'tåg'
1358 array (
1359 )
1360 </pre>
1361
1362 !! html/parsoid
1363 <pre typeof="mw:Extension/tåg" data-mw='{"name":"tåg","attrs":{},"body":{"extsrc":"tåg"}}' data-parsoid='{}' about="#mwt2"></pre>
1364 !! end
1365
1366 !! test
1367 Isolated close tags should be treated as literal text (T54760)
1368 !! options
1369 parsoid=wt2html
1370 !! wikitext
1371 </b>
1372
1373 <s.foo>s</s>
1374 !! html/php+tidy
1375 <p>&lt;s.foo&gt;s</p>
1376 !! html/parsoid
1377 <p>&lt;s.foo&gt;s</p>
1378 !! end
1379
1380 ###
1381 ### Special characters
1382 ###
1383
1384 !! test
1385 Bare pipe character (T54363)
1386 !! wikitext
1387 |
1388 !! html
1389 <p>|
1390 </p>
1391 !! end
1392
1393 !! test
1394 Bare pipe character from a template (T54363)
1395 !! wikitext
1396 {{pipe}}
1397 !! html
1398 <p>|
1399 </p>
1400 !! end
1401
1402 ###
1403 ### <nowiki> test cases
1404 ###
1405
1406 !! test
1407 <nowiki> unordered list
1408 !! wikitext
1409 <nowiki>* This is not an unordered list item.</nowiki>
1410 !! html/php
1411 <p>* This is not an unordered list item.
1412 </p>
1413 !! html/parsoid
1414 <p><span typeof="mw:Nowiki">* This is not an unordered list item.</span></p>
1415 !! end
1416
1417 !! test
1418 <nowiki> spacing
1419 !! wikitext
1420 <nowiki>Lorem ipsum dolor
1421
1422 sed abit.
1423 sed nullum.
1424
1425 :and a colon
1426 </nowiki>
1427 !! html/php
1428 <p>Lorem ipsum dolor
1429
1430 sed abit.
1431 sed nullum.
1432
1433 :and a colon
1434
1435 </p>
1436 !! html/parsoid
1437 <p><span typeof="mw:Nowiki">Lorem ipsum dolor
1438
1439 sed abit.
1440 sed nullum.
1441
1442 :and a colon
1443 </span></p>
1444 !! end
1445
1446 !! test
1447 Don't parse <nowiki><span class="error"></nowiki> (T149622)
1448 !! wikitext
1449 <nowiki><span class="error"></nowiki>
1450 !! html/php
1451 <p>&lt;span class="error"&gt;
1452 </p>
1453 !! html/parsoid
1454 <p><span typeof="mw:Nowiki">&lt;span class="error"></span></p>
1455 !! end
1456
1457 !! test
1458 nowiki 3
1459 !! wikitext
1460 :There is not nowiki.
1461 :There is <nowiki>nowiki</nowiki>.
1462
1463 #There is not nowiki.
1464 #There is <nowiki>nowiki</nowiki>.
1465
1466 *There is not nowiki.
1467 *There is <nowiki>nowiki</nowiki>.
1468 !! html/php
1469 <dl><dd>There is not nowiki.</dd>
1470 <dd>There is nowiki.</dd></dl>
1471 <ol><li>There is not nowiki.</li>
1472 <li>There is nowiki.</li></ol>
1473 <ul><li>There is not nowiki.</li>
1474 <li>There is nowiki.</li></ul>
1475
1476 !! html/parsoid
1477 <dl><dd data-parsoid='{}'>There is not nowiki.</dd>
1478 <dd data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</dd></dl>
1479
1480 <ol><li data-parsoid='{}'>There is not nowiki.</li>
1481 <li data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</li></ol>
1482
1483 <ul><li data-parsoid='{}'>There is not nowiki.</li>
1484 <li data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</li></ul>
1485 !! end
1486
1487 !! test
1488 Entities inside <nowiki>
1489 !! wikitext
1490 <nowiki>&lt;</nowiki>
1491 !! html
1492 <p>&lt;
1493 </p>
1494 !! end
1495
1496 !! test
1497 Entities inside template parameters
1498 !! wikitext
1499 {{echo|&ndash;}}
1500 !! html/php+tidy
1501 <p>–</p>
1502 !! html/parsoid
1503 <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>
1504 !! end
1505
1506 !! test
1507 Properly escape nowiki when combined with other wiki markup
1508 !! options
1509 parsoid=html2wt
1510 !! html/parsoid
1511 <p>* &lt;/nowiki&gt; tag</p>
1512 !! wikitext
1513 <nowiki>*</nowiki> <nowiki>&lt;/nowiki&gt;</nowiki> tag
1514 !! end
1515
1516 !! test
1517 T93824: Put escaped HTML tags inside nowiki
1518 !! options
1519 parsoid=html2wt
1520 !! html/parsoid
1521 <p>&lt;h2&gt;foo&lt;/h2&gt;</p>
1522 !! wikitext
1523 <nowiki><h2>foo</h2></nowiki>
1524 !! end
1525
1526 !! test
1527 T71950: 1. Put nowiki as close to cause as possible, even with non-quote escapable chars
1528 !! options
1529 parsoid=html2wt
1530 !! html/parsoid
1531 <p>This text: L'<a rel="mw:WikiLink" href="./Foo">Foo</a>
1532 This text: L''<a rel="mw:WikiLink" href="./Foo">Foo</a>
1533 This text: L'''<a rel="mw:WikiLink" href="./Foo">Foo</a>''</p>
1534 !! wikitext
1535 This text: L'[[Foo]]
1536 This text: L<nowiki>''</nowiki>[[Foo]]
1537 This text: L<nowiki>'''</nowiki>[[Foo]]<nowiki>''</nowiki>
1538 !! end
1539
1540 # This test fails because wikitext whitespace is not normalized before comparing.
1541 !! test
1542 T71950: 2. Put nowiki as close to cause as possible, after ' :'
1543 !! options
1544 parsoid=html2wt
1545 !! html/parsoid
1546 <p>This text : L''<a rel="mw:WikiLink" href="./Foo">Foo</a>
1547 </p>
1548 !! wikitext
1549 This text : L<nowiki>''</nowiki>[[Foo]]
1550 !! end
1551
1552 # This test and the next one are html2wt only as they test that incorrect wikitext
1553 # passed in template arguments gets escaped or wrapped in nowikis where required.
1554 !! test
1555 T71482: Use {{!}} instead of nowiki for single pipe in template argument
1556 !! options
1557 parsoid=html2wt
1558 !! html/parsoid
1559 <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>
1560 <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>
1561 !! wikitext
1562 {{echo|foo{{!}}bar}}
1563 {{echo|<nowiki>foo|bar |[[</nowiki>}}
1564 !! end
1565
1566 !! test
1567 T53961: Output correct nowikis in template arguments
1568 !! options
1569 parsoid=html2wt
1570 !! html/parsoid
1571 <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>
1572 <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>
1573 <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>
1574 <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>
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 }&quot;}},&quot;i&quot;:0}}]}" about="#mwt5"></span></p>
1576 !! wikitext
1577 {{echo|a [ b}}
1578 {{echo|<nowiki>a }} b</nowiki>}}
1579 {{echo|<nowiki>a [[ b</nowiki>}}
1580 {{echo|<nowiki>a | {{ ]]</nowiki>}}
1581 {{echo|a <nowiki>}</nowiki>}}
1582 !! end
1583
1584 !! test
1585 Cases where "!!" needs nowiki protection
1586 !! options
1587 parsoid=html2wt
1588 !! html/parsoid
1589 <table>
1590 <tr><th>this needs protection !! here</th></tr>
1591 </table>
1592
1593 <table>
1594 <tr><th>this does not need
1595 protection !! here</th></tr>
1596 </table>
1597 !! wikitext
1598 {|
1599 !<nowiki>this needs protection !! here</nowiki>
1600 |}
1601
1602 {|
1603 !this does not need
1604 protection !! here
1605 |}
1606 !! end
1607
1608 ###
1609 ### Comments
1610 ###
1611 !! test
1612 Comments and Indent-Pre
1613 !! wikitext
1614 <!-- comment 1 --> asdf
1615
1616 <!-- comment 1 --> asdf
1617 <!-- comment 2 -->
1618
1619 <!-- comment 1 --> asdf
1620 <!-- comment 2 -->xyz
1621
1622 <!-- comment 1 --> asdf
1623 <!-- comment 2 --> xyz
1624 !! html
1625 <pre>asdf
1626 </pre>
1627 <pre>asdf
1628 </pre>
1629 <pre>asdf
1630 </pre>
1631 <p>xyz
1632 </p>
1633 <pre>asdf
1634 xyz
1635 </pre>
1636 !! end
1637
1638 !! test
1639 Comment test 2a
1640 !! wikitext
1641 asdf
1642 <!-- comment 1 -->
1643 jkl
1644 !! html
1645 <p>asdf
1646 jkl
1647 </p>
1648 !! end
1649
1650 !! test
1651 Comment test 2b
1652 !! wikitext
1653 asdf
1654 <!-- comment 1 -->
1655
1656 jkl
1657 !! html
1658 <p>asdf
1659 </p><p>jkl
1660 </p>
1661 !! end
1662
1663 !! test
1664 Comment test 3
1665 !! wikitext
1666 asdf
1667 <!-- comment 1 -->
1668 <!-- comment 2 -->
1669 jkl
1670 !! html
1671 <p>asdf
1672 jkl
1673 </p>
1674 !! end
1675
1676 !! test
1677 Comment test 4
1678 !! wikitext
1679 asdf<!-- comment 1 -->jkl
1680 !! html
1681 <p>asdfjkl
1682 </p>
1683 !! end
1684
1685 !! test
1686 Comment spacing
1687 !! wikitext
1688 a
1689 <!-- foo --> b <!-- bar -->
1690 c
1691 !! html
1692 <p>a
1693 </p>
1694 <pre> b
1695 </pre>
1696 <p>c
1697 </p>
1698 !! end
1699
1700 !! test
1701 Comment whitespace
1702 !! wikitext
1703 <!-- returns a single newline, not nothing, since the newline after > is not stripped -->
1704 !! html
1705
1706 !! end
1707
1708 !! test
1709 Comment semantics and delimiters
1710 !! wikitext
1711 <!-- --><!----><!-----><!------>
1712 !! html/php
1713
1714 !! html/parsoid
1715 <!-- --><!----><!--&#x2D;--><!--&#x2D;&#x2D;-->
1716 !! end
1717
1718 !! test
1719 Comment semantics and delimiters, redux
1720 !! wikitext
1721 <!-- In SGML every "foo" here would actually show up in the text -- foo -- bar
1722 -- foo -- funky huh? ... -->
1723 !! html/php
1724
1725 !! html/parsoid
1726 <!-- In SGML every "foo" here would actually show up in the text &#x2D;&#x2D; foo &#x2D;&#x2D; bar
1727 &#x2D;&#x2D; foo &#x2D;&#x2D; funky huh? ... -->
1728 !! end
1729
1730 !! test
1731 Comment semantics and delimiters: directors cut
1732 !! wikitext
1733 <!-- ... However we like to keep things simple and somewhat XML-ish so we eat
1734 everything starting with < followed by !-- until the first -- and > we see,
1735 that wouldn't be valid XML however, since in XML -- has to terminate a comment
1736 -->-->
1737 !! html/php
1738 <p>--&gt;
1739 </p>
1740 !! html/parsoid
1741 <!-- ... However we like to keep things simple and somewhat XML&#x2D;ish so we eat
1742 everything starting with < followed by !&#x2D;&#x2D; until the first &#x2D;&#x2D; and &#x3E; we see,
1743 that wouldn't be valid XML however, since in XML &#x2D;&#x2D; has to terminate a comment
1744 --><p>--></p>
1745 !! end
1746
1747 !! test
1748 Comment semantics: nesting
1749 !! wikitext
1750 <!--<!-- no, we're not going to do anything fancy here -->-->
1751 !! html/php
1752 <p>--&gt;
1753 </p>
1754 !! html/parsoid
1755 <!--<!&#x2D;&#x2D; no, we're not going to do anything fancy here --><p>--></p>
1756 !! end
1757
1758 # Parsoid closes the unclosed comment, even if it means a slight
1759 # round-trip diff.
1760 !! test
1761 Comment semantics: unclosed comment at end
1762 !! options
1763 parsoid=wt2html,html2html
1764 !! wikitext
1765 <!--This comment will run out to the end of the document
1766 !! html/php
1767
1768 !! html/parsoid
1769 <!--This comment will run out to the end of the document-->
1770 !! end
1771
1772 !! test
1773 Comment semantics: normalize comments to play nice with XML and browsers
1774 !! wikitext
1775 <!-- Browsers --!> think this is closed -->
1776 <!--> This would normally be text -->
1777 <!---> As would this -->
1778 <!-- XML doesn't like trailing dashes -------->
1779 <!-- Nor doubled hyphens -- anywhere in the data -->
1780 But this is not a comment.
1781 !! html/php
1782 <p>But this is not a comment.
1783 </p>
1784 !! html/parsoid
1785 <!-- Browsers &#x2D;&#x2D;!&#x3E; think this is closed -->
1786 <!--&#x3E; This would normally be text -->
1787 <!--&#x2D;&#x3E; As would this -->
1788 <!-- XML doesn't like trailing dashes &#x2D;&#x2D;&#x2D;&#x2D;&#x2D;&#x2D;-->
1789 <!-- Nor doubled hyphens &#x2D;&#x2D; anywhere in the data -->
1790 <p>But this is not a comment.</p>
1791 !! end
1792
1793 !! test
1794 Comment semantics: round-trip even text which contains encoded -->
1795 !! wikitext
1796 <!-- hello & goodbye - > --&gt; --&amp;gt; --&xx -->
1797 !! html/parsoid
1798 <!-- hello &#x26; goodbye &#x2D; &#x3E; &#x2D;&#x2D;&#x3E; &#x2D;&#x2D;&#x26;gt; &#x2D;&#x2D;&#x26;xx -->
1799 !! end
1800
1801 !! test
1802 Comment in template title
1803 !! wikitext
1804 {{f<!---->oo}}
1805 !! html
1806 <p>FOO
1807 </p>
1808 !! end
1809
1810 !! test
1811 Comment on its own line post-expand
1812 !! wikitext
1813 a
1814 {{blank}}<!---->
1815 b
1816 !! html
1817 <p>a
1818 </p><p>b
1819 </p>
1820 !! end
1821
1822 !! test
1823 Comment on its own line post-expand with non-significant whitespace
1824 !! wikitext
1825 a
1826 {{blank}} <!---->
1827 b
1828 !! html
1829 <p>a
1830 </p><p>b
1831 </p>
1832 !! end
1833
1834 !! test
1835 Multiple comments should still parse as SOL-transparent
1836 !! options
1837 parsoid=wt2html,wt2wt
1838 !! wikitext
1839 <!--c1-->*a
1840 <!--c2--><!--c3--><!--c4-->*b
1841 !! html/php
1842 <ul><li>a</li>
1843 <li>b</li></ul>
1844
1845 !! html/parsoid
1846 <!--c1--><ul>
1847 <li>a
1848 </li>
1849 <!--c2--><!--c3--><!--c4-->
1850 <li>b
1851 </li>
1852 </ul>
1853 !! end
1854
1855 ###
1856 ### paragraph wrapping tests
1857 ###
1858 !! test
1859 No block tags
1860 !! wikitext
1861 a
1862
1863 b
1864 !! html
1865 <p>a
1866 </p><p>b
1867 </p>
1868 !! end
1869
1870 !! test
1871 Block tag on one line (<div>)
1872 !! wikitext
1873 a <div>foo</div>
1874
1875 b
1876 !! html
1877 a <div>foo</div>
1878 <p>b
1879 </p>
1880 !! html+tidy
1881 <p>a</p>
1882 <div>foo</div>
1883 <p>b</p>
1884 !! end
1885
1886 !! test
1887 Block tag on one line (<blockquote>)
1888 !! wikitext
1889 a <blockquote>foo</blockquote>
1890
1891 b
1892 !! html
1893 a <blockquote>foo</blockquote>
1894 <p>b
1895 </p>
1896 !! html+tidy
1897 <p>a</p>
1898 <blockquote>
1899 <p>foo</p>
1900 </blockquote>
1901 <p>b</p>
1902 !! end
1903
1904 !! test
1905 Block tag on both lines (<div>)
1906 !! wikitext
1907 a <div>foo</div>
1908
1909 b <div>foo</div>
1910 !! html
1911 a <div>foo</div>
1912 b <div>foo</div>
1913
1914 !! html+tidy
1915 <p>a</p>
1916 <div>foo</div>
1917 <p>b</p>
1918 <div>foo</div>
1919 !! end
1920
1921 !! test
1922 Block tag on both lines (<blockquote>)
1923 !! wikitext
1924 a <blockquote>foo</blockquote>
1925
1926 b <blockquote>foo</blockquote>
1927 !! html
1928 a <blockquote>foo</blockquote>
1929 b <blockquote>foo</blockquote>
1930
1931 !! html+tidy
1932 <p>a</p>
1933 <blockquote>
1934 <p>foo</p>
1935 </blockquote>
1936 <p>b</p>
1937 <blockquote>
1938 <p>foo</p>
1939 </blockquote>
1940 !! end
1941
1942 !! test
1943 Multiple lines without block tags
1944 !! wikitext
1945 <div>foo</div> a
1946 b
1947 c
1948 d<!--foo--> e
1949 x <div>foo</div> z
1950 !! html
1951 <div>foo</div> a
1952 <p>b
1953 c
1954 d e
1955 </p>
1956 x <div>foo</div> z
1957
1958 !! html+tidy
1959 <div>foo</div>
1960 <p>a</p>
1961 <p>b c d e</p>
1962 <p>x</p>
1963 <div>foo</div>
1964 <p>z</p>
1965 !! end
1966
1967 # Tidy strips out the empty <div> tags. Parsoid doesn't.
1968 # So, we have a separate section for Parsoid. We don't want
1969 # to mimic this stripping behavior in Parsoid. It affects
1970 # editing experience and also requires us to maintain additional
1971 # info for RT-ing.
1972 !! test
1973 Empty lines between lines with block tags
1974 !! wikitext
1975 <div></div>
1976
1977
1978 <div></div>a
1979
1980 b
1981 <div>a</div>b
1982
1983 <div>b</div>d
1984
1985
1986 <div>e</div>
1987 !! html
1988 <div></div>
1989 <p><br />
1990 </p>
1991 <div></div>a
1992 <p>b
1993 </p>
1994 <div>a</div>b
1995 <div>b</div>d
1996 <p><br />
1997 </p>
1998 <div>e</div>
1999
2000 !! html+tidy
2001 <p><br /></p>
2002 <p>a</p>
2003 <p>b</p>
2004 <div>a</div>
2005 <p>b</p>
2006 <div>b</div>
2007 <p>d</p>
2008 <p><br /></p>
2009 <div>e</div>
2010 !! html/parsoid
2011 <div data-parsoid='{"stx":"html"}'></div>
2012
2013 <p><br /></p>
2014 <div data-parsoid='{"stx":"html"}'></div><p>a</p>
2015
2016 <p>b</p>
2017 <div data-parsoid='{"stx":"html"}'>a</div><p>b</p>
2018
2019 <div data-parsoid='{"stx":"html"}'>b</div><p>d</p>
2020
2021 <p><br /></p>
2022 <div data-parsoid='{"stx":"html"}'>e</div>
2023 !! end
2024
2025 ## PHP parser emits output which is broken
2026 !! test
2027 Unclosed HTML p-tags should be handled properly
2028 !! wikitext
2029 <div><p>foo</div>
2030 a
2031
2032 b
2033 !! html/php+tidy
2034 <div>
2035 <p>foo</p>
2036 </div>
2037 <p>a</p>
2038 <p>b</p>
2039 !! html/parsoid
2040 <div data-parsoid='{"stx":"html"}'><p data-parsoid='{"stx":"html", "autoInsertedEnd":true}'>foo</p></div>
2041 <p>a</p>
2042 <p>b</p>
2043 !! end
2044
2045 ## SSS FIXME: I can come up with other scenarios where this doesn't work because
2046 ## of eager output of buffered tokens in the p-wrapper. But, I'm going to ignore
2047 ## them for now.
2048 !! test
2049 1. P-wrapping should leave sol-transparent tags outside p-tags where possible
2050 !! options
2051 parsoid=wt2html
2052 !! wikitext
2053 a [[Category:A1]] [[Category:A2]]
2054 [[Category:A3]]
2055 [[Category:A4]]
2056 !! html/parsoid
2057 <p>a</p>
2058 <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"/>
2059 !! end
2060
2061 !! test
2062 2. P-wrapping should leave sol-transparent tags outside p-tags where possible
2063 !! options
2064 parsoid=wt2html
2065 !! wikitext
2066 [[Category:A1]]a
2067 !! html/parsoid
2068 <link rel="mw:PageProp/Category" href="./Category:A1"/><p>a</p>
2069 !! end
2070
2071 ###
2072 ### Preformatted text
2073 ###
2074 !! test
2075 Preformatted text
2076 !! wikitext
2077 This is some
2078 Preformatted text
2079 With ''italic''
2080 And '''bold'''
2081 And a [[Main Page|link]]
2082 !! html
2083 <pre>This is some
2084 Preformatted text
2085 With <i>italic</i>
2086 And <b>bold</b>
2087 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
2088 </pre>
2089 !! end
2090
2091 !! test
2092 Tabs don't trigger preformatted text
2093 !! wikitext
2094 This is not
2095 preformatted text.
2096 This is preformatted text.
2097 So is this.
2098 !! html/php
2099 <p> This is not
2100 preformatted text.
2101 </p>
2102 <pre>This is preformatted text.
2103 So is this.
2104 </pre>
2105 !! html/parsoid
2106 <p> This is not
2107 preformatted text.</p>
2108 <pre>This is preformatted text.
2109 So is this.</pre>
2110 !! end
2111
2112 !! test
2113 Space before tab needs nowiki pre protection
2114 !! options
2115 parsoid=html2wt
2116 !! html/parsoid
2117 <p> a</p>
2118 !! wikitext
2119 <nowiki> </nowiki> a
2120 !! end
2121
2122 !! test
2123 Ident preformatting with inline content
2124 !! wikitext
2125 a
2126 ''b''
2127 !! html
2128 <pre>a
2129 <i>b</i>
2130 </pre>
2131 !! end
2132
2133 !! test
2134 <pre> with <nowiki> inside (compatibility with 1.6 and earlier)
2135 !! wikitext
2136 <pre><nowiki>
2137 <b>
2138 <cite>
2139 <em>
2140 </nowiki></pre>
2141 !! html
2142 <pre>
2143 &lt;b&gt;
2144 &lt;cite&gt;
2145 &lt;em&gt;
2146 </pre>
2147
2148 !! end
2149
2150 !! test
2151 Regression with preformatted in <center>
2152 !! wikitext
2153 <center>
2154 Blah
2155 </center>
2156 !! html
2157 <center>
2158 <pre>Blah
2159 </pre>
2160 </center>
2161
2162 !! end
2163
2164 !! test
2165 T54763: Preformatted in <blockquote>
2166 !! wikitext
2167 <blockquote>
2168 Blah
2169 {|
2170 |
2171 indented cell (no pre-wrapping!)
2172 |}
2173 </blockquote>
2174 !! html
2175 <blockquote>
2176 <p> Blah
2177 </p>
2178 <table>
2179 <tr>
2180 <td>
2181 <p> indented cell (no pre-wrapping!)
2182 </p>
2183 </td></tr></table>
2184 </blockquote>
2185
2186 !! end
2187
2188 !! test
2189 T53086: Double newlines in blockquotes should be turned into paragraphs
2190 !! wikitext
2191 <blockquote>
2192 Foo
2193
2194 Bar
2195 </blockquote>
2196 !! html
2197 <blockquote>
2198 <p>Foo
2199 </p><p>Bar
2200 </p>
2201 </blockquote>
2202
2203 !! end
2204
2205 !! test
2206 T17491: <ins>/<del> in blockquote
2207 !! wikitext
2208 <blockquote>
2209 Foo <del>bar</del> <ins>baz</ins> quux
2210 </blockquote>
2211 !! html
2212 <blockquote>
2213 <p>Foo <del>bar</del> <ins>baz</ins> quux
2214 </p>
2215 </blockquote>
2216
2217 !! end
2218
2219 # Note that the p-wrapping is newline sensitive, which could be
2220 # considered a bug: tidy will wrap only the 'Foo' in the example
2221 # below in a <p> tag. (see comment 23-25 of T8200)
2222 !! test
2223 T17491: <ins>/<del> in blockquote (2)
2224 !! wikitext
2225 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
2226 </blockquote>
2227 !! html
2228 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
2229 </blockquote>
2230
2231 !! html+tidy
2232 <blockquote>
2233 <p>Foo</p>
2234 <del>bar</del> <ins>baz</ins> quux</blockquote>
2235 !! end
2236
2237 !! test
2238 <pre> with attributes (T5202)
2239 !! wikitext
2240 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
2241 !! html
2242 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
2243
2244 !! end
2245
2246 !! test
2247 <pre> with width attribute (T5202)
2248 !! wikitext
2249 <pre width="8">Narrow screen goodies</pre>
2250 !! html
2251 <pre width="8">Narrow screen goodies</pre>
2252
2253 !! end
2254
2255 !! test
2256 <pre> with forbidden attribute (T5202)
2257 !! wikitext
2258 <pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
2259 !! html
2260 <pre width="8">Narrow screen goodies</pre>
2261
2262 !! end
2263
2264 !! test
2265 Entities inside <pre>
2266 !! wikitext
2267 <pre>&lt;</pre>
2268 !! html
2269 <pre>&lt;</pre>
2270
2271 !! end
2272
2273 !! test
2274 <pre> with forbidden attribute values (T5202)
2275 !! wikitext
2276 <pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
2277 !! html
2278 <pre width="8" style="/* insecure input */">Narrow screen goodies</pre>
2279
2280 !! end
2281
2282 !! test
2283 <nowiki> inside <pre> (T15238)
2284 !! wikitext
2285 <pre>
2286 <nowiki>
2287 </pre>
2288 <pre>
2289 <nowiki></nowiki>
2290 </pre>
2291 <pre><nowiki><nowiki></nowiki>Foo<nowiki></nowiki></nowiki></pre>
2292 !! html
2293 <pre>
2294 &lt;nowiki&gt;
2295 </pre>
2296 <pre>
2297
2298 </pre>
2299 <pre>&lt;nowiki&gt;Foo&lt;/nowiki&gt;</pre>
2300
2301 !! end
2302
2303 !! test
2304 <nowiki> inside of #tag:pre
2305 !! wikitext
2306 {{#tag:pre|Foo <nowiki>&rarr;bar</nowiki>}}
2307 !! html/php
2308 <pre>Foo &#8594;bar</pre>
2309
2310 !! html/parsoid
2311 <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>
2312 !! end
2313
2314 !! test
2315 <nowiki> and <pre> preference (first one wins)
2316 !! wikitext
2317 <pre>
2318 <nowiki>
2319 </pre>
2320 </nowiki>
2321 </pre>
2322
2323 <nowiki>
2324 <pre>
2325 <nowiki>
2326 </pre>
2327 </nowiki>
2328 </pre>
2329
2330 !! html/php
2331 <pre>
2332 &lt;nowiki&gt;
2333 </pre>
2334 <p>&lt;/nowiki&gt;
2335 &lt;/pre&gt;
2336 </p><p>
2337 &lt;pre&gt;
2338 &lt;nowiki&gt;
2339 &lt;/pre&gt;
2340
2341 &lt;/pre&gt;
2342 </p>
2343 !! html/parsoid
2344 <pre data-parsoid='{"stx":"html","strippedNL":true}'>&lt;nowiki>
2345 </pre>
2346 <p><span typeof="mw:Placeholder" data-parsoid='{"src":"&lt;/nowiki>"}'>&lt;/nowiki></span>
2347 &lt;/pre></p>
2348
2349 <p><span typeof="mw:Nowiki">
2350 &lt;pre>
2351 &lt;nowiki>
2352 &lt;/pre>
2353 </span>
2354 &lt;/pre></p>
2355 !! end
2356
2357 !! test
2358 </pre> inside nowiki
2359 !! wikitext
2360 <nowiki></pre></nowiki>
2361 !! html
2362 <p>&lt;/pre&gt;
2363 </p>
2364 !! end
2365
2366 # Parsoid doesn't strip empty tags, like Tidy does.
2367 !! test
2368 Empty pre; pre inside other HTML tags (T56946)
2369 !! options
2370 parsoid=wt2html,wt2wt
2371 !! wikitext
2372 a
2373
2374 <div><pre>
2375 foo
2376 </pre></div>
2377 <pre></pre>
2378 !! html/php
2379 <p>a
2380 </p>
2381 <div><pre>
2382 foo
2383 </pre></div>
2384 <pre></pre>
2385
2386 !! html/php+tidy
2387 <p>a</p>
2388 <div>
2389 <pre>
2390 foo
2391 </pre></div>
2392 !! html/parsoid
2393 <p>a</p>
2394
2395 <div><pre>foo
2396 </pre></div>
2397 <pre></pre>
2398 !! end
2399
2400 !! test
2401 HTML pre followed by indent-pre
2402 !! wikitext
2403 <pre>foo</pre>
2404 bar
2405 !! html
2406 <pre>foo</pre>
2407 <pre>bar
2408 </pre>
2409 !! end
2410
2411 # Note that tidy removes the empty <p> tags from the start and end.
2412 # Parsoid does not, by design.
2413 !!test
2414 Block tag pre
2415 !! wikitext
2416 <p><pre>foo</pre></p>
2417 !! html/php+tidy
2418 <pre>
2419 foo
2420 </pre>
2421 !! html/parsoid
2422 <p data-parsoid='{"stx":"html","autoInsertedEnd":true}'></p><pre data-parsoid='{"stx":"html"}'>foo</pre><p data-parsoid='{"autoInsertedStart":true,"stx":"html"}'></p>
2423 !!end
2424
2425 !!test
2426 Templates: Indent-Pre: 1a. Templates that break a line should suppress <pre>
2427 !! wikitext
2428 {{echo|}}
2429 !! html
2430
2431 !!end
2432
2433 !!test
2434 Templates: Indent-Pre: 1b. Templates that break a line should suppress <pre>
2435 !! wikitext
2436 {{echo|
2437 foo}}
2438 !! html
2439 <p>foo
2440 </p>
2441 !!end
2442
2443 !! test
2444 Templates: Indent-Pre: 1c: Wrapping should be based on expanded content
2445 !! wikitext
2446 {{echo|a
2447 b}}
2448 !! html
2449 <pre>a
2450 </pre>
2451 <p>b
2452 </p>
2453 !!end
2454
2455 !! test
2456 Templates: Indent-Pre: 1d: Wrapping should be based on expanded content
2457 !! wikitext
2458 {{echo|a
2459 b
2460 c
2461 d
2462 e
2463 }}
2464 !! html
2465 <pre>a
2466 </pre>
2467 <p>b
2468 c
2469 </p>
2470 <pre>d
2471 </pre>
2472 <p>e
2473 </p>
2474 !!end
2475
2476 !!test
2477 Templates: Indent-Pre: 1e. Wrapping should be based on expanded content
2478 !! wikitext
2479 {{echo| foo}}
2480
2481 {{echo| foo}}{{echo| bar}}
2482
2483 {{echo| foo}}
2484 {{echo| bar}}
2485
2486 {{echo|<!--cmt--> foo}}
2487
2488 <!--cmt-->{{echo| foo}}
2489
2490 {{echo|{{echo| }}bar}}
2491 !! html
2492 <pre>foo
2493 </pre>
2494 <pre>foo bar
2495 </pre>
2496 <pre>foo
2497 bar
2498 </pre>
2499 <pre>foo
2500 </pre>
2501 <pre>foo
2502 </pre>
2503 <pre>bar
2504 </pre>
2505 !!end
2506
2507 !! test
2508 Templates: Indent-Pre: 1f: Wrapping should be based on expanded content
2509 !! wikitext
2510 {{echo| }}a
2511
2512 {{echo|
2513 }}a
2514
2515 {{echo|
2516 b}}
2517
2518 {{echo|a
2519 }}b
2520
2521 {{echo|a
2522 }} b
2523 !! html
2524 <pre>a
2525 </pre>
2526 <p><br />
2527 </p>
2528 <pre>a
2529 </pre>
2530 <p><br />
2531 </p>
2532 <pre>b
2533 </pre>
2534 <p>a
2535 </p>
2536 <pre>b
2537 </pre>
2538 <p>a
2539 </p>
2540 <pre>b
2541 </pre>
2542 !!end
2543
2544 !! test
2545 Pres with newline attributes
2546 !! wikitext
2547 <pre class="one
2548 two">hi</pre>
2549 !! html/php
2550 <pre class="one two">hi</pre>
2551
2552 !! html/parsoid
2553 <pre class="one
2554 two" data-parsoid='{"stx":"html"}'>hi</pre>
2555 !! end
2556
2557 !! test
2558 Things that look like <pre> tags aren't treated as such
2559 !! wikitext
2560 Barack Obama <President> of the United States
2561 <President></President>
2562 !! html
2563 <p>Barack Obama &lt;President&gt; of the United States
2564 &lt;President&gt;&lt;/President&gt;
2565 </p>
2566 !! end
2567
2568 !! test
2569 Handle broken pre-like tags (T66025)
2570 !! options
2571 parsoid=wt2html
2572 !! wikitext
2573 {{echo|<pre <pre>x</pre>}}
2574
2575 <table><pre </table>
2576 !! html/php
2577 <pre>x</pre>
2578 <table>&lt;pre </table>
2579
2580 !! html/php+tidy
2581 <pre>
2582 x
2583 </pre>
2584 <p>&lt;pre</p>
2585 !! html/parsoid
2586 <pre about="#mwt1" typeof="mw:Transclusion" 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>
2587
2588
2589 <p>&lt;pre </p>
2590
2591 <table></table>
2592 !! end
2593
2594 !! test
2595 Parsoid: handle pre with space after attribute
2596 !! options
2597 parsoid=wt2html
2598 !! wikitext
2599 <pre style="width:50%;" >{{echo|foo}}</pre>
2600 !! html/php
2601 <pre style="width:50%;">{{echo|foo}}</pre>
2602
2603 !! html/parsoid
2604 <pre style="width:50%;">{{echo|foo}}</pre>
2605 !! end
2606
2607 # TODO / maybe: fix wt2wt for this
2608 !! test
2609 Parsoid: Don't paragraph-wrap fosterable content
2610 !! options
2611 parsoid=wt2html
2612 !! wikitext
2613 {|
2614 <td></td>
2615 <td></td>
2616
2617
2618
2619 |}
2620 !! html
2621 <table>
2622
2623 <tbody>
2624 <tr>
2625 <td></td>
2626
2627 <td></td></tr>
2628
2629
2630
2631 </tbody></table>
2632 !! end
2633
2634 !! test
2635 Parsoid: Don't paragraph-wrap fosterable content even if table syntax is unbalanced
2636 !! options
2637 parsoid=wt2html
2638 !! wikitext
2639 {|
2640 <td>
2641 <td>
2642 </td>
2643
2644
2645
2646 |}
2647 !! html
2648 <table>
2649
2650 <tbody>
2651 <tr>
2652 <td></td>
2653
2654 <td>
2655 </td></tr>
2656
2657
2658
2659 </tbody></table>
2660 !! end
2661
2662
2663 #--------------------------------------------------------------------
2664 # Transclusion parameter whitespace stripping tests
2665 # Behavior is different for positional and named parameters
2666 #--------------------------------------------------------------------
2667 !! test
2668 Templates: Strip leading and trailing whitespace from named-param values
2669 !! wikitext
2670 {{echo|1= a }}
2671
2672 {{echo|1= {{echo|b}} }}
2673
2674 {{echo| 1 =
2675 c }}
2676
2677 {{echo| 1 =
2678 * d
2679 }}
2680 !! html
2681 <p>a
2682 </p><p>b
2683 </p><p>c
2684 </p>
2685 <ul><li> d</li></ul>
2686
2687 !! end
2688
2689 !! test
2690 Templates: Don't strip whitespace from positional-param values
2691 !! wikitext
2692 {{echo|a }}
2693
2694 {{echo|{{echo|b}} }}
2695
2696 {{echo| c
2697 }}
2698
2699 {{echo| {{echo|d}}
2700 }}
2701
2702 {{echo|
2703 e}}
2704
2705 {{echo|
2706 * f}}
2707
2708 {{echo|
2709 }}g
2710 !! html
2711 <p>a
2712 </p><p>b
2713 </p>
2714 <pre>c
2715 </pre>
2716 <p><br />
2717 </p>
2718 <pre>d
2719 </pre>
2720 <p><br />
2721 </p>
2722 <pre>e
2723 </pre>
2724 <p><br />
2725 </p>
2726 <ul><li> f</li></ul>
2727 <p><br />
2728 </p>
2729 <pre>g
2730 </pre>
2731 !! end
2732
2733 !! test
2734 Templates: Handle empty comment-and-ws-only lines correctly
2735 !! wikitext
2736 {{echo|foo
2737 <!--should be ignored-->
2738 <!--should be ignored as well-->
2739 bar}}
2740 !! html/php
2741 <p>foo
2742 bar
2743 </p>
2744 !! html/parsoid
2745 <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>
2746 !! end
2747
2748 !! test
2749 Templates: Handle comments in the target
2750 !! wikitext
2751 {{echo
2752 <!-- should be ignored -->
2753 |foo}}
2754
2755 {{echo
2756 <!-- should be ignored and spaces on next line should not trip us up (T147742) -->
2757 |foo}}
2758
2759 {{echo<!-- should be ignored -->
2760 |foo}}
2761
2762 {{echo<!-- should be ignored -->|foo}}
2763
2764 {{<!-- should be ignored -->echo|foo}}
2765 !! html/php
2766 <p>foo
2767 </p><p>foo
2768 </p><p>foo
2769 </p><p>foo
2770 </p><p>foo
2771 </p>
2772 !! html/parsoid
2773 <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>
2774
2775 <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>
2776
2777 <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>
2778
2779 <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>
2780
2781 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2782 !!end
2783
2784 !! test
2785 Templates: Handle comments in parameter names (T69657)
2786 !! wikitext
2787 {{echo|1
2788 <!-- should be ignored -->
2789 =foo}}
2790
2791 {{echo|
2792 <!-- should be ignored -->
2793 1 = foo}}
2794
2795 {{echo|1<!-- should be ignored -->=foo}}
2796
2797 {{echo|<!-- should be ignored -->1=foo}}
2798 !! html/php
2799 <p>foo
2800 </p><p>foo
2801 </p><p>foo
2802 </p><p>foo
2803 </p>
2804 !! html/parsoid
2805 <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>
2806
2807 <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>
2808
2809 <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>
2810
2811 <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>
2812 !!end
2813
2814 !! test
2815 Templates: Other wikitext in parameter names (T69657)
2816 !! wikitext
2817 {{echo|''1''=foo}}
2818 !! html/php
2819 <p>{{{1}}}
2820 </p>
2821 !! html/parsoid
2822 <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>
2823 !!end
2824
2825 #--------------------------------------------------------------------
2826 # Transclusion parameter escaping tests
2827 #--------------------------------------------------------------------
2828 !! test
2829 Templates: Parsoid parameter escaping test 1
2830 !! wikitext
2831 {{echo|[foo]|{{echo|[bar]}}}}
2832 !! html/php+tidy
2833 <p>[foo]</p>
2834 !! html/parsoid
2835 <p about="#mwt1" typeof="mw:Transclusion"
2836 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[foo]"},"2":{"wt":"{{echo|[bar]}}"}},"i":0}}]}'>[foo]</p>
2837 !! end
2838
2839 !! test
2840 Parsoid: Pipes in external links in template parameter
2841 !! wikitext
2842 {{echo|[{{echo|http://example.com}} link]}}
2843 !! html/php+tidy
2844 <p><a rel="nofollow" class="external text" href="http://example.com">link</a></p>
2845 !! html/parsoid
2846 <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>
2847 !! end
2848
2849 !! test
2850 Parsoid: pipe in transclusion parameter
2851 !! wikitext
2852 {{echo|http://foo.com/a&#124;b}}
2853 !! html/php+tidy
2854 <p><a rel="nofollow" class="external free" href="http://foo.com/a%7Cb">http://foo.com/a%7Cb</a></p>
2855 !! html/parsoid
2856 <p><a rel="mw:ExtLink" href="http://foo.com/a%7Cb" about="#mwt1"
2857 typeof="mw:Transclusion"
2858 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>
2859 !! end
2860
2861 !! test
2862 Parsoid: Pipe in external link target and content in template parameter
2863 !! options
2864 parsoid=html2wt,wt2wt
2865 !! wikitext
2866 {{echo|[http://foo.com/a&#124;b a&#124;b]}}
2867 !! html/php+tidy
2868 <p><a rel="nofollow" class="external text" href="http://foo.com/a%7Cb">a|b</a></p>
2869 !! html/parsoid
2870 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2871 typeof="mw:Transclusion"
2872 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},
2873 "params":{"1":{"wt":"[http://foo.com/a|b a|b]"}},"i":0}}]}'>a|b</a></p>
2874 !! end
2875
2876 !! test
2877 Parsoid: Pipe in template with nested template in external link target in template parameter (seriously)
2878 !! options
2879 parsoid
2880 !! wikitext
2881 {{echo|[{{fullurl:{{FULLPAGENAME}}|action=edit}} bar]}}
2882 !! html
2883 <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>
2884 !! end
2885
2886 !! test
2887 Templates: Don't escape already nowiki-escaped text in template parameters
2888 !! options
2889 parsoid=html2wt,wt2wt
2890 !! wikitext
2891 {{echo|foo<nowiki>|</nowiki>bar}}
2892 {{echo|<nowiki>&lt;div&gt;</nowiki>}}
2893 {{echo|<nowiki></nowiki>}}
2894 !! html/php+tidy
2895 <p>foo|bar &lt;div&gt;</p>
2896 !! html/parsoid
2897 <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>
2898 <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>
2899 <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>
2900 </p>
2901 !! end
2902
2903 ## T54824
2904 !! test
2905 Templates: '=' char in nested transclusions should not trigger nowiki escapes or conversion to named param
2906 !! options
2907 parsoid=html2wt,wt2wt
2908 !! wikitext
2909 {{echo|{{echo|1=bar}}}}
2910 !! html/php+tidy
2911 <p>bar</p>
2912 !! html/parsoid
2913 <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>
2914 !! end
2915
2916 ## T58733
2917 !! test
2918 Templates parameters with special tokenizing behavior dont get modified because of arg escaping
2919 !! wikitext
2920 {{echo|a : b}}
2921 !! html/php+tidy
2922 <p>a&#160;: b</p>
2923 !! html/parsoid
2924 <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>
2925 !! end
2926
2927 ## T73412
2928 !! test
2929 Templates: Preserve blank parameter names
2930 !! wikitext
2931 {{echo|=foo}}
2932 !! html/php+tidy
2933 <p>{{{1}}}</p>
2934 !! html/parsoid
2935 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"":{"wt":"foo"}},"i":0}}]}'>{{{1}}}</p>
2936 !! end
2937
2938 !! test
2939 Templates: Preserve blank parameter names in other positions
2940 !! wikitext
2941 {{blank_param|bar|=foo}}
2942 !! html/php+tidy
2943 <p>bar foo</p>
2944 !! html/parsoid
2945 <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
2946 foo</p>
2947 !! end
2948
2949 ###
2950 ### Parsoid-centric tests for testing RT edge cases for pre
2951 ###
2952
2953 !!test
2954 1a. Indent-Pre and Comments
2955 !! wikitext
2956 a
2957 <!--a-->
2958 c
2959 !! html
2960 <pre>a
2961 </pre>
2962 <p>c
2963 </p>
2964 !!end
2965
2966 !!test
2967 1b. Indent-Pre and Comments
2968 !! wikitext
2969 a
2970 <!--a-->
2971 c
2972 !! html
2973 <pre>a
2974 </pre>
2975 <p>c
2976 </p>
2977 !!end
2978
2979 !!test
2980 1c. Indent-Pre and Comments
2981 !! wikitext
2982 <!--a--> a
2983
2984 <!--a--> a
2985 !! html
2986 <pre> a
2987 </pre>
2988 <pre> a
2989 </pre>
2990 !!end
2991
2992 !!test
2993 1d. Indent-Pre and Comments
2994 (Pre-handler currently cannot distinguish between comment/ws order and normalizes them to [comment,ws] order)
2995 !! wikitext
2996 <!--a--> a
2997
2998 <!--b-->b
2999 !! html
3000 <pre>a
3001 </pre>
3002 <pre>b
3003 </pre>
3004 !!end
3005
3006 !!test
3007 2a. Indent-Pre and tables
3008 !! wikitext
3009 {|
3010 |-
3011 !h1!!h2
3012 |foo||bar
3013 |}
3014 !! html
3015 <table>
3016
3017 <tr>
3018 <th>h1</th>
3019 <th>h2
3020 </th>
3021 <td>foo</td>
3022 <td>bar
3023 </td></tr></table>
3024
3025 !!end
3026
3027 !!test
3028 2b. Indent-Pre and tables
3029 !! wikitext
3030 {|
3031 |-
3032 |foo
3033 |}
3034 !! html
3035 <table>
3036
3037 <tr>
3038 <td>foo
3039 </td></tr></table>
3040
3041 !!end
3042
3043 !!test
3044 2c. Indent-Pre and tables (T44252)
3045 !! wikitext
3046 {|
3047 |+ foo
3048 ! | bar
3049 |}
3050 !! html
3051 <table>
3052 <caption> foo
3053 </caption>
3054 <tr>
3055 <th> bar
3056 </th></tr></table>
3057
3058 !!end
3059
3060 !!test
3061 2d. Indent-Pre and tables
3062 !! wikitext
3063 a
3064 {|
3065 | b
3066 |}
3067 !! html/php
3068 <pre>a
3069 </pre>
3070 <table>
3071 <tr>
3072 <td> b
3073 </td></tr></table>
3074
3075 !! html/parsoid
3076 <pre>a</pre>
3077 <table>
3078 <tbody><tr><td> b</td></tr>
3079 </tbody></table>
3080 !!end
3081
3082 !!test
3083 2e. Indent-Pre and table-line syntax
3084 !! wikitext
3085 a
3086 | b
3087 | c
3088 !! html/php
3089 <pre>a
3090 | b
3091 | c
3092 </pre>
3093 !!end
3094
3095 !!test
3096 2f. Indent-pre started by table-line syntax
3097 !! wikitext
3098 a
3099 | b
3100 | c
3101 !! html/php
3102 <p>a
3103 </p>
3104 <pre>| b
3105 | c
3106 </pre>
3107 !! html/parsoid
3108 <p>a</p>
3109 <pre>
3110 | b
3111 | c</pre>
3112 !!end
3113
3114 !! test
3115 2g. Indented table markup mixed with indented pre content (proposed in T8200)
3116 !! wikitext
3117 <table>
3118 <tr>
3119 <td>
3120 Text that should be rendered preformatted
3121 </td>
3122 </tr>
3123 </table>
3124 !! html
3125 <table>
3126 <tr>
3127 <td>
3128 <pre>Text that should be rendered preformatted
3129 </pre>
3130 </td>
3131 </tr>
3132 </table>
3133
3134 !! end
3135
3136 !!test
3137 3a. Indent-Pre and block tags (single-line html)
3138 !! wikitext
3139 a <p> foo </p>
3140 b <div> foo </div>
3141 c <blockquote> foo </blockquote>
3142 <span> foo </span>
3143 !! html
3144 a <p> foo </p>
3145 b <div> foo </div>
3146 c <blockquote> foo </blockquote>
3147 <pre><span> foo </span>
3148 </pre>
3149 !! html/parsoid
3150 <p>a </p><p data-parsoid='{"stx":"html"}'> foo </p>
3151 <p>b </p><div data-parsoid='{"stx":"html"}'> foo </div>
3152 <p>c </p><blockquote data-parsoid='{"stx":"html"}'> foo </blockquote>
3153 <pre><span> foo </span>
3154 </pre>
3155 !! html+tidy
3156 <p>a</p>
3157 <p>foo</p>
3158 <p>b</p>
3159 <div>foo</div>
3160 <p>c</p>
3161 <blockquote>
3162 <p>foo</p>
3163 </blockquote>
3164 <pre>
3165 <span> foo </span>
3166 </pre>
3167 !! end
3168
3169 !!test
3170 3b. Indent-Pre and block tags (multi-line html)
3171 !! wikitext
3172 a <span>foo</span>
3173 b <div> foo </div>
3174 !! html
3175 <pre>a <span>foo</span>
3176 </pre>
3177 b <div> foo </div>
3178
3179 !! html/parsoid
3180 <pre>a <span data-parsoid='{"stx":"html"}'>foo</span></pre>
3181 b <div data-parsoid='{"stx":"html"}'> foo </div>
3182 !! html+tidy
3183 <pre>
3184 a <span>foo</span>
3185 </pre>
3186 <p>b</p>
3187 <div>foo</div>
3188 !!end
3189
3190 !!test
3191 3c. Indent-Pre and block tags (pre-content on separate line)
3192 !! wikitext
3193 <p>
3194 foo
3195 </p>
3196
3197 <div>
3198 foo
3199 </div>
3200
3201 <center>
3202 foo
3203 </center>
3204
3205 <blockquote>
3206 foo
3207 </blockquote>
3208
3209 <blockquote>
3210 <pre>
3211 foo
3212 </pre>
3213 </blockquote>
3214
3215 <table><tr><td>
3216 foo
3217 </td></tr></table>
3218
3219 <ul><li>
3220 foo
3221 </li></ul>
3222
3223 !! html
3224 <p>
3225 foo
3226 </p>
3227 <div>
3228 <pre>foo
3229 </pre>
3230 </div>
3231 <center>
3232 <pre>foo
3233 </pre>
3234 </center>
3235 <blockquote>
3236 <p> foo
3237 </p>
3238 </blockquote>
3239 <blockquote>
3240 <pre>
3241 foo
3242 </pre>
3243 </blockquote>
3244 <table><tr><td>
3245 <pre>foo
3246 </pre>
3247 </td></tr></table>
3248 <ul><li>
3249 foo
3250 </li></ul>
3251
3252 !!end
3253
3254 !! test
3255 4. Indent-Pre and extension tags
3256 !! wikitext
3257 a <tag />
3258 !! html/php
3259 a <pre>
3260 NULL
3261 array (
3262 )
3263 </pre>
3264
3265 !! html/parsoid
3266 a <pre typeof="mw:Extension/tag" about="#mwt2" data-parsoid='{}' data-mw='{"name":"tag","attrs":{},"body":null}'></pre>
3267 !! end
3268
3269 !!test
3270 Render paragraphs when indent-pre is suppressed in blocklevels
3271 !! wikitext
3272 <blockquote>
3273 foo
3274
3275 bar
3276 </blockquote>
3277 !! html
3278 <blockquote>
3279 <p> foo
3280 </p><p> bar
3281 </p>
3282 </blockquote>
3283
3284 !!end
3285
3286 !!test
3287 4. Multiple spaces at start-of-line
3288 !! wikitext
3289 <p> foo </p>
3290 foo
3291 {|
3292 |foo
3293 |}
3294 !! html
3295 <p> foo </p>
3296 <pre> foo
3297 </pre>
3298 <table>
3299 <tr>
3300 <td>foo
3301 </td></tr></table>
3302
3303 !!end
3304
3305 ## NOTE: the leading white-space chars on empty line are significant
3306 !! test
3307 5a. White-space in indent-pre
3308 !! wikitext
3309 a<br />
3310
3311 b
3312 !! html
3313 <pre>a<br />
3314
3315 b
3316 </pre>
3317 !! end
3318
3319 ## NOTE: the leading white-space chars on empty line are significant
3320 !! test
3321 5b. White-space in indent-pre
3322 !! wikitext
3323 a
3324
3325 b
3326
3327
3328 c
3329 !! html
3330 <pre>a
3331
3332 b
3333
3334
3335 c
3336 </pre>
3337 !! end
3338
3339 !! test
3340 5c. White-space in indent-pre
3341 !! wikitext
3342 ''a''
3343 ''b''
3344 ''c''
3345 !! html
3346 <pre><i>a</i>
3347 <i>b</i>
3348 <i>c</i>
3349 </pre>
3350 !! end
3351
3352 !! test
3353 6. Pre-blocks should extend across lines with leading WS even when there is no wrappable content
3354 !! wikitext
3355 a
3356
3357 <!-- continue -->
3358 b
3359
3360 c
3361
3362 d
3363 !! html
3364 <pre>a
3365
3366 b
3367 </pre>
3368 <pre>c
3369
3370 </pre>
3371 <p>d
3372 </p>
3373 !! end
3374
3375 !! test
3376 7a. Indent-pre and category links
3377 !! options
3378 parsoid=wt2html,wt2wt
3379 !! wikitext
3380 [[Category:foo]] <!-- No pre-wrapping -->
3381 {{echo| [[Category:foo]]}} <!-- No pre-wrapping -->
3382 !! html/php+tidy
3383 !! html/parsoid
3384 <link rel="mw:PageProp/Category" href="./Category:Foo"> <!-- No pre&#x2D;wrapping -->
3385 <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 -->
3386 !! end
3387
3388 ## We used to, but no longer wt2wt this test since the default serializer
3389 ## will normalize all categories to serialize on their own line.
3390 ## This wikitext usage is going to be fairly uncommon in production and
3391 ## selser will take care of preserving formatting in those scenarios.
3392 !! test
3393 7b. Indent-pre and category links
3394 !! options
3395 parsoid=wt2html
3396 !! wikitext
3397 [[Category:foo]] a
3398 [[Category:foo]] {{echo|b}}
3399 !! html/parsoid
3400 <pre><link rel="mw:PageProp/Category" href="./Category:Foo"> a
3401 <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>
3402 !! end
3403
3404 !! test
3405 Indent-Pre: Newlines in comments shouldn't affect sol state
3406 !! wikitext
3407 a <!--
3408 foo
3409 --> b
3410 !! html/php+tidy
3411 <p>a b</p>
3412 !! html/parsoid
3413 <p>a <!--
3414 foo
3415 --> b</p>
3416 !! end
3417
3418 ###
3419 ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
3420 ###
3421
3422 !!test
3423 HTML-pre: 1. embedded newlines
3424 !! wikitext
3425 <pre>foo</pre>
3426
3427 <pre>
3428 foo
3429 </pre>
3430
3431 <pre>
3432
3433 foo
3434 </pre>
3435
3436 <pre>
3437
3438
3439 foo
3440 </pre>
3441 !! html/php+tidy
3442 <pre>
3443 foo
3444 </pre>
3445 <pre>
3446 foo
3447 </pre>
3448 <pre>
3449
3450 foo
3451 </pre>
3452 <pre>
3453
3454
3455 foo
3456 </pre>
3457 !! html/parsoid
3458 <pre data-parsoid='{"stx":"html"}'>foo</pre>
3459
3460 <pre data-parsoid='{"stx":"html","strippedNL":"\n"}'>
3461 foo
3462 </pre>
3463
3464 <pre data-parsoid='{"stx":"html"}'>
3465
3466 foo
3467 </pre>
3468
3469 <pre data-parsoid='{"stx":"html"}'>
3470
3471
3472 foo
3473 </pre>
3474 !!end
3475
3476 !! test
3477 HTML-pre: big spaces
3478 !! wikitext
3479 <pre>
3480
3481
3482
3483
3484 haha
3485
3486
3487
3488
3489 haha
3490
3491
3492
3493
3494 </pre>
3495 !! html/php+tidy
3496 <pre>
3497
3498
3499
3500
3501 haha
3502
3503
3504
3505
3506 haha
3507
3508
3509
3510
3511 </pre>
3512 !! html/parsoid
3513 <pre data-parsoid='{"stx":"html"}'>
3514
3515
3516
3517
3518 haha
3519
3520
3521
3522
3523 haha
3524
3525
3526
3527
3528 </pre>
3529 !! end
3530
3531 !!test
3532 HTML-pre: 2: indented text
3533 !! wikitext
3534 <pre>
3535 foo
3536 </pre>
3537 !! html
3538 <pre>
3539 foo
3540 </pre>
3541
3542 !!end
3543
3544 !!test
3545 HTML-pre: 3: other wikitext
3546 !! wikitext
3547 <pre>
3548 * foo
3549 # bar
3550 = no-h =
3551 '' no-italic ''
3552 [[ NoLink ]]
3553 </pre>
3554 !! html/php
3555 <pre>
3556 * foo
3557 # bar
3558 = no-h =
3559 '' no-italic ''
3560 [[ NoLink ]]
3561 </pre>
3562
3563 !! html/parsoid
3564 <pre data-parsoid='{"stx":"html","strippedNL":true}'>* foo
3565 # bar
3566 = no-h =
3567 '' no-italic ''
3568 [[ NoLink ]]
3569 </pre>
3570 !!end
3571
3572 ###
3573 ### Definition lists
3574 ###
3575 !! test
3576 Simple definition
3577 !! wikitext
3578 ; name : Definition
3579 !! html
3580 <dl><dt> name&#160;</dt>
3581 <dd> Definition</dd></dl>
3582
3583 !! end
3584
3585 !! test
3586 Definition list for indentation only
3587 !! wikitext
3588 : Indented text
3589 !! html
3590 <dl><dd> Indented text</dd></dl>
3591
3592 !! end
3593
3594 !! test
3595 Definition list with no space
3596 !! wikitext
3597 ;name:Definition
3598 !! html
3599 <dl><dt>name</dt>
3600 <dd>Definition</dd></dl>
3601
3602 !!end
3603
3604 !! test
3605 Definition list with URL link
3606 !! wikitext
3607 ; http://example.com/ : definition
3608 !! html
3609 <dl><dt> <a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&#160;</dt>
3610 <dd> definition</dd></dl>
3611
3612 !! end
3613
3614 !! test
3615 Definition list with bracketed URL link
3616 !! wikitext
3617 ;[http://www.example.com/ Example]:Something about it
3618 !! html
3619 <dl><dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt>
3620 <dd>Something about it</dd></dl>
3621
3622 !! end
3623
3624 !! test
3625 Definition list with wikilink containing colon
3626 !! wikitext
3627 ; [[Help:FAQ]]: The least-read page on Wikipedia
3628 !! html
3629 <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>
3630 <dd> The least-read page on Wikipedia</dd></dl>
3631
3632 !! end
3633
3634 # At Brion's and JeLuF's insistence... :)
3635 !! test
3636 Definition list with news link containing colon
3637 !! wikitext
3638 ; news:alt.wikipedia.rox: This isn't even a real newsgroup!
3639 !! html/php
3640 <dl><dt> <a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a></dt>
3641 <dd> This isn't even a real newsgroup!</dd></dl>
3642
3643 !! html/parsoid
3644 <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>
3645 !! end
3646
3647 !! test
3648 Malformed definition list with colon
3649 !! wikitext
3650 ; news:alt.wikipedia.rox -- don't crash or enter an infinite loop
3651 !! html
3652 <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>
3653
3654 !! end
3655
3656 !! test
3657 Definition lists: colon in external link text
3658 !! wikitext
3659 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
3660 !! html
3661 <dl><dt> <a rel="nofollow" class="external text" href="http://www.wikipedia2.org/">Wikipedia&#160;: The Next Generation</a></dt>
3662 <dd> OK, I made that up</dd></dl>
3663
3664 !! end
3665
3666 !! test
3667 Definition lists: colon in HTML attribute
3668 !! wikitext
3669 ;<b style="display: inline">bold</b>
3670 !! html
3671 <dl><dt><b style="display: inline">bold</b></dt></dl>
3672
3673 !! end
3674
3675 !! test
3676 Definition lists: self-closed tag
3677 !! wikitext
3678 ;one<br/>two : two-line fun
3679 !! html
3680 <dl><dt>one<br />two&#160;</dt>
3681 <dd> two-line fun</dd></dl>
3682
3683 !! end
3684
3685 !! test
3686 Definition lists: ignore colons inside tags
3687 !! wikitext
3688 ;one <b>two : tag <i>fun:</i>:</b>: def
3689 !! html
3690 <dl><dt>one <b>two&#160;: tag <i>fun:</i>:</b></dt>
3691 <dd> def</dd></dl>
3692
3693 !! end
3694
3695 !! test
3696 Definition lists: excess closed tags
3697 !! wikitext
3698 ;one</b>two : bad tag fun
3699 !! html/php+tidy
3700 <dl>
3701 <dt>onetwo&#160;</dt>
3702 <dd>bad tag fun</dd>
3703 </dl>
3704 !! html/parsoid
3705 <dl>
3706 <dt>onetwo</dt>
3707 <dd>bad tag fun</dd>
3708 </dl>
3709 !! end
3710
3711 !! test
3712 T13748: Literal closing tags
3713 !! wikitext
3714 <dl>
3715 <dt>test 1</dt>
3716 <dd>test test test test test</dd>
3717 <dt>test 2</dt>
3718 <dd>test test test test test</dd>
3719 </dl>
3720 !! html
3721 <dl>
3722 <dt>test 1</dt>
3723 <dd>test test test test test</dd>
3724 <dt>test 2</dt>
3725 <dd>test test test test test</dd>
3726 </dl>
3727
3728 !! end
3729
3730 !! test
3731 Definition and unordered list using wiki syntax nested in unordered list using html tags.
3732 !! wikitext
3733 <ul><li>
3734 ; term : description
3735 * unordered
3736 </li></ul>
3737 !! html
3738 <ul><li>
3739 <dl><dt> term&#160;</dt>
3740 <dd> description</dd></dl>
3741 <ul><li> unordered</li></ul>
3742 </li></ul>
3743
3744 !! end
3745
3746 !! test
3747 Definition list with empty definition and following paragraph
3748 !! wikitext
3749 ; term:
3750 Paragraph text
3751 !! html
3752 <dl><dt> term</dt>
3753 <dd></dd></dl>
3754 <p>Paragraph text
3755 </p>
3756 !! end
3757
3758 !! test
3759 Nested definition lists using html syntax
3760 !! wikitext
3761 <dl><dt>x</dt>
3762 <dd>a</dd>
3763 <dd>b</dd></dl>
3764 !! html
3765 <dl><dt>x</dt>
3766 <dd>a</dd>
3767 <dd>b</dd></dl>
3768
3769 !! end
3770
3771 !! test
3772 Definition Lists: No nesting: Multiple dd's
3773 !! wikitext
3774 ;x
3775 :a
3776 :b
3777 !! html
3778 <dl><dt>x</dt>
3779 <dd>a</dd>
3780 <dd>b</dd></dl>
3781
3782 !! end
3783
3784 !! test
3785 Definition Lists: Indentation: Regular
3786 !! wikitext
3787 :i1
3788 ::i2
3789 :::i3
3790 !! html
3791 <dl><dd>i1
3792 <dl><dd>i2
3793 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3794
3795 !! end
3796
3797 !! test
3798 Definition Lists: Indentation: Missing 1st level
3799 !! wikitext
3800 ::i2
3801 :::i3
3802 !! html
3803 <dl><dd><dl><dd>i2
3804 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3805
3806 !! end
3807
3808 !! test
3809 Definition Lists: Indentation: Multi-level indent
3810 !! wikitext
3811 :::i3
3812 !! html
3813 <dl><dd><dl><dd><dl><dd>i3</dd></dl></dd></dl></dd></dl>
3814
3815 !! end
3816
3817 !! test
3818 Definition Lists: Hacky use to indent tables
3819 !! wikitext
3820 ::{|
3821 |foo
3822 |bar
3823 |}
3824 this text
3825 should be left alone
3826 !! html
3827 <dl><dd><dl><dd><table>
3828 <tr>
3829 <td>foo
3830 </td>
3831 <td>bar
3832 </td></tr></table></dd></dl></dd></dl>
3833 <p>this text
3834 should be left alone
3835 </p>
3836 !! end
3837
3838 !! test
3839 Definition Lists: Hacky use to indent tables, with comments (T65979)
3840 !! wikitext
3841 <!-- foo -->
3842 ::{|
3843 |foo
3844 |bar
3845 |}<!-- bar -->
3846 this text
3847 should be left alone
3848 !! html/parsoid
3849 <!-- foo -->
3850 <dl><dd><dl><dd><table><tr>
3851 <td>foo</td>
3852 <td>bar</td>
3853 </tr></table><!-- bar --></dd></dl></dd></dl>
3854 <p>this text
3855 should be left alone</p>
3856 !! end
3857
3858 !! test
3859 Definition Lists: Hacky use to indent tables, with comment before table
3860 !! wikitext
3861 ::<!-- foo -->{|
3862 |foo
3863 |}
3864 !! html/parsoid
3865 <dl><dd><dl><dd><!-- foo --><table><tr>
3866 <td>foo</td>
3867 </tr></table></dd></dl></dd></dl>
3868 !! end
3869
3870 # The trailing whitespace in this test is to catch a regression in
3871 # Parsoid after T54473.
3872 !! test
3873 Definition Lists: Hacky use to indent tables (WS-insensitive)
3874 !! wikitext
3875 : {|
3876 |a
3877 |}
3878 !! html/php
3879 <dl><dd><table>
3880 <tr>
3881 <td>a
3882 </td></tr></table></dd></dl>
3883
3884 !! html/parsoid
3885 <dl><dd> <table>
3886 <tbody><tr><td>a</td></tr>
3887 </tbody></table> </dd></dl>
3888 !! end
3889
3890 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
3891 ## as an empty dt item. It also ignores all but the last ";" when followed
3892 ## by ":" later on. So, ";" are not ignored in ";;;t3" but are ignored in
3893 ## ";;;t3 :d1". So, PHP parser behavior is a little inconsistent wrt multiple
3894 ## ";"s.
3895 ##
3896 ## Ex: ";;t2 ::d2" is transformed into:
3897 ##
3898 ## <dl>
3899 ## <dt>t2 </dt>
3900 ## <dd>
3901 ## <dl>
3902 ## <dt></dt>
3903 ## <dd>d2</dd>
3904 ## </dl>
3905 ## </dd>
3906 ## </dl>
3907 ##
3908 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
3909 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
3910 ##
3911 ## <dl>
3912 ## <dt>
3913 ## <dl>
3914 ## <dt>t2 </dt>
3915 ## <dd>:d2</dd>
3916 ## </dl>
3917 ## </dt>
3918 ## </dl>
3919 ##
3920 ## All Parsoid only definition list tests have this difference.
3921 ##
3922 ## See also: https://phabricator.wikimedia.org/T8569
3923 ## and https://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
3924
3925 !! test
3926 Table / list interaction: indented table with lists in table contents
3927 !! wikitext
3928 :{|
3929 |-
3930 | a
3931 * b
3932 |-
3933 | c
3934 * d
3935 |}
3936 !! html
3937 <dl><dd><table>
3938
3939 <tr>
3940 <td> a
3941 <ul><li> b</li></ul>
3942 </td></tr>
3943 <tr>
3944 <td> c
3945 <ul><li> d</li></ul>
3946 </td></tr></table></dd></dl>
3947
3948 !! end
3949
3950 !!test
3951 Table / list interaction: lists nested in tables nested in indented lists
3952 !! wikitext
3953 :{|
3954 |
3955 :a
3956 :b
3957 |
3958 *c
3959 *d
3960 |}
3961
3962 *e
3963 *f
3964 !! html
3965 <dl><dd><table>
3966 <tr>
3967 <td>
3968 <dl><dd>a</dd>
3969 <dd>b</dd></dl>
3970 </td>
3971 <td>
3972 <ul><li>c</li>
3973 <li>d</li></ul>
3974 </td></tr></table></dd></dl>
3975 <ul><li>e</li>
3976 <li>f</li></ul>
3977
3978 !!end
3979
3980 !! test
3981 Definition Lists: Nesting: Multi-level (Parsoid only)
3982 !! options
3983 parsoid
3984 !! wikitext
3985 ;t1 :d1
3986 ;;t2 ::d2
3987 ;;;t3 :::d3
3988 !! html
3989 <dl>
3990 <dt>t1 </dt>
3991 <dd>d1</dd>
3992 <dt>
3993 <dl>
3994 <dt>t2 </dt>
3995 <dd>:d2</dd>
3996 <dt>
3997 <dl>
3998 <dt>t3 </dt>
3999 <dd>::d3</dd>
4000 </dl>
4001 </dt>
4002 </dl>
4003 </dt>
4004 </dl>
4005
4006
4007 !! end
4008
4009
4010 !! test
4011 Definition Lists: Nesting: Test 2 (Parsoid only)
4012 !! wikitext
4013 ;t1
4014 ::d2
4015 !! html/php+tidy
4016 <dl>
4017 <dt>t1</dt>
4018 <dd>
4019 <dl>
4020 <dd>d2</dd>
4021 </dl>
4022 </dd>
4023 </dl>
4024 !! html/parsoid
4025 <dl>
4026 <dt>t1</dt>
4027 <dd>
4028 <dl>
4029 <dd>d2</dd>
4030 </dl>
4031 </dd>
4032 </dl>
4033
4034 !! end
4035
4036
4037 !! test
4038 Definition Lists: Nesting: Test 3 (Parsoid only)
4039 !! wikitext
4040 :;t1
4041 ::::d2
4042 !! html/php+tidy
4043 <dl>
4044 <dd>
4045 <dl>
4046 <dt>t1</dt>
4047 <dd>
4048 <dl>
4049 <dd>
4050 <dl>
4051 <dd>d2</dd>
4052 </dl>
4053 </dd>
4054 </dl>
4055 </dd>
4056 </dl>
4057 </dd>
4058 </dl>
4059 !! html/parsoid
4060 <dl>
4061 <dd>
4062 <dl>
4063 <dt>t1</dt>
4064 <dd>
4065 <dl>
4066 <dd>
4067 <dl>
4068 <dd>d2</dd>
4069 </dl>
4070 </dd>
4071 </dl>
4072 </dd>
4073 </dl>
4074 </dd>
4075 </dl>
4076
4077 !! end
4078
4079
4080 !! test
4081 Definition Lists: Nesting: Test 4
4082 !! wikitext
4083 ::;t3
4084 :::d3
4085 !! html
4086 <dl><dd><dl><dd><dl><dt>t3</dt>
4087 <dd>d3</dd></dl></dd></dl></dd></dl>
4088
4089 !! end
4090
4091
4092 ## The Parsoid team believes the following three test exposes a
4093 ## bug in the PHP parser. (Parsoid team thinks the PHP parser is
4094 ## wrong to close the <dl> after the <dt> containing the <ul>.)
4095 ## It also exposes a "misfeature" in tidy, which doesn't like
4096 ## <dl> tags with a single <dt> child; it converts the <dt> into
4097 ## a <dd> in that case. (Parsoid leaves the <dt> alone!)
4098 !! test
4099 Definition Lists: Mixed Lists: Test 1
4100 !! wikitext
4101 :;* foo
4102 ::* bar
4103 :; baz
4104 !! html/php
4105 <dl><dd><dl><dt><ul><li> foo</li>
4106 <li> bar</li></ul></dt></dl>
4107 <dl><dt> baz</dt></dl></dd></dl>
4108
4109 !! html/php+tidy
4110 <dl>
4111 <dd>
4112 <dl>
4113 <dd>
4114 <ul>
4115 <li>foo</li>
4116 <li>bar</li>
4117 </ul>
4118 </dd>
4119 </dl>
4120 <dl>
4121 <dt>baz</dt>
4122 </dl>
4123 </dd>
4124 </dl>
4125 !! html/parsoid
4126 <dl>
4127 <dd><dl>
4128 <dt><ul>
4129 <li> foo
4130 </li>
4131 </ul></dt>
4132 <dd><ul>
4133 <li> bar
4134 </li>
4135 </ul></dd>
4136 <dt> baz</dt>
4137 </dl></dd>
4138 </dl>
4139 !! end
4140
4141 !! test
4142 Definition Lists: Mixed Lists: Test 2
4143 !! wikitext
4144 *: d1
4145 *: d2
4146 !! html
4147 <ul><li><dl><dd> d1</dd>
4148 <dd> d2</dd></dl></li></ul>
4149
4150 !! end
4151
4152
4153 !! test
4154 Definition Lists: Mixed Lists: Test 3
4155 !! wikitext
4156 *::: d1
4157 *::: d2
4158 !! html
4159 <ul><li><dl><dd><dl><dd><dl><dd> d1</dd>
4160 <dd> d2</dd></dl></dd></dl></dd></dl></li></ul>
4161
4162 !! end
4163
4164
4165 !! test
4166 Definition Lists: Mixed Lists: Test 4
4167 !! wikitext
4168 *;d1 :d2
4169 *;d3 :d4
4170 !! html
4171 <ul><li><dl><dt>d1&#160;</dt>
4172 <dd>d2</dd>
4173 <dt>d3&#160;</dt>
4174 <dd>d4</dd></dl></li></ul>
4175
4176 !! end
4177
4178
4179 !! test
4180 Definition Lists: Mixed Lists: Test 5
4181 !! wikitext
4182 *:d1
4183 *:: d2
4184 !! html
4185 <ul><li><dl><dd>d1
4186 <dl><dd> d2</dd></dl></dd></dl></li></ul>
4187
4188 !! end
4189
4190
4191 !! test
4192 Definition Lists: Mixed Lists: Test 6
4193 !! wikitext
4194 #*:d1
4195 #*::: d3
4196 !! html
4197 <ol><li><ul><li><dl><dd>d1
4198 <dl><dd><dl><dd> d3</dd></dl></dd></dl></dd></dl></li></ul></li></ol>
4199
4200 !! end
4201
4202
4203 !! test
4204 Definition Lists: Mixed Lists: Test 7
4205 !! wikitext
4206 :* d1
4207 :* d2
4208 !! html
4209 <dl><dd><ul><li> d1</li>
4210 <li> d2</li></ul></dd></dl>
4211
4212 !! end
4213
4214
4215 !! test
4216 Definition Lists: Mixed Lists: Test 8
4217 !! wikitext
4218 :* d1
4219 ::* d2
4220 !! html
4221 <dl><dd><ul><li> d1</li></ul>
4222 <dl><dd><ul><li> d2</li></ul></dd></dl></dd></dl>
4223
4224 !! end
4225
4226
4227 !! test
4228 Definition Lists: Mixed Lists: Test 9
4229 !! wikitext
4230 *;foo :bar
4231 !! html
4232 <ul><li><dl><dt>foo&#160;</dt>
4233 <dd>bar</dd></dl></li></ul>
4234
4235 !! end
4236
4237
4238 !! test
4239 Definition Lists: Mixed Lists: Test 10
4240 !! wikitext
4241 *#;foo :bar
4242 !! html
4243 <ul><li><ol><li><dl><dt>foo&#160;</dt>
4244 <dd>bar</dd></dl></li></ol></li></ul>
4245
4246 !! end
4247
4248 # The Parsoid team disagrees with the PHP parser's seemingly-random
4249 # rules regarding dd/dt on the next two tests. Parsoid is more
4250 # consistent, and recognizes the shared nesting and keeps the
4251 # still-open tags around until the nesting is complete.
4252 # (And tidy again converts <dt> to <dd> before 'bar'.)
4253
4254 !! test
4255 Definition Lists: Mixed Lists: Test 11
4256 !! wikitext
4257 *#*#;*;;foo :bar
4258 *#*#;boo :baz
4259 !! html/php
4260 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt>
4261 <dd><ul><li><dl><dt><dl><dt>bar</dt></dl></dd></dl></li></ul></dd></dl>
4262 <dl><dt>boo&#160;</dt>
4263 <dd>baz</dd></dl></li></ol></li></ul></li></ol></li></ul>
4264
4265 !! html/php+tidy
4266 <ul>
4267 <li>
4268 <ol>
4269 <li>
4270 <ul>
4271 <li>
4272 <ol>
4273 <li>
4274 <dl>
4275 <dt>foo&#160;</dt>
4276 <dd>
4277 <ul>
4278 <li>
4279 <dl>
4280 <dd>
4281 <dl>
4282 <dt>bar</dt>
4283 </dl>
4284 </dd>
4285 </dl>
4286 </li>
4287 </ul>
4288 </dd>
4289 </dl>
4290 <dl>
4291 <dt>boo&#160;</dt>
4292 <dd>baz</dd>
4293 </dl>
4294 </li>
4295 </ol>
4296 </li>
4297 </ul>
4298 </li>
4299 </ol>
4300 </li>
4301 </ul>
4302 !! html/parsoid
4303 <ul>
4304 <li>
4305 <ol>
4306 <li>
4307 <ul>
4308 <li>
4309 <ol>
4310 <li>
4311 <dl>
4312 <dt>
4313 <ul>
4314 <li>
4315 <dl>
4316 <dt>
4317 <dl>
4318 <dt>foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
4319 <dd data-parsoid='{"stx":"row"}'>bar</dd>
4320 </dl></dt>
4321 </dl></li>
4322 </ul></dt>
4323 <dt>boo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
4324 <dd data-parsoid='{"stx":"row"}'>baz</dd>
4325 </dl></li>
4326 </ol></li>
4327 </ul></li>
4328 </ol></li>
4329 </ul>
4330 !! end
4331
4332
4333 # Another case where tidy converts a <dt> to a <dd> (but Parsoid doesn't).
4334 # From whitelist:
4335 # * The test is wrong, there are two colons where there should be :;
4336 # * The PHP parser is wrong to close the <dl> after the <dt> containing the <ul>.
4337 !! test
4338 Definition Lists: Weird Ones: Test 1
4339 !! wikitext
4340 *#;*::;; foo : bar (who uses this?)
4341 !! html/php
4342 <ul><li><ol><li><dl><dt> foo&#160;</dt>
4343 <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>
4344
4345 !! html/php+tidy
4346 <ul>
4347 <li>
4348 <ol>
4349 <li>
4350 <dl>
4351 <dt>foo&#160;</dt>
4352 <dd>
4353 <ul>
4354 <li>
4355 <dl>
4356 <dd>
4357 <dl>
4358 <dd>
4359 <dl>
4360 <dd>
4361 <dl>
4362 <dt>bar (who uses this?)</dt>
4363 </dl>
4364 </dd>
4365 </dl>
4366 </dd>
4367 </dl>
4368 </dd>
4369 </dl>
4370 </li>
4371 </ul>
4372 </dd>
4373 </dl>
4374 </li>
4375 </ol>
4376 </li>
4377 </ul>
4378 !! html/parsoid
4379 <ul>
4380 <li>
4381 <ol>
4382 <li>
4383 <dl>
4384 <dt>
4385 <ul>
4386 <li>
4387 <dl>
4388 <dd>
4389 <dl>
4390 <dd>
4391 <dl>
4392 <dt>
4393 <dl>
4394 <dt> foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span></dt>
4395 <dd data-parsoid='{"stx":"row"}'> bar (who uses this?)</dd>
4396 </dl></dt>
4397 </dl></dd>
4398 </dl></dd>
4399 </dl></li>
4400 </ul></dt>
4401 </dl></li>
4402 </ol></li>
4403 </ul>
4404 !! end
4405
4406 !! test
4407 Definition Lists: colons occurring in tags
4408 !! wikitext
4409 ;a:b
4410 ;'''a:b'''
4411 ;<i>a:b</i>
4412 ;<span>a:b</span>
4413 ;<div>a:b</div>
4414 ;<div>a
4415 :b</div>
4416 ;{{echo|a:b}}
4417 ;{{echo|''a:b''}}
4418 ;;;''a:b''
4419 !! html+tidy
4420 <dl>
4421 <dt>a</dt>
4422 <dd>b</dd>
4423 <dt><b>a:b</b></dt>
4424 <dt><i>a:b</i></dt>
4425 <dt><span>a:b</span></dt>
4426 <dd>
4427 <div>a:b</div>
4428 </dd>
4429 <dd>
4430 <div>a
4431 <dl>
4432 <dd>b</dd>
4433 </dl>
4434 </div>
4435 </dd>
4436 <dt>a</dt>
4437 <dd>b</dd>
4438 <dt><i>a:b</i></dt>
4439 </dl>
4440 <dl>
4441 <dd>
4442 <dl>
4443 <dd>
4444 <dl>
4445 <dt><i>a:b</i></dt>
4446 </dl>
4447 </dd>
4448 </dl>
4449 </dd>
4450 </dl>
4451 !! html/parsoid
4452 <dl><dt>a</dt><dd data-parsoid='{"stx":"row"}'>b</dd>
4453 <dt><b>a:b</b></dt>
4454 <dt><i data-parsoid='{"stx":"html"}'>a:b</i></dt>
4455 <dt><span data-parsoid='{"stx":"html"}'>a:b</span></dt>
4456 <dt><div data-parsoid='{"stx":"html"}'>a:b</div></dt>
4457 <dt><div data-parsoid='{"stx":"html","autoInsertedEnd":true}'>a</div></dt>
4458 <dd>b</dd>
4459 <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>
4460 <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>
4461 <dl><dt><dl><dt><i>a:b</i></dt></dl></dt></dl></dt></dl>
4462 !! end
4463
4464 !! test
4465 Definition Lists: colons and tables 1
4466 !! wikitext
4467 :{|
4468 | x
4469 |}
4470 :{|
4471 | y
4472 |}
4473 !! html
4474 <dl><dd><table>
4475 <tr>
4476 <td> x
4477 </td></tr></table></dd></dl>
4478 <dl><dd><table>
4479 <tr>
4480 <td> y
4481 </td></tr></table></dd></dl>
4482
4483 !! end
4484
4485 # Parsoid's output (as documented below) differs from php's in this case.
4486 # This is probably a bug. If we fixup parsoid to match php's output, the
4487 # above test should pass and the below test case can be removed. It is
4488 # unclear which output is more desirable.
4489
4490 !! test
4491 Definition Lists: colons and tables 2
4492 !! wikitext
4493 :{|
4494 | x
4495 |}
4496 :{|
4497 | y
4498 |}
4499 !! html/parsoid
4500 <dl><dd><table>
4501 <tr>
4502 <td> x
4503 </td></tr></table></dd>
4504 <dd><table>
4505 <tr>
4506 <td> y
4507 </td></tr></table></dd></dl>
4508 !! end
4509
4510 !! test
4511 Definition Lists: template interaction
4512 !! wikitext
4513 ::{{definition_list}}
4514
4515 :one
4516 ::{{definition_list}}
4517 :::two
4518 :::three
4519 ::four
4520 !! html/parsoid
4521 <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">
4522 </span><dd about="#mwt1">two</dd></dl></dd></dl>
4523
4524 <dl><dd data-parsoid='{}'>one
4525 <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">
4526 </span><dd about="#mwt2">two
4527 <dl><dd>two</dd>
4528 <dd>three</dd></dl></dd>
4529 <dd data-parsoid='{}'>four</dd></dl></dd></dl>
4530 !! end
4531
4532
4533 ###
4534 ### External links
4535 ###
4536 !! test
4537 External links: non-bracketed
4538 !! wikitext
4539 Non-bracketed: http://example.com
4540 !! html
4541 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4542 </p>
4543 !! end
4544
4545 # parsoid doesn't explicitly mark autonumbered links, see T55505
4546 !! test
4547 External links: numbered
4548 !! wikitext
4549 Numbered: [http://example.com]
4550 Numbered: [http://example.net]
4551 Numbered: [http://example.com]
4552 !! html/php
4553 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
4554 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
4555 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
4556 </p>
4557 !! html/parsoid
4558 <p>Numbered: <a rel="mw:ExtLink" href="http://example.com"></a>
4559 Numbered: <a rel="mw:ExtLink" href="http://example.net"></a>
4560 Numbered: <a rel="mw:ExtLink" href="http://example.com"></a></p>
4561 !!end
4562
4563 !! test
4564 External links: specified text
4565 !! wikitext
4566 Specified text: [http://example.com link]
4567 !! html
4568 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
4569 </p>
4570 !!end
4571
4572 !! test
4573 External links: trail
4574 !! wikitext
4575 Linktrails should not work for external links: [http://example.com link]s
4576 !! html
4577 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
4578 </p>
4579 !! end
4580
4581 !! test
4582 External links: dollar sign in URL
4583 !! wikitext
4584 http://example.com/1$2345
4585 !! html
4586 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
4587 </p>
4588 !! end
4589
4590 # parsoid doesn't explicitly mark autonumbered links, see T55505
4591 !! test
4592 External links: dollar sign in URL (autonumber)
4593 !! wikitext
4594 [http://example.com/1$2345]
4595 !! html/php
4596 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
4597 </p>
4598 !! html/parsoid
4599 <p><a rel="mw:ExtLink" href="http://example.com/1$2345"></a></p>
4600 !!end
4601
4602 !! test
4603 External links: open square bracket forbidden in URL (T6377)
4604 !! options
4605 parsoid=wt2html,wt2wt,html2html
4606 !! wikitext
4607 http://example.com/1[2345
4608 !! html/php
4609 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
4610 </p>
4611 !! html/parsoid
4612 <p><a rel="mw:ExtLink" href="http://example.com/1">http://example.com/1</a>[2345</p>
4613 !! end
4614
4615 !! test
4616 External links: open square bracket forbidden in URL (named) (T6377)
4617 !! options
4618 parsoid=wt2html,html2html
4619 !! wikitext
4620 [http://example.com/1[2345]
4621 !! html/php
4622 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4623 </p>
4624 !! html/parsoid
4625 <p><a rel="mw:ExtLink" href="http://example.com/1">[2345</a></p>
4626 !!end
4627
4628 # parsoid adds a space before the link name
4629 !! test
4630 External links: open square bracket forbidden in URL (named) (T6377)
4631 Parsoid variant.
4632 !! wikitext
4633 [http://example.com/1 [2345]
4634 !! html
4635 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4636 </p>
4637 !!end
4638
4639 !! test
4640 External links: nowiki in URL link text (T8230)
4641 !! wikitext
4642 [http://example.com/ <nowiki>''example site''</nowiki>]
4643 !! html
4644 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
4645 </p>
4646 !! end
4647
4648 !! test
4649 External links: newline forbidden in text (T8230 regression check)
4650 !! wikitext
4651 [http://example.com/ first
4652 second]
4653 !! html
4654 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
4655 second]
4656 </p>
4657 !!end
4658
4659 !! test
4660 External links: Pipe char between url and text
4661 !! wikitext
4662 [http://example.com | link]
4663 !! html
4664 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
4665 </p>
4666 !!end
4667
4668 !! test
4669 External links: protocol-relative URL in brackets
4670 !! wikitext
4671 [//example.com/ Test]
4672 !! html
4673 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
4674 </p>
4675 !! end
4676
4677 # parsoid doesn't explicitly mark autonumbered links, see T55505
4678 !! test
4679 External links: protocol-relative URL in brackets without text
4680 !! wikitext
4681 [//example.com]
4682 !! html/php
4683 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
4684 </p>
4685 !! html/parsoid
4686 <p><a rel="mw:ExtLink" href="//example.com"></a></p>
4687 !! end
4688
4689 !! test
4690 External links: protocol-relative URL in free text is left alone
4691 !! wikitext
4692 //example.com/Foo
4693 !! html
4694 <p>//example.com/Foo
4695 </p>
4696 !!end
4697
4698 !! test
4699 External links: protocol-relative URL in the middle of a word is left alone (T32269)
4700 !! wikitext
4701 foo//example.com/Foo
4702 !! html
4703 <p>foo//example.com/Foo
4704 </p>
4705 !! end
4706
4707 !! test
4708 External links: with no contents
4709 !! wikitext
4710 [http://en.wikipedia.org/wiki/Foo]
4711
4712 [[wikipedia:Foo|Bar]]
4713
4714 [[wikipedia:Foo|<span>Bar</span>]]
4715 !! html/php
4716 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/wiki/Foo">[1]</a>
4717 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
4718 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo"><span>Bar</span></a>
4719 </p>
4720 !! html/parsoid
4721 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo"></a></p>
4722 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo">Bar</a></p>
4723 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo"><span>Bar</span></a></p>
4724 !! end
4725
4726 !! test
4727 External links: Free with trailing punctuation
4728 !! wikitext
4729 http://example.com,
4730 http://example.com;
4731 http://example.com\
4732 http://example.com.
4733 http://example.com:
4734 http://example.com!
4735 http://example.com?
4736 http://example.com)
4737 http://example.com/url_with_(brackets)
4738 (http://example.com/url_without_brackets)
4739 http://example.com/url_with_entity&amp;
4740 http://example.com/url_with_entity&#x26;
4741 http://example.com/url_with_entity&#038;
4742 http://example.com/url_with_entity&nbsp;
4743 http://example.com/url_with_entity&#xA0;
4744 http://example.com/url_with_entity&#160;
4745 http://example.com/url_with_entity&lt;
4746 http://example.com/url_with_entity&#x3C;
4747 http://example.com/url_with_entity&#60;
4748 !! html/php
4749 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
4750 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>;
4751 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>\
4752 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.
4753 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
4754 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>!
4755 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>?
4756 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
4757 <a rel="nofollow" class="external free" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
4758 (<a rel="nofollow" class="external free" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
4759 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4760 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4761 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4762 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#160;
4763 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#xa0;
4764 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#160;
4765 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&lt;
4766 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#x3c;
4767 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#60;
4768 </p>
4769 !! html/parsoid
4770 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>,
4771 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>;
4772 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>\
4773 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>.
4774 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:
4775 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>!
4776 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>?
4777 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)
4778 <a rel="mw:ExtLink" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
4779 (<a rel="mw:ExtLink" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
4780 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4781 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4782 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4783 <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>
4784 <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>
4785 <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>
4786 <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>
4787 <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>
4788 <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>
4789 !! end
4790
4791 !! test
4792 External links: tricky Parsoid html2html case
4793 !! options
4794 parsoid=wt2html,wt2wt,html2html
4795 !! wikitext
4796 http://example.com/url_with_entity&amp;amp;
4797 !! html/php
4798 <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>;
4799 </p>
4800 !! html/parsoid
4801 <p><a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;amp">http://example.com/url_with_entity&amp;amp</a>;</p>
4802 !! end
4803
4804 !! test
4805 External links: Free with trailing quotes (T113666)
4806 !! wikitext
4807 '''News:''' Stuff here
4808
4809 news:'a'b''c''d e
4810 !! html/php
4811 <p><b>News:</b> Stuff here
4812 </p><p><a rel="nofollow" class="external free" href="news:'a'b">news:'a'b</a><i>c</i>d e
4813 </p>
4814 !! html/parsoid
4815 <p><b>News:</b> Stuff here</p>
4816 <p><a rel="mw:ExtLink" href="news:'a'b">news:'a'b</a><i>c</i>d e</p>
4817 !! end
4818
4819 !! test
4820 External links: with entity
4821 !! wikitext
4822 [http://&#x20;www.librarieswithoutborders.org Libraries without borders]
4823 !! html/php
4824 <p><a rel="nofollow" class="external text" href="http://+www.librarieswithoutborders.org">Libraries without borders</a>
4825 </p>
4826 !! html/parsoid
4827 <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>
4828 !! end
4829
4830 !! test
4831 External links: Lone protocols are never linked (T105697)
4832 !! wikitext
4833 http://
4834 http://;
4835 (http://)
4836 bitcoin:
4837 bitcoin:;
4838 (bitcoin:)
4839 !! html
4840 <p>http://
4841 http://;
4842 (http://)
4843 bitcoin:
4844 bitcoin:;
4845 (bitcoin:)
4846 </p>
4847 !! end
4848
4849 !! test
4850 External links: No preceding word characters allowed (T67278)
4851 !! wikitext
4852 NOPEhttp://example.com
4853 N0http://example.com
4854 ok:http://example.com
4855 ok-http://example.com
4856 !! html
4857 <p>NOPEhttp://example.com
4858 N0http://example.com
4859 ok:<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4860 ok-<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4861 </p>
4862 !! end
4863
4864 !! test
4865 External links: nofollow domain exception
4866 !! wikitext
4867 A [https://no-nofollow.org/foobar link], and another [https://example.org link].
4868 !! html
4869 <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>.
4870 </p>
4871 !!end
4872
4873 !! test
4874 External image
4875 !! wikitext
4876 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4877 !! html
4878 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png"/>
4879 </p>
4880 !! end
4881
4882 !! test
4883 External image from https
4884 !! wikitext
4885 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4886 !! html
4887 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png"/>
4888 </p>
4889 !! end
4890
4891 !! test
4892 External image (when not allowed)
4893 !! options
4894 wgAllowExternalImages=0
4895 !! wikitext
4896 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4897 !! html
4898 <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>
4899 </p>
4900 !! end
4901
4902 !! test
4903 Link to non-http image, no img tag
4904 !! wikitext
4905 Link to non-http image, no img tag: ftp://example.com/test.jpg
4906 !! html
4907 <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>
4908 </p>
4909 !! end
4910
4911 !! test
4912 External links: terminating separator
4913 !! wikitext
4914 Terminating separator: http://example.com/thing,
4915 !! html
4916 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
4917 </p>
4918 !! end
4919
4920 !! test
4921 External links: intervening separator
4922 !! wikitext
4923 Intervening separator: http://example.com/1,2,3
4924 !! html
4925 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
4926 </p>
4927 !! end
4928
4929 !! test
4930 External links: old bug with URL in query
4931 !! wikitext
4932 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
4933 !! html
4934 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
4935 </p>
4936 !! end
4937
4938 !! test
4939 External links: old URL-in-URL bug, mixed protocols
4940 !! wikitext
4941 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
4942 !! html
4943 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
4944 </p>
4945 !!end
4946
4947 # Since Parsoid is starting to emit canonical wikitext for links,
4948 # [http://example.com http://example.com] will not RT back to that
4949 # form anymore.
4950 !! test
4951 External links: URL in text
4952 !! options
4953 parsoid=wt2html
4954 !! wikitext
4955 URL in text: [http://example.com http://example.com]
4956 !! html/php
4957 <p>URL in text: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4958 </p>
4959 !! html/parsoid
4960 <p>URL in text: <a rel="mw:ExtLink" href="http://example.com">http://example.com</a></p>
4961 !! end
4962
4963 !! test
4964 External links: Clickable images
4965 !! wikitext
4966 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
4967 !! html/php
4968 <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>
4969 </p>
4970 !! html/parsoid
4971 <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>
4972 !! end
4973
4974 !! test
4975 External links: raw ampersand
4976 !! wikitext
4977 Old &amp; use: http://x&y
4978 !! html
4979 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4980 </p>
4981 !! end
4982
4983 !! test
4984 External links: encoded ampersand
4985 !! wikitext
4986 Old &amp; use: http://x&amp;y
4987 !! html/php
4988 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4989 </p>
4990 !! html/parsoid
4991 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y">http://x&amp;y</a></p>
4992 !! end
4993
4994 !! test
4995 External links: encoded equals (T8102)
4996 !! wikitext
4997 http://example.com/?foo&#61;bar
4998 !! html/php
4999 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
5000 </p>
5001 !! html/parsoid
5002 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a></p>
5003 !! end
5004
5005 ##
5006 ## Note that parsoid doesn't explicit mark autonumbered links, nor
5007 ## does it number them. As discussed in T55505, we can identify
5008 ## autonumbered links via CSS.
5009 ##
5010
5011 !! test
5012 External links: [raw ampersand]
5013 !! wikitext
5014 Old &amp; use: [http://x&y]
5015 !! html/php
5016 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
5017 </p>
5018 !! html/parsoid
5019 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
5020 !! end
5021
5022 # note that parsoid html is identical to [raw ampersand] case; so html2wt
5023 # mode will return the [raw ampersand] wikitext
5024 !! test
5025 External links: [encoded ampersand]
5026 !! options
5027 parsoid=wt2html,wt2wt,html2html
5028 !! wikitext
5029 Old &amp; use: [http://x&amp;y]
5030 !! html/php
5031 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
5032 </p>
5033 !! html/parsoid
5034 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
5035 !! end
5036
5037 !! test
5038 External links: [raw equals]
5039 !! wikitext
5040 [http://example.com/?foo=bar]
5041 !! html/php
5042 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
5043 </p>
5044 !! html/parsoid
5045 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
5046 !! end
5047
5048 # note that parsoid html is identical to [raw equals] case; so html2wt
5049 # mode will return the [raw equals] wikitext
5050 !! test
5051 External links: [encoded equals] (T8102)
5052 !! options
5053 parsoid=wt2html,wt2wt,html2html
5054 !! wikitext
5055 [http://example.com/?foo&#61;bar]
5056 !! html/php
5057 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
5058 </p>
5059 !! html/parsoid
5060 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
5061 !! end
5062
5063 # xxx parsoid strips the IDN character, so the round-trip tests will
5064 # obviously fail and are disabled. --cscott
5065 !! test
5066 External links: [IDN ignored character reference in hostname; strip it right off]
5067 !! options
5068 parsoid=wt2html,wt2wt,html2html
5069 !! wikitext
5070 [http://e&zwnj;xample.com/]
5071 !! html/php
5072 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
5073 </p>
5074 !! html/parsoid
5075 <p><a rel="mw:ExtLink" href="http://example.com/"></a></p>
5076 !! end
5077
5078 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
5079 # Where an external link could easily circumvent the sanitization of the text of
5080 # a link like this (where an IDN-ignore character is in the URL somewhere), this
5081 # test demands a higher standard. That's a bit strange.
5082 #
5083 # Example:
5084 #
5085 # http://e‌xample.com -> [http://example.com|http://example.com]
5086 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
5087 #
5088 # The first example is sanitized, but the second is not. Any security benefits
5089 # from this production are trivial to circumvent. Either remove this test and
5090 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
5091 # the test accordingly.
5092 #
5093 # All our love,
5094 # The Parsoid team.
5095 # xxx parsoid strips the IDN character, so the round-trip tests will
5096 # obviously fail and are disabled. --cscott
5097 !! test
5098 External links: IDN ignored character reference in hostname; strip it right off
5099 !! options
5100 parsoid=wt2html,html2html
5101 !! wikitext
5102 http://e&zwnj;xample.com/
5103 !! html/php
5104 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
5105 </p>
5106 !! html/parsoid
5107 <p><a rel="mw:ExtLink" href="http://example.com/">http://example.com/</a></p>
5108 !! end
5109
5110 !! test
5111 External links: www.jpeg.org (T2554)
5112 !! wikitext
5113 http://www.jpeg.org
5114 !! html
5115 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
5116 </p>
5117 !! end
5118
5119 # parsoid doesn't explicitly mark autonumbered links, see T55505
5120 !! test
5121 External links: URL within URL (T2002)
5122 !! wikitext
5123 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
5124 !! html/php
5125 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
5126 </p>
5127 !! html/parsoid
5128 <p><a rel="mw:ExtLink" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp"></a></p>
5129 !! end
5130
5131 !! test
5132 T2361: URL inside bracketed URL
5133 !! wikitext
5134 [http://www.example.com/foo http://www.example.com/bar]
5135 !! html
5136 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
5137 </p>
5138 !! end
5139
5140 !! test
5141 T2361: URL within URL, not bracketed
5142 !! wikitext
5143 http://www.example.com/foo?=http://www.example.com/bar
5144 !! html
5145 <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>
5146 </p>
5147 !! end
5148
5149 !! test
5150 T2289: ">"-token in URL-tail
5151 !! wikitext
5152 http://www.example.com/<hello>
5153 !! html
5154 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
5155 </p>
5156 !!end
5157
5158 !! test
5159 T2289: literal ">"-token in URL-tail
5160 !! wikitext
5161 http://www.example.com/<b>html</b>
5162 !! html/php
5163 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
5164 </p>
5165 !! html/parsoid
5166 <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>
5167 !! end
5168
5169 !! test
5170 T2289: ">"-token in bracketed URL
5171 !! wikitext
5172 [http://www.example.com/<hello> stuff]
5173 !! html
5174 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
5175 </p>
5176 !!end
5177
5178 !! test
5179 T2289: literal ">"-token in bracketed URL
5180 !! wikitext
5181 [http://www.example.com/<b>html</b> stuff]
5182 !! html
5183 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
5184 </p>
5185 !!end
5186
5187 !! test
5188 T2289: literal double quote at end of URL
5189 !! wikitext
5190 http://www.example.com/"hello"
5191 !! html
5192 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
5193 </p>
5194 !!end
5195
5196 !! test
5197 T2289: literal double quote in bracketed URL
5198 !! wikitext
5199 [http://www.example.com/"hello" stuff]
5200 !! html
5201 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
5202 </p>
5203 !!end
5204
5205 !! test
5206 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (T7081)
5207 !! wikitext
5208 [http://www.example.com test]
5209 !! html
5210 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
5211 </p>
5212 !! end
5213
5214 !! test
5215 External links: link text with spaces
5216 !! wikitext
5217 [http://www.example.com a b c]
5218 [http://www.example.com ''a'' ''b'']
5219 !! html
5220 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
5221 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
5222 </p>
5223 !! end
5224
5225 !! test
5226 External links: wiki links within external link (T5695)
5227 !! options
5228 parsoid=wt2html,html2html
5229 !! wikitext
5230 [http://example.com [[wikilink]] embedded in ext link]
5231 !! html/php
5232 <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>
5233 </p>
5234 !! html/parsoid
5235 <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>
5236 !! end
5237
5238 !! test
5239 T2787: Links with one slash after the url protocol are invalid
5240 !! wikitext
5241 http:/example.com
5242
5243 [http:/example.com title]
5244 !! html
5245 <p>http:/example.com
5246 </p><p>[http:/example.com title]
5247 </p>
5248 !! end
5249
5250 !! test
5251 Bracketed external links with template-generated invalid target
5252 !! wikitext
5253 [{{echo|http:/example.com}} title]
5254 !! html
5255 <p>[http:/example.com title]
5256 </p>
5257 !! end
5258
5259 !! test
5260 T4702: Mismatched <i>, <b> and <a> tags are invalid
5261 !! wikitext
5262 ''[http://example.com text'']
5263 [http://example.com '''text]'''
5264 ''Something [http://example.com in italic'']
5265 ''Something [http://example.com mixed''''', even bold]'''
5266 '''''Now [http://example.com both''''']
5267 !! html
5268 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
5269 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
5270 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
5271 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
5272 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
5273 </p>
5274 !! end
5275
5276
5277 !! test
5278 T6781: %26 in URL
5279 !! wikitext
5280 http://www.example.com/?title=AT%26T
5281 !! html/php
5282 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
5283 </p>
5284 !! html/parsoid
5285 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a></p>
5286 !! end
5287
5288 # According to https://www.w3.org/TR/2011/WD-html5-20110525/Overview.html#parsing-urls a plain
5289 # % is actually legal in HTML5. Any change in output would need testing though.
5290 !! test
5291 T6781, T7267: %25 in URL
5292 !! wikitext
5293 http://www.example.com/?title=100%25_Bran
5294 !! html/php
5295 <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>
5296 </p>
5297 !! html/parsoid
5298 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran">http://www.example.com/?title=100%25_Bran</a></p>
5299 !! end
5300
5301 !! test
5302 T6781, T7267: %28, %29 in URL
5303 !! wikitext
5304 http://www.example.com/?title=Ben-Hur_%281959_film%29
5305 !! html/php
5306 <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>
5307 </p>
5308 !! html/parsoid
5309 <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>
5310 !! end
5311
5312
5313 !! test
5314 T6781: %26 in autonumber URL
5315 !! wikitext
5316 [http://www.example.com/?title=AT%26T]
5317 !! html/php
5318 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
5319 </p>
5320 !! html/parsoid
5321 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T"></a></p>
5322 !! end
5323
5324 !! test
5325 T6781, T7267: %26 in autonumber URL
5326 !! wikitext
5327 [http://www.example.com/?title=100%25_Bran]
5328 !! html/php
5329 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
5330 </p>
5331 !! html/parsoid
5332 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran"></a></p>
5333 !! end
5334
5335 !! test
5336 T6781, T7267: %28, %29 in autonumber URL
5337 !! wikitext
5338 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
5339 !! html/php
5340 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
5341 </p>
5342 !! html/parsoid
5343 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29"></a></p>
5344 !! end
5345
5346
5347 !! test
5348 T6781: %26 in bracketed URL
5349 !! wikitext
5350 [http://www.example.com/?title=AT%26T link]
5351 !! html/php
5352 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
5353 </p>
5354 !! html/parsoid
5355 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">link</a></p>
5356 !! end
5357
5358 !! test
5359 T6781, T7267: %25 in bracketed URL
5360 !! wikitext
5361 [http://www.example.com/?title=100%25_Bran link]
5362 !! html
5363 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
5364 </p>
5365 !! end
5366
5367 !! test
5368 T6781, T7267: %28, %29 in bracketed URL
5369 !! wikitext
5370 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
5371 !! html/php
5372 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
5373 </p>
5374 !! html/parsoid
5375 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a></p>
5376 !! end
5377
5378 !! test
5379 External link containing a period in the anchor. (T65947)
5380 !! wikitext
5381 [//foo.org/bar#baz. bang]
5382
5383 [//foo.org/bar. bang]
5384 !! html/php
5385 <p><a rel="nofollow" class="external text" href="//foo.org/bar#baz.">bang</a>
5386 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar.">bang</a>
5387 </p>
5388 !! html/parsoid
5389 <p><a rel="mw:ExtLink" href="//foo.org/bar#baz.">bang</a></p>
5390 <p><a rel="mw:ExtLink" href="//foo.org/bar.">bang</a></p>
5391 !! end
5392
5393 !! test
5394 External link containing a single quote. (T65947)
5395 !! wikitext
5396 [//foo.org/bar'baz]
5397
5398 [//foo.org/bar'baz bang]
5399 !! html/php
5400 <p><a rel="nofollow" class="external autonumber" href="//foo.org/bar'baz">[1]</a>
5401 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar'baz">bang</a>
5402 </p>
5403 !! html/parsoid
5404 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz"></a></p>
5405 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz">bang</a></p>
5406 !! end
5407
5408 !! test
5409 External link containing double-single-quotes in text '' (T6598 sanity check)
5410 !! wikitext
5411 Some [http://example.com/ pretty ''italics'' and stuff]!
5412 !! html
5413 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
5414 </p>
5415 !! end
5416
5417 !! test
5418 External link containing double-single-quotes in text embedded in italics (T6598 sanity check)
5419 !! wikitext
5420 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
5421 !! html
5422 <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>
5423 </p>
5424 !! end
5425
5426 !! test
5427 External link containing double-single-quotes with no space separating the url from text in italics
5428 !! wikitext
5429 [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]].]
5430 !! html/php
5431 <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>
5432 </p>
5433 !! html/php+tidy
5434 <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>
5435 !! html/parsoid
5436 <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>
5437 !! end
5438
5439 !! test
5440 External link with comments in link text
5441 !! wikitext
5442 [http://www.google.com Google <!-- comment -->]
5443 !! html/php
5444 <p><a rel="nofollow" class="external text" href="http://www.google.com">Google </a>
5445 </p>
5446 !! html/parsoid
5447 <p><a rel="mw:ExtLink" href="http://www.google.com">Google <!-- comment --></a></p>
5448 !! end
5449
5450 !! test
5451 External link to bare IPv4 address
5452 !! wikitext
5453 [http://192.168.0.1 Link]
5454 !! html/php
5455 <p><a rel="nofollow" class="external text" href="http://192.168.0.1">Link</a>
5456 </p>
5457 !! html/parsoid
5458 <p><a rel="mw:ExtLink" href="http://192.168.0.1">Link</a></p>
5459 !! end
5460
5461 !! test
5462 URL-encoding in URL functions (single parameter)
5463 !! wikitext
5464 {{localurl:Some page|amp=&}}
5465 !! html
5466 <p>/index.php?title=Some_page&amp;amp=&amp;
5467 </p>
5468 !! end
5469
5470 !! test
5471 URL-encoding in URL functions (multiple parameters)
5472 !! wikitext
5473 {{localurl:Some page|q=?&amp=&}}
5474 !! html
5475 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
5476 </p>
5477 !! end
5478
5479 !! test
5480 Brackets in urls
5481 !! wikitext
5482 http://example.com/index.php?foozoid%5B%5D=bar
5483
5484 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
5485 !! html/php
5486 <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>
5487 </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>
5488 </p>
5489 !! html/parsoid
5490 <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>
5491
5492 <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>
5493 !! end
5494
5495 !! test
5496 IPv6 urls, autolink format (T23261)
5497 !! wikitext
5498 http://[2404:130:0:1000::187:2]/index.php
5499
5500 Examples from RFC 2373, section 2.2:
5501 * http://[1080::8:800:200C:417A]/unicast
5502 * http://[FF01::101]/multicast
5503 * http://[::1]/loopback
5504 * http://[::]/unspecified
5505 * http://[::13.1.68.3]/ipv4compat
5506 * http://[::FFFF:129.144.52.38]/ipv4compat
5507
5508 Examples from RFC 2732, section 2:
5509 * http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html
5510 * http://[1080:0:0:0:8:800:200C:417A]/index.html
5511 * http://[3ffe:2a00:100:7031::1]
5512 * http://[1080::8:800:200C:417A]/foo
5513 * http://[::192.9.5.5]/ipng
5514 * http://[::FFFF:129.144.52.38]:80/index.html
5515 * http://[2010:836B:4179::836B:4179]
5516
5517 !! html/php
5518 <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>
5519 </p><p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2373">RFC 2373</a>, section 2.2:
5520 </p>
5521 <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>
5522 <li> <a rel="nofollow" class="external free" href="http://[FF01::101]/multicast">http://[FF01::101]/multicast</a></li>
5523 <li> <a rel="nofollow" class="external free" href="http://[::1]/loopback">http://[::1]/loopback</a></li>
5524 <li> <a rel="nofollow" class="external free" href="http://[::]/unspecified">http://[::]/unspecified</a></li>
5525 <li> <a rel="nofollow" class="external free" href="http://[::13.1.68.3]/ipv4compat">http://[::13.1.68.3]/ipv4compat</a></li>
5526 <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>
5527 <p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2732">RFC 2732</a>, section 2:
5528 </p>
5529 <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>
5530 <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>
5531 <li> <a rel="nofollow" class="external free" href="http://[3ffe:2a00:100:7031::1]">http://[3ffe:2a00:100:7031::1]</a></li>
5532 <li> <a rel="nofollow" class="external free" href="http://[1080::8:800:200C:417A]/foo">http://[1080::8:800:200C:417A]/foo</a></li>
5533 <li> <a rel="nofollow" class="external free" href="http://[::192.9.5.5]/ipng">http://[::192.9.5.5]/ipng</a></li>
5534 <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>
5535 <li> <a rel="nofollow" class="external free" href="http://[2010:836B:4179::836B:4179]">http://[2010:836B:4179::836B:4179]</a></li></ul>
5536
5537 !! html/parsoid
5538 <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>
5539
5540 <p>Examples from <a href="//tools.ietf.org/html/rfc2373" rel="mw:ExtLink">RFC 2373</a>, section 2.2:</p>
5541 <ul><li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/unicast">http://[1080::8:800:200C:417A]/unicast</a></li>
5542 <li> <a rel="mw:ExtLink" href="http://[FF01::101]/multicast">http://[FF01::101]/multicast</a></li>
5543 <li> <a rel="mw:ExtLink" href="http://[::1]/loopback">http://[::1]/loopback</a></li>
5544 <li> <a rel="mw:ExtLink" href="http://[::]/unspecified">http://[::]/unspecified</a></li>
5545 <li> <a rel="mw:ExtLink" href="http://[::13.1.68.3]/ipv4compat">http://[::13.1.68.3]/ipv4compat</a></li>
5546 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]/ipv4compat">http://[::FFFF:129.144.52.38]/ipv4compat</a></li></ul>
5547
5548 <p>Examples from <a href="//tools.ietf.org/html/rfc2732" rel="mw:ExtLink">RFC 2732</a>, section 2:</p>
5549 <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>
5550 <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>
5551 <li> <a rel="mw:ExtLink" href="http://[3ffe:2a00:100:7031::1]">http://[3ffe:2a00:100:7031::1]</a></li>
5552 <li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/foo">http://[1080::8:800:200C:417A]/foo</a></li>
5553 <li> <a rel="mw:ExtLink" href="http://[::192.9.5.5]/ipng">http://[::192.9.5.5]/ipng</a></li>
5554 <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>
5555 <li> <a rel="mw:ExtLink" href="http://[2010:836B:4179::836B:4179]">http://[2010:836B:4179::836B:4179]</a></li></ul>
5556 !! end
5557
5558 !! test
5559 IPv6 urls, bracketed format (T23261)
5560 !! wikitext
5561 [http://[2404:130:0:1000::187:2]/index.php test]
5562
5563 Examples from RFC 2373, section 2.2:
5564 * [http://[1080::8:800:200C:417A] unicast]
5565 * [http://[FF01::101] multicast]
5566 * [http://[::1]/ loopback]
5567 * [http://[::] unspecified]
5568 * [http://[::13.1.68.3] ipv4compat]
5569 * [http://[::FFFF:129.144.52.38] ipv4compat]
5570
5571 Examples from RFC 2732, section 2:
5572 * [http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html 1]
5573 * [http://[1080:0:0:0:8:800:200C:417A]/index.html 2]
5574 * [http://[3ffe:2a00:100:7031::1] 3]
5575 * [http://[1080::8:800:200C:417A]/foo 4]
5576 * [http://[::192.9.5.5]/ipng 5]
5577 * [http://[::FFFF:129.144.52.38]:80/index.html 6]
5578 * [http://[2010:836B:4179::836B:4179] 7]
5579
5580 !! html/php
5581 <p><a rel="nofollow" class="external text" href="http://[2404:130:0:1000::187:2]/index.php">test</a>
5582 </p><p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2373">RFC 2373</a>, section 2.2:
5583 </p>
5584 <ul><li> <a rel="nofollow" class="external text" href="http://[1080::8:800:200C:417A]">unicast</a></li>
5585 <li> <a rel="nofollow" class="external text" href="http://[FF01::101]">multicast</a></li>
5586 <li> <a rel="nofollow" class="external text" href="http://[::1]/">loopback</a></li>
5587 <li> <a rel="nofollow" class="external text" href="http://[::]">unspecified</a></li>
5588 <li> <a rel="nofollow" class="external text" href="http://[::13.1.68.3]">ipv4compat</a></li>
5589 <li> <a rel="nofollow" class="external text" href="http://[::FFFF:129.144.52.38]">ipv4compat</a></li></ul>
5590 <p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2732">RFC 2732</a>, section 2:
5591 </p>
5592 <ul><li> <a rel="nofollow" class="external text" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">1</a></li>
5593 <li> <a rel="nofollow" class="external text" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">2</a></li>
5594 <li> <a rel="nofollow" class="external text" href="http://[3ffe:2a00:100:7031::1]">3</a></li>
5595 <li> <a rel="nofollow" class="external text" href="http://[1080::8:800:200C:417A]/foo">4</a></li>
5596 <li> <a rel="nofollow" class="external text" href="http://[::192.9.5.5]/ipng">5</a></li>
5597 <li> <a rel="nofollow" class="external text" href="http://[::FFFF:129.144.52.38]:80/index.html">6</a></li>
5598 <li> <a rel="nofollow" class="external text" href="http://[2010:836B:4179::836B:4179]">7</a></li></ul>
5599
5600 !! html/parsoid
5601 <p><a rel="mw:ExtLink" href="http://[2404:130:0:1000::187:2]/index.php">test</a></p>
5602
5603 <p>Examples from <a href="//tools.ietf.org/html/rfc2373" rel="mw:ExtLink">RFC 2373</a>, section 2.2:</p>
5604 <ul><li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]">unicast</a></li>
5605 <li> <a rel="mw:ExtLink" href="http://[FF01::101]">multicast</a></li>
5606 <li> <a rel="mw:ExtLink" href="http://[::1]/">loopback</a></li>
5607 <li> <a rel="mw:ExtLink" href="http://[::]">unspecified</a></li>
5608 <li> <a rel="mw:ExtLink" href="http://[::13.1.68.3]">ipv4compat</a></li>
5609 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]">ipv4compat</a></li></ul>
5610
5611 <p>Examples from <a href="//tools.ietf.org/html/rfc2732" rel="mw:ExtLink">RFC 2732</a>, section 2:</p>
5612 <ul><li> <a rel="mw:ExtLink" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">1</a></li>
5613 <li> <a rel="mw:ExtLink" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">2</a></li>
5614 <li> <a rel="mw:ExtLink" href="http://[3ffe:2a00:100:7031::1]">3</a></li>
5615 <li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/foo">4</a></li>
5616 <li> <a rel="mw:ExtLink" href="http://[::192.9.5.5]/ipng">5</a></li>
5617 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]:80/index.html">6</a></li>
5618 <li> <a rel="mw:ExtLink" href="http://[2010:836B:4179::836B:4179]">7</a></li></ul>
5619 !! end
5620
5621 !! test
5622 Non-extlinks in brackets
5623 !! wikitext
5624 [foo]
5625 [foo bar]
5626 [foo ''bar'']
5627 [fool's] errand
5628 [fool's errand]
5629 [{{echo|foo}}]
5630 [{{echo|foo}} bar]
5631 [{{echo|foo}} ''bar'']
5632 [{{echo|foo}}l's] errand
5633 [{{echo|foo}}l's errand]
5634 [url={{echo|foo}}]
5635 [url=http://example.com]
5636 [http:// bare protocols don't count]
5637 !! html/php
5638 <p>[foo]
5639 [foo bar]
5640 [foo <i>bar</i>]
5641 [fool's] errand
5642 [fool's errand]
5643 [foo]
5644 [foo bar]
5645 [foo <i>bar</i>]
5646 [fool's] errand
5647 [fool's errand]
5648 [url=foo]
5649 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
5650 [http:// bare protocols don't count]
5651 </p>
5652 !! html/parsoid
5653 <p>[foo]
5654 [foo bar]
5655 [foo <i>bar</i>]
5656 [fool's] errand
5657 [fool's errand]
5658 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}"}'>foo</span>]
5659 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}"}'>foo</span> bar]
5660 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}"}'>foo</span> <i>bar</i>]
5661 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}l&#39;s"}'>fool's</span>] errand
5662 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}l&#39;s"}'>fool's</span> errand]
5663 [<span typeof="mw:Placeholder" data-parsoid='{"src":"url={{echo|foo}}"}'>url=foo</span>]
5664 [url=<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>]
5665 [http:// bare protocols don't count]</p>
5666 !! end
5667
5668 !! test
5669 Percent encoding in external links
5670 !! wikitext
5671 [https://github.com/search?l=&q=ResourceLoader+%40wikimedia Search]
5672 !! html/php
5673 <p><a rel="nofollow" class="external text" href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a>
5674 </p>
5675 !! html/parsoid
5676 <p><a rel="mw:ExtLink"
5677 href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a></p>
5678 !! end
5679
5680 !! test
5681 Use url link syntax for links where the content is equal the link target
5682 !! wikitext
5683 http://example.com
5684 !! html/php
5685 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
5686 </p>
5687 !! html/parsoid
5688 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></p>
5689 !! end
5690
5691 !! test
5692 Parenthesis in external links, especially URL links
5693 !! wikitext
5694 http://example.com)
5695
5696 http://example.com/test)
5697
5698 http://example.com/(test)
5699
5700 http://example.com/((test)
5701
5702 (http://example.com/(test))
5703
5704 (http://example.com/(test)))))
5705
5706 http://example.com/a)b
5707
5708 [http://example.com) foo]
5709 !! html/php
5710 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5711 </p><p><a rel="nofollow" class="external free" href="http://example.com/test">http://example.com/test</a>)
5712 </p><p><a rel="nofollow" class="external free" href="http://example.com/(test)">http://example.com/(test)</a>
5713 </p><p><a rel="nofollow" class="external free" href="http://example.com/((test)">http://example.com/((test)</a>
5714 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test))">http://example.com/(test))</a>
5715 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test)))))">http://example.com/(test)))))</a>
5716 </p><p><a rel="nofollow" class="external free" href="http://example.com/a)b">http://example.com/a)b</a>
5717 </p><p><a rel="nofollow" class="external text" href="http://example.com)">foo</a>
5718 </p>
5719 !! html/parsoid
5720 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)</p>
5721 <p><a rel="mw:ExtLink" href="http://example.com/test">http://example.com/test</a>)</p>
5722 <p><a rel="mw:ExtLink" href="http://example.com/(test)">http://example.com/(test)</a></p>
5723 <p><a rel="mw:ExtLink" href="http://example.com/((test)">http://example.com/((test)</a></p>
5724 <p>(<a rel="mw:ExtLink" href="http://example.com/(test))">http://example.com/(test))</a></p>
5725 <p>(<a rel="mw:ExtLink" href="http://example.com/(test)))))">http://example.com/(test)))))</a></p>
5726 <p><a rel="mw:ExtLink" href="http://example.com/a)b">http://example.com/a)b</a></p>
5727 <p><a rel="mw:ExtLink" href="http://example.com)">foo</a></p>
5728 !! end
5729
5730 !! test
5731 Parenthesis in external links, w/ transclusion or comment
5732 !! wikitext
5733 (http://example.com/{{echo|hi}})
5734
5735 (http://example.com<!-- hi -->)
5736 !! html/php
5737 <p>(<a rel="nofollow" class="external free" href="http://example.com/hi">http://example.com/hi</a>)
5738 </p><p>(<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5739 </p>
5740 !! html/parsoid
5741 <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>
5742
5743 <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>
5744 !! end
5745
5746 !! test
5747 Serialize <a> tags with invalid link targets as plain text
5748 !! options
5749 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
5750 !! html/parsoid
5751 <a rel="mw:WikiLink" href="[[foo]]">text</a>
5752 <a rel="mw:WikiLink" href="[[foo]]">*text</a>
5753 <a rel="mw:WikiLink" href="[[foo]]">[[foo]]</a>
5754 <a rel="mw:WikiLink" href="[[foo]]">*a [[foo]]</a>
5755 !! wikitext
5756 text
5757 <nowiki>*</nowiki>text
5758 <nowiki>[[foo]]</nowiki>
5759 <nowiki>*</nowiki>a <nowiki>[[foo]]</nowiki>
5760 !! end
5761
5762 !! test
5763 mw:ExtLink -vs- mw:WikiLink (T94723)
5764 !! options
5765 parsoid=html2wt
5766 !! html/parsoid
5767 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"piped","a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>Bar</a>
5768 <a rel="mw:WikiLink" href="./Foo" title="Foo">Bar</a>
5769 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
5770 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
5771 <p>
5772 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
5773 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
5774 </p>
5775 !! wikitext
5776 [[Foo|Bar]]
5777 [[Foo|Bar]]
5778 [[wikipedia:Foo|Bar]]
5779 [[wikipedia:Foo|Bar]]
5780
5781 [[wikipedia:European_Robin|European Robin]]
5782 [[wikipedia:European_Robin|European Robin]]
5783 !! end
5784
5785 !! test
5786 mw:ExtLink linking to a interwiki URL can be round-tripped losslessly (T94723)
5787 !! options
5788 parsoid=wt2wt
5789 !! wikitext
5790 [http://en.wikipedia.org/wiki/European_Robin European Robin]
5791 !! html/parsoid
5792 THIS SECTION IS NOT USED (but Parsoid won't run the test without it)
5793 !! end
5794
5795
5796 ###
5797 ### Quotes
5798 ###
5799
5800 !! test
5801 Quotes
5802 !! wikitext
5803 Normal text. '''Bold text.''' Normal text. ''Italic text.''
5804
5805 Normal text. '''''Bold italic text.''''' Normal text.
5806 !! html
5807 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
5808 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
5809 </p>
5810 !! end
5811
5812
5813 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
5814 # parser strips. The wikitext contains just the first half of the bold
5815 # quote pair.
5816 !! test
5817 Unclosed and unmatched quotes
5818 !! wikitext
5819 '''''Bold italic text '''with bold deactivated''' in between.'''''
5820
5821 '''''Bold italic text ''with italic deactivated'' in between.'''''
5822
5823 '''Bold text..
5824
5825 ..spanning two paragraphs (should not work).'''
5826
5827 '''Bold tag left open
5828
5829 ''Italic tag left open
5830
5831 Normal text.
5832
5833 <!-- Unmatching number of opening, closing tags: -->
5834 '''This year''''s election ''should'' beat '''last year''''s.
5835
5836 ''Tom'''s car is bigger than ''Susan'''s.
5837
5838 Plain ''italic'''s plain
5839 !! html/php
5840 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
5841 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
5842 </p><p><b>Bold text..</b>
5843 </p><p>..spanning two paragraphs (should not work).
5844 </p><p><b>Bold tag left open</b>
5845 </p><p><i>Italic tag left open</i>
5846 </p><p>Normal text.
5847 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
5848 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
5849 </p><p>Plain <i>italic'</i>s plain
5850 </p>
5851 !! html/parsoid
5852 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
5853 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
5854 </p><p><b>Bold text..</b>
5855 </p><p>..spanning two paragraphs (should not work).<b></b>
5856 </p><p><b>Bold tag left open</b>
5857 </p><p><i>Italic tag left open</i>
5858 </p><p>Normal text.
5859 </p>
5860 <!-- Unmatching number of opening, closing tags: -->
5861 <p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
5862 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
5863 </p><p>Plain <i>italic'</i>s plain
5864 </p>
5865 !! end
5866
5867 ###
5868 ### Tables
5869 ###
5870 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
5871 ###
5872
5873 # This should not produce <table></table> as <table><tr><td></td></tr></table>
5874 # is the bare minimum required by the spec, see:
5875 # https://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
5876 # Parsoid team replies: empty table tags are legal in HTML5
5877 !! test
5878 A table with no data.
5879 !! options
5880 parsoid=wt2html
5881 !! wikitext
5882 {||}
5883 !! html/php
5884
5885 !! html/parsoid
5886 <table></table>
5887
5888 !! end
5889
5890 !! test
5891 A table with stray table end tags on start tag line (wt2html)
5892 !! options
5893 parsoid=wt2html
5894 !! wikitext
5895 {|style="color: red;"|}
5896
5897 {|style="color: red;" |}
5898 |foo
5899 |}
5900
5901 {|style="color: red;"|} id="foo"
5902 |foo
5903 |}
5904
5905 {|style="color: red;" |} id="foo"
5906 |foo
5907 |}
5908 !! html
5909 <table style="color: red;"></table>
5910
5911 <table style="color: red;">
5912 <tbody><tr>
5913 <td>foo</td>
5914 </tr></tbody>
5915 </table>
5916
5917 <table style="color: red;" id="foo">
5918 <tbody><tr>
5919 <td>foo</td>
5920 </tr></tbody>
5921 </table>
5922
5923 <table style="color: red;" id="foo">
5924 <tbody><tr>
5925 <td>foo</td>
5926 </tr></tbody>
5927 </table>
5928
5929 !! end
5930
5931 !! test
5932 A table with no data (take 2)
5933 !! wikitext
5934 {|
5935 |}
5936 !! html/parsoid
5937 <table></table>
5938 !! end
5939
5940 # A table with nothing but a caption is invalid XHTML, we might want to render
5941 # this as <p>caption</p>
5942 # Parsoid team replies: table with only a caption is legal in HTML5
5943 !! test
5944 A table with nothing but a caption
5945 !! wikitext
5946 {|
5947 |+ caption
5948 |}
5949 !! html/php
5950 <table>
5951 <caption> caption
5952 </caption><tr><td></td></tr></table>
5953
5954 !! html/parsoid
5955 <table><caption> caption</caption></table>
5956 !! end
5957
5958 !! test
5959 A table with caption with default-spaced attributes and a table row
5960 !! wikitext
5961 {|
5962 |+ style="color: red;" | caption1
5963 |-
5964 | foo
5965 |}
5966 !! html
5967 <table>
5968 <caption style="color: red;"> caption1
5969 </caption>
5970 <tr>
5971 <td> foo
5972 </td></tr></table>
5973
5974 !! end
5975
5976 !! test
5977 A table with captions with non-default spaced attributes and a table row
5978 !! wikitext
5979 {|
5980 |+style="color: red;"|caption2
5981 |+ style="color: red;"| caption3
5982 |-
5983 | foo
5984 |}
5985 !! html
5986 <table>
5987 <caption style="color: red;">caption2
5988 </caption>
5989 <caption style="color: red;"> caption3
5990 </caption>
5991 <tr>
5992 <td> foo
5993 </td></tr></table>
5994
5995 !! end
5996
5997 !! test
5998 Table td-cell syntax variations
5999 !! wikitext
6000 {|
6001 | foo bar foo | baz
6002 | foo bar foo || baz
6003 | style='color:red;' | baz
6004 | style='color:red;' || baz
6005 |}
6006 !! html
6007 <table>
6008 <tr>
6009 <td> baz
6010 </td>
6011 <td> foo bar foo </td>
6012 <td> baz
6013 </td>
6014 <td style="color:red;"> baz
6015 </td>
6016 <td> style='color:red;' </td>
6017 <td> baz
6018 </td></tr></table>
6019
6020 !! end
6021
6022 !! test
6023 Simple table
6024 !! wikitext
6025 {|
6026 | 1 || 2
6027 |-
6028 | 3 || 4
6029 |}
6030 !! html
6031 <table>
6032 <tr>
6033 <td> 1 </td>
6034 <td> 2
6035 </td></tr>
6036 <tr>
6037 <td> 3 </td>
6038 <td> 4
6039 </td></tr></table>
6040
6041 !! end
6042
6043 !! test
6044 Simple table but with multiple dashes for row wikitext
6045 !! wikitext
6046 {|
6047 | foo
6048 |-----
6049 | bar
6050 |}
6051 !! html
6052 <table>
6053 <tr>
6054 <td> foo
6055 </td></tr>
6056 <tr>
6057 <td> bar
6058 </td></tr></table>
6059
6060 !! end
6061
6062 !! test
6063 Multiplication table
6064 !! wikitext
6065 {| border="1" cellpadding="2"
6066 |+Multiplication table
6067 |-
6068 ! &times; !! 1 !! 2 !! 3
6069 |-
6070 ! 1
6071 | 1 || 2 || 3
6072 |-
6073 ! 2
6074 | 2 || 4 || 6
6075 |-
6076 ! 3
6077 | 3 || 6 || 9
6078 |-
6079 ! 4
6080 | 4 || 8 || 12
6081 |-
6082 ! 5
6083 | 5 || 10 || 15
6084 |}
6085 !! html
6086 <table border="1" cellpadding="2">
6087 <caption>Multiplication table
6088 </caption>
6089 <tr>
6090 <th> &#215; </th>
6091 <th> 1 </th>
6092 <th> 2 </th>
6093 <th> 3
6094 </th></tr>
6095 <tr>
6096 <th> 1
6097 </th>
6098 <td> 1 </td>
6099 <td> 2 </td>
6100 <td> 3
6101 </td></tr>
6102 <tr>
6103 <th> 2
6104 </th>
6105 <td> 2 </td>
6106 <td> 4 </td>
6107 <td> 6
6108 </td></tr>
6109 <tr>
6110 <th> 3
6111 </th>
6112 <td> 3 </td>
6113 <td> 6 </td>
6114 <td> 9
6115 </td></tr>
6116 <tr>
6117 <th> 4
6118 </th>
6119 <td> 4 </td>
6120 <td> 8 </td>
6121 <td> 12
6122 </td></tr>
6123 <tr>
6124 <th> 5
6125 </th>
6126 <td> 5 </td>
6127 <td> 10 </td>
6128 <td> 15
6129 </td></tr></table>
6130
6131 !! end
6132
6133 !! test
6134 Accept "||" in table headings
6135 !! wikitext
6136 {|
6137 !h1 || h2
6138 |}
6139 !! html
6140 <table>
6141 <tr>
6142 <th>h1 </th>
6143 <th> h2
6144 </th></tr></table>
6145
6146 !! end
6147
6148 !! test
6149 Accept "!!" in table data
6150 !! wikitext
6151 {|
6152 | Foo!! ||
6153 |}
6154 !! html
6155 <table>
6156 <tr>
6157 <td> Foo!! </td>
6158 <td>
6159 </td></tr></table>
6160
6161 !! html/parsoid
6162 <table>
6163 <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>
6164 </tbody></table>
6165 !! end
6166
6167 !! test
6168 Accept "||" in indented table headings
6169 !! wikitext
6170 :{|
6171 !h1 || h2
6172 |}
6173 !! html
6174 <dl><dd><table>
6175 <tr>
6176 <th>h1 </th>
6177 <th> h2
6178 </th></tr></table></dd></dl>
6179
6180 !! end
6181
6182 !! test
6183 Accept "!!" in templates
6184 !! wikitext
6185 {|
6186 !a {{echo|b!!c}}
6187 |}
6188 !! html/php
6189 <table>
6190 <tr>
6191 <th>a b</th>
6192 <th>c
6193 </th></tr></table>
6194
6195 !! html/parsoid
6196 <table>
6197 <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>
6198 !! end
6199
6200 !! test
6201 Accept "!!" in table headings after newline
6202 !! wikitext
6203 {|
6204 !a
6205 b!!c
6206 |}
6207 !! html/php
6208 <table>
6209 <tr>
6210 <th>a
6211 <p>b!!c
6212 </p>
6213 </th></tr></table>
6214
6215 !! html/parsoid
6216 <table>
6217 <tbody><tr><th>a
6218 <p>b!!c</p></th></tr>
6219 </tbody></table>
6220 !! end
6221
6222 !! test
6223 Accept "!!" in table data of mixed wikitext / html syntax
6224 !! wikitext
6225 {|
6226 !a
6227 <tr><td>b!!c</td></tr>
6228 |}
6229 !! html+tidy
6230 <table>
6231 <tr>
6232 <th>a</th>
6233 </tr>
6234 <tr>
6235 <td>b!!c</td>
6236 </tr>
6237 </table>
6238 !! html/parsoid
6239 <table>
6240 <tbody><tr><th>a</th></tr>
6241 <tr data-parsoid='{"stx":"html"}'><td data-parsoid='{"stx":"html"}'>b!!c</td></tr>
6242 </tbody></table>
6243 !! end
6244
6245 !! test
6246 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
6247 !! wikitext
6248 {|
6249 !| h1
6250 || a
6251 |}
6252 !! html
6253 <table>
6254 <tr>
6255 <th> h1
6256 </th>
6257 <td> a
6258 </td></tr></table>
6259
6260 !! end
6261
6262 !!test
6263 Accept "| !" at start of line in tables (ignore !-attribute)
6264 !! wikitext
6265 {|
6266 |-
6267 | !style="color:red" | bar
6268 |}
6269 !! html
6270 <table>
6271
6272 <tr>
6273 <td> bar
6274 </td></tr></table>
6275
6276 !!end
6277
6278 !!test
6279 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 +/-
6280 !! wikitext
6281 {|
6282 |-
6283 |style='color:red;'|+1
6284 |style='color:blue;'|-1
6285 |-
6286 | 1 || 2 || 3
6287 | 1 ||+2 ||-3
6288 |-
6289 | +1
6290 | -1
6291 |}
6292 !! html
6293 <table>
6294
6295 <tr>
6296 <td style="color:red;">+1
6297 </td>
6298 <td style="color:blue;">-1
6299 </td></tr>
6300 <tr>
6301 <td> 1 </td>
6302 <td> 2 </td>
6303 <td> 3
6304 </td>
6305 <td> 1 </td>
6306 <td>+2 </td>
6307 <td>-3
6308 </td></tr>
6309 <tr>
6310 <td> +1
6311 </td>
6312 <td> -1
6313 </td></tr></table>
6314
6315 !!end
6316
6317 !! test
6318 Table rowspan
6319 !! wikitext
6320 {| border=1
6321 | Cell 1, row 1
6322 |rowspan=2| Cell 2, row 1 (and 2)
6323 | Cell 3, row 1
6324 |-
6325 | Cell 1, row 2
6326 | Cell 3, row 2
6327 |}
6328 !! html
6329 <table border="1">
6330 <tr>
6331 <td> Cell 1, row 1
6332 </td>
6333 <td rowspan="2"> Cell 2, row 1 (and 2)
6334 </td>
6335 <td> Cell 3, row 1
6336 </td></tr>
6337 <tr>
6338 <td> Cell 1, row 2
6339 </td>
6340 <td> Cell 3, row 2
6341 </td></tr></table>
6342
6343 !! end
6344
6345 !! test
6346 Nested table
6347 !! wikitext
6348 {| border=1
6349 | &alpha;
6350 |
6351 {| bgcolor=#ABCDEF border=2
6352 |nested
6353 |-
6354 |table
6355 |}
6356 |the original table again
6357 |}
6358 !! html
6359 <table border="1">
6360 <tr>
6361 <td> &#945;
6362 </td>
6363 <td>
6364 <table bgcolor="#ABCDEF" border="2">
6365 <tr>
6366 <td>nested
6367 </td></tr>
6368 <tr>
6369 <td>table
6370 </td></tr></table>
6371 </td>
6372 <td>the original table again
6373 </td></tr></table>
6374
6375 !! end
6376
6377 !! test
6378 Invalid attributes in table cell (T3830)
6379 !! wikitext
6380 {|
6381 |Cell:|broken
6382 |}
6383 !! html
6384 <table>
6385 <tr>
6386 <td>broken
6387 </td></tr></table>
6388
6389 !! end
6390
6391 !! test
6392 Table cell attributes: Pipes protected by nowikis should be treated as a plain character
6393 !! wikitext
6394 {|
6395 | title="foo" |bar
6396 | title="foo<nowiki>|</nowiki>" |bar
6397 | title="foo<nowiki>|</nowiki>" bar
6398 |}
6399 !! html/php
6400 <table>
6401 <tr>
6402 <td title="foo">bar
6403 </td>
6404 <td title="foo&#124;">bar
6405 </td>
6406 <td> title="foo|" bar
6407 </td></tr></table>
6408
6409 !! html/parsoid
6410 <table>
6411 <tbody><tr><td title="foo">bar</td>
6412 <td title="foo|" data-parsoid='{"a":{"title":"foo|"},"sa":{"title":"foo&lt;nowiki>|&lt;/nowiki>"},"autoInsertedEnd":true}'>bar</td>
6413 <td> title="foo<span typeof="mw:Nowiki">|</span>" bar</td></tr>
6414 </tbody></table>
6415 !! end
6416
6417 # See: http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html
6418 # N.B. The "|}" to close the table is missing from the input, so parsoid's
6419 # *2wt modes will fail.
6420 !! test
6421 Table security: embedded pipes
6422 !! options
6423 parsoid=wt2html,html2html
6424 !! wikitext
6425 {|
6426 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
6427 !! html/php
6428 <table>
6429 <tr>
6430 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
6431 <td>]" onmouseover="alert(document.cookie)"&gt;test
6432 </td>
6433 </tr>
6434 </table>
6435
6436 !! html/parsoid
6437 <table><tbody>
6438 <tr>
6439 <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>
6440 !! end
6441
6442 !! test
6443 Element attributes with double ! should not be broken up by <th>
6444 !! wikitext
6445 {|
6446 ! hi <div class="!!">ha</div> ho
6447 |}
6448 !! html/php
6449 <table>
6450 <tr>
6451 <th> hi <div class="!!">ha</div> ho
6452 </th></tr></table>
6453
6454 !! html/parsoid
6455 <table>
6456 <tbody><tr><th> hi <div class="!!" data-parsoid='{"stx":"html"}'>ha</div> ho</th></tr>
6457 </tbody></table>
6458 !! end
6459
6460 !! test
6461 ! and || in element attributes should not be parsed as <th>/<td>
6462 !! wikitext
6463 {|
6464 | <div style="color: red !important;" data-contrived="put this here ||">hi</div>
6465 |}
6466 !! html/php
6467 <table>
6468 <tr>
6469 <td> <div style="color: red !important;" data-contrived="put this here &#124;&#124;">hi</div>
6470 </td></tr></table>
6471
6472 !! html/parsoid
6473 <table>
6474 <tbody><tr><td> <div style="color: red !important;" data-contrived="put this here ||" data-parsoid='{"stx":"html"}'>hi</div></td></tr>
6475 </tbody></table>
6476 !! end
6477
6478 # FIXME: The output seems broken. Filed as T110268.
6479 !! test
6480 ! and || in td attributes should not be parsed as <th>/<td>
6481 !! options
6482 parsoid=wt2html
6483 !! wikitext
6484 {|
6485 | style="color: red !important;" data-contrived="put this here ||" | foo
6486 |}
6487 !! html/php
6488 <table>
6489 <tr>
6490 <td> style="color: red !important;" data-contrived="put this here </td>
6491 <td> foo
6492 </td></tr></table>
6493
6494 !! html/parsoid
6495 <table>
6496 <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>
6497 </tbody></table>
6498 !! end
6499
6500 !! test
6501 Break on | in element attribute in template
6502 !! options
6503 parsoid=wt2html,html2html
6504 !! wikitext
6505 {{echo|1=<div class="hi|ho">ha</div>}}
6506 !! html/php
6507 <p>ho"&gt;ha&lt;/div&gt;
6508 </p>
6509 !! html/parsoid
6510 <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>
6511 !! end
6512
6513 !! test
6514 Break on | in element attribute name in template
6515 !! wikitext
6516 {{echo|<div cla|ss="hiho">ha</div>}}
6517 !! html/parsoid
6518 <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>
6519 !! end
6520
6521 !! test
6522 Don't break on | in extension attribute in template
6523 !! wikitext
6524 {{echo|<ref name="hi|ho">ha</ref>}}
6525
6526 <references />
6527 !! html/parsoid
6528 <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>
6529
6530 <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>
6531 !! end
6532
6533 ## We don't support roundtripping of these attributes in Parsoid.
6534 ## Selective serialization takes care of preventing dirty diffs.
6535 ## But, on edits, we dirty-diff the invalid attribute text.
6536 !! test
6537 Invalid text in table attributes should be discarded
6538 !! options
6539 parsoid=wt2html
6540 !! wikitext
6541 {| <span>boo</span> style='border:1px solid black'
6542 | <span>boo</span> style='color:blue' | 1
6543 |<span>boo</span> style='color:blue'| 2
6544 |}
6545 !! html/php
6546 <table style="border:1px solid black">
6547 <tr>
6548 <td style="color:blue"> 1
6549 </td>
6550 <td style="color:blue"> 2
6551 </td></tr></table>
6552
6553 !! html/parsoid
6554 <table style="border:1px solid black">
6555 <tr>
6556 <td style="color:blue"> 1</td>
6557 <td style="color:blue"> 2</td>
6558 </tr>
6559 </table>
6560 !! end
6561
6562 !! test
6563 Invalid text in table attributes should be preserved by selective serializer
6564 !! options
6565 parsoid={
6566 "modes": ["selser"],
6567 "changes": [
6568 ["td:first-child", "text", "abc"],
6569 ["td + td", "text", "xyz"]
6570 ]
6571 }
6572 !! wikitext
6573 {| <span>boo</span> style='border:1px solid black'
6574 | <span>boo</span> style='color:blue' | 1
6575 |<span>boo</span> style='color:blue'| 2
6576 |}
6577 !! wikitext/edited
6578 {| <span>boo</span> style='border:1px solid black'
6579 | <span>boo</span> style='color:blue' |abc
6580 |<span>boo</span> style='color:blue'|xyz
6581 |}
6582 !! end
6583
6584 !! test
6585 1. Template-generated table cell attributes and cell content
6586 !! wikitext
6587 {|
6588 |{{table_attribs}}
6589 | {{table_attribs}}
6590 || {{table_attribs_5}}
6591 | <!--foo--> <!--bar--> <!--baz--> {{table_attribs}}
6592 |align=center {{table_attribs}}
6593 | <!--foo--> align=center <!--bar--> {{table_attribs}}
6594 |}
6595 !! html
6596 <table>
6597 <tr>
6598 <td style="color:red;">Foo
6599 </td>
6600 <td style="color:red;">Foo
6601 </td>
6602 <td> style="color:red;"</td>
6603 <td>Bar
6604 </td>
6605 <td style="color:red;">Foo
6606 </td>
6607 <td align="center" style="color:red;">Foo
6608 </td>
6609 <td align="center" style="color:red;">Foo
6610 </td></tr></table>
6611
6612 !! end
6613
6614 !! test
6615 2. Template-generated table cell attributes and cell content
6616 !! wikitext
6617 {|
6618 |{{table_attribs_2}}
6619 |}
6620 !! html/php
6621 <table>
6622 <tr>
6623 <td style="color:red;">Foo
6624 </td>
6625 <td>Bar</td>
6626 <td>Baz
6627 </td></tr></table>
6628
6629 !! html/parsoid
6630 <table>
6631 <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>
6632 <td about="#mwt1">Bar</td><td about="#mwt1">Baz</td></tr>
6633 </tbody></table>
6634 !! end
6635
6636 !! test
6637 3. Template-generated table cell attributes and cell content
6638 !! wikitext
6639 {|
6640 !align=center {{table_header_cells}}
6641 |-
6642 |align=center {{table_cells}}
6643 |}
6644 !! html/php
6645 <table>
6646 <tr>
6647 <th align="center" style="color:red;">Foo</th>
6648 <th style="color:red;"><i>Bar</i></th>
6649 <th style="color:brown;"><i>Foo</i> and Baz
6650 </th></tr>
6651 <tr>
6652 <td align="center" style="color:red;">Foo</td>
6653 <td style="color:red;"><i>Bar</i></td>
6654 <td style="color:brown;"><i>Foo</i> and Baz
6655 </td></tr></table>
6656
6657 !! html/parsoid
6658 <table>
6659 <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>
6660 <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>
6661 </tbody></table>
6662 !! end
6663
6664 !! test
6665 4. Template-generated table cell attributes and cell content inside a templated table
6666 !! wikitext
6667 {{tbl-start}}
6668 !align=center {{table_header_cells}}
6669 |-
6670 |align=center {{table_cells}}
6671 {{tbl-end}}
6672 !! html/php
6673 <table>
6674 <tr>
6675 <th align="center" style="color:red;">Foo</th>
6676 <th style="color:red;"><i>Bar</i></th>
6677 <th style="color:brown;"><i>Foo</i> and Baz
6678 </th></tr>
6679 <tr>
6680 <td align="center" style="color:red;">Foo</td>
6681 <td style="color:red;"><i>Bar</i></td>
6682 <td style="color:brown;"><i>Foo</i> and Baz
6683 </td></tr></table>
6684
6685 !! html/parsoid
6686 <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}}]}'>
6687 <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>
6688 <tr>
6689 <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>
6690 </tbody></table>
6691 !! end
6692
6693 ## Edge case fix to prevent future regressions
6694 !! test
6695 T107652: <ref>s in templates that also generate table cell attributes should be rendered properly
6696 !! wikitext
6697 {|
6698 |{{table_attribs_7}}
6699 |}
6700 <references />
6701 !! html/parsoid
6702 <table>
6703 <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>
6704 </tbody></table>
6705 <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>
6706 !! end
6707
6708 !! test
6709 Table with row followed by newlines and table heading
6710 !! options
6711 parsoid=wt2html,html2html
6712 !! wikitext
6713 {|
6714 |-
6715
6716 ! foo
6717 |}
6718 !! html/*
6719 <table>
6720
6721
6722 <tr>
6723 <th> foo
6724 </th></tr></table>
6725
6726 !! end
6727
6728 !! test
6729 Table with empty line following the start tag
6730 !! options
6731 parsoid=wt2html,html2html
6732 !! wikitext
6733 {|
6734
6735 |-
6736 | foo
6737 |}
6738 !! html/*
6739 <table>
6740
6741
6742 <tr>
6743 <td> foo
6744 </td></tr></table>
6745
6746 !! end
6747
6748 !! test
6749 Table attributes with empty value
6750 !! options
6751 parsoid=wt2html,html2html
6752 !! wikitext
6753 {|
6754 | style=| hello
6755 |}
6756 !! html/php
6757 <table>
6758 <tr>
6759 <td style=""> hello
6760 </td></tr></table>
6761
6762 !! html/parsoid
6763 <table>
6764 <tbody><tr><td style=""> hello</td></tr>
6765 </tbody></table>
6766 !! end
6767
6768 !! test
6769 Wikitext table with a lot of comments
6770 !! wikitext
6771 {|
6772 <!-- c0 -->
6773 | foo
6774 <!-- c1 -->
6775 |-<!-- c2 -->
6776 <!-- c3 -->
6777 |<!-- c4 -->
6778 <!-- c5 -->
6779 |}
6780 !! html
6781 <table>
6782 <tr>
6783 <td> foo
6784 </td></tr>
6785 <tr>
6786 <td>
6787 </td></tr></table>
6788
6789 !! end
6790
6791 !! test
6792 Wikitext table comments represented in parsoid dom
6793 !! wikitext
6794 {|<!--c1--><!--c2-->
6795 |-<!--c3-->
6796 | x
6797 |}
6798 !! html/php+tidy
6799 <table>
6800 <tr>
6801 <td>x</td>
6802 </tr>
6803 </table>
6804 !! html/parsoid
6805 <table><!--c1--><!--c2-->
6806 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'><!--c3-->
6807 <td data-parsoid='{"autoInsertedEnd":true}'> x</td></tr>
6808 </tbody></table>
6809 !! end
6810
6811 !! test
6812 Wikitext table with double-line table cell
6813 !! wikitext
6814 {|
6815 |a
6816 b
6817 |}
6818 !! html
6819 <table>
6820 <tr>
6821 <td>a
6822 <p>b
6823 </p>
6824 </td></tr></table>
6825
6826 !! end
6827
6828 !! test
6829 Table cell with a single comment
6830 !! wikitext
6831 {|
6832 | <!-- c1 -->
6833 | a
6834 |}
6835 !! html
6836 <table>
6837 <tr>
6838 <td>
6839 </td>
6840 <td> a
6841 </td></tr></table>
6842
6843 !! end
6844
6845 !! test
6846 Table-cell after a comment-only-empty-line
6847 !! wikitext
6848 {|
6849 |a
6850 <!--c1-->
6851 <!--c2-->| b
6852 |}
6853 !! html
6854 <table>
6855 <tr>
6856 <td>a
6857 </td>
6858 <td> b
6859 </td></tr></table>
6860
6861 !! html/parsoid
6862 <table>
6863 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>a</td>
6864 <!--c1-->
6865 <!--c2--><td data-parsoid='{"autoInsertedEnd":true}'> b</td></tr>
6866 </tbody></table>
6867
6868 !! end
6869
6870 !! test
6871 Build table with {{!}}
6872 !! wikitext
6873 {{{!}} class="wikitable"
6874 ! header
6875 ! second header
6876 {{!}}- style="color:red;"
6877 {{!}} data {{!}}{{!}} style="color:red;" {{!}} second data
6878 {{!}}}
6879 !! html
6880 <table class="wikitable">
6881 <tr>
6882 <th> header
6883 </th>
6884 <th> second header
6885 </th></tr>
6886 <tr style="color:red;">
6887 <td> data </td>
6888 <td style="color:red;"> second data
6889 </td></tr></table>
6890
6891 !! end
6892
6893 !! test
6894 Build table with pipe as data
6895 !! wikitext
6896 {| class="wikitable"
6897 ! header
6898 ! second header
6899 |- style="color:red;"
6900 | data || style="color:red;" | second data
6901 |-
6902 | style="color:red;" | data with | || style="color:red;" | second data with |
6903 |-
6904 || data with | ||| second data with |
6905 |}
6906 !! html
6907 <table class="wikitable">
6908 <tr>
6909 <th> header
6910 </th>
6911 <th> second header
6912 </th></tr>
6913 <tr style="color:red;">
6914 <td> data </td>
6915 <td style="color:red;"> second data
6916 </td></tr>
6917 <tr>
6918 <td style="color:red;"> data with | </td>
6919 <td style="color:red;"> second data with |
6920 </td></tr>
6921 <tr>
6922 <td> data with | </td>
6923 <td> second data with |
6924 </td></tr></table>
6925
6926 !! end
6927
6928 !! test
6929 Build table with wikilink
6930 !! wikitext
6931 {| class="wikitable"
6932 ! header || second header
6933 |- style="color:red;"
6934 | data [[Main Page|linktext]] || second data [[Main Page|linktext]]
6935 |-
6936 | data || second data [[Main Page|link|text with pipe]]
6937 |}
6938 !! html
6939 <table class="wikitable">
6940 <tr>
6941 <th> header </th>
6942 <th> second header
6943 </th></tr>
6944 <tr style="color:red;">
6945 <td> data <a href="/wiki/Main_Page" title="Main Page">linktext</a> </td>
6946 <td> second data <a href="/wiki/Main_Page" title="Main Page">linktext</a>
6947 </td></tr>
6948 <tr>
6949 <td> data </td>
6950 <td> second data <a href="/wiki/Main_Page" title="Main Page">link|text with pipe</a>
6951 </td></tr></table>
6952
6953 !! end
6954
6955 # The expected HTML structure in this test is debatable. The PHP parser does
6956 # not parse this kind of table at all. The main focus for Parsoid is on
6957 # round-tripping, so this output is ok for now. TODO: revisit!
6958 !! test
6959 Wikitext table with html-syntax row
6960 !! wikitext
6961 {|
6962 |-
6963 <td>foo</td>
6964 |}
6965 !! html/parsoid
6966 <table>
6967 <tbody>
6968 <tr>
6969 <td>foo</td></tr></tbody></table>
6970 !! end
6971
6972 ## Note that Parsoid output differs from PHP and PHP+tidy here.
6973 ## The lack of <tr> tags in the PHP output is arguably a bug in the
6974 ## PHP parser, which tidy then compounds by fostering the content
6975 ## entirely out of the table. Parsoid recognizes the table context
6976 ## and generates <tr> and <td> wrappers as needed. Hopefully nobody
6977 ## depends on PHP's treatment of broken table markup!
6978 !! test
6979 Implicit <td> after a |-
6980 !! options
6981 parsoid=wt2html,html2html
6982 !! wikitext
6983 {|
6984 |-
6985 a
6986 |}
6987 !! html/php
6988 <table>
6989
6990 a
6991 </table>
6992
6993 !! html/php+tidy
6994 <p>a</p>
6995 !! html/parsoid
6996 <table>
6997 <tr><td>a</td></tr>
6998 </table>
6999 !! end
7000
7001 # Again, Parsoid adds implicit <td>s here, PHP and Tidy strip the b out.
7002 !! test
7003 <pre> tags should be recognized in an explicit <td> context, but not in an implicit <td> context
7004 !! options
7005 parsoid=wt2html,html2html
7006 !! wikitext
7007 {|
7008 |-
7009 |
7010 a
7011 |-
7012 b
7013 |}
7014 !! html/php
7015 <table>
7016
7017 <tr>
7018 <td>
7019 <pre>a
7020 </pre>
7021 </td></tr>
7022 b
7023 </table>
7024
7025 !! html/php+tidy
7026 <p>b</p>
7027 <table>
7028 <tr>
7029 <td>
7030 <pre>
7031 a
7032 </pre></td>
7033 </tr>
7034 </table>
7035 !! html/parsoid
7036 <table>
7037 <tbody>
7038 <tr><td><pre>a</pre></td></tr>
7039 <tr><td> b</td></tr>
7040 </tbody>
7041 </table>
7042 !! end
7043
7044 # PHP + Tidy strips the list out of the table; Parsoid wraps it.
7045 # Parsoid generates the missing <td>, so wt2wt won't succeed.
7046 !! test
7047 Lists should be recognized in an implicit <td> context
7048 !! options
7049 parsoid=wt2html,html2html
7050 !! wikitext
7051 {|
7052 |-
7053 *a
7054 |}
7055 !! html/php
7056 <table>
7057
7058 <ul><li>a</li></ul>
7059 </table>
7060
7061 !! html/php+tidy
7062 <ul>
7063 <li>a</li>
7064 </ul>
7065 !! html/parsoid
7066 <table>
7067 <tr>
7068 <td><ul>
7069 <li>a</li>
7070 </ul></td>
7071 </tr>
7072 </table>
7073 !! end
7074
7075 !! test
7076 Table cells not properly parsed in an implicit-td context
7077 !! wikitext
7078 {|
7079 |-
7080 {{table_attribs_4}} || a || b
7081 |}
7082 !! html/php+tidy
7083 <table>
7084 <tr>
7085 <td style="background-color:#DC241f;" width="10px"></td>
7086 <td>a</td>
7087 <td>b</td>
7088 </tr>
7089 </table>
7090 !! html/parsoid
7091 <table>
7092 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
7093 <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}}," "]}'> </td><td data-parsoid='{"stx_v":"row","autoInsertedEnd":true}'> a </td><td data-parsoid='{"stx_v":"row","autoInsertedEnd":true}'> b</td></tr>
7094 </tbody></table>
7095 !! end
7096
7097 !! test
7098 Parsoid: Round-trip tables directly followed by content (T53219)
7099 !! options
7100 parsoid=wt2html,wt2wt
7101 !! wikitext
7102 {|
7103 |foo
7104 |} bar
7105
7106 {|
7107 |baz
7108 |}<b>quux</b>
7109 !! html+tidy
7110 <table>
7111 <tr>
7112 <td>foo</td>
7113 </tr>
7114 </table>
7115 <p>bar</p>
7116 <table>
7117 <tr>
7118 <td>baz</td>
7119 </tr>
7120 </table>
7121 <p><b>quux</b></p>
7122 !! end
7123
7124 !! test
7125 Parsoid: Default to a newline after tables in new content (T53219)
7126 !! options
7127 parsoid=html2wt
7128 !! html/parsoid
7129 <table><tbody>
7130 <tr><td>foo</td></tr></tbody></table> bar
7131 <table><tbody>
7132 <tr><td>baz</td></tr></tbody></table><b>quux</b>
7133 !! wikitext
7134 {|
7135 |foo
7136 |}
7137 <nowiki> </nowiki>bar
7138 {|
7139 |baz
7140 |}
7141 '''quux'''
7142 !! end
7143
7144 !! test
7145 Parsoid: newline inducing block nodes don't suppress <nowiki>
7146 !! options
7147 parsoid=html2wt
7148 !! html/parsoid
7149 a<h1>foo</h1>
7150 !! wikitext
7151 <nowiki> </nowiki>a
7152
7153 = foo =
7154 !! end
7155
7156 !! test
7157 Parsoid: Row-syntax table headings followed by comment & table cells
7158 !! options
7159 parsoid=wt2html,wt2wt
7160 !! wikitext
7161 {|
7162 ! foo || bar
7163 <!-- foo --> || baz || quux
7164 |}
7165 !! html/php
7166 <table>
7167 <tr>
7168 <th> foo </th>
7169 <th> bar
7170 </th>
7171 <td> baz </td>
7172 <td> quux
7173 </td></tr></table>
7174
7175 !! html/parsoid
7176 <table>
7177 <tbody><tr><th> foo </th><th> bar
7178 <!-- foo --> </th><td> baz </td><td> quux</td></tr>
7179 </tbody></table>
7180 !! end
7181
7182 !!test
7183 Parsoid: Recover better from broken table attributes
7184 !!options
7185 parsoid=wt2html
7186 !!wikitext
7187 {| class="foo
7188 | class="bar" |
7189 foo
7190 |}
7191 !!html/php+tidy
7192 <table class="foo">
7193 <tr>
7194 <td class="bar">
7195 <p>foo</p>
7196 </td>
7197 </tr>
7198 </table>
7199 !!html/parsoid
7200 <table class="foo">
7201 <tr>
7202 <td class="bar">
7203 <p>foo</p></td></tr>
7204 </tbody></table>
7205 !!end
7206
7207 !! test
7208 Tables: Digest broken attributes on table and tr tag
7209 !! options
7210 parsoid=wt2html
7211 !! wikitext
7212 {| || |} ++
7213 |- || || ++ --
7214 |- > [
7215 |}
7216 !! html
7217 <table>
7218 <tbody>
7219 <tr></tr>
7220 <tr></tr>
7221 </tbody></table>
7222 !! end
7223
7224 # T137406: Whitespace in the HTML
7225 !! test
7226 1. Generate correct wikitext for tables with thead/tbody/tfoot
7227 !! options
7228 parsoid=html2wt
7229 !! html/parsoid
7230 <table>
7231 <caption>Test</caption>
7232 <thead>
7233 <tr>
7234 <th>Month</th>
7235 <th>Savings</th>
7236 </tr>
7237 </thead>
7238 <tbody>
7239 <tr>
7240 <td>January</td>
7241 <td>$100</td>
7242 </tr>
7243 <tr>
7244 <td>February</td>
7245 <td>$80</td>
7246 </tr>
7247 </tbody>
7248 <tfoot>
7249 <tr>
7250 <td>Sum</td>
7251 <td>$180</td>
7252 </tr>
7253 </tfoot>
7254 </table>
7255 !! wikitext
7256 {|
7257 |+Test
7258 !Month
7259 !Savings
7260 |-
7261 |January
7262 |$100
7263 |-
7264 |February
7265 |$80
7266 |-
7267 |Sum
7268 |$180
7269 |}
7270 !! html/php+tidy
7271 <table>
7272 <caption>Test</caption>
7273 <tr>
7274 <th>Month</th>
7275 <th>Savings</th>
7276 </tr>
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 <tr>
7286 <td>Sum</td>
7287 <td>$180</td>
7288 </tr>
7289 </table>
7290 !! end
7291
7292 # T137406: No whitespace in the HTML
7293 !! test
7294 2. Generate correct wikitext for tables with thead/tbody/tfoot
7295 !! options
7296 parsoid=html2wt
7297 !! html/parsoid
7298 <table><thead><tr><th>heading</th></tr></thead><tbody><tr><td>foo</td></tr></tbody></table>
7299 !! wikitext
7300 {|
7301 !heading
7302 |-
7303 |foo
7304 |}
7305 !! end
7306
7307 !! test
7308 Testing serialization after deletion in references
7309 !! options
7310 parsoid={
7311 "modes": ["wt2wt"],
7312 "changes": [
7313 ["#x", "remove"]
7314 ]
7315 }
7316 !! wikitext
7317 hi <ref><div id="x">ho</div></ref>
7318
7319 <references />
7320 !! wikitext/edited
7321 hi <ref></ref>
7322
7323 <references />
7324 !! end
7325
7326 !!test
7327 Testing serialization after deletion of table cells
7328 !!options
7329 parsoid={
7330 "modes": ["wt2wt", "selser"],
7331 "changes": [
7332 ["#x", "remove"]
7333 ]
7334 }
7335 !!wikitext
7336 {|
7337 !h1 !!h2 !!h3
7338 | id="x" |c1 {{!}}{{!}}{{!}}c2 |||c3
7339 |}
7340 !! wikitext/edited
7341 {|
7342 !h1 !!h2 !!h3
7343 |c2 |||c3
7344 |}
7345 !!end
7346
7347 !! test
7348 Testing selser after addition of new row before first row (T125419)
7349 !! options
7350 parsoid={
7351 "modes": ["wt2wt", "selser"],
7352 "changes": [
7353 [ "tr", "before", "<tr><td>X</td></tr>" ]
7354 ]
7355 }
7356 !! wikitext
7357 {|
7358 |a
7359 |}
7360 !! wikitext/edited
7361 {|
7362 |X
7363 |-
7364 |a
7365 |}
7366 !! end
7367
7368 !! test
7369 Serialize new table rows in a HTML table using HTML tags
7370 !! options
7371 parsoid={
7372 "modes": ["wt2wt", "selser"],
7373 "changes": [
7374 [ "tr", "before", "<tr><td>X</td></tr>" ]
7375 ]
7376 }
7377 !! wikitext
7378 <table><tr><td>a</td></tr></table>
7379 !! wikitext/edited
7380 <table><tr><td>X</td></tr><tr><td>a</td></tr></table>
7381 !! end
7382
7383 !! test
7384 Serialize new table cells in a HTML row using HTML tags
7385 !! options
7386 parsoid={
7387 "modes": ["wt2wt", "selser"],
7388 "changes": [
7389 [ "td", "before", "<td>X</td>" ]
7390 ]
7391 }
7392 !! wikitext
7393 <table><tr><td>a</td></tr></table>
7394 !! wikitext/edited
7395 <table><tr><td>X</td><td>a</td></tr></table>
7396 !! end
7397
7398 !! test
7399 Wikitext tables can be nested inside HTML tables
7400 !! options
7401 parsoid=html2wt
7402 !! html
7403 <table data-parsoid='{"stx":"html"}'>
7404 <tr><td>
7405 <table>
7406 <tr><td>foo</td></tr>
7407 </table>
7408 </td></tr>
7409 </table>
7410 !! wikitext
7411 <table>
7412 <tr><td>
7413 {|
7414 |foo
7415 |}
7416 </td></tr>
7417 </table>
7418 !! end
7419
7420 !! test
7421 Serialize wikitext list items as HTML list items when embedded in a HTML list
7422 !! options
7423 parsoid=html2wt
7424 !! html
7425 <ul data-parsoid='{"stx": "html"}'>
7426 <li data-parsoid='{}'>a</li>
7427 <li>b</li>
7428 </ul>
7429 !! wikitext
7430 <ul>
7431 <li>a</li>
7432 <li>b</li>
7433 </ul>
7434 !! end
7435
7436 # SSS FIXME: Is this actually a good thing given the
7437 # odd nested list output that is generated by MW?
7438 # <ul><li>foo<ul>..</ul></li></ul> instead of
7439 # <ul><li>foo</li><ul>..</ul></ul>
7440 !! test
7441 Wikitext lists can be nested inside HTML lists
7442 !! options
7443 parsoid=html2wt
7444 !! html
7445 <ul data-parsoid='{"stx": "html"}'>
7446 <li data-parsoid='{"stx": "html"}'>a
7447 <ul><li>b</li></ul>
7448 </li>
7449 </ul>
7450
7451 <ul data-parsoid='{"stx": "html"}'>
7452 <li>x
7453 <ul><li>y</li></ul>
7454 </li>
7455 </ul>
7456 !! wikitext
7457 <ul>
7458 <li>a
7459 * b
7460 </li>
7461 </ul>
7462
7463 <ul>
7464 <li>x
7465 * y
7466 </li>
7467 </ul>
7468 !! end
7469
7470 ###
7471 ### Internal links
7472 ###
7473 !! test
7474 Plain link, capitalized
7475 !! wikitext
7476 [[Main Page]]
7477 !! html
7478 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
7479 </p>
7480 !! end
7481
7482 !! test
7483 Plain link, uncapitalized
7484 !! wikitext
7485 [[main Page]]
7486 !! html
7487 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
7488 </p>
7489 !! end
7490
7491 !! test
7492 Piped link
7493 !! wikitext
7494 [[Main Page|The Main Page]]
7495 !! html
7496 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
7497 </p>
7498 !! end
7499
7500 !! test
7501 Piped link with comment in link text
7502 !! wikitext
7503 [[Main Page|The Main<!--front--> Page]]
7504 !! html
7505 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
7506 </p>
7507 !! end
7508
7509 !! test
7510 Piped link with multiple pipe characters in link text
7511 !! wikitext
7512 [[Main Page||The|Main|Page|]]
7513 !! html/php
7514 <p><a href="/wiki/Main_Page" title="Main Page">|The|Main|Page|</a>
7515 </p>
7516 !! html/parsoid
7517 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">|The|Main|Page|</a></p>
7518 !! end
7519
7520 !! test
7521 Piped link with no link text
7522 !! wikitext
7523 [[Thomas Bek (bishop of St David's)|]]
7524 !! html/php
7525 <p>[[Thomas Bek (bishop of St David's)|]]
7526 </p>
7527 !! html/parsoid
7528 <p>[[Thomas Bek (bishop of St David's)|]]</p>
7529 !! end
7530
7531 !! test
7532 Piped link with empty link text
7533 !! wikitext
7534 [[Main Page|<nowiki />]] - empty nowiki
7535 [[Main Page| ]] - empty space
7536 [[Main Page|&nbsp;]] - empty non breaking space
7537 !! html/php
7538 <p><a href="/wiki/Main_Page" title="Main Page"></a> - empty nowiki
7539 <a href="/wiki/Main_Page" title="Main Page"> </a> - empty space
7540 <a href="/wiki/Main_Page" title="Main Page">&#160;</a> - empty non breaking space
7541 </p>
7542 !! html/parsoid
7543 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page"><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki />"}'/></a> - empty nowiki
7544 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page"> </a> - empty space
7545 <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>
7546 !! end
7547
7548 !! test
7549 Broken link
7550 !! wikitext
7551 [[Zigzagzogzagzig]]
7552 !! html
7553 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
7554 </p>
7555 !! end
7556
7557 !! test
7558 Broken link with fragment
7559 !! wikitext
7560 [[Zigzagzogzagzig#zug]]
7561 !! html
7562 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
7563 </p>
7564 !! end
7565
7566 !! test
7567 Special page link with fragment
7568 !! wikitext
7569 [[Special:Version#anchor]]
7570 !! html
7571 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
7572 </p>
7573 !! end
7574
7575 !! test
7576 Nonexistent special page link with fragment
7577 !! wikitext
7578 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
7579 !! html
7580 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
7581 </p>
7582 !! end
7583
7584 !! test
7585 Link with prefix
7586 !! wikitext
7587 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
7588 !! html
7589 <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>
7590 </p>
7591 !! end
7592
7593 !! test
7594 Link with suffix
7595 !! wikitext
7596 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
7597 !! html
7598 <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>!!!
7599 </p>
7600 !! end
7601
7602 !! article
7603 prefixed article
7604 !! text
7605 Some text
7606 !! endarticle
7607
7608 !! test
7609 T45661: Piped links with identical prefixes
7610 !! wikitext
7611 [[prefixed article|prefixed articles with spaces]]
7612
7613 [[prefixed article|prefixed articlesaoeu]]
7614
7615 [[Main Page|Main Page test]]
7616 !! html
7617 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
7618 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
7619 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
7620 </p>
7621 !! end
7622
7623
7624 !! test
7625 Link with HTML entity in suffix / tail
7626 !! wikitext
7627 [[Main Page]]&quot;, [[Main Page]]&#97;
7628 !! html/php
7629 <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;
7630 </p>
7631 !! html/parsoid
7632 <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>
7633 !! end
7634
7635 !! test
7636 Link with 3 brackets
7637 !! wikitext
7638 [[[Main Page]]]
7639 Foo [[[Main Page]]]
7640 !! html
7641 <p>[[[Main Page]]]
7642 Foo [[[Main Page]]]
7643 </p>
7644 !! end
7645
7646 !! test
7647 Link with 4 brackets
7648 !! wikitext
7649 [[[[Main Page]]]]
7650 !! html
7651 <p>[[<a href="/wiki/Main_Page" title="Main Page">Main Page</a>]]
7652 </p>
7653 !! end
7654
7655 !! test
7656 Piped link with 3 brackets
7657 !! wikitext
7658 [[[main page|the main page]]]
7659 !! html
7660 <p>[[[main page|the main page]]]
7661 </p>
7662 !! end
7663
7664 !! test
7665 Piped link with extlink-like text
7666 !! wikitext
7667 [[Main Page|[bar]]]
7668 [[Main Page|This is a [bar]]]
7669 !! html/php
7670 <p><a href="/wiki/Main_Page" title="Main Page">[bar]</a>
7671 <a href="/wiki/Main_Page" title="Main Page">This is a [bar]</a>
7672 </p>
7673 !! html/parsoid
7674 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>[bar]</a>
7675 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>This is a [bar]</a></p>
7676 !! end
7677
7678 !! test
7679 Link with multiple pipes
7680 !! wikitext
7681 [[Main Page|The|Main|Page]]
7682 !! html
7683 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
7684 </p>
7685 !! end
7686
7687 !! test
7688 Anchor containing a #. (T65430)
7689 !! wikitext
7690 [[Main Page#And#Link]]
7691 !! html/php
7692 <p><a href="/wiki/Main_Page#And.23Link" title="Main Page">Main Page#And#Link</a>
7693 </p>
7694 !! html/parsoid
7695 <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>
7696 !! end
7697
7698 !! test
7699 Link to namespaces
7700 !! wikitext
7701 [[Talk:Parser testing]], [[Meta:Disclaimers]]
7702 !! html
7703 <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>
7704 </p>
7705 !! end
7706
7707 !! test
7708 Link with space in namespace
7709 !! wikitext
7710 [[User talk:Foo bar]]
7711 !! html
7712 <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>
7713 </p>
7714 !! end
7715
7716 !! article
7717 MemoryAlpha:AlphaTest
7718 !! text
7719 This is an article in the MemoryAlpha namespace
7720 (which shadows the memoryalpha interwiki link).
7721 !! endarticle
7722
7723 !! test
7724 Namespace takes precedence over interwiki link (T53680)
7725 !! wikitext
7726 [[MemoryAlpha:AlphaTest]]
7727 !! html
7728 <p><a href="/wiki/MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
7729 </p>
7730 !! end
7731
7732 # The previous test doesn't work correctly in html2*, due to not recognizing the
7733 # link as an internal one. This one checks for the correct behavior.
7734 !! test
7735 Link to namespace preferred over interwiki with correct rel attribute
7736 !! options
7737 parsoid=html2wt,html2html
7738 !! html/parsoid
7739 <p><a rel="mw:WikiLink" href="./MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a></p>
7740 !! wikitext
7741 [[MemoryAlpha:AlphaTest]]
7742 !! end
7743
7744 !! test
7745 Piped link to namespace
7746 !! wikitext
7747 [[Meta:Disclaimers|The disclaimers]]
7748 !! html
7749 <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>
7750 </p>
7751 !! end
7752
7753 !! test
7754 Link containing }
7755 !! wikitext
7756 [[Usually caused by a typo (oops}]]
7757 !! html
7758 <p>[[Usually caused by a typo (oops}]]
7759 </p>
7760 !! end
7761
7762 !! article
7763 7% Solution
7764 !! text
7765 Just a test of an article title containing a percent.
7766 !! endarticle
7767
7768 !! test
7769 Link containing % (not as a hex sequence)
7770 !! wikitext
7771 [[7% Solution]]
7772 [[7% Solution|7%25 Solution]]
7773 !! html/php
7774 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
7775 <a href="/wiki/7%25_Solution" title="7% Solution">7%25 Solution</a>
7776 </p>
7777 !! html/parsoid
7778 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a>
7779 <a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7%25 Solution</a></p>
7780 !! end
7781
7782 # note that the parsoid HTML is identical to the previous test output,
7783 # so the previous test ensures that the html2wt mode will generate the
7784 # "not as a hex sequence" wikitext.
7785 !! test
7786 Link containing % as a single hex sequence interpreted to char
7787 !! options
7788 parsoid=wt2wt,wt2html,html2html
7789 !! wikitext
7790 [[7%25 Solution]]
7791 [[7%25 Solution|7%25 Solution]]
7792 !! html/php
7793 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
7794 <a href="/wiki/7%25_Solution" title="7% Solution">7%25 Solution</a>
7795 </p>
7796 !! html/parsoid
7797 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a>
7798 <a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7%25 Solution</a></p>
7799 !!end
7800
7801 !! test
7802 Link containing % as a double hex sequence interpreted to hex sequence
7803 !! wikitext
7804 [[7%2525 Solution]]
7805 !! html
7806 <p>[[7%2525 Solution]]
7807 </p>
7808 !!end
7809
7810 ## Example for such a section: == < ==
7811 !! test
7812 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
7813 !! wikitext
7814 [[%23%3c]][[%23%3e]]
7815 !! html/php
7816 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
7817 </p>
7818 !! html/parsoid
7819 <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>
7820 !! end
7821
7822 !! test
7823 Link containing "<#" and ">#" as a hex sequences
7824 !! wikitext
7825 [[%3c%23]][[%3e%23]]
7826 !! html
7827 <p>[[%3c%23]][[%3e%23]]
7828 </p>
7829 !! end
7830
7831 !! test
7832 Link containing an equals sign
7833 !! wikitext
7834 [[Special:BookSources/isbn=4-00-026157-6]]
7835 !! html/php
7836 <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>
7837 </p>
7838 !! html/parsoid
7839 <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>
7840 !! end
7841
7842 !! article
7843 Foo~bar
7844 !! text
7845 Just a test of an article title containing a tilde.
7846 !! endarticle
7847
7848 # note that links containing signatures, like [[Foo~~~~]], are
7849 # massaged by the pre-save transform (PST) and so the tildes are never
7850 # seen by the parser.
7851 !! test
7852 Link containing a tilde
7853 !! wikitext
7854 [[Foo~bar]]
7855 !! html/php
7856 <p><a href="/wiki/Foo~bar" title="Foo~bar">Foo~bar</a>
7857 </p>
7858 !! html/parsoid
7859 <p><a rel="mw:WikiLink" href="./Foo~bar" title="Foo~bar">Foo~bar</a></p>
7860 !! end
7861
7862 !! test
7863 Link containing double-single-quotes '' (T6598)
7864 !! wikitext
7865 [[Lista d''e paise d''o munno]]
7866 !! html/php
7867 <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>
7868 </p>
7869 !! html/parsoid
7870 <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>
7871 !! end
7872
7873 !! test
7874 Link containing double quotes and spaces
7875 !! wikitext
7876 [[Cool "Gator"]]
7877 !! html/php
7878 <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>
7879 </p>
7880 !! html/parsoid
7881 <p><a rel="mw:WikiLink" href="./Cool_%22Gator%22" title='Cool "Gator"'>Cool "Gator"</a></p>
7882 !! end
7883
7884 !! test
7885 Link containing double-single-quotes '' in text (T6598 sanity check)
7886 !! wikitext
7887 Some [[Link|pretty ''italics'' and stuff]]!
7888 !! html/php
7889 <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>!
7890 </p>
7891 !! html/parsoid
7892 <p>Some <a rel="mw:WikiLink" href="./Link" title="Link">pretty <i>italics</i> and stuff</a>!</p>
7893 !! end
7894
7895 !! test
7896 Link containing double-single-quotes '' in text embedded in italics (T6598 sanity check)
7897 !! wikitext
7898 ''Some [[Link|pretty ''italics'' and stuff]]!''
7899 !! html
7900 <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>
7901 </p>
7902 !! end
7903
7904 !! test
7905 Link with double quotes in title part (literal) and alternate part (interpreted)
7906 !! wikitext
7907 [[File:Denys_Savchenko_''Pentecoste''.jpg]]
7908
7909 [[''Pentecoste'']]
7910
7911 [[''Pentecoste''|Pentecoste]]
7912
7913 [[''Pentecoste''|''Pentecoste'']]
7914 !! html/php
7915 <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>
7916 </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>
7917 </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>
7918 </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>
7919 </p>
7920 !! html/parsoid
7921 <p><span class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}]}'><a href="./File:Denys_Savchenko_''Pentecoste''.jpg"><img resource="./File:Denys_Savchenko_''Pentecoste''.jpg" src="./Special:FilePath/Denys_Savchenko_''Pentecoste''.jpg" height="220" width="220"/></a></span></p>
7922 <p><a rel="mw:WikiLink" href="./''Pentecoste''" title="''Pentecoste''">''Pentecoste''</a></p>
7923 <p><a rel="mw:WikiLink" href="./''Pentecoste''" title="''Pentecoste''">Pentecoste</a></p>
7924 <p><a rel="mw:WikiLink" href="./''Pentecoste''" title="''Pentecoste''"><i>Pentecoste</i></a></p>
7925 !! end
7926
7927 !! test
7928 Broken image links with HTML captions (T41700)
7929 !! wikitext
7930 [[File:Nonexistent|<script></script>]]
7931 [[File:Nonexistent|100x100px|<script></script>]]
7932 [[File:Nonexistent|&lt;]]
7933 [[File:Nonexistent|a<i>b</i>c]]
7934 !! html/php
7935 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
7936 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
7937 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
7938 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
7939 </p>
7940 !! html/parsoid
7941 <p><span class="mw-default-size" typeof="mw:Error mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"&lt;script>&lt;/script>"}]}' data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}],"caption":"&amp;lt;script>&amp;lt;/script>"}'><a href="./File:Nonexistent" data-parsoid='{"a":{"href":"./File:Nonexistent"},"sa":{}}'><img resource="./File:Nonexistent" src="./Special:FilePath/Nonexistent" height="220" width="220" data-parsoid='{"a":{"resource":"./File:Nonexistent","height":"220","width":"220"},"sa":{"resource":"File:Nonexistent"}}'/></a></span>
7942 <span typeof="mw:Error mw:Image" data-parsoid='{"optList":[{"ck":"width","ak":"100x100px"},{"ck":"caption","ak":"&lt;script>&lt;/script>"}]}' data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}],"caption":"&amp;lt;script>&amp;lt;/script>"}'><a href="./File:Nonexistent" data-parsoid='{"a":{"href":"./File:Nonexistent"},"sa":{}}'><img resource="./File:Nonexistent" src="./Special:FilePath/Nonexistent" height="100" width="100" data-parsoid='{"a":{"resource":"./File:Nonexistent","height":"100","width":"100"},"sa":{"resource":"File:Nonexistent"}}'/></a></span>
7943 <span class="mw-default-size" typeof="mw:Error mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"&amp;lt;"}]}' data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}],"caption":"&lt;span typeof=\"mw:Entity\" data-parsoid=&#39;{\"src\":\"&amp;amp;lt;\",\"srcContent\":\"&amp;lt;\",\"dsr\":[107,111,null,null]}&#39;>&amp;lt;&lt;/span>"}'><a href="./File:Nonexistent" data-parsoid='{"a":{"href":"./File:Nonexistent"},"sa":{}}'><img resource="./File:Nonexistent" src="./Special:FilePath/Nonexistent" height="220" width="220" data-parsoid='{"a":{"resource":"./File:Nonexistent","height":"220","width":"220"},"sa":{"resource":"File:Nonexistent"}}'/></a></span>
7944 <span class="mw-default-size" typeof="mw:Error mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"a&lt;i>b&lt;/i>c"}]}' data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}],"caption":"a&lt;i data-parsoid=&#39;{\"stx\":\"html\",\"dsr\":[134,142,3,4]}&#39;>b&lt;/i>c"}'><a href="./File:Nonexistent" data-parsoid='{"a":{"href":"./File:Nonexistent"},"sa":{}}'><img resource="./File:Nonexistent" src="./Special:FilePath/Nonexistent" height="220" width="220" data-parsoid='{"a":{"resource":"./File:Nonexistent","height":"220","width":"220"},"sa":{"resource":"File:Nonexistent"}}'/></a></span></p>
7945 !! end
7946
7947 !! test
7948 Plain link to URL
7949 !! wikitext
7950 [[http://www.example.com]]
7951 !! html/php
7952 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
7953 </p>
7954 !! html/parsoid
7955 <p>[<a rel="mw:ExtLink" href="http://www.example.com"></a>]</p>
7956 !! end
7957
7958 !! test
7959 Plain link to URL with link text
7960 !! wikitext
7961 [[http://www.example.com Link text]]
7962 !! html
7963 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
7964 </p>
7965 !! end
7966
7967 !! test
7968 Plain link to protocol-relative URL
7969 !! wikitext
7970 [[//www.example.com]]
7971 !! html/php
7972 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
7973 </p>
7974 !! html/parsoid
7975 <p>[<a rel="mw:ExtLink" href="//www.example.com"></a>]</p>
7976 !! end
7977
7978 !! test
7979 Plain link to protocol-relative URL with link text
7980 !! wikitext
7981 [[//www.example.com Link text]]
7982 !! html
7983 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
7984 </p>
7985 !! end
7986
7987 !! test
7988 Plain link to page with question mark in title
7989 !! wikitext
7990 [[A?b]]
7991
7992 [[A?b|Baz]]
7993 !! html
7994 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
7995 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
7996 </p>
7997 !! end
7998
7999
8000 # I'm fairly sure the expected result here is wrong.
8001 # We want these to be URL links, not pseudo-pages with URLs for titles....
8002 # However the current output is also pretty screwy.
8003 #
8004 # ----
8005 # I'm changing it to match the current output--it arguably makes more
8006 # sense in the light of the test above. Old expected result was:
8007 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
8008 #</p>
8009 # But I think this test is bordering on "garbage in, garbage out" anyway.
8010 # -- wtm
8011 !! test
8012 Piped link to URL
8013 !! wikitext
8014 Piped link to URL: [[http://www.example.com|an example URL]]
8015 !! html/php
8016 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
8017 </p>
8018 !! html/parsoid
8019 <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>
8020 !! end
8021
8022 !! test
8023 T2002: [[page|http://url/]] should link to page, not http://url/
8024 !! wikitext
8025 [[Main Page|http://url/]]
8026 !! html/php
8027 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
8028 </p>
8029 !! html/parsoid
8030 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">http://url/</a></p>
8031 !! end
8032
8033 # Parsoid does not mark self-links, by design.
8034 !! test
8035 T2337: Escaped self-links should be bold
8036 !! options
8037 title=[[Bug462]]
8038 !! wikitext
8039 [[Bu&#103;462]] [[Bug462]]
8040 !! html/php
8041 <p><strong class="selflink">Bu&#103;462</strong> <strong class="selflink">Bug462</strong>
8042 </p>
8043 !! html/php+tidy
8044 <p><strong class="selflink">Bug462</strong> <strong class="selflink">Bug462</strong></p>
8045 !! html/parsoid
8046 <p><a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a> <a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a></p>
8047 !! end
8048
8049 !! test
8050 Self-link to section should not be bold
8051 !! options
8052 title=[[Main Page]]
8053 !! wikitext
8054 [[Main Page#section]]
8055 !! html
8056 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
8057 </p>
8058 !! end
8059
8060 !! article
8061 00
8062 !! text
8063 This is 00.
8064 !! endarticle
8065
8066 !!test
8067 Self-link to numeric title
8068 !!options
8069 title=[[0]]
8070 !! wikitext
8071 [[0]]
8072 !! html
8073 <p><strong class="selflink">0</strong>
8074 </p>
8075 !!end
8076
8077 !!test
8078 Link to numeric-equivalent title
8079 !!options
8080 title=[[0]]
8081 !! wikitext
8082 [[00]]
8083 !! html
8084 <p><a href="/wiki/00" title="00">00</a>
8085 </p>
8086 !!end
8087
8088 !! test
8089 <nowiki> inside a link
8090 !! wikitext
8091 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
8092 !! html
8093 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
8094 </p>
8095 !! end
8096
8097 !! test
8098 Non-breaking spaces in title
8099 !! wikitext
8100 [[&nbsp; Main &nbsp; Page &nbsp;]]
8101 !! html
8102 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
8103 </p>
8104 !!end
8105
8106 !! test
8107 Internal link with ca linktrail, surrounded by bold apostrophes (T29473 primary issue)
8108 !! options
8109 language=ca
8110 !! wikitext
8111 '''[[Main Page]]'''
8112 !! html
8113 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
8114 </p>
8115 !! end
8116
8117 !! test
8118 Internal link with ca linktrail, surrounded by italic apostrophes (T29473 primary issue)
8119 !! options
8120 language=ca
8121 !! wikitext
8122 ''[[Main Page]]''
8123 !! html
8124 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
8125 </p>
8126 !! end
8127
8128 !! test
8129 Internal link with en linktrail: no apostrophes (T29473)
8130 !! options
8131 language=en
8132 !! wikitext
8133 [[Something]]'nice
8134 !! html
8135 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
8136 </p>
8137 !! end
8138
8139 !! test
8140 Internal link with ca linktrail with apostrophes (T29473)
8141 !! options
8142 language=ca
8143 !! wikitext
8144 [[Something]]'nice
8145 !! html
8146 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
8147 </p>
8148 !! end
8149
8150 !! test
8151 Internal link with kaa linktrail with apostrophes (T29473)
8152 !! options
8153 language=kaa
8154 !! wikitext
8155 [[Something]]'nice
8156 !! html
8157 <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>
8158 </p>
8159 !! end
8160
8161 !! test
8162 Link with multiple ":" in a subpage-supporting namespace (T65636)
8163 !! wikitext
8164 [[User:Foo/Test/63636:Bar|Test]]
8165 !! html/php
8166 <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>
8167 </p>
8168 !! html/parsoid
8169 <p><a rel="mw:WikiLink" href="./User:Foo/Test/63636:Bar" title="User:Foo/Test/63636:Bar">Test</a></p>
8170 !! end
8171
8172 ## Mainly a sanity check for Parsoid
8173 !! test
8174 Handle title parsing for subpages
8175 !! options
8176 title=[[/123123]]
8177 subpage
8178 !! wikitext
8179 123
8180 !! html/php
8181 <p>123
8182 </p>
8183 !! html/parsoid
8184 <p>123</p>
8185 !! end
8186
8187 !! article
8188 User:Test/123
8189 !! text
8190 test 123
8191 !! endarticle
8192
8193 !! test
8194 Link to a subpage from a namespace other than main
8195 !! options
8196 title=[[User:Test]]
8197 subpage
8198 !! wikitext
8199 [[/123]]
8200 !! html/php
8201 <p><a href="/wiki/User:Test/123" title="User:Test/123">/123</a>
8202 </p>
8203 !! html/parsoid
8204 <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>
8205 !! end
8206
8207 !! test
8208 Ensure that transclusion titles are not url-decoded
8209 !! options
8210 subpage title=[[Test]]
8211 parsoid=wt2html
8212 !! wikitext
8213 {{Bar%C3%A9}} {{/Bar%C3%A9}}
8214 !! html/php
8215 <p>{{Bar%C3%A9}} {{/Bar%C3%A9}}
8216 </p>
8217 !! html/parsoid
8218 <p>{{Bar%C3%A9}} {{/Bar%C3%A9}}</p>
8219 !! end
8220
8221 !! test
8222 Purely hash wikilink
8223 !! options
8224 title=[[User:Test/123]]
8225 subpage
8226 !! wikitext
8227 [[#a|b]]
8228 !! html/php
8229 <p><a href="#a">b</a>
8230 </p>
8231 !! html/parsoid
8232 <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>
8233 !! end
8234
8235 !! test
8236 1. Interaction of linktrail and template encapsulation
8237 !! wikitext
8238 {{echo|[[Foo]]}}l
8239 !! html/parsoid
8240 <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>
8241 !! end
8242
8243 !! test
8244 2. Interaction of linktrail and template encapsulation
8245 !! options
8246 parsoid
8247 !! wikitext
8248 {{echo|Some [[Fool]]}}s
8249 !! html
8250 <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>
8251 !! end
8252
8253 !! test
8254 3. Interaction of linktrail and template encapsulation
8255 !! options
8256 parsoid
8257 !! wikitext
8258 {{echo|Some [[Fool]]s are '''bold and foolish'''}}
8259 !! html
8260 <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>
8261 !! end
8262
8263 !! article
8264 Söfnuður
8265 !! text
8266 Test.
8267 !! endarticle
8268
8269 !! test
8270 Internal link with is link prefix
8271 !! options
8272 language=is
8273 !! wikitext
8274 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
8275 !! html
8276 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
8277 </p>
8278 !! end
8279
8280 !! article
8281 Mótmælendatrú
8282 !! text
8283 Test.
8284 !! endarticle
8285
8286 !! test
8287 Internal link with is link trail and link prefix
8288 !! options
8289 language=is
8290 !! wikitext
8291 [[mótmælendatrú|xxx]]ar
8292 [[mótmælendatrú]]ar
8293 mótmælenda[[söfnuður]]
8294 mótmælenda[[söfnuður|söfnuðir]]
8295 mótmælenda[[söfnuður|söfnuðir]]xxx
8296 !! html
8297 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
8298 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
8299 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
8300 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
8301 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
8302 </p>
8303 !! end
8304
8305 !! test
8306 Parsoid link trail escaping
8307 !! options
8308 parsoid=html2wt,html2html
8309 !! html/parsoid
8310 <p><a rel="mw:WikiLink" href="./Apple" title="Apple">apple</a>s</p>
8311 !! wikitext
8312 [[apple]]<nowiki/>s
8313 !! end
8314
8315 !! test
8316 Parsoid link prefix escaping
8317 !! options
8318 language=is
8319 parsoid=html2wt,html2html
8320 !! html/parsoid
8321 <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="./Söfnuður" title="Söfnuður">söfnuður</a></p>
8322 !! wikitext
8323 Aðrir mótmælenda<nowiki/>[[söfnuður]]
8324 !! end
8325
8326 !! test
8327 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
8328 !! wikitext
8329 [[Foo| bar]]
8330
8331 [[Foo| ''bar'']]
8332
8333 [http://wp.org foo]
8334
8335 [http://wp.org ''foo'']
8336 !! html
8337 <p><a href="/wiki/Foo" title="Foo"> bar</a>
8338 </p><p><a href="/wiki/Foo" title="Foo"> <i>bar</i></a>
8339 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
8340 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
8341 </p>
8342 !! end
8343
8344 !! test
8345 Parsoid: Scoped parsing should handle mixed transclusions and plain text
8346 !! wikitext
8347 [[Foo|{{echo|a}} b {{echo|c}}]]
8348 !! html/parsoid
8349 <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>
8350 !! end
8351
8352 !! test
8353 Link with angle bracket after anchor
8354 !! wikitext
8355 [[Foo#<bar>]]
8356 !! html/php
8357 <p><a href="/wiki/Foo#.3Cbar.3E" title="Foo">Foo#&lt;bar&gt;</a>
8358 </p>
8359 !! html/parsoid
8360 <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>
8361 !! end
8362
8363 ###
8364 ### Interwiki links (see maintenance/interwiki.sql)
8365 ###
8366
8367 !! test
8368 Inline interwiki link
8369 !! options
8370 parsoid=wt2html,wt2wt,html2html
8371 !! wikitext
8372 [[MeatBall:SoftSecurity]]
8373 !! html/php
8374 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
8375 </p>
8376 !! html/parsoid
8377 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a></p>
8378 !! end
8379
8380 !! test
8381 Inline interwiki link with empty title (T4372)
8382 !! options
8383 parsoid=wt2html,wt2wt,html2html
8384 !! wikitext
8385 [[MeatBall:]]
8386 !! html/php
8387 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
8388 </p>
8389 !! html/parsoid
8390 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?" title="meatball:">MeatBall:</a></p>
8391 !! end
8392
8393 !! test
8394 Interwiki link encoding conversion (T3636)
8395 !! wikitext
8396 *[[Wikipedia:ro:Olteni&#0355;a]]
8397 *[[Wikipedia:ro:Olteni&#355;a]]
8398 !! html
8399 <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>
8400 <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>
8401
8402 !! html+tidy
8403 <ul>
8404 <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>
8405 <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>
8406 </ul>
8407 !! end
8408
8409 !! test
8410 Interwiki link with fragment (T4130)
8411 !! wikitext
8412 [[MeatBall:SoftSecurity#foo]]
8413 !! html
8414 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
8415 </p>
8416 !! end
8417
8418 !! test
8419 Link scenarios with escaped fragments
8420 !! wikitext
8421 [[#Is this great?]]
8422 [[Foo#Is this great?]]
8423 [[meatball:Foo#Is this great?]]
8424 !! html/php
8425 <p><a href="#Is_this_great.3F">#Is this great?</a>
8426 <a href="/wiki/Foo#Is_this_great.3F" title="Foo">Foo#Is this great?</a>
8427 <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>
8428 </p>
8429 !! html/parsoid
8430 <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>
8431 <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>
8432 <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>
8433 !! end
8434
8435 # Ideally the wikipedia: prefix here should be proto-relative too
8436 # [CSA]: this is kind of a bogus test, as the PHP parser test doesn't
8437 # define the 'en' prefix, and originally the test used 'wikipedia',
8438 # which isn't a localinterwiki prefix hence the links to the 'en:Foo'
8439 # article.
8440 !! test
8441 Different interwiki prefixes mapping to the same URL
8442 !! wikitext
8443 [[:en:Foo]]
8444
8445 [[:en:Foo|Foo]]
8446
8447 [[wikipedia:Foo]]
8448
8449 [[:wikipedia:Foo|Foo]]
8450
8451 [[wikipedia:en:Foo]]
8452
8453 [[:wikipedia:en:Foo]]
8454
8455 [[ wikiPEdia :Foo]]
8456 !! html/parsoid
8457 <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>
8458
8459 <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>
8460
8461 <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>
8462
8463 <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>
8464
8465 <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>
8466
8467 <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>
8468
8469 <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>
8470 !! end
8471
8472 !! test
8473 Interwiki links that cannot be represented in wiki syntax
8474 !! wikitext
8475 [[meatball:ok]]
8476 [[meatball:ok#foo|ok with fragment]]
8477 [[meatball:ok_as_well?|ok ending with ? mark]]
8478 [http://de.wikipedia.org/wiki/Foo?action=history has query]
8479 [http://de.wikipedia.org/wiki/#foo is just fragment]
8480
8481 !! html/php
8482 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?ok" class="extiw" title="meatball:ok">meatball:ok</a>
8483 <a href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" class="extiw" title="meatball:ok">ok with fragment</a>
8484 <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>
8485 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
8486 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a>
8487 </p>
8488 !! html/parsoid
8489 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok" title="meatball:ok">meatball:ok</a>
8490 <a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" title="meatball:ok">ok with fragment</a>
8491 <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>
8492 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
8493 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a></p>
8494 !! end
8495
8496 !! test
8497 Interwiki links: trail
8498 !! wikitext
8499 [[wikipedia:Foo|Ba]]r
8500 !! html/php
8501 <p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
8502 </p>
8503 !! html/parsoid
8504 <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>
8505 !! end
8506
8507 !! test
8508 Local interwiki link
8509 !! options
8510 parsoid=wt2html,wt2wt,html2html
8511 !! wikitext
8512 [[local:Template:Foo]]
8513 !! html/php
8514 <p><a href="/wiki/Template:Foo" title="Template:Foo">local:Template:Foo</a>
8515 </p>
8516 !! html/parsoid
8517 <p><a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">local:Template:Foo</a></p>
8518 !! end
8519
8520 # Parsoid does not mark self-links, by design.
8521 !! test
8522 Local interwiki link: self-link to current page
8523 !! options
8524 title=[[Main Page]]
8525 parsoid=wt2html,wt2wt,html2html
8526 !! wikitext
8527 [[local:Main Page]]
8528 !! html/php
8529 <p><strong class="selflink">local:Main Page</strong>
8530 </p>
8531 !! html/parsoid
8532 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:Main Page</a></p>
8533 !! end
8534
8535 !! test
8536 Local interwiki link: prefix only (T66167)
8537 !! options
8538 parsoid=wt2html,wt2wt,html2html
8539 !! wikitext
8540 [[local:]]
8541 !! html/php
8542 <p><a href="/wiki/Main_Page" title="Main Page">local:</a>
8543 </p>
8544 !! html/parsoid
8545 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:</a></p>
8546 !! end
8547
8548 !! test
8549 Local interwiki link: with additional interwiki prefix (T63357)
8550 !! options
8551 parsoid=wt2html,wt2wt,html2html
8552 !! wikitext
8553 [[local:meatball:Hello]]
8554 !! html/php
8555 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?Hello" class="extiw" title="meatball:Hello">local:meatball:Hello</a>
8556 </p>
8557 !! html/parsoid
8558 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?Hello" title="meatball:Hello">local:meatball:Hello</a></p>
8559 !! end
8560
8561 !! test
8562 Multiple local interwiki link prefixes
8563 !! wikitext
8564 [[local:local:local:local:mi:local:Foo]]
8565 !! options
8566 parsoid=wt2html,wt2wt,html2html
8567 !! html/php
8568 <p><a href="/wiki/Foo" title="Foo">local:local:local:local:mi:local:Foo</a>
8569 </p>
8570 !! html/parsoid
8571 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">local:local:local:local:mi:local:Foo</a></p>
8572 !! end
8573
8574 ###
8575 ### Interlanguage links
8576 ### Language links (so that searching for '### language' matches..)
8577 ###
8578
8579 !! test
8580 Interlanguage link
8581 !! wikitext
8582 Blah blah blah
8583 [[zh:Chinese]]
8584 !! html/php
8585 <p>Blah blah blah
8586 </p>
8587 !! html/parsoid
8588 <p>Blah blah blah</p>
8589 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8590 !! end
8591
8592 ## parsoid html2wt will lose the space variations
8593 !! test
8594 Interlanguage link with spacing
8595 !! options
8596 parsoid=wt2html,wt2wt,html2html
8597 !! wikitext
8598 Blah blah blah
8599 [[ zh : Chinese ]]
8600 !! html/php
8601 <p>Blah blah blah
8602 </p>
8603 !! html/parsoid
8604 <p>Blah blah blah</p>
8605 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8606 !! end
8607
8608 !! test
8609 Double interlanguage link
8610 !! wikitext
8611 Blah blah blah
8612 [[es:Spanish]]
8613 [[zh:Chinese]]
8614 !! html/php
8615 <p>Blah blah blah
8616 </p>
8617 !! html/parsoid
8618 <p>Blah blah blah</p>
8619 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
8620 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8621 !! end
8622
8623 ## parsoid html2wt will lose the space variations
8624 !! test
8625 Interlanguage link variations
8626 !! options
8627 parsoid=wt2html,wt2wt,html2html
8628 !! wikitext
8629 Blah blah blah
8630 [[ es :Spanish]]
8631 [[ ZH :Chinese]]
8632 [[es:Foo_bar]]
8633 !! html/php
8634 <p>Blah blah blah
8635 </p>
8636 !! html/parsoid
8637 <p>Blah blah blah</p>
8638 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish" />
8639 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese" />
8640 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar" />
8641 !! end
8642
8643 !! test
8644 Escaping of interlanguage links
8645 !! wikitext
8646 Blah blah blah
8647 [[:es:Spanish]]
8648 [[ : zh : Chinese ]]
8649 !! html/php
8650 <p>Blah blah blah
8651 <a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">es:Spanish</a>
8652 <a href="http://zh.wikipedia.org/wiki/Chinese" class="extiw" title="zh:Chinese"> zh : Chinese </a>
8653 </p>
8654 !! html/parsoid
8655 <p><a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">es:Spanish</a>
8656 <a rel="mw:ExtLink" href="http://zh.wikipedia.org/wiki/Chinese" title="zh:Chinese"> zh : Chinese </a></p>
8657 !! end
8658
8659 ## parsoid html2wt will normalize the space to _
8660 !! test
8661 Space and question mark encoding in interlanguage links (T95473)
8662 !! options
8663 parsoid=wt2html,wt2wt,html2html
8664 !! wikitext
8665 Blah blah blah
8666 [[es:Foo bar?]]
8667 !! html/php
8668 <p>Blah blah blah
8669 </p>
8670 !! html/parsoid
8671 <p>Blah blah blah</p>
8672 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar%3F" />
8673 !! end
8674
8675 !! test
8676 Interlanguage link, with prefix links
8677 !! options
8678 language=ln
8679 !! wikitext
8680 Blah blah blah
8681 [[zh:Chinese]]
8682 !! html/php
8683 <p>Blah blah blah
8684 </p>
8685 !! html/parsoid
8686 <p>Blah blah blah</p>
8687 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8688 !! end
8689
8690 !! test
8691 Double interlanguage link, with prefix links (T10897)
8692 !! options
8693 language=ln
8694 !! wikitext
8695 Blah blah blah
8696 [[es:Spanish]]
8697 [[zh:Chinese]]
8698 !! html/php
8699 <p>Blah blah blah
8700 </p>
8701 !! html/parsoid
8702 <p>Blah blah blah</p>
8703 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
8704 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8705 !! end
8706
8707 !! test
8708 "Extra" interlanguage links (T34189 / gerrit 111390)
8709 !! wikitext
8710 Blah blah blah
8711 [[mul:Article]]
8712 !! html/php
8713 <p>Blah blah blah
8714 </p>
8715 !! html/parsoid
8716 <p>Blah blah blah</p>
8717 <link rel="mw:PageProp/Language" title="Multilingual" href="http://wikisource.org/wiki/Article"/>
8718 !! end
8719
8720 ## PHP parser tests script needs an update
8721 ## Parsoid html2wt will normalize output to [[:zh:Chinese]]
8722 !! test
8723 Language links render as inline links if $wgInterwikiMagic=false
8724 !! options
8725 wgInterwikiMagic=false
8726 parsoid=wt2html,wt2wt,html2html
8727 !! wikitext
8728 Blah blah blah
8729 [[zh:Chinese]]
8730 !! html/parsoid
8731 <p>Blah blah blah <a rel="mw:ExtLink" href="http://zh.wikipedia.org/wiki/Chinese" title="zh:Chinese">zh:Chinese</a></p>
8732 !! end
8733
8734 ## PHP parser tests script needs an update
8735 ## Parsoid html2wt will normalize output to [[:zh:Chinese]]
8736 !! test
8737 Language links render as inline links in the Talk namespace
8738 !! options
8739 title=Talk:Foo
8740 parsoid=wt2html,wt2wt,html2html
8741 !! wikitext
8742 Blah blah blah
8743 [[zh:Chinese]]
8744 !! html/parsoid
8745 <p>Blah blah blah <a rel="mw:ExtLink" href="http://zh.wikipedia.org/wiki/Chinese" title="zh:Chinese">zh:Chinese</a></p>
8746 !! end
8747
8748 !! test
8749 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
8750 !! options
8751 language=ln
8752 !! wikitext
8753 [[WW&nbsp;II]]
8754 !! html
8755 <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>
8756 </p>
8757 !! end
8758
8759 !! test
8760 Parsoid T55221: Wikilinks should be properly entity-escaped
8761 !! options
8762 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
8763 !! html/parsoid
8764 <p>He&amp;nbsp;llo <a href="./Foo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
8765 <p>He&amp;nbsp;llo <a href="./He&amp;nbsp;llo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
8766 !! wikitext
8767 He&amp;nbsp;llo [[Foo|He&amp;nbsp;llo]]
8768
8769 He&amp;nbsp;llo He&amp;nbsp;llo
8770 !! html/php
8771 <p>He&amp;nbsp;llo <a href="/wiki/Foo" title="Foo">He&amp;nbsp;llo</a>
8772 </p><p>He&amp;nbsp;llo He&amp;nbsp;llo
8773 </p>
8774 !! end
8775
8776 # html2wt will fail because of title normalization without data-parsoid
8777 !! test
8778 Parsoid: handle constructor well
8779 !! options
8780 parsoid=wt2html,wt2wt
8781 !! wikitext
8782 [[constructor]]
8783
8784 [[constructor:foo]]
8785 !! html/php
8786 <p><a href="/index.php?title=Constructor&amp;action=edit&amp;redlink=1" class="new" title="Constructor (page does not exist)">constructor</a>
8787 </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>
8788 </p>
8789 !! html/parsoid
8790 <p><a rel="mw:WikiLink" href="./Constructor" title="Constructor" data-parsoid='{"stx":"simple","a":{"href":"./Constructor"},"sa":{"href":"constructor"}}'>constructor</a></p>
8791
8792 <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>
8793 !! end
8794
8795 !! article
8796 ko:
8797 !! text
8798 Test.
8799 !! endarticle
8800
8801 # Note that `ko` isn't a known interlanguage prefix
8802 !! test
8803 Parsoid: recognize interlanguage links without a target page
8804 !! options
8805 ill
8806 !! wikitext
8807 [[es:]]
8808
8809 [[ko:]]
8810 !! html/php
8811 es:
8812 !! html/parsoid
8813 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/"/>
8814
8815 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
8816 !! end
8817
8818 # Note that `ko` isn't a known interwiki prefix
8819 !! test
8820 Parsoid: recognize interwiki links without a target page
8821 !! options
8822 parsoid=wt2html,wt2wt,html2html
8823 !! wikitext
8824 [[:es:]]
8825
8826 [[:ko:]]
8827 !! html/php
8828 <p><a href="http://es.wikipedia.org/wiki/" class="extiw" title="es:">es:</a>
8829 </p><p><a href="/wiki/Ko:" title="Ko:">ko:</a>
8830 </p>
8831 !! html/parsoid
8832 <p><a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/" title="es:">es:</a></p>
8833 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
8834 !! end
8835
8836 !! test
8837 Handle interwiki links pointing to the current wiki as plain wiki links (T47209)
8838 !! wikitext
8839 [[mi:Foo]]
8840 !! html/php
8841 <p><a href="/wiki/Foo" title="Foo">mi:Foo</a>
8842 </p>
8843 !! html/parsoid
8844 <p><a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo"},"sa":{"href":"mi:Foo"}}'>mi:Foo</a></p>
8845 !! end
8846
8847 !! test
8848 Interlanguage link with preceding local interwiki link (T70085)
8849 !! options
8850 parsoid=wt2html,wt2wt,html2html
8851 !! wikitext
8852 Blah blah blah
8853 [[local:es:Spanish]]
8854 !! html/php
8855 <p>Blah blah blah
8856 <a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">local:es:Spanish</a>
8857 </p>
8858 !! html/parsoid
8859 <p>Blah blah blah
8860 <a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">local:es:Spanish</a></p>
8861 !! end
8862
8863 !! test
8864 Looks like an interlanguage link, but is actually a local interwiki
8865 !! options
8866 parsoid=wt2html,wt2wt,html2html
8867 !! wikitext
8868 Blah blah blah
8869 [[mi:Template:Foo]]
8870 !! html/php
8871 <p>Blah blah blah
8872 <a href="/wiki/Template:Foo" title="Template:Foo">mi:Template:Foo</a>
8873 </p>
8874 !! html/parsoid
8875 <p>Blah blah blah
8876 <a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">mi:Template:Foo</a></p>
8877 !! end
8878
8879 ###
8880 ### Redirects, Parsoid-only
8881 ###
8882
8883 !! test
8884 1. Simple redirect to page
8885 !! wikitext
8886 #REDIRECT [[Main Page]]
8887 !! html/parsoid
8888 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8889 !! end
8890
8891 !! test
8892 2. Other redirect variants
8893 !! wikitext
8894 #REDIRECT [[Main_Page]]
8895 !! html/parsoid
8896 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Main_Page"},"sa":{"href":"Main_Page"}}'/>
8897 !! end
8898
8899 # Not a valid redirect in PHP (although perhaps it was, once upon a time)
8900 # This tests the Parsoid bail-out code.
8901 !! test
8902 3. Other redirect variants
8903 !! wikitext
8904 #REDIRECT [[<nowiki>[[Bar]]</nowiki>]]
8905 !! html/parsoid
8906 <ol><li data-parsoid>REDIRECT [[[[Bar]]]]</li></ol>
8907 !! end
8908
8909 !! test
8910 4. Redirect to a templated destination
8911 !! wikitext
8912 #REDIRECT [[{{echo|Foo}}bar]]
8913 !! html/parsoid
8914 <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"}]]}'/>
8915 !! end
8916
8917 !! test
8918 Empty redirect
8919 !! options
8920 parsoid=wt2html,wt2wt
8921 !! wikitext
8922 #REDIRECT [[]]
8923 !! html/parsoid
8924 <ol>
8925 <li>REDIRECT [[]]</li></ol>
8926 !! end
8927
8928 !! test
8929 Optional colon in #REDIRECT
8930 !! options
8931 # the colon is archaic syntax. we support it for wt2html, but we
8932 # don't care that it roundtrips back to the modern syntax.
8933 parsoid=wt2html,html2html
8934 !! wikitext
8935 #REDIRECT:[[Main Page]]
8936 !! html/parsoid
8937 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8938 !! end
8939
8940 !! test
8941 Whitespace in #REDIRECT with optional colon
8942 !! options
8943 # the colon and gratuitous whitespace is archaic syntax. we support
8944 # it for wt2html, but we don't care that it roundtrips back to the
8945 # modern syntax (without extra whitespace)
8946 parsoid=wt2html,html2html
8947 !! wikitext
8948
8949 #REDIRECT
8950 :
8951 [[Main Page]]
8952 !! html/parsoid
8953 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8954 !! end
8955
8956 !! test
8957 Piped link in #REDIRECT
8958 !! options
8959 # content after piped link is ignored. we support this syntax,
8960 # but don't care that the piped link is lost when we roundtrip this.
8961 parsoid=wt2html
8962 !! wikitext
8963 #REDIRECT [[Main Page|bar]]
8964 !! html/parsoid
8965 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8966 !! end
8967
8968 !! test
8969 Redirect to category (T104502)
8970 !! options
8971 parsoid=wt2html,wt2wt
8972 !! wikitext
8973 #REDIRECT [[Category:Foo]]
8974 !! html/parsoid
8975 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8976 !! end
8977
8978 !! test
8979 Redirect to category with URL encoding (T104502)
8980 !! options
8981 parsoid=wt2html
8982 !! wikitext
8983 #REDIRECT [[Category%3AFoo]]
8984 !! html/parsoid
8985 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8986 !! end
8987
8988 !! test
8989 Redirect to category page
8990 !! wikitext
8991 #REDIRECT [[:Category:Foo]]
8992 !! html/parsoid
8993 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8994 !! end
8995
8996 !! test
8997 Redirect to image page (1)
8998 !! wikitext
8999 #REDIRECT [[File:Wiki.png]]
9000 !! html/parsoid
9001 <link rel="mw:PageProp/redirect" href="./File:Wiki.png"/>
9002 !! end
9003
9004 !! test
9005 Redirect to image page (2)
9006 !! wikitext
9007 #REDIRECT [[Image:Wiki.png]]
9008 !! html/parsoid
9009 <link rel="mw:PageProp/redirect" href="./File:Wiki.png" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./File:Wiki.png"},"sa":{"href":"Image:Wiki.png"}}'/>
9010 !! end
9011
9012 # html2wt disabled because wts serializes as "#REDIRECT [[:en:File:Wiki.png]]"
9013 # Next test confirms this.
9014 !! test
9015 Redirect to language (1) (T104918)
9016 !! options
9017 parsoid=wt2html,wt2wt,html2html
9018 !! wikitext
9019 #REDIRECT [[en:File:Wiki.png]]
9020 !! html/parsoid
9021 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
9022 !! end
9023
9024 !! test
9025 Redirect to language (2) (T104918)
9026 !! wikitext
9027 #REDIRECT [[:en:File:Wiki.png]]
9028 !! html/parsoid
9029 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
9030 !! end
9031
9032 !! test
9033 Redirect to interwiki (T104918)
9034 !! wikitext
9035 #REDIRECT [[meatball:File:Wiki.png]]
9036 !! html/parsoid
9037 <link rel="mw:PageProp/redirect" href="http://www.usemod.com/cgi-bin/mb.pl?File:Wiki.png"/>
9038 !! end
9039
9040 !! test
9041 Non-English #REDIRECT
9042 !! options
9043 language=is
9044 !! wikitext
9045 #TILVÍSUN [[Main Page]]
9046 !! html/parsoid
9047 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#TILVÍSUN ","a":{"href":"./Main_Page"},"sa":{"href":"Main Page"}}'/>
9048 !! end
9049
9050 !! test
9051 Redirect syntax under text isn't considered a redirect
9052 !! wikitext
9053 some text
9054 #redirect [[Main Page]]
9055 !! html/parsoid
9056 <p>some text</p>
9057 <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>
9058 !! end
9059
9060 # FIXME: Should hoist the redirect to the top of the page and ensure there
9061 # is only one.
9062 !! test
9063 New redirect
9064 !! options
9065 parsoid=html2wt
9066 !! html/parsoid
9067 <p>Foo<link rel="mw:PageProp/redirect" href="./Foo"/></p>
9068 !! wikitext
9069 Foo
9070 #REDIRECT [[Foo]]
9071 !! end
9072
9073 ##
9074 ## XHTML tidiness
9075 ###
9076
9077 !! test
9078 <br> to <br />
9079 !! wikitext
9080 1<br>2<br />3
9081 !! html
9082 <p>1<br />2<br />3
9083 </p>
9084 !! end
9085
9086 !! test
9087 Broken br tag sanitization
9088 !! wikitext
9089 </br>
9090 !! html/php
9091 <p>&lt;/br&gt;
9092 </p>
9093 !! end
9094
9095 # TODO: Fix html2html mode (T53055)!
9096 !! test
9097 Parsoid: Broken br tag recognition
9098 !! options
9099 parsoid=wt2html
9100 !! wikitext
9101 </br>
9102
9103 <br/ >
9104 !! html+tidy
9105 <p><br /></p>
9106 <p><br /></p>
9107 !! end
9108
9109 !! test
9110 Incorrecly removing closing slashes from correctly formed XHTML
9111 !! wikitext
9112 <br style="clear:both;" />
9113 !! html
9114 <p><br style="clear:both;" />
9115 </p>
9116 !! end
9117
9118 !! test
9119 Failing to transform badly formed HTML into correct XHTML
9120 !! wikitext
9121 <br style="clear: left;">
9122 <br style="clear: right;">
9123 <br style="clear: both;">
9124 !! html
9125 <p><br style="clear: left;" />
9126 <br style="clear: right;" />
9127 <br style="clear: both;" />
9128 </p>
9129 !!end
9130
9131 ## FIXME: Is Parsoid's acceptance of self-closing html-tags
9132 ## a feature or a bug? See https://phabricator.wikimedia.org/T76962
9133 !! test
9134 Handling html with a div self-closing tag
9135 !! wikitext
9136 <div title />
9137 <div title/>
9138 <div title/ >
9139 <div title=bar />
9140 <div title=bar/>
9141 <div title=bar/ >
9142 !! html/php
9143 <p>&lt;div title /&gt;
9144 &lt;div title/&gt;
9145 </p>
9146 <div>
9147 <p>&lt;div title=bar /&gt;
9148 &lt;div title=bar/&gt;
9149 </p>
9150 <div title="bar/"></div>
9151 </div>
9152
9153 !! html/parsoid
9154 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
9155 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
9156 <div title="" data-parsoid='{"stx":"html","selfClose":true,"brokenHTMLTag":true}'></div>
9157 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
9158 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
9159 <div title="bar/" data-parsoid='{"stx":"html","autoInsertedEnd":true}'></div>
9160 !! end
9161
9162 !! test
9163 Handling html with a br self-closing tag
9164 !! wikitext
9165 <br title />
9166 <br title/>
9167 <br title/ >
9168 <br title=bar />
9169 <br title=bar/>
9170 <br title=bar/ >
9171 !! html/php
9172 <p><br title="" />
9173 <br title="" />
9174 <br />
9175 <br title="bar" />
9176 <br title="bar" />
9177 <br title="bar/" />
9178 </p>
9179 !! html/parsoid
9180 <p><br title="" />
9181 <br title="" />
9182 <br title="" />
9183 <br title="bar" />
9184 <br title="bar" />
9185 <br title="bar/" />
9186 </p>
9187 !! end
9188
9189 !! test
9190 Horizontal ruler (should it add that extra space?)
9191 !! wikitext
9192 <hr>
9193 <hr >
9194 foo <hr
9195 > bar
9196 !! html+tidy
9197 <hr />
9198 <hr />
9199 <p>foo</p>
9200 <hr />
9201 <p>bar</p>
9202 !! end
9203
9204 !! test
9205 Horizontal ruler -- 4+ dashes render hr
9206 !! wikitext
9207 ----
9208 !! html
9209 <hr />
9210
9211 !! end
9212
9213 !! test
9214 Horizontal ruler -- eats additional dashes on the same line
9215 !! wikitext
9216 ---------
9217 !! html
9218 <hr />
9219
9220 !! end
9221
9222 !! test
9223 Horizontal ruler -- does not collapse dashes on consecutive lines
9224 !! wikitext
9225 ----
9226 ----
9227 !! html
9228 <hr />
9229 <hr />
9230
9231 !! end
9232
9233 !! test
9234 Horizontal ruler -- <4 dashes render as plain text
9235 !! wikitext
9236 ---
9237 !! html
9238 <p>---
9239 </p>
9240 !! end
9241
9242 !! test
9243 Horizontal ruler -- Supports content following dashes on same line
9244 !! wikitext
9245 ---- Foo
9246 !! html
9247 <hr /> Foo
9248
9249 !! html+tidy
9250 <hr />
9251 <p>Foo</p>
9252 !! end
9253
9254 ###
9255 ### Block-level elements
9256 ###
9257 !! test
9258 Common list
9259 !! wikitext
9260 *Common list
9261 * item 2
9262 *item 3
9263 !! html
9264 <ul><li>Common list</li>
9265 <li> item 2</li>
9266 <li>item 3</li></ul>
9267
9268 !! end
9269
9270 !! test
9271 Numbered list
9272 !! wikitext
9273 #Numbered list
9274 #item 2
9275 # item 3
9276 !! html
9277 <ol><li>Numbered list</li>
9278 <li>item 2</li>
9279 <li> item 3</li></ol>
9280
9281 !! end
9282
9283 !! test
9284 Mixed list
9285 !! wikitext
9286 *Mixed list
9287 *# with numbers
9288 ** and bullets
9289 *# and numbers
9290 *bullets again
9291 **bullet level 2
9292 ***bullet level 3
9293 ***#Number on level 4
9294 **bullet level 2
9295 **#Number on level 3
9296 **#Number on level 3
9297 *#number level 2
9298 *Level 1
9299 *** Level 3
9300 #** Level 3, but ordered
9301 !! html
9302 <ul><li>Mixed list
9303 <ol><li> with numbers</li></ol>
9304 <ul><li> and bullets</li></ul>
9305 <ol><li> and numbers</li></ol></li>
9306 <li>bullets again
9307 <ul><li>bullet level 2
9308 <ul><li>bullet level 3
9309 <ol><li>Number on level 4</li></ol></li></ul></li>
9310 <li>bullet level 2
9311 <ol><li>Number on level 3</li>
9312 <li>Number on level 3</li></ol></li></ul>
9313 <ol><li>number level 2</li></ol></li>
9314 <li>Level 1
9315 <ul><li><ul><li> Level 3</li></ul></li></ul></li></ul>
9316 <ol><li><ul><li><ul><li> Level 3, but ordered</li></ul></li></ul></li></ol>
9317
9318 !! end
9319
9320 !! test
9321 1. Nested mixed wikitext and html list
9322 !! wikitext
9323 * hi
9324 * <ul><li>ho</li></ul>
9325 * hi
9326 ** ho
9327 !! html/php
9328 <ul><li> hi</li>
9329 <li> <ul><li>ho</li></ul></li>
9330 <li> hi
9331 <ul><li> ho</li></ul></li></ul>
9332
9333 !! html/parsoid
9334 <ul><li> hi</li>
9335 <li> <ul data-parsoid='{"stx":"html"}'><li data-parsoid='{"stx":"html"}'>ho</li></ul></li>
9336 <li> hi
9337 <ul><li> ho</li></ul></li></ul>
9338 !! end
9339
9340 !! test
9341 2. Nested mixed wikitext and html list (incompatible)
9342 !! wikitext
9343 ; hi
9344 : {{echo|<li>ho</li>}}
9345 !! html/php
9346 <dl><dt> hi</dt>
9347 <dd> <li>ho</li></dd></dl>
9348
9349 !! html/parsoid
9350 <dl><dt> hi</dt>
9351 <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>
9352 !! end
9353
9354 !! test
9355 Nested lists 1
9356 !! wikitext
9357 *foo
9358 **bar
9359 !! html
9360 <ul><li>foo
9361 <ul><li>bar</li></ul></li></ul>
9362
9363 !! end
9364
9365 !! test
9366 Nested lists 2
9367 !! wikitext
9368 **foo
9369 *bar
9370 !! html
9371 <ul><li><ul><li>foo</li></ul></li>
9372 <li>bar</li></ul>
9373
9374 !! end
9375
9376 !! test
9377 Nested lists 3 (first element empty)
9378 !! wikitext
9379 *
9380 **bar
9381 !! html
9382 <ul><li>
9383 <ul><li>bar</li></ul></li></ul>
9384
9385 !! end
9386
9387 !! test
9388 Nested lists 4 (first element empty)
9389 !! wikitext
9390 **
9391 *bar
9392 !! html
9393 <ul><li><ul><li></li></ul></li>
9394 <li>bar</li></ul>
9395
9396 !! end
9397
9398 !! test
9399 Nested lists 5 (both elements empty)
9400 !! wikitext
9401 **
9402 *
9403 !! html
9404 <ul><li><ul><li></li></ul></li>
9405 <li></li></ul>
9406
9407 !! end
9408
9409 !! test
9410 Nested lists 6 (both elements empty)
9411 !! wikitext
9412 *
9413 **
9414 !! html
9415 <ul><li>
9416 <ul><li></li></ul></li></ul>
9417
9418 !! end
9419
9420 !! test
9421 Nested lists 7 (skip initial nesting levels)
9422 !! wikitext
9423 *** foo
9424 !! html
9425 <ul><li><ul><li><ul><li> foo</li></ul></li></ul></li></ul>
9426
9427 !! end
9428
9429 !! test
9430 Nested lists 8 (multiple nesting transitions)
9431 !! wikitext
9432 * foo
9433 *** bar
9434 ** baz
9435 * boo
9436 !! html
9437 <ul><li> foo
9438 <ul><li><ul><li> bar</li></ul></li>
9439 <li> baz</li></ul></li>
9440 <li> boo</li></ul>
9441
9442 !! end
9443
9444 !! test
9445 Nested lists 9 (extension interaction)
9446 !! options
9447 parsoid
9448 !! wikitext
9449 *<references />
9450 !! html/parsoid
9451 <ul><li data-parsoid='{}'><ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-parsoid='{}' data-mw='{"name":"references","attrs":{}}'></ol></li></ul>
9452 !! end
9453
9454 !! test
9455 1. Lists with start-of-line-transparent tokens before bullets: Comments
9456 !! wikitext
9457 *foo
9458 *<!--cmt-->bar
9459 <!--cmt-->*baz
9460 !! html
9461 <ul><li>foo</li>
9462 <li>bar</li>
9463 <li>baz</li></ul>
9464
9465 !! end
9466
9467 !! test
9468 2. Lists with start-of-line-transparent tokens before bullets: Template close
9469 !! wikitext
9470 *foo {{echo|bar
9471 }}*baz
9472 !! html
9473 <ul><li>foo bar</li>
9474 <li>baz</li></ul>
9475
9476 !! end
9477
9478 !! test
9479 List items are not parsed correctly following a <pre> block (T2785)
9480 !! wikitext
9481 * <pre>foo</pre>
9482 * <pre>bar</pre>
9483 * zar
9484 !! html/php
9485 <ul><li> <pre>foo</pre></li>
9486 <li> <pre>bar</pre></li>
9487 <li> zar</li></ul>
9488
9489 !! html/parsoid
9490 <ul><li> <pre data-parsoid='{"stx":"html"}'>foo</pre></li>
9491 <li> <pre data-parsoid='{"stx":"html"}'>bar</pre></li>
9492 <li> zar</li></ul>
9493 !! end
9494
9495 !! test
9496 List items from template
9497 !! wikitext
9498
9499 {{inner list}}
9500 * item 2
9501
9502 * item 0
9503 {{inner list}}
9504 * item 2
9505
9506 * item 0
9507 * notSOL{{inner list}}
9508 * item 2
9509 !! html
9510 <ul><li> item 1</li>
9511 <li> item 2</li></ul>
9512 <ul><li> item 0</li>
9513 <li> item 1</li>
9514 <li> item 2</li></ul>
9515 <ul><li> item 0</li>
9516 <li> notSOL</li>
9517 <li> item 1</li>
9518 <li> item 2</li></ul>
9519
9520 !! end
9521
9522 !! test
9523 List interrupted by empty line or heading
9524 !! wikitext
9525 * foo
9526
9527 ** bar
9528 == A heading ==
9529 * Another list item
9530 !! html
9531 <ul><li> foo</li></ul>
9532 <ul><li><ul><li> bar</li></ul></li></ul>
9533 <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>
9534 <ul><li> Another list item</li></ul>
9535
9536 !!end
9537
9538 !!test
9539 Multiple list tags generated by templates
9540 !! wikitext
9541 {{echo|<li>}}a
9542 {{echo|<li>}}b
9543 {{echo|<li>}}c
9544 !! html
9545 <li>a
9546 <li>b
9547 <li>c</li>
9548 </li>
9549 </li>
9550
9551 !! html+tidy
9552 <ul>
9553 <li>a</li>
9554 <li>b</li>
9555 <li>c</li>
9556 </ul>
9557 !!end
9558
9559 !!test
9560 Single-comment whitespace lines dont break lists, and neither do multi-comment whitespace lines
9561 !! wikitext
9562 *a
9563 <!--This line will NOT split the list-->
9564 *b
9565 <!--This line will NOT split the list either-->
9566 *c
9567 <!--foo--> <!----> <!--This line NOT split the list either-->
9568 *d
9569 !! html
9570 <ul><li>a</li>
9571 <li>b</li>
9572 <li>c</li>
9573 <li>d</li></ul>
9574
9575 !!end
9576
9577 !!test
9578 Replacing whitespace with tabs still doesn't break the list (gerrit 78327)
9579 !! wikitext
9580 *a
9581 <!--This line will NOT split the list-->
9582 *b
9583 <!--This line will NOT split the list either-->
9584 *c
9585 <!--foo--> <!----> <!--This line NOT split the list
9586 either-->
9587 *d
9588 !! html
9589 <ul><li>a</li>
9590 <li>b</li>
9591 <li>c</li>
9592 <li>d</li></ul>
9593
9594 !!end
9595
9596 !!test
9597 Test the li-hack
9598 (The PHP parser relies on Tidy for the hack)
9599 !!options
9600 parsoid=wt2html,wt2wt
9601 !! wikitext
9602 * foo
9603 * <li>li-hack
9604 * {{echo|<li>templated li-hack}}
9605 * <!--foo--> <li> unsupported li-hack with preceding comments
9606
9607 <ul>
9608 <li><li>not a li-hack
9609 </li>
9610 </ul>
9611 !! html+tidy
9612 <ul>
9613 <li>foo</li>
9614 <li>li-hack</li>
9615 <li>templated li-hack</li>
9616 <li>unsupported li-hack with preceding comments</li>
9617 </ul>
9618 <ul>
9619 <li>not a li-hack</li>
9620 </ul>
9621 !!end
9622
9623 !! test
9624 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
9625 !! options
9626 parsoid
9627 !! wikitext
9628 # foo
9629 ## bar
9630 * foo
9631 ** bar
9632 : foo
9633 :: bar
9634 !! html
9635 <ol>
9636 <li> foo<ol>
9637 <li> bar</li>
9638 </ol></li>
9639 </ol><ul>
9640 <li> foo<ul>
9641 <li> bar</li>
9642 </ul></li>
9643 </ul><dl>
9644 <dd> foo<dl>
9645 <dd> bar</dd>
9646 </dl></dd>
9647 </dl>
9648 !! end
9649
9650 !! test
9651 Parsoid: Test of whitespace serialization with Templated bullets
9652 !! options
9653 parsoid
9654 !! wikitext
9655 * {{bullet}}
9656 !! html
9657 <ul>
9658 <li> </li><li about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"bullet","href":"./Template:Bullet"},"params":{},"i":0}}]}'> Bar</li>
9659 </ul>
9660 !! end
9661
9662 # ------------------------------------------------------------------------
9663 # The next set of tests are about Parsoid's ability to handle badly nested
9664 # tags (parse, minimize scope of fixup, and roundtrip back)
9665 # ------------------------------------------------------------------------
9666
9667 !! test
9668 Unbalanced closing block tags break a list
9669 (php parser relies on Tidy to fix up)
9670 !! wikitext
9671 <div>
9672 *a</div><div>
9673 *b</div>
9674 !! html+tidy
9675 <div>
9676 <ul>
9677 <li>a</li>
9678 </ul>
9679 </div>
9680 <div>
9681 <ul>
9682 <li>b</li>
9683 </ul>
9684 </div>
9685 !! end
9686
9687 # Parsoid fails this test, but it might be tricky to support properly.
9688 # See T70395.
9689 !! test
9690 Unbalanced closing non-block tags don't break a list
9691 (php parser relies on Tidy to fix up)
9692 !! wikitext
9693 <span>
9694 *a</span><span>
9695 *b</span>
9696 !! html/php+tidy
9697 <ul>
9698 <li><span>a</span></li>
9699 <li><span>b</span></li>
9700 </ul>
9701 !! html/parsoid
9702 <span>
9703 <ul>
9704 <li>a<span></span>
9705 </li>
9706 <li>b
9707 </li>
9708 </ul>
9709 </span>
9710 !! end
9711
9712 !! test
9713 Unclosed formatting tags that straddle lists are closed and reopened
9714 (php parser relies on Tidy to fix up)
9715 !! options
9716 parsoid=wt2html,wt2wt,html2html
9717 !! wikitext
9718 # <s> a
9719 # b </s>
9720 !! html/php+tidy
9721 <ol>
9722 <li><s>a</s></li>
9723 <li><s>b</s></li>
9724 </ol>
9725 !! html/parsoid
9726 <ol><li> <s> a</s></li>
9727 <li><s> b </s></li></ol>
9728 !! end
9729
9730 # See T70395.
9731 !!test
9732 1. List embedded in a formatting tag
9733 !! wikitext
9734 <small>
9735 * foo
9736 </small>
9737 !! html/php+tidy
9738 <ul>
9739 <li><small>foo</small></li>
9740 </ul>
9741 !! html/parsoid
9742 <small>
9743 <ul>
9744 <li> foo</li>
9745 </ul>
9746 </small>
9747 !!end
9748
9749 ## Ugly Parsoid output here
9750 ## Not sure what the right output is.
9751 !!test
9752 2. List embedded in a formatting tag
9753 !! wikitext
9754 <small>
9755 *a
9756 *b</small>
9757 !! html/php+tidy
9758 <ul>
9759 <li><small>a</small></li>
9760 <li><small>b</small></li>
9761 </ul>
9762 !! html/parsoid
9763 <small></small>
9764 <ul><small>
9765 <li>a</li>
9766 </small>
9767 <li><small>b</small></li>
9768 </ul>
9769 !!end
9770
9771 # Ugly Parsoid and PHP parser output here
9772 # Not sure if we want to make this a test!
9773 #
9774 ## !!test
9775 ## 3. Unclosed formatting tags in list elements
9776 ## !! wikitext
9777 ## *<small>a
9778 ## *<small>b
9779 ## !! html/php+tidy
9780 ## <ul>
9781 ## <li><small>a</small></li>
9782 ## <li><small><small>b</small></small></li>
9783 ## </ul>
9784 ## !! html/parsoid
9785 ## <ul>
9786 ## <li><small>a</small></li>
9787 ## <small>
9788 ## <li><small>b</small></li>
9789 ## </small></ul>
9790 ## !!end
9791
9792 # This is a bug in the PHP parser + tidy combination.
9793 # (The </tr> tag gets parsed as text and html-escaped by PHP,
9794 # and then fostered out of the table by tidy.)
9795 # We believe the Parsoid output to be correct.
9796 !! test
9797 Table with missing opening <tr> tag
9798 !! options
9799 parsoid=wt2html,wt2wt
9800 !! wikitext
9801 <table>
9802 <td>foo</td>
9803 </tr>
9804 </table>
9805 !! html+tidy
9806 <table>
9807 <tr>
9808 <td>foo</td>
9809 </tr>
9810 </table>
9811 !! end
9812
9813 ###
9814 ### Magic Words
9815 ###
9816
9817 # Note that the current date is hard-coded as
9818 # 1970-01-01T00:02:03Z (a Thursday)
9819 # when running parser tests. The timezone is also fixed to GMT, so
9820 # local date will be identical to current date.
9821
9822 !! test
9823 Magic Word: {{CURRENTDAY}}
9824 !! wikitext
9825 {{CURRENTDAY}}
9826 !! html
9827 <p>1
9828 </p>
9829 !! end
9830
9831 !! test
9832 Magic Word: {{CURRENTDAY2}}
9833 !! wikitext
9834 {{CURRENTDAY2}}
9835 !! html
9836 <p>01
9837 </p>
9838 !! end
9839
9840 !! test
9841 Magic Word: {{CURRENTDAYNAME}}
9842 !! wikitext
9843 {{CURRENTDAYNAME}}
9844 !! html
9845 <p>Thursday
9846 </p>
9847 !! end
9848
9849 !! test
9850 Magic Word: {{CURRENTDOW}}
9851 !! wikitext
9852 {{CURRENTDOW}}
9853 !! html
9854 <p>4
9855 </p>
9856 !! end
9857
9858 !! test
9859 Magic Word: {{CURRENTMONTH}}
9860 !! wikitext
9861 {{CURRENTMONTH}}
9862 !! html
9863 <p>01
9864 </p>
9865 !! end
9866
9867 !! test
9868 Magic Word: {{CURRENTMONTH1}}
9869 !! wikitext
9870 {{CURRENTMONTH1}}
9871 !! html
9872 <p>1
9873 </p>
9874 !! end
9875
9876 !! test
9877 Magic Word: {{CURRENTMONTHABBREV}}
9878 !! wikitext
9879 {{CURRENTMONTHABBREV}}
9880 !! html
9881 <p>Jan
9882 </p>
9883 !! end
9884
9885 !! test
9886 Magic Word: {{CURRENTMONTHNAME}}
9887 !! wikitext
9888 {{CURRENTMONTHNAME}}
9889 !! html
9890 <p>January
9891 </p>
9892 !! end
9893
9894 !! test
9895 Magic Word: {{CURRENTMONTHNAMEGEN}}
9896 !! wikitext
9897 {{CURRENTMONTHNAMEGEN}}
9898 !! html
9899 <p>January
9900 </p>
9901 !! end
9902
9903 !! test
9904 Magic Word: {{CURRENTTIME}}
9905 !! wikitext
9906 {{CURRENTTIME}}
9907 !! html
9908 <p>00:02
9909 </p>
9910 !! end
9911
9912 !! test
9913 Magic Word: {{CURRENTHOUR}}
9914 !! wikitext
9915 {{CURRENTHOUR}}
9916 !! html
9917 <p>00
9918 </p>
9919 !! end
9920
9921 !! test
9922 Magic Word: {{CURRENTWEEK}} (T6594)
9923 !! wikitext
9924 {{CURRENTWEEK}}
9925 !! html
9926 <p>1
9927 </p>
9928 !! end
9929
9930 !! test
9931 Magic Word: {{CURRENTYEAR}}
9932 !! wikitext
9933 {{CURRENTYEAR}}
9934 !! html
9935 <p>1970
9936 </p>
9937 !! end
9938
9939 !! test
9940 Magic Word: {{CURRENTTIMESTAMP}}
9941 !! wikitext
9942 {{CURRENTTIMESTAMP}}
9943 !! html
9944 <p>19700101000203
9945 </p>
9946 !! end
9947
9948 !! test
9949 Magic Words LOCAL (UTC)
9950 !! wikitext
9951 * {{LOCALMONTH}}
9952 * {{LOCALMONTH1}}
9953 * {{LOCALMONTHNAME}}
9954 * {{LOCALMONTHNAMEGEN}}
9955 * {{LOCALMONTHABBREV}}
9956 * {{LOCALDAY}}
9957 * {{LOCALDAY2}}
9958 * {{LOCALDAYNAME}}
9959 * {{LOCALYEAR}}
9960 * {{LOCALTIME}}
9961 * {{LOCALHOUR}}
9962 * {{LOCALWEEK}}
9963 * {{LOCALDOW}}
9964 * {{LOCALTIMESTAMP}}
9965 !! html
9966 <ul><li> 01</li>
9967 <li> 1</li>
9968 <li> January</li>
9969 <li> January</li>
9970 <li> Jan</li>
9971 <li> 1</li>
9972 <li> 01</li>
9973 <li> Thursday</li>
9974 <li> 1970</li>
9975 <li> 00:02</li>
9976 <li> 00</li>
9977 <li> 1</li>
9978 <li> 4</li>
9979 <li> 19700101000203</li></ul>
9980
9981 !! end
9982
9983 !! test
9984 Magic Word: {{FULLPAGENAME}}
9985 !! options
9986 title=[[User:Ævar Arnfjörð Bjarmason]]
9987 !! wikitext
9988 {{FULLPAGENAME}}
9989 !! html
9990 <p>User:Ævar Arnfjörð Bjarmason
9991 </p>
9992 !! end
9993
9994 !! test
9995 Magic Word: {{FULLPAGENAMEE}}
9996 !! options
9997 title=[[User:Ævar Arnfjörð Bjarmason]]
9998 !! wikitext
9999 {{FULLPAGENAMEE}}
10000 !! html
10001 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10002 </p>
10003 !! end
10004
10005 !! test
10006 Magic Word: {{TALKSPACE}}
10007 !! options
10008 title=[[User:Ævar Arnfjörð Bjarmason]]
10009 !! wikitext
10010 {{TALKSPACE}}
10011 !! html
10012 <p>User talk
10013 </p>
10014 !! end
10015
10016 !! test
10017 Magic Word: {{TALKSPACE}}, same namespace
10018 !! options
10019 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10020 !! wikitext
10021 {{TALKSPACE}}
10022 !! html
10023 <p>User talk
10024 </p>
10025 !! end
10026
10027 !! test
10028 Magic Word: {{TALKSPACE}}, main namespace
10029 !! options
10030 title=[[Parser Test]]
10031 !! wikitext
10032 {{TALKSPACE}}
10033 !! html
10034 <p>Talk
10035 </p>
10036 !! end
10037
10038 !! test
10039 Magic Word: {{TALKSPACEE}}
10040 !! options
10041 title=[[User:Ævar Arnfjörð Bjarmason]]
10042 !! wikitext
10043 {{TALKSPACEE}}
10044 !! html
10045 <p>User_talk
10046 </p>
10047 !! end
10048
10049 !! test
10050 Magic Word: {{SUBJECTSPACE}}
10051 !! options
10052 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10053 !! wikitext
10054 {{SUBJECTSPACE}}
10055 !! html
10056 <p>User
10057 </p>
10058 !! end
10059
10060 !! test
10061 Magic Word: {{SUBJECTSPACE}}, same namespace
10062 !! options
10063 title=[[User:Ævar Arnfjörð Bjarmason]]
10064 !! wikitext
10065 {{SUBJECTSPACE}}
10066 !! html
10067 <p>User
10068 </p>
10069 !! end
10070
10071 !! test
10072 Magic Word: {{SUBJECTSPACE}}, main namespace
10073 !! options
10074 title=[[Parser Test]]
10075 !! wikitext
10076 {{SUBJECTSPACE}}
10077 !! html
10078
10079 !! end
10080
10081 !! test
10082 Magic Word: {{SUBJECTSPACEE}}
10083 !! options
10084 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10085 !! wikitext
10086 {{SUBJECTSPACEE}}
10087 !! html
10088 <p>User
10089 </p>
10090 !! end
10091
10092 !! test
10093 Magic Word: {{NAMESPACE}}
10094 !! options
10095 title=[[User:Ævar Arnfjörð Bjarmason]]
10096 !! wikitext
10097 {{NAMESPACE}}
10098 !! html
10099 <p>User
10100 </p>
10101 !! end
10102
10103 !! test
10104 Magic Word: {{NAMESPACEE}}
10105 !! options
10106 title=[[User:Ævar Arnfjörð Bjarmason]]
10107 !! wikitext
10108 {{NAMESPACEE}}
10109 !! html
10110 <p>User
10111 </p>
10112 !! end
10113
10114 !! test
10115 Magic Word: {{NAMESPACENUMBER}}
10116 !! options
10117 title=[[User:Ævar Arnfjörð Bjarmason]]
10118 !! wikitext
10119 {{NAMESPACENUMBER}}
10120 !! html
10121 <p>2
10122 </p>
10123 !! end
10124
10125 !! test
10126 Magic Word: {{SUBPAGENAME}}
10127 !! options
10128 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
10129 !! wikitext
10130 {{SUBPAGENAME}}
10131 !! html
10132 <p>sub ö
10133 </p>
10134 !! end
10135
10136 !! test
10137 Magic Word: {{SUBPAGENAMEE}}
10138 !! options
10139 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
10140 !! wikitext
10141 {{SUBPAGENAMEE}}
10142 !! html
10143 <p>sub_%C3%B6
10144 </p>
10145 !! end
10146
10147 !! test
10148 Magic Word: {{ROOTPAGENAME}}
10149 !! options
10150 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
10151 !! wikitext
10152 {{ROOTPAGENAME}}
10153 !! html
10154 <p>Ævar Arnfjörð Bjarmason
10155 </p>
10156 !! end
10157
10158 !! test
10159 Magic Word: {{ROOTPAGENAMEE}}
10160 !! options
10161 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
10162 !! wikitext
10163 {{ROOTPAGENAMEE}}
10164 !! html
10165 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10166 </p>
10167 !! end
10168
10169 !! test
10170 Magic Word: {{BASEPAGENAME}}
10171 !! options
10172 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
10173 !! wikitext
10174 {{BASEPAGENAME}}
10175 !! html
10176 <p>Ævar Arnfjörð Bjarmason
10177 </p>
10178 !! end
10179
10180 !! test
10181 Magic Word: {{BASEPAGENAMEE}}
10182 !! options
10183 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
10184 !! wikitext
10185 {{BASEPAGENAMEE}}
10186 !! html
10187 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10188 </p>
10189 !! end
10190
10191 !! test
10192 Magic Word: {{TALKPAGENAME}}
10193 !! options
10194 title=[[User:Ævar Arnfjörð Bjarmason]]
10195 !! wikitext
10196 {{TALKPAGENAME}}
10197 !! html
10198 <p>User talk:Ævar Arnfjörð Bjarmason
10199 </p>
10200 !! end
10201
10202 !! test
10203 Magic Word: {{TALKPAGENAMEE}}
10204 !! options
10205 title=[[User:Ævar Arnfjörð Bjarmason]]
10206 !! wikitext
10207 {{TALKPAGENAMEE}}
10208 !! html
10209 <p>User_talk:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10210 </p>
10211 !! end
10212
10213 !! test
10214 Magic Word: {{SUBJECTPAGENAME}}
10215 !! options
10216 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10217 !! wikitext
10218 {{SUBJECTPAGENAME}}
10219 !! html
10220 <p>User:Ævar Arnfjörð Bjarmason
10221 </p>
10222 !! end
10223
10224 !! test
10225 Magic Word: {{SUBJECTPAGENAMEE}}
10226 !! options
10227 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10228 !! wikitext
10229 {{SUBJECTPAGENAMEE}}
10230 !! html
10231 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10232 </p>
10233 !! end
10234
10235 !! test
10236 Magic Word: {{NUMBEROFFILES}}
10237 !! wikitext
10238 {{NUMBEROFFILES}}
10239 !! html
10240 <p>7
10241 </p>
10242 !! end
10243
10244 !! test
10245 Magic Word: {{PAGENAME}}
10246 !! options
10247 title=[[User:Ævar Arnfjörð Bjarmason]]
10248 !! wikitext
10249 {{PAGENAME}}
10250 !! html
10251 <p>Ævar Arnfjörð Bjarmason
10252 </p>
10253 !! end
10254
10255 !! test
10256 Magic Word: {{PAGENAME}} with metacharacters
10257 !! options
10258 title=[['foo & bar = baz']]
10259 !! wikitext
10260 ''{{PAGENAME}}''
10261 !! html/php
10262 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
10263 </p>
10264 !! html+tidy
10265 <p><i>'foo &amp; bar = baz'</i></p>
10266 !! end
10267
10268 !! test
10269 Magic Word: {{PAGENAME}} with metacharacters (T28781)
10270 !! options
10271 title=[[*RFC 1234 http://example.com/]]
10272 !! wikitext
10273 {{PAGENAME}}
10274 !! html/php
10275 <p>&#42;RFC&#32;1234 http&#58;//example.com/
10276 </p>
10277 !! html+tidy
10278 <p>*RFC 1234 http://example.com/</p>
10279 !! end
10280
10281 !! test
10282 Magic Word: {{PAGENAMEE}}
10283 !! options
10284 title=[[User:Ævar Arnfjörð Bjarmason]]
10285 !! wikitext
10286 {{PAGENAMEE}}
10287 !! html
10288 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10289 </p>
10290 !! end
10291
10292 !! test
10293 Magic Word: {{PAGENAMEE}} with metacharacters (T28781)
10294 !! options
10295 title=[[*RFC 1234 http://example.com/]]
10296 !! wikitext
10297 {{PAGENAMEE}}
10298 !! html/php
10299 <p>&#42;RFC_1234_http&#58;//example.com/
10300 </p>
10301 !! html+tidy
10302 <p>*RFC_1234_http://example.com/</p>
10303 !! end
10304
10305 !! test
10306 Magic Word: {{REVISIONID}}
10307 !! wikitext
10308 {{REVISIONID}}
10309 !! html
10310 <p>1337
10311 </p>
10312 !! end
10313
10314 !! test
10315 Magic Word: {{SCRIPTPATH}}
10316 !! wikitext
10317 {{SCRIPTPATH}}
10318 !! html
10319
10320 !! end
10321
10322 !! test
10323 Magic Word: {{STYLEPATH}}
10324 !! wikitext
10325 {{STYLEPATH}}
10326 !! html
10327 <p>/skins
10328 </p>
10329 !! end
10330
10331 !! test
10332 Magic Word: {{SERVER}}
10333 !! wikitext
10334 {{SERVER}}
10335 !! html
10336 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
10337 </p>
10338 !! end
10339
10340 !! test
10341 Magic Word: {{SERVERNAME}}
10342 !! wikitext
10343 {{SERVERNAME}}
10344 !! html
10345 <p>example.org
10346 </p>
10347 !! end
10348
10349 !! test
10350 Magic Word: {{SITENAME}}
10351 !! wikitext
10352 {{SITENAME}}
10353 !! html
10354 <p>MediaWiki
10355 </p>
10356 !! end
10357
10358 !! test
10359 Magic Word: {{PAGELANGUAGE}}
10360 !! options
10361 language=fr
10362 !! wikitext
10363 {{PAGELANGUAGE}}
10364 !! html
10365 <p>fr
10366 </p>
10367 !! end
10368
10369 !! test
10370 Magic Word: {{PAGELANGUAGE}} on a page with no explicitly set language
10371 !! wikitext
10372 {{PAGELANGUAGE}}
10373 !! html
10374 <p>en
10375 </p>
10376 !! end
10377
10378 !! test
10379 Case-sensitive magic words, when cased differently, should just be template transclusions
10380 !! wikitext
10381 {{CurrentMonth}}
10382 {{currentday}}
10383 {{cURreNTweEK}}
10384 {{currentHour}}
10385 !! html
10386 <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>
10387 <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>
10388 <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>
10389 <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>
10390 </p>
10391 !! end
10392
10393 !! test
10394 Case-insensitive magic words should still work with weird casing.
10395 !! wikitext
10396 {{sErVeRNaMe}}
10397 {{LCFirst:AOEU}}
10398 {{ucFIRST:aoeu}}
10399 {{SERver}}
10400 !! html
10401 <p>example.org
10402 aOEU
10403 Aoeu
10404 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
10405 </p>
10406 !! end
10407
10408 # From plwiki:PLOS_ONE
10409 !! test
10410 Parsoid: Page property magic word with magic word contents
10411 !! wikitext
10412 {{DISPLAYTITLE:''{{PAGENAME}}''}}
10413 !! html/parsoid
10414 <meta property="mw:PageProp/displaytitle" content="Main Page" about="#mwt3" typeof="mw:ExpandedAttrs" data-parsoid='{"src":"{{DISPLAYTITLE:&#39;&#39;{{PAGENAME}}&#39;&#39;}}"}' data-mw='{"attribs":[[{"txt":"content"},{"html":"&lt;i data-parsoid=&#39;{\"dsr\":[15,31,2,2]}&#39;>&lt;span about=\"#mwt2\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[]],\"dsr\":[17,29,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"PAGENAME\",\"function\":\"pagename\"},\"params\":{},\"i\":0}}]}&#39;>Main Page&lt;/span>&lt;/i>"}]]}'/>
10415 !! end
10416
10417 !! test
10418 Parsoid: Template-generated DISPLAYTITLE
10419 !! wikitext
10420 {{{{echo|DISPLAYTITLE}}:Foo}}
10421 !! html/parsoid
10422 <meta property="mw:PageProp/displaytitle" content="Foo" about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"{{echo|DISPLAYTITLE}}:Foo"},"params":{},"i":0}}]}'/>
10423 !! end
10424
10425 !! test
10426 Namespace 1 {{ns:1}}
10427 !! wikitext
10428 {{ns:1}}
10429 !! html
10430 <p>Talk
10431 </p>
10432 !! end
10433
10434 !! test
10435 Namespace 1 {{ns:01}}
10436 !! wikitext
10437 {{ns:01}}
10438 !! html
10439 <p>Talk
10440 </p>
10441 !! end
10442
10443 !! test
10444 Namespace 0 {{ns:0}} (T6783)
10445 !! wikitext
10446 {{ns:0}}
10447 !! html
10448
10449 !! end
10450
10451 !! test
10452 Namespace 0 {{ns:00}} (T6783)
10453 !! wikitext
10454 {{ns:00}}
10455 !! html
10456
10457 !! end
10458
10459 !! test
10460 Namespace -1 {{ns:-1}}
10461 !! wikitext
10462 {{ns:-1}}
10463 !! html
10464 <p>Special
10465 </p>
10466 !! end
10467
10468 !! test
10469 Namespace User {{ns:User}}
10470 !! wikitext
10471 {{ns:User}}
10472 !! html
10473 <p>User
10474 </p>
10475 !! end
10476
10477 !! test
10478 Namespace User talk {{ns:User_talk}}
10479 !! wikitext
10480 {{ns:User_talk}}
10481 !! html
10482 <p>User talk
10483 </p>
10484 !! end
10485
10486 !! test
10487 Namespace User talk {{ns:uSeR tAlK}}
10488 !! wikitext
10489 {{ns:uSeR tAlK}}
10490 !! html
10491 <p>User talk
10492 </p>
10493 !! end
10494
10495 !! test
10496 Namespace File {{ns:File}}
10497 !! wikitext
10498 {{ns:File}}
10499 !! html
10500 <p>File
10501 </p>
10502 !! end
10503
10504 !! test
10505 Namespace File {{ns:Image}}
10506 !! wikitext
10507 {{ns:Image}}
10508 !! html
10509 <p>File
10510 </p>
10511 !! end
10512
10513 !! test
10514 Namespace (lang=de) Benutzer {{ns:User}}
10515 !! options
10516 language=de
10517 !! wikitext
10518 {{ns:User}}
10519 !! html
10520 <p>Benutzer
10521 </p>
10522 !! end
10523
10524 !! test
10525 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
10526 !! options
10527 language=de
10528 !! wikitext
10529 {{ns:3}}
10530 !! html
10531 <p>Benutzer Diskussion
10532 </p>
10533 !! end
10534
10535 !! test
10536 Urlencode
10537 !! wikitext
10538 {{urlencode:hi world?!}}
10539 {{urlencode:hi world?!|WIKI}}
10540 {{urlencode:hi world?!|PATH}}
10541 {{urlencode:hi world?!|QUERY}}
10542 !! html/php
10543 <p>hi+world%3F%21
10544 hi_world%3F!
10545 hi%20world%3F%21
10546 hi+world%3F%21
10547 </p>
10548 !! end
10549
10550 !! test
10551 Magic Word: prioritize type info over data-parsoid
10552 !! options
10553 parsoid=html2wt
10554 !! html/parsoid
10555 <meta property="mw:PageProp/forcetoc" data-parsoid='{"magicSrc":"__NOTOC__"}'/>
10556 !! wikitext
10557 __FORCETOC__
10558 !! end
10559
10560 !! test
10561 Magic Word: serialize on separate line (parsoid)
10562 !! options
10563 parsoid=wt2wt,html2wt
10564 !! wikitext
10565 foo
10566 __NOTOC__
10567 bar
10568 !! html/parsoid
10569 foo<meta property="mw:PageProp/notoc"/>bar
10570 !! end
10571
10572 !! test
10573 Magic Word: rt non-english wikis
10574 !! options
10575 parsoid=wt2wt
10576 language=de
10577 !! wikitext
10578 __NOEDITSECTION__
10579 !! html/parsoid
10580 <meta property="mw:PageProp/noeditsection" data-parsoid='{"magicSrc":"__NOEDITSECTION__"}'/>
10581 !! end
10582
10583 !!test
10584 __proto__ is treated as normal wikitext (T105997)
10585 !!wikitext
10586 __proto__
10587 !!html
10588 <p>__proto__
10589 </p>
10590 !!end
10591
10592 ###
10593 ### Magic links
10594 ###
10595 !! test
10596 Magic links: internal link to RFC (T2479)
10597 !! wikitext
10598 [[RFC 123]]
10599 !! html/php
10600 <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>
10601 </p>
10602 !! html/parsoid
10603 <p><a rel="mw:WikiLink" href="./RFC_123" title="RFC 123">RFC 123</a></p>
10604 !! end
10605
10606 !! test
10607 Magic links: RFC (T2479)
10608 !! wikitext
10609 RFC 822
10610 !! html/php
10611 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
10612 </p>
10613 !! html/parsoid
10614 <p><a href="//tools.ietf.org/html/rfc822" rel="mw:ExtLink">RFC 822</a></p>
10615 !! end
10616
10617 !! test
10618 Magic links: RFC (T67278)
10619 !! wikitext
10620 This is RFC 822 but thisRFC 822 is not RFC 822linked.
10621 !! html/php
10622 <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.
10623 </p>
10624 !! html/parsoid
10625 <p>This is <a href="//tools.ietf.org/html/rfc822" rel="mw:ExtLink">RFC 822</a> but thisRFC 822 is not RFC 822linked.</p>
10626 !! end
10627
10628 !! test
10629 Magic links: RFC (w/ non-newline whitespace, T30950/T31025)
10630 !! wikitext
10631 RFC &nbsp;&#160;&#0160;&#xA0;&#Xa0; 822
10632 RFC
10633 822
10634 !! html/php
10635 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
10636 RFC
10637 822
10638 </p>
10639 !! html/parsoid
10640 <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>
10641 RFC
10642 822</p>
10643 !! end
10644
10645 !! test
10646 Magic links: ISBN (T3937)
10647 !! wikitext
10648 ISBN 0-306-40615-2
10649 !! html/php
10650 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
10651 </p>
10652 !! html/parsoid
10653 <p><a href="./Special:BookSources/0306406152" rel="mw:WikiLink">ISBN 0-306-40615-2</a></p>
10654 !! end
10655
10656 !! test
10657 Magic links: ISBN (T67278)
10658 !! wikitext
10659 This is ISBN 978-0-316-09811-3 but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.
10660 !! html/php
10661 <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.
10662 </p>
10663 !! html/parsoid
10664 <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>
10665 !! end
10666
10667 !! test
10668 Magic links: ISBN (w/ non-newline whitespace, T30950/T31025)
10669 !! wikitext
10670 ISBN &nbsp;&#160;&#0160;&#xA0;&#Xa0; 978&nbsp;0&#160;316&#0160;09811&#xA0;3
10671 ISBN
10672 9780316098113
10673 ISBN 978
10674 0316098113
10675 !! html/php
10676 <p><a href="/wiki/Special:BookSources/9780316098113" class="internal mw-magiclink-isbn">ISBN 978 0 316 09811 3</a>
10677 ISBN
10678 9780316098113
10679 ISBN 978
10680 0316098113
10681 </p>
10682 !! html/parsoid
10683 <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>
10684 ISBN
10685 9780316098113
10686 ISBN 978
10687 0316098113</p>
10688 !! end
10689
10690 !! test
10691 Magic links: PMID incorrectly converts space to underscore
10692 !! wikitext
10693 PMID 1234
10694 !! html/php
10695 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
10696 </p>
10697 !! html/parsoid
10698 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract" rel="mw:ExtLink">PMID 1234</a></p>
10699 !! end
10700
10701 !! test
10702 Magic links: PMID (T67278)
10703 !! wikitext
10704 This is PMID 1234 but thisPMID 1234 is not PMID 1234linked.
10705 !! html/php
10706 <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.
10707 </p>
10708 !! html/parsoid
10709 <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>
10710 !! end
10711
10712 !! test
10713 Magic links: PMID (w/ non-newline whitespace, T30950/T31025)
10714 !! wikitext
10715 PMID &nbsp;&#160;&#0160;&#xA0;&#Xa0; 1234
10716 PMID
10717 1234
10718 !! html/php
10719 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
10720 PMID
10721 1234
10722 </p>
10723 !! html/parsoid
10724 <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>
10725 PMID
10726 1234</p>
10727 !! end
10728
10729 # <nowiki> nodes shouldn't be inserted during html2wt by Parsoid,
10730 # since these are ExtLinkText, not MagicLinkText
10731 !! test
10732 Magic links: use appropriate serialization for "almost" magic links.
10733 !! wikitext
10734 X[[Special:BookSources/0978739256|foo]]
10735
10736 X[//tools.ietf.org/html/rfc1234 foo]
10737 !! html/php
10738 <p>X<a href="/wiki/Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a>
10739 </p><p>X<a rel="nofollow" class="external text" href="//tools.ietf.org/html/rfc1234">foo</a>
10740 </p>
10741 !! html/parsoid
10742 <p>X<a rel="mw:WikiLink" href="./Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a></p>
10743 <p>X<a rel="mw:ExtLink" href="//tools.ietf.org/html/rfc1234">foo</a></p>
10744 !! end
10745
10746 !! test
10747 Magic links: All disabled (T47942)
10748 !! options
10749 wgEnableMagicLinks={"ISBN":false, "PMID":false, "RFC":false}
10750 !! wikitext
10751 ISBN 0-306-40615-2
10752 PMID 1234
10753 RFC 4321
10754 !! html/php
10755 <p>ISBN 0-306-40615-2
10756 PMID 1234
10757 RFC 4321
10758 </p>
10759 !! end
10760
10761 ###
10762 ### Templates
10763 ####
10764
10765 !! test
10766 Nonexistent template
10767 !! wikitext
10768 {{thistemplatedoesnotexist}}
10769 !! html
10770 <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>
10771 </p>
10772 !! end
10773
10774 !! test
10775 Template with invalid target containing tags
10776 !! wikitext
10777 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
10778 !! html
10779 <p>{{a<b>b</b>|foo|a=b|a = b}}
10780 </p>
10781 !! end
10782
10783 !! test
10784 Template with invalid target containing unclosed tag
10785 !! wikitext
10786 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
10787 !! html
10788 <p>{{a<b>|foo|a=b|a = b}}</b>
10789 </p>
10790 !! end
10791
10792 !! test
10793 Template with invalid target containing wikilink
10794 !! wikitext
10795 {{[[Main Page]]}}
10796 !! html/php
10797 <p>{{<a href="/wiki/Main_Page" title="Main Page">Main Page</a>}}
10798 </p>
10799 !! html/parsoid
10800 <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>
10801 !! end
10802
10803 !! test
10804 Template with just whitespace in it, T70421
10805 !! wikitext
10806 {{echo|{{ }}}}
10807 !! html/parsoid
10808 <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>
10809 !! end
10810
10811 !! article
10812 Template:test
10813 !! text
10814 This is a test template
10815 !! endarticle
10816
10817 !! test
10818 Simple template
10819 !! wikitext
10820 {{test}}
10821 !! html
10822 <p>This is a test template
10823 </p>
10824 !! end
10825
10826 !! test
10827 Template with explicit namespace
10828 !! wikitext
10829 {{Template:test}}
10830 !! html
10831 <p>This is a test template
10832 </p>
10833 !! end
10834
10835
10836 !! article
10837 Template:paramtest
10838 !! text
10839 This is a test template with parameter {{{param}}}
10840 !! endarticle
10841
10842 !! test
10843 Template parameter
10844 !! wikitext
10845 {{paramtest|param=foo}}
10846 !! html
10847 <p>This is a test template with parameter foo
10848 </p>
10849 !! end
10850
10851 !! article
10852 Template:paramtestnum
10853 !! text
10854 [[{{{1}}}|{{{2}}}]]
10855 !! endarticle
10856
10857 !! test
10858 Template unnamed parameter
10859 !! wikitext
10860 {{paramtestnum|Main Page|the main page}}
10861 !! html
10862 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
10863 </p>
10864 !! end
10865
10866 !! article
10867 Template:templatesimple
10868 !! text
10869 (test)
10870 !! endarticle
10871
10872 !! article
10873 Template:templateredirect
10874 !! text
10875 #redirect [[Template:templatesimple]]
10876 !! endarticle
10877
10878 !! article
10879 Template:templateasargtestnum
10880 !! text
10881 {{{{{1}}}}}
10882 !! endarticle
10883
10884 !! article
10885 Template:templateasargtest
10886 !! text
10887 {{template{{{templ}}}}}
10888 !! endarticle
10889
10890 !! article
10891 Template:templateasargtest2
10892 !! text
10893 {{{{{templ}}}}}
10894 !! endarticle
10895
10896 !! test
10897 Template with template name as unnamed argument
10898 !! wikitext
10899 {{templateasargtestnum|templatesimple}}
10900 !! html
10901 <p>(test)
10902 </p>
10903 !! end
10904
10905 !! test
10906 Template with template name as argument
10907 !! wikitext
10908 {{templateasargtest|templ=simple}}
10909 !! html
10910 <p>(test)
10911 </p>
10912 !! end
10913
10914 !! test
10915 Template with template name as argument (2)
10916 !! wikitext
10917 {{templateasargtest2|templ=templatesimple}}
10918 !! html
10919 <p>(test)
10920 </p>
10921 !! end
10922
10923 !! article
10924 Template:templateasargtestdefault
10925 !! text
10926 {{{{{templ|templatesimple}}}}}
10927 !! endarticle
10928
10929 !! article
10930 Template:templa
10931 !! text
10932 '''templ'''
10933 !! endarticle
10934
10935 !! test
10936 Template with default value
10937 !! wikitext
10938 {{templateasargtestdefault}}
10939 !! html
10940 <p>(test)
10941 </p>
10942 !! end
10943
10944 !! test
10945 Template with default value (value set)
10946 !! wikitext
10947 {{templateasargtestdefault|templ=templa}}
10948 !! html
10949 <p><b>templ</b>
10950 </p>
10951 !! end
10952
10953 !! test
10954 Template redirect
10955 !! wikitext
10956 {{templateredirect}}
10957 !! html/php
10958 <p>(test)
10959 </p>
10960 !! html/parsoid
10961 <link rel="mw:PageProp/redirect" href="./Template:Templatesimple" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"templateredirect","href":"./Template:Templateredirect"},"params":{},"i":0}}]}'/>
10962 !! end
10963
10964 !! test
10965 Template with argument in separate line
10966 !! wikitext
10967 {{ templateasargtest |
10968 templ = simple }}
10969 !! html
10970 <p>(test)
10971 </p>
10972 !! end
10973
10974 !! test
10975 Template with complex template as argument
10976 !! wikitext
10977 {{paramtest|
10978 param ={{ templateasargtest |
10979 templ = simple }}}}
10980 !! html
10981 <p>This is a test template with parameter (test)
10982 </p>
10983 !! end
10984
10985 !! test
10986 Template with thumb image (with link in description)
10987 !! wikitext
10988 {{paramtest|param=[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
10989 !! html/php
10990 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>
10991
10992 !! html+tidy
10993 <p>This is a test template with parameter</p>
10994 <div class="thumb tright">
10995 <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>
10996 <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>
10997 </div>
10998 </div>
10999 !! html/parsoid
11000 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"paramtest","href":"./Template:Paramtest"},"params":{"param":{"wt":"[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]"}},"i":0}}]}'>This is a test template with parameter </p><figure class="mw-default-size" typeof="mw:Error mw:Image/Thumb" about="#mwt1" data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}]}'><a href="./File:Noimage.png" ><img resource="./File:Noimage.png" src="./Special:FilePath/Noimage.png" height="220" width="220"/></a><figcaption><a rel="mw:WikiLink" href="./No_link" title="No link">link</a> <a rel="mw:WikiLink" href="./No_link" title="No link">caption</a></figcaption></figure>
11001 !! end
11002
11003 !! article
11004 Template:complextemplate
11005 !! text
11006 {{{1}}} {{paramtest|
11007 param ={{{param}}}}}
11008 !! endarticle
11009
11010 !! test
11011 Template with complex arguments
11012 !! wikitext
11013 {{complextemplate|
11014 param ={{ templateasargtest |
11015 templ = simple }}|[[Template:complextemplate|link]]}}
11016 !! html
11017 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
11018 </p>
11019 !! end
11020
11021 !! test
11022 T2553: link with two variables in a piped link
11023 !! wikitext
11024 {|
11025 |[[{{{1}}}|{{{2}}}]]
11026 |}
11027 !! html/php
11028 <table>
11029 <tr>
11030 <td>[[{{{1}}}|{{{2}}}]]
11031 </td></tr></table>
11032
11033 !! html/parsoid
11034 <table>
11035 <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>
11036 </tbody></table>
11037 !! end
11038
11039 # See: T2553
11040 !! test
11041 Abort table cell attribute parsing on wikilink
11042 !! wikitext
11043 {|
11044 | testing [[one|two]] | three || four
11045 | testing one two | three || four
11046 | testing="[[one|two]]" | three || four
11047 |}
11048 !! html/php
11049 <table>
11050 <tr>
11051 <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>
11052 <td> four
11053 </td>
11054 <td> three </td>
11055 <td> four
11056 </td>
11057 <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>
11058 <td> four
11059 </td></tr></table>
11060
11061 !! html/parsoid
11062 <table>
11063 <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>
11064 <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>
11065 <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>
11066 </tbody></table>
11067 !! end
11068
11069 !! test
11070 Don't abort table cell attribute parsing if wikilink is found in template arg
11071 !! wikitext
11072 {|
11073 | Test {{#tag:ref|One two "[[three]]" four}}
11074 |}
11075 !! html/parsoid
11076 <table>
11077 <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>
11078 </tbody></table>
11079 !! end
11080
11081 !! test
11082 Magic variable as template parameter
11083 !! wikitext
11084 {{paramtest|param={{SITENAME}}}}
11085 !! html
11086 <p>This is a test template with parameter MediaWiki
11087 </p>
11088 !! end
11089
11090 !! article
11091 Template:linktest
11092 !! text
11093 [[{{{param}}}|link]]
11094 !! endarticle
11095
11096 !! test
11097 Template parameter as link source
11098 !! wikitext
11099 {{linktest|param=Main Page}}
11100 !! html
11101 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
11102 </p>
11103 !! end
11104
11105 !!article
11106 Template:paramtest2
11107 !! text
11108 including another template, {{paramtest|param={{{arg}}}}}
11109 !! endarticle
11110
11111 !! test
11112 Template passing argument to another template
11113 !! wikitext
11114 {{paramtest2|arg='hmm'}}
11115 !! html
11116 <p>including another template, This is a test template with parameter 'hmm'
11117 </p>
11118 !! end
11119
11120 !! article
11121 Template:Linktest2
11122 !! text
11123 Main Page
11124 !! endarticle
11125
11126 !! test
11127 Template as link source
11128 !! wikitext
11129 [[{{linktest2}}]]
11130
11131 [[{{linktest2}}|Main Page]]
11132
11133 [[{{linktest2}}]]Page
11134 !! html
11135 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
11136 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
11137 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
11138 </p>
11139 !! end
11140
11141
11142 !! article
11143 Template:loop1
11144 !! text
11145 {{loop2}}
11146 !! endarticle
11147
11148 !! article
11149 Template:loop2
11150 !! text
11151 {{loop1}}
11152 !! endarticle
11153
11154 !! test
11155 Template infinite loop
11156 !! wikitext
11157 {{loop1}}
11158 !! html
11159 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
11160 </p>
11161 !! end
11162
11163 !! test
11164 Template from main namespace
11165 !! wikitext
11166 {{:Main Page}}
11167 !! html
11168 <p>blah blah
11169 </p>
11170 !! end
11171
11172 !! article
11173 Template:table
11174 !! text
11175 {|
11176 | 1 || 2
11177 |-
11178 | 3 || 4
11179 |}
11180 !! endarticle
11181
11182 !! test
11183 T2529: Template with table, not included at beginning of line
11184 !! wikitext
11185 foo {{table}}
11186 !! html
11187 <p>foo
11188 </p>
11189 <table>
11190 <tr>
11191 <td> 1 </td>
11192 <td> 2
11193 </td></tr>
11194 <tr>
11195 <td> 3 </td>
11196 <td> 4
11197 </td></tr></table>
11198
11199 !! end
11200
11201 !! test
11202 T2523: Template shouldn't eat newline (or add an extra one before table)
11203 !! wikitext
11204 foo
11205 {{table}}
11206 !! html
11207 <p>foo
11208 </p>
11209 <table>
11210 <tr>
11211 <td> 1 </td>
11212 <td> 2
11213 </td></tr>
11214 <tr>
11215 <td> 3 </td>
11216 <td> 4
11217 </td></tr></table>
11218
11219 !! end
11220
11221 !! test
11222 T2041: Template parameters shown as broken links
11223 !! wikitext
11224 {{{parameter}}}
11225 !! html
11226 <p>{{{parameter}}}
11227 </p>
11228 !! end
11229
11230 !! test
11231 Template with targets containing wikilinks
11232 !! wikitext
11233 {{[[foo]]}}
11234
11235 {{[[{{echo|foo}}]]}}
11236
11237 {{{{echo|[[foo}}]]}}
11238 !! html
11239 <p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
11240 </p><p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
11241 </p><p>{{[[foo}}]]
11242 </p>
11243 !! end
11244
11245 !! article
11246 Template:''
11247 !! text
11248 bar
11249 !! endarticle
11250
11251 !! test
11252 Templates: Double quotes as template target
11253 !! wikitext
11254 foo {{''}} baz
11255 !! html/php
11256 <p>foo bar baz
11257 </p>
11258 !! html/parsoid
11259 <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
11260 </p>
11261 !! end
11262
11263 ## This test is about making sure Parsoid's data-mw is well formed in the
11264 ## face of multiple templates with intersecting and overlapping ranges. The
11265 ## wikitext itself is wretched.
11266 !! test
11267 Templates with intersecting and overlapping ranges
11268 !! wikitext
11269 {|{{echo|
11270 <p>ha</p>}}
11271 {|{{echo|
11272 <p>ho</p>}}
11273 {{echo|{{!}}hi}}
11274 |}
11275 !! html/php+tidy
11276 <p>ha</p>
11277 <p>ho</p>
11278 <table>
11279 <tr>
11280 <td></td>
11281 </tr>
11282 <tr>
11283 <td>hi</td>
11284 </tr>
11285 </table>
11286 <table>
11287 <tr>
11288 <td></td>
11289 </tr>
11290 </table>
11291 !! html/parsoid
11292 <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":""}]]}'>
11293
11294 </table><p about="#mwt1">ho</p><table about="#mwt1" typeof="mw:ExpandedAttrs" data-mw='{"attribs":[[{"txt":"","html":""},{"html":""}]]}'>
11295
11296 <tbody><tr><td>hi</td></tr>
11297 </tbody></table>
11298 !! end
11299
11300 !! article
11301 Template:MSGNW test
11302 !! text
11303 ''None'' of '''this''' should be
11304 * interpreted
11305 but rather passed unmodified
11306 {{test}}
11307 <gallery>
11308 File:Foobar.jpg
11309 </gallery>
11310 <!-- comment -->
11311 !! endarticle
11312
11313 # hmm, fix this or just deprecate msgnw and document its behavior?
11314 !! test
11315 msgnw keyword
11316 !! wikitext
11317 {{msgnw:MSGNW test}}
11318 !! html/php
11319 <p>&#39;&#39;None&#39;&#39; of &#39;&#39;&#39;this&#39;&#39;&#39; should be
11320 &#42; interpreted
11321 &#32;but rather passed unmodified
11322 &#123;&#123;test&#125;&#125;
11323 &#60;gallery&#62;
11324 File:Foobar.jpg
11325 &#60;/gallery&#62;
11326 &#60;!-- comment --&#62;
11327 </p>
11328 !! end
11329
11330 !! test
11331 int keyword
11332 !! wikitext
11333 {{int:youhavenewmessages|lots of money|not!}}
11334 !! html
11335 <p>You have lots of money (not!).
11336 </p>
11337 !! end
11338
11339 !! test
11340 int keyword - non-existing message
11341 !! wikitext
11342 {{int:var}}
11343 !! html
11344 <p>⧼var⧽
11345 </p>
11346 !! end
11347
11348 !! article
11349 Template:Includes
11350 !! text
11351 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
11352 !! endarticle
11353
11354 !! test
11355 <includeonly> and <noinclude> being included
11356 !! wikitext
11357 {{Includes}}
11358 !! html
11359 <p>Foobar
11360 </p>
11361 !! end
11362
11363 !! article
11364 Template:Includes2
11365 !! text
11366 <onlyinclude>Foo</onlyinclude>bar
11367 !! endarticle
11368
11369 !! test
11370 <onlyinclude> being included
11371 !! wikitext
11372 {{Includes2}}
11373 !! html
11374 <p>Foo
11375 </p>
11376 !! end
11377
11378
11379 !! article
11380 Template:Includes3
11381 !! text
11382 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
11383 !! endarticle
11384
11385 !! test
11386 <onlyinclude> and <includeonly> being included
11387 !! wikitext
11388 {{Includes3}}
11389 !! html
11390 <p>Foo
11391 </p>
11392 !! end
11393
11394 !! test
11395 <includeonly> and <noinclude> on a page
11396 !! wikitext
11397 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
11398 !! html
11399 <p>Foozar
11400 </p>
11401 !! end
11402
11403 !! test
11404 Un-closed <noinclude>
11405 !! wikitext
11406 <noinclude>
11407 !! html
11408 !! end
11409
11410 !! test
11411 <onlyinclude> on a page
11412 !! wikitext
11413 <onlyinclude>Foo</onlyinclude>bar
11414 !! html
11415 <p>Foobar
11416 </p>
11417 !! end
11418
11419 !! test
11420 Un-closed <onlyinclude>
11421 !! wikitext
11422 <onlyinclude>
11423 !! html
11424 !! end
11425
11426 !!test
11427 Self-closed noinclude, includeonly, onlyinclude tags
11428 !! wikitext
11429 <noinclude />
11430 <includeonly />
11431 <onlyinclude />
11432 !! html
11433 <p><br />
11434 </p>
11435 !!end
11436
11437 !!test
11438 Unbalanced includeonly and noinclude tags
11439 !! wikitext
11440 {|
11441 |a</noinclude>
11442 |b</noinclude></noinclude>
11443 |c</noinclude></includeonly>
11444 |d</includeonly></includeonly>
11445 |}
11446 !! html
11447 <table>
11448 <tr>
11449 <td>a
11450 </td>
11451 <td>b
11452 </td>
11453 <td>c&lt;/includeonly&gt;
11454 </td>
11455 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
11456 </td></tr></table>
11457
11458 !!end
11459
11460 !! article
11461 Template:Includeonly section
11462 !! text
11463 <includeonly>
11464 ==Includeonly section==
11465 </includeonly>
11466 ==Section T-1==
11467 !!endarticle
11468
11469 !! test
11470 T8563: Edit link generation for section shown by <includeonly>
11471 !! wikitext
11472 {{includeonly section}}
11473 !! html
11474 <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>
11475 <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>
11476
11477 !! end
11478
11479 # Uses same input as the contents of [[Template:Includeonly section]]
11480 !! test
11481 T8563: Section extraction for section shown by <includeonly>
11482 !! options
11483 section=T-2
11484 !! wikitext
11485 <includeonly>
11486 ==Includeonly section==
11487 </includeonly>
11488 ==Section T-2==
11489 !! html
11490 ==Section T-2==
11491 !! end
11492
11493 !! test
11494 T8563: Edit link generation for section suppressed by <includeonly>
11495 !! wikitext
11496 <includeonly>
11497 ==Includeonly section==
11498 </includeonly>
11499 ==Section 1==
11500 !! html
11501 <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>
11502
11503 !! end
11504
11505 !! test
11506 T8563: Section extraction for section suppressed by <includeonly>
11507 !! options
11508 section=1
11509 !! wikitext
11510 <includeonly>
11511 ==Includeonly section==
11512 </includeonly>
11513 ==Section 1==
11514 !! html
11515 ==Section 1==
11516 !! end
11517
11518 !! test
11519 Un-closed <includeonly>
11520 !! wikitext
11521 <includeonly>
11522 !! html/php
11523 !! html/parsoid
11524 <meta typeof="mw:Includes/IncludeOnly" data-parsoid='{"src":"&lt;includeonly>"}'/>
11525 !! end
11526
11527 ## We used to, but no longer wt2wt this test since the default serializer
11528 ## will normalize the include directives to serialize on their own line.
11529 ## Selser will take care of preserving formatting in scenarios where they
11530 ## intermingled with other wikitext.
11531 !! test
11532 Includes and comments at SOL
11533 !! options
11534 parsoid=wt2html,html2html
11535 !! wikitext
11536 <!-- comment --><noinclude><!-- comment --></noinclude><!-- comment -->== hu ==
11537
11538 <noinclude>
11539 some
11540 </noinclude>* stuff
11541 * here
11542
11543 <includeonly>can have stuff</includeonly>=== here ===
11544
11545 !! html/php
11546 <h2><span class="mw-headline" id="hu">hu</span></h2>
11547 <p>some
11548 </p>
11549 <ul><li> stuff</li>
11550 <li> here</li></ul>
11551 <h3><span class="mw-headline" id="here">here</span></h3>
11552
11553 !! html/parsoid
11554 <!-- 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>
11555
11556 <meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/>
11557 <p>some</p>
11558 <meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"&lt;/noinclude>"}'/><ul><li> stuff</li>
11559 <li> here</li></ul>
11560
11561 <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>
11562
11563 !! end
11564
11565 # TODO: test with DOM fragment reuse!
11566 !! test
11567 Parsoid: DOM fragment reuse
11568 !! options
11569 parsoid=wt2wt,wt2html
11570 !! wikitext
11571 a{{echo|b<table></table>c}}d
11572
11573 a{{echo|b
11574 <table></table>
11575 c}}d
11576
11577 {{echo|a
11578
11579 <table></table>
11580
11581 b}}
11582 !! html
11583 <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>
11584
11585 <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">
11586 </span><table about="#mwt2" data-parsoid='{"stx":"html"}'></table><span about="#mwt2">
11587 </span><p about="#mwt2">cd</p>
11588
11589 <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">
11590
11591 </span><table about="#mwt3" data-parsoid='{"stx":"html"}'></table><span about="#mwt3">
11592
11593 </span><p about="#mwt3">b</p>
11594 !! end
11595
11596 !! test
11597 Parsoid: Merge double tds (T52603)
11598 !! options
11599 parsoid
11600 !! wikitext
11601 {|
11602 |{{echo|{{!}} foo}}
11603 |}
11604 !! html
11605 <table><tbody>
11606 <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>
11607 </tbody></table>
11608 !! end
11609
11610 !! test
11611 Parsoid: Merge double tds in nested transclusion content (T52603)
11612 !! options
11613 parsoid
11614 !! wikitext
11615 {{echo|<div>}}
11616 {|
11617 |{{echo|{{!}} foo}}
11618 |}
11619 {{echo|</div>}}
11620 !! html
11621 <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}}]}'>
11622 <table><tbody>
11623 <tr><td data-mw='{"parts":["|"]}'> foo</td></tr>
11624 </tbody></table>
11625 </div>
11626 !! end
11627
11628 ###
11629 ### <includeonly> and <noinclude> in attributes
11630 ###
11631 !!test
11632 0. includeonly around the entire attribute
11633 !! wikitext
11634 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
11635 !! html
11636 <p><span id="v2">bar</span>
11637 </p>
11638 !!end
11639
11640 !!test
11641 1. includeonly in html attr key
11642 !! wikitext
11643 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
11644 !! html
11645 <p><span id="foo">bar</span>
11646 </p>
11647 !!end
11648
11649 !!test
11650 2. includeonly in html attr value
11651 !! wikitext
11652 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
11653 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
11654 !! html
11655 <p><span id="v1">bar</span>
11656 <span id="v1">bar</span>
11657 </p>
11658 !!end
11659
11660 !!test
11661 3. includeonly in part of an attr value
11662 !! wikitext
11663 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
11664 !! html
11665 <p><span style="color:red;">bar</span>
11666 </p>
11667 !!end
11668
11669 !!test
11670 4. includeonly in table attributes
11671 !! wikitext
11672 {|
11673 |- <noinclude>
11674 |-
11675 |a
11676 </noinclude>
11677 |- <includeonly>
11678 |-
11679 |b
11680 </includeonly>
11681 |}
11682 !! html
11683 <table>
11684
11685
11686 <tr>
11687 <td>a
11688 </td></tr>
11689 </table>
11690
11691 !!end
11692
11693 ###
11694 ### Token Stream Patcher tests
11695 ###
11696 ### These tests won't always pass wt2wt and other modes because
11697 ### on serialization, the table will be output on a new line.
11698 ### For now, we are blacklisting them, and using this to test selser.
11699 ###
11700
11701 !!test
11702 1. Table tag in SOL posn. should get reparsed correctly with valid TSR
11703 !!options
11704 parsoid=wt2html,wt2wt
11705 !!wikitext
11706 {{echo|}}{| width = '100%'
11707 |foo
11708 |}
11709 !!html/parsoid
11710 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":""}},"i":0}}]}'></span><table width="100%">
11711 <tbody><tr><td>foo</td></tr>
11712 </tbody></table>
11713 !!end
11714
11715 ## We used to, but no longer wt2wt this test since the default serializer
11716 ## will normalize the include directives to serialize on their own line.
11717 ## Selser will take care of preserving formatting in scenarios where they
11718 ## intermingled with other wikitext.
11719 !!test
11720 2. Table tag in SOL posn. should get reparsed correctly with valid TSR
11721 !!options
11722 parsoid=wt2html
11723 !!wikitext
11724 <includeonly>a</includeonly>{| {{{b}}}
11725 |c
11726 |}
11727 !!html/parsoid
11728 <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":""}]]}'>
11729 <tbody><tr><td>c</td></tr>
11730 </tbody></table>
11731 !!end
11732
11733 !! test
11734 Table wikitext syntax outside wiki-tables
11735 !! wikitext
11736 a
11737 |+ not a caption
11738 ! not a table heading
11739 |- not a table row
11740 | not a table cell
11741 | class="foo bar" | baz
11742 b
11743 |}
11744 |-
11745 c
11746 !! html
11747 <p>a
11748 |+ not a caption
11749 ! not a table heading
11750 |- not a table row
11751 | not a table cell
11752 | class="foo bar" | baz
11753 b
11754 |}
11755 |-
11756 c
11757 </p>
11758 !! end
11759
11760 ###
11761 ### Testing parsing of templates where a template arg
11762 ### has the same name as the template itself.
11763 ###
11764
11765 !! article
11766 Template:quote
11767 !! text
11768 {{{quote|{{{1}}}}}}
11769 !! endarticle
11770
11771 !!test
11772 Templates: Template Name/Arg clash: 1. Use of positional param
11773 !! wikitext
11774 {{quote|foo}}
11775 !! html
11776 <p>foo
11777 </p>
11778 !!end
11779
11780 !!test
11781 Templates: Template Name/Arg clash: 2. Use of named param
11782 !! wikitext
11783 {{quote|quote=foo}}
11784 !! html
11785 <p>foo
11786 </p>
11787 !!end
11788
11789 !!test
11790 Templates: Template Name/Arg clash: 3. Use of named param with empty input
11791 !! wikitext
11792 {{quote|quote}}
11793 !! html
11794 <p>quote
11795 </p>
11796 !!end
11797
11798 ###
11799 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
11800 ###
11801
11802 !!test
11803 Templates: 1. Simple use
11804 !! wikitext
11805 {{echo|Foo}}
11806 !! html
11807 <p>Foo
11808 </p>
11809 !!end
11810
11811 !!test
11812 Templates: 2. Inside a block tag
11813 !! wikitext
11814 <div>{{echo|Foo}}</div>
11815 <blockquote>{{echo|Foo}}</blockquote>
11816 !! html
11817 <div>Foo</div>
11818 <blockquote>Foo</blockquote>
11819
11820 !! html+tidy
11821 <div>Foo</div>
11822 <blockquote>
11823 <p>Foo</p>
11824 </blockquote>
11825 !!end
11826
11827 !!test
11828 Templates: P-wrapping: 1a. Templates on consecutive lines
11829 !! wikitext
11830 {{echo|Foo}}
11831 {{echo|bar}}
11832 !! html
11833 <p>Foo
11834 bar
11835 </p>
11836 !!end
11837
11838 !!test
11839 Templates: P-wrapping: 1b. Templates on consecutive lines
11840 !! wikitext
11841 Foo
11842
11843 {{echo|bar}}
11844 {{echo|baz}}
11845 !! html
11846 <p>Foo
11847 </p><p>bar
11848 baz
11849 </p>
11850 !!end
11851
11852 !!test
11853 Templates: P-wrapping: 1c. Templates on consecutive lines
11854 !! wikitext
11855 {{echo|Foo}}
11856 {{echo|bar}} <div>baz</div>
11857 !! html
11858 <p>Foo
11859 </p>
11860 bar <div>baz</div>
11861
11862 !! html+tidy
11863 <p>Foo</p>
11864 <p>bar</p>
11865 <div>baz</div>
11866 !! end
11867
11868 !!test
11869 Templates: P-wrapping: 1d. Template preceded by comment-only line
11870 !!options
11871 parsoid
11872 !! wikitext
11873 <!-- foo -->
11874 {{echo|Bar}}
11875 !! html
11876 <!-- foo -->
11877
11878 <p about="#mwt223" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Bar"}},"i":0}}]}'>Bar</p>
11879 !!end
11880
11881 !!test
11882 Templates: Inline Text: 1. Multiple template uses
11883 !! wikitext
11884 {{echo|Foo}}bar{{echo|baz}}
11885 !! html
11886 <p>Foobarbaz
11887 </p>
11888 !!end
11889
11890 !!test
11891 Templates: Inline Text: 2. Back-to-back template uses
11892 !! wikitext
11893 {{echo|Foo}}{{echo|bar}}
11894 !! html
11895 <p>Foobar
11896 </p>
11897 !!end
11898
11899 !!test
11900 Templates: Block Tags: 1. Multiple template uses
11901 !! wikitext
11902 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
11903 !! html
11904 <div>Foo</div><div>bar</div><div>baz</div>
11905
11906 !!end
11907
11908 !!test
11909 Templates: Block Tags: 2. Back-to-back template uses
11910 !! wikitext
11911 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
11912 !! html
11913 <div>Foo</div><div>bar</div>
11914
11915 !!end
11916
11917 # This is an edge case relating to paragraph wrapping.
11918 !!test
11919 Templates: Correctly encapsulate templates producing </p> tag without a corresponding <p> tag
11920 !! wikitext
11921 {{echo|a
11922 b</p>}}
11923 !! html/parsoid
11924 <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
11925 b</p>
11926 !!end
11927
11928 !!test
11929 Templates: Links: 1. Simple example
11930 !! wikitext
11931 {{echo|[[Foo|bar]]}}
11932 !! html
11933 <p><a href="/wiki/Foo" title="Foo">bar</a>
11934 </p>
11935 !!end
11936
11937 !!test
11938 Templates: Links: 2. Generation of link href
11939 !! wikitext
11940 [[{{echo|Foo}}|bar]]
11941 !! html
11942 <p><a href="/wiki/Foo" title="Foo">bar</a>
11943 </p>
11944 !!end
11945
11946 !!test
11947 Templates: Links: 3. Generation of part of a link href
11948 !! wikitext
11949 [[Fo{{echo|o}}|bar]]
11950
11951 [[Foo{{echo|bar}}]]
11952
11953 [[Foo{{echo|bar}}baz]]
11954
11955 [[Foo{{echo|bar}}|bar]]
11956
11957 [[:Foo{{echo|bar}}]]
11958
11959 [[:Foo{{echo|bar}}|bar]]
11960 !! html
11961 <p><a href="/wiki/Foo" title="Foo">bar</a>
11962 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11963 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
11964 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
11965 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11966 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
11967 </p>
11968 !!end
11969
11970 !!test
11971 Templates: Links: 4. Multiple templates generating link href
11972 !! wikitext
11973 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
11974 !! html
11975 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11976 </p>
11977 !!end
11978
11979 !!test
11980 Templates: Links: 5. Generation of link text
11981 !! wikitext
11982 [[Foo|{{echo|bar}}]]
11983 !! html
11984 <p><a href="/wiki/Foo" title="Foo">bar</a>
11985 </p>
11986 !!end
11987
11988 !!test
11989 Templates: Links: 5. Nested templates (only outermost template should be marked)
11990 !! wikitext
11991 {{echo|[[{{echo|Foo}}|bar]]}}
11992 !! html
11993 <p><a href="/wiki/Foo" title="Foo">bar</a>
11994 </p>
11995 !!end
11996
11997 !!test
11998 Templates: HTML Tag: 1. Generation of HTML attr. key
11999 !! wikitext
12000 <div {{echo|style}}="color:red;">foo</div>
12001 !! html
12002 <div style="color:red;">foo</div>
12003
12004 !!end
12005
12006 !!test
12007 Templates: HTML Tag: 2. Generation of HTML attr. value
12008 !! wikitext
12009 <div style={{echo|'color:red;'}}>foo</div>
12010 !! html
12011 <div style="color:red;">foo</div>
12012
12013 !!end
12014
12015 !!test
12016 Templates: HTML Tag: 3. Generation of HTML attr key and value
12017 !! wikitext
12018 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
12019 !! html
12020 <div style="color:red;">foo</div>
12021
12022 !!end
12023
12024 !!test
12025 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
12026 !! wikitext
12027 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
12028 !! html
12029 <div title="This is a long title with just one piece templated">foo</div>
12030
12031 !!end
12032
12033 !!test
12034 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
12035 !! wikitext
12036 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
12037 !! html
12038 <div title="This is a long title with just one piece templated">foo</div>
12039
12040 !!end
12041
12042 !!test
12043 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
12044 !! wikitext
12045 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
12046 !! html
12047 <div title="This is a long title with just one piece templated">foo</div>
12048
12049 !!end
12050
12051 # SSS FIXME: While it is great we added support for all this,
12052 # do we want to make this part of the spec? Maybe we want to
12053 # deprecate this kind of usage in the future?
12054 !!test
12055 Templates: HTML Tag: 7. Generation of partial attribute key string
12056 !! wikitext
12057 <div st{{echo|yle}}="color:red;">foo</div>
12058 !! html
12059 <div style="color:red;">foo</div>
12060
12061 !!end
12062
12063 !! test
12064 Templates: HTML Tag: 8. Template-generated attribute (k=v)
12065 !! wikitext
12066 <div {{echo|1=id="v1"}}>bar</div>
12067 !! html
12068 <div id="v1">bar</div>
12069
12070 !!end
12071
12072 !! test
12073 Templates: HTML Tag: 9. Multiple template-generated attributes
12074 !! wikitext
12075 <div {{echo|1=id="v1" title="foo"}}>bar</div>
12076 !! html
12077 <div id="v1" title="foo">bar</div>
12078
12079 !!end
12080
12081 !! test
12082 Templates: Support for templates generating attributes and content
12083 !! wikitext
12084 {| {{mixed_attr_content_template}}
12085 |-
12086 |bar
12087 |}
12088 !! html/php
12089 <table style="color:red;" title="T48811">
12090
12091 <tr>
12092 <td>foo
12093 </td></tr>
12094 <tr>
12095 <td>bar
12096 </td></tr></table>
12097
12098 !! html/parsoid
12099 <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|}"]}'>
12100 <tbody><tr>
12101 <td>foo</td></tr>
12102 <tr>
12103 <td>bar</td></tr>
12104 </tbody></table>
12105 !!end
12106
12107 !! test
12108 1. Entities and nowikis inside templated attributes should be handled correctly
12109 !! wikitext
12110 <div {{echo|style{{=}}"background:&#35;f9f9f9;"}}>foo</div>
12111 !! html/php
12112 <div style="background:#f9f9f9;">foo</div>
12113
12114 !! html/parsoid
12115 <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>
12116 !! end
12117
12118 !! test
12119 2. Entities and nowikis inside templated attributes should be handled correctly
12120 !! wikitext
12121 {|
12122 |{{table_attribs_3}}
12123 |}
12124 !! html/php
12125 <table>
12126 <tr>
12127 <td style="background:#f9f9f9;">Foo
12128 </td></tr></table>
12129
12130 !! html/parsoid
12131 <table>
12132 <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>
12133 </tbody></table>
12134 !! end
12135
12136 !! test
12137 3. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
12138 !! wikitext
12139 {{tbl-start}}
12140 |{{table_attribs_3}}
12141 {{tbl-end}}
12142 !! html/php
12143 <table>
12144 <tr>
12145 <td style="background:#f9f9f9;">Foo
12146 </td></tr></table>
12147
12148 !! html/parsoid
12149 <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}}]}'>
12150 <tbody><tr><td style="background:#f9f9f9;">Foo</td></tr>
12151 </tbody></table>
12152 !! end
12153
12154 # T107622
12155 !! test
12156 4. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
12157 !! wikitext
12158 {|
12159 | {{table_attribs_6}} hi
12160 |}
12161 !! html/php
12162 <table>
12163 <tr>
12164 <td style="background: red;"> hi
12165 </td></tr></table>
12166
12167 !! html/parsoid
12168 <table>
12169 <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>
12170 </tbody></table>
12171 !! end
12172
12173 !!test
12174 Templates: HTML Tables: 1. Generating start of a HTML table
12175 !! wikitext
12176 {{echo|<table><tr><td>foo</td>}}</tr></table>
12177 !! html
12178 <table><tr><td>foo</td></tr></table>
12179
12180 !!end
12181
12182 !!test
12183 Templates: HTML Tables: 2a. Generating middle of a HTML table
12184 !! wikitext
12185 <table><tr>{{echo|<td>foo</td>}}</tr></table>
12186 !! html
12187 <table><tr><td>foo</td></tr></table>
12188
12189 !!end
12190
12191 !!test
12192 Templates: HTML Tables: 2b. Generating middle of a HTML table
12193 !! wikitext
12194 <table>{{echo|<tr><td>foo</td></tr>}}</table>
12195 !! html
12196 <table><tr><td>foo</td></tr></table>
12197
12198 !!end
12199
12200 !!test
12201 Templates: HTML Tables: 3. Generating end of a HTML table
12202 !! wikitext
12203 <table><tr>{{echo|<td>foo</td></tr></table>}}
12204 !! html
12205 <table><tr><td>foo</td></tr></table>
12206
12207 !!end
12208
12209 !!test
12210 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
12211 !! wikitext
12212 {{echo|<table>}}<tr><td>foo</td></tr></table>
12213 !! html
12214 <table><tr><td>foo</td></tr></table>
12215
12216 !!end
12217
12218 !!test
12219 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
12220 !! wikitext
12221 <table>{{echo|<tr>}}<td>foo</td></tr></table>
12222 !! html
12223 <table><tr><td>foo</td></tr></table>
12224
12225 !!end
12226
12227 !!test
12228 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
12229 !! wikitext
12230 <table><tr>{{echo|<td>}}foo</td></tr></table>
12231 !! html
12232 <table><tr><td>foo</td></tr></table>
12233
12234 !!end
12235
12236 !!test
12237 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
12238 !! wikitext
12239 <table><tr><td>foo{{echo|</td>}}</tr></table>
12240 !! html
12241 <table><tr><td>foo</td></tr></table>
12242
12243 !!end
12244
12245 !!test
12246 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
12247 !! wikitext
12248 <table><tr><td>foo</td>{{echo|</tr>}}</table>
12249 !! html
12250 <table><tr><td>foo</td></tr></table>
12251
12252 !!end
12253
12254 !!test
12255 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
12256 !! wikitext
12257 <table><tr><td>foo</td></tr>{{echo|</table>}}
12258 !! html
12259 <table><tr><td>foo</td></tr></table>
12260
12261 !!end
12262
12263 !!test
12264 Templates: HTML Tables: 5. Proper fostering of categories from inside
12265 !!options
12266 parsoid=wt2html,wt2wt
12267 !! wikitext
12268 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
12269 <!--Two categories (T52330)-->
12270 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
12271 !! html
12272 <link rel="mw:PageProp/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
12273 <!--Two categories (T52330)-->
12274 <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>
12275 !!end
12276
12277 !!test
12278 Templates: Wiki Tables: 1a. Fostering of entire template content
12279 !! wikitext
12280 {|
12281 {{echo|a}}
12282 |}
12283 !! html
12284 <table>
12285 a
12286 <tr><td></td></tr></table>
12287
12288 !! html+tidy
12289 <p>a</p>
12290 <table>
12291 <tr>
12292 <td></td>
12293 </tr>
12294 </table>
12295 !! end
12296
12297 !!test
12298 Templates: Wiki Tables: 1b. Fostering of entire template content
12299 !! wikitext
12300 {|
12301 {{echo|<div>}}
12302 foo
12303 {{echo|</div>}}
12304 |}
12305 !! html
12306 <table>
12307 <div>
12308 <p>foo
12309 </p>
12310 </div>
12311 <tr><td></td></tr></table>
12312
12313 !! html+tidy
12314 <div>
12315 <p>foo</p>
12316 </div>
12317 <table>
12318 <tr>
12319 <td></td>
12320 </tr>
12321 </table>
12322 !! end
12323
12324 !!test
12325 Templates: Wiki Tables: 2. Fostering of partial template content
12326 !! wikitext
12327 {|
12328 {{echo|a
12329 <div>b</div>}}
12330 |}
12331 !! html
12332 <table>
12333 a
12334 <div>b</div>
12335 <tr><td></td></tr></table>
12336
12337 !! html+tidy
12338 <p>a</p>
12339 <div>b</div>
12340 <table>
12341 <tr>
12342 <td></td>
12343 </tr>
12344 </table>
12345 !! end
12346
12347 !!test
12348 Templates: Wiki Tables: 3. td-content via multiple templates
12349 !! wikitext
12350 {|
12351 {{echo|{{pipe}}a}}{{echo|b}}
12352 |}
12353 !! html
12354 <table>
12355 <tr>
12356 <td>ab
12357 </td></tr></table>
12358
12359 !!end
12360
12361 !!test
12362 Templates: Wiki Tables: 4. Templated tags, no content
12363 !! wikitext
12364 {{tbl-start}}
12365 {{tbl-end}}
12366 !! html
12367 <table>
12368 <tr><td></td></tr></table>
12369
12370 !!end
12371
12372 !!test
12373 Templates: Wiki Tables: 5. Templated tags, regular td-tags
12374 !! wikitext
12375 {{tbl-start}}
12376 |foo
12377 {{tbl-end}}
12378 !! html
12379 <table>
12380 <tr>
12381 <td>foo
12382 </td></tr></table>
12383
12384 !!end
12385
12386 !!test
12387 Templates: Wiki Tables: 6. Templated tags, templated td-tags
12388 !! wikitext
12389 {{tbl-start}}
12390 {{!}}foo
12391 {{tbl-end}}
12392 !! html
12393 <table>
12394 <tr>
12395 <td>foo
12396 </td></tr></table>
12397
12398 !!end
12399
12400 ## This test case is very specific to Parsoid's internals
12401 ## and is hence only tested for Parsoid's code. Parsoid uses
12402 ## a <meta> marker tag for <ref> tags and they are expanded
12403 ## much later. We are verifying that this <meta> tag usage
12404 ## doesn't prevent foster parenting.
12405 !!test
12406 Templates: Wiki Tables: 7. Fosterable <ref>s should get fostered
12407 !!wikitext
12408 {{PartialTable}}<ref>foo</ref>
12409 |}
12410
12411 <references />
12412 !!html/parsoid
12413 <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">
12414 <tbody>
12415 </tbody></table>
12416
12417 <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>
12418 !!end
12419
12420 !! test
12421 Templates: Wiki Tables: 8. Fosterable meta-tags should get fostered
12422 !! wikitext
12423 {{echo|
12424 {{{!}}
12425 {{!}}-}}
12426 <onlyinclude>
12427 |foo
12428 </onlyinclude>
12429 {{!}}}
12430 !! html/parsoid
12431 <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{{!}}}"]}'>
12432 </span><meta typeof="mw:Includes/OnlyInclude" about="#mwt1"/><table about="#mwt1">
12433 <tbody><tr>
12434
12435 <td>foo
12436 <meta typeof="mw:Includes/OnlyInclude/End"/></td></tr>
12437 </tbody></table>
12438 !! end
12439
12440 !!test
12441 Templates: Lists: Multi-line list-items via templates
12442 !! wikitext
12443 *{{echo|a {{nonexistent|
12444 unused}}}}
12445 *{{echo|b {{nonexistent|
12446 unused}}}}
12447 !! html
12448 <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>
12449 <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>
12450
12451 !!end
12452
12453 !!test
12454 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
12455 !! wikitext
12456 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
12457 !! html
12458 <p><i>ab</i>c<i>d</i>e
12459 </p>
12460 !!end
12461
12462 !!test
12463 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
12464 (PHP parser generates misnested html)
12465 !! wikitext
12466 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
12467 !! html/parsoid
12468 <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>
12469 !!end
12470
12471 !!test
12472 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
12473 (PHP parser generates misnested html; Parsoid html2wt mode adds newlines between {{echo}}s)
12474 !! options
12475 parsoid=wt2html,wt2wt
12476 !! wikitext
12477 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
12478 !! html
12479 <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>
12480 <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>
12481 <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>
12482 !!end
12483
12484 !!test
12485 Templates: Ugly nesting: 4. Divs opened/closed across templates
12486 !! wikitext
12487 a<div>b{{echo|c</div>d}}e
12488 !! html
12489 a<div>bc</div>de
12490
12491 !! html+tidy
12492 <p>a</p>
12493 <div>bc</div>
12494 <p>de</p>
12495 !! end
12496
12497 !!test
12498 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
12499 (Parsoid-centric)
12500 !! options
12501 parsoid
12502 !! wikitext
12503 {|
12504 |{{echo|foo</table>}}
12505 |bar
12506 |}
12507 !! html
12508 <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|}"]}'>
12509
12510 <tbody>
12511 <tr>
12512 <td>foo</td></tr></tbody></table><span about="#mwt1">
12513 </span><span about="#mwt1">|bar</span><span about="#mwt1">
12514 |}</span>
12515 !!end
12516
12517 !!test
12518 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
12519 (Parsoid-centric)
12520 !! options
12521 parsoid
12522 !! wikitext
12523 <table>
12524 <tr>
12525 <td>
12526 <table>
12527 <tr>
12528 <td>1. {{echo|foo </table>}}</td>
12529 <td> bar </td>
12530 <td>2. {{echo|baz </table>}}</td>
12531 </tr>
12532 <tr>
12533 <td>abc</td>
12534 </tr>
12535 </table>
12536 </td>
12537 </tr>
12538 <tr>
12539 <td>xyz</td>
12540 </tr>
12541 </table>
12542 !! html
12543 <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>"]}'>
12544 <tbody><tr>
12545 <td>
12546 <table>
12547 <tbody><tr>
12548 <td>1. foo </td></tr></tbody></table></td>
12549 <td> bar </td>
12550 <td>2. baz </td></tr></tbody></table><span about="#mwt2">
12551 </span><span about="#mwt2">
12552 </span><span about="#mwt2">
12553 </span><span about="#mwt2">abc</span><span about="#mwt2">
12554 </span><span about="#mwt2">
12555 </span><span about="#mwt2">
12556 </span><span about="#mwt2">
12557 </span><span about="#mwt2">
12558 </span><span about="#mwt2">
12559 </span><span about="#mwt2">xyz</span><span about="#mwt2">
12560 </span><span about="#mwt2">
12561 </span>
12562 !!end
12563
12564 !! test
12565 Templates: Ugly templates: 3. newline-only template parameter
12566 !! wikitext
12567 foo {{echo|
12568 }}
12569 !! html
12570 <p>foo
12571 </p>
12572 !! end
12573
12574 # This looks like a bug: a single newline triggers p/br for some reason.
12575 !! test
12576 Templates: Ugly templates: 4. newline-only template parameter inconsistency
12577 !! wikitext
12578 {{echo|
12579 }}
12580 !! html
12581 <p><br />
12582 </p>
12583 !! end
12584
12585 # T66017 -- ugly wikitext with fostered content generates two template ranges that
12586 # have a true overlap (T1-start - T2-start - T1-end - T2-end).
12587 !! test
12588 Templates: Ugly templates: 5. Template encapsulation test: Non-trivial overlap of template ranges is properly handled
12589 !! wikitext
12590 {{echo|<table>}}
12591 {{echo|<div>foo}}
12592 {{echo|</table>}}
12593 !! html/parsoid
12594 <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
12595 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
12596 </table>
12597 !! end
12598
12599 # T66017 -- ugly wikitext with fostered content generates two template ranges
12600 # that are "identical" and generate nesting cycles in the algorithm
12601 !! test
12602 Templates: Ugly templates: 6. Template encapsulation test: Cyclical nesting of template ranges is properly handled
12603 !! wikitext
12604 {{echo|<table><tr><td><table>}}
12605 {{echo|<div>}}
12606 {{echo|</div>}}
12607 !! html/parsoid
12608 <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"}'>
12609 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
12610 </table></td></tr></tbody></table>
12611 !! end
12612
12613 !! test
12614 Templates: Parameters substituted at the top-level
12615 !! wikitext
12616 {{{foo|''who'' {{echo|me}}? '''never!'''}}}
12617
12618 {{{foo|bar|baz}}}
12619 !! html/php
12620 <p><i>who</i> me? <b>never!</b>
12621 </p><p>bar
12622 </p>
12623 !! html/parsoid
12624 <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>
12625
12626 <p about="#mwt3" typeof="mw:Param" data-mw='{"parts":[{"templatearg":{"target":{"wt":"foo"},"params":{"1":{"wt":"bar"},"2":{"wt":"baz"}},"i":0}}]}'>bar</p>
12627 !! end
12628
12629 !!test
12630 Parser Functions: 1. Simple example
12631 !! wikitext
12632 {{uc:foo}}
12633 !! html
12634 <p>FOO
12635 </p>
12636 !!end
12637
12638 !!test
12639 Parser Functions: 2. Nested use (only outermost should be marked up)
12640 !! wikitext
12641 {{uc:{{lc:FOO}}}}
12642 !! html
12643 <p>FOO
12644 </p>
12645 !!end
12646
12647 ###
12648 ### Pre-save transform tests
12649 ###
12650 !! test
12651 pre-save transform: subst:
12652 !! options
12653 pst
12654 !! wikitext
12655 {{subst:test}}
12656 !! html/php
12657 This is a test template
12658 !! end
12659
12660 !! test
12661 pre-save transform: normal template
12662 !! options
12663 pst
12664 !! wikitext
12665 {{test}}
12666 !! html/php
12667 {{test}}
12668 !! end
12669
12670 !! test
12671 pre-save transform: nonexistent template
12672 !! options
12673 pst
12674 !! wikitext
12675 {{thistemplatedoesnotexist}}
12676 !! html/php
12677 {{thistemplatedoesnotexist}}
12678 !! end
12679
12680 !! test
12681 pre-save transform: subst magic variables
12682 !! options
12683 pst
12684 !! wikitext
12685 {{subst:SITENAME}}
12686 !! html/php
12687 MediaWiki
12688 !! end
12689
12690 # This is T2089, which I fixed. -- wtm
12691 !! test
12692 pre-save transform: subst: templates with parameters
12693 !! options
12694 pst
12695 !! wikitext
12696 {{subst:paramtest|param="something else"}}
12697 !! html/php
12698 This is a test template with parameter "something else"
12699 !! end
12700
12701 !! article
12702 Template:nowikitest
12703 !! text
12704 <nowiki>'''not wiki'''</nowiki>
12705 !! endarticle
12706
12707 !! test
12708 pre-save transform: nowiki in subst (T3188)
12709 !! options
12710 pst
12711 !! wikitext
12712 {{subst:nowikitest}}
12713 !! html/php
12714 <nowiki>'''not wiki'''</nowiki>
12715 !! end
12716
12717 !! article
12718 Template:commenttest
12719 !! text
12720 This template has <!-- a comment --> in it.
12721 !! endarticle
12722
12723 !! test
12724 pre-save transform: comment in subst (T3936)
12725 !! options
12726 pst
12727 !! wikitext
12728 {{subst:commenttest}}
12729 !! html/php
12730 This template has <!-- a comment --> in it.
12731 !! end
12732
12733 !! test
12734 pre-save transform: unclosed tag
12735 !! options
12736 pst
12737 !! wikitext
12738 <nowiki>'''not wiki'''
12739 !! html/php
12740 <nowiki>'''not wiki'''
12741 !! end
12742
12743 !! test
12744 pre-save transform: mixed tag case
12745 !! options
12746 pst
12747 !! wikitext
12748 <NOwiki>'''not wiki'''</noWIKI>
12749 !! html/php
12750 <NOwiki>'''not wiki'''</noWIKI>
12751 !! end
12752
12753 !! test
12754 pre-save transform: unclosed comment in <nowiki>
12755 !! options
12756 pst
12757 !! wikitext
12758 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
12759 !! html/php
12760 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
12761 !!end
12762
12763 # Leading @ in this template definition works around a limitation
12764 # in parsoid's parserTests which otherwise strips the <span> from the
12765 # result (confusing it for a template wrapper)
12766 !! article
12767 Template:dangerous
12768 !!text
12769 @<span onmouseover="alert('crap')">Oh no</span>
12770 !!endarticle
12771
12772 !!test
12773 (confirming safety of fix for subst T3936)
12774 !! wikitext
12775 {{Template:dangerous}}
12776 !! html
12777 <p>@<span>Oh no</span>
12778 </p>
12779 !! end
12780
12781 !! test
12782 pre-save transform: comment containing gallery (T7024)
12783 !! options
12784 pst
12785 !! wikitext
12786 <!-- <gallery>data</gallery> -->
12787 !! html/php
12788 <!-- <gallery>data</gallery> -->
12789 !!end
12790
12791 !! test
12792 pre-save transform: comment containing extension
12793 !! options
12794 pst
12795 !! wikitext
12796 <!-- <tag>data</tag> -->
12797 !! html/php
12798 <!-- <tag>data</tag> -->
12799 !!end
12800
12801 !! test
12802 pre-save transform: comment containing nowiki
12803 !! options
12804 pst
12805 !! wikitext
12806 <!-- <nowiki>data</nowiki> -->
12807 !! html/php
12808 <!-- <nowiki>data</nowiki> -->
12809 !!end
12810
12811 !! test
12812 pre-save transform: <noinclude> in subst (T5298)
12813 !! options
12814 pst
12815 !! wikitext
12816 {{subst:Includes}}
12817 !! html/php
12818 Foobar
12819 !! end
12820
12821 !! test
12822 pre-save transform: <onlyinclude> in subst (T5298)
12823 !! options
12824 pst
12825 !! wikitext
12826 {{subst:Includes2}}
12827 !! html/php
12828 Foo
12829 !! end
12830
12831 !! article
12832 Template:SubstTest
12833 !!text
12834 {{<includeonly>subst:</includeonly>Includes}}
12835 !! endarticle
12836
12837 !! article
12838 Template:SafeSubstTest
12839 !! text
12840 {{<includeonly>safesubst:</includeonly>Includes}}
12841 !! endarticle
12842
12843 !! test
12844 T24297: safesubst: works during PST
12845 !! options
12846 pst
12847 !! wikitext
12848 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
12849 !! html/php
12850 FoobarFoobar
12851 !! end
12852
12853 !! test
12854 T24297: safesubst: works during normal parse
12855 !! wikitext
12856 {{SafeSubstTest}}
12857 !! html
12858 <p>Foobar
12859 </p>
12860 !! end
12861
12862 !! test
12863 subst: does not work during normal parse
12864 !! wikitext
12865 {{SubstTest}}
12866 !! html
12867 <p>{{subst:Includes}}
12868 </p>
12869 !! end
12870
12871 !! test
12872 pre-save transform: context links ("pipe trick")
12873 !! options
12874 pst
12875 !! wikitext
12876 [[Article (context)|]]
12877 [[Bar:Article|]]
12878 [[:Bar:Article|]]
12879 [[Bar:Article (context)|]]
12880 [[:Bar:Article (context)|]]
12881 [[|Article]]
12882 [[|Article (context)]]
12883 [[Bar:X (Y) Z|]]
12884 [[:Bar:X (Y) Z|]]
12885 !! html/php
12886 [[Article (context)|Article]]
12887 [[Bar:Article|Article]]
12888 [[:Bar:Article|Article]]
12889 [[Bar:Article (context)|Article]]
12890 [[:Bar:Article (context)|Article]]
12891 [[Article]]
12892 [[Article (context)]]
12893 [[Bar:X (Y) Z|X (Y) Z]]
12894 [[:Bar:X (Y) Z|X (Y) Z]]
12895 !! end
12896
12897 !! test
12898 pre-save transform: context links ("pipe trick") with interwiki prefix
12899 !! options
12900 pst
12901 !! wikitext
12902 [[interwiki:Article|]]
12903 [[:interwiki:Article|]]
12904 [[interwiki:Bar:Article|]]
12905 [[:interwiki:Bar:Article|]]
12906 !! html/php
12907 [[interwiki:Article|Article]]
12908 [[:interwiki:Article|Article]]
12909 [[interwiki:Bar:Article|Bar:Article]]
12910 [[:interwiki:Bar:Article|Bar:Article]]
12911 !! end
12912
12913 !! test
12914 pre-save transform: context links ("pipe trick") with parens in title
12915 !! options
12916 pst title=[[Somearticle (context)]]
12917 !! wikitext
12918 [[|Article]]
12919 !! html/php
12920 [[Article (context)|Article]]
12921 !! end
12922
12923 !! test
12924 pre-save transform: context links ("pipe trick") with comma in title
12925 !! options
12926 pst title=[[Someplace, Somewhere]]
12927 !! wikitext
12928 [[|Otherplace]]
12929 [[Otherplace, Elsewhere|]]
12930 [[Otherplace, Elsewhere, Anywhere|]]
12931 !! html/php
12932 [[Otherplace, Somewhere|Otherplace]]
12933 [[Otherplace, Elsewhere|Otherplace]]
12934 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
12935 !! end
12936
12937 !! test
12938 pre-save transform: context links ("pipe trick") with parens and comma
12939 !! options
12940 pst title=[[Someplace (IGNORED), Somewhere]]
12941 !! wikitext
12942 [[|Otherplace]]
12943 [[Otherplace (place), Elsewhere|]]
12944 !! html/php
12945 [[Otherplace, Somewhere|Otherplace]]
12946 [[Otherplace (place), Elsewhere|Otherplace]]
12947 !! end
12948
12949 !! test
12950 pre-save transform: context links ("pipe trick") with comma and parens
12951 !! options
12952 pst title=[[Who, me? (context)]]
12953 !! wikitext
12954 [[|Yes, you.]]
12955 [[Me, Myself, and I (1937 song)|]]
12956 !! html/php
12957 [[Yes, you. (context)|Yes, you.]]
12958 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
12959 !! end
12960
12961 !! test
12962 pre-save transform: context links ("pipe trick") with namespace
12963 !! options
12964 pst title=[[Ns:Somearticle]]
12965 !! wikitext
12966 [[|Article]]
12967 !! html/php
12968 [[Ns:Article|Article]]
12969 !! end
12970
12971 !! test
12972 pre-save transform: context links ("pipe trick") with namespace and parens
12973 !! options
12974 pst title=[[Ns:Somearticle (context)]]
12975 !! wikitext
12976 [[|Article]]
12977 !! html/php
12978 [[Ns:Article (context)|Article]]
12979 !! end
12980
12981 !! test
12982 pre-save transform: context links ("pipe trick") with namespace and comma
12983 !! options
12984 pst title=[[Ns:Somearticle, Context, Whatever]]
12985 !! wikitext
12986 [[|Article]]
12987 !! html/php
12988 [[Ns:Article, Context, Whatever|Article]]
12989 !! end
12990
12991 !! test
12992 pre-save transform: context links ("pipe trick") with namespace, comma and parens
12993 !! options
12994 pst title=[[Ns:Somearticle, Context (context)]]
12995 !! wikitext
12996 [[|Article]]
12997 !! html/php
12998 [[Ns:Article (context)|Article]]
12999 !! end
13000
13001 !! test
13002 pre-save transform: context links ("pipe trick") with namespace, parens and comma
13003 !! options
13004 pst title=[[Ns:Somearticle (IGNORED), Context]]
13005 !! wikitext
13006 [[|Article]]
13007 !! html/php
13008 [[Ns:Article, Context|Article]]
13009 !! end
13010
13011 !! test
13012 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, T32149)
13013 !! options
13014 pst
13015 !! wikitext
13016 [[Article(context)|]]
13017 [[Bar:Article(context)|]]
13018 [[:Bar:Article(context)|]]
13019 [[|Article(context)]]
13020 [[Bar:X(Y)Z|]]
13021 [[:Bar:X(Y)Z|]]
13022 !! html/php
13023 [[Article(context)|Article]]
13024 [[Bar:Article(context)|Article]]
13025 [[:Bar:Article(context)|Article]]
13026 [[Article(context)]]
13027 [[Bar:X(Y)Z|X(Y)Z]]
13028 [[:Bar:X(Y)Z|X(Y)Z]]
13029 !! end
13030
13031 !! test
13032 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, T32149)
13033 !! options
13034 pst
13035 !! wikitext
13036 [[Article (context)|]]
13037 [[Bar:Article (context)|]]
13038 [[:Bar:Article (context)|]]
13039 [[|Article (context)]]
13040 [[Bar:X (Y) Z|]]
13041 [[:Bar:X (Y) Z|]]
13042 !! html/php
13043 [[Article (context)|Article]]
13044 [[Bar:Article (context)|Article]]
13045 [[:Bar:Article (context)|Article]]
13046 [[Article (context)]]
13047 [[Bar:X (Y) Z|X (Y) Z]]
13048 [[:Bar:X (Y) Z|X (Y) Z]]
13049 !! end
13050
13051 !! test
13052 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, T32149)
13053 !! options
13054 pst
13055 !! wikitext
13056 [[Article(context)|]]
13057 [[Bar:Article(context)|]]
13058 [[:Bar:Article(context)|]]
13059 [[|Article(context)]]
13060 [[Bar:X(Y)Z|]]
13061 [[:Bar:X(Y)Z|]]
13062 !! html/php
13063 [[Article(context)|Article]]
13064 [[Bar:Article(context)|Article]]
13065 [[:Bar:Article(context)|Article]]
13066 [[Article(context)]]
13067 [[Bar:X(Y)Z|X(Y)Z]]
13068 [[:Bar:X(Y)Z|X(Y)Z]]
13069 !! end
13070
13071 !! test
13072 pre-save transform: context links ("pipe trick") with commas (T23660)
13073 !! options
13074 pst
13075 !! wikitext
13076 [[Article (context), context|]]
13077 [[Article (context),context|]]
13078 [[Bar:Article (context), context|]]
13079 [[Bar:Article (context),context|]]
13080 [[:Bar:Article (context), context|]]
13081 [[:Bar:Article (context),context|]]
13082 !! html/php
13083 [[Article (context), context|Article]]
13084 [[Article (context),context|Article]]
13085 [[Bar:Article (context), context|Article]]
13086 [[Bar:Article (context),context|Article]]
13087 [[:Bar:Article (context), context|Article]]
13088 [[:Bar:Article (context),context|Article]]
13089 !! end
13090
13091 !! test
13092 pre-save transform: trim trailing empty lines
13093 !! options
13094 pst
13095 !! wikitext
13096 Empty lines are trimmed
13097
13098
13099
13100
13101 !! html/php
13102 Empty lines are trimmed
13103 !! end
13104
13105 !! test
13106 pre-save transform: Signature expansion
13107 !! options
13108 pst
13109 !! wikitext
13110 * ~~~
13111 * <noinclude>~~~</noinclude>
13112 * <includeonly>~~~</includeonly>
13113 * <onlyinclude>~~~</onlyinclude>
13114 !! html/php
13115 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
13116 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
13117 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
13118 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
13119 !! end
13120
13121
13122 !! test
13123 pre-save transform: Signature expansion in nowiki tags (T2093)
13124 !! options
13125 pst disabled
13126 !! wikitext
13127 Shall not expand:
13128
13129 <nowiki>~~~~</nowiki>
13130
13131 <includeonly><nowiki>~~~~</nowiki></includeonly>
13132
13133 <noinclude><nowiki>~~~~</nowiki></noinclude>
13134
13135 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
13136
13137 {{subst:Foo}} shall be converted to FOO
13138
13139 As well as inside noinclude/onlyinclude
13140 <noinclude>{{subst:Foo}}</noinclude>
13141 <onlyinclude>{{subst:Foo}}</onlyinclude>
13142
13143 But not inside includeonly
13144 <includeonly>{{subst:Foo}}</includeonly>
13145 !! html/php
13146 Shall not expand:
13147
13148 <nowiki>~~~~</nowiki>
13149
13150 <includeonly><nowiki>~~~~</nowiki></includeonly>
13151
13152 <noinclude><nowiki>~~~~</nowiki></noinclude>
13153
13154 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
13155
13156 FOO shall be converted to FOO
13157
13158 As well as inside noinclude/onlyinclude
13159 <noinclude>FOO</noinclude>
13160 <onlyinclude>FOO</onlyinclude>
13161
13162 But not inside includeonly
13163 <includeonly>{{subst:Foo}}</includeonly>
13164 !! end
13165
13166 !! test
13167 Parsoid: Recognize nowiki with trailing space in tags
13168 !! options
13169 parsoid=wt2html
13170 !! wikitext
13171 <nowiki ><div>[[foo]]</nowiki >
13172
13173 a<nowiki / >b
13174
13175 c<nowiki />d
13176
13177 e<nowiki/ >f
13178 !! html
13179 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
13180 <p>ab</p>
13181 <p>cd</p>
13182 <p>ef</p>
13183 !! end
13184
13185 !! test
13186 Parsoid: Recognize nowiki with odd capitalization
13187 !! options
13188 parsoid=wt2html
13189 !! wikitext
13190 <noWikI ><div>[[foo]]</Nowiki >
13191 !! html
13192 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
13193 !! end
13194
13195
13196 !! test
13197 Parsoid: Escape nowiki with trailing space in tags
13198 !! options
13199 parsoid=html2wt
13200 !! html/parsoid
13201 <p>&lt;nowiki &gt; foo &lt/nowiki ></p>
13202 <p>a&lt;nowiki /&gt;b</p>
13203 <p>c&lt;nowiki/ &gt;d</p>
13204 !! wikitext
13205 &lt;nowiki &gt; foo &lt;/nowiki &gt;
13206
13207 a&lt;nowiki /&gt;b
13208
13209 c&lt;nowiki/ &gt;d
13210 !! end
13211
13212 !! test
13213 Parsoid: Escape weird noWikI capitalizations
13214 !! options
13215 parsoid=html2wt
13216 !! html/parsoid
13217 <p>&lt;noWikI &gt; foo &lt/NoWikI ></p>
13218 !! wikitext
13219 &lt;noWikI &gt; foo &lt;/NoWikI &gt;
13220 !! end
13221
13222 ###
13223 ### Message transform tests
13224 ###
13225 !! test
13226 message transform: magic variables
13227 !! options
13228 msg
13229 !! wikitext
13230 {{SITENAME}}
13231 !! html
13232 MediaWiki
13233 !! end
13234
13235 !! test
13236 message transform: should not transform wiki markup
13237 !! options
13238 msg
13239 !! wikitext
13240 ''test''
13241 !! html
13242 ''test''
13243 !! end
13244
13245 !! test
13246 message transform: <noinclude> in transcluded template (T6926)
13247 !! options
13248 msg
13249 !! wikitext
13250 {{Includes}}
13251 !! html
13252 Foobar
13253 !! end
13254
13255 !! test
13256 message transform: <onlyinclude> in transcluded template (T6926)
13257 !! options
13258 msg
13259 !! wikitext
13260 {{Includes2}}
13261 !! html
13262 Foo
13263 !! end
13264
13265 !! test
13266 {{#special:}} page name, known
13267 !! options
13268 msg
13269 !! wikitext
13270 {{#special:Recentchanges}}
13271 !! html
13272 Special:RecentChanges
13273 !! end
13274
13275 !! test
13276 {{#special:}} page name with subpage, known
13277 !! options
13278 msg
13279 !! wikitext
13280 {{#special:Recentchanges/param}}
13281 !! html
13282 Special:RecentChanges/param
13283 !! end
13284
13285 !! test
13286 {{#special:}} page name, unknown
13287 !! options
13288 msg
13289 !! wikitext
13290 {{#special:foobar nonexistent}}
13291 !! html
13292 Special:Foobar nonexistent
13293 !! end
13294
13295 !! test
13296 {{#speciale:}} page name, known
13297 !! options
13298 msg
13299 !! wikitext
13300 {{#speciale:Recentchanges}}
13301 !! html
13302 Special:RecentChanges
13303 !! end
13304
13305 !! test
13306 {{#speciale:}} page name with subpage, known
13307 !! options
13308 msg
13309 !! wikitext
13310 {{#speciale:Recentchanges/param}}
13311 !! html
13312 Special:RecentChanges/param
13313 !! end
13314
13315 !! test
13316 {{#speciale:}} page name, unknown
13317 !! options
13318 msg
13319 !! wikitext
13320 {{#speciale:foobar nonexistent}}
13321 !! html
13322 Special:Foobar_nonexistent
13323 !! end
13324
13325 ###
13326 ### Images
13327 ###
13328 ### For Parsoid-specific tests, see
13329 #### https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
13330
13331 !! test
13332 Simple image
13333 !! options
13334 parsoid=wt2html,wt2wt,html2html
13335 !! wikitext
13336 [[Image:foobar.jpg]]
13337 !! html/php
13338 <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>
13339 </p>
13340 !! html/parsoid
13341 <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>
13342 !! end
13343
13344 !! test
13345 Simple image (using File: namespace, now canonical)
13346 !! wikitext
13347 [[File:Foobar.jpg]]
13348 !! html/php
13349 <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>
13350 </p>
13351 !! html/parsoid
13352 <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>
13353 !! end
13354
13355 !! test
13356 Right-aligned image
13357 !! wikitext
13358 [[File:Foobar.jpg|right]]
13359 !! html/php
13360 <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>
13361
13362 !! html/parsoid
13363 <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>
13364 !! end
13365
13366 !! test
13367 Image with caption
13368 !! wikitext
13369 [[File:Foobar.jpg|right|Caption text]]
13370 !! html/php
13371 <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>
13372
13373 !! html/parsoid
13374 <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>
13375 !! end
13376
13377 !! test
13378 Image with caption, T55312 #1
13379 !! wikitext
13380 [[File:Foobar.jpg|right|Caption page stuff]]
13381 !! html/php
13382 <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>
13383
13384 !! html/parsoid
13385 <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>
13386 !! end
13387
13388 !! test
13389 Image with caption, T55312 #2
13390 !! wikitext
13391 [[File:Foobar.jpg|right|Caption page=]]
13392 !! html/php
13393 <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>
13394
13395 !! html/parsoid
13396 <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>
13397 !! end
13398
13399 !! test
13400 Image with caption, T55312 #3
13401 !! wikitext
13402 [[File:Foobar.jpg|right|Caption page=stuff]]
13403 !! html/php
13404 <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>
13405
13406 !! html/parsoid
13407 <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>
13408 !! end
13409
13410 !! test
13411 Allow empty links in image captions (T62753)
13412 !! options
13413 thumbsize=220
13414 !! wikitext
13415 [[File:Foobar.jpg|thumb|Caption [[Link1]]
13416 [[]]
13417 [[Link2]]
13418 ]]
13419 !! html/php
13420 <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>
13421
13422 !! html/parsoid
13423 <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>
13424 [[]]
13425 <a rel="mw:WikiLink" href="./Link2" title="Link2" data-parsoid='{"stx":"simple","a":{"href":"./Link2"},"sa":{"href":"Link2"}}'>Link2</a>
13426 </figcaption></figure>
13427 !! end
13428
13429 !! test
13430 Titles in unlinked images (T23454)
13431 !! wikitext
13432 [[File:Foobar.jpg|link=|stuff]]
13433 !! html/php
13434 <p><img alt="stuff" src="http://example.com/images/3/3a/Foobar.jpg" title="stuff" width="1941" height="220" />
13435 </p>
13436 !! end
13437
13438 !! test
13439 Link with empty target
13440 !! wikitext
13441 [[]]
13442 !! html
13443 <p>[[]]
13444 </p>
13445 !! end
13446
13447 !! test
13448 Image with link trail
13449 !! wikitext
13450 Linktrails should not work for images: [[File:Foobar.jpg]]s
13451 !! html/php
13452 <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
13453 </p>
13454 !! html/parsoid
13455 <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>
13456 !! end
13457
13458 !! test
13459 Image with empty attribute
13460 !! options
13461 parsoid=wt2html,wt2wt,html2html
13462 !! wikitext
13463 [[File:Foobar.jpg|right||Caption text]]
13464 !! html/php
13465 <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>
13466
13467 !! html/parsoid
13468 <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>
13469 !! end
13470
13471 !! test
13472 1. Block image with individual attributes from templates
13473 !! wikitext
13474 [[File:Foobar.jpg|thumb|{{echo|137px}}|This is a caption]]
13475 !! html/php
13476 <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>
13477
13478 !! html/parsoid
13479 <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>
13480 !! end
13481
13482 !! test
13483 2. Block Image with individual attributes from templates
13484 !! wikitext
13485 [[File:Foobar.jpg|{{echo|thumb}}|{{echo|137px}}|This is a caption]]
13486 !! html/php
13487 <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>
13488
13489 !! html/parsoid
13490 <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>
13491 !! end
13492
13493 !! test
13494 3. Inline image with individual attributes from templates
13495 !! wikitext
13496 [[File:Foobar.jpg|{{echo|50px}}]]
13497 !! html/php
13498 <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>
13499 </p>
13500 !! html/parsoid
13501 <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>
13502 !! end
13503
13504 ## Parsoid does not provide editing support for images where templates produce multiple image attributes.
13505 ## To signal this, we add a 'mw:Placeholder' type to such images. This could change in the future.
13506 !! test
13507 Image with multiple attributes from the same template
13508 !! wikitext
13509 [[File:Foobar.jpg|{{image_attribs}}]]
13510 !! html/php
13511 <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>
13512
13513 !! html/parsoid
13514 <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>
13515 !! end
13516
13517 !! test
13518 Image with link tails
13519 !! options
13520 thumbsize=220
13521 !! wikitext
13522 123[[File:Foobar.jpg]]456
13523 123[[File:Foobar.jpg|right]]456
13524 123[[File:Foobar.jpg|thumb]]456
13525 !! html/php
13526 <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
13527 </p>
13528 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
13529 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
13530
13531 !! html/php+tidy
13532 <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>
13533 <p>123</p>
13534 <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>
13535 <p>456 123</p>
13536 <div class="thumb tright">
13537 <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>
13538 <div class="thumbcaption">
13539 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
13540 </div>
13541 </div>
13542 </div>
13543 <p>456</p>
13544 !! html/parsoid
13545 <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>
13546 <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>
13547 <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>
13548 !! end
13549
13550 !! test
13551 Image with multiple captions -- only last one is accepted
13552 !! wikitext
13553 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
13554 !! html/php
13555 <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>
13556
13557 !! html/parsoid
13558 <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>
13559 !! end
13560
13561 !! test
13562 Image with multiple widths -- use last
13563 !! wikitext
13564 [[File:Foobar.jpg|200px|300px|caption]]
13565 !! html/php
13566 <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>
13567 </p>
13568 !! html/parsoid
13569 <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>
13570 !! end
13571
13572 !! test
13573 Image with multiple alignments -- use first (T50664)
13574 !! options
13575 thumbsize=220
13576 !! wikitext
13577 [[File:Foobar.jpg|thumb|left|right|center|caption]]
13578
13579 [[File:Foobar.jpg|middle|text-top|caption]]
13580 !! html/php
13581 <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>
13582 <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>
13583 </p>
13584 !! html/parsoid
13585 <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>
13586 <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>
13587 !! end
13588
13589 !! test
13590 Image with width attribute at different positions
13591 !! wikitext
13592 [[File:Foobar.jpg|200px|right|Caption]]
13593 [[File:Foobar.jpg|right|200px|Caption]]
13594 [[File:Foobar.jpg|right|Caption|200px]]
13595 !! html/php
13596 <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>
13597 <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>
13598 <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>
13599
13600 !! html/parsoid
13601 <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>
13602 <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>
13603 <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>
13604 !! end
13605
13606 # a sad bit of backward-compatibility
13607 !! test
13608 Image with size specified with pxpx (T15500, T53628)
13609 !! options
13610 parsoid=wt2html,wt2wt,html2html
13611 !! wikitext
13612 [[File:Foobar.jpg|20pxpx]]
13613 [[File:Foobar.jpg|200x20pxpx]]
13614 !! html/php
13615 <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>
13616 <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>
13617 </p>
13618 !! html/parsoid
13619 <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>
13620 !! end
13621
13622 !! test
13623 Image with link parameter, wiki target
13624 !! wikitext
13625 [[File:Foobar.jpg|link=Main Page]]
13626 !! html/php
13627 <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>
13628 </p>
13629 !! html/parsoid
13630 <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>
13631 !! end
13632
13633 # parsoid T51293 (part 1)
13634 !! test
13635 Image with link parameter, URL target
13636 !! wikitext
13637 [[File:Foobar.jpg|link=http://example.com/]]
13638 !! html/php
13639 <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>
13640 </p>
13641 !! html/parsoid
13642 <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>
13643 !! end
13644
13645 # parsoid T51293 (part 2)
13646 !! test
13647 Image with link parameter, protocol-less URL target
13648 !! wikitext
13649 [[File:Foobar.jpg|link=//example.com/]]
13650 !! html/php
13651 <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>
13652 </p>
13653 !! html/parsoid
13654 <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>
13655 !! end
13656
13657 !! test
13658 Escaping non-block captions (T107435)
13659 !! options
13660 parsoid={
13661 "modes": ["wt2wt"],
13662 "changes": [
13663 ["[typeof~='mw:Image']", "attr", "data-mw", "{\"caption\": \"|\"}"]
13664 ]
13665 }
13666 !! wikitext
13667 [[Image:Foobar.jpg|caption]]
13668 !! wikitext/edited
13669 [[Image:Foobar.jpg|<nowiki>|</nowiki>]]
13670 !! end
13671
13672 # wgExternalLinkTarget not supported by Parsoid
13673 !! test
13674 Image with link parameter, wgExternalLinkTarget
13675 !! wikitext
13676 [[Image:foobar.jpg|link=http://example.com/]]
13677 !! config
13678 wgExternalLinkTarget='foobar'
13679 !! html/php
13680 <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>
13681 </p>
13682 !! end
13683
13684 !! test
13685 Image with link parameter, wgNoFollowLinks set to false
13686 !! wikitext
13687 [[Image:foobar.jpg|link=http://example.com/]]
13688 !! config
13689 wgNoFollowLinks=false
13690 !! html
13691 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
13692 </p>
13693 !! end
13694
13695 !! test
13696 Image with link parameter, wgNoFollowDomainExceptions
13697 !! wikitext
13698 [[Image:foobar.jpg|link=http://example.com/]]
13699 !! config
13700 wgNoFollowDomainExceptions='example.com'
13701 !! html
13702 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
13703 </p>
13704 !! end
13705
13706 # wgExternalLinkTarget not supported by Parsoid
13707 !! test
13708 Image with link parameter, wgExternalLinkTarget, unnamed parameter
13709 !! wikitext
13710 [[Image:foobar.jpg|link=http://example.com/|Title]]
13711 !! config
13712 wgExternalLinkTarget='foobar'
13713 !! html/php
13714 <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>
13715 </p>
13716 !! end
13717
13718 !! test
13719 Image with empty link parameter
13720 !! wikitext
13721 [[File:Foobar.jpg|link=]]
13722 !! html/php
13723 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
13724 </p>
13725 !! html/parsoid
13726 <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>
13727 !! end
13728
13729 !! test
13730 Image with link parameter (wiki target) and unnamed parameter
13731 !! wikitext
13732 [[File:Foobar.jpg|link=Main_Page|Title]]
13733 !! html/php
13734 <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>
13735 </p>
13736 !! html/parsoid
13737 <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>
13738 !! end
13739
13740 !! test
13741 Image with link parameter (URL target) and unnamed parameter
13742 !! wikitext
13743 [[File:Foobar.jpg|link=http://example.com/|Title]]
13744 !! html/php
13745 <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>
13746 </p>
13747 !! html/parsoid
13748 <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>
13749 !! end
13750
13751 !! test
13752 Thumbnail image with link parameter
13753 !! options
13754 thumbsize=220
13755 parsoid=wt2html,wt2wt,html2html
13756 !! wikitext
13757 [[File:Foobar.jpg|thumb|link=http://example.com/|Title]]
13758 !! html/php
13759 <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>
13760
13761 !! html/parsoid
13762 <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>
13763 !! end
13764
13765 !! test
13766 Manually-specified thumbnail image
13767 !! options
13768 thumbsize=220
13769 !! wikitext
13770 [[File:Foobar.jpg|thumb=Thumb.png|Title]]
13771 !! html/php
13772 <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>
13773
13774 !! html/parsoid
13775 <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>
13776 !! end
13777
13778 !! test
13779 Manually-specified thumbnail image with explicit link to wiki page
13780 !! options
13781 thumbsize=220
13782 parsoid=wt2html,wt2wt,html2html
13783 !! wikitext
13784 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|Title]]
13785 !! html/php
13786 <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>
13787
13788 !! html/parsoid
13789 <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>
13790 !! end
13791
13792 !! test
13793 Manually-specified thumbnail image with explicit link to url
13794 !! options
13795 thumbsize=220
13796 parsoid=wt2html,wt2wt,html2html
13797 !! wikitext
13798 [[File:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
13799 !! html/php
13800 <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>
13801
13802 !! html/parsoid
13803 <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>
13804 !! end
13805
13806 !! test
13807 Manually-specified thumbnail image with explicit no link
13808 !! options
13809 thumbsize=220
13810 parsoid=wt2html,wt2wt,html2html
13811 !! wikitext
13812 [[File:Foobar.jpg|thumb=Thumb.png|link=|Title]]
13813 !! html/php
13814 <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>
13815
13816 !! html/parsoid
13817 <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>
13818 !! end
13819
13820 !! test
13821 Manually-specified thumbnail image with explicit link and alt text
13822 !! options
13823 thumbsize=220
13824 parsoid=wt2html,wt2wt,html2html
13825 !! wikitext
13826 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|alt=alttext|Title]]
13827 !! html/php
13828 <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>
13829
13830 !! html/parsoid
13831 <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>
13832 !! end
13833
13834 !! test
13835 Image with frame and link
13836 !! options
13837 parsoid=wt2html,wt2wt,html2html
13838 !! wikitext
13839 [[File:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
13840 !! html/php
13841 <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>
13842
13843 !! html/parsoid
13844 <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>
13845 !! end
13846
13847 !! test
13848 Image with frame and link and explicit alt
13849 !! options
13850 parsoid=wt2html,wt2wt,html2html
13851 !! wikitext
13852 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
13853 !! html/php
13854 <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>
13855
13856 !! html/parsoid
13857 <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>
13858 !! end
13859
13860 !! test
13861 Image with wiki markup in implicit alt
13862 !! wikitext
13863 [[Image:Foobar.jpg|testing '''bold''' in alt]]
13864
13865 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
13866 !! html/php
13867 <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>
13868 </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>
13869 </p>
13870 !! html/parsoid
13871 <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>
13872
13873 <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>
13874 !! end
13875
13876 !! test
13877 Alt image option should handle most kinds of wikitext without barfing
13878 !! wikitext
13879 [[Image:Foobar.jpg|thumb|This is the image caption|alt=This is a [[link]] and a {{echo|''bold template''}}.]]
13880 !! html/php
13881 <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>
13882
13883 !! html/parsoid
13884 <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>
13885 !! end
13886
13887 ###################
13888 # Conflicting image format options.
13889 # First option specified should 'win'.
13890 # All three cases in each test should be identical.
13891
13892 !! test
13893 Image with 'frameless' first.
13894 !! options
13895 parsoid=wt2html,wt2wt,html2html
13896 !! wikitext
13897 [[File:Foobar.jpg|frameless|caption]]
13898
13899 [[File:Foobar.jpg|frameless|frame|caption]]
13900
13901 [[File:Foobar.jpg|frameless|thumb|caption]]
13902 !! html/php
13903 <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>
13904 </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>
13905 </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>
13906 </p>
13907 !! html/parsoid
13908 <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>
13909 <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>
13910 <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>
13911 !! end
13912
13913 !! test
13914 Image with 'frame' first.
13915 !! options
13916 parsoid=wt2html,wt2wt,html2html
13917 !! wikitext
13918 [[File:Foobar.jpg|frame|caption]]
13919 [[File:Foobar.jpg|frame|frameless|caption]]
13920 [[File:Foobar.jpg|frame|thumb|caption]]
13921 !! html/php
13922 <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>
13923 <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>
13924 <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>
13925
13926 !! html/parsoid
13927 <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>
13928 <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>
13929 <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>
13930 !! end
13931
13932 !! test
13933 Image with 'thumb' first.
13934 !! options
13935 parsoid=wt2html,wt2wt,html2html
13936 !! wikitext
13937 [[File:Foobar.jpg|thumb|caption]]
13938 [[File:Foobar.jpg|thumb|frameless|caption]]
13939 [[File:Foobar.jpg|thumb|frame|caption]]
13940 !! html/php
13941 <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>
13942 <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>
13943 <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>
13944
13945 !! html/parsoid
13946 <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>
13947 <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>
13948 <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>
13949 !! end
13950
13951 ###################
13952 # Image sizing.
13953 # See https://www.mediawiki.org/wiki/Help:Images#Size_and_frame
13954 # and https://phabricator.wikimedia.org/T64258
13955 # Foobar has actual size of 1941x220
13956 # 1. Thumbs & frameless always reduce, can't be enlarged unless it's
13957 # a scalable format.
13958 # 2. Framed images always ignore size options; always render at default size.
13959 # 3. "Unspecified format" and border are the only types which can be
13960 # enlarged.
13961
13962 !! test
13963 Image: "unspecified format" and border enlarge
13964 !! options
13965 parsoid=wt2html,wt2wt,html2html
13966 !! wikitext
13967 [[File:Foobar.jpg|2000px]]
13968
13969 [[File:Foobar.jpg|border|2000px]]
13970 !! html/php
13971 <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>
13972 </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>
13973 </p>
13974 !! html/parsoid
13975 <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>
13976 <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>
13977 !! end
13978
13979 !! test
13980 Image: "unspecified format" and border reduce
13981 !! options
13982 parsoid=wt2html,wt2wt,html2html
13983 !! wikitext
13984 [[File:Foobar.jpg|1000px]]
13985
13986 [[File:Foobar.jpg|border|1000px]]
13987 !! html/php
13988 <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>
13989 </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>
13990 </p>
13991 !! html/parsoid
13992 <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>
13993 <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>
13994 !! end
13995
13996 !! test
13997 Image: thumbs reduce
13998 !! options
13999 parsoid=wt2html,wt2wt,html2html
14000 !! wikitext
14001 [[File:Foobar.jpg|thumb|50px]]
14002 !! html/php
14003 <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>
14004
14005 !! html/parsoid
14006 <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>
14007 !! end
14008
14009 !! test
14010 Image: bitmap thumbs can't be enlarged past original size, but vector can.
14011 !! options
14012 parsoid=wt2html,wt2wt,html2html
14013 !! wikitext
14014 [[File:Foobar.jpg|thumb|2000px]]
14015
14016 [[File:Foobar.svg|thumb|2000px]]
14017 !! html/php
14018 <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>
14019 <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>
14020
14021 !! html/parsoid
14022 <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>
14023 <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>
14024 !! end
14025
14026 !! test
14027 Image: frameless can reduce in size
14028 !! options
14029 parsoid=wt2html,wt2wt,html2html
14030 !! wikitext
14031 [[File:Foobar.jpg|frameless|50px]]
14032 !! html/php
14033 <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>
14034 </p>
14035 !! html/parsoid
14036 <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>
14037 !! end
14038
14039 !! test
14040 Image: bitmap frameless can't be enlarged past original size, but vector can
14041 !! options
14042 parsoid=wt2html,wt2wt,html2html
14043 !! wikitext
14044 [[File:Foobar.jpg|frameless|2000px]]
14045
14046 [[File:Foobar.svg|frameless|2000px]]
14047 !! html/php
14048 <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>
14049 </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>
14050 </p>
14051 !! html/parsoid
14052 <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>
14053 <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>
14054 !! end
14055
14056 !! test
14057 Image: framed images are always unscaled.
14058 !! options
14059 parsoid=wt2html,wt2wt,html2html
14060 !! wikitext
14061 [[File:Foobar.jpg|frame]]
14062
14063 [[File:Foobar.jpg|frame|50px]]
14064
14065 [[File:Foobar.jpg|frame|50x50px]]
14066
14067 [[File:Foobar.jpg|frame|2000px]]
14068 !! html/php
14069 <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>
14070 <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>
14071 <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>
14072 <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>
14073
14074 !! html/parsoid
14075 <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>
14076 <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>
14077 <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>
14078 <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>
14079 !! end
14080
14081 ###################
14082
14083 !! test
14084 Link to image page- image page normally doesn't exists, hence edit link
14085 Add test with existing image page
14086 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
14087 !! wikitext
14088 [[:Image:test]]
14089 !! html
14090 <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>
14091 </p>
14092 !! end
14093
14094 !! test
14095 T20784 Link to non-existent image page with caption should use caption as link text
14096 !! wikitext
14097 [[:Image:test|caption]]
14098 !! html
14099 <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>
14100 </p>
14101 !! end
14102
14103 !! test
14104 Frameless image caption with a free URL
14105 !! wikitext
14106 [[File:Foobar.jpg|http://example.com]]
14107 !! html/php
14108 <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>
14109 </p>
14110 !! html/parsoid
14111 <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>
14112 !! end
14113
14114 !! test
14115 Thumbnail image caption with a free URL
14116 !! options
14117 thumbsize=220
14118 !! wikitext
14119 [[File:Foobar.jpg|thumb|http://example.com]]
14120 !! html/php
14121 <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>
14122
14123 !! html/parsoid
14124 <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>
14125 !! end
14126
14127 !! test
14128 Thumbnail image caption with a free URL and explicit alt
14129 !! options
14130 thumbsize=220
14131 parsoid=wt2html,wt2wt,html2html
14132 !! wikitext
14133 [[File:Foobar.jpg|thumb|http://example.com|alt=Alteration]]
14134 !! html/php
14135 <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>
14136
14137 !! html/parsoid
14138 <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>
14139 !! end
14140
14141 !! test
14142 SVG thumbnails with no language set
14143 !! options
14144 !! wikitext
14145 [[File:Foobar.svg|thumb|caption]]
14146 !! html/php
14147 <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>
14148
14149 !! html/parsoid
14150 <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>
14151 !! end
14152
14153 !! test
14154 SVG thumbnails with language de
14155 !! options
14156 parsoid=wt2html,wt2wt,html2html
14157 !! wikitext
14158 [[File:Foobar.svg|thumb|caption|lang=de]]
14159 !! html/php
14160 <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>
14161
14162 !! html/parsoid
14163 <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>
14164 !! end
14165
14166 !! test
14167 SVG thumbnails with invalid language code
14168 !! options
14169 parsoid=wt2html,wt2wt,html2html
14170 !! wikitext
14171 [[File:Foobar.svg|thumb|caption|lang=invalid.language.code]]
14172 !! html/php
14173 <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>
14174
14175 !! html/parsoid
14176 <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>
14177 !! end
14178
14179 !! test
14180 T3887: A ISBN with a thumbnail
14181 !! wikitext
14182 [[File:Foobar.jpg|thumb|ISBN 1235467890]]
14183 !! html/php
14184 <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>
14185
14186 !! html/parsoid
14187 <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>
14188 !! end
14189
14190 !! test
14191 T3887: A RFC with a thumbnail
14192 !! wikitext
14193 [[File:Foobar.jpg|thumb|This is RFC 12354]]
14194 !! html/php
14195 <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>
14196
14197 !! html/parsoid
14198 <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>
14199 !! end
14200
14201 !! test
14202 T3887: A mailto link with a thumbnail
14203 !! wikitext
14204 [[File:Foobar.jpg|thumb|Please mailto:nobody@example.com]]
14205 !! html/php
14206 <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>
14207
14208 !! html/parsoid
14209 <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>
14210 !! end
14211
14212 # Pending resolution to T2368
14213 !! test
14214 T2648: Frameless image caption with a link
14215 !! wikitext
14216 [[File:Foobar.jpg|text with a [[link]] in it]]
14217 !! html/php
14218 <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>
14219 </p>
14220 !! html/parsoid
14221 <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>
14222 !! end
14223
14224 !! test
14225 T2648: Frameless image caption with a link (suffix)
14226 !! wikitext
14227 [[File:Foobar.jpg|text with a [[link]]foo in it]]
14228 !! html/php
14229 <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>
14230 </p>
14231 !! html/parsoid
14232 <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>
14233 !! end
14234
14235 !! test
14236 T2648: Frameless image caption with an interwiki link
14237 !! wikitext
14238 [[File:Foobar.jpg|text with a [[MeatBall:Link]] in it]]
14239 !! html/php
14240 <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>
14241 </p>
14242 !! html/parsoid
14243 <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>
14244 !! end
14245
14246 !! test
14247 T2648: Frameless image caption with a piped interwiki link
14248 !! wikitext
14249 [[File:Foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
14250 !! html/php
14251 <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>
14252 </p>
14253 !! html/parsoid
14254 <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>
14255 !! end
14256
14257 !! test
14258 T107474: Frameless image caption with <nowiki>
14259 !! wikitext
14260 [[File:Foobar.jpg|<nowiki>text with a [[MeatBall:Link|link]] in it</nowiki>]]
14261 !! html/parsoid
14262 <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>
14263 !! end
14264
14265 !! test
14266 Escape HTML special chars in image alt text
14267 !! wikitext
14268 [[File:Foobar.jpg|& < > "]]
14269 !! html/php
14270 <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>
14271 </p>
14272 !! html/parsoid
14273 <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>
14274 !! end
14275
14276 !! test
14277 Escape HTML special chars in image alt text with LanguageConverter
14278 !! options
14279 language=zh
14280 !! wikitext
14281 [[File:Foobar.jpg|& < > "]]
14282 !! html/php
14283 <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>
14284 </p>
14285 !! html/parsoid
14286 <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>
14287 !! end
14288
14289 !! test
14290 Entities in file name and attributes
14291 !! wikitext
14292 [[File:7%25 solution.gif|manualthumb=7%25 solution.gif|link=7%25 solution|[[7%25 solution]]]]
14293 !! html/php
14294 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=7%25_solution.gif" class="new" title="File:7% solution.gif">7% solution</a>
14295 </p>
14296 !! html/parsoid
14297 <p><span class="mw-default-size" typeof="mw:Error mw:Image" data-parsoid='{"optList":[{"ck":"bogus","ak":"manualthumb=7%25 solution.gif"},{"ck":"link","ak":"link=7%25 solution"},{"ck":"caption","ak":"[[7%25 solution]]"}]}' data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}],"caption":"&lt;a rel=\"mw:WikiLink\" href=\"./7%25_solution\" title=\"7% solution\" data-parsoid=&#39;{\"stx\":\"simple\",\"a\":{\"href\":\"./7%25_solution\"},\"sa\":{\"href\":\"7%25 solution\"},\"dsr\":[74,91,2,2]}&#39;>7% solution&lt;/a>"}'><a href="./7%25_solution" data-parsoid='{"a":{"href":"./7%25_solution"},"sa":{"href":"link=7%25 solution"}}'><img resource="./File:7%25_solution.gif" src="./Special:FilePath/7%25_solution.gif" height="220" width="220" data-parsoid='{"a":{"resource":"./File:7%25_solution.gif","height":"220","width":"220"},"sa":{"resource":"File:7%25 solution.gif"}}'/></a></span></p>
14298 !! end
14299
14300 !! test
14301 T2499: Alt text should have &#1234;, not &amp;1234;
14302 !! wikitext
14303 [[File:Foobar.jpg|&#9792;]]
14304 !! html/php
14305 <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>
14306 </p>
14307 !! html/parsoid
14308 <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>
14309 !! end
14310
14311 !! test
14312 Broken image caption with link
14313 !! options
14314 parsoid=wt2html,wt2wt,html2html
14315 !! wikitext
14316 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
14317 !! html/php
14318 <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.
14319 </p>
14320 !! html/parsoid
14321 <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>
14322 !! end
14323
14324 !! test
14325 Image caption containing another image
14326 !! wikitext
14327 [[File:Foobar.jpg|thumb|This is a caption with another [[File:Thumb.png|image]] inside it!]]
14328 !! html/php
14329 <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>
14330
14331 !! html/parsoid
14332 <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>
14333 !! end
14334
14335 !! test
14336 Image: caption containing a newline
14337 !! wikitext
14338 [[File:Foobar.jpg|This
14339 *is some text]]
14340 !! html/php
14341 <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>
14342 </p>
14343 !! html/parsoid
14344 <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>
14345 !!end
14346
14347 !!test
14348 Image: caption containing leading space
14349 (The leading space should not trigger nowiki escaping in wt2wt mode)
14350 !! wikitext
14351 [[File:Foobar.jpg|thumb| bar]]
14352 !! html/php
14353 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>bar</div></div></div>
14354
14355 !! html/parsoid
14356 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption> bar</figcaption></figure>
14357 !!end
14358
14359 !! test
14360 Image: caption containing a table
14361 !! options
14362 parsoid=wt2html,wt2wt,html2html
14363 !! wikitext
14364 [[Image:Foobar.jpg|thumb|200px|This is an example image thumbnail caption with a table
14365 {|
14366 ! Foo !! Bar
14367 |-
14368 | Foo1 || Bar1
14369 |}
14370 and some more text.]]
14371 !! html/php
14372 <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>
14373
14374 !! html/parsoid
14375 <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
14376 <table>
14377 <tbody>
14378 <tr><th>Foo </th><th>Bar</th></tr>
14379 <tr>
14380 <td>Foo1 </td>
14381 <td>Bar1</td></tr></tbody></table>and some more text.</figcaption></figure>
14382 !! end
14383
14384 !! test
14385 T5090: External links other than http: in image captions
14386 !! wikitext
14387 [[File:Foobar.jpg|thumb|200x200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
14388 !! html/php
14389 <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>
14390
14391 !! html/parsoid
14392 <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>
14393 !! end
14394
14395 !! test
14396 Custom class
14397 !! options
14398 parsoid=wt2html,wt2wt,html2html
14399 !! wikitext
14400 [[Image:foobar.jpg|a|class=b]]
14401 !! html/php
14402 <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>
14403 </p>
14404 !! html/parsoid
14405 <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>
14406 !! end
14407
14408 !! test
14409 Localized image handling (1).
14410 !! options
14411 parsoid=wt2html,wt2wt,html2html
14412 language=es
14413 !! wikitext
14414 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
14415 !! html/php
14416 <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>
14417
14418 !! html/parsoid
14419 <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>
14420 !! end
14421
14422 !! test
14423 Localized image handling (2).
14424 !! options
14425 thumbsize=220
14426 parsoid=wt2html,wt2wt,html2html
14427 language=es
14428 !! wikitext
14429 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
14430 !! html/php
14431 <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>
14432
14433 !! html/parsoid
14434 <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>
14435 !! end
14436
14437 !! test
14438 Localized image handling (3).
14439 !! options
14440 language=fa
14441 parsoid=html2wt
14442 !! html/parsoid
14443 <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>
14444 !! wikitext
14445 [[File:Foobar.jpg|بندانگشتی]]
14446 !! end
14447
14448 !! test
14449 "border", "frameless" and "class" attributes on an image.
14450 !! options
14451 thumbsize=220
14452 parsoid=wt2html,wt2wt,html2html
14453 !! wikitext
14454 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
14455 !! html/php
14456 <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>
14457 </p>
14458 !! html/parsoid
14459 <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>
14460 !! end
14461
14462 # Note that 'right' is the default alignment, despite the misspelled 'righ' below
14463 !! test
14464 Invalid image attributes (T64500)
14465 !! options
14466 thumbsize=220
14467 parsoid=wt2html,wt2wt,html2html
14468 !! wikitext
14469 [[File:Foobar.jpg|thumb|float|left|caption]]
14470
14471 [[File:Foobar.jpg|thumb|righ|caption]]
14472
14473 [[File:Foobar.jpg|bogus1|thumb|bogus2|left|bogus3|caption]]
14474 !! html/php
14475 <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>
14476 <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>
14477 <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>
14478
14479 !! html/parsoid
14480 <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>
14481 <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>
14482 <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>
14483 !! end
14484
14485 !! article
14486 File:Barfoo.jpg
14487 !! text
14488 #REDIRECT [[File:Barfoo.jpg]]
14489 !! endarticle
14490
14491 # FIXME: Parsoid should run this test -- but we'd need to teach the
14492 # mockAPI about the redirected Barfoo.jpg image.
14493 !! test
14494 Redirected image
14495 !! wikitext
14496 [[Image:Barfoo.jpg]]
14497 !! html/php
14498 <p><a href="/wiki/File:Barfoo.jpg" class="mw-redirect" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
14499 </p>
14500 !! end
14501
14502 !! test
14503 Missing image with uploads disabled
14504 !! options
14505 wgEnableUploads=0
14506 !! wikitext
14507 [[File:Foobaz.jpg]]
14508 !! html/php
14509 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
14510 </p>
14511 !! html/parsoid
14512 <p><span class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}]}'><a href="./File:Foobaz.jpg"><img resource="./File:Foobaz.jpg" src="./Special:FilePath/Foobaz.jpg" height="220" width="220"/></a></span></p>
14513 !! end
14514
14515 # Parsoid-specific testing for images
14516 # https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
14517 # Currently imperfect due to a flaw in the Parsoid testrunner
14518 # Work in progress
14519 # THESE TESTS SHOULD BE MOVED UP and merged with the php-specific
14520 # image tests.
14521
14522 !! test
14523 Parsoid-specific image handling - simple image with size and middle alignment
14524 !! wikitext
14525 [[File:Foobar.jpg|middle|50px]]
14526 !! html/parsoid
14527 <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>
14528 !! end
14529
14530 !! test
14531 Parsoid-specific image handling - simple image with size, middle alignment,
14532 non-standard namespace alias
14533 !! options
14534 parsoid=wt2wt,wt2html,html2html
14535 !! wikitext
14536 [[Image:Foobar.jpg|middle|50px]]
14537 !! html/parsoid
14538 <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>
14539 !! end
14540
14541 !! test
14542 Parsoid-specific image handling - simple image with size and middle alignment
14543 (existing content)
14544 !! wikitext
14545 [[File:Foobar.jpg|50px|middle]]
14546 !! html/parsoid
14547 <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>
14548 !! end
14549
14550 !! test
14551 Parsoid-specific image handling - simple image with size and middle alignment
14552 and non-standard namespace name
14553 !! options
14554 parsoid=wt2html,wt2wt,html2html
14555 !! wikitext
14556 [[Image:Foobar.jpg|50px|middle]]
14557 !! html/parsoid
14558 <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>
14559 !! end
14560
14561 !! test
14562 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
14563 !! wikitext
14564 [[File:Foobar.jpg|500x10px|baseline|caption]]
14565 !! html/parsoid
14566 <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>
14567 !! end
14568
14569 !! test
14570 Parsoid-specific image handling - simple image with border and size spec
14571 !! wikitext
14572 [[File:Foobar.jpg|50px|border|caption]]
14573 !! html/parsoid
14574 <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>
14575 !! end
14576
14577 !! test
14578 Parsoid-specific image handling - thumbnail with halign, valign, and caption
14579 !! wikitext
14580 [[File:Foobar.jpg|left|baseline|thumb|caption content]]
14581 !! html/parsoid
14582 <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>
14583 !! end
14584
14585 !! test
14586 Parsoid-specific image handling - thumbnail with halign, valign, and caption
14587 (existing content)
14588 !! wikitext
14589 [[File:Foobar.jpg|thumb|left|baseline|caption content]]
14590 !! html/parsoid
14591 <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>
14592 !! end
14593
14594 !! test
14595 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
14596 !! wikitext
14597 [[Image:Foobar.jpg|right|middle|thumb|50x50px|caption]]
14598 !! html/parsoid
14599 <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>
14600 !! end
14601
14602 !! test
14603 Parsoid-specific image handling - thumbnail with specific size, halign,
14604 valign, and caption (existing content)
14605 !! wikitext
14606 [[File:Foobar.jpg|thumb|50x50px|right|middle|caption]]
14607 !! html/parsoid
14608 <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>
14609 !! end
14610
14611 !! test
14612 Parsoid-specific image handling - framed image with specific size and caption
14613 (size is ignored)
14614 !! options
14615 parsoid=wt2html,wt2wt,html2html
14616 !! wikitext
14617 [[File:Foobar.jpg|frame|500x50px|caption]]
14618 !! html/parsoid
14619 <figure typeof="mw:Image/Frame"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>caption</figcaption></figure>
14620 !! end
14621
14622 !! test
14623 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption
14624 (size is ignored)
14625 !! options
14626 parsoid=wt2html,wt2wt,html2html
14627 !! wikitext
14628 [[File:Foobar.jpg|left|baseline|frame|500x50px|caption]]
14629 !! html/parsoid
14630 <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>
14631 !! end
14632
14633 !! test
14634 Parsoid-specific image handling - frameless image with specific size, border, and caption
14635 !! wikitext
14636 [[File:Foobar.jpg|frameless|442x50px|border|caption]]
14637 !! html/parsoid
14638 <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>
14639 !! end
14640
14641 !! test
14642 Parsoid-specific image handling - simple image with a formatted caption
14643 !! wikitext
14644 [[File:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
14645 !! html/parsoid
14646 <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>
14647 !! end
14648
14649 !! test
14650 Parsoid-specific image handling - caption with a template in it
14651 !! wikitext
14652 [[File:Foobar.jpg|thumb|200x23px|This caption has a {{echo|transclusion}} in it.]]
14653 !! html/parsoid
14654 <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>
14655 !! end
14656
14657 !! test
14658 Parsoid-specific image handling - caption with unbalanced tags in it
14659 !! options
14660 parsoid=wt2html,wt2wt,html2html
14661 !! wikitext
14662 foo
14663 [[File:Foobar.jpg|thumb|200x200px|This caption has a <center>unbalanced tag in it.]]
14664 bar
14665 !! html/parsoid
14666 <p>foo</p>
14667 <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>
14668 <p>bar</p>
14669 !! end
14670
14671 !! test
14672 Parsoid-specific image handling - empty caption (1)
14673 !! options
14674 parsoid=wt2html,wt2wt
14675 !! wikitext
14676 [[File:Foobar.jpg|thumb|]]
14677 !! html/parsoid
14678 <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>
14679 !! end
14680
14681 # empty captions don't get serialized unless we're in the "round trip" case
14682 !! test
14683 Parsoid-specific image handling - empty caption (2)
14684 !! options
14685 parsoid=html2wt
14686 !! html/parsoid
14687 <figure class="mw-default-size" typeof="mw:Image/Thumb">
14688 <a href="./File:Foobar.jpg">
14689 <img resource="./File:Foobar.jpg"
14690 src="//example.com/images/3/3a/Foobar.jpg"
14691 data-file-width="1941" data-file-height="220" data-file-type="bitmap"
14692 height="25" width="220"/>
14693 </a>
14694 <figcaption></figcaption>
14695 </figure>
14696 !! wikitext
14697 [[File:Foobar.jpg|thumb]]
14698 !! end
14699
14700 !! test
14701 Parsoid-specific image handling - whitespace caption
14702 !! wikitext
14703 [[File:Foobar.jpg|thumb| ]]
14704 !! html/parsoid
14705 <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>
14706 !! end
14707
14708 !! test
14709 Parsoid-specific image handling - lang option
14710 !! wikitext
14711 foo
14712 [[File:Foobar.svg|lang=de|caption]]
14713 bar
14714 !! html/parsoid
14715 <p>foo
14716 <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>
14717 bar</p>
14718 !! end
14719
14720 ## Edge case bugs in Parsoid from T93580
14721 !! test
14722 T93580: 1. Templated <ref> inside block images
14723 !! wikitext
14724 [[File:Foobar.jpg|thumb|Caption with templated ref: {{echo|<ref>foo</ref>}}]]
14725
14726 <references />
14727 !! html/parsoid
14728 <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>
14729
14730 <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>
14731 !! end
14732
14733 !! test
14734 T93580: 2. <ref> inside inline images
14735 !! wikitext
14736 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: <ref>foo</ref>]]
14737
14738 <references />
14739 !! html/parsoid
14740 <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>
14741
14742 <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>
14743 !! end
14744
14745 !! test
14746 T93580: 3. Templated <ref> inside inline images
14747 !! wikitext
14748 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: {{echo|<ref>{{echo|foo}}</ref>}}]]
14749
14750 <references />
14751 !! html/parsoid
14752 <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>
14753
14754 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><a href="./Main_Page#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text" data-parsoid="{}">foo</span></li></ol>
14755 !! end
14756
14757 ###
14758 ### Subpages
14759 ###
14760 !! article
14761 Subpage test/subpage
14762 !! text
14763 foo
14764 !! endarticle
14765
14766 !! test
14767 Subpage link
14768 !! options
14769 subpage title=[[Subpage test]]
14770 !! wikitext
14771 [[/subpage]]
14772 !! html
14773 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
14774 </p>
14775 !! end
14776
14777 !! test
14778 Subpage noslash link
14779 !! options
14780 subpage title=[[Subpage test]]
14781 !! wikitext
14782 [[/subpage/]]
14783 !! html
14784 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
14785 </p>
14786 !! end
14787
14788 !! article
14789 Subpage test/1/2/subpage
14790 !! text
14791 blah
14792 !! endarticle
14793
14794 !! test
14795 Relative subpage noslash link
14796 !! options
14797 parsoid=wt2wt,wt2html,html2html
14798 subpage title=[[Subpage test/1/2/3/4]]
14799 !! wikitext
14800 [[../../subpage/]]
14801
14802 [[../../subpage]]
14803 !! html/php
14804 <p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a>
14805 </p><p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage test/1/2/subpage</a>
14806 </p>
14807 !! html/parsoid
14808 <p><a rel="mw:WikiLink" href="./Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a></p>
14809 <p><a rel="mw:WikiLink" href="./Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
14810 !! end
14811
14812 !! test
14813 Parsoid: dot-slash prefixed wikilinks
14814 !! wikitext
14815 [[./foo]]
14816
14817 [[././bar]]
14818
14819 [[././baz/]]
14820 !! html/php
14821 <p>[[./foo]]
14822 </p><p>[[././bar]]
14823 </p><p>[[././baz/]]
14824 </p>
14825 !! html/parsoid
14826 <p>[[./foo]]
14827 </p><p>[[././bar]]
14828 </p><p>[[././baz/]]
14829 </p>
14830 !! end
14831
14832 !! test
14833 Render invalid page names as plain text (T53090)
14834 !! wikitext
14835 [[./../foo|bar]]
14836 [[foo�|bar]]
14837 [[foo/.|bar]]
14838 [[foo/..|bar]]
14839 [[foo~~~bar]]
14840 [[foo>bar]]
14841 [[foo[bar]]
14842 [[.]]
14843 [[..]]
14844 [[foo././bar]]
14845
14846 [[{{echo|./../foo}}|bar]]
14847 [[{{echo|foo/.}}|bar]]
14848 [[{{echo|foo/..}}|bar]]
14849 [[{{echo|foo~~~~bar}}]]
14850 [[{{echo|foo>bar}}]]
14851 [[{{echo|foo././bar}}]]
14852 [[{{echo|foo{bar}}]]
14853 [[{{echo|foo}bar}}]]
14854 [[{{echo|foo[bar}}]]
14855 [[{{echo|foo]bar}}]]
14856 [[{{echo|foo<bar}}]]
14857 !!html/php
14858 <p>[[./../foo|bar]]
14859 [[foo�|bar]]
14860 [[foo/.|bar]]
14861 [[foo/..|bar]]
14862 [[foo~~~bar]]
14863 [[foo&gt;bar]]
14864 [[foo[bar]]
14865 [[.]]
14866 [[..]]
14867 [[foo././bar]]
14868 </p><p>[[./../foo|bar]]
14869 [[foo/.|bar]]
14870 [[foo/..|bar]]
14871 [[foo~~~~bar]]
14872 [[foo&gt;bar]]
14873 [[foo././bar]]
14874 [[foo{bar]]
14875 [[foo}bar]]
14876 [[foo[bar]]
14877 [[foo]bar]]
14878 [[foo&lt;bar]]
14879 </p>
14880 !!html/parsoid
14881 <p>[[./../foo|bar]]
14882 [[foo�|bar]]
14883 [[foo/.|bar]]
14884 [[foo/..|bar]]
14885 [[foo~~~bar]]
14886 [[foo>bar]]
14887 [[foo[bar]]
14888 [[.]]
14889 [[..]]
14890 [[foo././bar]]</p>
14891
14892 <p>[[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"./../foo"}},"i":0}}]}'>./../foo</span>|bar]]
14893 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/."}},"i":0}}]}'>foo/.</span>|bar]]
14894 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/.."}},"i":0}}]}'>foo/..</span>|bar]]
14895 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo~~~~bar"}},"i":0}}]}'>foo~~~~bar</span>]]
14896 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo>bar"}},"i":0}}]}'>foo>bar</span>]]
14897 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo././bar"}},"i":0}}]}'>foo././bar</span>]]
14898 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo{bar"}},"i":0}}]}'>foo{bar</span>]]
14899 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo}bar"}},"i":0}}]}'>foo}bar</span>]]
14900 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo[bar"}},"i":0}}]}'>foo[bar</span>]]
14901 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo]bar"}},"i":0}}]}'>foo]bar</span>]]
14902 [[<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>
14903 !!end
14904
14905 !! test
14906 Disabled subpages
14907 !! wikitext
14908 [[/subpage]]
14909 !! html
14910 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
14911 </p>
14912 !! end
14913
14914 !! test
14915 T2561: {{/Subpage}}
14916 !! options
14917 subpage title=[[Page]]
14918 !! wikitext
14919 {{/Subpage}}
14920 !! html
14921 <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>
14922 </p>
14923 !! end
14924
14925 ###
14926 ### Categories
14927 ###
14928 !! article
14929 Category:MediaWiki User's Guide
14930 !! text
14931 blah
14932 !! endarticle
14933
14934 !! test
14935 Link to category
14936 !! wikitext
14937 [[:Category:MediaWiki User's Guide]]
14938 !! html
14939 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
14940 </p>
14941 !! end
14942
14943 !! test
14944 Simple category
14945 !! options
14946 cat
14947 !! wikitext
14948 [[Category:MediaWiki User's Guide]]
14949 !! html/php
14950 cat=MediaWiki_User's_Guide sort=
14951 !! html/parsoid
14952 <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"}}'/>
14953 !! end
14954
14955 !! test
14956 PAGESINCATEGORY invalid title fatal (r33546 fix)
14957 !! wikitext
14958 {{PAGESINCATEGORY:<bogus>}}
14959 !! html
14960 <p>0
14961 </p>
14962 !! end
14963
14964 !! test
14965 Category with different sort key
14966 !! options
14967 cat
14968 !! wikitext
14969 [[Category:MediaWiki User's Guide|Foo]]
14970 !! html/php
14971 cat=MediaWiki_User's_Guide sort=Foo
14972 !! html/parsoid
14973 <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"}}'/>
14974 !! end
14975
14976 !! test
14977 Category with identical sort key
14978 !! options
14979 cat
14980 !! wikitext
14981 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
14982 !! html/php
14983 cat=MediaWiki_User's_Guide sort=MediaWiki User's Guide
14984 !! html/parsoid
14985 <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"}}'/>
14986 !! end
14987
14988 !! test
14989 Category with empty sort key
14990 !! options
14991 cat
14992 pst
14993 !! wikitext
14994 [[Category:MediaWiki User's Guide|]]
14995 !! html/php
14996 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
14997 !! end
14998
14999 !! test
15000 Category with empty sort key and parentheses
15001 !! options
15002 cat
15003 pst
15004 !! wikitext
15005 [[Category:Foo (bar)|]]
15006 !! html/php
15007 [[Category:Foo (bar)|Foo]]
15008 !! end
15009
15010 !! test
15011 Category with link tail
15012 !! options
15013 cat
15014 pst
15015 !! wikitext
15016 123[[Category:Foo]]456
15017 !! html/php
15018 123[[Category:Foo]]456
15019 !! end
15020
15021 !! test
15022 Category with template
15023 !! options
15024 cat
15025 pst
15026 !! wikitext
15027 [[Category:{{echo|Foo}}]]
15028 !! html/php
15029 [[Category:{{echo|Foo}}]]
15030 !! end
15031
15032 !! test
15033 Category with template in sort key
15034 !! options
15035 cat
15036 pst
15037 !! wikitext
15038 [[Category:Foo|{{echo|Bar}}]]
15039 !! html/php
15040 [[Category:Foo|{{echo|Bar}}]]
15041 !! end
15042
15043 !! test
15044 Category with template in sort key and title
15045 !! options
15046 cat
15047 pst
15048 !! wikitext
15049 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
15050 !! html/php
15051 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
15052 !! end
15053
15054 ## We used to, but no longer wt2wt this test since the default serializer
15055 ## will normalize all categories to serialize on their own line.
15056 ## This wikitext usage is going to be fairly uncommon in production and
15057 ## selser will take care of preserving formatting in those scenarios.
15058 !! test
15059 Category / paragraph interactions
15060 !! options
15061 parsoid=wt2html
15062 !! wikitext
15063 Foo [[Category:Baz]] Bar
15064
15065 Foo [[Category:Baz]]
15066 Bar
15067
15068 Foo
15069 [[Category:Baz]]
15070 Bar
15071
15072 Foo
15073 [[Category:Baz]] Bar
15074
15075 Foo
15076 [[Category:Baz]]
15077 [[Category:Baz]]
15078 [[Category:Baz]]
15079 Bar
15080
15081 [[Category:Baz]]
15082 [[Category:Baz]]
15083 [[Category:Baz]]
15084
15085 [[Category:Baz]]
15086 {{echo|[[Category:Baz]]}}
15087 [[Category:Baz]]
15088 !! html/php
15089 <p>Foo Bar
15090 </p><p>Foo
15091 Bar
15092 </p><p>Foo
15093 Bar
15094 </p><p>Foo Bar
15095 </p><p>Foo
15096 Bar
15097 </p>
15098 !! html/parsoid
15099 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
15100 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
15101 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
15102 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
15103 <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>
15104 <link rel="mw:PageProp/Category" href="./Category:Baz"/>
15105 !! end
15106
15107 ## We used to, but no longer wt2wt this test since the default serializer
15108 ## will normalize all categories to serialize on their own line.
15109 ## This wikitext usage is going to be fairly uncommon in production and
15110 ## selser will take care of preserving formatting in those scenarios.
15111 ##
15112 ## The whitespace on the empty line is part of the test. Please do not delete
15113 !! test
15114 1. Categories and newlines: All preceding newlines should be suppressed (courtesy T2087)
15115 !! options
15116 parsoid=wt2html
15117 !! wikitext
15118 This
15119
15120 [[Category:Foo]] and this should be part of same paragraph (not an indent-pre)
15121
15122 {{echo|[[Category:Foo]] and so should this!}}
15123 !! html/php
15124 <p>This and this should be part of same paragraph (not an indent-pre) and so should this!
15125 </p>
15126 !! html/parsoid
15127 <p>This
15128
15129 <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of same paragraph (not an indent-pre)
15130
15131 <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>
15132 !! end
15133
15134 ## Parsoid will not try to wt2wt this while preserving newlines because
15135 ## it suppresses excess newlines within list items -- and we don't want to
15136 ## introduce a special case just for categories, which is, in reality somewhat
15137 ## odd behavior -- categories are unlikely to be used in list items like this
15138 ## in top-level pages and are only likely to show up in template-generated
15139 ## list items where this RT-ing is a non-issue.
15140 ##
15141 ## The whitespace on the empty line is part of the test. Please do not delete
15142 !! test
15143 2. Categories and newlines: All preceding newlines should be suppressed (courtesy T2087)
15144 !! options
15145 parsoid=wt2html
15146 !! wikitext
15147 * This
15148
15149 [[Category:Foo]] and this should be part of the same list item
15150 * So should this
15151
15152 {{echo|[[Category:Foo]] and this should be part of the same list item}}
15153 !! html
15154 <ul><li>This and this should be part of the same list item</li>
15155 <li>So should this and this should be part of the same list item</li></ul>
15156 !! html/parsoid
15157 <ul>
15158 <li>This <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of the same list item</li>
15159 <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>
15160 </ul>
15161 !! end
15162
15163 ## Newlines and categories that follow the last item of a list
15164 ## are treated differently because this (list followed by categories)
15165 ## is an extremely common pattern on wikis.
15166 !! test
15167 3. Categories and newlines: newline suppression for last list item should RT properly
15168 !! wikitext
15169 * a
15170 * b
15171
15172 [[Category:Foo]]
15173
15174 [[Category:Bar]]
15175 [[Category:Baz]]
15176 !! html/parsoid
15177 <ul><li> a</li>
15178 <li> b</li></ul>
15179
15180 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
15181
15182 <link rel="mw:PageProp/Category" href="./Category:Bar" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
15183 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
15184 !! end
15185
15186 !! test
15187 4. Categories and newlines: newline suppression for last list item should RT properly
15188 !! wikitext
15189 * a
15190 **** b
15191
15192 [[Category:Foo]]
15193 !! html/parsoid
15194 <ul><li> a
15195 <ul><li><ul><li><ul><li> b</li></ul></li></ul></li></ul></li></ul>
15196
15197 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
15198 !! end
15199
15200 ## only wt2html for this to make sure the algo only applies to the rightmost path
15201 !! test
15202 5. Categories and newlines: migrateTrailingCategories dom pass should only run on the rightmost path of nested lists
15203 !! options
15204 parsoid=wt2html
15205 !! wikitext
15206 * a
15207 ** b
15208 [[Category:Foo]]
15209 * c
15210 ** d
15211 [[Category:Foo]]
15212 !! html/parsoid
15213 <ul><li> a
15214 <ul><li> b
15215 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/></li></ul></li>
15216 <li> c
15217 <ul><li> d</li></ul></li></ul>
15218 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
15219 !! end
15220
15221 ## We used to, but no longer wt2wt this test since the default serializer
15222 ## will normalize all categories to serialize on their own line.
15223 ## This wikitext usage is going to be fairly uncommon in production and
15224 ## selser will take care of preserving formatting in those scenarios.
15225 !! test
15226 6. Categories and newlines: migrateTrailingCategories dom pass should not migrate categories not preceded by newlines
15227 !! options
15228 parsoid=wt2html
15229 !! wikitext
15230 * a [[Category:Foo]]
15231 !! html/parsoid
15232 <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>
15233 !! end
15234
15235 # This test also demonstrates because of newline+category tunneling
15236 # through the list hander, template wrapping doesn't expand to the
15237 # containing list when the list item swallows the category.
15238 !! test
15239 7. Categories and newlines: migrateTrailingCategories dom pass should leave template content alone
15240 !! wikitext
15241 * {{echo|a
15242 [[Category:Foo]]}}
15243 !! html/parsoid
15244 <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
15245 </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>
15246 !! end
15247
15248 !! test
15249 8. Categories and newlines: migrateTrailingCategories dom pass should not get tripped by intervening templates
15250 !! wikitext
15251 * a
15252
15253 {{echo|[[Category:Foo]]
15254 [[Category:Bar]]}}
15255 [[Category:Baz]]
15256 !! html/parsoid
15257 <ul><li> a</li></ul>
15258
15259 <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">
15260 </span><link rel="mw:PageProp/Category" href="./Category:Bar" about="#mwt1" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
15261 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
15262 !! end
15263
15264 !! test
15265 Category links with multiple namespaces
15266 !! wikitext
15267 [[Category:Project:Foo]]
15268 !! html/parsoid
15269 <link rel="mw:PageProp/Category" href="./Category:Project:Foo" />
15270 !! end
15271
15272 !! test
15273 Parsoid: Serialize link to category page with colon escape
15274 !! options
15275 parsoid
15276 !! wikitext
15277
15278 [[:Category:Foo]]
15279 [[:Category:Foo|Bar]]
15280 !! html
15281 <p>
15282 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Category:Foo</a>
15283 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Bar</a>
15284 </p>
15285 !! end
15286
15287 # We used to, but no longer wt2wt this test since the default serializer
15288 # will normalize all categories to serialize on their own line.
15289 # This wikitext usage is going to be fairly uncommon in production and
15290 # selser will take care of preventing whitespace insertion if this
15291 # occurs in an article.
15292 #
15293 # html2html disabled for the same reason (whitespace insertion between
15294 # x and y).
15295 #
15296 # html2wt disabled because it localizes the "Category" namespace.
15297 !! test
15298 Link prefix/suffixes aren't applied to category links
15299 !! options
15300 parsoid=wt2html
15301 language=is
15302 !! wikitext
15303 x[[Category:Foo]]y
15304 !! html/php
15305 <p>xy
15306 </p>
15307 !! html/parsoid
15308 <p>x<link rel="mw:PageProp/Category" href="./Flokkur:Foo" data-parsoid=""/>y</p>
15309 !! end
15310
15311 !! test
15312 Parsoid: Serialize link to file page with colon escape
15313 !! options
15314 parsoid
15315 !! wikitext
15316
15317 [[:File:Foo.png]]
15318 [[:File:Foo.png|Bar]]
15319 !! html
15320 <p>
15321 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">File:Foo.png</a>
15322 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">Bar</a>
15323 </p>
15324 !! end
15325
15326 !! test
15327 Parsoid: Serialize a genuine category link without colon escape
15328 !! options
15329 parsoid
15330 !! wikitext
15331 [[Category:Foo]]
15332 [[Category:Foo|Bar]]
15333 !! html
15334 <link rel="mw:PageProp/Category" href="./Category:Foo">
15335 <link rel="mw:PageProp/Category" href="./Category:Foo#Bar">
15336 !! end
15337
15338 !! test
15339 Normalize hrefs properly before testing for invalid link targets (T72894)
15340 !! options
15341 parsoid=html2wt
15342 !! html/parsoid
15343 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne"/>
15344 !! wikitext
15345 [[Category:Toxine bactérienne]]
15346 !! end
15347
15348 !! test
15349 Parsoid: Defaultsort
15350 !! wikitext
15351 {{DEFAULTSORT:Foo}}
15352 !! html/parsoid
15353 <meta property="mw:PageProp/categorydefaultsort" content="Foo"/>
15354 !! end
15355
15356 !! test
15357 Parsoid: Defaultsort (template-generated)
15358 !! wikitext
15359 {{{{echo|DEFAULTSORT}}:Foo}}
15360 !! html/parsoid
15361 <meta property="mw:PageProp/categorydefaultsort" content="Foo" about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"{{echo|DEFAULTSORT}}:Foo"},"params":{},"i":0}}]}'/>
15362 !! end
15363
15364 ###
15365 ### Inter-language links
15366 ###
15367 !! test
15368 Interlanguage links
15369 !! options
15370 ill
15371 !! wikitext
15372 [[es:Alimento]]
15373 [[fr:Nourriture]]
15374 [[zh:食品]]
15375 !! html/php
15376 es:Alimento fr:Nourriture zh:食品
15377 !! html/parsoid
15378 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Alimento"/>
15379 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/Nourriture"/>
15380 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/食品"/>
15381 !! end
15382
15383 !! test
15384 Duplicate interlanguage links (T26502)
15385 !! options
15386 ill
15387 !! wikitext
15388 [[es:1]]
15389 [[es:2]]
15390 [[fr:1]]
15391 [[fr:2]]
15392 !! html/php
15393 es:1 fr:1
15394 !! html/parsoid
15395 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/1"/>
15396 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/2"/>
15397 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/1"/>
15398 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/2"/>
15399 !! end
15400
15401 ###
15402 ### Sections
15403 ###
15404 !! test
15405 Basic section headings
15406 !! wikitext
15407 == Headline 1 ==
15408 Some text
15409
15410 ==Headline 2==
15411 More
15412 ===Smaller headline===
15413 Blah blah
15414 !! html
15415 <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>
15416 <p>Some text
15417 </p>
15418 <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>
15419 <p>More
15420 </p>
15421 <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>
15422 <p>Blah blah
15423 </p>
15424 !! end
15425
15426 !! test
15427 Section headings with TOC
15428 !! wikitext
15429 == Headline 1 ==
15430 === Subheadline 1 ===
15431 ===== Skipping a level =====
15432 ====== Skipping a level ======
15433
15434 == Headline 2 ==
15435 Some text
15436 ===Another headline===
15437 !! html
15438 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15439 <ul>
15440 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
15441 <ul>
15442 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
15443 <ul>
15444 <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>
15445 <ul>
15446 <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>
15447 </ul>
15448 </li>
15449 </ul>
15450 </li>
15451 </ul>
15452 </li>
15453 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
15454 <ul>
15455 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
15456 </ul>
15457 </li>
15458 </ul>
15459 </div>
15460
15461 <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>
15462 <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>
15463 <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>
15464 <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>
15465 <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>
15466 <p>Some text
15467 </p>
15468 <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>
15469
15470 !! end
15471
15472 !! test
15473 TOC anchors don't collide
15474 !! wikitext
15475 __FORCETOC__
15476 == Headline 2 ==
15477 == Headline ==
15478 == Headline 2 ==
15479 == Headline ==
15480 !! html/php
15481 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15482 <ul>
15483 <li class="toclevel-1 tocsection-1"><a href="#Headline_2"><span class="tocnumber">1</span> <span class="toctext">Headline 2</span></a></li>
15484 <li class="toclevel-1 tocsection-2"><a href="#Headline"><span class="tocnumber">2</span> <span class="toctext">Headline</span></a></li>
15485 <li class="toclevel-1 tocsection-3"><a href="#Headline_2_2"><span class="tocnumber">3</span> <span class="toctext">Headline 2</span></a></li>
15486 <li class="toclevel-1 tocsection-4"><a href="#Headline_3"><span class="tocnumber">4</span> <span class="toctext">Headline</span></a></li>
15487 </ul>
15488 </div>
15489
15490 <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>
15491 <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>
15492 <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>
15493 <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>
15494
15495 !! end
15496
15497 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
15498 !! test
15499 Handling of sections up to level 6 and beyond
15500 !! wikitext
15501 = Level 1 Heading=
15502 == Level 2 Heading==
15503 === Level 3 Heading===
15504 ==== Level 4 Heading====
15505 ===== Level 5 Heading=====
15506 ====== Level 6 Heading======
15507 ======= Level 7 Heading=======
15508 ======== Level 8 Heading========
15509 ========= Level 9 Heading=========
15510 ========== Level 10 Heading==========
15511 !! html
15512 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15513 <ul>
15514 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
15515 <ul>
15516 <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>
15517 <ul>
15518 <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>
15519 <ul>
15520 <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>
15521 <ul>
15522 <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>
15523 <ul>
15524 <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>
15525 <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>
15526 <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>
15527 <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>
15528 <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>
15529 </ul>
15530 </li>
15531 </ul>
15532 </li>
15533 </ul>
15534 </li>
15535 </ul>
15536 </li>
15537 </ul>
15538 </li>
15539 </ul>
15540 </div>
15541
15542 <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>
15543 <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>
15544 <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>
15545 <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>
15546 <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>
15547 <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>
15548 <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>
15549 <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>
15550 <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>
15551 <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>
15552
15553 !! end
15554
15555 !! test
15556 TOC regression (T11764)
15557 !! wikitext
15558 == title 1 ==
15559 === title 1.1 ===
15560 ==== title 1.1.1 ====
15561 === title 1.2 ===
15562 == title 2 ==
15563 === title 2.1 ===
15564 !! html
15565 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15566 <ul>
15567 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
15568 <ul>
15569 <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>
15570 <ul>
15571 <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>
15572 </ul>
15573 </li>
15574 <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>
15575 </ul>
15576 </li>
15577 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
15578 <ul>
15579 <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>
15580 </ul>
15581 </li>
15582 </ul>
15583 </div>
15584
15585 <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>
15586 <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>
15587 <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>
15588 <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>
15589 <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>
15590 <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>
15591
15592 !! end
15593
15594 !! test
15595 TOC for heading containing <span id="..."></span> (T96153)
15596 !! wikitext
15597 __FORCETOC__
15598 ==<span id="old-anchor"></span>New title==
15599 !! html/php
15600 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15601 <ul>
15602 <li class="toclevel-1 tocsection-1"><a href="#New_title"><span class="tocnumber">1</span> <span class="toctext">New title</span></a></li>
15603 </ul>
15604 </div>
15605
15606 <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>
15607
15608 !! end
15609
15610 !! test
15611 TOC with wgMaxTocLevel=3 (T8204)
15612 !! options
15613 wgMaxTocLevel=3
15614 !! wikitext
15615 == title 1 ==
15616 === title 1.1 ===
15617 ==== title 1.1.1 ====
15618 === title 1.2 ===
15619 == title 2 ==
15620 === title 2.1 ===
15621 !! html
15622 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15623 <ul>
15624 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
15625 <ul>
15626 <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>
15627 <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>
15628 </ul>
15629 </li>
15630 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
15631 <ul>
15632 <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>
15633 </ul>
15634 </li>
15635 </ul>
15636 </div>
15637
15638 <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>
15639 <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>
15640 <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>
15641 <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>
15642 <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>
15643 <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>
15644
15645 !! end
15646
15647 !! test
15648 TOC with wgMaxTocLevel=3 and two level four headings (T8204)
15649 !! options
15650 wgMaxTocLevel=3
15651 !! wikitext
15652 ==Section 1==
15653 ===Section 1.1===
15654 ====Section 1.1.1====
15655 ====Section 1.1.1.1====
15656 ==Section 2==
15657 !! html
15658 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15659 <ul>
15660 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
15661 <ul>
15662 <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>
15663 </ul>
15664 </li>
15665 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
15666 </ul>
15667 </div>
15668
15669 <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>
15670 <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>
15671 <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>
15672 <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>
15673 <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>
15674
15675 !! end
15676
15677
15678 !! test
15679 Resolving duplicate section names
15680 !! wikitext
15681 == Foo bar ==
15682 == Foo bar ==
15683 !! html
15684 <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>
15685 <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>
15686
15687 !! end
15688
15689 !! test
15690 Resolving duplicate section names with differing case (T12721)
15691 !! wikitext
15692 == Foo bar ==
15693 == Foo Bar ==
15694 !! html
15695 <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>
15696 <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>
15697
15698 !! end
15699
15700 !! article
15701 Template:sections
15702 !! text
15703 ===Section 1===
15704 ==Section 2==
15705 !! endarticle
15706
15707 !! test
15708 Template with sections, __NOTOC__
15709 !! wikitext
15710 __NOTOC__
15711 ==Section 0==
15712 {{sections}}
15713 ==Section 4==
15714 !! html
15715 <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>
15716 <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>
15717 <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>
15718 <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>
15719
15720 !! end
15721
15722 !! test
15723 __NOEDITSECTION__ keyword
15724 !! wikitext
15725 __NOEDITSECTION__
15726 ==Section 1==
15727 ==Section 2==
15728 !! html
15729 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
15730 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
15731
15732 !! end
15733
15734 !! test
15735 Link inside a section heading
15736 !! wikitext
15737 ==Section with a [[Main Page|link]] in it==
15738 !! html
15739 <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>
15740
15741 !! end
15742
15743 !! test
15744 TOC regression (T14077)
15745 !! wikitext
15746 __TOC__
15747 == title 1 ==
15748 === title 1.1 ===
15749 == title 2 ==
15750 !! html
15751 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15752 <ul>
15753 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
15754 <ul>
15755 <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>
15756 </ul>
15757 </li>
15758 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
15759 </ul>
15760 </div>
15761
15762 <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>
15763 <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>
15764 <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>
15765
15766 !! end
15767
15768 !! test
15769 T3219 URL next to image (good)
15770 !! wikitext
15771 http://example.com [[File:Foobar.jpg]]
15772 !! html/php
15773 <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>
15774 </p>
15775 !! html/parsoid
15776 <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>
15777 !!end
15778
15779 !! test
15780 Short headings with trailing space should match behavior of Parser::doHeadings (T21910)
15781 !! wikitext
15782 ===
15783 The line above must have a trailing space!
15784 === <!--
15785 --> <!-- -->
15786 But just in case it doesn't...
15787 !! html
15788 <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>
15789 <p>The line above must have a trailing space!
15790 </p>
15791 <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>
15792 <p>But just in case it doesn't...
15793 </p>
15794 !! end
15795
15796 !! test
15797 Header with special characters (T27462)
15798 !! wikitext
15799 The tooltips shall not show entities to the user (ie. be double escaped)
15800
15801 == text > text ==
15802 section 1
15803
15804 == text < text ==
15805 section 2
15806
15807 == text & text ==
15808 section 3
15809
15810 == text ' text ==
15811 section 4
15812
15813 == text " text ==
15814 section 5
15815 !! html
15816 <p>The tooltips shall not show entities to the user (ie. be double escaped)
15817 </p>
15818 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15819 <ul>
15820 <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>
15821 <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>
15822 <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>
15823 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
15824 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
15825 </ul>
15826 </div>
15827
15828 <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>
15829 <p>section 1
15830 </p>
15831 <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>
15832 <p>section 2
15833 </p>
15834 <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>
15835 <p>section 3
15836 </p>
15837 <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>
15838 <p>section 4
15839 </p>
15840 <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>
15841 <p>section 5
15842 </p>
15843 !! end
15844
15845 !! test
15846 Header with space, plus and underscore as entity
15847 !! wikitext
15848 Id should not contain + for spaces
15849
15850 == Space between Text ==
15851 section 1
15852
15853 == Space-Entity&#32;between&#32;Text ==
15854 section 2
15855
15856 == Plus+between+Text ==
15857 section 3
15858
15859 == Plus-Entity&#43;between&#43;Text ==
15860 section 4
15861
15862 == Underscore_between_Text ==
15863 section 5
15864
15865 == Underscore-Entity&#95;between&#95;Text ==
15866 section 6
15867
15868 [[#Space between Text]]
15869 [[#Space-Entity&#32;between&#32;Text]]
15870 [[#Plus+between+Text]]
15871 [[#Plus-Entity&#43;between&#43;Text]]
15872 [[#Underscore_between_Text]]
15873 [[#Underscore-Entity&#95;between&#95;Text]]
15874 !! html
15875 <p>Id should not contain + for spaces
15876 </p>
15877 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15878 <ul>
15879 <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>
15880 <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>
15881 <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>
15882 <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>
15883 <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>
15884 <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>
15885 </ul>
15886 </div>
15887
15888 <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>
15889 <p>section 1
15890 </p>
15891 <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>
15892 <p>section 2
15893 </p>
15894 <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>
15895 <p>section 3
15896 </p>
15897 <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>
15898 <p>section 4
15899 </p>
15900 <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>
15901 <p>section 5
15902 </p>
15903 <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>
15904 <p>section 6
15905 </p><p><a href="#Space_between_Text">#Space between Text</a>
15906 <a href="#Space-Entity_between_Text">#Space-Entity&#32;between&#32;Text</a>
15907 <a href="#Plus.2Bbetween.2BText">#Plus+between+Text</a>
15908 <a href="#Plus-Entity.2Bbetween.2BText">#Plus-Entity&#43;between&#43;Text</a>
15909 <a href="#Underscore_between_Text">#Underscore_between_Text</a>
15910 <a href="#Underscore-Entity_between_Text">#Underscore-Entity&#95;between&#95;Text</a>
15911 </p>
15912 !! end
15913
15914 !! test
15915 Headers with excess '=' characters
15916 (Are similar tests necessary beyond the 1st level?)
15917 !! wikitext
15918 =foo==
15919 ==foo=
15920 =''italic'' heading==
15921 ==''italic'' heading=
15922 !! html
15923 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15924 <ul>
15925 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
15926 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
15927 <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>
15928 <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>
15929 </ul>
15930 </div>
15931
15932 <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>
15933 <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>
15934 <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>
15935 <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>
15936
15937 !! end
15938
15939 !! test
15940 HTML headers vs TOC (T25393)
15941 (__NOEDITSECTION__ for clearer output, doesn't matter here)
15942 !! wikitext
15943 <h1>Header 1</h1>
15944 == Header 1.1 ==
15945 == Header 1.2 ==
15946
15947 <h1>Header 2
15948 </h1>
15949 == Header 2.1 ==
15950 == Header 2.2 ==
15951 __NOEDITSECTION__
15952 !! html
15953 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15954 <ul>
15955 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
15956 <ul>
15957 <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>
15958 <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>
15959 </ul>
15960 </li>
15961 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
15962 <ul>
15963 <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>
15964 <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>
15965 </ul>
15966 </li>
15967 </ul>
15968 </div>
15969
15970 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
15971 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
15972 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
15973 <h1><span class="mw-headline" id="Header_2">Header 2</span></h1>
15974 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
15975 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
15976
15977 !! end
15978
15979 !! test
15980 Single-line or multiline-comments can follow headings
15981 !! options
15982 parsoid=wt2html,wt2wt
15983 !! wikitext
15984 ==foo==<!---->
15985 ==bar==<!--c1-->
15986 ==baz==<!--
15987 c2
15988 c3-->
15989 !! html
15990 <h2><span class="mw-headline" id="foo">foo</span></h2>
15991 <h2><span class="mw-headline" id="bar">bar</span></h2>
15992 <h2><span class="mw-headline" id="baz">baz</span></h2>
15993
15994 !! end
15995
15996 !! test
15997 T3219 URL next to image (broken)
15998 !! wikitext
15999 http://example.com[[File:Foobar.jpg]]
16000 !! html/php
16001 <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>
16002 </p>
16003 !! html/parsoid
16004 <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>
16005 !!end
16006
16007 !! test
16008 T3186 news: in the middle of text
16009 !! wikitext
16010 http://en.wikinews.org/wiki/Wikinews:Workplace
16011 !! html
16012 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
16013 </p>
16014 !!end
16015
16016
16017 !! test
16018 Namespaced link must have a title
16019 !! wikitext
16020 [[Project:]]
16021 !! html
16022 <p>[[Project:]]
16023 </p>
16024 !!end
16025
16026 !! test
16027 Namespaced link must have a title (bad fragment version)
16028 !! wikitext
16029 [[Project:#fragment]]
16030 !! html
16031 <p>[[Project:#fragment]]
16032 </p>
16033 !!end
16034
16035
16036 ###
16037 ### HTML tags and HTML attributes
16038 ###
16039
16040 !! test
16041 div with no attributes
16042 !! wikitext
16043 <div>HTML rocks</div>
16044 !! html
16045 <div>HTML rocks</div>
16046
16047 !! end
16048
16049 !! test
16050 div with double-quoted attribute
16051 !! wikitext
16052 <div id="rock">HTML rocks</div>
16053 !! html
16054 <div id="rock">HTML rocks</div>
16055
16056 !! end
16057
16058 !! test
16059 div with single-quoted attribute
16060 !! wikitext
16061 <div id='rock'>HTML rocks</div>
16062 !! html
16063 <div id="rock">HTML rocks</div>
16064
16065 !! end
16066
16067 !! test
16068 div with unquoted attribute
16069 !! wikitext
16070 <div id=rock>HTML rocks</div>
16071 !! html
16072 <div id="rock">HTML rocks</div>
16073
16074 !! end
16075
16076 !! test
16077 div with illegal double attributes
16078 !! wikitext
16079 <div id="a" id="b">HTML rocks</div>
16080 !! html
16081 <div id="b">HTML rocks</div>
16082
16083 !!end
16084
16085 !! test
16086 div with empty attribute value, space before equals
16087 !! options
16088 parsoid=wt2html,html2html
16089 !! wikitext
16090 <div class =>HTML rocks</div>
16091 !! html/php
16092 <div class="">HTML rocks</div>
16093
16094 !! html/parsoid
16095 <div class="" data-parsoid='{"stx":"html"}'>HTML rocks</div>
16096 !! end
16097
16098 !! test
16099 div with multiple empty attribute values
16100 !! options
16101 parsoid=wt2html,html2html
16102 !! wikitext
16103 <div id= title=>HTML rocks</div>
16104 !! html/php
16105 <div id="title.3D">HTML rocks</div>
16106
16107 !! html/parsoid
16108 <div id="title.3D" data-parsoid='{"stx":"html"}'>HTML rocks</div>
16109 !! end
16110
16111 !! test
16112 table with multiple empty attribute values
16113 !! options
16114 parsoid=wt2html,html2html
16115 !! wikitext
16116 {| title= id=
16117 | hi
16118 |}
16119 !! html/php
16120 <table title="id=">
16121 <tr>
16122 <td> hi
16123 </td></tr></table>
16124
16125 !! html/parsoid
16126 <table title="id=">
16127 <tbody><tr><td> hi</td></tr>
16128 </tbody></table>
16129 !! end
16130
16131 !! test
16132 div with braces in attribute value
16133 !! wikitext
16134 <div title="{}">Foo</div>
16135 !! html/php
16136 <div title="&#123;&#125;">Foo</div>
16137
16138 !! html/parsoid
16139 <div title="{}">Foo</div>
16140 !! end
16141
16142 !! test
16143 div with empty attribute value, no space before equals
16144 !! options
16145 parsoid=wt2html,html2html
16146 !! wikitext
16147 <div class=>HTML rocks</div>
16148 !! html/php
16149 <div class="">HTML rocks</div>
16150
16151 !! html/parsoid
16152 <div class="">HTML rocks</div>
16153 !! end
16154
16155 !! test
16156 HTML multiple attributes correction
16157 !! wikitext
16158 <p class="error" class="awesome">Awesome!</p>
16159 !! html
16160 <p class="awesome">Awesome!</p>
16161
16162 !!end
16163
16164 !! test
16165 Table multiple attributes correction
16166 !! wikitext
16167 {|
16168 !+ class="error" class="awesome"| status
16169 |}
16170 !! html
16171 <table>
16172 <tr>
16173 <th class="awesome"> status
16174 </th></tr></table>
16175
16176 !!end
16177
16178 !! test
16179 DIV IN UPPERCASE
16180 !! wikitext
16181 <DIV ID="x">HTML ROCKS</DIV>
16182 !! html
16183 <div id="x">HTML ROCKS</div>
16184
16185 !!end
16186
16187 !! test
16188 Non-ASCII pseudo-tags are rendered as text
16189 !! wikitext
16190 <khyô>
16191 !! html
16192 <p>&lt;khyô&gt;
16193 </p>
16194 !! end
16195
16196 !! test
16197 Pseudo-tag with URL 'name' renders as url link
16198 !! wikitext
16199 <http://example.com/>
16200 !! html
16201 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
16202 </p>
16203 !! end
16204
16205 !! test
16206 text with amp in the middle of nowhere
16207 !! wikitext
16208 Remember AT&T?
16209 !! html
16210 <p>Remember AT&amp;T?
16211 </p>
16212 !! end
16213
16214 !! test
16215 text with character entity: eacute
16216 !! wikitext
16217 I always thought &eacute; was a cute letter.
16218 !! html
16219 <p>I always thought &#233; was a cute letter.
16220 </p>
16221 !! html+tidy
16222 <p>I always thought é was a cute letter.</p>
16223 !! end
16224
16225 !! test
16226 text with entity-escaped character entity-like string: eacute
16227 !! wikitext
16228 I always thought &amp;eacute; was a cute letter.
16229 !! html
16230 <p>I always thought &amp;eacute; was a cute letter.
16231 </p>
16232 !! end
16233
16234 !! test
16235 text with undefined character entity: xacute
16236 !! wikitext
16237 I always thought &xacute; was a cute letter.
16238 !! html
16239 <p>I always thought &amp;xacute; was a cute letter.
16240 </p>
16241 !! end
16242
16243 !! test
16244 HTML5 tags
16245 !! wikitext
16246 <data value="5">five</data>
16247 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
16248 <mark>This highlighted text</mark>
16249 !! html
16250 <p><data value="5">five</data>
16251 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
16252 <mark>This highlighted text</mark>
16253 </p>
16254 !! end
16255
16256 !! test
16257 HTML tag with leading space is parsed as text
16258 !! wikitext
16259 < div>foo< /div>
16260 !! html
16261 <p>&lt; div&gt;foo&lt; /div&gt;
16262 </p>
16263 !! end
16264
16265 ###
16266 ### Nesting tests (see T43545, T52604, T53081)
16267 ###
16268
16269 # This test case is fixed in Parsoid by domino 1.0.12. (T52604)
16270 # Note that html2wt is considerably more difficult if we use <b> in
16271 # the test case, instead of <small>
16272 !! test
16273 Ensure that HTML adoption agency algorithm is properly implemented.
16274 !! wikitext
16275 <small>X<small>Y</small>Z</small>
16276 !! html
16277 <p><small>X<small>Y</small>Z</small>
16278 </p>
16279 !! end
16280
16281 # This was T43545 in the PHP parser.
16282 # Note that tidy doesn't handle this correctly.
16283 !! test
16284 Nesting of <kbd>
16285 !! wikitext
16286 <kbd>X<kbd>Y</kbd>Z</kbd>
16287 !! html
16288 <p><kbd>X<kbd>Y</kbd>Z</kbd>
16289 </p>
16290 !! end
16291
16292 # The following cases were T53081 in the PHP parser.
16293 # Note that there are some other nestable tags (b, i, etc) which are
16294 # not covered; see T53081 for discussion.
16295
16296 # Note that tidy doesn't handle this correctly.
16297 !! test
16298 Nesting of <em>
16299 !! wikitext
16300 <em>X<em>Y</em>Z</em>
16301 !! html
16302 <p><em>X<em>Y</em>Z</em>
16303 </p>
16304 !! end
16305
16306 # Note that tidy doesn't handle this correctly.
16307 !! test
16308 Nesting of <strong>
16309 !! wikitext
16310 <strong>X<strong>Y</strong>Z</strong>
16311 !! html
16312 <p><strong>X<strong>Y</strong>Z</strong>
16313 </p>
16314 !! end
16315
16316 !! test
16317 Nesting of <q>
16318 !! wikitext
16319 <q>X<q>Y</q>Z</q>
16320 !! html+tidy
16321 <p><q>X<q>Y</q>Z</q></p>
16322 !! end
16323
16324 # Note that tidy doesn't handle this correctly.
16325 !! test
16326 Nesting of <ruby>
16327 !! wikitext
16328 <ruby>X<ruby>Y</ruby>Z</ruby>
16329 !! html
16330 <p><ruby>X<ruby>Y</ruby>Z</ruby>
16331 </p>
16332 !! end
16333
16334 # Note that tidy doesn't handle this correctly.
16335 !! test
16336 Nesting of <bdo>
16337 !! wikitext
16338 <bdo>X<bdo>Y</bdo>Z</bdo>
16339 !! html
16340 <p><bdo>X<bdo>Y</bdo>Z</bdo>
16341 </p>
16342 !! end
16343
16344
16345 ###
16346 ### Media links
16347 ###
16348
16349 !! test
16350 Media link
16351 !! wikitext
16352 [[Media:Foobar.jpg]]
16353 !! html
16354 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
16355 </p>
16356 !! end
16357
16358 !! test
16359 Media link with text
16360 !! wikitext
16361 [[Media:Foobar.jpg|A neat file to look at]]
16362 !! html
16363 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
16364 </p>
16365 !! end
16366
16367 # FIXME: this is still bad HTML tag nesting
16368 # FIXME: doBlockLevels won't wrap this in a paragraph because it contains a div
16369 !! test
16370 Media link with nasty text
16371 !! wikitext
16372 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
16373 !! html
16374 <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>
16375
16376 !! html+tidy
16377 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Safe Link</a></p>
16378 <div style="display:none">" onmouseover="alert(document.cookie)" onfoo="</div>
16379 !! end
16380
16381 !! test
16382 Media link to nonexistent file (T3702)
16383 !! wikitext
16384 [[Media:No such.jpg]]
16385 !! html
16386 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
16387 </p>
16388 !! end
16389
16390 !! test
16391 Image link to nonexistent file (T3850 - good)
16392 !! wikitext
16393 [[File:No_such.jpg]]
16394 !! html/php
16395 <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>
16396 </p>
16397 !! html/parsoid
16398 <p><span class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}]}'><a href="./File:No_such.jpg"><img resource="./File:No_such.jpg" src="./Special:FilePath/No_such.jpg" height="220" width="220"/></a></span></p>
16399 !! end
16400
16401 !! test
16402 :Image link to nonexistent file (T3850 - bad)
16403 !! wikitext
16404 [[:Image:No such.jpg]]
16405 !! html/php
16406 <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>
16407 </p>
16408 !! html/parsoid
16409 <p><a rel="mw:WikiLink" href="./File:No_such.jpg" title="File:No such.jpg">Image:No such.jpg</a></p>
16410 !! end
16411
16412
16413
16414 !! test
16415 Character reference normalization in link text (T3938)
16416 !! wikitext
16417 [[Main Page|this&that]]
16418 !! html
16419 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
16420 </p>
16421 !!end
16422
16423 !! article
16424 אַ
16425 !! text
16426 Test for unicode normalization
16427
16428 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
16429 !! endarticle
16430
16431 !! test
16432 (T21451) Links should refer to the normalized form.
16433 !! wikitext
16434 [[&#xFB2E;]]
16435 [[&#x5d0;&#x5b7;]]
16436 [[&#x5d0;ַ]]
16437 [[א&#x5b7;]]
16438 [[אַ]]
16439 !! html
16440 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
16441 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
16442 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
16443 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
16444 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
16445 </p>
16446 !! end
16447
16448 !! test
16449 Empty attribute crash test (T4067)
16450 !! wikitext
16451 <font color="">foo</font>
16452 !! html
16453 <p><font color="">foo</font>
16454 </p>
16455 !! end
16456
16457 !! test
16458 Empty attribute crash test single-quotes (T4067)
16459 !! wikitext
16460 <font color=''>foo</font>
16461 !! html
16462 <p><font color="">foo</font>
16463 </p>
16464 !! end
16465
16466 !! test
16467 Attribute test: equals, then nothing
16468 !! options
16469 parsoid=wt2html,html2html
16470 !! wikitext
16471 <font color=>foo</font>
16472 !! html/php
16473 <p><font color="">foo</font>
16474 </p>
16475 !! html/parsoid
16476 <p><font color="" data-parsoid='{"stx":"html"}'>foo</font></p>
16477 !! end
16478
16479 !! test
16480 Attribute test: unquoted value
16481 !! options
16482 parsoid=wt2html,html2html
16483 !! wikitext
16484 <font color=x>foo</font>
16485 !! html/php
16486 <p><font color="x">foo</font>
16487 </p>
16488 !! html/parsoid
16489 <p><font color="x" data-parsoid='{"stx":"html"}'>foo</font></p>
16490 !! end
16491
16492 !! test
16493 Attribute test: unquoted but illegal value (hash)
16494 !! wikitext
16495 <font color=#x>foo</font>
16496 !! html
16497 <p><font color="#x">foo</font>
16498 </p>
16499 !! end
16500
16501 # Parsoid does not serialize to empty attribute syntax,
16502 # so wt2wt and html2wt cases are skipped
16503 !! test
16504 Attribute test: no value (T54330)
16505 !! options
16506 parsoid=wt2html,html2html
16507 !! wikitext
16508 <font color>foo</font>
16509 !! html/php
16510 <p><font color="">foo</font>
16511 </p>
16512 !! html/parsoid
16513 <p><font color="">foo</font></p>
16514 !! end
16515
16516 !! test
16517 T4095: link with three closing brackets
16518 !! wikitext
16519 [[Main Page]]]
16520 !! html/php
16521 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
16522 </p>
16523 !! html/parsoid
16524 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a>]</p>
16525 !! end
16526
16527 !! test
16528 T4095: link with pipe and three closing brackets
16529 !! wikitext
16530 [[Main Page|link]]]
16531 !! html/php
16532 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
16533 </p>
16534 !! html/parsoid
16535 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">link</a>]</p>
16536 !! end
16537
16538 !! test
16539 T4095: link with pipe and three closing brackets, version 2
16540 !! wikitext
16541 [[Main Page|[http://example.com/]]]
16542 !! html/php
16543 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
16544 </p>
16545 !! html/parsoid
16546 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">[http://example.com/]</a></p>
16547 !! end
16548
16549
16550 ###
16551 ### Safety
16552 ###
16553
16554 !! article
16555 Template:Dangerous attribute
16556 !! text
16557 " onmouseover="alert(document.cookie)
16558 !! endarticle
16559
16560 !! article
16561 Template:Dangerous style attribute
16562 !! text
16563 border-size: expression(alert(document.cookie))
16564 !! endarticle
16565
16566 !! article
16567 Template:Div style
16568 !! text
16569 <div style="float: right; {{{1}}}">Magic div</div>
16570 !! endarticle
16571
16572 !! test
16573 T4304: HTML attribute safety (safe template; regression T4309)
16574 !! wikitext
16575 <div title="{{test}}"></div>
16576 !! html/php
16577 <div title="This is a test template"></div>
16578
16579 !! html/parsoid
16580 <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>
16581 !! end
16582
16583 # Parsoid has enough context to handle this case
16584 !! test
16585 T4304: HTML attribute safety (dangerous template; 2309)
16586 !! wikitext
16587 <div title="{{dangerous attribute}}"></div>
16588 !! html/php
16589 <div title=""></div>
16590
16591 !! html/parsoid
16592 <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>
16593 !! end
16594
16595 !! test
16596 T4304: HTML attribute safety (dangerous style template; 2309)
16597 !! wikitext
16598 <div style="{{dangerous style attribute}}"></div>
16599 !! html/php
16600 <div style="/* insecure input */"></div>
16601
16602 !! html/parsoid
16603 <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>
16604 !! end
16605
16606 !! test
16607 T4304: HTML attribute safety (safe parameter; 2309)
16608 !! wikitext
16609 {{div style|width: 200px}}
16610 !! html/php
16611 <div style="float: right; width: 200px">Magic div</div>
16612
16613 !! html/parsoid
16614 <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>
16615 !! end
16616
16617 !! test
16618 T4304: HTML attribute safety (unsafe parameter; 2309)
16619 !! wikitext
16620 {{div style|width: expression(alert(document.cookie))}}
16621 !! html/php
16622 <div style="/* insecure input */">Magic div</div>
16623
16624 !! html/parsoid
16625 <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>
16626 !! end
16627
16628 ## Parsoid output here differs; needs investigation.
16629 !! test
16630 T4304: HTML attribute safety (unsafe breakout parameter; 2309)
16631 !! wikitext
16632 {{div style|"><script>alert(document.cookie)</script>}}
16633 !! html
16634 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
16635
16636 !! end
16637
16638 ## Parsoid output here differs; needs investigation.
16639 !! test
16640 T4304: HTML attribute safety (unsafe breakout parameter 2; 2309)
16641 !! wikitext
16642 {{div style|" ><script>alert(document.cookie)</script>}}
16643 !! html
16644 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
16645
16646 !! end
16647
16648 !! test
16649 T4304: HTML attribute safety (link)
16650 !! wikitext
16651 <div title="[[Main Page]]"></div>
16652 !! html
16653 <div title="&#91;&#91;Main Page]]"></div>
16654
16655 !! end
16656
16657 !! test
16658 T4304: HTML attribute safety (italics)
16659 !! wikitext
16660 <div title="''foobar''"></div>
16661 !! html
16662 <div title="&#39;&#39;foobar&#39;&#39;"></div>
16663
16664 !! end
16665
16666 !! test
16667 T4304: HTML attribute safety (bold)
16668 !! wikitext
16669 <div title="'''foobar'''"></div>
16670 !! html
16671 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
16672
16673 !! end
16674
16675 !! test
16676 T4304: HTML attribute safety (ISBN)
16677 !! wikitext
16678 <div title="ISBN 1234567890"></div>
16679 !! html
16680 <div title="&#73;SBN 1234567890"></div>
16681
16682 !! end
16683
16684 !! test
16685 T4304: HTML attribute safety (RFC)
16686 !! wikitext
16687 <div title="RFC 1234"></div>
16688 !! html
16689 <div title="&#82;FC 1234"></div>
16690
16691 !! end
16692
16693 !! test
16694 T4304: HTML attribute safety (PMID)
16695 !! wikitext
16696 <div title="PMID 1234567890"></div>
16697 !! html
16698 <div title="&#80;MID 1234567890"></div>
16699
16700 !! end
16701
16702 !! test
16703 T4304: HTML attribute safety (web link)
16704 !! wikitext
16705 <div title="http://example.com/"></div>
16706 !! html
16707 <div title="http&#58;//example.com/"></div>
16708
16709 !! end
16710
16711 !! test
16712 T4304: HTML attribute safety (named web link)
16713 !! wikitext
16714 <div title="[http://example.com/ link]"></div>
16715 !! html
16716 <div title="&#91;http&#58;//example.com/ link]"></div>
16717
16718 !! end
16719
16720 !! test
16721 T5244: HTML attribute safety (extension; safe)
16722 !! wikitext
16723 <div style="<nowiki>background:blue</nowiki>"></div>
16724 !! html/php
16725 <div style="background:blue"></div>
16726
16727 !! html/parsoid
16728 <div style="background:blue" data-parsoid='{"stx":"html","a":{"style":"background:blue"},"sa":{"style":"&lt;nowiki>background:blue&lt;/nowiki>"}}'></div>
16729 !! end
16730
16731 !! test
16732 T5244: HTML attribute safety (extension; unsafe)
16733 !! wikitext
16734 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
16735 !! html/php
16736 <div style="/* insecure input */"></div>
16737
16738 !! html/parsoid
16739 <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>
16740 !! end
16741
16742 # More MSIE fun discovered by Tom Gilder
16743
16744 !! test
16745 MSIE CSS safety test: spurious slash
16746 !! wikitext
16747 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
16748 !! html/php
16749 <div style="/* insecure input */">evil</div>
16750
16751 !! html/parsoid
16752 <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>
16753 !! end
16754
16755 !! test
16756 MSIE CSS safety test: hex code
16757 !! wikitext
16758 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
16759 !! html/php
16760 <div style="/* insecure input */">evil</div>
16761
16762 !! html/parsoid
16763 <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>
16764 !! end
16765
16766 !! test
16767 MSIE CSS safety test: comment in url
16768 !! wikitext
16769 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
16770 !! html/php
16771 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
16772
16773 !! html/parsoid
16774 <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>
16775 !! end
16776
16777 !! test
16778 MSIE CSS safety test: comment in expression
16779 !! wikitext
16780 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
16781 !! html/php
16782 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
16783
16784 !! html/parsoid
16785 <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>
16786 !! end
16787
16788 !! test
16789 CSS safety test (all browsers): vertical tab (T57332 / CVE-2013-4567)
16790 !! wikitext
16791 <p style="font-size: 100px; background-image:url\b(https://www.google.com/images/srpr/logo6w.png)">A</p>
16792 !! html/php
16793 <p style="/* invalid control char */">A</p>
16794
16795 !! html/parsoid
16796 <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>
16797 !! end
16798
16799 !! test
16800 MSIE 6 CSS safety test: Fullwidth (T57332)
16801 !! wikitext
16802 <p style="font-size: 100px; color: expression((title='XSSed'),'red')">A</p>
16803 <div style="top:EXPRESSION(alert())">B</div>
16804 !! html/php
16805 <p style="/* insecure input */">A</p>
16806 <div style="/* insecure input */">B</div>
16807
16808 !! html/parsoid
16809 <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>
16810 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"top:EXPRESSION(alert())"}}'>B</div>
16811 !! end
16812
16813 !! test
16814 MSIE 6 CSS safety test: IPA extensions (T57332)
16815 !! wikitext
16816 <div style="background-image:uʀʟ(javascript:alert())">A</div>
16817 <p style="font-size: 100px; color: expʀessɪoɴ((title='XSSed'),'red')">B</p>
16818 !! html/php
16819 <div style="/* insecure input */">A</div>
16820 <p style="/* insecure input */">B</p>
16821
16822 !! html/parsoid
16823 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"background-image:uʀʟ(javascript:alert())"}}'>A</div>
16824 <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>
16825 !! end
16826
16827 !! test
16828 MSIE 6 CSS safety test: sup/sub script (T57332)
16829 !! wikitext
16830 <div style="background-image:url⁽javascript:alert())">A</div>
16831 <div style="background-image:url₍javascript:alert())">B</div>
16832 <p style="font-size: 100px; color: expressioⁿ((title='XSSed'),'red')">C</p>
16833 !! html/php
16834 <div style="/* insecure input */">A</div>
16835 <div style="/* insecure input */">B</div>
16836 <p style="/* insecure input */">C</p>
16837
16838 !! html/parsoid
16839 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"background-image:url⁽javascript:alert())"}}'>A</div>
16840 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"background-image:url₍javascript:alert())"}}'>B</div>
16841 <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>
16842 !! end
16843
16844 !! test
16845 Opera -o-link CSS
16846 !! options
16847 parsoid=wt2html,html2html
16848 !! wikitext
16849 <div
16850 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;"
16851 style="-o-link:attr(title);-o-link-source:current">X</div>
16852 !! html/php
16853 <div title="data:text/html,&lt;img src=1 onerror=alert(1)&gt;" style="/* insecure input */">X</div>
16854
16855 !! html/parsoid
16856 <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>
16857 !! end
16858
16859 !! test
16860 MSIE 6 CSS safety test: Repetition markers (T57332)
16861 !! wikitext
16862 <p style="font-size: 100px; color: expres〱ion((title='XSSed'),'red')">A</p>
16863 <p style="font-size: 100px; color: expresゝion((title='XSSed'),'red')">B</p>
16864 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">C</p>
16865 <p style="font-size: 100px; color: expresヽion((title='XSSed'),'red')">D</p>
16866 <p style="font-size: 100px; color: expresﹽion((title='XSSed'),'red')">E</p>
16867 <p style="font-size: 100px; color: expresﹼion((title='XSSed'),'red')">F</p>
16868 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">G</p>
16869 !! html/php
16870 <p style="/* insecure input */">A</p>
16871 <p style="/* insecure input */">B</p>
16872 <p style="/* insecure input */">C</p>
16873 <p style="/* insecure input */">D</p>
16874 <p style="/* insecure input */">E</p>
16875 <p style="/* insecure input */">F</p>
16876 <p style="/* insecure input */">G</p>
16877
16878 !! html/parsoid
16879 <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>
16880 <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>
16881 <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>
16882 <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>
16883 <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>
16884 <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>
16885 <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>
16886 !! end
16887
16888 !! test
16889 Table attribute legitimate extension
16890 !! wikitext
16891 {|
16892 !+ style="<nowiki>color:blue</nowiki>"| status
16893 |}
16894 !! html
16895 <table>
16896 <tr>
16897 <th style="color:blue"> status
16898 </th></tr></table>
16899
16900 !!end
16901
16902 !! test
16903 Table attribute safety
16904 !! wikitext
16905 {|
16906 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
16907 |}
16908 !! html
16909 <table>
16910 <tr>
16911 <th style="/* insecure input */"> status
16912 </th></tr></table>
16913
16914 !! end
16915
16916 !! test
16917 CSS line continuation 1
16918 !! wikitext
16919 <div style="background-image: u\&#10;rl(test.jpg);"></div>
16920 !! html
16921 <div style="/* insecure input */"></div>
16922
16923 !! end
16924
16925 !! test
16926 CSS line continuation 2
16927 !! wikitext
16928 <div style="background-image: u\&#13;rl(test.jpg); "></div>
16929 !! html
16930 <div style="/* invalid control char */"></div>
16931
16932 !! end
16933
16934 !! article
16935 Template:Identity
16936 !! text
16937 {{{1}}}
16938 !! endarticle
16939
16940 !! test
16941 Expansion of multi-line templates in attribute values (T8255)
16942 !! wikitext
16943 <div style="background: {{identity|#00FF00}}">-</div>
16944 !! html
16945 <div style="background: #00FF00">-</div>
16946
16947 !! end
16948
16949 !! test
16950 Expansion of multi-line templates in attribute values (T8255 sanity check)
16951 !! wikitext
16952 <div style="background:
16953 #00FF00">-</div>
16954 !! html/php
16955 <div style="background: #00FF00">-</div>
16956
16957 !! html/parsoid
16958 <div style="background:
16959 #00FF00">-</div>
16960 !! end
16961
16962 !! test
16963 Expansion of multi-line templates in attribute values (T8255 sanity check 2)
16964 !! wikitext
16965 <div style="background: &#10;#00FF00">-</div>
16966 !! html
16967 <div style="background: &#10;#00FF00">-</div>
16968
16969 !! end
16970
16971 !! test
16972 Tags which are hidden from Tidy cannot pass through the Sanitizer
16973 !! wikitext
16974 <mw:toc><script>alert();</script></mw:toc>
16975 !! html+tidy
16976 <p>&lt;mw:toc&gt;&lt;script&gt;alert();&lt;/script&gt;&lt;/mw:toc&gt;</p>
16977 !! end
16978
16979 ###
16980 ### Parser hooks (see tests/parser/parserTestsParserHook.php for the <tag> extension)
16981 ###
16982
16983 !! test
16984 Parser hook: empty input
16985 !! wikitext
16986 <tag></tag>
16987 !! html/php
16988 <pre>
16989 ''
16990 array (
16991 )
16992 </pre>
16993
16994 !! html/parsoid
16995 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
16996 !! end
16997
16998 ## Don't expect parsoid to rt this form.
16999 !! test
17000 Parser hook: empty input using terminated empty elements
17001 !! options
17002 parsoid=wt2html,html2html
17003 !! wikitext
17004 <tag/>
17005 !! html/php
17006 <pre>
17007 NULL
17008 array (
17009 )
17010 </pre>
17011
17012 !! html/parsoid
17013 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":null}' data-parsoid='{}' about="#mwt2"></pre>
17014 !! end
17015
17016 !! test
17017 Parser hook: empty input using terminated empty elements (space before)
17018 !! wikitext
17019 <tag />
17020 !! html/php
17021 <pre>
17022 NULL
17023 array (
17024 )
17025 </pre>
17026
17027 !! html/parsoid
17028 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":null}' data-parsoid='{}' about="#mwt2"></pre>
17029 !! end
17030
17031 !! test
17032 Parser hook: basic input
17033 !! wikitext
17034 <tag>input</tag>
17035 !! html/php
17036 <pre>
17037 'input'
17038 array (
17039 )
17040 </pre>
17041
17042 !! html/parsoid
17043 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
17044 !! end
17045
17046 ## Don't expect parsoid to rt this form.
17047 !! test
17048 Parser hook: case insensitive
17049 !! options
17050 parsoid=wt2html,html2html
17051 !! wikitext
17052 <TAG>input</TAG>
17053 !! html/php
17054 <pre>
17055 'input'
17056 array (
17057 )
17058 </pre>
17059
17060 !! html/parsoid
17061 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
17062 !! end
17063
17064 ## Don't expect parsoid to rt this form.
17065 !! test
17066 Parser hook: case insensitive, redux
17067 !! options
17068 parsoid=wt2html,html2html
17069 !! wikitext
17070 <TaG>input</TAg>
17071 !! html/php
17072 <pre>
17073 'input'
17074 array (
17075 )
17076 </pre>
17077
17078 !! html/parsoid
17079 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
17080 !! end
17081
17082 !! test
17083 Parser hook: nested tags
17084 !! wikitext
17085 <tag><tag></tag></tag>
17086 !! html/php
17087 <pre>
17088 '<tag>'
17089 array (
17090 )
17091 </pre>&lt;/tag&gt;
17092
17093 !! html/parsoid
17094 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"&lt;tag>"}}' data-parsoid='{}' about="#mwt2"></pre>&lt;/tag>
17095 !! end
17096
17097 !! test
17098 Parser hook: basic arguments
17099 !! wikitext
17100 <tag width="200" height="100" depth="50" square=""></tag>
17101 !! html/php
17102 <pre>
17103 ''
17104 array (
17105 'width' => '200',
17106 'height' => '100',
17107 'depth' => '50',
17108 'square' => '',
17109 )
17110 </pre>
17111
17112 !! html/parsoid
17113 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
17114 !! end
17115
17116 ## Don't expect parsoid to rt this form.
17117 !! test
17118 Parser hook: basic arguments, variations
17119 !! options
17120 parsoid=wt2html,html2html
17121 !! wikitext
17122 <tag width=200 height = "100" depth = '50' square></tag>
17123 !! html/php
17124 <pre>
17125 ''
17126 array (
17127 'width' => '200',
17128 'height' => '100',
17129 'depth' => '50',
17130 'square' => '',
17131 )
17132 </pre>
17133
17134 !! html/parsoid
17135 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
17136 !! end
17137
17138 !! test
17139 Parser hook: argument containing a forward slash (T7344)
17140 !! wikitext
17141 <tag filename="/tmp/bla"></tag>
17142 !! html/php
17143 <pre>
17144 ''
17145 array (
17146 'filename' => '/tmp/bla',
17147 )
17148 </pre>
17149
17150 !! html/parsoid
17151 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"filename":"/tmp/bla"},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
17152 !! end
17153
17154 ## Don't expect parsoid to rt this form.
17155 !! test
17156 Parser hook: empty input using terminated empty elements (T4374)
17157 !! options
17158 parsoid=wt2html,html2html
17159 !! wikitext
17160 <tag foo=bar/>text
17161 !! html/php
17162 <pre>
17163 NULL
17164 array (
17165 'foo' => 'bar',
17166 )
17167 </pre>text
17168
17169 !! html/parsoid
17170 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"foo":"bar"},"body":null}' data-parsoid='{}' about="#mwt2"></pre>text
17171 !! end
17172
17173 ## </tag> should be output literally since there is no matching tag that begins it
17174 ## Don't expect parsoid to rt this form.
17175 !! test
17176 Parser hook: basic arguments using terminated empty elements (T4374)
17177 !! options
17178 parsoid=wt2html
17179 !! wikitext
17180 <tag width=200 height = "100" depth = '50' square/>
17181 other stuff
17182 </tag>
17183 !! html/php
17184 <pre>
17185 NULL
17186 array (
17187 'width' => '200',
17188 'height' => '100',
17189 'depth' => '50',
17190 'square' => '',
17191 )
17192 </pre>
17193 <p>other stuff
17194 &lt;/tag&gt;
17195 </p>
17196 !! html/parsoid
17197 <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
17198 &lt;/tag></p>
17199 !! end
17200
17201 ## Don't expect parsoid to rt this form.
17202 !! test
17203 Parser hook: Don't allow unclosed extension tags
17204 !! options
17205 parsoid=wt2html
17206 !! wikitext
17207 test <tag>123
17208
17209 this is a '''test'''
17210 !! html/php
17211 <p>test &lt;tag&gt;123
17212 </p><p>this is a <b>test</b>
17213 </p>
17214 !! html/parsoid
17215 <p>test &lt;tag>123</p>
17216
17217 <p>this is a <b>test</b></p>
17218 !! end
17219
17220 ###
17221 ### (see tests/parser/parserTestsParserHook.php for the <statictag> extension)
17222 ###
17223
17224 !! test
17225 Parser hook: static parser hook not inside a comment
17226 !! wikitext
17227 <statictag>hello, world</statictag>
17228
17229 <statictag action="flush" />
17230 !! html/php
17231 <p><br />
17232 hello, world
17233 </p>
17234 !! html/parsoid
17235 <p><span typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{},"body":{"extsrc":"hello, world"}}' data-parsoid='{}' about="#mwt2"></span></p>
17236 <p typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{"action":"flush"},"body":null}' data-parsoid='{}' about="#mwt4">hello, world</p>
17237 !! end
17238
17239 !! test
17240 Parser hook: static parser hook inside a comment
17241 !! wikitext
17242 <!-- <statictag>hello, world</statictag> -->
17243 <statictag action="flush" />
17244 !! html/php
17245 <p><br />
17246 </p>
17247 !! html/parsoid
17248 <!-- <statictag&#x3E;hello, world</statictag&#x3E; -->
17249 <p typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{"action":"flush"},"body":null}' data-parsoid='{}' about="#mwt2"></p>
17250 !! end
17251
17252 # Nested template calls; this case was broken by Parser.php rev 1.506,
17253 # since reverted.
17254
17255 !! article
17256 Template:One-parameter
17257 !! text
17258 (My parameter is: {{{1}}})
17259 !! endarticle
17260
17261 !! article
17262 Template:Map-one-parameter
17263 !! text
17264 {{{{{1}}}|{{{2}}}}}
17265 !! endarticle
17266
17267 !! test
17268 Nested template calls
17269 !! wikitext
17270 {{Map-one-parameter|One-parameter|param}}
17271 !! html
17272 <p>(My parameter is: param)
17273 </p>
17274 !! end
17275
17276
17277 ###
17278 ### Sanitizer
17279 ###
17280
17281 # HTML+Tidy effectively strips out the empty tags completely
17282 # But since Parsoid doesn't it wraps the <s></s> tags in p-tags
17283 # which Tidy would have done for the PHP parser had there been content inside it.
17284 !! test
17285 Sanitizer: Closing of open tags
17286 !! wikitext
17287 <s></s><table></table>
17288 !! html
17289 <s></s><table></table>
17290
17291 !! html/parsoid
17292 <p><s></s></p><table></table>
17293 !! end
17294
17295 !! test
17296 Sanitizer: Closing of open but not closed tags
17297 !! wikitext
17298 <s>foo
17299 !! html
17300 <p><s>foo</s>
17301 </p>
17302 !! end
17303
17304 !! test
17305 Sanitizer: Closing of closed but not open tags
17306 !! options
17307 parsoid=wt2html
17308 !! wikitext
17309 </s>
17310 !! html/php+tidy
17311 !! html/parsoid
17312 !! end
17313
17314 !! test
17315 Sanitizer: Closing of closed but not open table tags
17316 !! options
17317 parsoid=wt2html
17318 !! wikitext
17319 Table not started</td></tr></table>
17320 !! html/php+tidy
17321 <p>Table not started</p>
17322 !! html/parsoid
17323 <p>Table not started</p>
17324 !! end
17325
17326 !! test
17327 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
17328 !! wikitext
17329 <span id="æ: v">byte</span>[[#æ: v|backlink]]
17330 !! html/php
17331 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
17332 </p>
17333 !! html/parsoid
17334 <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>
17335 !! end
17336
17337 # In HTML5, the restrictions are that id must contain at least one character,
17338 # and must not contain any space characters.
17339 !! test
17340 Sanitizer: Validating the contents of the id attribute (T6515)
17341 !! options
17342 disabled
17343 !! wikitext
17344 <br id="" /><br id="a space" />
17345 !! html
17346 Something ...
17347 !! end
17348
17349 # In HTML5, id must be unique amongst all the ids in the element's home subtree.
17350 !! test
17351 Sanitizer: Validating id attribute uniqueness (T6515, T8301)
17352 !! options
17353 disabled
17354 !! wikitext
17355 <br id="foo" /><br id="foo" />
17356 !! html
17357 Something need to be done. foo-2 ?
17358 !! end
17359
17360 !! test
17361 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
17362 !! wikitext
17363 <div itemscope>
17364 <meta itemprop="hello" content="world">
17365 <meta http-equiv="refresh" content="5">
17366 <meta itemprop="hello" http-equiv="refresh" content="5">
17367 <link itemprop="hello" href="{{SERVER}}">
17368 <link rel="stylesheet" href="{{SERVER}}">
17369 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
17370 </div>
17371 !! html
17372 <div itemscope="">
17373 <p> <meta itemprop="hello" content="world" />
17374 &lt;meta http-equiv="refresh" content="5"&gt;
17375 <meta itemprop="hello" content="5" />
17376 </p>
17377 <link itemprop="hello" href="http&#58;//example.org" />
17378 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
17379 <link itemprop="hello" href="http&#58;//example.org" />
17380 </div>
17381
17382 !! end
17383
17384 !! test
17385 Language converter: output gets cut off unexpectedly (T7757)
17386 !! options
17387 language=zh
17388 !! wikitext
17389 this bit is safe: }-
17390
17391 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
17392
17393 then we get cut off here: }-
17394
17395 all additional text is vanished
17396 !! html
17397 <p>this bit is safe: }-
17398 </p><p>but if we add a conversion instance: xxx
17399 </p><p>then we get cut off here: }-
17400 </p><p>all additional text is vanished
17401 </p>
17402 !! end
17403
17404 !! test
17405 Self closed html pairs (T7487)
17406 !! options
17407 !! wikitext
17408 <center><font id="bug" />Centered text</center>
17409 <div><font id="bug2" />In div text</div>
17410 !! html
17411 <center>&lt;font id="bug" /&gt;Centered text</center>
17412 <div>&lt;font id="bug2" /&gt;In div text</div>
17413
17414 !! end
17415
17416 #
17417 #
17418 #
17419
17420 !! test
17421 Punctuation: nbsp before exclamation
17422 !! wikitext
17423 C'est grave !
17424 !! html
17425 <p>C'est grave&#160;!
17426 </p>
17427 !! end
17428
17429 !! test
17430 Punctuation: CSS !important (T13874)
17431 !! wikitext
17432 <div style="width:50% !important">important</div>
17433 !! html
17434 <div style="width:50% !important">important</div>
17435
17436 !!end
17437
17438 !! test
17439 Punctuation: CSS ! important (T13874; with space after)
17440 !! wikitext
17441 <div style="width:50% ! important">important</div>
17442 !! html
17443 <div style="width:50% ! important">important</div>
17444
17445 !!end
17446
17447 !! test
17448 HTML bullet list, closed tags (T7497)
17449 !! wikitext
17450 <ul>
17451 <li>One</li>
17452 <li>Two</li>
17453 </ul>
17454 !! html/php
17455 <ul>
17456 <li>One</li>
17457 <li>Two</li>
17458 </ul>
17459
17460 !! html/parsoid
17461 <ul data-parsoid='{"stx":"html"}'>
17462 <li data-parsoid='{"stx":"html"}'>One</li>
17463 <li data-parsoid='{"stx":"html"}'>Two</li>
17464 </ul>
17465
17466 !! end
17467
17468 !! test
17469 HTML bullet list, unclosed tags (T7497)
17470 !! wikitext
17471 <ul>
17472 <li>One
17473 <li>Two
17474 </ul>
17475 !! html/php+tidy
17476 <ul>
17477 <li>One</li>
17478 <li>Two</li>
17479 </ul>
17480 !! html/parsoid
17481 <ul data-parsoid='{"stx":"html"}'>
17482 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
17483 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
17484 </ul>
17485
17486 !! end
17487
17488 !! test
17489 HTML ordered list, closed tags (T7497)
17490 !! wikitext
17491 <ol>
17492 <li>One</li>
17493 <li>Two</li>
17494 </ol>
17495 !! html/php
17496 <ol>
17497 <li>One</li>
17498 <li>Two</li>
17499 </ol>
17500
17501 !! html/parsoid
17502 <ol data-parsoid='{"stx":"html"}'>
17503 <li data-parsoid='{"stx":"html"}'>One</li>
17504 <li data-parsoid='{"stx":"html"}'>Two</li>
17505 </ol>
17506
17507 !! end
17508
17509 !! test
17510 HTML ordered list, unclosed tags (T7497)
17511 !! options
17512 !! wikitext
17513 <ol>
17514 <li>One
17515 <li>Two
17516 </ol>
17517 !! html/php+tidy
17518 <ol>
17519 <li>One</li>
17520 <li>Two</li>
17521 </ol>
17522 !! html/parsoid
17523 <ol data-parsoid='{"stx":"html"}'>
17524 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
17525 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
17526 </ol>
17527
17528 !! end
17529
17530 !! test
17531 HTML nested bullet list, closed tags (T7497)
17532 !! wikitext
17533 <ul>
17534 <li>One</li>
17535 <li>Two:
17536 <ul>
17537 <li>Sub-one</li>
17538 <li>Sub-two</li>
17539 </ul>
17540 </li>
17541 </ul>
17542 !! html/php
17543 <ul>
17544 <li>One</li>
17545 <li>Two:
17546 <ul>
17547 <li>Sub-one</li>
17548 <li>Sub-two</li>
17549 </ul>
17550 </li>
17551 </ul>
17552
17553 !! html/parsoid
17554 <ul data-parsoid='{"stx":"html"}'>
17555 <li data-parsoid='{"stx":"html"}'>One</li>
17556 <li data-parsoid='{"stx":"html"}'>Two:
17557 <ul data-parsoid='{"stx":"html"}'>
17558 <li data-parsoid='{"stx":"html"}'>Sub-one</li>
17559 <li data-parsoid='{"stx":"html"}'>Sub-two</li>
17560 </ul>
17561 </li>
17562 </ul>
17563 !! end
17564
17565 !! test
17566 HTML nested bullet list, open tags (T7497)
17567 !! wikitext
17568 <ul>
17569 <li>One
17570 <li>Two:
17571 <ul>
17572 <li>Sub-one
17573 <li>Sub-two
17574 </ul>
17575 </ul>
17576 !! html/php+tidy
17577 <ul>
17578 <li>One</li>
17579 <li>Two:
17580 <ul>
17581 <li>Sub-one</li>
17582 <li>Sub-two</li>
17583 </ul>
17584 </li>
17585 </ul>
17586 !! html/parsoid
17587 <ul>
17588 <li>One
17589 </li>
17590 <li>Two:
17591 <ul>
17592 <li>Sub-one
17593 </li>
17594 <li>Sub-two
17595 </li>
17596 </ul>
17597 </li>
17598 </ul>
17599
17600 !! end
17601
17602 !! test
17603 HTML nested ordered list, closed tags (T7497)
17604 !! wikitext
17605 <ol>
17606 <li>One</li>
17607 <li>Two:
17608 <ol>
17609 <li>Sub-one</li>
17610 <li>Sub-two</li>
17611 </ol>
17612 </li>
17613 </ol>
17614 !! html
17615 <ol>
17616 <li>One</li>
17617 <li>Two:
17618 <ol>
17619 <li>Sub-one</li>
17620 <li>Sub-two</li>
17621 </ol>
17622 </li>
17623 </ol>
17624
17625 !! end
17626
17627 !! test
17628 HTML nested ordered list, open tags (T7497)
17629 !! wikitext
17630 <ol>
17631 <li>One
17632 <li>Two:
17633 <ol>
17634 <li>Sub-one
17635 <li>Sub-two
17636 </ol>
17637 </ol>
17638 !! html/php
17639 <ol>
17640 <li>One
17641 <li>Two:
17642 <ol>
17643 <li>Sub-one
17644 <li>Sub-two
17645 </ol>
17646 </ol>
17647
17648 !! html/parsoid
17649 <ol>
17650 <li>One
17651 </li>
17652 <li>Two:
17653 <ol>
17654 <li>Sub-one
17655 </li>
17656 <li>Sub-two
17657 </li>
17658 </ol>
17659 </li>
17660 </ol>
17661
17662 !! end
17663
17664 !! test
17665 HTML ordered list item with parameters oddity
17666 !! wikitext
17667 <ol><li id="fragment">One</li>
17668 </ol>
17669 !! html
17670 <ol><li id="fragment">One</li>
17671 </ol>
17672
17673 !! end
17674
17675 # parsoid doesn't explicitly mark autonumbered links, see T55505
17676 !!test
17677 T7918: autonumbering
17678 !! wikitext
17679 [http://first/] [http://second] [ftp://ftp]
17680
17681 ftp://inlineftp
17682
17683 [mailto:enclosed@mail.tld With target]
17684
17685 [mailto:enclosed@mail.tld]
17686
17687 mailto:inline@mail.tld
17688 !! html/php
17689 <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>
17690 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
17691 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
17692 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
17693 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
17694 </p>
17695 !! html/parsoid
17696 <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>
17697 <p><a rel="mw:ExtLink" href="ftp://inlineftp">ftp://inlineftp</a></p>
17698 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld">With target</a></p>
17699 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld"></a></p>
17700 <p><a rel="mw:ExtLink" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a></p>
17701 !! end
17702
17703
17704 #
17705 # Security and HTML correctness
17706 # From Nick Jenkins' fuzz testing
17707 #
17708
17709 !! test
17710 Fuzz testing: Parser13
17711 !! wikitext
17712 {|
17713 | http://a|
17714 !! html
17715 <table>
17716 <tr>
17717 <td>
17718 </td>
17719 </tr>
17720 </table>
17721
17722 !! end
17723
17724 !! test
17725 Fuzz testing: Parser14
17726 !! wikitext
17727 == onmouseover= ==
17728 http://__TOC__
17729 !! html
17730 <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>
17731 http://<div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17732 <ul>
17733 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
17734 </ul>
17735 </div>
17736
17737
17738 !! html+tidy
17739 <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>
17740 <p>http://</p>
17741 <div id="toc" class="toc">
17742 <div id="toctitle">
17743 <h2>Contents</h2>
17744 </div>
17745 <ul>
17746 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
17747 </ul>
17748 </div>
17749 <p></p>
17750 !! end
17751
17752 !! test
17753 Fuzz testing: Parser14-table
17754 !! options
17755 parsoid=wt2html,html2html
17756 !! wikitext
17757 ==a==
17758 {| STYLE=__TOC__
17759 !! html
17760 <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>
17761 <table style="&#95;_TOC&#95;_">
17762 <tr><td></td></tr>
17763 </table>
17764
17765 !! html+tidy
17766 <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>
17767 <table style="__TOC__">
17768 <tr>
17769 <td></td>
17770 </tr>
17771 </table>
17772 !! html/parsoid
17773 <h2>a</h2>
17774 <table style="__TOC__"></table>
17775 !! end
17776
17777 # Known to produce bogus xml (extra </td>)
17778 !! test
17779 Fuzz testing: Parser16
17780 !! wikitext
17781 {|
17782 !https://||||||
17783 !! html
17784 <table>
17785 <tr>
17786 <th>https://</th>
17787 <th></th>
17788 <th></th>
17789 <th>
17790 </td>
17791 </tr>
17792 </table>
17793
17794 !! html+tidy
17795 <table>
17796 <tr>
17797 <th>https://</th>
17798 <th></th>
17799 <th></th>
17800 <th></th>
17801 </tr>
17802 </table>
17803 !! end
17804
17805 !! test
17806 Fuzz testing: Parser21
17807 !! wikitext
17808 {|
17809 ! irc://{{ftp://a" onmouseover="alert('hello world');"
17810 |
17811 !! html
17812 <table>
17813 <tr>
17814 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
17815 </th>
17816 <td>
17817 </td>
17818 </tr>
17819 </table>
17820
17821 !! end
17822
17823 !! test
17824 Fuzz testing: Parser22
17825 !! wikitext
17826 http://===r:::https://b
17827
17828 {|
17829 !! html
17830 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
17831 </p>
17832 <table>
17833 <tr><td></td></tr>
17834 </table>
17835
17836 !! end
17837
17838 # Known to produce bad XML for now
17839 !! test
17840 Fuzz testing: Parser24
17841 !! options
17842 parsoid=wt2html
17843 !! wikitext
17844 {|
17845 {{{|
17846 <u CLASS=
17847 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
17848 <br style="onmouseover='alert(document.cookie);' " />
17849
17850 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
17851 |
17852 !! html/php
17853 <table>
17854 {{{|
17855 <u class="&#124;">}}}} &gt;
17856 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
17857
17858 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
17859 <tr>
17860 <td></u>
17861 </td>
17862 </tr>
17863 </table>
17864
17865 !! html/parsoid
17866 <p data-parsoid='{"fostered":true,"autoInsertedEnd":true}'>{{{|
17867 <u class="|" about="#mwt2" typeof="mw:ExpandedAttrs" data-parsoid='{"stx":"html","a":{"{{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx-->&lt;noinclude>}}}}":null},"sa":{"{{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx-->&lt;noinclude>}}}}":""},"autoInsertedEnd":true}' data-mw='{"attribs":[[{"txt":"{{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx-->}}}}","html":"{&lt;span about=\"#mwt1\" typeof=\"mw:Param\" data-parsoid=&#39;{\"pi\":[[]],\"dsr\":[21,79,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"templatearg\":{\"target\":{\"wt\":\"SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx-->&amp;lt;noinclude>\"},\"params\":{},\"i\":0}}]}&#39;>{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx-->}}}&lt;/span>}"},{"html":""}]]}'>
17868 <br style="onmouseover='alert(document.cookie);' " data-parsoid='{"stx":"html","selfClose":true}'/></u></p><p data-parsoid='{"fostered":true,"autoInsertedEnd":true}'><u class="|" about="#mwt2" typeof="mw:ExpandedAttrs" data-parsoid='{"stx":"html","a":{"{{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx-->&lt;noinclude>}}}}":null},"sa":{"{{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx-->&lt;noinclude>}}}}":""},"autoInsertedEnd":true,"autoInsertedStart":true}' data-mw='{"attribs":[[{"txt":"{{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx-->}}}}","html":"{&lt;span about=\"#mwt1\" typeof=\"mw:Param\" data-parsoid=&#39;{\"pi\":[[]],\"dsr\":[21,79,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"templatearg\":{\"target\":{\"wt\":\"SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx-->&amp;lt;noinclude>\"},\"params\":{},\"i\":0}}]}&#39;>{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx-->}}}&lt;/span>}"},{"html":""}]]}'>MOVE YOUR MOUSE CURSOR OVER THIS TEXT</u></p><table data-parsoid='{"autoInsertedEnd":true}'>
17869
17870
17871
17872 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'></td></tr></tbody></table>
17873 !! end
17874
17875 # Note: the current result listed for this is not what the original one was,
17876 # but the original bug was JavaScript injection, which is fixed in any case.
17877 # It's not clear that the original result listed was any more correct than the
17878 # current one. Original result:
17879 # <p>{{{|
17880 # </p>
17881 # <li class="&#124;&#124;">
17882 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
17883 !!test
17884 Fuzz testing: Parser25 (T8055)
17885 !! wikitext
17886 {{{
17887 |
17888 <LI CLASS=||
17889 >
17890 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
17891 !! html/php
17892 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
17893 </p>
17894 !! html/parsoid
17895 <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"]}'>
17896 </span><p about="#mwt1">&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b></p>
17897 !! end
17898
17899 !!test
17900 Fuzz testing: URL adjacent extension (with space, clean)
17901 !! wikitext
17902 http://example.com <nowiki>junk</nowiki>
17903 !! html/php
17904 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
17905 </p>
17906 !! html/parsoid
17907 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a> <span typeof="mw:Nowiki">junk</span></p>
17908 !! end
17909
17910 !!test
17911 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
17912 !! wikitext
17913 http://example.com<nowiki>junk</nowiki>
17914 !! html/php
17915 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
17916 </p>
17917 !! html/parsoid
17918 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a><span typeof="mw:Nowiki">junk</span></p>
17919 !! end
17920
17921 !!test
17922 Fuzz testing: URL adjacent extension (no space, dirty; pre)
17923 !! wikitext
17924 http://example.com<pre>junk</pre>
17925 !! html/php
17926 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
17927
17928 !! html/php+tidy
17929 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></p>
17930 <pre>
17931 junk
17932 </pre>
17933 !! html/parsoid
17934 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a></p><pre data-parsoid='{"stx":"html"}'>junk</pre>
17935 !!end
17936
17937 !!test
17938 Fuzz testing: image with bogus manual thumbnail
17939 !! wikitext
17940 [[Image:foobar.jpg|thumbnail= ]]
17941 !! html/php
17942 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
17943
17944 !! html/parsoid
17945 <figure class="mw-default-size" typeof="mw:Error mw:Image/Thumb" data-parsoid='{"optList":[{"ck":"manualthumb","ak":"thumbnail= "}]}' data-mw='{"errors":[{"key":"missing-thumbnail","message":"This thumbnail does not exist.","params":{"name":""}}],"thumb":""}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="./Special:FilePath/" height="220" width="220" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"220"},"sa":{"resource":"Image:foobar.jpg"}}'/></a></figure>
17946 !!end
17947
17948 !! test
17949 Fuzz testing: encoded newline in generated HTML replacements (T8577)
17950 !! wikitext
17951 <pre dir="&#10;"></pre>
17952 !! html
17953 <pre dir="&#10;"></pre>
17954
17955 !! end
17956
17957 !! test
17958 Parsing optional HTML elements (T8171)
17959 !! options
17960 !! wikitext
17961 <table>
17962 <tr>
17963 <td> Some tabular data</td>
17964 <td> More tabular data ...
17965 <td> And yet som tabular data</td>
17966 </tr>
17967 </table>
17968 !! html
17969 <table>
17970 <tr>
17971 <td> Some tabular data</td>
17972 <td> More tabular data ...
17973 </td><td> And yet som tabular data</td>
17974 </tr>
17975 </table>
17976
17977 !! end
17978
17979 !! test
17980 Correct handling of <td>, <tr> (T8171)
17981 !! options
17982 !! wikitext
17983 <table>
17984 <tr>
17985 <td> Some tabular data</td>
17986 <td> More tabular data ...</td>
17987 <td> And yet som tabular data</td>
17988 </tr>
17989 </table>
17990 !! html
17991 <table>
17992 <tr>
17993 <td> Some tabular data</td>
17994 <td> More tabular data ...</td>
17995 <td> And yet som tabular data</td>
17996 </tr>
17997 </table>
17998
17999 !! end
18000
18001
18002 !! test
18003 Parsing crashing regression (fr:JavaScript)
18004 !! wikitext
18005 </body></x>
18006 !! html
18007 <p>&lt;/body&gt;&lt;/x&gt;
18008 </p>
18009 !! end
18010
18011 !! test
18012 Inline wiki vs wiki block nesting
18013 !! wikitext
18014 '''Bold paragraph
18015
18016 New wiki paragraph
18017 !! html
18018 <p><b>Bold paragraph</b>
18019 </p><p>New wiki paragraph
18020 </p>
18021 !! end
18022
18023 # FIXME: The current php output is documented
18024 # and desired output is the parsoid target.
18025 !! test
18026 Inline HTML vs wiki block nesting
18027 !! wikitext
18028 <b>Bold paragraph
18029
18030 New wiki paragraph
18031 !! html/php
18032 <p><b>Bold paragraph
18033 </p><p>New wiki paragraph</b>
18034 </p>
18035 !! html/parsoid
18036 <p><b>Bold paragraph</b>
18037 </p><p>New wiki paragraph
18038 </p>
18039 !! end
18040
18041 # Original result was this:
18042 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
18043 # </p>
18044 # While that might be marginally more intuitive, maybe, the six-apostrophe
18045 # construct is clearly pathological and the result stated here (which is what
18046 # the parser actually does) is about as reasonable as anything.
18047 !!test
18048 Mixing markup for italics and bold
18049 !! options
18050 !! wikitext
18051 '''bold''''''bold''bolditalics'''''
18052 !! html
18053 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
18054 </p>
18055 !! end
18056
18057
18058 !! article
18059 Xyzzyx
18060 !! text
18061 Article for special page transclusion test
18062 !! endarticle
18063
18064 !! test
18065 Special page transclusion
18066 !! options
18067 !! wikitext
18068 {{Special:Prefixindex/Xyzzyx}}
18069 !! html
18070 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
18071 </ul>
18072
18073 !! end
18074
18075 !! test
18076 Special page transclusion twice (T7021)
18077 !! options
18078 !! wikitext
18079 {{Special:Prefixindex/Xyzzyx}}
18080 {{Special:Prefixindex/Xyzzyx}}
18081 !! html
18082 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
18083 </ul>
18084 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
18085 </ul>
18086
18087 !! end
18088
18089 !! test
18090 Transclusion of default MediaWiki message
18091 !! wikitext
18092 {{MediaWiki:Mainpage}}
18093 !! html
18094 <p>Main Page
18095 </p>
18096 !! end
18097
18098 !! test
18099 Transclusion of nonexistent MediaWiki message
18100 !! wikitext
18101 {{MediaWiki:Mainpagexxx}}
18102 !! html
18103 <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>
18104 </p>
18105 !! end
18106
18107 !! test
18108 Transclusion of MediaWiki message with underscore
18109 !! wikitext
18110 {{MediaWiki:history_short}}
18111 !! html
18112 <p>History
18113 </p>
18114 !! end
18115
18116 !! test
18117 Transclusion of MediaWiki message with space
18118 !! wikitext
18119 {{MediaWiki:history short}}
18120 !! html
18121 <p>History
18122 </p>
18123 !! end
18124
18125 !! test
18126 Invalid header with following text
18127 !! wikitext
18128 = x = y
18129 !! html
18130 <p>= x = y
18131 </p>
18132 !! end
18133
18134
18135 !! test
18136 Section extraction test (section 0)
18137 !! options
18138 section=0
18139 !! wikitext
18140 start
18141 ==a==
18142 ===aa===
18143 ====aaa====
18144 ==b==
18145 ===ba===
18146 ===bb===
18147 ====bba====
18148 ===bc===
18149 ==c==
18150 ===ca===
18151 !! html/php
18152 start
18153 !! end
18154
18155 !! test
18156 Section extraction test (section 1)
18157 !! options
18158 section=1
18159 !! wikitext
18160 start
18161 ==a==
18162 ===aa===
18163 ====aaa====
18164 ==b==
18165 ===ba===
18166 ===bb===
18167 ====bba====
18168 ===bc===
18169 ==c==
18170 ===ca===
18171 !! html/php
18172 ==a==
18173 ===aa===
18174 ====aaa====
18175 !! end
18176
18177 !! test
18178 Section extraction test (section 2)
18179 !! options
18180 section=2
18181 !! wikitext
18182 start
18183 ==a==
18184 ===aa===
18185 ====aaa====
18186 ==b==
18187 ===ba===
18188 ===bb===
18189 ====bba====
18190 ===bc===
18191 ==c==
18192 ===ca===
18193 !! html/php
18194 ===aa===
18195 ====aaa====
18196 !! end
18197
18198 !! test
18199 Section extraction test (section 3)
18200 !! options
18201 section=3
18202 !! wikitext
18203 start
18204 ==a==
18205 ===aa===
18206 ====aaa====
18207 ==b==
18208 ===ba===
18209 ===bb===
18210 ====bba====
18211 ===bc===
18212 ==c==
18213 ===ca===
18214 !! html/php
18215 ====aaa====
18216 !! end
18217
18218 !! test
18219 Section extraction test (section 4)
18220 !! options
18221 section=4
18222 !! wikitext
18223 start
18224 ==a==
18225 ===aa===
18226 ====aaa====
18227 ==b==
18228 ===ba===
18229 ===bb===
18230 ====bba====
18231 ===bc===
18232 ==c==
18233 ===ca===
18234 !! html/php
18235 ==b==
18236 ===ba===
18237 ===bb===
18238 ====bba====
18239 ===bc===
18240 !! end
18241
18242 !! test
18243 Section extraction test (section 5)
18244 !! options
18245 section=5
18246 !! wikitext
18247 start
18248 ==a==
18249 ===aa===
18250 ====aaa====
18251 ==b==
18252 ===ba===
18253 ===bb===
18254 ====bba====
18255 ===bc===
18256 ==c==
18257 ===ca===
18258 !! html/php
18259 ===ba===
18260 !! end
18261
18262 !! test
18263 Section extraction test (section 6)
18264 !! options
18265 section=6
18266 !! wikitext
18267 start
18268 ==a==
18269 ===aa===
18270 ====aaa====
18271 ==b==
18272 ===ba===
18273 ===bb===
18274 ====bba====
18275 ===bc===
18276 ==c==
18277 ===ca===
18278 !! html/php
18279 ===bb===
18280 ====bba====
18281 !! end
18282
18283 !! test
18284 Section extraction test (section 7)
18285 !! options
18286 section=7
18287 !! wikitext
18288 start
18289 ==a==
18290 ===aa===
18291 ====aaa====
18292 ==b==
18293 ===ba===
18294 ===bb===
18295 ====bba====
18296 ===bc===
18297 ==c==
18298 ===ca===
18299 !! html/php
18300 ====bba====
18301 !! end
18302
18303 !! test
18304 Section extraction test (section 8)
18305 !! options
18306 section=8
18307 !! wikitext
18308 start
18309 ==a==
18310 ===aa===
18311 ====aaa====
18312 ==b==
18313 ===ba===
18314 ===bb===
18315 ====bba====
18316 ===bc===
18317 ==c==
18318 ===ca===
18319 !! html/php
18320 ===bc===
18321 !! end
18322
18323 !! test
18324 Section extraction test (section 9)
18325 !! options
18326 section=9
18327 !! wikitext
18328 start
18329 ==a==
18330 ===aa===
18331 ====aaa====
18332 ==b==
18333 ===ba===
18334 ===bb===
18335 ====bba====
18336 ===bc===
18337 ==c==
18338 ===ca===
18339 !! html/php
18340 ==c==
18341 ===ca===
18342 !! end
18343
18344 !! test
18345 Section extraction test (section 10)
18346 !! options
18347 section=10
18348 !! wikitext
18349 start
18350 ==a==
18351 ===aa===
18352 ====aaa====
18353 ==b==
18354 ===ba===
18355 ===bb===
18356 ====bba====
18357 ===bc===
18358 ==c==
18359 ===ca===
18360 !! html/php
18361 ===ca===
18362 !! end
18363
18364 !! test
18365 Section extraction test (nonexistent section 11)
18366 !! options
18367 section=11
18368 !! wikitext
18369 start
18370 ==a==
18371 ===aa===
18372 ====aaa====
18373 ==b==
18374 ===ba===
18375 ===bb===
18376 ====bba====
18377 ===bc===
18378 ==c==
18379 ===ca===
18380 !! html/php
18381 !! end
18382
18383 !! test
18384 Section extraction test with bogus heading (section 1)
18385 !! options
18386 section=1
18387 !! wikitext
18388 ==a==
18389 ==bogus== not a legal section
18390 ==b==
18391 !! html/php
18392 ==a==
18393 ==bogus== not a legal section
18394 !! end
18395
18396 !! test
18397 Section extraction test with bogus heading (section 2)
18398 !! options
18399 section=2
18400 !! wikitext
18401 ==a==
18402 ==bogus== not a legal section
18403 ==b==
18404 !! html/php
18405 ==b==
18406 !! end
18407
18408 !! test
18409 Section extraction test with comment after heading (section 1)
18410 !! options
18411 section=1
18412 !! wikitext
18413 ==a==
18414 ==b== <!-- -->
18415 ==c==
18416 !! html/php
18417 ==a==
18418 !! end
18419
18420 !! test
18421 Section extraction test with comment after heading (section 2)
18422 !! options
18423 section=2
18424 !! wikitext
18425 ==a==
18426 ==b== <!-- -->
18427 ==c==
18428 !! html/php
18429 ==b== <!-- -->
18430 !! end
18431
18432 !! test
18433 Section extraction test with bogus <nowiki> heading (section 1)
18434 !! options
18435 section=1
18436 !! wikitext
18437 ==a==
18438 ==bogus== <nowiki>not a legal section</nowiki>
18439 ==b==
18440 !! html/php
18441 ==a==
18442 ==bogus== <nowiki>not a legal section</nowiki>
18443 !! end
18444
18445 !! test
18446 Section extraction test with bogus <nowiki> heading (section 2)
18447 !! options
18448 section=2
18449 !! wikitext
18450 ==a==
18451 ==bogus== <nowiki>not a legal section</nowiki>
18452 ==b==
18453 !! html/php
18454 ==b==
18455 !! end
18456
18457 # Formerly testing for T4587, now resolved by the use of unmarked sections
18458 # instead of respecting commented sections
18459 !! test
18460 Section extraction prefixed by comment (section 1)
18461 !! options
18462 section=1
18463 !! wikitext
18464 <!-- -->==sec1==
18465 ==sec2==
18466 !! html/php
18467 ==sec2==
18468 !!end
18469
18470 !! test
18471 Section extraction prefixed by comment (section 2)
18472 !! options
18473 section=2
18474 !! wikitext
18475 <!-- -->==sec1==
18476 ==sec2==
18477 !! html/php
18478
18479 !!end
18480
18481 # Formerly testing for T4607, now resolved by the use of unmarked sections
18482 # instead of respecting HTML-style headings
18483 !! test
18484 Section extraction, mixed wiki and html (section 1)
18485 !! options
18486 section=1
18487 !! wikitext
18488 <h2>unmarked</h2>
18489 unmarked
18490 ==1==
18491 one
18492 ==2==
18493 two
18494 !! html/php
18495 ==1==
18496 one
18497 !! end
18498
18499 !! test
18500 Section extraction, mixed wiki and html (section 2)
18501 !! options
18502 section=2
18503 !! wikitext
18504 <h2>unmarked</h2>
18505 unmarked
18506 ==1==
18507 one
18508 ==2==
18509 two
18510 !! html/php
18511 ==2==
18512 two
18513 !! end
18514
18515
18516 # Formerly testing for T5342
18517 !! test
18518 Section extraction, heading surrounded by <noinclude>
18519 !! options
18520 section=1
18521 !! wikitext
18522 <noinclude>==unmarked==</noinclude>
18523 ==marked==
18524 !! html/php
18525 ==marked==
18526 !!end
18527
18528 # Test behavior of T21910
18529 !! test
18530 Sectiion with all-equals
18531 !! options
18532 section=2
18533 !! wikitext
18534 ===
18535 The line above must have a trailing space
18536 === <!--
18537 --> <!-- -->
18538 But just in case it doesn't...
18539 !! html/php
18540 === <!--
18541 --> <!-- -->
18542 But just in case it doesn't...
18543 !! end
18544
18545 !! test
18546 Section replacement test (section 0)
18547 !! options
18548 replace=0,"xxx"
18549 !! wikitext
18550 start
18551 ==a==
18552 ===aa===
18553 ====aaa====
18554 ==b==
18555 ===ba===
18556 ===bb===
18557 ====bba====
18558 ===bc===
18559 ==c==
18560 ===ca===
18561 !! html/php
18562 xxx
18563
18564 ==a==
18565 ===aa===
18566 ====aaa====
18567 ==b==
18568 ===ba===
18569 ===bb===
18570 ====bba====
18571 ===bc===
18572 ==c==
18573 ===ca===
18574 !! end
18575
18576 !! test
18577 Section replacement test (section 1)
18578 !! options
18579 replace=1,"xxx"
18580 !! wikitext
18581 start
18582 ==a==
18583 ===aa===
18584 ====aaa====
18585 ==b==
18586 ===ba===
18587 ===bb===
18588 ====bba====
18589 ===bc===
18590 ==c==
18591 ===ca===
18592 !! html/php
18593 start
18594 xxx
18595
18596 ==b==
18597 ===ba===
18598 ===bb===
18599 ====bba====
18600 ===bc===
18601 ==c==
18602 ===ca===
18603 !! end
18604
18605 !! test
18606 Section replacement test (section 2)
18607 !! options
18608 replace=2,"xxx"
18609 !! wikitext
18610 start
18611 ==a==
18612 ===aa===
18613 ====aaa====
18614 ==b==
18615 ===ba===
18616 ===bb===
18617 ====bba====
18618 ===bc===
18619 ==c==
18620 ===ca===
18621 !! html/php
18622 start
18623 ==a==
18624 xxx
18625
18626 ==b==
18627 ===ba===
18628 ===bb===
18629 ====bba====
18630 ===bc===
18631 ==c==
18632 ===ca===
18633 !! end
18634
18635 !! test
18636 Section replacement test (section 3)
18637 !! options
18638 replace=3,"xxx"
18639 !! wikitext
18640 start
18641 ==a==
18642 ===aa===
18643 ====aaa====
18644 ==b==
18645 ===ba===
18646 ===bb===
18647 ====bba====
18648 ===bc===
18649 ==c==
18650 ===ca===
18651 !! html/php
18652 start
18653 ==a==
18654 ===aa===
18655 xxx
18656
18657 ==b==
18658 ===ba===
18659 ===bb===
18660 ====bba====
18661 ===bc===
18662 ==c==
18663 ===ca===
18664 !! end
18665
18666 !! test
18667 Section replacement test (section 4)
18668 !! options
18669 replace=4,"xxx"
18670 !! wikitext
18671 start
18672 ==a==
18673 ===aa===
18674 ====aaa====
18675 ==b==
18676 ===ba===
18677 ===bb===
18678 ====bba====
18679 ===bc===
18680 ==c==
18681 ===ca===
18682 !! html/php
18683 start
18684 ==a==
18685 ===aa===
18686 ====aaa====
18687 xxx
18688
18689 ==c==
18690 ===ca===
18691 !! end
18692
18693 !! test
18694 Section replacement test (section 5)
18695 !! options
18696 replace=5,"xxx"
18697 !! wikitext
18698 start
18699 ==a==
18700 ===aa===
18701 ====aaa====
18702 ==b==
18703 ===ba===
18704 ===bb===
18705 ====bba====
18706 ===bc===
18707 ==c==
18708 ===ca===
18709 !! html/php
18710 start
18711 ==a==
18712 ===aa===
18713 ====aaa====
18714 ==b==
18715 xxx
18716
18717 ===bb===
18718 ====bba====
18719 ===bc===
18720 ==c==
18721 ===ca===
18722 !! end
18723
18724 !! test
18725 Section replacement test (section 6)
18726 !! options
18727 replace=6,"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 start
18742 ==a==
18743 ===aa===
18744 ====aaa====
18745 ==b==
18746 ===ba===
18747 xxx
18748
18749 ===bc===
18750 ==c==
18751 ===ca===
18752 !! end
18753
18754 !! test
18755 Section replacement test (section 7)
18756 !! options
18757 replace=7,"xxx"
18758 !! wikitext
18759 start
18760 ==a==
18761 ===aa===
18762 ====aaa====
18763 ==b==
18764 ===ba===
18765 ===bb===
18766 ====bba====
18767 ===bc===
18768 ==c==
18769 ===ca===
18770 !! html/php
18771 start
18772 ==a==
18773 ===aa===
18774 ====aaa====
18775 ==b==
18776 ===ba===
18777 ===bb===
18778 xxx
18779
18780 ===bc===
18781 ==c==
18782 ===ca===
18783 !! end
18784
18785 !! test
18786 Section replacement test (section 8)
18787 !! options
18788 replace=8,"xxx"
18789 !! wikitext
18790 start
18791 ==a==
18792 ===aa===
18793 ====aaa====
18794 ==b==
18795 ===ba===
18796 ===bb===
18797 ====bba====
18798 ===bc===
18799 ==c==
18800 ===ca===
18801 !! html/php
18802 start
18803 ==a==
18804 ===aa===
18805 ====aaa====
18806 ==b==
18807 ===ba===
18808 ===bb===
18809 ====bba====
18810 xxx
18811
18812 ==c==
18813 ===ca===
18814 !!end
18815
18816 !! test
18817 Section replacement test (section 9)
18818 !! options
18819 replace=9,"xxx"
18820 !! wikitext
18821 start
18822 ==a==
18823 ===aa===
18824 ====aaa====
18825 ==b==
18826 ===ba===
18827 ===bb===
18828 ====bba====
18829 ===bc===
18830 ==c==
18831 ===ca===
18832 !! html/php
18833 start
18834 ==a==
18835 ===aa===
18836 ====aaa====
18837 ==b==
18838 ===ba===
18839 ===bb===
18840 ====bba====
18841 ===bc===
18842 xxx
18843 !! end
18844
18845 !! test
18846 Section replacement test (section 10)
18847 !! options
18848 replace=10,"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 ==b==
18867 ===ba===
18868 ===bb===
18869 ====bba====
18870 ===bc===
18871 ==c==
18872 xxx
18873 !! end
18874
18875 !! test
18876 Section replacement test with initial whitespace (T15728)
18877 !! options
18878 replace=2,"xxx"
18879 !! wikitext
18880 Preformatted initial line
18881 ==a==
18882 ===a===
18883 !! html/php
18884 Preformatted initial line
18885 ==a==
18886 xxx
18887 !! end
18888
18889
18890 !! test
18891 Section extraction, heading followed by pre with 20 spaces (T8398)
18892 !! options
18893 section=1
18894 !! wikitext
18895 ==a==
18896 a
18897 !! html/php
18898 ==a==
18899 a
18900 !! end
18901
18902 !! test
18903 Section extraction, heading followed by pre with 19 spaces (T8398 sanity check)
18904 !! options
18905 section=1
18906 !! wikitext
18907 ==a==
18908 a
18909 !! html/php
18910 ==a==
18911 a
18912 !! end
18913
18914
18915 !! test
18916 Section extraction, <pre> around bogus header (T12309)
18917 !! options
18918 section=2
18919 !! wikitext
18920 == Section One ==
18921 <pre>
18922 =======
18923 </pre>
18924
18925 == Section Two ==
18926 stuff
18927 !! html/php
18928 == Section Two ==
18929 stuff
18930 !! end
18931
18932 !! test
18933 Section replacement, <pre> around bogus header (T12309)
18934 !! options
18935 replace=2,"xxx"
18936 !! wikitext
18937 == Section One ==
18938 <pre>
18939 =======
18940 </pre>
18941
18942 == Section Two ==
18943 stuff
18944 !! html/php
18945 == Section One ==
18946 <pre>
18947 =======
18948 </pre>
18949
18950 xxx
18951 !! end
18952
18953 !! test
18954 Handling of &#x0A; in URLs
18955 !! wikitext
18956 ** irc://&#x0A;a
18957 !! html/php
18958 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
18959
18960 !! html/parsoid
18961 <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>
18962 !! end
18963
18964 !! test
18965 Handling of %0A in URLs
18966 !! wikitext
18967 ** irc://%0Aa
18968 !! html/php
18969 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
18970
18971 !! html/parsoid
18972 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
18973 !! end
18974
18975 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
18976 !! test
18977 5 quotes, code coverage +1 line
18978 !! options
18979 parsoid=wt2html
18980 !! wikitext
18981 '''''
18982 !! html/php
18983 !! html/parsoid
18984 <p><b><i></i></b></p>
18985 !! end
18986
18987 # same html as previous, but wikitext adjusted to match parsoid html2wt
18988 # note that wt2html and html2html will put the <i> before the <b>
18989 !! test
18990 5 quotes, code coverage +1 line w/ nowiki (1)
18991 !! options
18992 parsoid=wt2wt,html2wt
18993 !! wikitext
18994 '''''<nowiki/>'''''
18995 !! html/php
18996 <p><i></i>
18997 </p>
18998 !! html/parsoid
18999 <p><b><i></i></b></p>
19000 !! end
19001
19002 # same as previous, just swapping the <i> and <b>
19003 !! test
19004 5 quotes, code coverage +1 line w/ nowiki (2)
19005 !! wikitext
19006 '''''<nowiki/>'''''
19007 !! html/php
19008 <p><i></i>
19009 </p>
19010 !! html/parsoid
19011 <p><i><b></b></i></p>
19012 !! end
19013
19014 !! test
19015 Special:Search page linking.
19016 !! wikitext
19017 {{Special:search}}
19018 !! html
19019 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
19020 </p>
19021 !! end
19022
19023 !! test
19024 {{!}} is a magic word
19025 !! wikitext
19026 {{!}} is a magic word there and {{!}} is still a magic word here
19027 | is not a magic word here but {{!}} is still a magic word here
19028 !! html/php
19029 <p>| is a magic word there and | is still a magic word here
19030 | is not a magic word here but | is still a magic word here
19031 </p>
19032 !! html/parsoid
19033 <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
19034 | 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>
19035
19036 !! end
19037
19038 !! test
19039 Say the magic word
19040 !! options
19041 title=[[Parser test]]
19042 !! wikitext
19043 * {{PAGENAME}}
19044 * {{PAGENAMEE}}
19045 * {{FULLPAGENAME}}
19046 * {{FULLPAGENAMEE}}
19047 * {{BASEPAGENAME}}
19048 * {{BASEPAGENAMEE}}
19049 * {{SUBPAGENAME}}
19050 * {{SUBPAGENAMEE}}
19051 * {{ROOTPAGENAME}}
19052 * {{ROOTPAGENAMEE}}
19053 * {{TALKPAGENAME}}
19054 * {{TALKPAGENAMEE}}
19055 * {{SUBJECTPAGENAME}}
19056 * {{SUBJECTPAGENAMEE}}
19057 * {{NAMESPACEE}}
19058 * {{NAMESPACE}}
19059 * {{NAMESPACENUMBER}}
19060 * {{TALKSPACE}}
19061 * {{TALKSPACEE}}
19062 * {{SUBJECTSPACE}}
19063 * {{SUBJECTSPACEE}}
19064 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
19065 !! html
19066 <ul><li> Parser test</li>
19067 <li> Parser_test</li>
19068 <li> Parser test</li>
19069 <li> Parser_test</li>
19070 <li> Parser test</li>
19071 <li> Parser_test</li>
19072 <li> Parser test</li>
19073 <li> Parser_test</li>
19074 <li> Parser test</li>
19075 <li> Parser_test</li>
19076 <li> Talk:Parser test</li>
19077 <li> Talk:Parser_test</li>
19078 <li> Parser test</li>
19079 <li> Parser_test</li>
19080 <li> </li>
19081 <li> </li>
19082 <li> 0</li>
19083 <li> Talk</li>
19084 <li> Talk</li>
19085 <li> </li>
19086 <li> </li>
19087 <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>
19088
19089 !! end
19090 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
19091
19092 ## Parsoid thinks the "centre" here is a property, not a caption.
19093 !! test
19094 Gallery
19095 !! options
19096 parsoid={
19097 "modes": ["wt2html"],
19098 "nativeGallery": true
19099 }
19100 !! wikitext
19101 <gallery>
19102 image1.png |
19103 image2.gif|||||
19104
19105 image3|
19106 image4 |300px| centre
19107 image5.svg| http://///////
19108 [[x|xx]]]]
19109 * image6
19110 </gallery>
19111 !! html/php
19112 <ul class="gallery mw-gallery-traditional">
19113 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19114 <div class="thumb" style="height: 150px;">Image1.png</div>
19115 <div class="gallerytext">
19116 </div>
19117 </div></li>
19118 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19119 <div class="thumb" style="height: 150px;">Image2.gif</div>
19120 <div class="gallerytext">
19121 </div>
19122 </div></li>
19123 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19124 <div class="thumb" style="height: 150px;">Image3</div>
19125 <div class="gallerytext">
19126 </div>
19127 </div></li>
19128 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19129 <div class="thumb" style="height: 150px;">Image4</div>
19130 <div class="gallerytext">
19131 <pre>centre
19132 </pre>
19133 </div>
19134 </div></li>
19135 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19136 <div class="thumb" style="height: 150px;">Image5.svg</div>
19137 <div class="gallerytext">
19138 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
19139 </p>
19140 </div>
19141 </div></li>
19142 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19143 <div class="thumb" style="height: 150px;">* image6</div>
19144 <div class="gallerytext">
19145 </div>
19146 </div></li>
19147 </ul>
19148
19149 !! html/parsoid
19150 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt3" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
19151 <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>
19152 <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>
19153 <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>
19154 <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>
19155 <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>
19156 <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>
19157 </ul>
19158 !! end
19159
19160 !! test
19161 Gallery (with options, html)
19162 !! options
19163 parsoid={
19164 "modes": ["wt2html", "html2html"],
19165 "nativeGallery": true
19166 }
19167 !! wikitext
19168 <gallery widths="70px" heights="40px" perrow="2" caption="Foo [[Main Page]]">
19169 File:Nonexistent.jpg|caption
19170 File:Nonexistent.jpg
19171 image:foobar.jpg|some '''caption''' [[Main Page]]
19172 image:foobar.jpg
19173 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
19174 </gallery>
19175 !! html/php
19176 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
19177 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
19178 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19179 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
19180 <div class="gallerytext">
19181 <p>caption
19182 </p>
19183 </div>
19184 </div></li>
19185 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19186 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
19187 <div class="gallerytext">
19188 </div>
19189 </div></li>
19190 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19191 <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>
19192 <div class="gallerytext">
19193 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
19194 </p>
19195 </div>
19196 </div></li>
19197 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19198 <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>
19199 <div class="gallerytext">
19200 </div>
19201 </div></li>
19202 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19203 <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>
19204 <div class="gallerytext">
19205 <p>blabla.
19206 </p>
19207 </div>
19208 </div></li>
19209 </ul>
19210
19211 !! html/parsoid
19212 <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":{}}'>
19213 <li class="gallerycaption">Foo <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a></li>
19214 <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>
19215 <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>
19216 <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>
19217 <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>
19218 <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>
19219 </ul>
19220 !! end
19221
19222 !! test
19223 Gallery (with options, extsrc)
19224 !! options
19225 parsoid={
19226 "nativeGallery": false
19227 }
19228 !! wikitext
19229 <gallery widths="70px" heights="40px" perrow="2" caption="Foo [[Main Page]]">
19230 File:Nonexistent.jpg|caption
19231 File:Nonexistent.jpg
19232 image:foobar.jpg|some '''caption''' [[Main Page]]
19233 image:foobar.jpg
19234 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
19235 </gallery>
19236 !! html/php
19237 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
19238 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
19239 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19240 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
19241 <div class="gallerytext">
19242 <p>caption
19243 </p>
19244 </div>
19245 </div></li>
19246 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19247 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
19248 <div class="gallerytext">
19249 </div>
19250 </div></li>
19251 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19252 <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>
19253 <div class="gallerytext">
19254 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
19255 </p>
19256 </div>
19257 </div></li>
19258 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19259 <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>
19260 <div class="gallerytext">
19261 </div>
19262 </div></li>
19263 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19264 <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>
19265 <div class="gallerytext">
19266 <p>blabla.
19267 </p>
19268 </div>
19269 </div></li>
19270 </ul>
19271
19272 !! html/parsoid
19273 <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"}}'>
19274 <li class="gallerycaption">Foo <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a></li>
19275 <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>
19276 <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>
19277 <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>
19278 <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>
19279 <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>
19280 </ul>
19281 !! end
19282
19283 !! test
19284 Gallery with link that has fragment
19285 !! options
19286 parsoid={
19287 "modes": ["wt2html", "html2html"],
19288 "nativeGallery": true
19289 }
19290 !! wikitext
19291 <gallery>
19292 image:foobar.jpg|link=Main_Page
19293 image:foobar.jpg|link=Main_Page#section
19294 image:foobar.jpg|link=Main Page#section|caption
19295 </gallery>
19296 !! html/php
19297 <ul class="gallery mw-gallery-traditional">
19298 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19299 <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>
19300 <div class="gallerytext">
19301 </div>
19302 </div></li>
19303 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19304 <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>
19305 <div class="gallerytext">
19306 </div>
19307 </div></li>
19308 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19309 <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>
19310 <div class="gallerytext">
19311 <p>caption
19312 </p>
19313 </div>
19314 </div></li>
19315 </ul>
19316
19317 !! html/parsoid
19318 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
19319 <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>
19320 <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>
19321 <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>
19322 </ul>
19323 !! end
19324
19325 ## Whoops, Parsoid shouldn't be parsing templates in the attribute caption!
19326 !! test
19327 Gallery with template inside caption
19328 !! options
19329 parsoid={
19330 "nativeGallery": true
19331 }
19332 !! wikitext
19333 <gallery caption="{{echo|hi}}">
19334 File:Foobar.jpg|{{echo|ho}}
19335 </gallery>
19336 !! html/php
19337 <ul class="gallery mw-gallery-traditional">
19338 <li class='gallerycaption'>{{echo|hi}}</li>
19339 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19340 <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>
19341 <div class="gallerytext">
19342 <p>ho
19343 </p>
19344 </div>
19345 </div></li>
19346 </ul>
19347
19348 !! html/parsoid
19349 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt6" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
19350 <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>
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 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>
19352 </ul>
19353 !! end
19354
19355 !! test
19356 Gallery with wikitext inside caption
19357 !! options
19358 parsoid={
19359 "nativeGallery": true
19360 }
19361 !! wikitext
19362 <gallery>
19363 File:Foobar.jpg|alt=galleryalt|[[File:Foobar.jpg|alt=inneralt|20x20px|desc]]
19364 File:Foobar.jpg|alt=galleryalt|{{Test|unamedParam|alt=param}}
19365 </gallery>
19366 !! html/php
19367 <ul class="gallery mw-gallery-traditional">
19368 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19369 <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>
19370 <div class="gallerytext">
19371 <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>
19372 </p>
19373 </div>
19374 </div></li>
19375 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19376 <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>
19377 <div class="gallerytext">
19378 <p>This is a test template
19379 </p>
19380 </div>
19381 </div></li>
19382 </ul>
19383
19384 !! html/parsoid
19385 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt6" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
19386 <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>
19387 <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>
19388 </ul>
19389 !! end
19390
19391 !! test
19392 Gallery (with showfilename option)
19393 !! options
19394 parsoid={
19395 "nativeGallery": true
19396 }
19397 !! wikitext
19398 <gallery showfilename="">
19399 File:Nonexistent.jpg|caption
19400 File:Nonexistent.jpg
19401 File:Foobar.jpg|some '''caption''' [[Main Page]]
19402 File:Foobar.jpg
19403 </gallery>
19404 !! html/php
19405 <ul class="gallery mw-gallery-traditional">
19406 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19407 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
19408 <div class="gallerytext">
19409 <p><a href="/wiki/File:Nonexistent.jpg" class="galleryfilename galleryfilename-truncate" title="File:Nonexistent.jpg">Nonexistent.jpg</a>
19410 caption
19411 </p>
19412 </div>
19413 </div></li>
19414 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19415 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
19416 <div class="gallerytext">
19417 <p><a href="/wiki/File:Nonexistent.jpg" class="galleryfilename galleryfilename-truncate" title="File:Nonexistent.jpg">Nonexistent.jpg</a>
19418 </p>
19419 </div>
19420 </div></li>
19421 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19422 <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>
19423 <div class="gallerytext">
19424 <p><a href="/wiki/File:Foobar.jpg" class="galleryfilename galleryfilename-truncate" title="File:Foobar.jpg">Foobar.jpg</a>
19425 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
19426 </p>
19427 </div>
19428 </div></li>
19429 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19430 <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>
19431 <div class="gallerytext">
19432 <p><a href="/wiki/File:Foobar.jpg" class="galleryfilename galleryfilename-truncate" title="File:Foobar.jpg">Foobar.jpg</a>
19433 </p>
19434 </div>
19435 </div></li>
19436 </ul>
19437
19438 !! html/parsoid
19439 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt3" data-mw='{"name":"gallery","attrs":{"showfilename":""},"body":{}}'>
19440 <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>
19441 <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>
19442 <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>
19443 <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>
19444 </ul>
19445 !! end
19446
19447 ## Should Parsoid be preserving these variations?
19448 !! test
19449 Gallery (with namespace-less filenames)
19450 !! options
19451 parsoid={
19452 "modes": ["wt2html", "html2html"],
19453 "nativeGallery": true
19454 }
19455 !! wikitext
19456 <gallery>
19457 File:Nonexistent.jpg
19458 Nonexistent.jpg
19459 image:foobar.jpg
19460 foobar.jpg
19461 </gallery>
19462 !! html/php
19463 <ul class="gallery mw-gallery-traditional">
19464 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19465 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
19466 <div class="gallerytext">
19467 </div>
19468 </div></li>
19469 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19470 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
19471 <div class="gallerytext">
19472 </div>
19473 </div></li>
19474 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19475 <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>
19476 <div class="gallerytext">
19477 </div>
19478 </div></li>
19479 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19480 <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>
19481 <div class="gallerytext">
19482 </div>
19483 </div></li>
19484 </ul>
19485
19486 !! html/parsoid
19487 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
19488 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><span style="display: inline-block; height: 100%; vertical-align: middle;"></span><span style="vertical-align: middle; display: inline-block;">File:Nonexistent.jpg</span></div><div class="gallerytext"></div></li>
19489 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><span style="display: inline-block; height: 100%; vertical-align: middle;"></span><span style="vertical-align: middle; display: inline-block;">Nonexistent.jpg</span></div><div class="gallerytext"></div></li>
19490 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><span style="display: inline-block; height: 100%; vertical-align: middle;"></span><span typeof="mw:Image" style="vertical-align: middle; display: inline-block;"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="14" width="120"/></a></span></div><div class="gallerytext"></div></li>
19491 <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>
19492 </ul>
19493 !! end
19494
19495 !! test
19496 Gallery override link with WikiLink (T36852)
19497 !! options
19498 parsoid={
19499 "nativeGallery": true
19500 }
19501 !! wikitext
19502 <gallery>
19503 File:Foobar.jpg|alt=galleryalt|link=InterWikiLink
19504 </gallery>
19505 !! html/php
19506 <ul class="gallery mw-gallery-traditional">
19507 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19508 <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>
19509 <div class="gallerytext">
19510 </div>
19511 </div></li>
19512 </ul>
19513
19514 !! html/parsoid
19515 <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":{}}'>
19516 <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>
19517 </ul>
19518 !! end
19519
19520 !! test
19521 Gallery override link with absolute external link (T36852)
19522 !! options
19523 parsoid={
19524 "nativeGallery": true
19525 }
19526 !! wikitext
19527 <gallery>
19528 File:Foobar.jpg|alt=galleryalt|link=http://www.example.org
19529 </gallery>
19530 !! html/php
19531 <ul class="gallery mw-gallery-traditional">
19532 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19533 <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>
19534 <div class="gallerytext">
19535 </div>
19536 </div></li>
19537 </ul>
19538
19539 !! html/parsoid
19540 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
19541 <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>
19542 </ul>
19543 !! end
19544
19545 !! test
19546 Gallery override link with absolute external link with LanguageConverter
19547 !! options
19548 language=zh
19549 !! input
19550 <gallery>
19551 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
19552 </gallery>
19553 !! result
19554 <ul class="gallery mw-gallery-traditional">
19555 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19556 <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>
19557 <div class="gallerytext">
19558 <p>caption
19559 </p>
19560 </div>
19561 </div></li>
19562 </ul>
19563
19564 !! end
19565
19566 !! test
19567 Gallery override link with malicious javascript (T36852)
19568 !! options
19569 parsoid={
19570 "modes": ["wt2html", "html2html"],
19571 "nativeGallery": true
19572 }
19573 !! wikitext
19574 <gallery>
19575 File:Foobar.jpg|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
19576 </gallery>
19577 !! html/php
19578 <ul class="gallery mw-gallery-traditional">
19579 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19580 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/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>
19581 <div class="gallerytext">
19582 </div>
19583 </div></li>
19584 </ul>
19585
19586 !! html/parsoid
19587 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
19588 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><span style="display: inline-block; height: 100%; vertical-align: middle;"></span><span typeof="mw:Image" style="vertical-align: middle; display: inline-block;"><a href="./%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>
19589 </ul>
19590 !! end
19591
19592 !! test
19593 Gallery with invalid title as link (T45964)
19594 !! options
19595 parsoid={
19596 "modes": ["wt2html", "html2html"],
19597 "nativeGallery": true
19598 }
19599 !! wikitext
19600 <gallery>
19601 File:Foobar.jpg|link=<
19602 </gallery>
19603 !! html/php
19604 <ul class="gallery mw-gallery-traditional">
19605 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19606 <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>
19607 <div class="gallerytext">
19608 </div>
19609 </div></li>
19610 </ul>
19611
19612 !! html/parsoid
19613 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
19614 <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>
19615 </ul>
19616 !! end
19617
19618 !! test
19619 Serialize gallery without attrs in data-mw
19620 !! options
19621 parsoid={
19622 "modes": ["html2wt"],
19623 "nativeGallery": true
19624 }
19625 !! html/parsoid
19626 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","body":{}}'>
19627 <li class="gallerycaption">123</li>
19628 <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>
19629 </ul>
19630 !! wikitext
19631 <gallery caption="123">
19632 File:Test.png
19633 </gallery>
19634 !! end
19635
19636 !! test
19637 HTML Hex character encoding (spells the word "JavaScript")
19638 !! options
19639 parsoid=wt2html,wt2wt,html2html
19640 !! wikitext
19641 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
19642 !! html/php
19643 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
19644 </p>
19645 !! html/php+tidy
19646 <p>JavaScript</p>
19647 !! html/parsoid
19648 <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>
19649 !! end
19650
19651 !! test
19652 HTML Hex character encoding bogus encoding (T28437 regression check)
19653 !! wikitext
19654 &#xsee;&#XSEE;
19655 !! html/php
19656 <p>&amp;#xsee;&amp;#XSEE;
19657 </p>
19658 !! html/parsoid
19659 <p>&amp;#xsee;&amp;#XSEE;</p>
19660 !! end
19661
19662 !! test
19663 HTML Hex character encoding mixed case
19664 !! options
19665 parsoid=wt2html,wt2wt,html2html
19666 !! wikitext
19667 &#xEE;&#Xee;
19668 !! html/php
19669 <p>&#xee;&#xee;
19670 </p>
19671 !! html/php+tidy
19672 <p>îî</p>
19673 !! html/parsoid
19674 <p><span typeof="mw:Entity">î</span><span typeof="mw:Entity">î</span></p>
19675 !! end
19676
19677 # See: https://www.w3.org/TR/html5/syntax.html#character-references
19678 # Note that U+000C (form feed) is not a valid XML character, so
19679 # it is banned even though allowed in HTML5.
19680 !! test
19681 Illegal character references (T106578)
19682 !! wikitext
19683 ; Null: &#00;
19684 ; FF: &#xC;
19685 ; CR: &#xD;
19686 ; Control (low): &#8;
19687 ; Control (high): &#x7F; &#x9F;
19688 ; Surrogate: &#xD83D;&#xDCA9;
19689 ; This is an okay astral character: &#x1F4A9;
19690 !! html+tidy
19691 <dl>
19692 <dt>Null</dt>
19693 <dd>&amp;#00;</dd>
19694 <dt>FF</dt>
19695 <dd>&amp;#xC;</dd>
19696 <dt>CR</dt>
19697 <dd>&amp;#xD;</dd>
19698 <dt>Control (low)</dt>
19699 <dd>&amp;#8;</dd>
19700 <dt>Control (high)</dt>
19701 <dd>&amp;#x7F; &amp;#x9F;</dd>
19702 <dt>Surrogate</dt>
19703 <dd>&amp;#xD83D;&amp;#xDCA9;</dd>
19704 <dt>This is an okay astral character</dt>
19705 <dd>💩</dd>
19706 </dl>
19707 !! end
19708
19709 !! test
19710 __FORCETOC__ override
19711 !! wikitext
19712 __NEWSECTIONLINK__
19713 __FORCETOC__
19714 !! html/php
19715 <p><br />
19716 </p>
19717 !! end
19718
19719 !! test
19720 ISBN code coverage
19721 !! wikitext
19722 ISBN 978-0-1234-56&#x20;789
19723 !! html
19724 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
19725 </p>
19726 !! html+tidy
19727 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a> 789</p>
19728 !! html/parsoid
19729 <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>
19730 !! end
19731
19732 !! test
19733 ISBN followed by 5 spaces
19734 !! wikitext
19735 ISBN
19736 !! html
19737 <p>ISBN
19738 </p>
19739 !! end
19740
19741 !! test
19742 Double ISBN
19743 !! wikitext
19744 ISBN ISBN 1234567890
19745 !! html/php
19746 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
19747 </p>
19748 !! html/parsoid
19749 <p>ISBN <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a></p>
19750 !! end
19751
19752 # Uppercase X and lowercase x as well
19753 !! test
19754 ISBN with an X
19755 !! wikitext
19756 ISBN 3-462-04561-X
19757 ISBN 3-462-04561-x
19758 ISBN 080442957X
19759 ISBN 080442957x
19760 ISBN 978080442957X
19761 ISBN 978080442957x
19762 !! html/php
19763 <p><a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-X</a>
19764 <a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-x</a>
19765 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957X</a>
19766 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957x</a>
19767 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957X</a>
19768 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957x</a>
19769 </p>
19770 !! html/parsoid
19771 <p><a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-X</a>
19772 <a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-x</a>
19773 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957X</a>
19774 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957x</a>
19775 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957X</a>
19776 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957x</a></p>
19777 !! end
19778
19779 !! test
19780 ISBN with empty prefix (parsoid test)
19781 !! wikitext
19782 ISBN 1234567890
19783 !! html/php
19784 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
19785 </p>
19786 !! html/parsoid
19787 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink">ISBN 1234567890</a></p>
19788 !! end
19789
19790 !! test
19791 T24905: <abbr> followed by ISBN followed by </a>
19792 !! wikitext
19793 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
19794 !! html/php
19795 <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>
19796 </p>
19797 !! html/parsoid
19798 <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>
19799 !! end
19800
19801 !! test
19802 Double RFC
19803 !! wikitext
19804 RFC RFC 1234
19805 !! html
19806 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
19807 </p>
19808 !! end
19809
19810 !! test
19811 Double RFC with a wiki link
19812 !! wikitext
19813 RFC [[RFC 1234]]
19814 !! html
19815 <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>
19816 </p>
19817 !! end
19818
19819 !! test
19820 RFC code coverage
19821 !! wikitext
19822 RFC 983&#x20;987
19823 !! html
19824 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
19825 </p>
19826 !! html+tidy
19827 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a> 987</p>
19828 !! end
19829
19830 !! test
19831 Centre-aligned image
19832 !! wikitext
19833 [[Image:foobar.jpg|centre]]
19834 !! html
19835 <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>
19836
19837 !!end
19838
19839 !! test
19840 None-aligned image
19841 !! wikitext
19842 [[Image:foobar.jpg|none]]
19843 !! html
19844 <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>
19845
19846 !!end
19847
19848 !! test
19849 Width + Height sized image (using px) (height is ignored)
19850 !! wikitext
19851 [[Image:foobar.jpg|640x480px]]
19852 !! html
19853 <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>
19854 </p>
19855 !!end
19856
19857 !! test
19858 Width-sized image (using px, no following whitespace)
19859 !! wikitext
19860 [[Image:foobar.jpg|640px]]
19861 !! html
19862 <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>
19863 </p>
19864 !!end
19865
19866 !! test
19867 Width-sized image (using px, with following whitespace - test regression from r39467)
19868 !! wikitext
19869 [[Image:foobar.jpg|640px ]]
19870 !! html
19871 <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>
19872 </p>
19873 !!end
19874
19875 !! test
19876 Width-sized image (using px, with preceding whitespace - test regression from r39467)
19877 !! wikitext
19878 [[Image:foobar.jpg| 640px]]
19879 !! html
19880 <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>
19881 </p>
19882 !!end
19883
19884 !! test
19885 Image with page parameter
19886 !! options
19887 djvu
19888 !! wikitext
19889 [[File:LoremIpsum.djvu|page=2]]
19890 !! html/php
19891 <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>
19892 </p>
19893 !! html/parsoid
19894 <p><span class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"page","ak":"page=2"}]}'><a href="./File:LoremIpsum.djvu" data-parsoid='{"a":{"href":"./File:LoremIpsum.djvu"},"sa":{}}'><img resource="./File:LoremIpsum.djvu" src="//example.com/images/5/5f/LoremIpsum.djvu" data-file-width="2480" data-file-height="3508" data-file-type="bitmap" height="3508" width="2480" data-parsoid='{"a":{"resource":"./File:LoremIpsum.djvu","height":"3508","width":"2480"},"sa":{"resource":"File:LoremIpsum.djvu"}}'/></a></span></p>
19895 !! end
19896
19897 !! test
19898 Another italics / bold test
19899 !! wikitext
19900 ''' ''x'
19901 !! html
19902 <pre>'<i> </i>x'
19903 </pre>
19904 !!end
19905
19906 # FIXME: The php output seems broken. It's interleaving some open/close tags.
19907 !! test
19908 dt/dd/dl test
19909 !! wikitext
19910 :;;;::
19911 !! html/php
19912 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dt></dl></dd></dl></dd></dl></dd></dl></dd></dl></dd></dl>
19913
19914 !! html/parsoid
19915 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dd></dl></dd></dl></dt></dl></dt></dl></dt></dl></dd></dl>
19916
19917 !!end
19918
19919 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
19920 !! test
19921 Images with the "|" character in the comment
19922 !! wikitext
19923 [[File:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
19924 !! html/php
19925 <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>
19926
19927 !! html/parsoid
19928 <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>
19929 !! end
19930
19931 !! test
19932 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
19933 !! wikitext
19934 <html><script>alert(1);</script></html>
19935 !! html
19936 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
19937 </p>
19938 !! end
19939
19940 !! test
19941 HTML with raw HTML ($wgRawHtml==true)
19942 !! options
19943 wgRawHtml=1
19944 !! wikitext
19945 <html><script>alert(1);</script></html>
19946 !! html
19947 <p><script>alert(1);</script>
19948 </p>
19949 !! end
19950
19951 !! test
19952 Parents of subpages, one level up
19953 !! options
19954 subpage title=[[Subpage test/L1/L2/L3]]
19955 !! wikitext
19956 [[../|L2]]
19957 !! html
19958 <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>
19959 </p>
19960 !! end
19961
19962
19963 !! test
19964 Parents of subpages, one level up, not named
19965 !! options
19966 subpage title=[[Subpage test/L1/L2/L3]]
19967 !! wikitext
19968 [[../]]
19969 !! html
19970 <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>
19971 </p>
19972 !! end
19973
19974
19975
19976 !! test
19977 Parents of subpages, two levels up
19978 !! options
19979 subpage title=[[Subpage test/L1/L2/L3]]
19980 !! wikitext
19981 [[../../|L1]]2
19982
19983 [[../../|L1]]l
19984 !! html
19985 <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
19986 </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>
19987 </p>
19988 !! end
19989
19990 !! test
19991 Parents of subpages, two levels up, without trailing slash or name.
19992 !! options
19993 subpage title=[[Subpage test/L1/L2/L3]]
19994 !! wikitext
19995 [[../..]]
19996 !! html
19997 <p>[[../..]]
19998 </p>
19999 !! end
20000
20001 !! test
20002 Parents of subpages, two levels up, with lots of extra trailing slashes.
20003 !! options
20004 subpage title=[[Subpage test/L1/L2/L3]]
20005 !! wikitext
20006 [[../../////]]
20007 !! html
20008 <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>
20009 </p>
20010 !! end
20011
20012 !! article
20013 Subpage test/L1/L2/L3Sibling
20014 !! text
20015 Sibling article
20016 !! endarticle
20017
20018 !! test
20019 Transclusion of a sibling page (one level up)
20020 !! options
20021 subpage title=[[Subpage test/L1/L2/L3]]
20022 !! wikitext
20023 {{../L3Sibling}}
20024 !! html
20025 <p>Sibling article
20026 </p>
20027 !! end
20028
20029 !! test
20030 Transclusion of a child page
20031 !! options
20032 subpage title=[[Subpage test/L1/L2]]
20033 !! wikitext
20034 {{/L3Sibling}}
20035 !! html
20036 <p>Sibling article
20037 </p>
20038 !! end
20039
20040 # This is wt2html only in Parsoid because we add <nowiki>
20041 # because of {{..}} and we don't expect to fix that to
20042 # eliminate the nowikis selective for {{..}} markup.
20043 !! test
20044 Non-transclusion because of too many up levels
20045 !! options
20046 subpage title=[[Subpage test/L1/L2/L3]]
20047 parsoid=wt2html
20048 !! wikitext
20049 {{../../../../More than parent}}
20050 !! html/php
20051 <p>{{../../../../More than parent}}
20052 </p>
20053 !! html/parsoid
20054 <p>{{../../../../More than parent}}</p>
20055 !! end
20056
20057 !! test
20058 Definition list code coverage
20059 !! wikitext
20060 ; title : def
20061 ; title : def
20062 ;title: def
20063 !! html/php
20064 <dl><dt> title &#160;</dt>
20065 <dd> def</dd>
20066 <dt> title&#160;</dt>
20067 <dd> def</dd>
20068 <dt>title</dt>
20069 <dd> def</dd></dl>
20070
20071 !! html/parsoid
20072 <dl><dt> title <span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
20073 <dt> title<span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
20074 <dt>title</dt><dd> def</dd></dl>
20075 !! end
20076
20077 !! test
20078 Don't fall for the self-closing div
20079 !! wikitext
20080 <div>hello world</div/>
20081 !! html
20082 <div>hello world</div>
20083
20084 !! end
20085
20086 !! test
20087 MSGNW magic word
20088 !! wikitext
20089 {{MSGNW:msg}}
20090 !! html/php
20091 <p>&#91;&#91;:Template:Msg&#93;&#93;
20092 </p>
20093 !! end
20094
20095 !! test
20096 RAW magic word
20097 !! wikitext
20098 {{RAW:QUERTY}}
20099 !! html
20100 <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>
20101 </p>
20102 !! end
20103
20104 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
20105 !! test
20106 Always escape literal '>' in output, not just after '<'
20107 !! wikitext
20108 ><>
20109 !! html
20110 <p>&gt;&lt;&gt;
20111 </p>
20112 !! end
20113
20114 !! test
20115 Template caching
20116 !! wikitext
20117 {{Test}}
20118 {{Test}}
20119 !! html
20120 <p>This is a test template
20121 This is a test template
20122 </p>
20123 !! end
20124
20125
20126 !! article
20127 MediaWiki:Fake
20128 !! text
20129 ==header==
20130 !! endarticle
20131
20132 !! test
20133 Inclusion of !userCanEdit() content
20134 !! wikitext
20135 {{MediaWiki:Fake}}
20136 !! html
20137 <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>
20138
20139 !! end
20140
20141
20142 !! test
20143 Out-of-order TOC heading levels
20144 !! wikitext
20145 ==2==
20146 ======6======
20147 ===3===
20148 =1=
20149 =====5=====
20150 ==2==
20151 !! html
20152 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20153 <ul>
20154 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
20155 <ul>
20156 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
20157 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
20158 </ul>
20159 </li>
20160 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
20161 <ul>
20162 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
20163 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
20164 </ul>
20165 </li>
20166 </ul>
20167 </div>
20168
20169 <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>
20170 <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>
20171 <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>
20172 <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>
20173 <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>
20174 <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>
20175
20176 !! end
20177
20178
20179 !! test
20180 ISBN with a dummy number
20181 !! wikitext
20182 ISBN ---
20183 !! html
20184 <p>ISBN ---
20185 </p>
20186 !! end
20187
20188
20189 !! test
20190 ISBN with space-delimited number
20191 !! wikitext
20192 ISBN 92 9017 032 8
20193 !! html
20194 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
20195 </p>
20196 !! end
20197
20198
20199 !! test
20200 ISBN with multiple spaces, no number
20201 !! wikitext
20202 ISBN foo
20203 !! html
20204 <p>ISBN foo
20205 </p>
20206 !! end
20207
20208
20209 !! test
20210 ISBN length
20211 !! wikitext
20212 ISBN 123456789
20213
20214 ISBN 1234567890
20215
20216 ISBN 12345678901
20217 !! html
20218 <p>ISBN 123456789
20219 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
20220 </p><p>ISBN 12345678901
20221 </p>
20222 !! end
20223
20224
20225 !! test
20226 ISBN with trailing year (T9110)
20227 !! wikitext
20228 ISBN 1-234-56789-0 - 2006
20229
20230 ISBN 1 234 56789 0 - 2006
20231 !! html
20232 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
20233 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
20234 </p>
20235 !! end
20236
20237
20238 !! test
20239 anchorencode
20240 !! wikitext
20241 {{anchorencode:foo bar©#%n}}
20242 !! html
20243 <p>foo_bar.C2.A9.23.25n
20244 </p>
20245 !! end
20246
20247 !! test
20248 anchorencode trims spaces
20249 !! wikitext
20250 {{anchorencode: __pretty__please__}}
20251 !! html
20252 <p>pretty_please
20253 </p>
20254 !! end
20255
20256 !! test
20257 anchorencode deals with links
20258 !! wikitext
20259 {{anchorencode: [[hello|world]] [[hi]]}}
20260 !! html
20261 <p>world_hi
20262 </p>
20263 !! end
20264
20265 !! test
20266 anchorencode deals with templates
20267 !! wikitext
20268 {{anchorencode: {{Foo}} }}
20269 !! html
20270 <p>FOO
20271 </p>
20272 !! end
20273
20274 !! test
20275 anchorencode encodes like the TOC generator: (T20431)
20276 !! wikitext
20277 === _ +:.3A%3A&&amp;]] ===
20278 {{anchorencode: _ +:.3A%3A&&amp;]] }}
20279 __NOEDITSECTION__
20280 !! html
20281 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
20282 <p>.2B:.3A.253A.26.26.5D.5D
20283 </p>
20284 !! end
20285
20286 !! test
20287 T8200: blockquotes and paragraph formatting
20288 !! wikitext
20289 <blockquote>
20290 foo
20291 </blockquote>
20292
20293 bar
20294
20295 baz
20296 !! html
20297 <blockquote>
20298 <p>foo
20299 </p>
20300 </blockquote>
20301 <p>bar
20302 </p>
20303 <pre>baz
20304 </pre>
20305 !! end
20306
20307 !! test
20308 T10293: Use of center tag ruins paragraph formatting
20309 !! wikitext
20310 <center>
20311 foo
20312 </center>
20313
20314 bar
20315
20316 baz
20317 !! html
20318 <center>
20319 <p>foo
20320 </p>
20321 </center>
20322 <p>bar
20323 </p>
20324 <pre>baz
20325 </pre>
20326 !! end
20327
20328 !!test
20329 Parsing of overlapping (improperly nested) inline html tags
20330 !! wikitext
20331 <span><s>x</span></s>
20332 !! html/php
20333 <p><span><s>x&lt;/span&gt;</s></span>
20334 </p>
20335 !! html/parsoid
20336 <p><span><s>x</s></span>
20337 </p>
20338 !!end
20339
20340 ###
20341 ### Language variants related tests
20342 ###
20343 !! test
20344 Self-link in language variants
20345 !! options
20346 title=[[Dunav]] language=sr
20347 !! wikitext
20348 Both [[Dunav]] and [[Дунав]] are names for this river.
20349 !! html
20350 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
20351 </p>
20352 !!end
20353
20354 !! article
20355 Дуна
20356 !! text
20357 content
20358 !! endarticle
20359
20360 !! test
20361 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
20362 !! options
20363 title=[[Duna]] language=sr
20364 !! wikitext
20365 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
20366 !! html
20367 <p><a href="/wiki/%D0%94%D1%83%D0%BD%D0%B0" title="Дуна">Дуна</a> is not a self-link while <strong class="selflink">Duna</strong> and <strong class="selflink">Dуна</strong> are still self-links.
20368 </p>
20369 !! end
20370
20371 !! test
20372 Link to a section of a variant of this title shouldn't be parsed as self-link
20373 !! options
20374 title=[[Duna]] language=sr
20375 !! wikitext
20376 [[Dуна]] is a self-link while [[Dunа#Foo]] and [[Dуна#Foo]] are not self-links.
20377 !! html
20378 <p><strong class="selflink">Dуна</strong> 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.
20379 </p>
20380 !! end
20381
20382 !! test
20383 Link to pages in language variants
20384 !! options
20385 language=sr
20386 !! wikitext
20387 Main Page can be written as [[Маин Паге]]
20388 !! html
20389 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
20390 </p>
20391 !!end
20392
20393
20394 !! test
20395 Multiple links to pages in language variants
20396 !! options
20397 language=sr
20398 !! wikitext
20399 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
20400 !! html
20401 <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>.
20402 </p>
20403 !!end
20404
20405
20406 !! test
20407 Simple template in language variants
20408 !! options
20409 language=sr
20410 !! wikitext
20411 {{тест}}
20412 !! html
20413 <p>This is a test template
20414 </p>
20415 !! end
20416
20417
20418 !! test
20419 Template with explicit namespace in language variants
20420 !! options
20421 language=sr
20422 !! wikitext
20423 {{Template:тест}}
20424 !! html
20425 <p>This is a test template
20426 </p>
20427 !! end
20428
20429
20430 !! test
20431 Basic test for template parameter in language variants
20432 !! options
20433 language=sr
20434 !! wikitext
20435 {{парамтест|param=foo}}
20436 !! html
20437 <p>This is a test template with parameter foo
20438 </p>
20439 !! end
20440
20441 !! test
20442 Simple category in language variants
20443 !! options
20444 language=sr cat
20445 !! wikitext
20446 [[Category:МедиаWики Усер'с Гуиде]]
20447 !! html/php
20448 cat=МедиаWики_Усер'с_Гуиде sort=
20449 !! html/parsoid
20450 <link rel="mw:PageProp/Category" href="./Категорија:МедиаWики_Усер'с_Гуиде" data-parsoid='{"stx":"simple","a":{"href":"./Категорија:МедиаWики_Усер&#39;с_Гуиде"},"sa":{"href":"Category:МедиаWики Усер&#39;с Гуиде"}}'/>
20451 !! end
20452
20453 !! article
20454 Category:分类
20455 !! text
20456 blah
20457 !! endarticle
20458
20459 !! article
20460 Category:分類
20461 !! text
20462 blah
20463 !! endarticle
20464
20465 ## We used to, but no longer wt2wt this test since the default serializer
20466 ## will normalize all categories to serialize on their own line.
20467 ## This wikitext usage is going to be fairly uncommon in production and
20468 ## selser will take care of preserving formatting in those scenarios.
20469 !! test
20470 Don't convert blue categorylinks to another variant (T35210)
20471 !! options
20472 cat
20473 language=zh
20474 parsoid=wt2html
20475 !! wikitext
20476 [[A]][[Category:分类]]
20477 !! html/php
20478 cat=分类 sort=
20479 !! html/parsoid
20480 <p><a rel="mw:WikiLink" href="./A" title="A">A</a></p>
20481 <link rel="mw:PageProp/Category" href="./Category:分类"/>
20482 !! end
20483
20484 !! test
20485 Stripping -{}- tags (language variants)
20486 !! options
20487 language=sr
20488 !! wikitext
20489 Latin proverb: -{Ne nuntium necare}-
20490 !! html
20491 <p>Latin proverb: Ne nuntium necare
20492 </p>
20493 !! end
20494
20495
20496 !! test
20497 Prevent conversion with -{}- tags (language variants)
20498 !! options
20499 language=sr variant=sr-ec
20500 !! wikitext
20501 Latinski: -{Ne nuntium necare}-
20502 !! html
20503 <p>Латински: Ne nuntium necare
20504 </p>
20505 !! end
20506
20507
20508 !! test
20509 Prevent conversion of text with -{}- tags (language variants)
20510 !! options
20511 language=sr variant=sr-ec
20512 !! wikitext
20513 Latinski: -{Ne nuntium necare}-
20514 !! html
20515 <p>Латински: Ne nuntium necare
20516 </p>
20517 !! end
20518
20519
20520 !! test
20521 Prevent conversion of links with -{}- tags (language variants)
20522 !! options
20523 language=sr variant=sr-ec
20524 !! wikitext
20525 -{[[Main Page]]}-
20526 !! html
20527 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
20528 </p>
20529 !! end
20530
20531
20532 !! test
20533 -{}- tags within headlines (within html for parserConvert())
20534 !! options
20535 language=sr variant=sr-ec
20536 !! wikitext
20537 == -{Naslov}- ==
20538 !! html
20539 <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>
20540
20541 !! end
20542
20543
20544 !! test
20545 Explicit definition of language variant alternatives
20546 !! options
20547 language=zh variant=zh-tw
20548 !! wikitext
20549 -{zh:China;zh-tw:Taiwan}-, not China
20550 !! html
20551 <p>Taiwan, not China
20552 </p>
20553 !! end
20554
20555
20556 !! test
20557 Conversion around HTML tags
20558 !! options
20559 language=sr variant=sr-ec
20560 !! wikitext
20561 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
20562 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
20563 !! html
20564 <p>
20565 <span title="ЛаCтин">ски</span>
20566 </p>
20567 !! end
20568
20569
20570 !! test
20571 Explicit session-wise language variant mapping (A flag and - flag)
20572 !! options
20573 language=zh variant=zh-tw
20574 !! wikitext
20575 Taiwan is not China.
20576 But -{A|zh:China;zh-tw:Taiwan}- is China,
20577 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
20578 and -{China}- is China.
20579 !! html
20580 <p>Taiwan is not China.
20581 But Taiwan is Taiwan,
20582 (This should be stripped!)
20583 and China is China.
20584 </p>
20585 !! end
20586
20587 !! test
20588 Explicit session-wise language variant mapping (H flag for hide)
20589 !! options
20590 language=zh variant=zh-tw
20591 !! wikitext
20592 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
20593 Taiwan is China.
20594 !! html
20595 <p>(This should be stripped!)
20596 Taiwan is Taiwan.
20597 </p>
20598 !! end
20599
20600 !! test
20601 Adding explicit conversion rule for title (T flag)
20602 !! options
20603 language=zh variant=zh-tw showtitle
20604 !! wikitext
20605 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
20606 !! html
20607 Taiwan
20608 <p>Should be stripped!
20609 </p>
20610 !! end
20611
20612 !! test
20613 Testing that changing the language variant here in the tests actually works
20614 !! options
20615 language=zh variant=zh showtitle
20616 !! wikitext
20617 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
20618 !! html
20619 China
20620 <p>Should be stripped!
20621 </p>
20622 !! end
20623
20624 !! test
20625 Recursive conversion of alt and title attrs shouldn't clear converter state
20626 !! options
20627 language=zh variant=zh-cn showtitle
20628 !! wikitext
20629 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
20630 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
20631 !! html
20632 China
20633 <p>
20634 Should be stripped<span title="Exclamation">!</span>
20635 </p>
20636 !! end
20637
20638 !! test
20639 T26072: more test on conversion rule for title
20640 !! options
20641 language=zh variant=zh-tw showtitle
20642 !! wikitext
20643 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
20644 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
20645 !! html
20646 Taiwan
20647 <p>This should be stripped!
20648 This won't take interferes with the title rule.
20649 </p>
20650 !! end
20651
20652 !! test
20653 Partly disable title conversion if variant == main language code
20654 !! options
20655 language=zh variant=zh title=[[ZH]] showtitle
20656 !! wikitext
20657 -{T|zh-cn:CN;zh-tw:TW}-
20658 !! html
20659 ZH
20660 <p>
20661 </p>
20662 !! end
20663
20664 !! test
20665 Partly disable title conversion if variant == main language code, more
20666 !! options
20667 language=zh variant=zh title=[[ZH]] showtitle
20668 !! wikitext
20669 -{T|TW}-
20670 !! html
20671 ZH
20672 <p>
20673 </p>
20674 !! end
20675
20676 !! test
20677 Raw output of variant escape tags (R flag)
20678 !! options
20679 language=zh variant=zh-tw
20680 !! wikitext
20681 Raw: -{R|zh:China;zh-tw:Taiwan}-
20682 !! html
20683 <p>Raw: zh:China;zh-tw:Taiwan
20684 </p>
20685 !! end
20686
20687 !! test
20688 Strings evaluating false shouldn't be ignored by Language converter (T51072)
20689 !! options
20690 language=zh variant=zh-cn
20691 !! input
20692 -{zh-cn:0;zh-sg:1;zh-tw:2;zh-hk:3}-
20693 !! result
20694 <p>0
20695 </p>
20696 !! end
20697
20698 !! test
20699 Conversion rules from [numeric-only string] to [something else] (T48634)
20700 !! options
20701 language=zh variant=zh-cn
20702 !! input
20703 -{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
20704 !! result
20705 <p>D12345EE12345
20706 </p>
20707 !! end
20708
20709 !! test
20710 Bidirectional converter rule entries with an empty value should be ignored (T53551)
20711 !! options
20712 language=zh variant=zh-cn
20713 !! input
20714 -{H|zh-cn:foo;zh-tw:;}-foobar
20715 !! result
20716 <p>foobar
20717 </p>
20718 !! end
20719
20720 !! test
20721 Unidirectional converter rule entries with an empty "from" string should be ignored (T53551)
20722 !! options
20723 language=zh variant=zh-cn
20724 !! input
20725 -{H|=>zh-cn:foo;}-foobar
20726 !! result
20727 <p>foobar
20728 </p>
20729 !! end
20730
20731 !! test
20732 Empty converter rule entries shouldn't be inserted into the conversion table (T53551)
20733 !! options
20734 language=zh variant=zh-cn
20735 !! input
20736 -{H|}-foobar
20737 !! result
20738 <p>foobar
20739 </p>
20740 !! end
20741
20742 !! test
20743 Nested using of manual convert syntax
20744 !! options
20745 language=zh variant=zh-hk
20746 !! wikitext
20747 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
20748 !! html
20749 <p>Nested: Hello Hong Kong!
20750 </p>
20751 !! end
20752
20753 # Since Parsoid is starting to emit canonical wikitext for links,
20754 # [http://example.com http://example.com] will not RT back to that
20755 # form anymore.
20756 !! test
20757 HTML markups with conversion syntax in attribs, nested in other conversion blocks
20758 !! options
20759 language=zh variant=zh-cn
20760 !! wikitext
20761 -{zh;zh-hans;zh-hant|<span title="-{X}-">A</span>}-
20762 !! html
20763 <p><span title="X">A</span>
20764 </p>
20765 !! end
20766
20767 !! test
20768 HTML markups with conversion syntax in attribs, nested in other conversion blocks (not working yet)
20769 !! options
20770 language=zh variant=zh-cn disabled
20771 !! wikitext
20772 -{<span title="-{X}-">A</span>}-
20773 !! html
20774 <p><span title="X">A</span>
20775 </p>
20776 !! end
20777
20778 !! test
20779 Proper conversion of text in external links
20780 !! options
20781 language=sr variant=sr-ec
20782 parsoid=wt2html
20783 !! wikitext
20784 http://www.google.com
20785 gopher://www.google.com
20786 [http://www.google.com http://www.google.com]
20787 [gopher://www.google.com gopher://www.google.com]
20788 [https://www.google.com irc://www.google.com]
20789 [ftp://www.google.com www.google.com/ftp://dir]
20790 [//www.google.com www.google.com]
20791 !! html/php
20792 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
20793 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
20794 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
20795 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
20796 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
20797 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
20798 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
20799 </p>
20800 !! html/parsoid
20801 <p><a rel="mw:ExtLink" href="http://www.google.com">http://www.google.com</a>
20802 <a rel="mw:ExtLink" href="gopher://www.google.com">gopher://www.google.com</a>
20803 <a rel="mw:ExtLink" href="http://www.google.com">http://www.google.com</a>
20804 <a rel="mw:ExtLink" href="gopher://www.google.com">gopher://www.google.com</a>
20805 <a rel="mw:ExtLink" href="https://www.google.com">irc://www.google.com</a>
20806 <a rel="mw:ExtLink" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
20807 <a rel="mw:ExtLink" href="//www.google.com">www.гоогле.цом</a></p>
20808 !! end
20809
20810 !! test
20811 Do not convert roman numbers to language variants
20812 !! options
20813 language=sr variant=sr-ec
20814 !! wikitext
20815 Fridrih IV je car.
20816 !! html
20817 <p>Фридрих IV је цар.
20818 </p>
20819 !! end
20820
20821 !! test
20822 Unclosed language converter markup "-{"
20823 !! options
20824 language=sr
20825 !! wikitext
20826 -{T|hello
20827 !! html
20828 <p>-{T|hello
20829 </p>
20830 !! end
20831
20832 !! test
20833 Don't convert raw rule "-{R|=&gt;}-" to "=>"
20834 !! options
20835 language=sr
20836 !! wikitext
20837 -{R|=&gt;}-
20838 !! html
20839 <p>=&gt;
20840 </p>
20841 !!end
20842
20843 !! test
20844 Don't break link parsing if language converter markup is in the caption.
20845 !! options
20846 language=sr variant=sr-ec
20847 !! wikitext
20848 [[Main Page|-{R|main page}-]]
20849 !! html
20850 <p><a href="/wiki/Main_Page" title="Маин Паге">main page</a>
20851 </p>
20852 !! end
20853
20854 # FIXME: This test is currently broken in the PHP parser T153761
20855 !! test
20856 T146304: Don't break template parsing if language converter markup is in the parameter.
20857 !! options
20858 language=sr variant=sr-ec
20859 disabled
20860 !! wikitext
20861 {{echo|-{R|foo}-}}
20862 !! html/php
20863 <p>foo
20864 </p>
20865 !! end
20866
20867 !! test
20868 T146305: Don't break image parsing if language converter markup is in the caption.
20869 !! options
20870 language=sr
20871 !! wikitext
20872 [[File:Foobar.jpg|thumb|-{R|caption:}-]]
20873 !! html/php
20874 <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>
20875
20876 !! html/parsoid
20877 <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>
20878 !! end
20879
20880 !! test
20881 T146305: Don't break image parsing if nested language converter markup is in the caption.
20882 !! options
20883 language=zh variant=zh-cn
20884 !! wikitext
20885 [[File:Foobar.jpg|thumb|-{zh-cn:blog (hk: -{zh-hans|WEBJOURNAL}-, tw: -{zh-hans|WEBLOG}-)}-]]
20886 !! html/php
20887 <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>
20888
20889 !! html/parsoid
20890 <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>
20891 !! end
20892
20893 !! test
20894 Don't break gallery if language converter markup is inside.
20895 !! options
20896 language=zh
20897 !! wikitext
20898 <gallery>
20899 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=-{R|foo}-|-{R|bar}-]]|alt=-{R|bat}-
20900 File:foobar.jpg|{{Test|unamedParam|alt=-{R|param}-}}|alt=galleryalt
20901 </gallery>
20902 !! html
20903 <ul class="gallery mw-gallery-traditional">
20904 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20905 <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>
20906 <div class="gallerytext">
20907 <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>
20908 </p>
20909 </div>
20910 </div></li>
20911 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20912 <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>
20913 <div class="gallerytext">
20914 <p>This is a test template
20915 </p>
20916 </div>
20917 </div></li>
20918 </ul>
20919
20920 !! end
20921
20922 !! test
20923 T153135: Don't break list handling if language converter markup is in the item.
20924 !! options
20925 language=zh variant=zh-cn
20926 !! wikitext
20927 ;-{zh-cn:AAA;zh-tw:BBB}-
20928 ;-{R|foo:bar}-
20929 !! html/php
20930 <dl><dt>AAA</dt>
20931 <dt>foo:bar</dt></dl>
20932
20933 !! html/parsoid
20934 <dl>
20935 <dt><span typeof="mw:LanguageVariant" data-mw='{"bidir":[{"l":"zh-cn","t":"AAA"},{"l":"zh-tw","t":"BBB"}],"show":true}'></span></dt>
20936 <dt><span typeof="mw:LanguageVariant" data-mw='{"disabled":true,"show":true,"text":"foo:bar"}'></span></dt>
20937 </dl>
20938 !! end
20939
20940 // Note that parsoid does not protect colons unless language converter
20941 // markup is properly nested, because it is a backtracking parser.
20942 !! test
20943 T153135: Unclosed markup in definition list (code coverage)
20944 !! options
20945 language=zh variant=zh-cn
20946 !! wikitext
20947 ;<b>foo:bar
20948 ;-{zh-cn:AAA
20949 !! html/php
20950 <dl><dt><b>foo:bar</dt>
20951 <dt>-{zh-cn:AAA</b></dt></dl>
20952
20953 !! html/parsoid
20954 <dl>
20955 <dt><b>foo:bar</b></dt>
20956 <b>
20957 <dt>-{zh-cn</dt>
20958 <dd>AAA</dd>
20959 </b></dl>
20960 !! end
20961
20962 !! test
20963 T153135: Nested language converter markup in definition list (code coverage)
20964 !! options
20965 language=zh variant=zh-cn
20966 !! wikitext
20967 ;-{zh-cn:AAA -{zh-hans|foo:bar}- -{R|bat:baz}-}-:def
20968 !! html/php
20969 <dl><dt>AAA foo:bar bat:baz</dt>
20970 <dd>def</dd></dl>
20971
20972 !! html/parsoid
20973 <dl>
20974 <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>
20975 <dd>def</dd>
20976 </dl>
20977 !! end
20978
20979 !! test
20980 T153140: Don't break table handling if language converter markup is in the cell.
20981 !! options
20982 language=sr variant=sr-ec
20983 !! wikitext
20984 {|
20985 |-
20986 | -{R|B}-
20987 |}
20988 !! html/php
20989 <table>
20990
20991 <tr>
20992 <td> B
20993 </td></tr></table>
20994
20995 !! html/parsoid
20996 <table>
20997
20998 <tr>
20999 <td> B
21000 </td></tr></table>
21001
21002 !! end
21003
21004 !! test
21005 T2529: Uncovered bullet
21006 !! wikitext
21007 * Foo {{bullet}}
21008 !! html
21009 <ul><li> Foo </li>
21010 <li> Bar</li></ul>
21011
21012 !! end
21013
21014 # Plain MediaWiki does not remove empty lists, but tidy actually does.
21015 # Templates in Wikipedia rely on this behavior, as tidy has always been
21016 # enabled there. These tests are normally run *without* tidy, so specify the
21017 # full output here.
21018 # To test realistic parsing behavior, apply a tidy-like transformation to both
21019 # the expected output and your parser's output.
21020 !! test
21021 T2529: Uncovered bullet leaving empty list, normally removed by tidy
21022 !! wikitext
21023 ******* Foo {{bullet}}
21024 !! html
21025 <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>
21026 <li> Bar</li></ul>
21027
21028 !! end
21029
21030 !! test
21031 T2529: Uncovered table already at line-start
21032 !! wikitext
21033 x
21034
21035 {{table}}
21036 y
21037 !! html
21038 <p>x
21039 </p>
21040 <table>
21041 <tr>
21042 <td> 1 </td>
21043 <td> 2
21044 </td></tr>
21045 <tr>
21046 <td> 3 </td>
21047 <td> 4
21048 </td></tr></table>
21049 <p>y
21050 </p>
21051 !! end
21052
21053 !! test
21054 T2529: Uncovered bullet in parser function result
21055 !! wikitext
21056 * Foo {{lc:{{bullet}} }}
21057 !! html
21058 <ul><li> Foo </li>
21059 <li> bar</li></ul>
21060
21061 !! end
21062
21063 !! test
21064 T7678: Double-parsed template argument
21065 !! wikitext
21066 {{lc:{{{1}}}|hello}}
21067 !! html
21068 <p>{{{1}}}
21069 </p>
21070 !! end
21071
21072 !! test
21073 T7678: Double-parsed template invocation
21074 !! wikitext
21075 {{lc:{{paramtest {{!}} param = hello }} }}
21076 !! html
21077 <p>{{paramtest | param = hello }}
21078 </p>
21079 !! end
21080
21081 !! test
21082 Case insensitivity of parser functions for non-ASCII characters (T10143)
21083 !! options
21084 language=cs
21085 title=[[Main Page]]
21086 !! wikitext
21087 {{PRVNÍVELKÉ:ěščř}}
21088 {{prvnívelké:ěščř}}
21089 {{PRVNÍMALÉ:ěščř}}
21090 {{prvnímalé:ěščř}}
21091 {{MALÁ:ěščř}}
21092 {{malá:ěščř}}
21093 {{VELKÁ:ěščř}}
21094 {{velká:ěščř}}
21095 !! html
21096 <p>Ěščř
21097 Ěščř
21098 ěščř
21099 ěščř
21100 ěščř
21101 ěščř
21102 ĚŠČŘ
21103 ĚŠČŘ
21104 </p>
21105 !! end
21106
21107 !! test
21108 Morwen/13: Unclosed link followed by heading
21109 !! wikitext
21110 [[link
21111 ==heading==
21112 !! html
21113 <p>[[link
21114 </p>
21115 <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>
21116
21117 !! end
21118
21119 !! test
21120 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
21121 !! wikitext
21122 {{foo|
21123 =heading=
21124 !! html
21125 <p>{{foo|
21126 </p>
21127 <h1><span class="mw-headline" id="heading">heading</span></h1>
21128
21129 !! end
21130
21131 !! test
21132 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
21133 !! wikitext
21134 {{foo|
21135 ==heading==
21136 !! html
21137 <p>{{foo|
21138 </p>
21139 <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>
21140
21141 !! end
21142
21143 !! test
21144 Tildes in comments
21145 !! options
21146 pst
21147 !! wikitext
21148 <!-- ~~~~ -->
21149 !! html/php
21150 <!-- ~~~~ -->
21151 !! end
21152
21153 !! test
21154 Paragraphs inside divs (no extra line breaks)
21155 !! wikitext
21156 <div>Line one
21157
21158 Line two</div>
21159 !! html
21160 <div>Line one
21161 Line two</div>
21162
21163 !! end
21164
21165 !! test
21166 Paragraphs inside divs (extra line break on open)
21167 !! wikitext
21168 <div>
21169 Line one
21170
21171 Line two</div>
21172 !! html
21173 <div>
21174 <p>Line one
21175 </p>
21176 Line two</div>
21177
21178 !! end
21179
21180 !! test
21181 Paragraphs inside divs (extra line break on close)
21182 !! wikitext
21183 <div>Line one
21184
21185 Line two
21186 </div>
21187 !! html
21188 <div>Line one
21189 <p>Line two
21190 </p>
21191 </div>
21192
21193 !! end
21194
21195 !! test
21196 Paragraphs inside divs (extra line break on open and close)
21197 !! wikitext
21198 <div>
21199 Line one
21200
21201 Line two
21202 </div>
21203 !! html
21204 <div>
21205 <p>Line one
21206 </p><p>Line two
21207 </p>
21208 </div>
21209
21210 !! end
21211
21212 !! test
21213 Nesting tags, paragraphs on lines which begin with <div>
21214 !! wikitext
21215 <div></div><strong>A
21216 B</strong>
21217 !! html/php+tidy
21218 <p><strong>A</strong></p>
21219 <p><strong>B</strong></p>
21220 !! html/parsoid
21221 <div></div>
21222 <p><strong>A
21223 B</strong>
21224 </p>
21225 !! end
21226
21227 # T8200: <blockquote> should behave like <div> with respect to line breaks
21228 !! test
21229 T8200: paragraphs inside blockquotes (no extra line breaks)
21230 !! wikitext
21231 <blockquote>Line one
21232
21233 Line two</blockquote>
21234 !! html
21235 <blockquote>Line one
21236 Line two</blockquote>
21237
21238 !! html+tidy
21239 <blockquote>
21240 <p>Line one Line two</p>
21241 </blockquote>
21242 !! end
21243
21244 !! test
21245 T8200: paragraphs inside blockquotes (extra line break on open)
21246 !! wikitext
21247 <blockquote>
21248 Line one
21249
21250 Line two</blockquote>
21251 !! html
21252 <blockquote>
21253 <p>Line one
21254 </p>
21255 Line two</blockquote>
21256
21257 !! html+tidy
21258 <blockquote>
21259 <p>Line one</p>
21260 Line two</blockquote>
21261 !! end
21262
21263 !! test
21264 T8200: paragraphs inside blockquotes (extra line break on close)
21265 !! wikitext
21266 <blockquote>Line one
21267
21268 Line two
21269 </blockquote>
21270 !! html
21271 <blockquote>Line one
21272 <p>Line two
21273 </p>
21274 </blockquote>
21275
21276 !! html+tidy
21277 <blockquote>
21278 <p>Line one</p>
21279 <p>Line two</p>
21280 </blockquote>
21281 !! end
21282
21283 !! test
21284 T8200: paragraphs inside blockquotes (extra line break on open and close)
21285 !! wikitext
21286 <blockquote>
21287 Line one
21288
21289 Line two
21290 </blockquote>
21291 !! html
21292 <blockquote>
21293 <p>Line one
21294 </p><p>Line two
21295 </p>
21296 </blockquote>
21297
21298 !! html+tidy
21299 <blockquote>
21300 <p>Line one</p>
21301 <p>Line two</p>
21302 </blockquote>
21303 !! end
21304
21305 !! test
21306 Paragraphs inside blockquotes/divs (no extra line breaks)
21307 !! wikitext
21308 <blockquote><div>Line one
21309
21310 Line two</div></blockquote>
21311 !! html
21312 <blockquote><div>Line one
21313 Line two</div></blockquote>
21314
21315 !! end
21316
21317 !! test
21318 Paragraphs inside blockquotes/divs (extra line break on open)
21319 !! wikitext
21320 <blockquote><div>
21321 Line one
21322
21323 Line two</div></blockquote>
21324 !! html
21325 <blockquote><div>
21326 <p>Line one
21327 </p>
21328 Line two</div></blockquote>
21329
21330 !! end
21331
21332 !! test
21333 Paragraphs inside blockquotes/divs (extra line break on close)
21334 !! wikitext
21335 <blockquote><div>Line one
21336
21337 Line two
21338 </div></blockquote>
21339 !! html
21340 <blockquote><div>Line one
21341 <p>Line two
21342 </p>
21343 </div></blockquote>
21344
21345 !! end
21346
21347 !! test
21348 Paragraphs inside blockquotes/divs (extra line break on open and close)
21349 !! wikitext
21350 <blockquote><div>
21351 Line one
21352
21353 Line two
21354 </div></blockquote>
21355 !! html
21356 <blockquote><div>
21357 <p>Line one
21358 </p><p>Line two
21359 </p>
21360 </div></blockquote>
21361
21362 !! end
21363
21364 !! test
21365 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
21366 !! options
21367 wgLinkHolderBatchSize=0
21368 !! wikitext
21369 [[meatball:1]]
21370 [[meatball:2]]
21371 [[meatball:3]]
21372 !! html
21373 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
21374 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
21375 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
21376 </p>
21377 !! end
21378
21379 !! test
21380 Free external link invading image caption
21381 !! wikitext
21382 [[Image:Foobar.jpg|thumb|http://x|hello]]
21383 !! html
21384 <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>
21385
21386 !! end
21387
21388 !! test
21389 T17196: localised external link numbers
21390 !! options
21391 language=fa
21392 !! wikitext
21393 [http://en.wikipedia.org/]
21394 !! html/php
21395 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
21396 </p>
21397 !! html/parsoid
21398 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/"></a></p>
21399 !! end
21400
21401 !! test
21402 Multibyte character in padleft
21403 !! wikitext
21404 {{padleft:-Hello|7|Æ}}
21405 !! html
21406 <p>Æ-Hello
21407 </p>
21408 !! end
21409
21410 !! test
21411 Multibyte character in padright
21412 !! wikitext
21413 {{padright:Hello-|7|Æ}}
21414 !! html
21415 <p>Hello-Æ
21416 </p>
21417 !! end
21418
21419 !!test
21420 formatdate parser function
21421 !! wikitext
21422 {{#formatdate:2009-03-24}}
21423 !! html
21424 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
21425 </p>
21426 !! end
21427
21428 !!test
21429 formatdate parser function, with default format
21430 !! wikitext
21431 {{#formatdate:2009-03-24|mdy}}
21432 !! html
21433 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
21434 </p>
21435 !! end
21436
21437 !! test
21438 Spacing of numbers in formatted dates
21439 !! wikitext
21440 {{#formatdate:January 15}}
21441 !! html
21442 <p><span class="mw-formatted-date" title="01-15">January 15</span>
21443 </p>
21444 !! end
21445
21446 !! test
21447 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
21448 !! options
21449 language=nl title=[[MediaWiki:Common.css]]
21450 !! wikitext
21451 {{#formatdate:2009-03-24|dmy}}
21452 !! html
21453 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
21454 </p>
21455 !! end
21456
21457 #
21458 #
21459 #
21460
21461 #
21462 # Edit comments
21463 #
21464
21465 !! test
21466 Edit comment with link
21467 !! options
21468 comment
21469 !! wikitext
21470 I like the [[Main Page]] a lot
21471 !! html/php
21472 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
21473 !!end
21474
21475 !! test
21476 Edit comment with link and link text
21477 !! options
21478 comment
21479 !! wikitext
21480 I like the [[Main Page|best pages]] a lot
21481 !! html/php
21482 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
21483 !!end
21484
21485 !! test
21486 Edit comment with link and link text with suffix
21487 !! options
21488 comment
21489 !! wikitext
21490 I like the [[Main Page|best page]]s a lot
21491 !! html/php
21492 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
21493 !!end
21494
21495 !! test
21496 Edit comment with section link (non-local, eg in history list)
21497 !! options
21498 comment title=[[Main Page]]
21499 !! wikitext
21500 /* External links */ removed bogus entries
21501 !! html/php
21502 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
21503 !!end
21504
21505 !! test
21506 Edit comment with section link and text before it (non-local, eg in history list)
21507 !! options
21508 comment title=[[Main Page]]
21509 !! wikitext
21510 pre-comment text /* External links */ removed bogus entries
21511 !! html/php
21512 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>
21513 !!end
21514
21515 !! test
21516 Edit comment with section link (local, eg in diff view)
21517 !! options
21518 comment local title=[[Main Page]]
21519 !! wikitext
21520 /* External links */ removed bogus entries
21521 !! html/php
21522 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
21523 !!end
21524
21525 !! test
21526 Edit comment with subpage link (T16080)
21527 !! options
21528 comment
21529 subpage
21530 title=[[Subpage test]]
21531 !! wikitext
21532 Poked at a [[/subpage]] here...
21533 !! html/php
21534 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
21535 !!end
21536
21537 !! test
21538 Edit comment with subpage link and link text (T16080)
21539 !! options
21540 comment
21541 subpage
21542 title=[[Subpage test]]
21543 !! wikitext
21544 Poked at a [[/subpage|neat little page]] here...
21545 !! html/php
21546 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
21547 !!end
21548
21549 !! test
21550 Edit comment with bogus subpage link in non-subpage NS (T16080)
21551 !! options
21552 comment
21553 title=[[Subpage test]]
21554 !! wikitext
21555 Poked at a [[/subpage]] here...
21556 !! html/php
21557 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...
21558 !!end
21559
21560 !! test
21561 Edit comment with bare anchor link (local, as on diff)
21562 !! options
21563 comment
21564 local
21565 title=[[Main Page]]
21566 !! wikitext
21567 [[#section]]
21568 !! html/php
21569 <a href="#section">#section</a>
21570 !! end
21571
21572 !! test
21573 Edit comment with bare anchor link (non-local, as on history)
21574 !! options
21575 comment
21576 title=[[Main Page]]
21577 !! wikitext
21578 [[#section]]
21579 !! html/php
21580 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
21581 !! end
21582
21583 !! test
21584 Anchor starting with underscore
21585 !! options
21586 title=[[Foo]]
21587 !! wikitext
21588 [[#_ref|One]]
21589 !! html/php
21590 <p><a href="#_ref">One</a>
21591 </p>
21592 !! html/parsoid
21593 <p><a rel="mw:WikiLink" href="./Foo#_ref" data-parsoid='{"stx":"piped","a":{"href":"./Foo#_ref"},"sa":{"href":"#_ref"}}'>One</a></p>
21594 !! end
21595
21596 !! test
21597 Id starting with underscore
21598 !! wikitext
21599 <div id="_ref"></div>
21600 !! html/*
21601 <div id="_ref"></div>
21602
21603 !! end
21604
21605 !! test
21606 Edit comment with link with more than one pipe (T99346)
21607 !! options
21608 comment
21609 !! wikitext
21610 [[Main Page|Many|pipes]]
21611 !! html/php
21612 <a href="/wiki/Main_Page" title="Main Page">Many|pipes</a>
21613 !! end
21614
21615 !! test
21616 Complex edit comment with link with more than one pipe (T99346)
21617 !! options
21618 comment
21619 !! wikitext
21620 Created page with "<noinclude>[[Category:Requests for permissions/Bot|{{subst:#titleparts:{{subst:PAGENAME}}|1|3}}]]</noinclude> === [[User:MineoBot|]] 8=== {{Request for permissions/links|Mineo..."
21621 !! html/php
21622 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;
21623 !! end
21624
21625 !! test
21626 Space normalisation on autocomment (T24784)
21627 !! options
21628 comment
21629 title=[[Main Page]]
21630 !! wikitext
21631 /* __hello__world__ */
21632 !! html/php
21633 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
21634 !! end
21635
21636 !! test
21637 percent-encoding and + signs in comments (T28410)
21638 !! options
21639 comment
21640 !! wikitext
21641 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
21642 !! html/php
21643 <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>
21644 !! end
21645
21646 # Parsoid doesn't support this yet: see T75581
21647 # but it *should* omit the 'src' attribute if the image is bad.
21648 # PHP side of tests was disabled in
21649 # mediawiki/core:6bd31e7d95161a6e88fa86df60871051da997c3c
21650 # because of issues in the PHP parserTests infrastructure
21651 # (but the output below is indeed what the PHP side emits)
21652 !! test
21653 Bad images - basic functionality
21654 !! wikitext
21655 [[File:Bad.jpg]]
21656 !! DISABLED/html/php
21657 !! html/parsoid
21658 <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>
21659 !! end
21660
21661 !! test
21662 Bad images - T18039: text after bad image disappears
21663 !! wikitext
21664 Foo bar
21665 [[File:Bad.jpg]]
21666 Bar foo
21667 !! DISABLED/html/php
21668 <p>Foo bar
21669 </p><p>Bar foo
21670 </p>
21671 !! html/parsoid
21672 <p>Foo bar
21673 <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>
21674 Bar foo</p>
21675 !! end
21676
21677 !! test
21678 Verify that displaytitle works (T24501) no displaytitle
21679 !! options
21680 showtitle
21681 !! config
21682 wgAllowDisplayTitle=true
21683 wgRestrictDisplayTitle=false
21684 !! wikitext
21685 this is not the the title
21686 !! html/php
21687 Parser test
21688 <p>this is not the the title
21689 </p>
21690 !! end
21691
21692 !! test
21693 Verify that displaytitle works (T24501) RestrictDisplayTitle=false
21694 !! options
21695 showtitle
21696 title=[[Screen]]
21697 !! config
21698 wgAllowDisplayTitle=true
21699 wgRestrictDisplayTitle=false
21700 !! wikitext
21701 this is not the the title
21702 {{DISPLAYTITLE:whatever}}
21703 !! html/php
21704 whatever
21705 <p>this is not the the title
21706 </p>
21707 !! end
21708
21709 !! test
21710 Verify that displaytitle works (T24501) RestrictDisplayTitle=true mismatch
21711 !! options
21712 showtitle
21713 title=[[Screen]]
21714 !! config
21715 wgAllowDisplayTitle=true
21716 wgRestrictDisplayTitle=true
21717 !! wikitext
21718 this is not the the title
21719 {{DISPLAYTITLE:whatever}}
21720 !! html/php
21721 Screen
21722 <p>this is not the the title
21723 </p>
21724 !! end
21725
21726 !! test
21727 Verify that displaytitle works (T24501) RestrictDisplayTitle=true matching
21728 !! options
21729 showtitle
21730 title=[[Screen]]
21731 !! config
21732 wgAllowDisplayTitle=true
21733 wgRestrictDisplayTitle=true
21734 !! wikitext
21735 this is not the the title
21736 {{DISPLAYTITLE:screen}}
21737 !! html/php
21738 screen
21739 <p>this is not the the title
21740 </p>
21741 !! end
21742
21743 !! test
21744 Verify that displaytitle works (T24501) AllowDisplayTitle=false
21745 !! options
21746 showtitle
21747 title=[[Screen]]
21748 !! config
21749 wgAllowDisplayTitle=false
21750 !! wikitext
21751 this is not the the title
21752 {{DISPLAYTITLE:screen}}
21753 !! html/php
21754 Screen
21755 <p>this is not the the title
21756 <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>
21757 </p>
21758 !! end
21759
21760 !! test
21761 Verify that displaytitle works (T24501) AllowDisplayTitle=false no DISPLAYTITLE
21762 !! options
21763 showtitle
21764 title=[[Screen]]
21765 !! config
21766 wgAllowDisplayTitle=false
21767 !! wikitext
21768 this is not the the title
21769 !! html/php
21770 Screen
21771 <p>this is not the the title
21772 </p>
21773 !! end
21774
21775 !! test
21776 Verify that displaytitle handles inline CSS styles (T28547) - rejected value
21777 !! options
21778 showtitle
21779 title=[[Screen]]
21780 !! config
21781 wgAllowDisplayTitle=true
21782 wgRestrictDisplayTitle=true
21783 !! wikitext
21784 this is not the the title
21785 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
21786 !! html/php
21787 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
21788 <p>this is not the the title
21789 </p>
21790 !! end
21791
21792 !! test
21793 Verify that displaytitle handles inline CSS styles (T28547) - accepted value
21794 !! options
21795 showtitle
21796 title=[[Screen]]
21797 !! config
21798 wgAllowDisplayTitle=true
21799 wgRestrictDisplayTitle=true
21800 !! wikitext
21801 this is not the the title
21802 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
21803 !! html/php
21804 <span style="color: red;">s</span>creen
21805 <p>this is not the the title
21806 </p>
21807 !! end
21808
21809 !! test
21810 Page status indicators: Empty name is invalid
21811 !! options
21812 showindicators
21813 !! wikitext
21814 <indicator name=" "></indicator>
21815 <indicator></indicator>
21816 !! html
21817 <p><span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
21818 <span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
21819 </p>
21820 !! end
21821
21822 !! test
21823 Page status indicators: Weird syntaxes that are okay
21824 !! options
21825 showindicators
21826 !! wikitext
21827 <indicator name="empty" />
21828 <indicator name="name"></indicator>
21829 !! html
21830 empty=
21831 name=
21832 <p><br />
21833 </p>
21834 !! end
21835
21836 !! test
21837 Page status indicators: Torture test
21838 !! options
21839 showindicators
21840 !! wikitext
21841 <indicator name="01">hello world</indicator>
21842 <indicator name="02">[[Main Page]]</indicator>
21843 <indicator name="03">[[File:Foobar.jpg|25px|link=]]</indicator>
21844 <indicator name="04">[[File:Foobar.jpg|25px]]</indicator>
21845 <indicator name="05">* foo
21846 * bar</indicator>
21847 <indicator name="06"><nowiki>foo</nowiki></indicator>
21848 <indicator name="07"> Preformatted</indicator>
21849 <indicator name="08"><div>Broken tag</indicator>
21850 <indicator name="09">{| class=wikitable
21851 | cell
21852 |}</indicator>
21853 <indicator name="10">Two
21854
21855 paragraphs</indicator>
21856 !! html
21857 01=hello world
21858 02=<a href="/wiki/Main_Page" title="Main Page">Main Page</a>
21859 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" />
21860 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>
21861 05=<ul><li> foo</li>
21862 <li> bar</li></ul>
21863
21864 06=foo
21865 07=<pre>Preformatted
21866 </pre>
21867 08=<div>Broken tag</div>
21868
21869 09=<table class="wikitable">
21870 <tr>
21871 <td> cell
21872 </td></tr></table>
21873
21874 10=<p>Two
21875 </p><p>paragraphs
21876 </p>
21877 <p><br />
21878 </p><p><br />
21879 </p><p><br />
21880 </p><p><br />
21881 </p><p><br />
21882 </p>
21883 !! end
21884
21885 !! test
21886 preload: check <noinclude> and <includeonly>
21887 !! options
21888 preload
21889 !! wikitext
21890 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
21891 !! html/php
21892 Hello kind world.
21893 !! end
21894
21895 !! test
21896 preload: check <onlyinclude>
21897 !! options
21898 preload
21899 !! wikitext
21900 Goodbye <onlyinclude>Hello world</onlyinclude>
21901 !! html/php
21902 Hello world
21903 !! end
21904
21905 !! test
21906 preload: can pass tags through if we want to
21907 !! options
21908 preload
21909 !! wikitext
21910 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
21911 !! html/php
21912 <includeonly>Hello world</includeonly>
21913 !! end
21914
21915 !! test
21916 preload: check that it doesn't try to do tricks
21917 !! options
21918 preload
21919 !! wikitext
21920 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
21921 !! html/php
21922 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
21923 !! end
21924
21925 !! test
21926 Play a bit with r67090 and T5158
21927 !! wikitext
21928 <div style="width:50% !important">&nbsp;</div>
21929 <div style="width:50%&nbsp;!important">&nbsp;</div>
21930 <div style="width:50%&#160;!important">&nbsp;</div>
21931 <div style="border : solid;">&nbsp;</div>
21932 !! html/php
21933 <div style="width:50% !important">&#160;</div>
21934 <div style="width:50% !important">&#160;</div>
21935 <div style="width:50% !important">&#160;</div>
21936 <div style="border&#160;: solid;">&#160;</div>
21937
21938 !! html/parsoid
21939 <div style="width:50% !important" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
21940 <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>
21941 <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>
21942 <div style="border : solid;" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
21943
21944 !! end
21945
21946 !! test
21947 HTML5 data attributes
21948 !! wikitext
21949 <span data-foo="bar">Baz</span>
21950 <p data-abc-def_hij="">Quuz</p>
21951 !! html/php
21952 <p><span data-foo="bar">Baz</span>
21953 </p>
21954 <p data-abc-def_hij="">Quuz</p>
21955
21956 !! html/parsoid
21957 <p><span data-foo="bar" data-parsoid='{"stx":"html"}'>Baz</span></p>
21958 <p data-abc-def_hij="" data-parsoid='{"stx":"html"}'>Quuz</p>
21959 !! end
21960
21961 !! test
21962 Strip reserved data attributes
21963 !! wikitext
21964 <div data-mw="foo" data-parsoid="bar" data-mw-someext="baz" data-ok="fred" data-ooui="xyzzy" data-bad:ns="ns">d</div>
21965 !! html/php
21966 <div data-ok="fred">d</div>
21967
21968 !! html/parsoid
21969 <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>
21970 !! end
21971
21972 !! test
21973 percent-encoding and + signs in internal links (T28410)
21974 !! wikitext
21975 [[User:+%]] [[Page+title%]]
21976 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
21977 [[%]] [[+]] [[File:%+abc%39|foo|[[bar]]]]
21978 [[%33%45]] [[%33%45+]]
21979 !! html/php
21980 <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>
21981 <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>
21982 <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>
21983 <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>
21984 </p>
21985 !! html/parsoid
21986 <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>
21987 <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>
21988 <a rel="mw:WikiLink" href="./%25" title="%" data-parsoid='{"stx":"simple","a":{"href":"./%25"},"sa":{"href":"%"}}'>%</a> <a rel="mw:WikiLink" href="./+" title="+" data-parsoid='{"stx":"simple","a":{"href":"./+"},"sa":{"href":"+"}}'>+</a> <span class="mw-default-size" typeof="mw:Error mw:Image" data-parsoid='{"optList":[{"ck":"bogus","ak":"foo"},{"ck":"caption","ak":"[[bar]]"}]}' data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}],"caption":"&lt;a rel=\"mw:WikiLink\" href=\"./Bar\" title=\"Bar\" data-parsoid=&#39;{\"stx\":\"simple\",\"a\":{\"href\":\"./Bar\"},\"sa\":{\"href\":\"bar\"},\"dsr\":[94,101,2,2]}&#39;>bar&lt;/a>"}'><a href="./File:%25+abc9" data-parsoid='{"a":{"href":"./File:%25+abc9"},"sa":{}}'><img resource="./File:%25+abc9" src="./Special:FilePath/%25+abc9" height="220" width="220" data-parsoid='{"a":{"resource":"./File:%25+abc9","height":"220","width":"220"},"sa":{"resource":"File:%+abc%39"}}'/></a></span>
21989 <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>
21990 !! end
21991
21992 !! test
21993 Special characters in embedded file links (T29679)
21994 !! wikitext
21995 [[File:Contains & ampersand.jpg]]
21996 [[File:Does not exist.jpg|Title with & ampersand]]
21997 !! html/php
21998 <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>
21999 <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>
22000 </p>
22001 !! html/parsoid
22002 <p><span class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}]}'><a href="./File:Contains_&amp;_ampersand.jpg"><img resource="./File:Contains_&amp;_ampersand.jpg" src="./Special:FilePath/Contains_&amp;_ampersand.jpg" height="220" width="220"/></a></span>
22003 <span class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}],"caption":"Title with &amp;amp; ampersand"}'><a href="./File:Does_not_exist.jpg"><img resource="./File:Does_not_exist.jpg" src="./Special:FilePath/Does_not_exist.jpg" height="220" width="220"/></a></span></p>
22004 !! end
22005
22006 !! test
22007 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
22008 !! wikitext
22009 Text&apos;s been normalized?
22010 !! html
22011 <p>Text&#39;s been normalized?
22012 </p>
22013 !! end
22014
22015 !! test
22016 T21052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
22017 !! wikitext
22018 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
22019 !! html
22020 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
22021 </p>
22022 !! end
22023
22024 !! test
22025 T21052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
22026 !! wikitext
22027 [http://www.example.org/ ideograms]
22028 !! html
22029 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
22030 </p>
22031 !! end
22032
22033 !! test
22034 T21052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
22035 !! wikitext
22036 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
22037 !! html
22038 <p><img src="http://www.example.org/pic.png" alt="pic.png"/> &lt;-- U+3000 (vim: ^Vu3000)
22039 </p>
22040 !! end
22041
22042 !! article
22043 Mediawiki:loop1
22044 !! text
22045 {{Identical|A}}
22046 !! endarticle
22047
22048 !! article
22049 Mediawiki:loop2
22050 !! text
22051 {{Identical|B}}
22052 !! endarticle
22053
22054 !! article
22055 Template:Identical
22056 !! text
22057 {{int:loop1}}
22058 {{int:loop2}}
22059 !! endarticle
22060
22061 !! test
22062 T33098 Template which includes system messages which includes the template
22063 !! wikitext
22064 {{Identical}}
22065 !! html
22066 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
22067 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
22068 </p>
22069 !! end
22070
22071 !! test
22072 T33490 Turkish: ucfirst 'blah'
22073 !! options
22074 language=tr
22075 !! wikitext
22076 {{ucfirst:blah}}
22077 !! html
22078 <p>Blah
22079 </p>
22080 !! end
22081
22082 !! test
22083 T33490 Turkish: ucfirst 'ix'
22084 !! options
22085 language=tr
22086 !! wikitext
22087 {{ucfirst:ix}}
22088 !! html
22089 <p>İx
22090 </p>
22091 !! end
22092
22093 !! test
22094 T33490 Turkish: lcfirst 'BLAH'
22095 !! options
22096 language=tr
22097 !! wikitext
22098 {{lcfirst:BLAH}}
22099 !! html
22100 <p>bLAH
22101 </p>
22102 !! end
22103
22104 !! test
22105 T33490 Turkish: ucfırst (with a dotless i)
22106 !! options
22107 language=tr
22108 !! wikitext
22109 {{ucfırst:blah}}
22110 !! html
22111 <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>
22112 </p>
22113 !! end
22114
22115 !! test
22116 T33490 ucfırst (with a dotless i) with English language
22117 !! options
22118 language=en
22119 !! wikitext
22120 {{ucfırst:blah}}
22121 !! html
22122 <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>
22123 </p>
22124 !! end
22125
22126 !! test
22127 T28375: TOC with italics
22128 !! options
22129 title=[[Main Page]]
22130 !! wikitext
22131 __TOC__
22132 == ''Lost'' episodes ==
22133 !! html
22134 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
22135 <ul>
22136 <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>
22137 </ul>
22138 </div>
22139
22140 <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>
22141
22142 !! end
22143
22144 !! test
22145 T28375: TOC with bold
22146 !! options
22147 title=[[Main Page]]
22148 !! wikitext
22149 __TOC__
22150 == '''should be bold''' then normal text ==
22151 !! html
22152 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
22153 <ul>
22154 <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>
22155 </ul>
22156 </div>
22157
22158 <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>
22159
22160 !! end
22161
22162 !! test
22163 T35845: Headings become cursive in TOC when they contain an image
22164 !! options
22165 title=[[Main Page]]
22166 !! wikitext
22167 __TOC__
22168 == Image [[Image:foobar.jpg]] ==
22169 !! html
22170 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
22171 <ul>
22172 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
22173 </ul>
22174 </div>
22175
22176 <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>
22177
22178 !! end
22179
22180 !! test
22181 T35845 (2): Headings become bold in TOC when they contain a blockquote
22182 !! options
22183 title=[[Main Page]]
22184 !! wikitext
22185 __TOC__
22186 == <blockquote>Quote</blockquote> ==
22187 !! html
22188 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
22189 <ul>
22190 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
22191 </ul>
22192 </div>
22193
22194 <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>
22195
22196 !! html+tidy
22197 <p></p>
22198 <div id="toc" class="toc">
22199 <div id="toctitle">
22200 <h2>Contents</h2>
22201 </div>
22202 <ul>
22203 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
22204 </ul>
22205 </div>
22206 <p></p>
22207 <h2><span class="mw-headline" id="Quote"></span></h2>
22208 <blockquote>
22209 <p><span class="mw-headline" id="Quote">Quote</span></p>
22210 </blockquote>
22211 <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>
22212 !! end
22213
22214 !! test
22215 Unclosed tags in TOC
22216 !! options
22217 title=[[Main Page]]
22218 !! wikitext
22219 __TOC__
22220 == Proof: 2 < 3 ==
22221 <small>Hanc marginis exiguitas non caperet.</small>
22222 QED
22223 !! html
22224 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
22225 <ul>
22226 <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>
22227 </ul>
22228 </div>
22229
22230 <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>
22231 <p><small>Hanc marginis exiguitas non caperet.</small>
22232 QED
22233 </p>
22234 !! end
22235
22236 !! test
22237 Multiple tags in TOC
22238 !! wikitext
22239 __TOC__
22240 == <i>Foo</i> <b>Bar</b> ==
22241
22242 == <i>Foo</i> <blockquote>Bar</blockquote> ==
22243 !! html
22244 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
22245 <ul>
22246 <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>
22247 <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>
22248 </ul>
22249 </div>
22250
22251 <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>
22252 <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>
22253
22254 !! html+tidy
22255 <p></p>
22256 <div id="toc" class="toc">
22257 <div id="toctitle">
22258 <h2>Contents</h2>
22259 </div>
22260 <ul>
22261 <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>
22262 <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>
22263 </ul>
22264 </div>
22265 <p></p>
22266 <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>
22267 <h2><span class="mw-headline" id="Foo_Bar_2"><i>Foo</i></span></h2>
22268 <blockquote>
22269 <p><span class="mw-headline" id="Foo_Bar_2">Bar</span></p>
22270 </blockquote>
22271 <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>
22272 !! end
22273
22274 # Don't expect Parsoid to roundtrip this until the php parser comes closer to
22275 # html5 tag parsing.
22276 !! test
22277 Tags with parameters in TOC
22278 !! options
22279 parsoid=wt2html
22280 !! wikitext
22281 __TOC__
22282 == <sup class="in-h2">Hello</sup> ==
22283
22284 == <sup class="a > b">Evilbye</sup> ==
22285 !! html/php
22286 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
22287 <ul>
22288 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
22289 <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>
22290 </ul>
22291 </div>
22292
22293 <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>
22294 <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>
22295
22296 !! html/parsoid
22297 <meta property="mw:PageProp/toc" />
22298 <h2> <sup class="in-h2" data-parsoid='{"stx":"html"}'>Hello</sup> </h2>
22299
22300 <h2> <sup class="a " data-parsoid='{"stx":"html"}'> b">Evilbye</sup> </h2>
22301 !! end
22302
22303 !! test
22304 span tags with directionality in TOC
22305 !! wikitext
22306 __TOC__
22307 == <span dir="ltr">C++</span> ==
22308
22309 == <span dir="rtl">זבנג!</span> ==
22310
22311 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
22312
22313 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
22314
22315 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
22316 !! html
22317 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
22318 <ul>
22319 <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>
22320 <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>
22321 <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>
22322 <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>
22323 <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>
22324 </ul>
22325 </div>
22326
22327 <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>
22328 <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>
22329 <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>
22330 <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>
22331 <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>
22332
22333 !! end
22334
22335 !! test
22336 T74884: bdi element in ToC
22337 !! wikitext
22338 __TOC__
22339 == <bdi>test</bdi> ==
22340 !! html
22341 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
22342 <ul>
22343 <li class="toclevel-1 tocsection-1"><a href="#test"><span class="tocnumber">1</span> <span class="toctext"><bdi>test</bdi></span></a></li>
22344 </ul>
22345 </div>
22346
22347 <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>
22348
22349 !! end
22350
22351 !! test
22352 T35715: s/strike element in ToC
22353 !! wikitext
22354 __TOC__
22355 == <s>test</s> test <strike>test</strike> ==
22356 !! html
22357 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
22358 <ul>
22359 <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>
22360 </ul>
22361 </div>
22362
22363 <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>
22364
22365 !! end
22366
22367 # Note that the html output does not have the <p></p>, but the
22368 # html+tidy output *does*. This is because the empty <p></p> is
22369 # removed by the sanitizer, but only when tidy is *not* enabled (!).
22370 !! test
22371 Empty <p> tag in TOC, removed by Sanitizer (T92892)
22372 !! wikitext
22373 __TOC__
22374 == x ==
22375 !! html
22376 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
22377 <ul>
22378 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
22379 </ul>
22380 </div>
22381
22382 <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>
22383
22384 !! html+tidy
22385 <p></p>
22386 <div id="toc" class="toc">
22387 <div id="toctitle">
22388 <h2>Contents</h2>
22389 </div>
22390 <ul>
22391 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
22392 </ul>
22393 </div>
22394 <p></p>
22395 <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>
22396 !! end
22397
22398 !! article
22399 MediaWiki:T34057
22400 !! text
22401 == {{int:headline_sample}} ==
22402 !! endarticle
22403
22404 !! test
22405 T34057: Title needed when expanding <h> nodes.
22406 !! options
22407 title=[[Main Page]]
22408 !! wikitext
22409 {{int:T34057}}
22410 !! html
22411 <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>
22412
22413 !! end
22414
22415 !! test
22416 Strip marker in urlencode
22417 !! wikitext
22418 {{urlencode:x<nowiki/>y}}
22419 {{urlencode:x<nowiki/>y|wiki}}
22420 {{urlencode:x<nowiki/>y|path}}
22421 {{urlencode:x<pre id="one">two</pre>y}}
22422 !! html/php
22423 <p>xy
22424 xy
22425 xy
22426 xy
22427 </p>
22428 !! end
22429
22430 !! test
22431 Strip marker in lc
22432 !! wikitext
22433 {{lc:x<nowiki/>y}}
22434 !! html
22435 <p>xy
22436 </p>
22437 !! end
22438
22439 !! test
22440 Strip marker in uc
22441 !! wikitext
22442 {{uc:x<nowiki/>y}}
22443 !! html
22444 <p>XY
22445 </p>
22446 !! end
22447
22448 !! test
22449 Strip marker in formatNum
22450 !! wikitext
22451 {{formatnum:1<nowiki/>2}}
22452 {{formatnum:1<nowiki/>2|R}}
22453 !! html
22454 <p>12
22455 12
22456 </p>
22457 !! end
22458
22459 !! test
22460 Check noCommafy in formatNum
22461 !! options
22462 language=be-tarask
22463 !! wikitext
22464 {{formatnum:123456.78}}
22465 {{formatnum:123456.78|NOSEP}}
22466 !! html
22467 <p>123 456,78
22468 123456.78
22469 </p>
22470 !! end
22471
22472 !! test
22473 Wrong option for formatNum (T58199)
22474 !! wikitext
22475 {{formatnum:1,234.56|Random}}
22476 {{formatnum:1,234.56|EVERYTHING}}
22477 {{formatnum:1234.56|any argument that has the string 'NOSEP'}}
22478 !! html
22479 <p>1,234.56
22480 1,234.56
22481 1,234.56
22482 </p>
22483 !! end
22484
22485 !! test
22486 Strip marker in grammar
22487 !! options
22488 language=fi
22489 !! wikitext
22490 {{grammar:elative|foo<nowiki/>bar}}
22491 !! html
22492 <p>foobarista
22493 </p>
22494 !! end
22495
22496 !! test
22497 Strip marker in padleft
22498 !! wikitext
22499 {{padleft:|2|x<nowiki/>y}}
22500 !! html
22501 <p>xy
22502 </p>
22503 !! end
22504
22505 !! test
22506 Strip marker in padright
22507 !! wikitext
22508 {{padright:|2|x<nowiki/>y}}
22509 !! html
22510 <p>xy
22511 </p>
22512 !! end
22513
22514 !! test
22515 Strip marker in anchorencode
22516 !! wikitext
22517 {{anchorencode:x<nowiki/>y}}
22518 !! html
22519 <p>xy
22520 </p>
22521 !! end
22522
22523 !! test
22524 nowiki inside link inside heading (T20295)
22525 !! wikitext
22526 ==[[foo|x<nowiki>y</nowiki>z]]==
22527 !! html
22528 <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>
22529
22530 !! end
22531
22532 !! test
22533 new support for bdi element (T33817)
22534 !! wikitext
22535 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
22536 !! html
22537 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
22538
22539 !!end
22540
22541 !! test
22542 Ignore pipe between table row attributes
22543 !! wikitext
22544 {|
22545 | quux
22546 |- id=foo | style='color: red'
22547 | bar
22548 |}
22549 !! html
22550 <table>
22551 <tr>
22552 <td> quux
22553 </td></tr>
22554 <tr id="foo" style="color: red">
22555 <td> bar
22556 </td></tr></table>
22557
22558 !! end
22559
22560 !!test
22561 Language parser function
22562 !! wikitext
22563 {{#language:ar}}
22564 !! html
22565 <p>العربية
22566 </p>
22567 !! end
22568
22569 !!test
22570 Padleft and padright as substr
22571 !! wikitext
22572 {{padleft:|3|abcde}}
22573 {{padright:|3|abcde}}
22574 !! html
22575 <p>abc
22576 abc
22577 </p>
22578 !! end
22579
22580 !!test
22581 Special parser function
22582 !! wikitext
22583 {{#special:RandomPage}}
22584 {{#special:BaDtItLe}}
22585 {{#special:Foobar}}
22586 !! html
22587 <p>Special:Random
22588 Special:Badtitle
22589 Special:Foobar
22590 </p>
22591 !! end
22592
22593 !!test
22594 T36939 - Case insensitive link parsing ([HttP://])
22595 !! wikitext
22596 [HttP://MediaWiki.Org/]
22597 !! html/php
22598 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
22599 </p>
22600 !! html/parsoid
22601 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/"></a></p>
22602 !! end
22603
22604 !!test
22605 T36939 - Case insensitive link parsing ([HttP:// title])
22606 !! wikitext
22607 [HttP://MediaWiki.Org/ MediaWiki]
22608 !! html
22609 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
22610 </p>
22611 !! end
22612
22613 !!test
22614 T36939 - Case insensitive link parsing (HttP://)
22615 !! wikitext
22616 HttP://MediaWiki.Org/
22617 !! html/php
22618 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
22619 </p>
22620 !! html/parsoid
22621 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a></p>
22622 !! end
22623
22624 !!test
22625 Disable TOC
22626 !! options
22627 notoc
22628 !! wikitext
22629 Lead
22630 == Section 1 ==
22631 == Section 2 ==
22632 == Section 3 ==
22633 == Section 4 ==
22634 == Section 5 ==
22635 !! html
22636 <p>Lead
22637 </p>
22638
22639 <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>
22640 <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>
22641 <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>
22642 <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>
22643 <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>
22644
22645 !! end
22646
22647
22648 ###
22649 ### Parsoid-specific tests
22650 ### Parsoid-PHP parser incompatibilities
22651 ###
22652 !!test
22653 1. SOL-sensitive wikitext tokens as template-args
22654 !!options
22655 parsoid=wt2html,wt2wt
22656 !! wikitext
22657 {{echo|*a}}
22658 {{echo|#a}}
22659 {{echo|:a}}
22660 !! html
22661 <span about="#mwt1" typeof="mw:Transclusion">
22662 </span><ul about="#mwt1"><li>a</li>
22663 </ul>
22664 <span about="#mwt2" typeof="mw:Transclusion">
22665 </span><ol about="#mwt2"><li>a</li>
22666 </ol>
22667 <span about="#mwt3" typeof="mw:Transclusion">
22668 </span><dl about="#mwt3"><dd>a</dd>
22669 </dl>
22670 !!end
22671
22672 #### -----------------------------------------------------------------
22673 #### Parsoid-specific functionality tests
22674 #### -----------------------------------------------------------------
22675
22676 # T65642/T68749: Formatting elt fixup around images is cleaned up.
22677 # We know wt2wt will fail, but we expect selser to pass.
22678 # Due to the nature of our testing, wt2wt and selser tests will enter the
22679 # blacklist and we'll catch selser regressions based on changes to the
22680 # blacklist entries for selser tests.
22681 !! test
22682 1. Bad treebuilder fixup of formatting elt is cleaned up
22683 !! options
22684 parsoid=wt2html,wt2wt
22685 !! wikitext
22686 {|
22687 |
22688 <small>
22689 [[Image:Foobar.jpg|right|Test]]
22690 </small>
22691 |}
22692 !! html/parsoid
22693 <table>
22694 <tbody><tr><td>
22695 <small>
22696 <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>
22697 </small>
22698 </td></tr>
22699 </tbody></table>
22700 !! end
22701
22702 !! test
22703 2. Bad treebuilder fixup of formatting elt is cleaned up
22704 !! options
22705 parsoid=wt2html,wt2wt
22706 !! wikitext
22707 '''foo[[File:Foobar.jpg|thumb|caption]]bar'''
22708
22709 <small>[[Image:Foobar.jpg|right|300px]]</small>
22710 !! html/parsoid
22711
22712 <p><b>foo</b></p>
22713 <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>
22714 <p><b>bar</b></p>
22715 <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>
22716 !! end
22717
22718 !! test
22719 3. Bad treebuilder fixup of formatting elt is cleaned up
22720 !! options
22721 parsoid=wt2html,wt2wt
22722 !! wikitext
22723 <small>'''foo[[File:Foobar.jpg|thumb|caption]]bar'''</small>
22724 !! html/parsoid
22725 <p><small><b>foo</b></small></p>
22726 <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>
22727 <p><small><b>bar</b></small></p>
22728 !! end
22729
22730 !! test
22731 4. Bad treebuilder fixup of formatting elt is cleaned up: formatting tags around captionless images are ignored
22732 !! options
22733 parsoid=wt2html,wt2wt
22734 !! wikitext
22735 '''<small>[[Image:Foobar.jpg|right|300px]]</small>'''
22736 !! html/parsoid
22737 <p><b><small></small></b></p>
22738 <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>
22739 <p></p>
22740 !! end
22741
22742 #### ----------------------------------------------------------------
22743 #### Parsoid-only testing of Parsoid's impl of <ref> and <references>
22744 #### tags. Parsoid's output for these tags differs from that of the
22745 #### PHP parser.
22746 #### ----------------------------------------------------------------
22747
22748 !!test
22749 Ref: 1. ref-location should be replaced with an index span
22750 !! wikitext
22751 A <ref>foo</ref>
22752 B <ref name="x">foo</ref>
22753 C <ref name="y" />
22754 <references />
22755 !! html/parsoid
22756 <p>A <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>
22757 B <span about="#mwt4" class="mw-ref" id="cite_ref-x_2-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-x-2"},"attrs":{"name":"x"}}'><a href="./Main_Page#cite_note-x-2"><span class="mw-reflink-text">[2]</span></a></span>
22758 C <span about="#mwt6" class="mw-ref" id="cite_ref-y_3-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"y"}}'><a href="./Main_Page#cite_note-y-3"><span class="mw-reflink-text">[3]</span></a></span></p>
22759 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
22760 <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>
22761 <li about="#cite_note-x-2" id="cite_note-x-2"><a href="./Main_Page#cite_ref-x_2-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-x-2" class="mw-reference-text">foo</span></li>
22762 <li about="#cite_note-y-3" id="cite_note-y-3"><a href="./Main_Page#cite_ref-y_3-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-y-3" class="mw-reference-text"></span></li>
22763 </ol>
22764 !!end
22765
22766 !!test
22767 Ref: 2. ref-tags with identical names should all get the same index
22768 !! wikitext
22769 A <ref name="x">foo</ref>
22770 B <ref name="x" />
22771 <references />
22772 !! html/parsoid
22773 <p>A <span about="#mwt2" class="mw-ref" id="cite_ref-x_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-x-1"},"attrs":{"name":"x"}}'><a href="./Main_Page#cite_note-x-1"><span class="mw-reflink-text">[1]</span></a></span>
22774 B <span about="#mwt4" class="mw-ref" id="cite_ref-x_1-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"x"}}'><a href="./Main_Page#cite_note-x-1"><span class="mw-reflink-text">[1]</span></a></span></p>
22775 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
22776 <li about="#cite_note-x-1" id="cite_note-x-1"><span rel="mw:referencedBy"><a href="./Main_Page#cite_ref-x_1-0"><span class="mw-linkback-text">1 </span></a><a href="./Main_Page#cite_ref-x_1-1"><span class="mw-linkback-text">2 </span></a></span> <span id="mw-reference-text-cite_note-x-1" class="mw-reference-text">foo</span></li>
22777 </ol>
22778 !!end
22779
22780 !!test
22781 Ref: 3. spaces in ref-names should be ignored
22782 !! wikitext
22783 A <ref name="x">foo</ref>
22784 B <ref name=" x " />
22785 C <ref name= x />
22786 <references />
22787 !! html/parsoid
22788 <p>A <span about="#mwt2" class="mw-ref" id="cite_ref-x_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-x-1"},"attrs":{"name":"x"}}'><a href="./Main_Page#cite_note-x-1"><span class="mw-reflink-text">[1]</span></a></span>
22789 B <span about="#mwt4" class="mw-ref" id="cite_ref-x_1-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"x"}}'><a href="./Main_Page#cite_note-x-1"><span class="mw-reflink-text">[1]</span></a></span>
22790 C <span about="#mwt6" class="mw-ref" id="cite_ref-x_1-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"x"}}'><a href="./Main_Page#cite_note-x-1"><span class="mw-reflink-text">[1]</span></a></span></p>
22791 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
22792 <li about="#cite_note-x-1" id="cite_note-x-1"><span rel="mw:referencedBy"><a href="./Main_Page#cite_ref-x_1-0"><span class="mw-linkback-text">1 </span></a><a href="./Main_Page#cite_ref-x_1-1"><span class="mw-linkback-text">2 </span></a><a href="./Main_Page#cite_ref-x_1-2"><span class="mw-linkback-text">3 </span></a></span> <span id="mw-reference-text-cite_note-x-1" class="mw-reference-text">foo</span></li>
22793 </ol>
22794 !!end
22795
22796 # NOTE: constructor is a predefined property in JS and constructor as a ref-name can clash with it if not handled properly)
22797 !!test
22798 Ref: 4. 'constructor' should be accepted as a valid ref-name
22799 !! wikitext
22800 A <ref name="constructor">foo</ref>
22801 <references />
22802 !! html/parsoid
22803 <p>A <span about="#mwt2" class="mw-ref" id="cite_ref-constructor_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-constructor-1"},"attrs":{"name":"constructor"}}'><a href="./Main_Page#cite_note-constructor-1"><span class="mw-reflink-text">[1]</span></a></span></p>
22804 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22805 <li about="#cite_note-constructor-1" id="cite_note-constructor-1"><a href="./Main_Page#cite_ref-constructor_1-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-constructor-1" class="mw-reference-text">foo</span></li>
22806 </ol>
22807 !!end
22808
22809 !!test
22810 Ref: 5. body should accept generic wikitext
22811 !! wikitext
22812 A <ref>
22813 This is a '''[[bolded link]]''' and this is a {{echo|transclusion}}
22814 </ref>
22815
22816 <references />
22817 !! html/parsoid
22818 <p>A <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>
22819
22820 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
22821 <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">This is a <b><a rel="mw:WikiLink" href="./Bolded_link" title="Bolded link">bolded link</a></b> and this is a <span about="#mwt3" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"transclusion"}},"i":0}}]}'>transclusion</span>
22822 </span></li>
22823 </ol>
22824 !!end
22825
22826 !!test
22827 Ref: 6. indent-pres should not be output in ref-body
22828 !! wikitext
22829 A <ref>
22830 foo
22831 bar
22832 baz
22833 </ref>
22834
22835 <references />
22836 !! html/parsoid
22837 <p>A <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>
22838
22839 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22840 <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
22841 bar
22842 baz
22843 </span></li>
22844 </ol>
22845 !!end
22846
22847 !!test
22848 Ref: 7. No p-wrapping in ref-body
22849 !! wikitext
22850 A <ref>
22851 foo
22852
22853 bar
22854
22855
22856 baz
22857
22858
22859
22860 booz
22861 </ref>
22862
22863 <references />
22864 !! html/parsoid
22865 <p>A <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>
22866
22867 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22868 <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
22869
22870 bar
22871
22872
22873 baz
22874
22875
22876
22877 booz
22878 </span></li>
22879 </ol>
22880 !!end
22881
22882 !!test
22883 Ref: 8. transclusion wikitext has lower precedence
22884 !! wikitext
22885 A <ref> foo {{echo|</ref> B C}}
22886
22887 <references />
22888 !! html/parsoid
22889 <p>A <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> B C}}</p>
22890 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22891 <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 {{echo|</span></li>
22892 </ol>
22893 !!end
22894
22895 !!test
22896 Ref: 9. unclosed comments should not leak out of ref-body
22897 !! wikitext
22898 A <ref> foo <!--</ref> B C
22899 <references />
22900 !! html/parsoid
22901 <p>A <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> B C</p>
22902 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22903 <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>
22904 </ol>
22905 !!end
22906
22907 !!test
22908 Ref: 10. Unclosed HTML tags should not leak out of ref-body
22909 !! wikitext
22910 A <ref> <b> foo </ref> B C
22911
22912 <references />
22913 !! html/parsoid
22914 <p>A <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> B C</p>
22915
22916
22917 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22918 <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"><b data-parsoid='{"stx":"html","autoInsertedEnd":true}'> foo </b></span></li>
22919 </ol>
22920 !!end
22921
22922 !!test
22923 Ref: 11. ref-tags acts like an inline element wrt P-wrapping
22924 !! wikitext
22925 A <ref>foo</ref> B
22926 C <ref>bar</ref> D
22927 <references />
22928 !! html/parsoid
22929 <p>A <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> B
22930 C <span about="#mwt4" class="mw-ref" id="cite_ref-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-2"},"attrs":{}}'><a href="./Main_Page#cite_note-2"><span class="mw-reflink-text">[2]</span></a></span> D</p>
22931 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
22932 <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>
22933 <li about="#cite_note-2" id="cite_note-2"><a href="./Main_Page#cite_ref-2" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-2" class="mw-reference-text">bar</span></li>
22934 </ol>
22935 !!end
22936
22937 !!test
22938 Ref: 12. ref-tags act as trailing newline migration barrier
22939 !! wikitext
22940 <!--the newline at the end of this line moves out of the p tag-->a
22941
22942 b<!--the newline at the end of this line stays inside the p tag--> <ref />
22943 <ref />
22944
22945 c
22946 <references />
22947 !! html/parsoid
22948 <!--the newline at the end of this line moves out of the p tag--><p>a</p>
22949
22950
22951 <p>b<!--the newline at the end of this line stays inside the p tag--> <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{}}'><a href="./Main_Page#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span>
22952 <span about="#mwt4" class="mw-ref" id="cite_ref-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{}}'><a href="./Main_Page#cite_note-2"><span class="mw-reflink-text">[2]</span></a></span></p>
22953
22954 <p>c</p>
22955 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
22956 <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"></span></li>
22957 <li about="#cite_note-2" id="cite_note-2"><a href="./Main_Page#cite_ref-2" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-2" class="mw-reference-text"></span></li></ol>
22958 !!end
22959
22960 !!test
22961 Ref: 13. ref-tags are not SOL-transparent and block indent-pres
22962 !! wikitext
22963 <ref>foo</ref> A
22964 <ref>bar
22965 </ref> B
22966 <references />
22967 !! html/parsoid
22968 <p><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> A
22969 <span about="#mwt4" class="mw-ref" id="cite_ref-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-2"},"attrs":{}}'><a href="./Main_Page#cite_note-2"><span class="mw-reflink-text">[2]</span></a></span> B</p>
22970 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
22971 <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>
22972 <li about="#cite_note-2" id="cite_note-2"><a href="./Main_Page#cite_ref-2" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-2" class="mw-reference-text">bar
22973 </span></li>
22974 </ol>
22975 !!end
22976
22977 ## Roundtripping fails because of nowiki'ing
22978 !! test
22979 Ref: 14. A nested ref-tag should be emitted as plain text
22980 !! options
22981 parsoid=wt2html
22982 !! wikitext
22983 <ref>foo <ref>bar</ref> baz</ref>
22984
22985 <references />
22986 !! html/parsoid
22987 <p><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" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></span> baz&lt;/ref></p>
22988
22989 <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 &lt;ref>bar</span></li></ol>
22990 !! end
22991
22992 !!test
22993 Ref: 15. ref-tags with identical names should get identical indexes
22994 !! wikitext
22995 A1 <ref name="a">foo</ref> A2 <ref name="a" />
22996 B1 <ref name="b" /> B2 <ref name="b">bar</ref>
22997
22998 <references />
22999 !! html/parsoid
23000 <p>A1 <span about="#mwt3" class="mw-ref" id="cite_ref-a_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-a-1"},"attrs":{"name":"a"}}'><a href="./Main_Page#cite_note-a-1"><span class="mw-reflink-text">[1]</span></a></span> A2 <span about="#mwt4" class="mw-ref" id="cite_ref-a_1-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"a"}}'><a href="./Main_Page#cite_note-a-1"><span class="mw-reflink-text">[1]</span></a></span>
23001 B1 <span about="#mwt7" class="mw-ref" id="cite_ref-b_2-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"b"}}'><a href="./Main_Page#cite_note-b-2"><span class="mw-reflink-text">[2]</span></a></span> B2 <span about="#mwt8" class="mw-ref" id="cite_ref-b_2-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-b-2"},"attrs":{"name":"b"}}'><a href="./Main_Page#cite_note-b-2"><span class="mw-reflink-text">[2]</span></a></span></p>
23002
23003 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt10" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-a-1" id="cite_note-a-1"><span rel="mw:referencedBy"><a href="./Main_Page#cite_ref-a_1-0"><span class="mw-linkback-text">1 </span></a><a href="./Main_Page#cite_ref-a_1-1"><span class="mw-linkback-text">2 </span></a></span> <span id="mw-reference-text-cite_note-a-1" class="mw-reference-text">foo</span></li><li about="#cite_note-b-2" id="cite_note-b-2"><span rel="mw:referencedBy"><a href="./Main_Page#cite_ref-b_2-0"><span class="mw-linkback-text">1 </span></a><a href="./Main_Page#cite_ref-b_2-1"><span class="mw-linkback-text">2 </span></a></span> <span id="mw-reference-text-cite_note-b-2" class="mw-reference-text">bar</span></li>
23004 </ol>
23005 !!end
23006
23007 ## We don't bother wt2wt-ing non-standard whitespace
23008 !!test
23009 Ref: 16. Tokenizer should accept non-standard whitespace in <ref> and </ref> tags
23010 !!options
23011 parsoid=wt2html
23012 !! wikitext
23013 A <ref >foo</ref >
23014
23015 <references />
23016 !! html/parsoid
23017 <p>A <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>
23018 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
23019 <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>
23020 !!end
23021
23022 !!test
23023 Ref: 17. Generate valid HTML5 id/about attributes
23024 !!wikitext
23025 <ref name="a b">foo</ref>
23026 <ref name=":0">ve-created name</ref>
23027
23028 <references />
23029 !!html/parsoid
23030 <p><span about="#mwt2" class="mw-ref" id="cite_ref-a_b_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-a_b-1"},"attrs":{"name":"a b"}}'><a href="./Main_Page#cite_note-a_b-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></span>
23031 <span about="#mwt4" class="mw-ref" id="cite_ref-:0_2-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-:0-2"},"attrs":{"name":":0"}}'><a href="./Main_Page#cite_note-:0-2" style="counter-reset: mw-Ref 2;"><span class="mw-reflink-text">[2]</span></a></span>
23032
23033 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-a_b-1" id="cite_note-a_b-1"><a href="./Main_Page#cite_ref-a_b_1-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-a_b-1" class="mw-reference-text">foo</span></li><li about="#cite_note-:0-2" id="cite_note-:0-2"><a href="./Main_Page#cite_ref-:0_2-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-:0-2" class="mw-reference-text">ve-created name</span></li></ol>
23034
23035 !!end
23036
23037 !!test
23038 Ref: 18. T58916: Extension attributes should be parsed as plain text
23039 !!wikitext
23040 <ref name="{{echo|a}}">foo</ref>
23041
23042 <references />
23043 !!html/parsoid
23044 <p><span class="mw-ref" id="cite_ref-.7B.7Becho.7Ca.7D.7D_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-.7B.7Becho.7Ca.7D.7D-1"},"attrs":{"name":"{{echo|a}}"}}'><a href="./Main_Page#cite_note-.7B.7Becho.7Ca.7D.7D-1"><span class="mw-reflink-text">[1]</span></a></span>
23045 </p>
23046
23047 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
23048 <li about="#cite_note-.7B.7Becho.7Ca.7D.7D-1" id="cite_note-.7B.7Becho.7Ca.7D.7D-1"><a href="./Main_Page#cite_ref-.7B.7Becho.7Ca.7D.7D_1-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-.7B.7Becho.7Ca.7D.7D-1" class="mw-reference-text">foo</span></li>
23049 </ol>
23050 !!end
23051
23052 !!test
23053 Ref: 19. ref-tags with identical name encodings should get identical indexes
23054 !! wikitext
23055 1 <ref name="a & b">foo</ref> 2 <ref name="a &amp; b" />
23056
23057 <references />
23058 !! html/parsoid
23059 <p>1 <span about="#mwt3" class="mw-ref" id="cite_ref-a_.26_b_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-a_.26_b-1"},"attrs":{"name":"a &amp; b"}}'><a href="./Main_Page#cite_note-a_.26_b-1"><span class="mw-reflink-text">[1]</span></a></span> 2 <span about="#mwt4" class="mw-ref" id="cite_ref-a_.26_b_1-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"a &amp;amp; b"}}'><a href="./Main_Page#cite_note-a_.26_b-1"><span class="mw-reflink-text">[1]</span></a></span>
23060 </p>
23061 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
23062 <li about="#cite_note-a_.26_b-1" id="cite_note-a_.26_b-1"><span rel="mw:referencedBy"><a href="./Main_Page#cite_ref-a_.26_b_1-0"><span class="mw-linkback-text">1 </span></a><a href="./Main_Page#cite_ref-a_.26_b_1-1"><span class="mw-linkback-text">2 </span></a></span> <span id="mw-reference-text-cite_note-a_.26_b-1" class="mw-reference-text">foo</span></li>
23063 </ol>
23064 !!end
23065
23066 !!test
23067 Ref: 20. ref-tags with identical names but different content should keep it
23068 !! wikitext
23069 A <ref name="foo">Foo one</ref>
23070 B <ref name="foo">Foo two</ref>
23071 C <ref name="foo" />
23072
23073 <references />
23074 !! html/parsoid
23075 <p>A <span about="#mwt2" class="mw-ref" id="cite_ref-foo_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-foo-1"},"attrs":{"name":"foo"}}'><a href="./Main_Page#cite_note-foo-1"><span class="mw-reflink-text">[1]</span></a></span>
23076 B <span about="#mwt4" class="mw-ref" id="cite_ref-foo_1-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"Foo two"},"attrs":{"name":"foo"}}'><a href="./Main_Page#cite_note-foo-1"><span class="mw-reflink-text">[1]</span></a></span>
23077 C <span about="#mwt6" class="mw-ref" id="cite_ref-foo_1-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"foo"}}'><a href="./Main_Page#cite_note-foo-1"><span class="mw-reflink-text">[1]</span></a></span></p>
23078
23079 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-foo-1" id="cite_note-foo-1"><span rel="mw:referencedBy"><a href="./Main_Page#cite_ref-foo_1-0"><span class="mw-linkback-text">1 </span></a><a href="./Main_Page#cite_ref-foo_1-1"><span class="mw-linkback-text">2 </span></a><a href="./Main_Page#cite_ref-foo_1-2"><span class="mw-linkback-text">3 </span></a></span> <span id="mw-reference-text-cite_note-foo-1" class="mw-reference-text">Foo one</span></li>
23080 </ol>
23081 !!end
23082
23083 !!test
23084 References: 1. references tag without any refs should be handled properly
23085 !! wikitext
23086 <references />
23087 !! html/parsoid
23088 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
23089 !!end
23090
23091 !!test
23092 References: 2. references tag with group only outputs references from that group
23093 !! wikitext
23094 A <ref group="a">foo</ref>
23095 B <ref group="b">bar</ref>
23096 C <ref>baz</ref>
23097
23098 <references group="a" />
23099 <references />
23100 <references group="b" />
23101 !! html/parsoid
23102 <p>A <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":{"group":"a"}}'><a href="./Main_Page#cite_note-1" data-mw-group="a"><span class="mw-reflink-text">[a 1]</span></a></span>
23103 B <span about="#mwt4" class="mw-ref" id="cite_ref-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-2"},"attrs":{"group":"b"}}'><a href="./Main_Page#cite_note-2" data-mw-group="b"><span class="mw-reflink-text">[b 1]</span></a></span>
23104 C <span class="mw-ref" id="cite_ref-3" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-3"},"attrs":{}}'><a href="./Main_Page#cite_note-3"><span class="mw-reflink-text">[1]</span></a></span></p>
23105
23106 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw-group="a" data-mw='{"name":"references","attrs":{"group":"a"}}'>
23107 <li about="#cite_note-1" id="cite_note-1"><a href="./Main_Page#cite_ref-1" data-mw-group="a" 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>
23108 </ol>
23109 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt10" data-mw='{"name":"references","attrs":{}}'>
23110 <li about="#cite_note-3" id="cite_note-3"><a href="./Main_Page#cite_ref-3" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-3" class="mw-reference-text">baz</span></li>
23111 </ol>
23112 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt12" data-mw-group="b" data-mw='{"name":"references","attrs":{"group":"b"}}'>
23113 <li about="#cite_note-2" id="cite_note-2"><a href="./Main_Page#cite_ref-2" data-mw-group="b" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-2" class="mw-reference-text">bar</span></li>
23114 </ol>
23115 !!end
23116
23117 !!test
23118 References: 3. ref list should be cleared after processing references
23119 !! wikitext
23120 A <ref>foo</ref>
23121
23122 <references />
23123
23124 B <ref>bar</ref>
23125
23126 <references />
23127 !! html/parsoid
23128 <p>A <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>
23129
23130 <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>
23131 </ol>
23132
23133 <p>B <span about="#mwt6" class="mw-ref" id="cite_ref-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-2"},"attrs":{}}'><a href="./Main_Page#cite_note-2"><span class="mw-reflink-text">[1]</span></a></span></p>
23134
23135 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
23136 <li about="#cite_note-2" id="cite_note-2"><a href="./Main_Page#cite_ref-2" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-2" class="mw-reference-text">bar</span></li>
23137 </ol>
23138 !!end
23139
23140 !!test
23141 References: 4. only referenced group should be cleared after processing references
23142 !! wikitext
23143 A <ref group="a">afoo</ref>
23144 B <ref>bfoo</ref>
23145
23146 <references group="a" />
23147
23148 C <ref>cfoo</ref>
23149
23150 <references />
23151 !! html/parsoid
23152 <p>A <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":{"group":"a"}}'><a href="./Main_Page#cite_note-1" data-mw-group="a"><span class="mw-reflink-text">[a 1]</span></a></span>
23153 B <span about="#mwt4" class="mw-ref" id="cite_ref-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-2"},"attrs":{}}'><a href="./Main_Page#cite_note-2"><span class="mw-reflink-text">[1]</span></a></span></p>
23154
23155 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw-group="a" data-mw='{"name":"references","attrs":{"group":"a"}}'><li about="#cite_note-1" id="cite_note-1"><a href="./Main_Page#cite_ref-1" data-mw-group="a" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">afoo</span></li>
23156 </ol>
23157
23158 <p>C <span about="#mwt8" class="mw-ref" id="cite_ref-3" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-3"},"attrs":{}}'><a href="./Main_Page#cite_note-3"><span class="mw-reflink-text">[2]</span></a></span></p>
23159
23160 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt10" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-2" id="cite_note-2"><a href="./Main_Page#cite_ref-2" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-2" class="mw-reference-text">bfoo</span></li><li about="#cite_note-3" id="cite_note-3"><a href="./Main_Page#cite_ref-3" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-3" class="mw-reference-text">cfoo</span></li>
23161 </ol>
23162 !!end
23163
23164 ## Don't expect this to rt since we're dropping content
23165 !! test
23166 References: 5. ref tags in references should be processed while ignoring all other content
23167 !! options
23168 parsoid=wt2html,html2html
23169 !! wikitext
23170 A <ref name="a" />
23171 B <ref name="b">bar</ref>
23172
23173 <references>
23174 <ref name="a">foo</ref>
23175 This should just get lost.
23176 </references>
23177 !! html/parsoid
23178 <p>A <span about="#mwt2" class="mw-ref" id="cite_ref-a_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"a"}}'><a href="./Main_Page#cite_note-a-1"><span class="mw-reflink-text">[1]</span></a></span>
23179 B <span about="#mwt4" class="mw-ref" id="cite_ref-b_2-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-b-2"},"attrs":{"name":"b"}}'><a href="./Main_Page#cite_note-b-2"><span class="mw-reflink-text">[2]</span></a></span></p>
23180
23181
23182 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{},"body":{"html":"\n&lt;span about=\"#mwt8\" class=\"mw-ref\" rel=\"dc:references\" typeof=\"mw:Extension/ref\" data-parsoid=&#39;{\"dsr\":[59,82,14,6]}&#39; data-mw=&#39;{\"name\":\"ref\",\"body\":{\"id\":\"mw-reference-text-cite_note-a-1\"},\"attrs\":{\"name\":\"a\"}}&#39;>&lt;a href=\"./Main_Page#cite_note-a-1\" style=\"counter-reset: mw-Ref 1;\" data-parsoid=\"{}\">&lt;span class=\"mw-reflink-text\" data-parsoid=\"{}\">[1]&lt;/span>&lt;/a>&lt;/span>\n"}}'><li about="#cite_note-a-1" id="cite_note-a-1"><a href="./Main_Page#cite_ref-a_1-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-a-1" class="mw-reference-text">foo</span></li><li about="#cite_note-b-2" id="cite_note-b-2"><a href="./Main_Page#cite_ref-b_2-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-b-2" class="mw-reference-text">bar</span></li>
23183 </ol>
23184 !! end
23185
23186 !! test
23187 References: 6. <references /> from a transclusion
23188 !! wikitext
23189 <ref>Foo</ref> {{echo|<references />}}
23190 !! html/parsoid
23191 <p><span about="#mwt3" 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> <ol class="mw-references" typeof="mw:Extension/references mw:Transclusion" about="#mwt4" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;references />"}},"i":0}}]}'><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>
23192 </ol>
23193 !! end
23194
23195 !! test
23196 References: 7. Multiple references tags (one without and one with nested refs) should be correctly handled
23197 !! wikitext
23198 A <ref>foo bar for a</ref>
23199 B <ref group="X" name="b" />
23200
23201 <references />
23202
23203 <references group="X">
23204 <ref name="b">foo</ref>
23205 </references>
23206 !! html/parsoid
23207 <p>A <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>
23208 B <span about="#mwt4" class="mw-ref" id="cite_ref-b_2-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"group":"X","name":"b"}}'><a href="./Main_Page#cite_note-b-2" data-mw-group="X"><span class="mw-reflink-text">[X 1]</span></a></span>
23209 </p>
23210
23211 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
23212 <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 bar for a</span></li>
23213 </ol>
23214
23215 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw-group="X" data-mw='{"name":"references","attrs":{"group":"X"},"body":{"html":"\n&lt;span about=\"#mwt10\" class=\"mw-ref\" rel=\"dc:references\" typeof=\"mw:Extension/ref\" data-parsoid=&#39;{\"dsr\":[96,119,14,6]}&#39; data-mw=&#39;{\"name\":\"ref\",\"body\":{\"id\":\"mw-reference-text-cite_note-b-2\"},\"attrs\":{\"name\":\"b\"}}&#39;>&lt;a href=\"./Main_Page#cite_note-b-2\" style=\"counter-reset: mw-Ref 1;\" data-mw-group=\"X\" data-parsoid=\"{}\">&lt;span class=\"mw-reflink-text\" data-parsoid=\"{}\">[X 1]&lt;/span>&lt;/a>&lt;/span>\n"}}'>
23216 <li about="#cite_note-b-2" id="cite_note-b-2"><a href="./Main_Page#cite_ref-b_2-0" data-mw-group="X" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-b-2" class="mw-reference-text">foo</span></li>
23217 </ol>
23218 !! end
23219
23220 !! test
23221 References: 8. T88019: Remove <meta>s from templates inside <ref> that's itself inside a template
23222 !! wikitext
23223 X{{echo|<ref>foo {{echo|<b>bar</b>}} and {{echo|baz}} boo</ref>}}
23224 <references />
23225 !! html/parsoid
23226 <p>X<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":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;ref>foo {{echo|&lt;b>bar&lt;/b>}} and {{echo|baz}} boo&lt;/ref>"}},"i":0}}]}'><a href="./Main_Page#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span></p>
23227 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt7" 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 <b data-parsoid='{"stx":"html"}'>bar</b> and baz boo</span></li>
23228 </ol>
23229 !!end
23230
23231 # This test only works in wt2html now as the <references /> are always generated
23232 # unless selser is active. Once T72722 is fixed, we should add a changes test
23233 # here to ensure that unrelated changes don't add the new <references />
23234 # when selser is active.
23235 !! test
23236 References: 9. Generate missing references list at the end
23237 !! wikitext
23238 A <ref>foo</ref>
23239 B <ref group="inexistent">bar</ref>
23240 !! html/parsoid
23241 <p>A <span 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> B <span class="mw-ref" id="cite_ref-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-2"},"attrs":{"group":"inexistent"}}'><a href="./Main_Page#cite_note-2" data-mw-group="inexistent"><span class="mw-reflink-text">[inexistent 1]</span></a></span></p>
23242 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{},"autoGenerated":true}'>
23243 <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>
23244 </ol>
23245 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw-group="inexistent" data-mw='{"name":"references","attrs":{"group":"inexistent"},"autoGenerated":true}'>
23246 <li about="#cite_note-2" id="cite_note-2"><a href="./Main_Page#cite_ref-2" data-mw-group="inexistent" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-2" class="mw-reference-text">bar</span></li>
23247 </ol>
23248 !! end
23249
23250 !! test
23251 References: 10. New <references/> shouldn't be added for unrelated edits.
23252 !! options
23253 parsoid={
23254 "modes": ["selser"],
23255 "changes": [["#x", "remove"]],
23256 "selser": "noauto"
23257 }
23258 !! wikitext
23259 Unrelated text<span id="x"> that's going to disappear</span>.
23260 A <ref>foo</ref>
23261 !! wikitext/edited
23262 Unrelated text.
23263 A <ref>foo</ref>
23264 !!end
23265
23266 !! test
23267 Entities in ref name
23268 !! wikitext
23269 <ref name="test &amp; me">hi</ref>
23270 <references />
23271 !! html/parsoid
23272 <p><span about="#mwt2" class="mw-ref" id="cite_ref-test_.26_me_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-test_.26_me-1"},"attrs":{"name":"test &amp;amp; me"}}'><a href="./Main_Page#cite_note-test_.26_me-1"><span class="mw-reflink-text">[1]</span></a></span></p>
23273 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
23274 <li about="#cite_note-test_.26_me-1" id="cite_note-test_.26_me-1"><a href="./Main_Page#cite_ref-test_.26_me_1-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-test_.26_me-1" class="mw-reference-text">hi</span></li>
23275 </ol>
23276 !! end
23277
23278 ## The output here may look funny, but it's what the php parser will do. The
23279 ## unclosed references tag becomes escaped text, and then a new references
23280 ## tag is auto-generated. The test is wt2html only because it roundtrips with
23281 ## nowiki tags, and the auto-generated references tag is only dropped in
23282 ## rtTestMode.
23283 !! test
23284 Generate references for unclosed references tag
23285 !! options
23286 parsoid=wt2html
23287 !! wikitext
23288 a<ref>foo</ref>
23289
23290 <references>
23291 !! html/parsoid
23292 <p>a<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" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></span></p>
23293
23294 <p>&lt;references></p>
23295 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt3" data-mw='{"name":"references","attrs":{},"autoGenerated":true}'><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>
23296 !! end
23297
23298 !! test
23299 New reference serializes on its own line
23300 !! options
23301 parsoid=wt2wt,html2wt
23302 !! wikitext
23303 foo
23304 <references />
23305 !! html/parsoid
23306 foo<ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
23307 !! end
23308
23309 #### ----------------------------------------------------------------
23310 #### Parsoid-only testing of Parsoid's impl of LST
23311 #### Not implemented yet, see
23312 #### https://www.mediawiki.org/wiki/Parsoid/HTML_based_LST
23313 #### ----------------------------------------------------------------
23314
23315 ## We still need to support serializing the older format while content is stored.
23316 !! test
23317 LST Sections: Backwards compatibility
23318 !! options
23319 parsoid={
23320 "suppressErrors": true,
23321 "modes": ["html2wt"]
23322 }
23323 !! wikitext
23324 <section begin="2011-05-16" />
23325 <section end="2014-04-10 (MW 1.23wmf22)" />
23326 !! html/parsoid
23327 <p><meta typeof="mw:Extension/LabeledSectionTransclusion/begin" content="2011-05-16"/>
23328 <meta typeof="mw:Extension/LabeledSectionTransclusion/end" content="2014-04-10 (MW 1.23wmf22)"/></p>
23329 !! end
23330
23331 ## The unconventional output is the result of `usePHPPreProcessor` being
23332 ## disabled in parserTests.js. This test is mainly just to show <section> is
23333 ## recognized as an extension tag w/o a native handler.
23334 !! test
23335 LST Sections: Newfangled approach
23336 !! options
23337 parsoid={ "suppressErrors": true }
23338 !! wikitext
23339 <section begin="2011-05-16" />
23340 <section end="2014-04-10 (MW 1.23wmf22)" />
23341 !! html/parsoid
23342 <p><span typeof="mw:Extension/section" about="#mwt1" data-parsoid='{"stx":"html","selfClose":true,"src":"&lt;section begin=\"2011-05-16\" />","tagWidths":[30,0]}'>&lt;section begin="2011-05-16" /></span>
23343 <span typeof="mw:Extension/section" about="#mwt2" data-parsoid='{"stx":"html","selfClose":true,"src":"&lt;section end=\"2014-04-10 (MW 1.23wmf22)\" />","tagWidths":[43,0]}'>&lt;section end="2014-04-10 (MW 1.23wmf22)" /></span></p>
23344 !! end
23345
23346 #--------- Test stripping of empty nodes in template content ----------
23347 !!test
23348 Empty LI and TR nodes should be stripped from template content
23349 !!wikitext
23350 {{EmptyLITest}}
23351 {{EmptyTRTest}}
23352 !!html/parsoid
23353 <ul about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyLITest","href":"./Template:EmptyLITest"},"params":{},"i":0}}]}'>
23354 <li>a</li>
23355 <li>b</li>
23356 </ul>
23357 <table about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRTest","href":"./Template:EmptyTRTest"},"params":{},"i":0}}]}'>
23358 <tbody>
23359 <tr>
23360 <td>foo</td>
23361 </tr>
23362 <tr>
23363 <td>bar</td>
23364 </tr>
23365 </tbody>
23366 </table>
23367 !!end
23368
23369 !!test
23370 Empty LI and TR nodes should not be stripped from top-level content
23371 !!wikitext
23372 * a
23373 *
23374 * b
23375 {|
23376 |-
23377 |-
23378 |foo
23379 |}
23380 !!html/parsoid
23381 <ul>
23382 <li> a</li>
23383 <li></li>
23384 <li> b</li>
23385 </ul>
23386 <table>
23387 <tbody>
23388 <tr></tr>
23389 <tr>
23390 <td>foo</td>
23391 </tr>
23392 </tbody>
23393 </table>
23394 !!end
23395
23396 !!test
23397 Empty TR nodes should not be stripped if they have any attributes set
23398 !!wikitext
23399 {{EmptyTRWithHTMLAttrTest}}
23400 !!html/parsoid
23401 <table about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRWithHTMLAttrTest","href":"./Template:EmptyTRWithHTMLAttrTest"},"params":{},"i":0}}]}'>
23402 <tr align="center"></tr>
23403 <tr><td>foo</td></tr>
23404 <tr align="center"></tr>
23405 <tr><td>bar</td></tr>
23406 </table>
23407 !!end
23408
23409 #### ----------------------------------------------------------------
23410 #### The following section of tests are primarily to test
23411 #### wikitext escaping capabilities of Parsoid. Given that
23412 #### escaping can be done any number of ways, the wikitext (input)
23413 #### is always adjusted to reflect how Parsoid adds nowiki
23414 #### escape tags.
23415 ####
23416 #### We are marking several tests as parsoid-only since the
23417 #### HTML in the result section is different from what the
23418 #### PHP parser generates for it.
23419 #### ----------------------------------------------------------------
23420
23421
23422 #### --------------- Headings ---------------
23423 #### 0. Unnested
23424 #### 1. Nested inside html <h1>=foo=</h1>
23425 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
23426 #### 3. Nested inside html with wikitext split by html tags
23427 #### 4. No escape needed
23428 #### 5. Empty headings <h1></h1>
23429 #### 6. Heading chars in SOL context
23430 #### ----------------------------------------
23431 !! test
23432 Headings: 0. Unnested
23433 !! options
23434 parsoid=html2wt
23435 !! html/parsoid
23436 <p>=foo=</p>
23437
23438 <p> =foo=
23439 <!--cmt-->
23440 =foo=</p>
23441
23442 <p>=foo<i>a</i>=</p>
23443 !! wikitext
23444 <nowiki>=foo=</nowiki>
23445
23446 <nowiki> </nowiki>=foo=
23447 <!--cmt-->
23448 <nowiki>=foo=</nowiki>
23449
23450 =foo''a''<nowiki>=</nowiki>
23451 !!end
23452
23453 # New headings and existing headings are handled differently
23454 !! test
23455 Headings: 1. Nested inside html
23456 !! options
23457 parsoid=html2wt
23458 !! html/parsoid
23459 <h1>=foo=</h1>
23460 <h2>=foo=</h2>
23461 <h3>=foo=</h3>
23462
23463 <h1 data-parsoid=''>=foo=</h1>
23464 <h2 data-parsoid=''>=foo=</h2>
23465 <h3 data-parsoid=''>=foo=</h3>
23466 <h4 data-parsoid=''>=foo=</h4>
23467 <h5 data-parsoid=''>=foo=</h5>
23468 <h6 data-parsoid=''>=foo=</h6>
23469 !! wikitext
23470 = =foo= =
23471
23472 == =foo= ==
23473
23474 === =foo= ===
23475
23476 =<nowiki>=foo=</nowiki>=
23477 ==<nowiki>=foo=</nowiki>==
23478 ===<nowiki>=foo=</nowiki>===
23479 ====<nowiki>=foo=</nowiki>====
23480 =====<nowiki>=foo=</nowiki>=====
23481 ======<nowiki>=foo=</nowiki>======
23482
23483 !!end
23484
23485 !! test
23486 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
23487 !! options
23488 parsoid=html2wt
23489 !! html/parsoid
23490 <h1>foo</h1>*bar
23491 <h1>foo</h1>=bar
23492 <h1>foo</h1>=bar=
23493 !! wikitext
23494 = foo =
23495 <nowiki>*</nowiki>bar
23496
23497 = foo =
23498 =bar
23499
23500 = foo =
23501 <nowiki>=bar=</nowiki>
23502 !!end
23503
23504 !! test
23505 Headings: 3. Nested inside html with wikitext split by html tags
23506 !! options
23507 parsoid=html2wt
23508 !! html/parsoid
23509 <h1>=<b>bold</b>foo=</h1>
23510 !! wikitext
23511 = ='''bold'''foo= =
23512 !!end
23513
23514 !! test
23515 Headings: 4a. No escaping needed (testing just h1 and h2)
23516 !! options
23517 parsoid=html2wt
23518 !! html/parsoid
23519 <h1>=foo</h1>
23520 <h1>foo=</h1>
23521 <h1> =foo= </h1>
23522 <h1>=foo= bar</h1>
23523 <h2>=foo</h2>
23524 <h2>foo=</h2>
23525 <h1>=</h1>
23526 <h1><i>=</i>foo=</h1>
23527 !! wikitext
23528 = =foo =
23529
23530 = foo= =
23531
23532 = =foo= =
23533
23534 = =foo= bar =
23535
23536 == =foo ==
23537
23538 == foo= ==
23539
23540 = = =
23541
23542 = ''=''foo= =
23543 !!end
23544
23545 !! test
23546 Headings: 4b. No escaping needed (inside p-tags)
23547 !! options
23548 parsoid=html2wt
23549 !! html/parsoid
23550 <p>===
23551 =foo= x
23552 =foo= <s></s>
23553 </p>
23554 !! wikitext
23555 ===
23556 =foo= x
23557 =foo= <s></s>
23558 !!end
23559
23560 !! test
23561 Headings: 5. Empty headings
23562 !! options
23563 parsoid=html2wt
23564 !! html/parsoid
23565 <h1 data-parsoid='{}'></h1>
23566
23567 <h2 data-parsoid='{}'></h2>
23568
23569 <h3 data-parsoid='{}'></h3>
23570
23571 <h4 data-parsoid='{}'></h4>
23572
23573 <h5 data-parsoid='{}'></h5>
23574
23575 <h6 data-parsoid='{}'></h6>
23576 !! wikitext
23577 =<nowiki/>=
23578
23579 ==<nowiki/>==
23580
23581 ===<nowiki/>===
23582
23583 ====<nowiki/>====
23584
23585 =====<nowiki/>=====
23586
23587 ======<nowiki/>======
23588 !!end
23589
23590 !! test
23591 Headings: 6a. Heading chars in SOL context (with trailing spaces)
23592 !! options
23593 parsoid=html2wt
23594 !! html/parsoid
23595 <p>=a=</p>
23596
23597 <p>=a=</p>
23598
23599 <p>=a=</p>
23600 !! wikitext
23601 <nowiki>=a=</nowiki>
23602
23603 <nowiki>=a=</nowiki>
23604
23605 <nowiki>=a=</nowiki>
23606 !!end
23607
23608 !! test
23609 Headings: 6b. Heading chars in SOL context (with trailing newlines)
23610 !! options
23611 parsoid=html2wt
23612 !! html/parsoid
23613 <p>=a=
23614 b</p>
23615
23616 <p>=a=
23617 b</p>
23618
23619 <p>=a=
23620 b</p>
23621 !! wikitext
23622 <nowiki>=a=</nowiki>
23623 b
23624
23625 <nowiki>=a=</nowiki>
23626 b
23627
23628 <nowiki>=a=</nowiki>
23629 b
23630 !!end
23631
23632 !! test
23633 Headings: 6c. Heading chars in SOL context (leading newline break)
23634 !! options
23635 parsoid=html2wt
23636 !! html/parsoid
23637 <p>a
23638 =b=</p>
23639 !! wikitext
23640 a
23641 <nowiki>=b=</nowiki>
23642 !!end
23643
23644 !! test
23645 Headings: 6d. Heading chars in SOL context (with interspersed comments)
23646 !! options
23647 parsoid=html2wt
23648 !! html/parsoid
23649 <!--c0--><p>=a=</p>
23650
23651 <!--c1--><p>=a=</p> <!--c2--> <!--c3-->
23652 !! wikitext
23653 <!--c0--><nowiki>=a=</nowiki>
23654
23655 <!--c1--><nowiki>=a=</nowiki> <!--c2--> <!--c3-->
23656 !!end
23657
23658 !! test
23659 Headings: 6d. Heading chars in SOL context (No escaping needed)
23660 !! options
23661 parsoid=html2wt
23662 !! html/parsoid
23663 =a=<div>b</div>
23664 !! wikitext
23665 =a=<div>b</div>
23666 !!end
23667
23668 !! test
23669 Headings: 7. Insert a newline between new content and headings
23670 !! options
23671 parsoid=html2wt
23672 !! html/parsoid
23673 <h2>NEW</h2>
23674 <p>new</p>
23675 <h2 data-parsoid='{}'>A</h2>
23676 <p data-parsoid='{}'>a</p>
23677 !! wikitext
23678 == NEW ==
23679 new
23680
23681 ==A==
23682 a
23683
23684 !! end
23685
23686 #### --------------- Lists ---------------
23687 #### 0. Outside nests (*foo, etc.)
23688 #### 1. Nested inside html <ul><li>*foo</li></ul>
23689 #### 2. Inside definition lists
23690 #### 3. Only bullets at start should be escaped
23691 #### 4. No escapes needed
23692 #### 5. No unnecessary escapes
23693 #### 6. Escape bullets in SOL position
23694 #### 7. Escape bullets in a multi-line context
23695 #### ----------------------------------------
23696
23697 !! test
23698 Lists: 0. Outside nests
23699 !! options
23700 parsoid=html2wt
23701 !! html/parsoid
23702 <p>*foo</p>
23703
23704 <p>#foo</p>
23705
23706 <p>;Foo:bar</p>
23707 !! wikitext
23708 <nowiki>*</nowiki>foo
23709
23710 <nowiki>#</nowiki>foo
23711
23712 <nowiki>;</nowiki>Foo<nowiki>:</nowiki>bar
23713 !!end
23714
23715 ## Making these next 3 tests Parsoid-only since they are html2wt tests
23716 ## to test wikitext escaping, and insignificant whitespace diffs
23717 ## cause PHP parser tests to barf
23718 !! test
23719 Lists: 1. Nested inside html (No unnecessary escapes)
23720 !! options
23721 parsoid=html2wt
23722 !! html/parsoid
23723 <ul>
23724 <li>*foo</li>
23725 <li>#foo</li>
23726 <li>:foo</li>
23727 <li>;foo</li>
23728 <li data-parsoid='{}'>*foo</li>
23729 <li data-parsoid='{}'>#foo</li>
23730 <li data-parsoid='{}'>:foo</li>
23731 <li data-parsoid='{}'>;foo</li>
23732 </ul>
23733
23734 <ol>
23735 <li>*foo</li>
23736 <li>#foo</li>
23737 <li>:foo</li>
23738 <li>;foo</li>
23739 <li data-parsoid='{}'>*foo</li>
23740 <li data-parsoid='{}'>#foo</li>
23741 <li data-parsoid='{}'>:foo</li>
23742 <li data-parsoid='{}'>;foo</li>
23743 </ol>
23744 !! wikitext
23745 * *foo
23746 * #foo
23747 * :foo
23748 * ;foo
23749 *<nowiki>*foo</nowiki>
23750 *<nowiki>#foo</nowiki>
23751 *<nowiki>:foo</nowiki>
23752 *<nowiki>;foo</nowiki>
23753
23754 # *foo
23755 # #foo
23756 # :foo
23757 # ;foo
23758 #<nowiki>*foo</nowiki>
23759 #<nowiki>#foo</nowiki>
23760 #<nowiki>:foo</nowiki>
23761 #<nowiki>;foo</nowiki>
23762 !!end
23763
23764 !! test
23765 Lists: 2. Inside definition lists
23766 !! options
23767 parsoid=html2wt
23768 !! html/parsoid
23769 <dl><dt>;foo</dt></dl>
23770 <dl><dt>:foo</dt></dl>
23771 <dl><dt>:foo</dt>
23772 <dd>bar</dd></dl>
23773 <dl><dd>:foo</dd></dl>
23774 !! wikitext
23775 ; ;foo
23776
23777 ; <nowiki>:foo</nowiki>
23778
23779 ; <nowiki>:foo</nowiki>
23780 : bar
23781
23782 : :foo
23783 !!end
23784
23785 !! test
23786 Lists: 3. Only bullets at start of text in wikitext-generated HTML should be escaped
23787 !! options
23788 parsoid=html2wt
23789 !! html/parsoid
23790 <ul>
23791 <li>*foo*bar</li>
23792 <li data-parsoid='{}'>*foo<i>it</i>*bar</li>
23793 </ul>
23794 !! wikitext
23795 * *foo*bar
23796 *<nowiki>*foo</nowiki>''it''*bar
23797 !!end
23798
23799 !! test
23800 Lists: 4. No escapes needed
23801 !! options
23802 parsoid=html2wt
23803 !! html/parsoid
23804 <ul>
23805 <li>foo*bar
23806 </li>
23807 </ul>
23808 <ul>
23809 <li><i>foo</i>*bar
23810 </li>
23811 </ul>
23812 <ul>
23813 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>: bar
23814 </li>
23815 </ul>
23816 <ul>
23817 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>*bar
23818 </li>
23819 </ul>
23820 !! wikitext
23821 *foo*bar
23822
23823 *''foo''*bar
23824
23825 *[[Foo]]: bar
23826
23827 *[[Foo]]*bar
23828 !!end
23829
23830 !! test
23831 Lists: 5. No unnecessary escapes
23832 !! options
23833 parsoid=html2wt
23834 !! html/parsoid
23835 <ul><li> bar <span>[[foo]]</span></li></ul>
23836 <ul><li> =bar <span>[[foo]]</span></li></ul>
23837 <ul><li> [[bar <span>[[foo]]</span></li></ul>
23838 <ul><li> ]]bar <span>[[foo]]</span></li></ul>
23839 <ul><li> =bar <span>foo]]</span>=</li></ul>
23840 <ul><li> <s></s>: a</li></ul>
23841 <ul><li> <i>* foo</i></li></ul>
23842
23843 !! wikitext
23844 * bar <span><nowiki>[[foo]]</nowiki></span>
23845
23846 * =bar <span><nowiki>[[foo]]</nowiki></span>
23847
23848 * [[bar <span><nowiki>[[foo]]</nowiki></span>
23849
23850 * ]]bar <span><nowiki>[[foo]]</nowiki></span>
23851
23852 * =bar <span>foo]]</span>=
23853
23854 * <s></s>: a
23855
23856 * ''* foo''
23857 !!end
23858
23859 !! test
23860 Lists: 6. Escape bullets in SOL position
23861 !! options
23862 parsoid=html2wt
23863 !! html/parsoid
23864 <p><!--cmt-->*foo</p>
23865 !! wikitext
23866 <!--cmt--><nowiki>*</nowiki>foo
23867 !!end
23868
23869 !! test
23870 Lists: 7. Escape bullets in a multi-line context
23871 !! options
23872 parsoid=html2wt
23873 !! html/parsoid
23874 <p>a
23875 *b
23876 </p>
23877 !! wikitext
23878 a
23879 <nowiki>*</nowiki>b
23880 !!end
23881
23882 !! test
23883 Lists: 8. Escape colons only if not present in tags
23884 !! options
23885 parsoid=html2wt
23886 !! html/parsoid
23887 <dl><dt>a:b<i>c:d</i></dt></dl>
23888 !! wikitext
23889 ; <nowiki>a:b</nowiki>''c:d''
23890 !! end
23891
23892 #### --------------- HRs ---------------
23893 #### 1. Single line
23894 #### -----------------------------------
23895
23896 !! test
23897 HRs: 1. Single line
23898 !! options
23899 parsoid=html2wt
23900 !! html/parsoid
23901 <hr />----
23902 <hr />=foo=
23903 <hr />*foo
23904 !! wikitext
23905 ----<nowiki>----</nowiki>
23906 ----=foo=
23907 ----*foo
23908 !! end
23909
23910 #### --------------- Tables ---------------
23911 #### 1a. Simple example
23912 #### 1b. No escaping needed (!foo)
23913 #### 1c. No escaping needed (|foo)
23914 #### 1d. No escaping needed (|}foo)
23915 ####
23916 #### 2a. Nested in td (<td>foo|bar</td>)
23917 #### 2b. Nested in td (<td>foo||bar</td>)
23918 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
23919 ####
23920 #### 3a. Nested in th (<th>foo!bar</th>)
23921 #### 3b. Nested in th (<th>foo!!bar</th>)
23922 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
23923 ####
23924 #### 4a. Escape -
23925 #### 4b. Escape +
23926 #### 4c. No escaping needed
23927 #### --------------------------------------
23928
23929 !! test
23930 Tables: 1a. Simple example
23931 !! options
23932 parsoid=html2wt
23933 !! html/parsoid
23934 <p>{|
23935 |}
23936 </p>
23937 !! wikitext
23938 <nowiki>{|</nowiki>
23939 |}
23940 !! end
23941
23942 !! test
23943 Tables: 1b. No escaping needed
23944 !! options
23945 parsoid=html2wt
23946 !! html/parsoid
23947 <p>!foo
23948 </p>
23949 !! wikitext
23950 !foo
23951 !! end
23952
23953 !! test
23954 Tables: 1c. No escaping needed
23955 !! options
23956 parsoid=html2wt
23957 !! html/parsoid
23958 <p>|foo
23959 </p>
23960 !! wikitext
23961 |foo
23962 !! end
23963
23964 !! test
23965 Tables: 1d. No escaping needed
23966 !! options
23967 parsoid=html2wt
23968 !! html/parsoid
23969 <p>|}foo
23970 </p>
23971 !! wikitext
23972 |}foo
23973 !! end
23974
23975 !! test
23976 Tables: 2a. Nested in td
23977 !! options
23978 parsoid=html2wt
23979 !! html/parsoid
23980 <table><tbody><tr>
23981 <td>foo|bar</td></tr>
23982 <tr><td>x<div>a|b</div></td>
23983 </tbody></table>
23984 !! wikitext
23985 {|
23986 |<nowiki>foo|bar</nowiki>
23987 |-
23988 |x<div><nowiki>a|b</nowiki></div>
23989 |}
23990 !! html/php+tidy
23991 <table>
23992 <tr>
23993 <td>foo|bar</td>
23994 </tr>
23995 <tr>
23996 <td>x
23997 <div>a|b</div>
23998 </td>
23999 </tr>
24000 </table>
24001 !! end
24002
24003 !! test
24004 Tables: 2b. Nested in td
24005 !! options
24006 parsoid=html2wt
24007 !! html/parsoid
24008 <table><tbody><tr>
24009 <td>foo||bar</td>
24010 <td>a<i>b||c</i></td>
24011 <td>a<i><div>b||c</div></i></td>
24012 </tr></tbody></table>
24013 !! wikitext
24014 {|
24015 |<nowiki>foo||bar</nowiki>
24016 |a''<nowiki>b||c</nowiki>''
24017 |a''<div><nowiki>b||c</nowiki></div>''
24018 |}
24019 !! html/php
24020 <table>
24021 <tr>
24022 <td>foo||bar
24023 </td>
24024 <td>a<i>b||c</i>
24025 </td>
24026 <td>a<i><div>b||c</div></i>
24027 </td></tr></table>
24028
24029 !! end
24030
24031 !! test
24032 Tables: 2c. Nested in td -- no escaping needed
24033 !! options
24034 parsoid=html2wt
24035 !! html/*
24036 <table>
24037 <tr>
24038 <td>foo!!bar
24039 </td></tr></table>
24040
24041 !! wikitext
24042 {|
24043 |foo!!bar
24044 |}
24045 !! end
24046
24047 !! test
24048 Tables: 3a. Nested in th
24049 !! options
24050 parsoid=html2wt
24051 !! html/*
24052 <table>
24053 <tr>
24054 <th>foo!bar
24055 </th></tr></table>
24056
24057 !! wikitext
24058 {|
24059 !foo!bar
24060 |}
24061 !! end
24062
24063 !! test
24064 Tables: 3b. Nested in th
24065 !! options
24066 parsoid=html2wt
24067 !! html/parsoid
24068 <table><tbody>
24069 <tr><th>foo!!bar</th>
24070 <th><i>foo|bar</i></th>
24071 <th><i>foo!!bar</i></th>
24072 <th><i><span>foo!!bar</span></i></th>
24073 </tr></tbody></table>
24074 !! wikitext
24075 {|
24076 !<nowiki>foo!!bar</nowiki>
24077 !''<nowiki>foo|bar</nowiki>''
24078 !''<nowiki>foo!!bar</nowiki>''
24079 !''<span><nowiki>foo!!bar</nowiki></span>''
24080 |}
24081 !! html/php
24082 <table>
24083 <tr>
24084 <th>foo!!bar
24085 </th>
24086 <th><i>foo|bar</i>
24087 </th>
24088 <th><i>foo!!bar</i>
24089 </th>
24090 <th><i><span>foo!!bar</span></i>
24091 </th></tr></table>
24092
24093 !! end
24094
24095 !! test
24096 Tables: 3c. Nested in th
24097 !! options
24098 parsoid=html2wt
24099 !! html/parsoid
24100 <table><tbody>
24101 <tr><th>foo||bar</th>
24102 <th><span typeof="mw:Nowiki">foo||bar</span></th>
24103 </tr></tbody></table>
24104 !! wikitext
24105 {|
24106 !<nowiki>foo||bar</nowiki>
24107 !<nowiki>foo||bar</nowiki>
24108 |}
24109 !! html/php
24110 <table>
24111 <tr>
24112 <th>foo||bar
24113 </th>
24114 <th>foo||bar
24115 </th></tr></table>
24116
24117 !! end
24118
24119 !! test
24120 Tables: 4a. Escape -
24121 !! options
24122 parsoid=html2wt
24123 !! html/*
24124 <table>
24125 <tr>
24126 <th>-bar
24127 </th></tr>
24128 <tr>
24129 <td>-bar
24130 </td></tr></table>
24131
24132 !! wikitext
24133 {|
24134 !-bar
24135 |-
24136 |<nowiki>-bar</nowiki>
24137 |}
24138 !! end
24139
24140 !! test
24141 Tables: 4b. Escape +
24142 !! options
24143 parsoid=html2wt
24144 !! html/*
24145 <table>
24146 <tr>
24147 <th>+bar
24148 </th></tr>
24149 <tr>
24150 <td>+bar
24151 </td></tr></table>
24152
24153 !! wikitext
24154 {|
24155 !+bar
24156 |-
24157 |<nowiki>+bar</nowiki>
24158 |}
24159 !! end
24160
24161 !! test
24162 Tables: 4c. No escaping needed
24163 !! options
24164 parsoid=html2wt
24165 !! html/parsoid
24166 <table><tbody>
24167 <tr><td>foo-bar</td><td>foo+bar</td></tr>
24168 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
24169 <tr><td>foo
24170 <p>bar|baz
24171 +bar
24172 -bar</p></td></tr>
24173 <tr><td>x
24174 <div>a|b</div></td>
24175 </tbody></table>
24176 !! wikitext
24177 {|
24178 |foo-bar
24179 |foo+bar
24180 |-
24181 |''foo''-bar
24182 |''foo''+bar
24183 |-
24184 |foo
24185 bar|baz
24186 +bar
24187 -bar
24188 |-
24189 |x
24190 <div>a|b</div>
24191 |}
24192 !! html/php
24193 <table>
24194 <tr>
24195 <td>foo-bar
24196 </td>
24197 <td>foo+bar
24198 </td></tr>
24199 <tr>
24200 <td><i>foo</i>-bar
24201 </td>
24202 <td><i>foo</i>+bar
24203 </td></tr>
24204 <tr>
24205 <td>foo
24206 <p>bar|baz
24207 +bar
24208 -bar
24209 </p>
24210 </td></tr>
24211 <tr>
24212 <td>x
24213 <div>a|b</div>
24214 </td></tr></table>
24215
24216 !! end
24217
24218 !! test
24219 Tables: 4d. No escaping needed
24220 !! options
24221 parsoid=html2wt
24222 !! html/parsoid
24223 <table>
24224 <tbody><tr><td><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>-bar</td>
24225 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>+1</td>
24226 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>-2</td></tr>
24227 </tbody></table>
24228 !! wikitext
24229 {|
24230 |[[Foo]]-bar
24231 ||+1
24232 ||-2
24233 |}
24234 !! html/php
24235 <table>
24236 <tr>
24237 <td><a href="/wiki/Foo" title="Foo">Foo</a>-bar
24238 </td>
24239 <td>+1
24240 </td>
24241 <td>-2
24242 </td></tr></table>
24243
24244 !! end
24245
24246 !! test
24247 T97430: Don't emit empty nowiki pairs around marker meta tags
24248 !! options
24249 parsoid=html2wt
24250 !! html/parsoid
24251 <p>*This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
24252 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.</p>
24253 !! wikitext
24254 <nowiki>*</nowiki>This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
24255 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.
24256 !! end
24257
24258 !! test
24259 Unclosed xmlish element in table line shouldn't eat end delimiters
24260 !! options
24261 parsoid=html2wt
24262 !! html/parsoid
24263 <table>
24264 <tbody><tr><td> &lt;foo</td>
24265 <td> bar></td></tr>
24266 </tbody></table>
24267 !! wikitext
24268 {|
24269 | <foo
24270 | bar>
24271 |}
24272 !! html/php
24273 <table>
24274 <tr>
24275 <td> &lt;foo
24276 </td>
24277 <td> bar&gt;
24278 </td></tr></table>
24279
24280 !! end
24281
24282 #### --------------- Links ----------------
24283 #### 1. Quote marks in link text
24284 #### 2. Wikilinks: Escapes needed
24285 #### 3. Wikilinks: No escapes needed
24286 #### 4. Extlinks: Escapes needed
24287 #### 5. Extlinks: No escapes needed
24288 #### --------------------------------------
24289 !! test
24290 Links 1. WikiLinks: No escapes needed
24291 !! options
24292 parsoid=html2wt
24293 !! html/parsoid
24294 <p><a rel="mw:WikiLink" href="Foo" title="Foo">Foo<i>boo</i></a>
24295 <a rel="mw:WikiLink" href="Foo" title="Foo">[Foobar]</a>
24296 <a rel="mw:WikiLink" href="Foo" title="Foo">x [Foobar] x</a></p>
24297 !! wikitext
24298 [[Foo|Foo''boo'']]
24299 [[Foo|[Foobar]]]
24300 [[Foo|x [Foobar] x]]
24301 !! html/php
24302 <p><a href="/wiki/Foo" title="Foo">Foo<i>boo</i></a>
24303 <a href="/wiki/Foo" title="Foo">[Foobar]</a>
24304 <a href="/wiki/Foo" title="Foo">x [Foobar] x</a>
24305 </p>
24306 !! end
24307
24308 !! test
24309 Links 2. WikiLinks: Escapes needed
24310 !! options
24311 parsoid=html2wt
24312 !! html/parsoid
24313 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
24314 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
24315 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
24316 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
24317 <a href="Foo" rel="mw:WikiLink">|Bar</a>
24318 <a href="Foo" rel="mw:WikiLink">]]bar</a>
24319 <a href="Foo" rel="mw:WikiLink">[[bar</a>
24320 <a href="Foo" rel="mw:WikiLink">x [[ y</a>
24321 <a href="Foo" rel="mw:WikiLink">x ]] y</a>
24322 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
24323 !! wikitext
24324 [[Foo|<nowiki>Foobar]</nowiki>]]
24325 [[Foo|x <nowiki>[http://google.com g]</nowiki> x]]
24326 [[Foo|<nowiki>[[Bar]]</nowiki>]]
24327 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
24328 [[Foo|<nowiki>|Bar</nowiki>]]
24329 [[Foo|<nowiki>]]bar</nowiki>]]
24330 [[Foo|<nowiki>[[bar</nowiki>]]
24331 [[Foo|<nowiki>x [[ y</nowiki>]]
24332 [[Foo|<nowiki>x ]] y</nowiki>]]
24333 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
24334 !! html/php
24335 <p><a href="/wiki/Foo" title="Foo">Foobar]</a>
24336 <a href="/wiki/Foo" title="Foo">x [http://google.com g] x</a>
24337 <a href="/wiki/Foo" title="Foo">[[Bar]]</a>
24338 <a href="/wiki/Foo" title="Foo">x [[Bar]] x</a>
24339 <a href="/wiki/Foo" title="Foo">|Bar</a>
24340 <a href="/wiki/Foo" title="Foo">]]bar</a>
24341 <a href="/wiki/Foo" title="Foo">[[bar</a>
24342 <a href="/wiki/Foo" title="Foo">x [[ y</a>
24343 <a href="/wiki/Foo" title="Foo">x ]] y</a>
24344 <a href="/wiki/Foo" title="Foo">x ]] y [[ z</a>
24345 </p>
24346 !! end
24347
24348 !! test
24349 Links 3. WikiLinks: No escapes needed
24350 !! options
24351 parsoid=html2wt
24352 !! html/parsoid
24353 <p><a rel="mw:WikiLink" href="Foo">[Foobar</a>
24354 <a rel="mw:WikiLink" href="Foo" title="Foo">foo|bar</a></p>
24355 !! wikitext
24356 [[Foo|[Foobar]]
24357 [[Foo|foo|bar]]
24358 !! html/php
24359 <p><a href="/wiki/Foo" title="Foo">[Foobar</a>
24360 <a href="/wiki/Foo" title="Foo">foo|bar</a>
24361 </p>
24362 !! end
24363
24364 !! test
24365 Links 4. ExtLinks: Escapes needed
24366 !! options
24367 parsoid=html2wt
24368 !! html/parsoid
24369 <p><a rel="mw:ExtLink" href="http://google.com">[google]</a>
24370 <a rel="mw:ExtLink" href="http://google.com">google]</a></p>
24371 <p>[http://google.com]</p>
24372 <p>[http://google.com google]</p>
24373 <p>[<a rel="mw:ExtLink" href="http://google.com">http://google.com</a>]</p>
24374 <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>
24375 !! wikitext
24376 [http://google.com <nowiki>[google]</nowiki>]
24377 [http://google.com <nowiki>google]</nowiki>]
24378
24379 <nowiki>[http://google.com]</nowiki>
24380
24381 <nowiki>[http://google.com google]</nowiki>
24382
24383 [http://google.com<nowiki>]</nowiki>
24384
24385 [{{echo|http://google.com}}<nowiki>]</nowiki>
24386 !! html/php
24387 <p><a rel="nofollow" class="external text" href="http://google.com">[google]</a>
24388 <a rel="nofollow" class="external text" href="http://google.com">google]</a>
24389 </p><p>[http://google.com]
24390 </p><p>[http://google.com google]
24391 </p><p>[<a rel="nofollow" class="external free" href="http://google.com">http://google.com</a>]
24392 </p><p>[<a rel="nofollow" class="external free" href="http://google.com">http://google.com</a>]
24393 </p>
24394 !! end
24395
24396 !! test
24397 Links 5. ExtLinks: No escapes needed
24398 !! options
24399 parsoid=html2wt
24400 !! html/parsoid
24401 <p><a rel="mw:ExtLink" href="http://google.com">[google</a></p>
24402 <p>[<a ref="mw:ExtLink" href="http://google.com"></a>]</p>
24403 !! wikitext
24404 [http://google.com [google]
24405
24406 [[http://google.com]]
24407 !! html/php
24408 <p><a rel="nofollow" class="external text" href="http://google.com">[google</a>
24409 </p><p>[<a rel="nofollow" class="external autonumber" href="http://google.com">[1]</a>]
24410 </p>
24411 !! end
24412
24413 !! test
24414 Links 6. Add <nowiki/>s between text-nodes and url-links when required (T66300)
24415 !! options
24416 parsoid=html2wt
24417 !! html/parsoid
24418 <p>x<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>y
24419 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>?x
24420 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>&amp;x
24421 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>'x
24422 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,x
24423 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.x
24424 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
24425 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>:x
24426 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
24427 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>!x
24428 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>=x
24429 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>(x)
24430 <a rel="mw:ExtLink" href="http://example.com(x" data-parsoid='{"stx":"url"}'>http://example.com(x</a>)
24431 </p>
24432 !! wikitext
24433 x<nowiki/>http://example.com<nowiki/>y
24434 http://example.com<nowiki/>?x
24435 http://example.com<nowiki/>&x
24436 http://example.com<nowiki/>'x
24437 http://example.com<nowiki/>,x
24438 http://example.com<nowiki/>.x
24439 http://example.com<nowiki/>;x
24440 http://example.com<nowiki/>:x
24441 http://example.com<nowiki/>;x
24442 http://example.com<nowiki/>!x
24443 http://example.com<nowiki/>=x
24444 http://example.com<nowiki/>(x)
24445 http://example.com(x<nowiki/>)
24446 !! end
24447
24448 !! test
24449 Links 7a. Don't add spurious <nowiki/>s between text-nodes and url-links (T66300)
24450 !! options
24451 parsoid=html2wt
24452 !! html/parsoid
24453 <p>x
24454 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>
24455 y
24456 "<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>"
24457 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>)
24458 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>) foo
24459 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,
24460 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>, foo
24461 </p>
24462 !! wikitext
24463 x
24464 http://example.com
24465 y
24466 "http://example.com"
24467 (http://example.com)
24468 (http://example.com) foo
24469 http://example.com,
24470 http://example.com, foo
24471 !! html/php
24472 <p>x
24473 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
24474 y
24475 "<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>"
24476 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
24477 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>) foo
24478 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
24479 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>, foo
24480 </p>
24481 !! end
24482
24483 !! test
24484 Links 7b. Don't add spurious <nowiki/>s between text-nodes and url-links (T66300)
24485 !! options
24486 parsoid=html2wt
24487 !! html/parsoid
24488 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.,;:!?\
24489 -<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:</p>
24490 !! wikitext
24491 http://example.com.,;:!?\
24492 -http://example.com:
24493 !! html/php
24494 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.,;:!?\
24495 -<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
24496 </p>
24497 !! end
24498
24499 !! test
24500 Links 8. Add <nowiki/>s between text-nodes and RFC-links when required (T66300)
24501 !! options
24502 parsoid=html2wt
24503 !! html/parsoid
24504 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>4
24505 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
24506 X<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y</p>
24507 !! wikitext
24508 RFC 123<nowiki/>4
24509 RFC 123<nowiki/>y
24510 X<nowiki/>RFC 123<nowiki/>y
24511 !! end
24512
24513 !! test
24514 Links 9. Don't add spurious <nowiki/>s between text-nodes and RFC-links (T66300)
24515 !! options
24516 parsoid=html2wt
24517 !! html/parsoid
24518 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>?foo
24519 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>&amp;foo
24520 -<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>-
24521 </p>
24522 !! wikitext
24523 RFC 123?foo
24524 RFC 123&foo
24525 -RFC 123-
24526 !! html/php
24527 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>?foo
24528 <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>&amp;foo
24529 -<a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>-
24530 </p>
24531 !! end
24532
24533 !! test
24534 Links 10. Add <nowiki/>s between text-nodes and PMID-links when required (T66300)
24535 !! options
24536 parsoid=html2wt
24537 !! html/parsoid
24538 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>4
24539 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
24540 X<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
24541 !! wikitext
24542 PMID 123<nowiki/>4
24543 PMID 123<nowiki/>y
24544 X<nowiki/>PMID 123<nowiki/>y
24545 !! end
24546
24547 !! test
24548 Links 11. Don't add spurious <nowiki/>s between text-nodes and PMID-links (T66300)
24549 !! options
24550 parsoid=html2wt
24551 !! html/parsoid
24552 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>?foo
24553 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>&foo
24554 -<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>-
24555 </p>
24556 !! wikitext
24557 PMID 123?foo
24558 PMID 123&foo
24559 -PMID 123-
24560 !! html/php
24561 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>?foo
24562 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>&amp;foo
24563 -<a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>-
24564 </p>
24565 !! end
24566
24567 !! test
24568 Links 12. Add <nowiki/>s between text-nodes and ISBN-links when required (T66300)
24569 !! options
24570 parsoid=html2wt
24571 !! html/parsoid
24572 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>1
24573 <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>x
24574 a<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>b
24575 </p>
24576 !! wikitext
24577 ISBN 1234567890<nowiki/>1
24578 ISBN 1234567890<nowiki/>x
24579 a<nowiki/>ISBN 1234567890<nowiki/>b
24580 !! end
24581
24582 !! test
24583 Links 13. Don't add spurious <nowiki/>s between text-nodes and ISBN-links (T66300)
24584 !! options
24585 parsoid=html2wt
24586 !! html/parsoid
24587 <p>-<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>'s
24588 !! wikitext
24589 -ISBN 1234567890's
24590 !! html/php
24591 <p>-<a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>'s
24592 </p>
24593 !! end
24594
24595 !! test
24596 Links 14. Protect link-like plain text. (Parsoid bug T78425)
24597 !! options
24598 parsoid=html2wt
24599 !! html/*
24600 <p>this is not a link: http://example.com
24601 </p>
24602 !! wikitext
24603 this is not a link: <nowiki>http://example.com</nowiki>
24604 !! end
24605
24606 !! test
24607 Links 15. Link trails can't become link prefixes.
24608 !! options
24609 language=is
24610 parsoid=html2wt
24611 !! html/parsoid
24612 <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>
24613 !! wikitext
24614 [[Söfnuður]]-[[00]]
24615 !! html/php
24616 <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>
24617 </p>
24618 !! end
24619
24620 #### --------------- Quotes ---------------
24621 #### 1. Quotes inside <b> and <i>
24622 #### 2. Link fragments separated by <i> and <b> tags
24623 #### 3. Link fragments inside <i> and <b>
24624 #### 4. No escaping needed
24625 #### --------------------------------------
24626 !! test
24627 1a. Quotes inside <b> and <i>
24628 !! options
24629 parsoid=html2wt
24630 !! html/*
24631 <p><i>'foo'</i>
24632 <i>''foo''</i>
24633 <i>'''foo'''</i>
24634 <i>foo</i>'s
24635 <b>'foo'</b>
24636 <b>''foo''</b>
24637 <b>'''foo'''</b>
24638 <b>foo'<i>bar'</i>baz</b>
24639 <b>foo</b>'s
24640 '<i>foo</i>
24641 <i>foo</i>'
24642 <i>foo'</i>'
24643 '<i>foo</i>'
24644 '<b>foo</b>
24645 <b>foo</b>'
24646 '<b>foo</b>'
24647 <i>fools'<span> errand</span></i>
24648 <i><span>fool</span>'s errand</i>
24649 '<i>foo</i> bar '<i>baz</i>
24650 a|!*#-:;+-~[]{}b'<i>x</i>
24651 </p>
24652 !! wikitext
24653 ''<nowiki/>'foo'''
24654 ''<nowiki>''foo''</nowiki>''
24655 ''<nowiki>'''foo'''</nowiki>''
24656 ''foo''<nowiki/>'s
24657 '''<nowiki/>'foo''''
24658 '''<nowiki>''foo''</nowiki>'''
24659 '''<nowiki>'''foo'''</nowiki>'''
24660 '''foo'<nowiki/>''bar'<nowiki/>''baz'''
24661 '''foo'''<nowiki/>'s
24662 '''foo''
24663 ''foo''<nowiki/>'
24664 ''foo'''<nowiki/>'
24665 '''foo''<nowiki/>'
24666 ''''foo'''
24667 '''foo'''<nowiki/>'
24668 ''''foo'''<nowiki/>'
24669 ''fools'<span> errand</span>''
24670 ''<span>fool</span>'s errand''
24671 '<nowiki/>''foo'' bar '''baz''
24672 a|!*#-:;+-~[]{}b'''x''
24673 !! end
24674
24675 !! test
24676 1b. Quotes inside <b> and <i> with other tags on same line
24677 !! options
24678 parsoid=html2wt
24679 !! html/parsoid
24680 '<i>a</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
24681 <i>a'</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
24682 <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>
24683 <a rel="mw:WikiLink" href="Foo" title="Foo">foo</a> x'<i><a href="Bar" rel="mw:WikiLink" title="Bar">bar</a></i>
24684 '<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>
24685 '<i>foo</i> <div title="name">test</div>
24686 '<i>foo</i> and <br data-parsoid='{"stx":"html","noClose":true}'/> bar
24687 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
24688 <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>
24689 </ol>
24690 !! wikitext
24691 '''a'' foo ''[[bar]]''
24692 ''a''' foo ''[[bar]]''
24693 ''a''' foo '''{{echo|[[bar]]}}'''
24694 [[foo]] x'''[[bar]]''
24695 '''foo'' <ref>test</ref>
24696 '''foo'' <div title="name">test</div>
24697 '''foo'' and <br> bar
24698 <references />
24699 !! end
24700
24701 !! test
24702 2. Link fragments separated by <i> and <b> tags
24703 !! options
24704 parsoid=html2wt
24705 !! html/parsoid
24706 <p>[[<i>foo</i>hello]]</p>
24707 <p>[[<b>foo</b>hello]]</p>
24708 !! wikitext
24709 [[''foo''<nowiki>hello]]</nowiki>
24710
24711 [['''foo'''<nowiki>hello]]</nowiki>
24712 !! end
24713
24714 # FIXME: Escaping one or both of [[ and ]] is also acceptable --
24715 # this is one of the shortcomings of this format
24716 !! test
24717 3. Link fragments inside <i> and <b>
24718 !! options
24719 parsoid=html2wt
24720 !! html/parsoid
24721 <p><i>[[foo</i>]]</p>
24722 <p><b>[[foo</b>]]</p>
24723 !! wikitext
24724 ''[[foo''<nowiki>]]</nowiki>
24725
24726 '''[[foo'''<nowiki>]]</nowiki>
24727 !! end
24728
24729 !! test
24730 4. No escaping needed
24731 !! options
24732 options=html2wt
24733 !! html/parsoid
24734 <p>'<span><i>bar</i></span>'
24735 '<span><b>bar</b></span>'
24736 'a:b'foo
24737 </p>
24738 !! wikitext
24739 '<span>''bar''</span>'
24740 '<span>'''bar'''</span>'
24741 'a:b'foo
24742 !! end
24743
24744 #### ----------- Paragraphs ---------------
24745 #### 1. No unnecessary escapes
24746 #### --------------------------------------
24747
24748 !! test
24749 1. No unnecessary escapes
24750 !! options
24751 parsoid=html2wt
24752 !! html/parsoid
24753 <p>bar <span>[[foo]]</span>
24754 </p><p>=bar <span>[[foo]]</span>
24755 </p><p>[[bar <span>[[foo]]</span>
24756 </p><p>]]bar <span>[[foo]]</span>
24757 </p><p>=bar <span>foo]]</span>=
24758 </p>
24759 !! wikitext
24760 bar <span><nowiki>[[foo]]</nowiki></span>
24761
24762 =bar <span><nowiki>[[foo]]</nowiki></span>
24763
24764 [[bar <span><nowiki>[[foo]]</nowiki></span>
24765
24766 ]]bar <span><nowiki>[[foo]]</nowiki></span>
24767
24768 =bar <span>foo]]</span><nowiki>=</nowiki>
24769 !!end
24770
24771 #### ----------------------- PRE --------------------------
24772 #### 1. Leading whitespace in SOL context should be escaped
24773 #### ------------------------------------------------------
24774 !! test
24775 1. Leading whitespace in SOL context should be escaped
24776 !! options
24777 parsoid=html2wt
24778 !! html/parsoid
24779 <p> a</p>
24780
24781 <p> a</p>
24782
24783 <p> a(tab)</p>
24784
24785 <p> a
24786 <!--cmt-->
24787 a</p>
24788
24789 <p>a
24790 b</p>
24791
24792 <p>a
24793 b</p>
24794
24795 <p>a
24796 b</p>
24797 !! wikitext
24798 <nowiki> </nowiki>a
24799
24800 <nowiki> </nowiki> a
24801
24802 a(tab)
24803
24804 <nowiki> </nowiki> a
24805 <!--cmt-->
24806 <nowiki> </nowiki>a
24807
24808 a
24809 <nowiki> </nowiki>b
24810
24811 a
24812 b
24813
24814 a
24815 b
24816 !! html/php
24817 <p> a
24818 </p><p> a
24819 </p><p> a(tab)
24820 </p><p> a
24821 a
24822 </p><p>a
24823 b
24824 </p><p>a
24825 b
24826 </p><p>a
24827 b
24828 </p>
24829 !! end
24830
24831 !! test
24832 2. Leading whitespace in non-indent-pre contexts should not be escaped
24833 !! options
24834 parsoid=html2wt
24835 !! html/parsoid
24836 <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>
24837 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
24838 <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>
24839 b</span></li>
24840 </ol>
24841 !! wikitext
24842 foo <ref>''a''
24843 b</ref>
24844 <references />
24845 !! end
24846
24847 !! test
24848 3. Leading whitespace in indent-pre suppressing contexts should not be escaped
24849 !! options
24850 parsoid=html2wt
24851 !! html/parsoid
24852 <blockquote>
24853 <p>
24854 a
24855 <span>b</span>
24856 c</p>
24857 </blockquote>
24858 !! wikitext
24859 <blockquote>
24860 a
24861 <span>b</span>
24862 c
24863 </blockquote>
24864 !! end
24865
24866 !! test
24867 4. Leading whitespace in indent-pre suppressing contexts should not be escaped
24868 !! options
24869 options=html2wt
24870 !! html/parsoid
24871 <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>
24872 !! wikitext
24873 [[File:Foobar.jpg|thumb|caption]]
24874 !! end
24875
24876 !! test
24877 5. Nowiki escaping should account for indent-pres
24878 !! options
24879 parsoid=html2wt
24880 !! html/parsoid
24881 <pre>==foo==</pre>
24882 !! wikitext
24883 ==foo==
24884 !! end
24885
24886 !!test
24887 T95794: nowiki escaping should account for leading space at start-of-line in an indent-pre block
24888 !! options
24889 parsoid=html2wt
24890 !! html/parsoid
24891 <pre>
24892 * foo
24893 * bar
24894 </pre>
24895 !! wikitext
24896 * foo
24897 * bar
24898 !! end
24899
24900 #### --------------- Behavior Switches --------------------
24901
24902 !! test
24903 1. Valid behavior switches should be escaped
24904 !! options
24905 parsoid=html2wt
24906 !! html/parsoid
24907 __TOC__
24908 <i>__TOC__</i>
24909 !! wikitext
24910 <nowiki>__TOC__</nowiki>
24911 ''<nowiki>__TOC__</nowiki>''
24912 !! end
24913
24914 !! test
24915 2. Invalid behavior switches should not be escaped
24916 !! options
24917 parsoid=html2wt
24918 !! html/parsoid
24919 __TOO__
24920 __|__
24921 !! wikitext
24922 __TOO__
24923 __|__
24924 !! end
24925
24926 # We use indent-pre as an indirect way to test for sol-transparent behavior.
24927 !! test
24928 Behavior switches should be SOL-transparent
24929 !! options
24930 parsoid=html2wt
24931 !! html/parsoid
24932 <meta property="mw:PageProp/toc" />
24933
24934 <!-- this one's bogus -->
24935 <pre>__TOO__</pre>
24936
24937 <pre data-parsoid='{}'><meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/> foo</pre>
24938
24939 <meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/><pre data-parsoid='{}'>bar</pre>
24940 !! wikitext
24941 __TOC__
24942
24943 <!-- this one's bogus -->
24944 __TOO__
24945
24946 __TOC__ foo
24947
24948 __TOC__
24949 bar
24950 !! end
24951
24952 #### --------------- HTML tags ---------------
24953 #### 1. a tags
24954 #### 2. other tags
24955 #### 3. multi-line html tag
24956 #### 4. extension tags
24957 #### -----------------------------------------
24958 !! test
24959 1. a tags
24960 !! options
24961 parsoid=html2wt
24962 !! html/parsoid
24963 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
24964 !! wikitext
24965 <a href="http://google.com">google</a>
24966 !! end
24967
24968 !! test
24969 2. other tags
24970 !! options
24971 parsoid=html2wt
24972 !! html/parsoid
24973 <ul><li> &lt;div&gt;foo&lt;/div&gt;</li>
24974 <li> &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;</li>
24975 <li> &lt;td&gt;</li></ul>
24976
24977 !! wikitext
24978 * <nowiki><div>foo</div></nowiki>
24979 * <nowiki><div style="color:red">foo</div></nowiki>
24980 * <nowiki><td></nowiki>
24981 !! end
24982
24983 !! test
24984 3. multi-line html tag
24985 !! options
24986 parsoid=html2wt
24987 !! html/parsoid
24988 <p>&lt;div
24989 &gt;foo&lt;/div
24990 &gt;
24991 </p>
24992 !! wikitext
24993 <nowiki><div
24994 >foo</div
24995 ></nowiki>
24996 !! end
24997
24998 !! test
24999 4. extension tags
25000 !! options
25001 parsoid=html2wt
25002 !! html/parsoid
25003 <p>&lt;ref&gt;foo&lt;/ref&gt;
25004 </p><p>&lt;ref&gt;bar
25005 </p><p>baz&lt;/ref&gt;
25006 </p>
25007 !! wikitext
25008 <nowiki><ref>foo</ref></nowiki>
25009
25010 <nowiki><ref>bar</nowiki>
25011
25012 baz<nowiki></ref></nowiki>
25013 !! end
25014
25015 #### --------------- Others ---------------
25016 !! test
25017 Escaping nowikis
25018 !! options
25019 parsoid=html2wt
25020 !! html/parsoid
25021 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
25022 </p>
25023 !! wikitext
25024 &lt;nowiki&gt;foo&lt;/nowiki&gt;
25025 !! end
25026
25027 ## The quote-char in the input is necessary for triggering the bug
25028 !! test
25029 (T54035) Nowiki-escaping should not get tripped by " :" in text
25030 !! options
25031 parsoid=html2wt
25032 !! html/parsoid
25033 <p>foo's bar :</p>
25034 !! wikitext
25035 foo's bar :
25036 !! end
25037
25038 #----------- End of wikitext escaping tests --------------
25039
25040 !! test
25041
25042 Tag-like HTML structures are passed through as text
25043 !! wikitext
25044 <x y>
25045
25046 <x.y>
25047
25048 <x-y>
25049
25050 1>2
25051
25052 x<y
25053
25054 a>b
25055
25056 1<d e>f
25057 !! html
25058 <p>&lt;x y&gt;
25059 </p><p>&lt;x.y&gt;
25060 </p><p>&lt;x-y&gt;
25061 </p><p>1&gt;2
25062 </p><p>x&lt;y
25063 </p><p>a&gt;b
25064 </p><p>1&lt;d e&gt;f
25065 </p>
25066 !! end
25067
25068 !! test
25069 HTML tag with necessary entities in attributes
25070 !! wikitext
25071 <span title="&amp;amp;">foo</span>
25072 !! html
25073 <p><span title="&amp;amp;">foo</span>
25074 </p>
25075 !! end
25076
25077 !! test
25078 HTML tag with 'unnecessary' entity encoding in attributes
25079 !! wikitext
25080 <span title="&amp;">foo</span>
25081 !! html
25082 <p><span title="&amp;">foo</span>
25083 </p>
25084 !! end
25085
25086 !! test
25087 HTML tag with broken attribute value quoting
25088 !! options
25089 parsoid=wt2html,html2html
25090 !! wikitext
25091 <span title="Hello world>Foo</span>
25092 !! html/php
25093 <p><span title="Hello world">Foo</span>
25094 </p>
25095 !! html/parsoid
25096 <p><span title="Hello world">Foo</span></p>
25097 !! end
25098
25099 !! test
25100 Self-closed tag with broken attribute value quoting
25101 !! options
25102 parsoid=wt2html,html2html
25103 !! wikitext
25104 <div title="Hello world />Foo
25105 !! html/php+tidy
25106 <div title="Hello world"></div>
25107 <p>Foo</p>
25108 !! html/parsoid
25109 <div title="Hello world " data-parsoid='{"stx":"html","selfClose":true}'></div><p>Foo</p>
25110 !! end
25111
25112 !! test
25113 Table with broken attribute value quoting
25114 !! options
25115 parsoid=wt2html,html2html
25116 !! wikitext
25117 {|
25118 | title="Hello world|Foo
25119 |}
25120 !! html/php
25121 <table>
25122 <tr>
25123 <td title="Hello world">Foo
25124 </td></tr></table>
25125
25126 !! html/parsoid
25127 <table>
25128 <tr>
25129 <td title="Hello world">Foo
25130 </td></tr></table>
25131
25132 !! end
25133
25134 !! test
25135 Table with broken attribute value quoting on consecutive lines
25136 !! options
25137 parsoid=wt2html,html2html
25138 !! wikitext
25139 {|
25140 | title="Hello world|Foo
25141 | style="color:red|Bar
25142 |}
25143 !! html/php
25144 <table>
25145 <tr>
25146 <td title="Hello world">Foo
25147 </td>
25148 <td style="color:red">Bar
25149 </td></tr></table>
25150
25151 !! html/parsoid
25152 <table><tbody>
25153 <tr>
25154 <td title="Hello world">Foo
25155 </td><td style="color: red">Bar
25156 </td></tr></tbody></table>
25157
25158 !! end
25159
25160 !!test
25161 Accept empty td cell attribute
25162 !! wikitext
25163 {|
25164 | align="center" | foo || |
25165 |}
25166 !! html
25167 <table>
25168 <tr>
25169 <td align="center"> foo </td>
25170 <td>
25171 </td></tr></table>
25172
25173 !!end
25174
25175 !!test
25176 Non-empty attributes in th-cells
25177 !! wikitext
25178 {|
25179 ! Foo !! style="color: red" | Bar
25180 |}
25181 !! html
25182 <table>
25183 <tr>
25184 <th> Foo </th>
25185 <th style="color: red"> Bar
25186 </th></tr></table>
25187
25188 !!end
25189
25190 !!test
25191 Accept empty attributes in th-cells
25192 !! wikitext
25193 {|
25194 !| foo !!| bar
25195 |}
25196 !! html
25197 <table>
25198 <tr>
25199 <th> foo </th>
25200 <th> bar
25201 </th></tr></table>
25202
25203 !!end
25204
25205 !!test
25206 Empty table rows go away
25207 !! wikitext
25208 {|
25209 | Hello
25210 | there
25211 |- class="foo"
25212 |-
25213 |}
25214 !! html
25215 <table>
25216 <tr>
25217 <td> Hello
25218 </td>
25219 <td> there
25220 </td></tr>
25221
25222 </table>
25223
25224 !! end
25225
25226 ###
25227 ### Parsoid-centric tests for testing RTing of inter-element separators
25228 ### Edge cases not tested by existing parser tests and specific to
25229 ### Parsoid-specific serialization strategies.
25230 ###
25231
25232 !!test
25233 RT-ed inter-element separators should be valid separators
25234 !! wikitext
25235 {|
25236 |- [[foo]]
25237 |}
25238 !! html/php
25239 <table>
25240
25241 </table>
25242
25243 !! html/parsoid
25244 <table>
25245 <tbody><tr data-parsoid='{"startTagSrc":"|-","a":{"[[foo]]":null},"sa":{"[[foo]]":""},"autoInsertedEnd":true}'></tr>
25246 </tbody></table>
25247 !!end
25248
25249 # Parsoid-only since PHP parser relies on Tidy for correct output
25250 !!test
25251 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
25252 !!options
25253 parsoid
25254 !! wikitext
25255 {|
25256 |<small>foo
25257 bar
25258 |}
25259
25260 {|
25261 |<small>foo<small>
25262 |}
25263 !! html
25264 <table>
25265 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'>foo
25266 <p>bar</p></small></td></tr>
25267 </tbody></table>
25268
25269 <table>
25270 <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>
25271 </tbody></table>
25272 !!end
25273
25274 # Note that the "style" attribute is really a template parameter here.
25275 # The = would have to be {{=}} if you wanted the literal.
25276 !!test
25277 Empty TD followed by TD with tpl-generated attribute
25278 !! wikitext
25279 {|
25280 |-
25281 |
25282 |{{echo|style='color:red'}}|foo
25283 |}
25284 !! html
25285 <table>
25286
25287 <tr>
25288 <td>
25289 </td>
25290 <td>foo
25291 </td></tr></table>
25292
25293 !!end
25294
25295 !!test
25296 Indented table with an empty td
25297 !! wikitext
25298 {|
25299 |-
25300 |
25301 |foo
25302 |}
25303 !! html
25304 <table>
25305
25306 <tr>
25307 <td>
25308 </td>
25309 <td>foo
25310 </td></tr></table>
25311
25312 !!end
25313
25314 ## We have some newline diffs RT-ing this edge case
25315 ## and it is not important enough -- we seem to be emitting
25316 ## at most 2 newlines after a </tr> and this is unrelated to
25317 ## the issue from T85627 that this is testing.
25318 !!test
25319 Indented table with blank lines in between (T85627)
25320 !! options
25321 parsoid=wt2html
25322 !! wikitext
25323 {|
25324 |foo
25325
25326
25327 |}
25328 !! html
25329 <table>
25330
25331 <tr>
25332 <td>foo
25333 </td></tr></table>
25334
25335 !!end
25336
25337 !!test
25338 Indented block & table
25339 !! wikitext
25340 <div>foo</div>
25341 {|
25342 |foo
25343 |}
25344 !! html/php
25345 <div>foo</div>
25346 <table>
25347 <tr>
25348 <td>foo
25349 </td></tr></table>
25350
25351 !! html/parsoid
25352 <div data-parsoid='{"stx":"html"}'>foo</div>
25353 <table><tbody>
25354 <tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>foo</td></tr>
25355 </tbody></table>
25356 !!end
25357
25358 !! test
25359 Indent and comment before table row
25360 !! wikitext
25361 {|
25362 <!--hi-->|-
25363 | there
25364 |}
25365 !! html/php
25366 <table>
25367
25368 <tr>
25369 <td> there
25370 </td></tr></table>
25371
25372 !! html/parsoid
25373 <table>
25374 <!--hi--><tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
25375 <td data-parsoid='{"autoInsertedEnd":true}'> there</td></tr>
25376 </tbody></table>
25377 !! end
25378
25379 # Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext
25380 !!test
25381 Empty TR followed by a template-generated TR
25382 !!options
25383 parsoid
25384 !! wikitext
25385 {|
25386 |-
25387 {{echo|<tr><td>foo</td></tr>}}
25388 |}
25389 !! html
25390 <table>
25391 <tbody>
25392 <tr></tr>
25393 <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}}]}'>
25394 <td>foo</td></tr>
25395 </tbody></table>
25396 !!end
25397
25398 ## PHP and parsoid output differ for this, and since this is primarily
25399 ## for testing Parsoid's serializer, marking this Parsoid only
25400 !!test
25401 Empty TR followed by mixed-ws-comment line should RT correctly
25402 !!options
25403 parsoid
25404 !! wikitext
25405 {|
25406 |-
25407 <!--c-->
25408 |-
25409 <!--c--> <!--d-->
25410 |}
25411 !! html
25412 <table>
25413 <tbody>
25414 <tr></tr>
25415 <!--c-->
25416 <tr>
25417 <!--c--> </tr><!--d-->
25418 </tbody></table>
25419
25420 !!end
25421
25422 !!test
25423 Multi-line image caption generated by templates with/without trailing newlines
25424 !! wikitext
25425 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
25426 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
25427 !! html/parsoid
25428 <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>
25429 <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>
25430 !!end
25431
25432 !! test
25433 New element inserted (without intervening newlines) after an old sol-transparent node should serialize correctly
25434 !! options
25435 parsoid=html2wt
25436 !! html/parsoid
25437 <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>
25438
25439 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{}'/><h1>new heading</h1>
25440 !! wikitext
25441 <includeonly>foo</includeonly>
25442 new para
25443
25444 [[Category:Foo]]
25445
25446 = new heading =
25447 !! end
25448
25449 ## PHP emits broken html for this, and since this is primarily
25450 ## a Parsoid serializer test, marking this Parsoid only
25451 !!test
25452 Improperly nested inline or quotes tags with whitespace in between
25453 !! wikitext
25454 <span> <s>x</span> </s>
25455 ''' ''x''' ''
25456 !! html/parsoid
25457 <p><span> <s>x</s></span><s> </s>
25458 <b> <i>x</i></b><i> </i>
25459 </p>
25460 !!end
25461
25462 !!test
25463 Encapsulate protected attributes from wt
25464 !! wikitext
25465 <div typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
25466
25467 {| typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true"
25468 | ok
25469 |}
25470 !! html/parsoid
25471 <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>
25472
25473 <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">
25474 <tbody><tr><td data-parsoid='{"autoInsertedEnd":true}'> ok</td></tr>
25475 </tbody></table>
25476 !!end
25477
25478 ## Currently the p-wrapper is fragile in how it adds / removes transformations.
25479 ## Having nested or stray pre tags results in the attempt to add duplicates,
25480 ## causing an assertion fail. This test tries to prevent that situation.
25481 !!test
25482 Ensure ParagraphWrapper can deal with stray closing pre tags
25483 !!options
25484 parsoid=wt2html
25485 !! wikitext
25486 plain text</pre>
25487 !! html/parsoid
25488 plain text
25489 !!end
25490
25491 !!test
25492 1. Ensure fostered text content is wrapped in element nodes
25493 !!options
25494 parsoid=wt2html
25495 !! wikitext
25496 <table>hi</table><table>ho</table>
25497 !! html/parsoid
25498 <p>hi</p>
25499 <table></table>
25500 <p>ho</p>
25501 <table></table>
25502 !!end
25503
25504 !!test
25505 2. Ensure fostered text content is wrapped in element nodes (traps regressions around fostered marker on the element getting lost)
25506 !!options
25507 parsoid=wt2html,wt2wt
25508 !! wikitext
25509 <table>
25510 <tr> || ||
25511 <td> a
25512 </table>
25513 !! html/parsoid
25514 <p> || ||
25515 </p><table>
25516 <tbody><tr><td> a</td></tr>
25517 </tbody></table>
25518 !!end
25519
25520 !!test
25521 Encapsulation properly handles null DSR information from foster box
25522 !!options
25523 parsoid=wt2html,wt2wt
25524 !! wikitext
25525 {{echo|<table>foo<tr><td>bar</td></tr></table>}}
25526 !! html/parsoid
25527 <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>
25528 !!end
25529
25530 !!test
25531 1. Encapsulate foster-parented transclusion content
25532 !!options
25533 parsoid=wt2wt,wt2html
25534 !! wikitext
25535 <table>{{echo|foo<tr><td>bar</td></tr>}}</table>
25536 !! html/parsoid
25537 <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>
25538 <tbody>
25539 <tr>
25540 <td>bar</td>
25541 </tr>
25542 </tbody>
25543 </table>
25544 !!end
25545
25546 !!test
25547 2. Encapsulate foster-parented transclusion content
25548 !!options
25549 parsoid=wt2wt,wt2html
25550 !! wikitext
25551 <table><div>{{echo|foo}}</div><tr><td>bar</td></tr></table>
25552 !! html/parsoid
25553 <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>
25554 <table>
25555 <tbody>
25556 <tr>
25557 <td>bar</td>
25558 </tr>
25559 </tbody>
25560 </table>
25561 !!end
25562
25563 !!test
25564 3. Encapsulate foster-parented transclusion content
25565 !!options
25566 parsoid=wt2wt,wt2html
25567 !! wikitext
25568 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
25569 !! html/parsoid
25570 <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;]}">
25571 <p>foo</p>
25572 </div>
25573 <table>
25574 <tbody>
25575 <tr>
25576 <td>bar</td>
25577 </tr>
25578 </tbody>
25579 </table>
25580 !!end
25581
25582 !!test
25583 4. Encapsulate foster-parented transclusion content
25584 !!options
25585 parsoid=wt2wt,wt2html
25586 !! wikitext
25587 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
25588 !! html/parsoid
25589 <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;]}">
25590 <p>foo</p>
25591 </div>
25592 <table>
25593 <tbody>
25594 <tr>
25595 <td>bar</td>
25596 </tr>
25597 </tbody>
25598 </table>
25599 !!end
25600
25601 !!test
25602 5. Encapsulate foster-parented transclusion content
25603 !!options
25604 parsoid=wt2wt,wt2html
25605 !! wikitext
25606 <table><tr><td><div><p>{{echo|foo</p></div></td>foo}}</tr></table>
25607 !! html/parsoid
25608 <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>
25609 <table>
25610 <tbody>
25611 <tr>
25612 <td>
25613 <div>
25614 <p>foo</p>
25615 </div>
25616 </td>
25617 </tr>
25618 </tbody>
25619 </table>
25620 !!end
25621
25622 !!test
25623 6. Encapsulate foster-parented transclusion content
25624 !!options
25625 parsoid=wt2wt,wt2html
25626 !! wikitext
25627 <table><tr><td><div><p>{{echo|foo</p></div></td>foo</tr></table>}}<p>ok</p>
25628 !! html/parsoid
25629 <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>
25630 <table>
25631 <tbody>
25632 <tr>
25633 <td>
25634 <div>
25635 <p>foo</p>
25636 </div>
25637 </td>
25638 </tr>
25639 </tbody>
25640 </table>
25641 <p>ok</p>
25642 !!end
25643
25644 !!test
25645 7. Encapsulate foster-parented transclusion content
25646 !!options
25647 parsoid=wt2wt,wt2html
25648 !! wikitext
25649 <table>{{echo|<p>foo</p>}}<td>bar</td></table>
25650 !! html/parsoid
25651 <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>
25652 <table>
25653 <tbody>
25654 <tr>
25655 <td>bar</td>
25656 </tr>
25657 </tbody>
25658 </table>
25659 !!end
25660
25661 # Note that the wt is broken on purpose: the = should be {{=}} if you
25662 # don't want it to be a template parameter key.
25663 !!test
25664 8. Encapsulate foster-parented transclusion content
25665 !!options
25666 parsoid=wt2wt,wt2html
25667 !! wikitext
25668 {{echo|a
25669 }}{|{{echo|style='color:red'}}
25670 |-
25671 |b
25672 |}
25673 !! html/parsoid
25674 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\n"}},"i":0}}]}'>a</p>
25675 <span> </span>
25676 <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>
25677 <table>
25678 <tbody>
25679 <tr>
25680 <td>b</td>
25681 </tr>
25682 </tbody>
25683 </table>
25684 !!end
25685
25686 !!test
25687 9. Encapsulate foster-parented transclusion content
25688 !!options
25689 parsoid=wt2wt,wt2html
25690 !! wikitext
25691 <table>{{echo|hi</table>hello}}
25692 !! html/parsoid
25693 <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>
25694 !!end
25695
25696 !!test
25697 Table in fosterable position
25698 !!options
25699 parsoid=wt2html
25700 !! wikitext
25701 {{OpenTable}}
25702 <div>
25703 {|
25704 |}
25705 </div>
25706 |}
25707 !! html/parsoid
25708 <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">
25709 </span>
25710 <table about="#mwt1" data-parsoid='{"autoInsertedEnd":true}'></table>
25711
25712 <table>
25713 </table>
25714 !!end
25715
25716 # Parsoid only for T66747
25717 !! test
25718 Properly encapsulate empty-content transclusions in fosterable positions
25719 !! wikitext
25720 <table>
25721 {{#if:|
25722 <td>foo</td>
25723 }}
25724 </table>
25725 !! html/parsoid
25726 <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"}]]}'>
25727
25728 </table>
25729 !! end
25730
25731 !! test
25732 Always encapsulate foster box when template range is expanded to table
25733 !! options
25734 parsoid=wt2wt
25735 !! wikitext
25736 {|
25737 hello
25738 {{OpenTable}}
25739 |}
25740 !! html/parsoid
25741
25742 !! end
25743
25744 !! test
25745 T115289: Unclosed table
25746 !! wikitext
25747 {{echo|<table>}}<!--c-->[[Category:Two]]
25748 !! html/parsoid
25749 <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>
25750 !! end
25751
25752 !! test
25753 T115289: Don't migrate newlines out of tables with fostered content
25754 !! wikitext
25755 <table><td></td>{{echo|<tr>[[Category:One]]}}<!--c-->[[Category:Two]]
25756 !! html/parsoid
25757 <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>
25758 !! end
25759
25760 !! test
25761 T73074: More fostering fun
25762 !! wikitext
25763 <table><td></td>{{echo|<tr>}}<!--c-->[[Category:Two]]
25764 !! html/parsoid
25765 <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>
25766 !! end
25767
25768 !!test
25769 Support <object> element with .data attribute
25770 !!options
25771 parsoid=html2wt
25772 !! html/parsoid
25773 <object data="test.swf"></object>
25774 !! wikitext
25775 <object data="test.swf"></object>
25776 !!end
25777
25778 !! test
25779 Don't block XML namespace declaration
25780 !! wikitext
25781 <span xmlns:dct="http://purl.org/dc/terms/" property="dct:title">MediaWiki</span>
25782 !! html/php
25783 <p><span xmlns:dct="http&#58;//purl.org/dc/terms/" property="dct:title">MediaWiki</span>
25784 </p>
25785 !! html/parsoid
25786 <p><span xmlns:dct="http://purl.org/dc/terms/" data-x-property="dct:title" data-parsoid='{"stx":"html"}'>MediaWiki</span></p>
25787 !! end
25788
25789 # -----------------------------------------------------------------
25790 # The following section of tests are primarily to spec requirements
25791 # around Parsoid's serialization (old, new, edited content)
25792 #
25793 # All these tests are marked Parsoid html2wt and html2html only
25794 # ----------------------------------------------------------------
25795
25796 !! test
25797 Ignore rel attribute in a-tags during serialization to url-links
25798 !! options
25799 parsoid=html2wt
25800 !! html/parsoid
25801 <a href='http://en.wikipedia.org/wiki/Foobar'>http://en.wikipedia.org/wiki/Foobar</a>
25802 <a href='http://en.wikipedia.org/wiki/Foobar' rel='mw:ExtLink'>http://en.wikipedia.org/wiki/Foobar</a>
25803 <a href='http://en.wikipedia.org/wiki/Foobar' rel='mw:WikiLink'>http://en.wikipedia.org/wiki/Foobar</a>
25804 !! wikitext
25805 http://en.wikipedia.org/wiki/Foobar
25806 http://en.wikipedia.org/wiki/Foobar
25807 http://en.wikipedia.org/wiki/Foobar
25808 !! end
25809
25810 # 'mi' is a localinterwiki prefix as well as a language
25811 !! test
25812 Serialize interwiki links pointing to the current wiki as plain wiki links (T67869)
25813 !! options
25814 parsoid=html2wt
25815 !! html/parsoid
25816 <p><a rel="mw:ExtLink" href="http://mi.wikipedia.org/wiki/Foo">Foo</a></p>
25817 !! wikitext
25818 [[Foo]]
25819 !! end
25820
25821 # See T93839
25822 !! test
25823 New wikilinks should be serialized properly
25824 !! options
25825 parsoid=html2wt
25826 !! html/parsoid
25827 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{}'>Foo</a>
25828 <a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>
25829 <a href="//en.wikipedia.org/wiki/Foo">//en.wikipedia.org/wiki/Foo</a>
25830 <a href="http://en.wikipedia.org/wiki/Foo">http://en.wikipedia.org/wiki/Foo</a>
25831 <a href="//en.wikipedia.org/wiki/Foo_bar">//en.wikipedia.org/wiki/Foo bar</a>
25832 !! wikitext
25833 [[Foo]]
25834 [[Foo]]
25835 [[:en:Foo|//en.wikipedia.org/wiki/Foo]]
25836 http://en.wikipedia.org/wiki/Foo
25837 [[:en:Foo_bar|//en.wikipedia.org/wiki/Foo bar]]
25838 !! end
25839
25840 !! test
25841 New wiki links (href variations)
25842 !! options
25843 parsoid=html2wt
25844 !! html/parsoid
25845 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
25846 <a rel="mw:WikiLink" href="Foo_bar">Foo_bar</a>
25847 <a rel="mw:WikiLink" href="Foo bar">Foo_bar</a>
25848 <a rel="mw:WikiLink" href="./Toxine_bact%C3%A9rienne">Toxine bactérienne</a>
25849 !! wikitext
25850 [[Foo_bar]]
25851 [[Foo_bar]]
25852 [[Foo_bar]]
25853 [[Toxine bactérienne]]
25854 !! end
25855
25856 !! test
25857 New wiki links (content string variations)
25858 !! options
25859 parsoid=html2wt
25860 !! html/parsoid
25861 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
25862 <a rel="mw:WikiLink" href="./Foo_bar">Foo bar</a>
25863 <a rel="mw:WikiLink" href="./Foo_bar">./Foo_bar</a>
25864 !! wikitext
25865 [[Foo_bar]]
25866 [[Foo bar]]
25867 [[Foo_bar|./Foo_bar]]
25868 !! end
25869
25870 !! test
25871 New category links (href variations)
25872 !! options
25873 parsoid=html2wt
25874 !! html/parsoid
25875 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne" />
25876 <link rel="mw:PageProp/Category" href="./Category:Toxine_bact%C3%A9rienne" />
25877 <link rel="mw:PageProp/Category" href="Category:Toxine_bact%C3%A9rienne" />
25878 !! wikitext
25879 [[Category:Toxine bactérienne]]
25880 [[Category:Toxine bactérienne]]
25881 [[Category:Toxine bactérienne]]
25882 !! end
25883
25884 !! test
25885 New sol transparent links don't need indent-pre nowiki protection
25886 !! options
25887 parsoid=html2wt
25888 language=de
25889 !! html/parsoid
25890 <link rel="mw:PageProp/redirect" href="./Main_Page">
25891 <!-- this is good --> <link rel="mw:PageProp/Category" href="./Category:Good" />
25892 <!-- this is great --> <link rel="mw:PageProp/Category" href="./Kategorie:Great" />
25893 !! wikitext
25894 #WEITERLEITUNG [[Main Page]]
25895 <!-- this is good --> [[Category:Good]]
25896 <!-- this is great --> [[Kategorie:Great]]
25897 !! end
25898
25899 !! test
25900 New interlanguage links (href variations)
25901 !! options
25902 parsoid=html2wt
25903 !! html/parsoid
25904 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine bactérienne" />
25905 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bactérienne" />
25906 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bact%C3%A9rienne" />
25907 !! wikitext
25908 [[es:Toxine bactérienne]]
25909 [[es:Toxine_bactérienne]]
25910 [[es:Toxine_bactérienne]]
25911 !! end
25912
25913 !! test
25914 Image: Modifying size of an image (1)
25915 !! options
25916 parsoid={
25917 "modes": ["wt2wt"],
25918 "changes": [
25919 ["img[height]", "attr", "height", "22"],
25920 ["img[width]", "attr", "width", "200"]
25921 ]
25922 }
25923 !! wikitext
25924 [[Image:Foobar.jpg|230x230px]]
25925 !! wikitext/edited
25926 [[Image:Foobar.jpg|200x200px]]
25927 !!end
25928
25929 !! test
25930 Image: Modifying size of an image (2)
25931 !! options
25932 parsoid={
25933 "modes": ["wt2wt"],
25934 "changes": [
25935 ["img[height]", "attr", "height", "100"],
25936 ["img[width]", "attr", "width", "500"]
25937 ]
25938 }
25939 !! wikitext
25940 [[Image:Foobar.jpg|230x230px]]
25941 !! wikitext/edited
25942 [[Image:Foobar.jpg|500x500px]]
25943 !!end
25944
25945 # Change in size is ignored so long as class='mw-default-size'
25946 !! test
25947 Image: Modifying size of an image (3)
25948 !! options
25949 parsoid={
25950 "modes": ["wt2wt"],
25951 "changes": [
25952 ["figure[class]", "removeClass", "mw-default-size"],
25953 ["figure img", "attr", "height", "19"],
25954 ["figure img", "attr", "width", "170"]
25955 ]
25956 }
25957 !! wikitext
25958 [[Image:Foobar.jpg|thumb]]
25959 !! wikitext/edited
25960 [[Image:Foobar.jpg|thumb|170x170px]]
25961 !!end
25962
25963 !! test
25964 Image: Modifying alignment of an image (T50665)
25965 !! options
25966 parsoid={
25967 "modes": ["wt2wt"],
25968 "changes": [
25969 ["figure[class]", "removeClass", "mw-halign-right"],
25970 ["figure[class]", "addClass", "mw-halign-left"]
25971 ]
25972 }
25973 !! wikitext
25974 [[Image:Foobar.jpg|thumb|caption|right]]
25975 !! wikitext/edited
25976 [[Image:Foobar.jpg|thumb|caption|left]]
25977 !! end
25978
25979 !! test
25980 Image: Modifying mw-default-size of an frameless image (T64805)
25981 !! options
25982 parsoid={
25983 "modes": ["wt2wt"],
25984 "changes": [
25985 ["figure.mw-default-size", "removeClass", "mw-default-size"]
25986 ]
25987 }
25988 !! wikitext
25989 [[Image:Foobar.jpg|frameless|right]]
25990 !! wikitext/edited
25991 [[Image:Foobar.jpg|frameless|right|220x220px]]
25992 !! end
25993
25994 !! test
25995 Image: Modifying valign of an image (T51221)
25996 !! options
25997 parsoid={
25998 "modes": ["wt2wt"],
25999 "changes": [
26000 ["*[typeof=\"mw:Image\"]", "removeClass", "mw-valign-middle"],
26001 ["*[typeof=\"mw:Image\"]", "addClass", "mw-valign-text-top"]
26002 ]
26003 }
26004 !! wikitext
26005 [[File:Foobar.jpg|20px|middle]]
26006 !! wikitext/edited
26007 [[File:Foobar.jpg|20px|text-top]]
26008 !! end
26009
26010 !! test
26011 Image: Modifying alt attribute of an image (T58400)
26012 !! options
26013 parsoid={
26014 "modes": ["wt2wt"],
26015 "changes": [
26016 ["img[alt]", "attr", "alt", "some alternate edited text"]
26017 ]
26018 }
26019 !! wikitext
26020 [[File:Foobar.jpg|thumb|some caption|alt=some alternate text]]
26021 !! wikitext/edited
26022 [[File:Foobar.jpg|thumb|some caption|alt=some alternate edited text]]
26023 !!end
26024
26025 !! test
26026 Image: Modifying caption of an image
26027 !! options
26028 parsoid={
26029 "modes": ["wt2wt"],
26030 "changes": [
26031 ["figcaption", "text", "new caption"]
26032 ]
26033 }
26034 !! wikitext
26035 [[Image:Foobar.jpg|thumb|original caption]]
26036 !! wikitext/edited
26037 [[Image:Foobar.jpg|thumb|new caption]]
26038 !!end
26039
26040 !! test
26041 Image: empty alt attribute (T50924)
26042 !! options
26043 parsoid
26044 !! wikitext
26045 [[File:Foobar.jpg|thumb|alt=|bar]]
26046 !! html
26047 <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>
26048 !! end
26049
26050 !! test
26051 Image: new attributes should be serialized in wiki's language for RTL languages (T53852)
26052 !! options
26053 parsoid=html2wt
26054 language=ar
26055 disabled
26056 !! html/parsoid
26057 <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>
26058 !! wikitext
26059 [[Imagen:Foobar.jpg|derecha|miniaturadeimagen]]
26060 !! end
26061
26062 !! test
26063 Image: Block level image should have \n before and after
26064 !! wikitext
26065 123
26066 [[File:Foobar.jpg|right|thumb|150x150px]]
26067 456
26068 !! html/parsoid
26069 <p>123</p>
26070 <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>
26071 <p>456</p>
26072 !!end
26073
26074 !! test
26075 Image: New block level image should have \n before and after (existing content)
26076 !! wikitext
26077 123
26078 [[File:Foobar.jpg|right|thumb|150x150px]]
26079 456
26080 !! html/parsoid
26081 <p>123</p>
26082 <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>
26083 <p>456</p>
26084 !!end
26085
26086 !! test
26087 Image: upright option (parsoid)
26088 !! wikitext
26089 [[File:Foobar.jpg|thumb|upright|caption]]
26090 [[File:Foobar.jpg|thumb|upright=0.5|caption]]
26091 [[File:Foobar.jpg|thumb|500x500px|upright=0.5|caption]]
26092 !! html/parsoid
26093 <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>
26094 <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>
26095 <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>
26096 !!end
26097
26098 !! test
26099 Image: upright option is ignored on inline and frame images (parsoid)
26100 !! wikitext
26101 [[File:Foobar.jpg|500x500px|upright=0.5|caption]]
26102 !! html/parsoid
26103 <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>
26104 !!end
26105
26106 !! test
26107 Image: from basic HTML (1)
26108 !! options
26109 parsoid=html2wt
26110 !! html/parsoid
26111 <span typeof="mw:Image">
26112 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
26113 </span>
26114 !! wikitext
26115 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
26116 !! end
26117
26118 !! test
26119 Image: from basic HTML (2)
26120 !! options
26121 parsoid=html2wt
26122 !! html/parsoid
26123 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
26124 !! wikitext
26125 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
26126 !! end
26127
26128 !! test
26129 Image: from basic HTML (3)
26130 !! options
26131 parsoid=html2wt
26132 !! html/parsoid
26133 <a href="Main"><img src="./File:Foobar.jpg" width=100 height=100 alt="Alt"></a>
26134 !! wikitext
26135 [[File:Foobar.jpg|link=Main|alt=Alt|100x100px]]
26136 !! end
26137
26138 !! test
26139 Image: from basic HTML (4)
26140 !! options
26141 parsoid=html2wt
26142 !! html/parsoid
26143 <img src="./File:Foobar.jpg">
26144 !! wikitext
26145 [[File:Foobar.jpg|link=]]
26146 !! end
26147
26148 !! test
26149 Image: Invalid title as link
26150 !! wikitext
26151 [[File:Foobar.jpg|link=<]]
26152 !! html/php
26153 <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>
26154 </p>
26155 !! html/parsoid
26156 <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>
26157 !! end
26158
26159 !! test
26160 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
26161 !! options
26162 parsoid=html2wt
26163 !! html/parsoid
26164 <ul>
26165 <li><p>foo</p></li>
26166 </ul>
26167 !! wikitext
26168 * foo
26169 !! end
26170
26171 !! test
26172 Lists: Serialize correctly even when list tags has unneeded whitespace between tags
26173 !! options
26174 parsoid=html2wt
26175 !! html/parsoid
26176 <ul> <li>foo</li></ul>
26177 !! wikitext
26178 * foo
26179 !! end
26180
26181 !! test
26182 Don't strip leading whitespace when handling indent-pre suppressing tags
26183 !! options
26184 parsoid=html2wt
26185 !! html/parsoid
26186 <table>
26187 <tr><td> indented row</td></tr>
26188 </table>
26189 <blockquote><p>
26190 <b>This is very bold of you!</b>
26191 </p>
26192 <table><tr><td>
26193 indented cell (no pre-wrapping!)
26194 </td></tr></table>
26195 </blockquote>
26196 <p>foo</p>
26197 <div>bar</div>
26198 !! wikitext
26199 {|
26200 | indented row
26201 |}
26202 <blockquote>
26203 '''This is very bold of you!'''
26204
26205 {|
26206 |
26207 indented cell (no pre-wrapping!)
26208 |}
26209 </blockquote>
26210 foo
26211 <div>bar</div>
26212 !! end
26213
26214 !! test
26215 Nowiki-wrap leading whitespace when handling indent-pre inducing tags
26216 !! options
26217 parsoid=html2wt
26218 !! html/parsoid
26219 <p>foo</p>
26220 <span>bar</span>
26221
26222 <span>foo2
26223 </span>bar2
26224
26225 <div>foo</div>
26226 <span>bar</span>
26227
26228 <div>
26229 <span>foo</span>
26230 </div>
26231 !! wikitext
26232 foo
26233
26234 <span>bar</span>
26235
26236 <span>foo2
26237 <nowiki> </nowiki></span>bar2
26238
26239 <div>foo</div>
26240 <nowiki> </nowiki><span>bar</span>
26241
26242 <div>
26243 <nowiki> </nowiki><span>foo</span>
26244 </div>
26245 !! end
26246
26247 !! test
26248 Lists: Dont insert newlines in a serialized list item.
26249 !! options
26250 parsoid=html2wt
26251 !! html/parsoid
26252 <ul><li>a<br>b</li><li>c</li></ul>
26253 !! wikitext
26254 * a<br>b
26255 * c
26256 !! end
26257
26258 !! test
26259 1. Headings: Force sol-transparent links and behavior switches to serialize before/after
26260 !! options
26261 parsoid={
26262 "modes": ["html2wt"],
26263 "scrubWikitext": false
26264 }
26265 !! html/parsoid
26266 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
26267 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
26268
26269 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
26270 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
26271
26272 <h2 data-parsoid='{}'>howdy<link href="./Category:A5" rel="mw:PageProp/Category" /></h2>
26273
26274 <h2><meta property="mw:PageProp/toc" /> ok</h2>
26275 !! wikitext
26276 == hello there [[Category:A1]] ==
26277
26278 == [[Category:A2]] hi pal ==
26279
26280 == <!--foo--> [[Category:A3]] how goes it ==
26281
26282 == it goes well [[Category:A4]] <!--bar--> ==
26283
26284 ==howdy [[Category:A5]]==
26285
26286 == __TOC__ ok ==
26287 !! end
26288
26289 !! test
26290 2. Headings: Force sol-transparent links and behavior switches to serialize before/after
26291 !! options
26292 parsoid={
26293 "modes": ["html2wt"],
26294 "scrubWikitext": true
26295 }
26296 !! html/parsoid
26297 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
26298 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
26299
26300 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
26301 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
26302
26303 <h2><meta property="mw:PageProp/toc" /> ok</h2>
26304 !! wikitext
26305 == hello there ==
26306 [[Category:A1]]
26307 [[Category:A2]]
26308
26309 == hi pal ==
26310
26311 <!--foo--> [[Category:A3]]
26312
26313 == how goes it ==
26314
26315 == it goes well ==
26316 [[Category:A4]] <!--bar-->
26317
26318 __TOC__
26319
26320 == ok ==
26321 !! end
26322
26323 !! test
26324 Headings: Don't hoist metas that come from templates
26325 !! options
26326 parsoid={
26327 "modes": ["html2wt"],
26328 "scrubWikitext": true
26329 }
26330 !! html/parsoid
26331 <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>
26332 !! wikitext
26333 == {{echo|foo [[Category:Foo]]}} ==
26334 !! end
26335
26336 !! test
26337 Headings: Category in ref isn't hoisted
26338 !! options
26339 parsoid={
26340 "modes": ["html2wt"],
26341 "scrubWikitext": true
26342 }
26343 !! html/parsoid
26344 <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>
26345
26346 <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>
26347 !! wikitext
26348 == foo <ref>bar
26349 [[Category:Baz]] </ref> ==
26350
26351 <references />
26352 !! end
26353
26354 !! test
26355 Parsoid: Serialize positional parameters with = in them as named parameter
26356 !! options
26357 parsoid=html2wt
26358 !! html/parsoid
26359 <p about="#mwt1" typeof="mw:Transclusion"
26360 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
26361
26362 <p about="#mwt1" typeof="mw:Transclusion"
26363 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}, "2":{"wt":"bar"}},"i":0}}]}'>foo</p>
26364
26365 <!--Orig params with data-parsoid has heuristics for handling = chars-->
26366 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
26367 <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>
26368 !! wikitext
26369 {{echo|1=f=oo}}
26370
26371 {{echo|1=f=oo|2=bar}}
26372
26373 <!--Orig params with data-parsoid has heuristics for handling = chars-->
26374 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
26375 {{echo|<nowiki>f=oo</nowiki>|bar}}
26376 !! end
26377
26378 !! test
26379 Parsoid: Serialize positional parameters with = in extlink as named parameter
26380 !! options
26381 parsoid=html2wt
26382 !! html/parsoid
26383 <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>
26384 !! wikitext
26385 {{echo|1=http://stuff?is=ok}}
26386 !! end
26387
26388 !! test
26389 Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
26390 !! options
26391 parsoid=html2wt
26392 !! html/parsoid
26393 <div>a<p>b</p></div>
26394 <div>a
26395 <p>b</p></div>
26396 <div>
26397 a
26398 <p>b</p></div>
26399 !! wikitext
26400 <div>a
26401 b
26402 </div>
26403 <div>a
26404 b
26405 </div>
26406 <div>
26407 a
26408
26409 b
26410 </div>
26411 !! end
26412
26413 !! test
26414 Substrings resembling wikitext in hrefs should not get nowiki escapes
26415 !! options
26416 parsoid=html2wt
26417 !! html/parsoid
26418 <a rel="mw:WikiLink" href="./Foo''bar''baz">Foo''bar''baz</a>
26419 !! wikitext
26420 [[Foo''bar''baz]]
26421 !! end
26422
26423 !! test
26424 Enforce single-line context in the serializer
26425 !! options
26426 parsoid=html2wt
26427 !! html/parsoid
26428 <h2>testing
26429 123</h2>
26430
26431 <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">
26432 </span><span about="#mwt1">you</span> </h2>
26433
26434 <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>
26435
26436 <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
26437 there</span></li></ol>
26438
26439 <ul><li>asd
26440 sdf</li></ul>
26441
26442 <ul><li>foo
26443 bar
26444 baz</li>
26445 <li>foo <b>bar</b>
26446 baz</li></ul>
26447
26448 <dl><dt>hi
26449 ho </dt><dd data-parsoid='{"stx":"row"}'> hi
26450 ho</dd></dl>
26451
26452 <dl><dd> <table>
26453 <tbody><tr><td> ha
26454 ha
26455 ha</td></tr>
26456 </tbody></table></dd></dl>
26457 !! wikitext
26458 == testing 123 ==
26459
26460 == hi {{bogus|there
26461 you}} ==
26462
26463 == foo <ref>hello
26464 there</ref> ==
26465
26466 <references />
26467
26468 * asd sdf
26469
26470 * foo bar baz
26471 * foo '''bar''' baz
26472
26473 ; hi ho : hi ho
26474
26475 : {|
26476 | ha
26477 ha
26478 ha
26479 |}
26480 !! end
26481
26482 !! test
26483 Serialize new placeholder space without spans
26484 !! options
26485 parsoid=html2wt
26486 !! html/parsoid
26487 <p>foo<span typeof="mw:Placeholder"> </span>: bar</p>
26488
26489 <p>foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span>: bar</p>
26490
26491 <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>
26492 !! wikitext
26493 foo : bar
26494
26495 foo : bar
26496
26497 <ref>foo : bar</ref>ok
26498 !! end
26499
26500
26501 #-----------------------
26502 # Tag minimization tests
26503 #-----------------------
26504
26505 !! test
26506 1. I/B quote minimization: wikitext-only tags should be combined
26507 !! options
26508 parsoid=html2wt
26509 !! html/parsoid
26510 <p><i>A</i><i>B</i></p>
26511 <p><b>A</b><b>B</b></p>
26512 <p><i>A</i><b><i>B</i></b></p>
26513 <p><b>A</b><i><b>B</b></i></p>
26514 <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
26515 <p><i><b>A</b></i><i><b>B</b></i></p>
26516 <p><i><b>A</b></i><b><i>B</i></b></p>
26517 <p><b><i>A</i></b><i><b>B</b></i></p>
26518 !! wikitext
26519 ''AB''
26520
26521 '''AB'''
26522
26523 ''A'''B'''''
26524
26525 '''A''B'''''
26526
26527 '''A''BC''D'''
26528
26529 '''''AB'''''
26530
26531 '''''AB'''''
26532
26533 '''''AB'''''
26534 !! end
26535
26536 !! test
26537 2. I/B quote minimization: wikitext and html tags should not be combined
26538 !! options
26539 parsoid=html2wt
26540 !! html/parsoid
26541 <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
26542 <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
26543 !! wikitext
26544 ''A''<i>B</i>
26545
26546 ''A''<nowiki/>'''<i>B</i>'''
26547 !! end
26548
26549 !! test
26550 3. I/B quote minimization: templated content stops minimization
26551 !! options
26552 parsoid=html2wt
26553 !! html/parsoid
26554 <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>
26555 <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>
26556 !! wikitext
26557 ''A''{{echo|''B''}}
26558
26559 ''A''{{echo|'''''B'''''}}
26560 !! end
26561
26562 !! test
26563 4. I/B quote minimization: new content should be mimimized with adjacent old content
26564 !! options
26565 parsoid=html2wt
26566 !! html/parsoid
26567 <p><i>A</i><i>B</i></p>
26568 <p><b>A</b><b>B</b></p>
26569 <p><i>A</i><b><i>B</i></b></p>
26570 !! wikitext
26571 ''AB''
26572
26573 '''AB'''
26574
26575 ''A'''B'''''
26576 !! end
26577
26578 !! test
26579 5a. Merge adjacent quote nodes if they've been edited
26580 !! options
26581 parsoid={
26582 "modes": ["wt2wt", "selser"],
26583 "changes": [
26584 ["p", "contents", "remove", ":contains('b')"]
26585 ]
26586 }
26587 !! wikitext
26588 ''a''b''c''
26589 !! wikitext/edited
26590 ''ac''
26591 !! end
26592
26593 !! test
26594 5b. Merge adjacent quote nodes if they've been edited
26595 !! options
26596 parsoid={
26597 "modes": ["wt2wt", "selser"],
26598 "changes": [
26599 ["#x", "remove"]
26600 ]
26601 }
26602 !! wikitext
26603 ''a''<span id="x">b</span>''c''
26604 !! wikitext/edited
26605 ''ac''
26606 !! end
26607
26608 !! test
26609 1. Merge adjacent link nodes as long as at least one element is new
26610 !! options
26611 parsoid={
26612 "modes": ["html2wt"],
26613 "scrubWikitext": true
26614 }
26615 !! html/parsoid
26616 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
26617 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
26618 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a data-parsoid="{}" rel="mw:WikiLink" href="./Football">ball</a>
26619 !! wikitext
26620 [[Football]]
26621 [[Football]]
26622 [[Football|Foot]][[Football|ball]]
26623 !! end
26624
26625 !! test
26626 2. Merge adjacent link nodes and enable additional normalizations
26627 !! options
26628 parsoid={
26629 "modes": ["html2wt"],
26630 "scrubWikitext": true
26631 }
26632 !! html/parsoid
26633 <a rel="mw:WikiLink" href="./Football"><i>Foot</i></a><a rel="mw:WikiLink" href="./Football"><i>ball</i></a>
26634 !! wikitext
26635 [[Football|''Football'']]
26636 !! end
26637
26638 !! test
26639 3. Don't merge adjacent link nodes if scrubWikitext is false
26640 !! options
26641 parsoid={
26642 "modes": ["html2wt"],
26643 "scrubWikitext": false
26644 }
26645 !! html/parsoid
26646 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
26647 !! wikitext
26648 [[Football|Foot]][[Football|ball]]
26649 !! end
26650
26651 #------------------------------
26652 # End of tag minimization tests
26653 #------------------------------
26654
26655 !!test
26656 T56262: New entities
26657 !! options
26658 parsoid=html2wt
26659 !! html/parsoid
26660 <span typeof="mw:Entity">&nbsp;</span>
26661 !! wikitext
26662 &nbsp;
26663 !! end
26664
26665 ## Note that there is no wikitext output for 'unknownproperty' ##
26666 ## Unknown magic words are silently dropped ##
26667
26668 !! test
26669 Magic words
26670 !! options
26671 parsoid=html2wt
26672 !! html/parsoid
26673 <meta property='mw:PageProp/toc' />
26674 <meta property='mw:PageProp/notoc' />
26675 <meta property='mw:PageProp/forcetoc' />
26676 <meta property='mw:PageProp/index' />
26677 <meta property='mw:PageProp/noindex' />
26678 <meta property='mw:PageProp/nogallery' />
26679 <meta property='mw:PageProp/noeditsection' />
26680 <meta property='mw:PageProp/notitleconvert' />
26681 <meta property='mw:PageProp/nocontentconvert' />
26682 <meta property='mw:PageProp/unknownproperty' />
26683 !! wikitext
26684 __TOC__
26685 __NOTOC__
26686 __FORCETOC__
26687 __INDEX__
26688 __NOINDEX__
26689 __NOGALLERY__
26690 __NOEDITSECTION__
26691 __NOTITLECONVERT__
26692 __NOCONTENTCONVERT__
26693 !! end
26694
26695 !! test
26696 Consecutive <pre>s should not get merged
26697 !! options
26698 parsoid=html2wt,html2html
26699 !! html/parsoid
26700 <pre>a</pre><pre>b</pre>
26701
26702 <pre>c
26703 </pre><pre>
26704 d</pre>
26705
26706 <pre>e
26707
26708 </pre><pre>
26709
26710 f</pre>
26711 !! wikitext
26712 a
26713
26714 b
26715
26716 c
26717
26718 d
26719
26720 e
26721
26722
26723
26724 f
26725 !! end
26726
26727 !! test
26728 Edited ISBN links not serializable as ISBN links should serialize as wikilinks
26729 !! options
26730 parsoid=html2wt
26731 !! html/parsoid
26732 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink">ISBN 1234567895</a>
26733 !! wikitext
26734 [[Special:BookSources/1234567890|ISBN 1234567895]]
26735 !! end
26736
26737 !! test
26738 Edited RFC links not serializable as RFC links should serialize as extlinks
26739 !! options
26740 parsoid=html2wt
26741 !! html/parsoid
26742 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink">New RFC</a>
26743 !! wikitext
26744 [//tools.ietf.org/html/rfc123 New RFC]
26745 !! end
26746
26747 !! test
26748 Edited PMID links not serializable as PMID links should serialize as extlinks
26749 !! options
26750 parsoid=html2wt
26751 !! html/parsoid
26752 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink">New PMID</a>
26753 !! wikitext
26754 [//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract New PMID]
26755 !! end
26756
26757 !! test
26758 WTS of autolinks with trailing/surrounding context
26759 !! options
26760 parsoid=html2wt
26761 !! html/parsoid
26762 <p><a href="http://cscott.net">http://cscott.net</a><b>foo</b></p>
26763 <p><a href="http://cscott.net">http://cscott.net</a><b data-parsoid='{"stx":"html"}'>foo</b></p>
26764 <p><b><a href="http://cscott.net">http://cscott.net</a></b></p>
26765 <p><b><a href="http://cscott.net">http://cscott.net</a> </b></p>
26766 <p><b><a href="http://cscott.net">http://cscott.net</a>x</b></p>
26767 <p><a href="http://cscott.net">http://cscott.net</a>x</p>
26768 !! wikitext
26769 http://cscott.net'''foo'''
26770
26771 http://cscott.net<b>foo</b>
26772
26773 '''http://cscott.net'''
26774
26775 '''http://cscott.net '''
26776
26777 '''http://cscott.net<nowiki/>x'''
26778
26779 http://cscott.net<nowiki/>x
26780 !! end
26781
26782 !! test
26783 WTS of autolinks with nowikis (round-trip)
26784 !! wikitext
26785 x<nowiki/>http://cscott.net<nowiki/>x
26786 !! html/parsoid
26787 <p>x<a rel="mw:ExtLink" href="http://cscott.net">http://cscott.net</a>x</p>
26788 !! end
26789
26790 # this is the "easy" test because it leaves in place all the
26791 # data-parsoid information indicating this is an autolink
26792 !! test
26793 WTS of autolinks with escapes (editing)
26794 !! options
26795 parsoid={
26796 "modes": ["wt2wt"],
26797 "changes": [
26798 [ "meta", "remove" ]
26799 ]
26800 }
26801 !! wikitext
26802 x<nowiki/>http://cscott.net<nowiki/>x
26803 !! wikitext/edited
26804 x<nowiki/>http://cscott.net<nowiki/>x
26805 !! end
26806
26807 !! test
26808 WTS of edited autolink-like text (T103364)
26809 !! options
26810 parsoid={
26811 "modes": ["wt2wt"],
26812 "changes": [
26813 [ "span[typeof]", "removeAttr", "typeof" ]
26814 ]
26815 }
26816 !! wikitext
26817 Not a link: <nowiki>http://example.com</nowiki>.
26818 !! wikitext/edited
26819 Not a link: <span><nowiki>http://example.com</nowiki></span>.
26820 !! end
26821
26822 !! test
26823 WTS of newly-authored autolink-like text (T103364)
26824 !! options
26825 parsoid=html2wt
26826 !! html/parsoid
26827 <p>http://example.com is not a link.</p>
26828 !! wikitext
26829 <nowiki>http://example.com</nowiki> is not a link.
26830 !! end
26831
26832 !! test
26833 WTS of autolink-like text after an autolink (T108563)
26834 !! options
26835 parsoid=html2wt
26836 !! html/parsoid
26837 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a> http://example.com is not a link.</p>
26838 !! wikitext
26839 http://example.com <nowiki>http://example.com</nowiki> is not a link.
26840 !! end
26841
26842 !! test
26843 Magic links inside links (not autolinked)
26844 !! wikitext
26845 [[Foo|http://example.com]]
26846 [[Foo|RFC 1234]]
26847 [[Foo|PMID 1234]]
26848 [[Foo|ISBN 123456789x]]
26849
26850 [http://foo.com http://example.com]
26851 [http://foo.com RFC 1234]
26852 [http://foo.com PMID 1234]
26853 [http://foo.com ISBN 123456789x]
26854 !! html+tidy
26855 <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>
26856 <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>
26857 !! html/parsoid
26858 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">http://example.com</a>
26859 <a rel="mw:WikiLink" href="./Foo" title="Foo">RFC 1234</a>
26860 <a rel="mw:WikiLink" href="./Foo" title="Foo">PMID 1234</a>
26861 <a rel="mw:WikiLink" href="./Foo" title="Foo">ISBN 123456789x</a></p>
26862
26863 <p><a rel="mw:ExtLink" href="http://foo.com">http://example.com</a>
26864 <a rel="mw:ExtLink" href="http://foo.com">RFC 1234</a>
26865 <a rel="mw:ExtLink" href="http://foo.com">PMID 1234</a>
26866 <a rel="mw:ExtLink" href="http://foo.com">ISBN 123456789x</a></p>
26867 !! end
26868
26869 !! test
26870 Magic links inside image captions (autolinked)
26871 !! wikitext
26872 [[File:Foobar.jpg|thumb|http://example.com]]
26873 [[File:Foobar.jpg|thumb|RFC 1234]]
26874 [[File:Foobar.jpg|thumb|PMID 1234]]
26875 [[File:Foobar.jpg|thumb|ISBN 123456789x]]
26876 !! html+tidy
26877 <div class="thumb tright">
26878 <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>
26879 <div class="thumbcaption">
26880 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
26881 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></div>
26882 </div>
26883 </div>
26884 <div class="thumb tright">
26885 <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>
26886 <div class="thumbcaption">
26887 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
26888 <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a></div>
26889 </div>
26890 </div>
26891 <div class="thumb tright">
26892 <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>
26893 <div class="thumbcaption">
26894 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
26895 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a></div>
26896 </div>
26897 </div>
26898 <div class="thumb tright">
26899 <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>
26900 <div class="thumbcaption">
26901 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
26902 <a href="/wiki/Special:BookSources/123456789X" class="internal mw-magiclink-isbn">ISBN 123456789x</a></div>
26903 </div>
26904 </div>
26905 !! html/parsoid
26906 <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>
26907 <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>
26908 <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>
26909 <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>
26910 !! end
26911
26912 !! test
26913 WTS of magic word text (T109371)
26914 !! options
26915 parsoid=html2wt
26916 !! html/parsoid
26917 <p>RFC 1234</p>
26918 <p><a href="http://foo.com" rel="mw:ExtLink">RFC 1234</a></p>
26919 <p><a href="./Foo" rel="mw:WikiLink">RFC 1234</a></p>
26920 !! wikitext
26921 <nowiki>RFC 1234</nowiki>
26922
26923 [http://foo.com RFC 1234]
26924
26925 [[Foo|RFC 1234]]
26926 !! end
26927
26928 !! test
26929 Edited Redirect link should emit a non-piped wikitext link
26930 !! options
26931 parsoid=html2wt
26932 !! html/parsoid
26933 <link rel="mw:PageProp/redirect" href="Bar" data-parsoid='{"a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>
26934 !! wikitext
26935 #REDIRECT [[Bar]]
26936 !! end
26937
26938 !! test
26939 T75121: Infer extension name from typeOf if data-mw is not present
26940 !! options
26941 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
26942 !! html/parsoid
26943 <div typeOf="mw:Extension/foo"></div>
26944 !! wikitext
26945 <foo />
26946 !! end
26947
26948 # Note that the <p> wrapping isn't present in PHP parser output
26949 # The important thing for this test is that P-wrapping doesn't
26950 # interfere with the <nowiki> protection for leading - in <td>
26951 # (which isn't necessary for <th>).
26952 !! test
26953 T88318: p-wrapped dash in table.
26954 !! options
26955 parsoid=html2wt,wt2wt
26956 !! html/parsoid
26957 <table><tbody>
26958 <tr><th><p>-</p></th><th><p>- </p></th></tr>
26959 <tr><td><p>-</p></td><td><p>- </p></td></tr>
26960 <tr><td><small>-</small></td><td><br/><p>-</p></td><td><br/>-</td></tr>
26961 </tbody></table>
26962 !! wikitext
26963 {|
26964 !-
26965 !-
26966 |-
26967 |<nowiki>-</nowiki>
26968 |<nowiki>- </nowiki>
26969 |-
26970 |<small>-</small>
26971 |<br>
26972 -
26973 |<br>
26974 -
26975 |}
26976 !! html/php+tidy
26977 <table>
26978 <tr>
26979 <th>-</th>
26980 <th>-</th>
26981 </tr>
26982 <tr>
26983 <td>-</td>
26984 <td>-</td>
26985 </tr>
26986 <tr>
26987 <td><small>-</small></td>
26988 <td><br />
26989 <p>-</p>
26990 </td>
26991 <td><br />
26992 <p>-</p>
26993 </td>
26994 </tr>
26995 </table>
26996 !! end
26997
26998 !! test
26999 T149209: WTS: Handle newlines in table cells properly
27000 !! options
27001 parsoid=html2wt
27002 !! html/parsoid
27003 <table>
27004 <tbody>
27005 <tr><td>a
27006 b
27007 </td><td data-parsoid='{"stx_v":"row"}'>c</td></tr>
27008 <tr><td><p>x</p>
27009 </td><td data-parsoid='{"stx_v":"row", "startTagSrc": "{{!}}{{!}}"}'>y</td></tr>
27010 </tbody></table>
27011 <table>
27012 <tbody>
27013 <tr><th>a
27014 b
27015 </th><th data-parsoid='{"stx_v":"row"}'>c</th></tr>
27016 <tr><th><p>x</h>
27017 </th><th data-parsoid='{"stx_v":"row"}'>y</th></tr>
27018 </tbody></table>
27019 !! wikitext
27020 {|
27021 |a
27022 b
27023 |c
27024 |-
27025 |x
27026 {{!}}y
27027 |}
27028 {|
27029 !a
27030 b
27031 !c
27032 |-
27033 !x
27034 !y
27035 |}
27036 !! end
27037
27038 !! test
27039 T149209: Selser: Handle newlines in table cells properly
27040 !! options
27041 parsoid={
27042 "modes": ["selser"],
27043 "changes": [
27044 [ "#h1", "html", "a\nb\n" ],
27045 [ "#h2", "html", "a\nb\n" ],
27046 [ "#c1", "html", "a\nb\n" ],
27047 [ "#c2", "html", "<p>a</p>" ],
27048 [ "#c3", "html", "<p>a</p>" ],
27049 [ "#c4", "html", "edit-me<p>a</p>" ]
27050 ]
27051 }
27052 !! wikitext
27053 {|
27054 ! id="h1" |edit-me!!1
27055 |-
27056 ! id="h2" |edit-me||2
27057 |-
27058 | id="c1" |edit-me||3
27059 |-
27060 | id="c2" |edit-me||4
27061 |-
27062 | id="c3" |edit-me||p||q||r
27063 |-
27064 | id="c4" |edit-me||p||q||r
27065 |}
27066 !! wikitext/edited
27067 {|
27068 ! id="h1" |a
27069 b
27070 !1
27071 |-
27072 ! id="h2" |a
27073 b
27074 !2
27075 |-
27076 | id="c1" |a
27077 b
27078 |3
27079 |-
27080 | id="c2" |a
27081 |4
27082 |-
27083 | id="c3" |a
27084 |p||q||r
27085 |-
27086 | id="c4" |edit-me
27087 a
27088 |p||q||r
27089 |}
27090 !! end
27091
27092 !! test
27093 HTML id attribute with Parsoid-like element ids should not be serialized to wikitext
27094 !! options
27095 parsoid=html2wt
27096 !! html/parsoid
27097 <table id='mwAb'>
27098 <td id='mwAc'>foo</td>
27099 <td id='serialize-this'>bar</td>
27100 </table>
27101 !! wikitext
27102 {|
27103 |foo
27104 | id="serialize-this" |bar
27105 |}
27106 !! end
27107
27108 !! test
27109 Parsoid-like element ids should not be serialized to wikitext unless shadowed
27110 !! options
27111 parsoid=html2wt
27112 !! html/parsoid
27113 <div id="mwAQ" data-parsoid='{"stx":"html","a":{"id":"mwAQ"},"sa":{"id":"hello"}}'>ok</div>
27114 !! wikitext
27115 <div id="hello">ok</div>
27116 !! end
27117
27118 !! test
27119 WTS change modes
27120 !! options
27121 parsoid={
27122 "modes": ["wt2wt"],
27123 "changes": [
27124 [ "#xyz", "before", "<b>before</b> stuff " ],
27125 [ "#xyz", "after", " stuff <i>after</i>" ],
27126 [ "#xyz", "html", "x <b>y</b> z" ]
27127 ]
27128 }
27129 !! wikitext
27130 <span id="xyz">hello</span>
27131 !! wikitext/edited
27132 '''before''' stuff <span id="xyz">x '''y''' z</span> stuff ''after''
27133 !! end
27134
27135 !! test
27136 Never serialize a-tag as html, regardless of what data-parsoid has to say
27137 !! options
27138 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
27139 !! html/parsoid
27140 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"html"}'>Foo</a>
27141 !! wikitext
27142 [[Foo]]
27143 !! end
27144
27145 ## SSS FIXME: This is broken output nevertheless.
27146 ## What might be a reasonable non-broken output for this?
27147 ## This is an edge case unlikely to be seen in production
27148 ## that I am not wasting more time on this right now.
27149 !! test
27150 Never serialize a-tag as html, no matter what attributes it has
27151 !! options
27152 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
27153 !! html/parsoid
27154 <a bad='true' href='http://boo.org'><img src='http://boohoo.org' /></a>
27155 !! wikitext
27156 [http://boo.org http://boohoo.org]
27157 !! end
27158
27159 # Misnested is an indication that selser can reuse the source but these have
27160 # shown to sneak through on occasion. See T101768.
27161 # The original wikitext here is: [http://test.com [[one]] two three]
27162 !! test
27163 Strip span tags added to mark misnested links
27164 !! options
27165 parsoid=html2wt
27166 !! html/parsoid
27167 <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>
27168 !! wikitext
27169 [http://test.com][[one]] two three
27170 !! end
27171
27172 !! test
27173 Use data-parsoid.firstWikitextNode to compute newline constraints for template content
27174 !! options
27175 parsoid=html2wt
27176 !! html/parsoid
27177 <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|}"]}'>
27178 <tbody><tr><td>d
27179 </td></tr>
27180 </tbody></table>
27181 !! wikitext
27182 {{echo|a}}
27183 {|{{echo|c
27184 {{!}}d
27185 }}
27186 |}
27187 !! end
27188
27189 ## This test verifies the presence and computation of this attribute indirectly
27190 ## by making an edit and ensuring that the serialization is correct (which it would be
27191 ## only if firstWikitextNode is properly set).
27192 !! test
27193 data-parsoid.firstWikitextNode should be computed properly in the presence of fostered content
27194 !! options
27195 parsoid= {
27196 "modes": ["wt2wt"],
27197 "changes": [
27198 [ "div#x", "remove" ],
27199 [ "div", "before", "<div>new</div>" ]
27200 ]
27201 }
27202 !! wikitext
27203 <div id="x">foo</div>
27204 {|
27205 {{echo|<div>boo</div>
27206 {{!}}b}}
27207 |c
27208 |}
27209 !! wikitext/edited
27210
27211 <div>new</div>
27212 {|
27213 {{echo|<div>boo</div>
27214 {{!}}b}}
27215 |c
27216 |}
27217 !! end
27218
27219 # --------------------------------------------
27220 # Tests spec'ing wikitext serialization norms |
27221 # --------------------------------------------
27222
27223 !! test
27224 1. Categories should always be serialized on their own line
27225 !! options
27226 parsoid=html2wt
27227 !! html/parsoid
27228 foo<link rel="mw:PageProp/Category" href="./Category:Foo">bar
27229 !! wikitext
27230 foo
27231 [[Category:Foo]]
27232 bar
27233 !! end
27234
27235 !! test
27236 2. Categories that are part of templates should not introduce a line break
27237 !! wikitext
27238 foo {{echo|<span>bar</span> [[Category:baz]]}} bar
27239 !! html/parsoid
27240 <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>
27241 !! end
27242
27243 # Careful while editing these next 2 tests. There are \u200f characters
27244 # before and after the <link> tags in the HTML and following some
27245 # of the categories in wikitext
27246 # Do not remove these characters in edits.
27247 #
27248 # As part of the serialization, these bidi characters will get stripped.
27249 !! test
27250 RTL (\u200f) and LTR (\u200e) markers around category tags should be stripped
27251 !! options
27252 parsoid={
27253 "modes": ["html2wt"],
27254 "scrubWikitext": true
27255 }
27256 !! html/parsoid
27257 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏
27258 ‏<link rel="mw:PageProp/Category" href="./קטגוריה:_שיטות_משפט" />‏</p>
27259 !! wikitext
27260 [[קטגוריה:טקסים]]
27261 [[קטגוריה: שיטות משפט]]
27262 !! end
27263
27264 !! test
27265 RTL (\u200f) and LTR (\u200e) markers should not be stripped if followed by a text node
27266 !! options
27267 parsoid={
27268 "modes": ["html2wt"],
27269 "scrubWikitext": true
27270 }
27271 !! html/parsoid
27272 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏y</p>
27273 !! wikitext
27274 [[קטגוריה:טקסים]]
27275 ‏y
27276 !! end
27277
27278 !! test
27279 Lists: Add space after bullets
27280 !! options
27281 parsoid=html2wt
27282 !! html/parsoid
27283 <ul>
27284 <li>foo</li>
27285 <li> bar</li>
27286 <li><span> baz</span></li>
27287 </ul>
27288 !! wikitext
27289 * foo
27290 * bar
27291 * <span> baz</span>
27292 !! end
27293
27294 !! test
27295 1. Headings: Add space before/after == (T53744)
27296 !! options
27297 parsoid=html2wt
27298 !! html/parsoid
27299 <h2>foo</h2>
27300 <h2> bar</h2>
27301 <h2>baz </h2>
27302 <h2><span> baz</span></h2>
27303 !! wikitext
27304 == foo ==
27305
27306 == bar ==
27307
27308 == baz ==
27309
27310 == <span> baz</span> ==
27311 !! end
27312
27313 !! test
27314 2. Headings: Add space before/after == even after hoisted content
27315 !! options
27316 parsoid={
27317 "modes": ["html2wt"],
27318 "scrubWikitext": true
27319 }
27320 !! html/parsoid
27321 <h2> <link href="./Category:A2" rel="mw:PageProp/Category" />ok</h2>
27322 !! wikitext
27323 [[Category:A2]]
27324
27325 == ok ==
27326 !! end
27327
27328 !! test
27329 1. Headings: suppress newly created empty headings
27330 !! options
27331 parsoid={
27332 "modes": ["html2wt"],
27333 "scrubWikitext": true
27334 }
27335 !! html/parsoid
27336 <h2></h2>
27337 !! wikitext
27338 !! end
27339
27340 !! test
27341 2. Headings: don't suppress empty headings if scrubWikitext is false
27342 !! options
27343 parsoid=html2wt
27344 !! html/parsoid
27345 <h2></h2>
27346 !! wikitext
27347 ==<nowiki/>==
27348 !! end
27349
27350 !! test
27351 3. Headings: suppress empty headings on edits
27352 !! options
27353 parsoid={
27354 "modes": ["selser"],
27355 "scrubWikitext": true,
27356 "changes": [
27357 [ "#x", "remove"]
27358 ]
27359 }
27360 !! wikitext
27361 ==<span id="x">foo</span>==
27362 !! wikitext/edited
27363 !! end
27364
27365 !! test
27366 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = true)
27367 !! options
27368 parsoid={
27369 "modes": ["html2wt"],
27370 "scrubWikitext": true
27371 }
27372 !! html/parsoid
27373 <h2>foo<br/>bar</h2>
27374 <h2>foo <span><br/>bar</span> baz</h2>
27375 !! wikitext
27376 == foo bar ==
27377
27378 == foo <span> bar</span> baz ==
27379 !! end
27380
27381 !! test
27382 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = false)
27383 !! options
27384 parsoid={
27385 "modes": ["html2wt"],
27386 "scrubWikitext": false
27387 }
27388 !! html/parsoid
27389 <h2>foo<br/>bar</h2>
27390 !! wikitext
27391 == foo<br> bar ==
27392 !! end
27393
27394 !! test
27395 1. WT Quote Tags: suppress newly created empty style tags
27396 !! options
27397 parsoid={
27398 "modes": ["html2wt"],
27399 "scrubWikitext": true
27400 }
27401 !! html/parsoid
27402 <i></i><b></b>
27403 !! wikitext
27404 !! end
27405
27406 !! test
27407 2. WT Quote Tags: don't suppress empty style tags if scrubWikitext is false
27408 !! options
27409 parsoid=html2wt
27410 !! html/parsoid
27411 <i></i><b></b>
27412 !! wikitext
27413 ''<nowiki/>'''''<nowiki/>'''
27414 !! end
27415
27416 !! test
27417 3. WT Quote Tags: suppress empty style tags on edits
27418 !! options
27419 parsoid={
27420 "modes": ["selser"],
27421 "scrubWikitext": true,
27422 "changes": [
27423 [ "#x", "remove"]
27424 ]
27425 }
27426 !! wikitext
27427 '''<span id="x">foo</span>'''
27428 !! wikitext/edited
27429 !! end
27430
27431 !! test
27432 1. Anchors: suppress newly created empty anchors
27433 !! options
27434 parsoid={
27435 "modes": ["html2wt"],
27436 "scrubWikitext": true
27437 }
27438 !! html/parsoid
27439 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
27440 !! wikitext
27441 !! end
27442
27443 !! test
27444 2. Anchors: don't suppress empty anchors if scrubWikitext is false
27445 !! options
27446 parsoid={
27447 "modes": ["html2wt"],
27448 "scrubWikitext": false
27449 }
27450 !! html/parsoid
27451 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
27452 !! wikitext
27453 [[Test|<nowiki/>]]
27454 !! end
27455
27456 !! test
27457 3. Anchors: suppress empty anchors on edits
27458 !! options
27459 parsoid={
27460 "modes": ["selser"],
27461 "scrubWikitext": true,
27462 "changes": [
27463 [ "#x", "remove"]
27464 ]
27465 }
27466 !! wikitext
27467 [[Test|<span id="x">foo</span>]]
27468 !! wikitext/edited
27469 !! end
27470
27471 !! test
27472 3a. Anchors: do not suppress numbered extlinks
27473 !! options
27474 parsoid={
27475 "modes": ["wt2wt"],
27476 "scrubWikitext": true
27477 }
27478 !! wikitext
27479 [http://foo.com]
27480 !! html/parsoid
27481 <a rel="mw:ExtLink" href="http://foo.com"></a>
27482 !! end
27483
27484 !! test
27485 3b. Anchors: do not suppress numbered extlinks
27486 !! options
27487 parsoid={
27488 "modes": ["wt2wt"],
27489 "scrubWikitext": true,
27490 "changes": [
27491 [ "#x", "remove"]
27492 ]
27493 }
27494 !! wikitext
27495 [http://foo.com <span id="x">foo</span>]
27496 !! wikitext/edited
27497 [http://foo.com]
27498 !! end
27499
27500 !!test
27501 Normalizations should be restricted to edited content
27502 !!options
27503 parsoid={
27504 "modes": ["selser"],
27505 "scrubWikitext": true,
27506 "changes": [
27507 [ "h1", "before", "<i></i>"]
27508 ]
27509 }
27510 !!wikitext
27511 a
27512 = =
27513 b
27514 !!wikitext/edited
27515 a
27516 = =
27517 b
27518 !!end
27519
27520 !! test
27521 1. Multiple normalizations (html2wt)
27522 !! options
27523 parsoid={
27524 "modes": ["html2wt"],
27525 "scrubWikitext": true
27526 }
27527 !! html
27528 <h2><i></i></h2>
27529 <p><a href='Foo' rel='mw:WikiLink'>foo<i></i>
27530 </a><b><i></i></b>x</p>
27531 !! wikitext
27532
27533 [[foo]]
27534 x
27535
27536 !! end
27537
27538 !! test
27539 2. Multiple normalizations (selser)
27540 !! options
27541 parsoid={
27542 "modes": ["selser"],
27543 "scrubWikitext": true,
27544 "changes": [
27545 [ "#x", "after", "<h1><i></i></h1>\n<p> x<b></b></p>"]
27546 ]
27547 }
27548 !! wikitext
27549 <span id="x">foo</span>
27550 !! wikitext/edited
27551 <span id="x">foo</span>
27552
27553 x
27554 !! end
27555
27556 !! test
27557 1. Indent Pre Nowiki: suppress whitespace at the start of new paragraph
27558 !! options
27559 parsoid={
27560 "modes": ["html2wt"],
27561 "scrubWikitext": true
27562 }
27563 !! html/parsoid
27564 <p> hi</p>
27565 <p> hello</p>
27566 !! wikitext
27567 hi
27568
27569 hello
27570 !! end
27571
27572 !! test
27573 2. Indent Pre Nowiki: don't suppress whitespace at the start of new paragraph if scrubWikitext is false
27574 !! options
27575 parsoid=html2wt
27576 !! html/parsoid
27577 <p> hi</p>
27578 <p> hello</p>
27579 !! wikitext
27580 <nowiki> </nowiki>hi
27581
27582 <nowiki> </nowiki> hello
27583 !! end
27584
27585 !! test
27586 3. Indent Pre Nowiki: suppress whitespace after newlines in new paragraph or table cell
27587 !! options
27588 parsoid={
27589 "modes": ["html2wt"],
27590 "scrubWikitext": true
27591 }
27592 !! html/parsoid
27593 <p>Foo
27594 bar
27595 baz</p>
27596
27597 <table><tr><td>Foo
27598 bar
27599 baz bang</td></tr></table>
27600
27601 <p><!--boo--> foo
27602 bar</p>
27603
27604 <p> foo
27605 bar<span>boo</span></p>
27606 !! wikitext
27607 Foo
27608 bar
27609 baz
27610
27611 {|
27612 |Foo
27613 bar
27614 baz bang
27615 |}
27616
27617 <!--boo-->foo
27618 bar
27619
27620 foo
27621 bar<span>boo</span>
27622 !! end
27623
27624 !! test
27625 4. Indent Pre Nowiki: suppress leading whitespace in edited paragraphs
27626 !! options
27627 parsoid={
27628 "modes": ["selser"],
27629 "scrubWikitext": true,
27630 "changes": [
27631 [ "p", "html", " a\n b" ]
27632 ]
27633 }
27634 !! wikitext
27635 xyz
27636 !! wikitext/edited
27637 a
27638 b
27639 !! end
27640
27641 !! test
27642 1. New links that end in spaces
27643 !! options
27644 parsoid={
27645 "modes": ["html2wt"],
27646 "scrubWikitext": false
27647 }
27648 !! html/parsoid
27649 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
27650 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
27651 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
27652 !! wikitext
27653 [[Berlin ]]<nowiki/>is the capital of Germany.
27654
27655 [[Foo ]]'''bar'''
27656
27657 [[Boston ]] is a city.
27658 !! end
27659
27660 !! test
27661 2. New links that end in spaces
27662 !! options
27663 parsoid={
27664 "modes": ["html2wt"],
27665 "scrubWikitext": true
27666 }
27667 !! html/parsoid
27668 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
27669 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
27670 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
27671 !! wikitext
27672 [[Berlin]] is the capital of Germany.
27673
27674 [[Foo]] '''bar'''
27675
27676 [[Boston]] is a city.
27677 !! end
27678
27679 !! test
27680 1. Table cells with escapable prefixes
27681 !! options
27682 parsoid={
27683 "modes": ["html2wt"],
27684 "scrubWikitext": false
27685 }
27686 !! html
27687 <table>
27688 <tr><td>a</td></tr>
27689 <tr><td>-</td></tr>
27690 <tr><td>+</td></tr>
27691 </table>
27692 !! wikitext
27693 {|
27694 |a
27695 |-
27696 |<nowiki>-</nowiki>
27697 |-
27698 |<nowiki>+</nowiki>
27699 |}
27700 !! end
27701
27702 !! test
27703 2. Table cells with escapable prefixes
27704 !! options
27705 parsoid={
27706 "modes": ["html2wt"],
27707 "scrubWikitext": true
27708 }
27709 !! html
27710 <table>
27711 <tr><td>a</td></tr>
27712 <tr><td>-</td></tr>
27713 <tr><td>+</td></tr>
27714 </table>
27715 !! wikitext
27716 {|
27717 |a
27718 |-
27719 | -
27720 |-
27721 | +
27722 |}
27723 !! end
27724
27725 !! test
27726 3a. Table cells with escapable prefixes after edits
27727 !! options
27728 parsoid={
27729 "modes": ["selser"],
27730 "scrubWikitext": true,
27731 "changes": [
27732 [ "table tbody tr:first-child td:first-child", "remove"]
27733 ]
27734 }
27735 !! wikitext
27736 {|
27737 |a||-
27738 |}
27739 !! wikitext/edited
27740 {|
27741 | -
27742 |}
27743 !! end
27744
27745 !! test
27746 3b. Table cells with escapable prefixes after edits
27747 !! options
27748 parsoid={
27749 "modes": ["selser"],
27750 "scrubWikitext": true,
27751 "changes": [
27752 [ "table tbody tr:first-child td:first-child", "html", "-" ],
27753 [ "#x", "remove" ]
27754 ]
27755 }
27756 !! wikitext
27757 {|
27758 |pqr
27759 |<span id="x">foo</span>+
27760 |}
27761 !! wikitext/edited
27762 {|
27763 | -
27764 | +
27765 |}
27766 !! end
27767
27768 # FIXME: This test will fail because
27769 # normalization doesn't realize that the id attribute
27770 # will eliminate the escapable scenario
27771 !! test
27772 4a. Table cells without escapable prefixes after edits
27773 !! options
27774 parsoid={
27775 "modes": ["selser"],
27776 "scrubWikitext": true,
27777 "changes": [
27778 [ "#x", "html", "-" ]
27779 ]
27780 }
27781 !! wikitext
27782 {|
27783 | id="x" |abcd
27784 |}
27785 !! wikitext/edited
27786 {|
27787 | id="x" |-
27788 |}
27789 !! end
27790
27791 ## This tests normalizer's ability to discriminate between
27792 ## cells having identical content.
27793 !! test
27794 4b. Table cells without escapable prefixes after edits
27795 !! options
27796 parsoid={
27797 "modes": ["selser"],
27798 "scrubWikitext": true,
27799 "changes": [
27800 [ "td", "html", "-" ]
27801 ]
27802 }
27803 !! wikitext
27804 {|
27805 |a||b
27806 |}
27807 !! wikitext/edited
27808 {|
27809 | -||-
27810 |}
27811 !! end
27812
27813 ## This tests normalizer's ability to not be tripped by
27814 ## comments (and whitespace)
27815 !! test
27816 4c. Table cells without escapable prefixes after edits
27817 !! options
27818 parsoid={
27819 "modes": ["selser"],
27820 "scrubWikitext": true,
27821 "changes": [
27822 [ "table tbody tr td:first-child", "remove" ]
27823 ]
27824 }
27825 !! wikitext
27826 {|
27827 |-
27828 <!--foo--> |a||-
27829 |}
27830 !! wikitext/edited
27831 {|
27832 |-
27833 <!--foo--> | -
27834 |}
27835 !! end
27836
27837 ## This tests normalizer's ability to handle HTML cells
27838 !! test
27839 4d. Table cells without escapable prefixes after edits
27840 !! options
27841 parsoid={
27842 "modes": ["selser"],
27843 "scrubWikitext": true,
27844 "changes": [
27845 [ "td", "html", "-" ]
27846 ]
27847 }
27848 !! wikitext
27849 <table>
27850 <tr><td>a</td></tr>
27851 </table>
27852 !! wikitext/edited
27853 <table>
27854 <tr><td>-</td></tr>
27855 </table>
27856 !! end
27857
27858 ## T111151 Remove font elements without attributes
27859 !! test
27860 5a. font tags without attributes should be dropped in scrubWikitext mode
27861 !! options
27862 parsoid={
27863 "modes": ["html2wt"],
27864 "scrubWikitext": true
27865 }
27866 !! html
27867 <font>foo</font>
27868 <font><font>bar</font></font>
27869 <font class="x">boo</font>
27870 !! wikitext
27871 foo
27872 bar
27873 <font class="x">boo</font>
27874 !! end
27875
27876 !! test
27877 5b. font tags should not be dropped without scrubWikitext being enabled
27878 !! options
27879 parsoid={
27880 "modes": ["html2wt"],
27881 "scrubWikitext": false
27882 }
27883 !! html
27884 <font>foo</font>
27885 !! wikitext
27886 <font>foo</font>
27887 !! end
27888
27889 !! test
27890 Escape nowiki DOM elements
27891 !! options
27892 parsoid=html2wt
27893 !! html/parsoid
27894 <nowiki><i>foo</i></nowiki>
27895 !! wikitext
27896 &lt;nowiki&gt;''foo''&lt;/nowiki&gt;
27897 !! end
27898
27899 # This is meant to be an interim fix while we go about figuring out
27900 # how to not introduce these trailing <nowiki/>s in the first place.
27901 !! test
27902 T115717: Strip trailing <nowiki/>s (without affecting valid uses)
27903 !! options
27904 parsoid=html2wt
27905 !! html/parsoid
27906 <p>x<meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/>
27907 y</p>
27908 <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>
27909 <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>
27910 !! wikitext
27911 x
27912 y
27913
27914 {{echo|
27915 1 = <nowiki/>}}
27916
27917 {{echo|
27918 1 = <nowiki/>
27919 }}
27920 !! end
27921
27922 # ---------------------------------------------------
27923 # End of tests spec'ing wikitext serialization norms |
27924 # ---------------------------------------------------
27925
27926 # T104032
27927 !! test
27928 Bare inline nodes not wrapped inside p-tags should be treated as p-wrapped
27929 !! options
27930 parsoid=html2wt
27931 !! html/parsoid
27932 a<p>b</p>
27933 <b>c</b><p>d</p>
27934 <table><tr>
27935 <td>a<p>b</p></td>
27936 <td><b>c</b><p>d</p></td>
27937 </tr></table>
27938 !! wikitext
27939 a
27940
27941 b
27942
27943 '''c'''
27944
27945 d
27946 {|
27947 |a
27948 b
27949 |'''c'''
27950 d
27951 |}
27952 !! end
27953
27954 # -----------------------------------------------------------------
27955 # End of section for Parsoid-only html2wt tests for serialization
27956 # of new content
27957 # -----------------------------------------------------------------
27958
27959 # -----------------------------------------------------------------
27960 # The following section of tests are primarily to spec behavior of
27961 # the selective serializer. All these tests have manual selser
27962 # changes. The automated selser changes for all tests handle the
27963 # wide variation of changes, but these tests here capture specs
27964 # deterministically.
27965 # ----------------------------------------------------------------
27966
27967 ## T90517
27968 !! test
27969 Selser: New comments should not be lost
27970 !! options
27971 parsoid={
27972 "modes": ["selser"],
27973 "changes": [
27974 [ "#a", "after", "<!--c1-->" ],
27975 [ "#b", "before", "<!--c2-->" ]
27976 ]
27977 }
27978 !! wikitext
27979 <span id="a">a</span>
27980
27981 <span id="b">b</span>
27982 !! wikitext/edited
27983 <span id="a">a</span><!--c1-->
27984
27985 <!--c2--><span id="b">b</span>
27986 !! end
27987
27988 ## T89383
27989 !! test
27990 Selser: Check for validity of DSR before using it
27991 !! options
27992 parsoid={
27993 "modes": ["selser"],
27994 "changes": [
27995 [ "#a", "before", "<meta property='mw:PageProp/displaytitle' content='foo'>" ]
27996 ]
27997 }
27998 !! wikitext
27999 <span id="a">a</span>
28000 !! wikitext/edited
28001 {{DISPLAYTITLE:foo}}
28002 <span id="a">a</span>
28003 !! end
28004
28005 !! test
28006 1. DOMDiff: Changes to <ref> content should be looked up using id
28007 !! options
28008 parsoid={
28009 "modes": ["selser"],
28010 "changes": [
28011 ["#X", "after", "bar"],
28012 ["#Y", "after", "baz"]
28013 ]
28014 }
28015 !! wikitext
28016 X <ref><span id="X">foo</span></ref>
28017 Y <ref name="a" />
28018 <references>
28019 <ref name="a"><span id="Y">foo</span></ref>
28020 </references>
28021 !! wikitext/edited
28022 X <ref><span id="X">foo</span>bar</ref>
28023 Y <ref name="a" />
28024 <references>
28025 <ref name="a"><span id="Y">foo</span>baz</ref>
28026 </references>
28027 !! end
28028
28029 !! test
28030 2. DOMDiff: Changes to <ref> content should be looked up using id
28031 !! options
28032 parsoid={
28033 "modes": ["selser"],
28034 "changes": [
28035 ["#Z", "after", "bar"]
28036 ]
28037 }
28038 !! wikitext
28039 A <ref>foo bar for a</ref>
28040 B <ref group="X" name="b" />
28041
28042 <references />
28043
28044 <references group="X">
28045 <ref name="b"><span id="Z">foo</span></ref>
28046 </references>
28047 !! wikitext/edited
28048 A <ref>foo bar for a</ref>
28049 B <ref group="X" name="b" />
28050
28051 <references />
28052
28053 <references group="X">
28054 <ref name="b"><span id="Z">foo</span>bar</ref>
28055 </references>
28056 !! end
28057
28058 !! test
28059 DOMDiff: Edits to content nested in elements with templated attributes should not be lost (T139388)
28060 !! options
28061 parsoid={
28062 "modes": ["selser"],
28063 "changes": [
28064 [ "div:first-child", "text", "bar" ]
28065 ]
28066 }
28067 !! wikitext
28068 <div style="{{1x|color:red;}}%">foo</div>
28069 !! wikitext/edited
28070 <div style="{{1x|color:red;}}%">bar</div>
28071 !! end
28072
28073 !! test
28074 Empty LI (T49673)
28075 !! wikitext
28076 * a
28077 *
28078 *
28079 * b
28080 !! html/php+tidy
28081 <ul>
28082 <li>a</li>
28083 <li class="mw-empty-elt"></li>
28084 <li class="mw-empty-elt"></li>
28085 <li>b</li>
28086 </ul>
28087 !! end
28088
28089 !! test
28090 Thumbnail output
28091 !! wikitext
28092 [[File:Thumb.png|thumb]]
28093 !! html/php+tidy
28094 <div class="thumb tright">
28095 <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>
28096 <div class="thumbcaption">
28097 <div class="magnify"><a href="/wiki/File:Thumb.png" class="internal" title="Enlarge"></a></div>
28098 </div>
28099 </div>
28100 </div>
28101 !! end
28102
28103 !! test
28104 unclosed internal link XSS (T137264)
28105 !! wikitext
28106 [[#%3Cscript%3Ealert(1)%3C/script%3E|
28107 !! html/php
28108 <p>[[#&lt;script&gt;alert(1)&lt;/script&gt;|
28109 </p>
28110 !! html/parsoid
28111 <p>[[#%3Cscript%3Ealert(1)%3C/script%3E|</p>
28112 !! end